tiny-essentials 1.28.1 → 1.28.2

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 (211) hide show
  1. package/changelog/1/28/2.md +43 -0
  2. package/dist/_/numbers.d.mts +91 -16
  3. package/dist/v1/TinyBasicsEs.min.js +1 -1
  4. package/dist/v1/TinyEssentials.min.js +1 -1
  5. package/dist/v1/TinyMediaPlayer.min.js +1 -1
  6. package/dist/v1/TinyRadioFm.min.js +1 -1
  7. package/dist/v1/basics/array.d.mts +14 -14
  8. package/dist/v1/basics/clock.cjs +15 -15
  9. package/dist/v1/basics/clock.d.mts +21 -21
  10. package/dist/v1/basics/clock.mjs +15 -15
  11. package/dist/v1/basics/collision.d.mts +245 -104
  12. package/dist/v1/basics/deprecated/html.d.mts +33 -33
  13. package/dist/v1/basics/extendObjType/Buffer.d.mts +1 -1
  14. package/dist/v1/basics/fullScreen.d.mts +47 -7
  15. package/dist/v1/basics/html.d.mts +52 -61
  16. package/dist/v1/basics/index.d.mts +11 -67
  17. package/dist/v1/basics/mediaContent.cjs +65 -23
  18. package/dist/v1/basics/mediaContent.d.mts +144 -73
  19. package/dist/v1/basics/mediaContent.mjs +65 -23
  20. package/dist/v1/basics/objChecker.d.mts +2 -2
  21. package/dist/v1/basics/objFilter.cjs +31 -7
  22. package/dist/v1/basics/objFilter.d.mts +10 -13
  23. package/dist/v1/basics/objFilter.mjs +31 -7
  24. package/dist/v1/basics/simpleMath.d.mts +21 -21
  25. package/dist/v1/basics/text.d.mts +34 -46
  26. package/dist/v1/build/ColorSafeStringify.d.mts +1 -1
  27. package/dist/v1/build/TinyAdvancedRaffle.d.mts +1 -1
  28. package/dist/v1/build/TinyAfterScrollWatcher.d.mts +1 -1
  29. package/dist/v1/build/TinyAnalogClock.d.mts +1 -1
  30. package/dist/v1/build/TinyArrayComparator.d.mts +1 -1
  31. package/dist/v1/build/TinyArrayPaginator.d.mts +1 -1
  32. package/dist/v1/build/TinyClassManager.d.mts +1 -1
  33. package/dist/v1/build/TinyClipboard.d.mts +1 -1
  34. package/dist/v1/build/TinyColorConverter.d.mts +1 -1
  35. package/dist/v1/build/TinyColorValidator.d.mts +1 -1
  36. package/dist/v1/build/TinyCookieConsent.d.mts +1 -1
  37. package/dist/v1/build/TinyDayNightCycle.d.mts +1 -1
  38. package/dist/v1/build/TinyDomReadyManager.d.mts +1 -1
  39. package/dist/v1/build/TinyDragDropDetector.d.mts +1 -1
  40. package/dist/v1/build/TinyDragger.d.mts +1 -1
  41. package/dist/v1/build/TinyElementObserver.d.mts +1 -1
  42. package/dist/v1/build/TinyGamepad.d.mts +1 -1
  43. package/dist/v1/build/TinyHtml.d.mts +1 -1
  44. package/dist/v1/build/TinyI18.d.mts +1 -1
  45. package/dist/v1/build/TinyIframeEvents.d.mts +1 -1
  46. package/dist/v1/build/TinyInventory.d.mts +1 -1
  47. package/dist/v1/build/TinyInventoryTrader.d.mts +1 -1
  48. package/dist/v1/build/TinyLevelUp.d.mts +1 -1
  49. package/dist/v1/build/TinyLoadingScreen.d.mts +1 -1
  50. package/dist/v1/build/TinyLocalStorage.d.mts +1 -1
  51. package/dist/v1/build/TinyMediaPlayer.d.mts +1 -1
  52. package/dist/v1/build/TinyNeedBar.d.mts +1 -1
  53. package/dist/v1/build/TinyNewWinEvents.d.mts +1 -1
  54. package/dist/v1/build/TinyNotifications.d.mts +1 -1
  55. package/dist/v1/build/TinyNotifyCenter.d.mts +1 -1
  56. package/dist/v1/build/TinyPromiseQueue.d.mts +1 -1
  57. package/dist/v1/build/TinyRadioFm.d.mts +1 -1
  58. package/dist/v1/build/TinyRateLimiter.d.mts +1 -1
  59. package/dist/v1/build/TinySimpleDice.d.mts +1 -1
  60. package/dist/v1/build/TinySmartScroller.d.mts +1 -1
  61. package/dist/v1/build/TinyTextDiffer.d.mts +1 -1
  62. package/dist/v1/build/TinyTextRangeEditor.d.mts +1 -1
  63. package/dist/v1/build/TinyTextarea.d.mts +1 -1
  64. package/dist/v1/build/TinyTimeout.d.mts +1 -1
  65. package/dist/v1/build/TinyToastNotify.d.mts +1 -1
  66. package/dist/v1/build/TinyUploadClicker.d.mts +1 -1
  67. package/dist/v1/build/UltraRandomMsgGen.d.mts +1 -1
  68. package/dist/v1/fileManager/asyncFuncs.d.mts +13 -13
  69. package/dist/v1/fileManager/index.d.mts +3 -29
  70. package/dist/v1/fileManager/normalFuncs.d.mts +22 -22
  71. package/dist/v1/index.d.mts +53 -139
  72. package/dist/v1/libs/ColorSafeStringify.d.mts +3 -12
  73. package/dist/v1/libs/TinyAdvancedRaffle.d.mts +60 -103
  74. package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +11 -18
  75. package/dist/v1/libs/TinyAnalogClock.d.mts +8 -11
  76. package/dist/v1/libs/TinyArrayComparator.d.mts +14 -20
  77. package/dist/v1/libs/TinyArrayPaginator.d.mts +22 -26
  78. package/dist/v1/libs/TinyClassManager/TinyPluginInliner.d.mts +8 -8
  79. package/dist/v1/libs/TinyClassManager.cjs +5 -7
  80. package/dist/v1/libs/TinyClassManager.d.mts +16 -16
  81. package/dist/v1/libs/TinyClassManager.mjs +5 -6
  82. package/dist/v1/libs/TinyClipboard.d.mts +8 -3
  83. package/dist/v1/libs/TinyColorConverter.d.mts +8 -31
  84. package/dist/v1/libs/TinyColorValidator.d.mts +145 -184
  85. package/dist/v1/libs/TinyCookieConsent.d.mts +17 -17
  86. package/dist/v1/libs/TinyDayNightCycle.d.mts +85 -110
  87. package/dist/v1/libs/TinyDomReadyManager.d.mts +8 -16
  88. package/dist/v1/libs/TinyDragDropDetector.d.mts +30 -30
  89. package/dist/v1/libs/TinyDragger.d.mts +82 -81
  90. package/dist/v1/libs/TinyElementObserver.d.mts +25 -28
  91. package/dist/v1/libs/TinyGamepad.cjs +0 -1
  92. package/dist/v1/libs/TinyGamepad.d.mts +50 -122
  93. package/dist/v1/libs/TinyGamepad.mjs +0 -1
  94. package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.cjs +2 -25
  95. package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.d.mts +19 -25
  96. package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.mjs +3 -27
  97. package/dist/v1/libs/TinyHtml/TinyHtmlButton.cjs +2 -1
  98. package/dist/v1/libs/TinyHtml/TinyHtmlButton.d.mts +55 -55
  99. package/dist/v1/libs/TinyHtml/TinyHtmlButton.mjs +2 -1
  100. package/dist/v1/libs/TinyHtml/TinyHtmlCanvas.d.mts +6 -6
  101. package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.cjs +8 -4
  102. package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.d.mts +19 -21
  103. package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.mjs +7 -4
  104. package/dist/v1/libs/TinyHtml/TinyHtmlEmbed.d.mts +8 -8
  105. package/dist/v1/libs/TinyHtml/TinyHtmlForm.d.mts +18 -18
  106. package/dist/v1/libs/TinyHtml/TinyHtmlIcon.d.mts +5 -6
  107. package/dist/v1/libs/TinyHtml/TinyHtmlIframe.d.mts +19 -19
  108. package/dist/v1/libs/TinyHtml/TinyHtmlImage.cjs +0 -28
  109. package/dist/v1/libs/TinyHtml/TinyHtmlImage.d.mts +22 -28
  110. package/dist/v1/libs/TinyHtml/TinyHtmlImage.mjs +1 -27
  111. package/dist/v1/libs/TinyHtml/TinyHtmlInput.d.mts +11 -11
  112. package/dist/v1/libs/TinyHtml/TinyHtmlLink.d.mts +23 -23
  113. package/dist/v1/libs/TinyHtml/TinyHtmlMedia.d.mts +26 -26
  114. package/dist/v1/libs/TinyHtml/TinyHtmlScript.cjs +4 -30
  115. package/dist/v1/libs/TinyHtml/TinyHtmlScript.d.mts +20 -26
  116. package/dist/v1/libs/TinyHtml/TinyHtmlScript.mjs +5 -32
  117. package/dist/v1/libs/TinyHtml/TinyHtmlSelect.d.mts +19 -19
  118. package/dist/v1/libs/TinyHtml/TinyHtmlStyle.d.mts +8 -8
  119. package/dist/v1/libs/TinyHtml/TinyHtmlTemplate.d.mts +26 -28
  120. package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.cjs +14 -15
  121. package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.d.mts +32 -32
  122. package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.mjs +15 -15
  123. package/dist/v1/libs/TinyHtml/index.d.mts +102 -45
  124. package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.cjs +11 -9
  125. package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.d.mts +21 -21
  126. package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.mjs +11 -9
  127. package/dist/v1/libs/TinyHtml/input/TinyHtmlFileInput.d.mts +11 -11
  128. package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.cjs +4 -4
  129. package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.d.mts +17 -13
  130. package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.mjs +4 -4
  131. package/dist/v1/libs/TinyHtml/input/TinyHtmlImageInput.d.mts +21 -21
  132. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.cjs +5 -4
  133. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.d.mts +14 -14
  134. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.mjs +5 -4
  135. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.cjs +4 -3
  136. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.d.mts +10 -10
  137. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.mjs +4 -3
  138. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.cjs +4 -3
  139. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.d.mts +19 -19
  140. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.mjs +4 -3
  141. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.cjs +5 -4
  142. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.d.mts +11 -11
  143. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.mjs +5 -4
  144. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.cjs +4 -3
  145. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.d.mts +15 -11
  146. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.mjs +4 -3
  147. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.cjs +49 -21
  148. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.d.mts +34 -20
  149. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.mjs +45 -20
  150. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.cjs +1 -1
  151. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.d.mts +14 -14
  152. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.mjs +1 -1
  153. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.cjs +1 -1
  154. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.d.mts +14 -14
  155. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.mjs +1 -1
  156. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.cjs +48 -25
  157. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.d.mts +27 -21
  158. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.mjs +40 -27
  159. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.cjs +1 -1
  160. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.d.mts +14 -14
  161. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.mjs +1 -1
  162. package/dist/v1/libs/TinyHtml/input/number/TinyHtmlNumberInput.d.mts +14 -14
  163. package/dist/v1/libs/TinyHtml/input/number/TinyHtmlRangeInput.d.mts +14 -14
  164. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlEmailInput.d.mts +25 -21
  165. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlPasswordInput.d.mts +18 -18
  166. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlSearchInput.d.mts +33 -29
  167. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlTelInput.d.mts +22 -22
  168. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlTextInput.d.mts +18 -18
  169. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlUrlInput.d.mts +31 -27
  170. package/dist/v1/libs/TinyHtml/media/TinyHtmlAudio.d.mts +35 -11
  171. package/dist/v1/libs/TinyHtml/media/TinyHtmlObject.d.mts +10 -10
  172. package/dist/v1/libs/TinyHtml/media/TinyHtmlSource.d.mts +12 -12
  173. package/dist/v1/libs/TinyHtml/media/TinyHtmlVideo.d.mts +35 -27
  174. package/dist/v1/libs/TinyHtml.cjs +3 -4
  175. package/dist/v1/libs/TinyHtml.d.mts +1503 -1731
  176. package/dist/v1/libs/TinyHtml.mjs +3 -4
  177. package/dist/v1/libs/TinyI18.d.mts +23 -61
  178. package/dist/v1/libs/TinyIframeEvents.cjs +1 -1
  179. package/dist/v1/libs/TinyIframeEvents.d.mts +29 -38
  180. package/dist/v1/libs/TinyIframeEvents.mjs +1 -1
  181. package/dist/v1/libs/TinyInventory.d.mts +78 -141
  182. package/dist/v1/libs/TinyInventoryTrader.d.mts +19 -22
  183. package/dist/v1/libs/TinyLevelUp.d.mts +10 -13
  184. package/dist/v1/libs/TinyLoadingScreen.d.mts +21 -31
  185. package/dist/v1/libs/TinyLocalStorage.d.mts +11 -36
  186. package/dist/v1/libs/TinyMamdaniInferenceSystem.d.mts +37 -23
  187. package/dist/v1/libs/TinyMediaPlayer.cjs +5 -3
  188. package/dist/v1/libs/TinyMediaPlayer.d.mts +102 -109
  189. package/dist/v1/libs/TinyMediaPlayer.mjs +5 -3
  190. package/dist/v1/libs/TinyNeedBar.d.mts +25 -37
  191. package/dist/v1/libs/TinyNewWinEvents.d.mts +29 -32
  192. package/dist/v1/libs/TinyNotifications.d.mts +6 -6
  193. package/dist/v1/libs/TinyNotifyCenter.d.mts +15 -21
  194. package/dist/v1/libs/TinyPromiseQueue.d.mts +11 -11
  195. package/dist/v1/libs/TinyRadioFm.cjs +32 -12
  196. package/dist/v1/libs/TinyRadioFm.d.mts +44 -80
  197. package/dist/v1/libs/TinyRadioFm.mjs +29 -12
  198. package/dist/v1/libs/TinyRateLimiter.d.mts +26 -39
  199. package/dist/v1/libs/TinySimpleDice.d.mts +17 -36
  200. package/dist/v1/libs/TinySmartScroller.d.mts +50 -60
  201. package/dist/v1/libs/TinyTextDiffer.d.mts +11 -14
  202. package/dist/v1/libs/TinyTextRangeEditor.d.mts +8 -8
  203. package/dist/v1/libs/TinyTextarea.d.mts +31 -31
  204. package/dist/v1/libs/TinyTimeout.d.mts +14 -14
  205. package/dist/v1/libs/TinyToastNotify.cjs +1 -1
  206. package/dist/v1/libs/TinyToastNotify.d.mts +15 -23
  207. package/dist/v1/libs/TinyToastNotify.mjs +1 -1
  208. package/dist/v1/libs/TinyUploadClicker.d.mts +38 -14
  209. package/dist/v1/libs/UltraRandomMsgGen.d.mts +44 -84
  210. package/dist/v1/libs/utils.d.mts +5 -1
  211. package/package.json +2 -2
@@ -1,43 +1,10 @@
1
- /** @type {Map<string, number>} */
2
- export const _blobCounter: Map<string, number>;
3
- export function getMediaContentBase(): MediaContentBase;
4
- export function getMediaContentMetadata(): MediaContentMetadata;
5
1
  /**
6
- * Custom error class to provide detailed context during the content preparation process.
7
- * @extends Error
2
+ * A type representing either a static string or a function that returns a string, used to resolve an unknown artist's name.
3
+ * @typedef {string|(() => string)} UnknownArtistGetter
8
4
  */
9
- export class MediaLoadingError extends Error {
10
- /**
11
- * @param {string} message - Human-readable error message.
12
- * @param {string} url - The URL that caused the error.
13
- * @param {LoadingErrorStage} stage - The stage where the error occurred.
14
- */
15
- constructor(message: string, url: string, stage: LoadingErrorStage);
16
- url: string;
17
- stage: LoadingErrorStage;
18
- }
19
- export function generateSimpleHash(str: string): Promise<string>;
20
- export function convertToBlobUrl(data: Uint8Array | string, format?: string): string;
21
- export function blobUrlToBase64(url: string): Promise<string>;
22
- export function revokeContentUrls(content: MediaContent): void;
23
- export function valMediaContentMetadata(common: ContentMetadataTemplate<IPictureTemplate<string | Uint8Array<ArrayBufferLike>>>): void;
24
- export function valMediaContentMetadataPartial(common: Partial<ContentMetadataTemplate<IPictureTemplate<string | Uint8Array<ArrayBufferLike>>>>): void;
25
- export function extractMediaId3Tags(url: string, parseFile: ParseMediaContentMetadata): Promise<MediaContentMetadata>;
26
- export function parseMediaMetadata(source: string | HTMLMediaElement, defaultMetadata?: Partial<MediaContentBase & MediaContentMetadata> & {
27
- id?: string;
28
- weight?: number;
29
- }, metadata?: Partial<MediaContentBase & MediaContentMetadata> & {
30
- id?: string;
31
- weight?: number;
32
- }, parseFile?: ParseMediaContentMetadata, callbacks?: {
33
- onProgress?: ((progress: LoadingMediaProgress) => void) | undefined;
34
- onError?: ((error: MediaLoadingErrorData) => void) | undefined;
35
- }, unknownArtist?: UnknownArtistGetter): Promise<MediaContent>;
36
5
  export type UnknownArtistGetter = string | (() => string);
37
- /**
38
- * Represents an image attachment template.
39
- */
40
- export type IPictureTemplate<PictureData extends Uint8Array | string> = {
6
+ export type PictureDataType = Uint8Array | string;
7
+ export type IPictureTemplate<PictureData extends PictureDataType> = {
41
8
  /**
42
9
  * - The MIME type of the image (e.g., 'image/jpeg').
43
10
  */
@@ -49,31 +16,22 @@ export type IPictureTemplate<PictureData extends Uint8Array | string> = {
49
16
  /**
50
17
  * - An optional textual description of the image.
51
18
  */
52
- description?: string | undefined;
19
+ description?: string;
53
20
  /**
54
21
  * - The specific type of picture (e.g., 'cover', 'front', 'back').
55
22
  */
56
- type?: string | undefined;
23
+ type?: string;
57
24
  /**
58
25
  * - The filename associated with the image.
59
26
  */
60
- name?: string | undefined;
27
+ name?: string;
61
28
  };
62
- /**
63
- * Represents an image attachment, such as album art.
64
- */
65
29
  export type IPicture = IPictureTemplate<string>;
66
- /**
67
- * A numeric structure representing track or disk indexing.
68
- */
69
30
  export type MediaNumber = {
70
31
  no: number | null;
71
32
  of: number | null;
72
33
  };
73
- /**
74
- * This metadata structure is modeled template.
75
- */
76
- export type ContentMetadataTemplate<IPictureContent extends IPictureTemplate<Uint8Array | string>> = {
34
+ export type ContentMetadataTemplate<IPictureContent extends IPictureTemplate<PictureDataType>> = {
77
35
  /**
78
36
  * - The title of the track.
79
37
  */
@@ -125,16 +83,9 @@ export type ContentMetadataTemplate<IPictureContent extends IPictureTemplate<Uin
125
83
  /**
126
84
  * - An array of picture objects containing album art.
127
85
  */
128
- picture?: IPictureContent[] | undefined;
86
+ picture?: IPictureContent[];
129
87
  };
130
- /**
131
- * This metadata structure is modeled after the standard output of the
132
- * `music-metadata@11.13.0` npm package.
133
- */
134
- export type MediaContentMetadata = ContentMetadataTemplate<IPicture>;
135
- /**
136
- * The core properties required for any content item within the media system.
137
- */
88
+ export type MediaContentMetadata<PictureData extends PictureDataType> = ContentMetadataTemplate<IPictureTemplate<PictureData>>;
138
89
  export type MediaContentBase = {
139
90
  /**
140
91
  * - Unique identifier.
@@ -159,24 +110,17 @@ export type MediaContentBase = {
159
110
  /**
160
111
  * - Probability multiplier for random selection mode.
161
112
  */
162
- weight?: number | undefined;
113
+ weight?: number;
163
114
  };
164
- /**
165
- * The final content object used within the media, combining
166
- * core playback properties with rich metadata.
167
- */
168
- export type MediaContent = MediaContentBase & MediaContentMetadata;
169
- /**
170
- * A promise that resolves to an object containing the extracted metadata.
171
- */
115
+ export type MediaContent<PictureData extends PictureDataType> = MediaContentBase & MediaContentMetadata<PictureData>;
172
116
  export type ParseMediaContentMetadata = (data: Blob) => Promise<{
173
- common: Partial<ContentMetadataTemplate<IPictureTemplate<Uint8Array | string>>>;
117
+ common: Partial<ContentMetadataTemplate<IPictureTemplate<PictureDataType>>>;
174
118
  }>;
175
119
  export type LoadingMediaProgress = {
176
120
  /**
177
121
  * - The current status of the operation.
178
122
  */
179
- status: "loading" | "success";
123
+ status: 'loading' | 'success';
180
124
  /**
181
125
  * - The current execution stage.
182
126
  */
@@ -184,14 +128,14 @@ export type LoadingMediaProgress = {
184
128
  /**
185
129
  * - The current loading event.
186
130
  */
187
- event?: ProgressEvent<EventTarget> | undefined;
131
+ event?: ProgressEvent<EventTarget>;
188
132
  /**
189
133
  * - The URL being processed.
190
134
  */
191
135
  url: string;
192
136
  };
193
- export type LoadingProgressStage = "INITIALIZING" | "DOWNLOADING" | "METADATA_LOADED" | "EXTRACTING_ID3" | "COMPLETE";
194
- export type LoadingErrorStage = "INITIALIZING" | "DOWNLOADING" | "METADATA" | "ID3" | "UNKNOWN";
137
+ export type LoadingProgressStage = 'INITIALIZING' | 'DOWNLOADING' | 'METADATA_LOADED' | 'EXTRACTING_ID3' | 'COMPLETE';
138
+ export type LoadingErrorStage = 'INITIALIZING' | 'DOWNLOADING' | 'METADATA' | 'ID3' | 'UNKNOWN';
195
139
  export type MediaLoadingErrorData = {
196
140
  /**
197
141
  * - The original error object.
@@ -206,4 +150,131 @@ export type MediaLoadingErrorData = {
206
150
  */
207
151
  stage: LoadingErrorStage;
208
152
  };
153
+ /** @type {Map<string, number>} */
154
+ export declare const _blobCounter: Map<string, number>;
155
+ /**
156
+ * Returns a new object initialized with the default values for the core media content properties.
157
+ * @returns {MediaContentBase}
158
+ */
159
+ export declare const getMediaContentBase: () => MediaContentBase;
160
+ /**
161
+ * Returns a new object initialized with the default values for the media content metadata properties.
162
+ * @returns {MediaContentMetadata<PictureDataType>}
163
+ */
164
+ export declare const getMediaContentMetadata: () => MediaContentMetadata<PictureDataType>;
165
+ /**
166
+ * Custom error class to provide detailed context during the content preparation process.
167
+ * @extends Error
168
+ */
169
+ export declare class MediaLoadingError extends Error {
170
+ url: string;
171
+ stage: LoadingErrorStage;
172
+ /**
173
+ * @param {string} message - Human-readable error message.
174
+ * @param {string} url - The URL that caused the error.
175
+ * @param {LoadingErrorStage} stage - The stage where the error occurred.
176
+ */
177
+ constructor(message: string, url: string, stage: LoadingErrorStage);
178
+ }
179
+ /**
180
+ * Internal helper to generate a deterministic ID from a string.
181
+ * @param {string} str
182
+ * @returns {Promise<string>}
183
+ * @private
184
+ */
185
+ export declare const generateSimpleHash: (str: string) => Promise<string>;
186
+ /**
187
+ * Helper to convert Uint8Array or Base64 string directly into a high performance Blob URL.
188
+ * @param {PictureDataType} data
189
+ * @param {string} format
190
+ * @returns {string} The generated Blob URL or original string if already valid.
191
+ */
192
+ export declare const convertToBlobUrl: (data: PictureDataType, format?: string) => string;
193
+ /**
194
+ * Asynchronous helper to convert a Blob URL back to Base64 (Date URL) at export time.
195
+ * @param {string} url
196
+ * @returns {Promise<string>}
197
+ */
198
+ export declare const blobUrlToBase64: (url: string) => Promise<string>;
199
+ /**
200
+ * Safely revokes Blob URLs to prevent memory leaks from createObjectURL.
201
+ * @template {PictureDataType} PictureData
202
+ * @param {MediaContent<PictureData>} content
203
+ */
204
+ export declare const revokeContentUrls: <PictureData extends PictureDataType>(content: MediaContent<PictureData>) => void;
205
+ /**
206
+ * Helper to validate types within the media content metadata object.
207
+ * This ensures that if a property is present, it matches the expected type.
208
+ * @param {ContentMetadataTemplate<IPictureTemplate<string | Uint8Array<ArrayBufferLike>>>} common
209
+ */
210
+ export declare const valMediaContentMetadata: (common: ContentMetadataTemplate<IPictureTemplate<string | Uint8Array<ArrayBufferLike>>>) => void;
211
+ /**
212
+ * Helper to validate types within the media content metadata object.
213
+ * Allows the absence of properties (useful for updates/patch).
214
+ * @param {Partial<ContentMetadataTemplate<IPictureTemplate<string | Uint8Array<ArrayBufferLike>>>>} common
215
+ */
216
+ export declare const valMediaContentMetadataPartial: (common: Partial<ContentMetadataTemplate<IPictureTemplate<string | Uint8Array<ArrayBufferLike>>>>) => void;
217
+ /**
218
+ * Downloads an audio file from a URL and extracts its ID3/metadata tags.
219
+ *
220
+ * @param {string} url - The full URL of the audio file to be downloaded.
221
+ * @param {ParseMediaContentMetadata} parseFile - The function used to parse the file data.
222
+ * @returns {Promise<MediaContentMetadata<string>>} A promise that resolves to an object containing the extracted metadata.
223
+ * @throws {TypeError} If the provided `url` is not a string or `parseFile` is not a function.
224
+ * @throws {Error} If the network request fails or the parsing process encounters an error.
225
+ */
226
+ export declare const extractMediaId3Tags: (url: string, parseFile: ParseMediaContentMetadata) => Promise<MediaContentMetadata<string>>;
227
+ /**
228
+ * A Static Factory Method that prepares a MediaContent object by
229
+ * extracting metadata from an audio source.
230
+ *
231
+ * @template {PictureDataType} PictureData
232
+ * @param {string | HTMLMediaElement} source - A URL string or an existing Audio object.
233
+ * @param {Partial<MediaContentBase & MediaContentMetadata<PictureData>> & { id?: string; weight?: number }} [defaultMetadata={}] - Optional default metadata that overrides automatic extraction.
234
+ * @param {Partial<MediaContentBase & MediaContentMetadata<PictureData>> & { id?: string; weight?: number }} [metadata={}] - Optional manual metadata that overrides automatic extraction.
235
+ * @param {ParseMediaContentMetadata} [parseFile] - Private helper to interface with parseFile.
236
+ * @param {Object} [callbacks={}] - Callbacks for monitoring the loading process.
237
+ * @param {(progress: LoadingMediaProgress) => void} [callbacks.onProgress] - Callback triggered on stage changes.
238
+ * @param {(error: MediaLoadingErrorData) => void} [callbacks.onError] - Callback triggered when a non-fatal or fatal error occurs.
239
+ * @param {UnknownArtistGetter} unknownArtist
240
+ * @returns {Promise<MediaContent<PictureData>>} A promise that resolves to a valid MediaContent object.
241
+ * @throws {MediaLoadingError} If the preparation process fails at any stage.
242
+ *
243
+ * @example
244
+ * // Usage with URL
245
+ * import { parseBlob } from 'music-metadata';
246
+ * const track = await parseMediaMetadata('/assets/song.mp3', {}, { title: 'My Song', artist: 'Artist' }, parseBlob);
247
+ * media.add('music', track);
248
+ *
249
+ * @example
250
+ * // Usage with Audio Object
251
+ * import { parseBlob } from 'music-metadata';
252
+ * const audio = new Audio();
253
+ * audio.src = '/assets/song.mp3';
254
+ * const track = await parseMediaMetadata(audio, {}, {}, parseBlob);
255
+ * media.add('music', track);
256
+ *
257
+ * @example
258
+ * // Usage with tracking
259
+ * const track = await parseMediaMetadata(
260
+ * '/assets/song.mp3',
261
+ * {},
262
+ * {},
263
+ * parseBlob,
264
+ * {
265
+ * onProgress: (p) => console.log(`[${p.stage}] ${p.status}`),
266
+ * onError: (e) => console.error(`Failed at ${e.stage} for ${e.url}: ${e.error.message}`)
267
+ * }
268
+ * );
269
+ */
270
+ export declare const parseMediaMetadata: <PictureData extends PictureDataType>(source: string | HTMLMediaElement, defaultMetadata?: Partial<MediaContentBase & MediaContentMetadata<PictureData>> & {
271
+ id?: string;
272
+ weight?: number;
273
+ }, metadata?: Partial<MediaContentBase & MediaContentMetadata<PictureData>> & {
274
+ id?: string;
275
+ weight?: number;
276
+ }, parseFile?: ParseMediaContentMetadata, callbacks?: {
277
+ onProgress?: (progress: LoadingMediaProgress) => void;
278
+ onError?: (error: MediaLoadingErrorData) => void;
279
+ }, unknownArtist?: UnknownArtistGetter) => Promise<MediaContent<PictureData>>;
209
280
  //# sourceMappingURL=mediaContent.d.mts.map
@@ -1,9 +1,14 @@
1
1
  /**
2
+ * A type representing either a static string or a function that returns a string, used to resolve an unknown artist's name.
2
3
  * @typedef {string|(() => string)} UnknownArtistGetter
3
4
  */
5
+ /**
6
+ * Represents the data type for images, which can be raw binary (Uint8Array) or a string (such as a Blob URL or Data URL).
7
+ * @typedef {Uint8Array|string} PictureDataType
8
+ */
4
9
  /**
5
10
  * Represents an image attachment template.
6
- * @template {Uint8Array|string} PictureData
11
+ * @template {PictureDataType} PictureData
7
12
  * @typedef {Object} IPictureTemplate
8
13
  * @property {string} format - The MIME type of the image (e.g., 'image/jpeg').
9
14
  * @property {PictureData} data - The raw binary data of the image.
@@ -22,7 +27,7 @@
22
27
  /**
23
28
  * This metadata structure is modeled template.
24
29
  *
25
- * @template {IPictureTemplate<Uint8Array|string>} IPictureContent
30
+ * @template {IPictureTemplate<PictureDataType>} IPictureContent
26
31
  * @typedef {Object} ContentMetadataTemplate
27
32
  * @property {string|null} title - The title of the track.
28
33
  * @property {string|null} album - The name of the album.
@@ -42,7 +47,8 @@
42
47
  * This metadata structure is modeled after the standard output of the
43
48
  * `music-metadata@11.13.0` npm package.
44
49
  *
45
- * @typedef {ContentMetadataTemplate<IPicture>} MediaContentMetadata
50
+ * @template {PictureDataType} PictureData
51
+ * @typedef {ContentMetadataTemplate<IPictureTemplate<PictureData>>} MediaContentMetadata
46
52
  */
47
53
  /**
48
54
  * The core properties required for any content item within the media system.
@@ -58,29 +64,33 @@
58
64
  * The final content object used within the media, combining
59
65
  * core playback properties with rich metadata.
60
66
  *
61
- * @typedef {MediaContentBase & MediaContentMetadata} MediaContent
67
+ * @template {PictureDataType} PictureData
68
+ * @typedef {MediaContentBase & MediaContentMetadata<PictureData>} MediaContent
62
69
  */
63
70
  //////////////////////////////////////////////////////////////////
64
71
  /**
65
72
  * A promise that resolves to an object containing the extracted metadata.
66
73
  * @callback ParseMediaContentMetadata
67
74
  * @param {Blob} data - The raw file blob.
68
- * @returns {Promise<{ common: Partial<ContentMetadataTemplate<IPictureTemplate<Uint8Array|string>>> }>} A promise resolving to the common metadata properties.
75
+ * @returns {Promise<{ common: Partial<ContentMetadataTemplate<IPictureTemplate<PictureDataType>>> }>} A promise resolving to the common metadata properties.
69
76
  */
70
77
  /**
71
- * @typedef {Object} LoadingMediaProgress
78
+ * @typedef {Object} LoadingMediaProgress Represents the current state of a media loading operation, including its status, execution stage, and the URL being processed.
72
79
  * @property {'loading'|'success'} status - The current status of the operation.
73
80
  * @property {LoadingProgressStage} stage - The current execution stage.
74
81
  * @property {ProgressEvent<EventTarget>} [event] - The current loading event.
75
82
  * @property {string} url - The URL being processed.
76
83
  */
77
84
  /**
85
+ * Defines the specific execution stages of a successful loading process.
78
86
  * @typedef {'INITIALIZING'|'DOWNLOADING'|'METADATA_LOADED'|'EXTRACTING_ID3'|'COMPLETE'} LoadingProgressStage
79
87
  */
80
88
  /**
89
+ * Defines the specific stages where a loading error might occur.
81
90
  * @typedef {'INITIALIZING'|'DOWNLOADING'|'METADATA'|'ID3'|'UNKNOWN'} LoadingErrorStage
82
91
  */
83
92
  /**
93
+ * A data structure containing details about a media loading error.
84
94
  * @typedef {Object} MediaLoadingErrorData
85
95
  * @property {Error} error - The original error object.
86
96
  * @property {string} url - The URL that failed.
@@ -88,21 +98,30 @@
88
98
  */
89
99
  //////////////////////////////////////////////////////////////////
90
100
  const checkString = (/** @type {string} */ val, /** @type {string} */ name) => {
101
+ if (typeof name !== 'string')
102
+ throw new TypeError('Expected "name" to be a string.');
91
103
  if (typeof val !== 'string')
92
104
  throw new TypeError(`Expected "${name}" to be a string, but received ${typeof val}.`);
93
105
  };
94
106
  const checkFunction = (/** @type {Function} */ val, /** @type {string} */ name) => {
107
+ if (typeof name !== 'string')
108
+ throw new TypeError('Expected "name" to be a string.');
95
109
  if (typeof val !== 'function')
96
110
  throw new TypeError(`Expected "${name}" to be a function, but received ${typeof val}.`);
97
111
  };
98
112
  const checkObject = (/** @type {Object<string, any> | null} */ val, /** @type {string} */ name) => {
113
+ if (typeof name !== 'string')
114
+ throw new TypeError('Expected "name" to be a string.');
99
115
  if (typeof val !== 'object' || val === null || Array.isArray(val)) {
100
116
  throw new TypeError(`Expected "${name}" to be a plain object, but received ${val === null ? 'null' : Array.isArray(val) ? 'array' : typeof val}.`);
101
117
  }
102
118
  };
103
119
  /** @type {Map<string, number>} */
104
120
  export const _blobCounter = new Map();
105
- /** @returns {MediaContentBase} */
121
+ /**
122
+ * Returns a new object initialized with the default values for the core media content properties.
123
+ * @returns {MediaContentBase}
124
+ */
106
125
  export const getMediaContentBase = () => ({
107
126
  id: '',
108
127
  title: '',
@@ -111,7 +130,10 @@ export const getMediaContentBase = () => ({
111
130
  duration: 0,
112
131
  weight: 1,
113
132
  });
114
- /** @returns {MediaContentMetadata} */
133
+ /**
134
+ * Returns a new object initialized with the default values for the media content metadata properties.
135
+ * @returns {MediaContentMetadata<PictureDataType>}
136
+ */
115
137
  export const getMediaContentMetadata = () => ({
116
138
  title: null,
117
139
  album: null,
@@ -167,7 +189,7 @@ export const generateSimpleHash = async (str) => {
167
189
  };
168
190
  /**
169
191
  * Helper to convert Uint8Array or Base64 string directly into a high performance Blob URL.
170
- * @param {Uint8Array|string} data
192
+ * @param {PictureDataType} data
171
193
  * @param {string} format
172
194
  * @returns {string} The generated Blob URL or original string if already valid.
173
195
  */
@@ -225,7 +247,8 @@ export const blobUrlToBase64 = async (url) => {
225
247
  };
226
248
  /**
227
249
  * Safely revokes Blob URLs to prevent memory leaks from createObjectURL.
228
- * @param {MediaContent} content
250
+ * @template {PictureDataType} PictureData
251
+ * @param {MediaContent<PictureData>} content
229
252
  */
230
253
  export const revokeContentUrls = (content) => {
231
254
  checkObject(content, 'content');
@@ -258,6 +281,7 @@ const validateMediaContent = (common, isPartial) => {
258
281
  const isArray = (
259
282
  /** @type {string[] | IPictureTemplate<string|Uint8Array>[] | undefined} */ v,
260
283
  /** @type {(value: any, index: number, array: any[]) => any} */ valueValidator) => {
284
+ checkFunction(valueValidator, 'valueValidator');
261
285
  if (isUndefinedAllowed(v))
262
286
  return true;
263
287
  if (Array.isArray(v) && v.every(valueValidator))
@@ -296,10 +320,11 @@ const validateMediaContent = (common, isPartial) => {
296
320
  throw new TypeError('Invalid metadata: "picture" must be an array of pictures.');
297
321
  /**
298
322
  * Validate Nested Objects (Disk and Track)
323
+ * @param {string} name
299
324
  * @param {MediaNumber|null} [info]
300
- * @param {string} [name]
301
325
  */
302
- const validateTrackInfo = (info, name) => {
326
+ const validateTrackInfo = (name, info) => {
327
+ checkString(name, 'name');
303
328
  if (isUndefinedAllowed(info))
304
329
  return; // Ignores if partial
305
330
  if (info === undefined || info === null) {
@@ -312,27 +337,33 @@ const validateMediaContent = (common, isPartial) => {
312
337
  if (typeof info.of !== 'number' && info.of !== null)
313
338
  throw new TypeError(`Invalid metadata: "${name}.of" must be a number or null.`);
314
339
  };
315
- validateTrackInfo(common.disk, 'disk');
316
- validateTrackInfo(common.track, 'track');
340
+ validateTrackInfo('disk', common.disk);
341
+ validateTrackInfo('track', common.track);
317
342
  };
318
343
  /**
319
344
  * Helper to validate types within the media content metadata object.
320
345
  * This ensures that if a property is present, it matches the expected type.
321
346
  * @param {ContentMetadataTemplate<IPictureTemplate<string | Uint8Array<ArrayBufferLike>>>} common
322
347
  */
323
- export const valMediaContentMetadata = (common) => validateMediaContent(common, false);
348
+ export const valMediaContentMetadata = (common) => {
349
+ checkObject(common, 'common');
350
+ return validateMediaContent(common, false);
351
+ };
324
352
  /**
325
353
  * Helper to validate types within the media content metadata object.
326
354
  * Allows the absence of properties (useful for updates/patch).
327
355
  * @param {Partial<ContentMetadataTemplate<IPictureTemplate<string | Uint8Array<ArrayBufferLike>>>>} common
328
356
  */
329
- export const valMediaContentMetadataPartial = (common) => validateMediaContent(common, true);
357
+ export const valMediaContentMetadataPartial = (common) => {
358
+ checkObject(common, 'common');
359
+ return validateMediaContent(common, true);
360
+ };
330
361
  /**
331
362
  * Downloads an audio file from a URL and extracts its ID3/metadata tags.
332
363
  *
333
364
  * @param {string} url - The full URL of the audio file to be downloaded.
334
365
  * @param {ParseMediaContentMetadata} parseFile - The function used to parse the file data.
335
- * @returns {Promise<MediaContentMetadata>} A promise that resolves to an object containing the extracted metadata.
366
+ * @returns {Promise<MediaContentMetadata<string>>} A promise that resolves to an object containing the extracted metadata.
336
367
  * @throws {TypeError} If the provided `url` is not a string or `parseFile` is not a function.
337
368
  * @throws {Error} If the network request fails or the parsing process encounters an error.
338
369
  */
@@ -384,15 +415,16 @@ export const extractMediaId3Tags = async (url, parseFile) => {
384
415
  * A Static Factory Method that prepares a MediaContent object by
385
416
  * extracting metadata from an audio source.
386
417
  *
418
+ * @template {PictureDataType} PictureData
387
419
  * @param {string | HTMLMediaElement} source - A URL string or an existing Audio object.
388
- * @param {Partial<MediaContentBase & MediaContentMetadata> & { id?: string; weight?: number }} [defaultMetadata={}] - Optional default metadata that overrides automatic extraction.
389
- * @param {Partial<MediaContentBase & MediaContentMetadata> & { id?: string; weight?: number }} [metadata={}] - Optional manual metadata that overrides automatic extraction.
420
+ * @param {Partial<MediaContentBase & MediaContentMetadata<PictureData>> & { id?: string; weight?: number }} [defaultMetadata={}] - Optional default metadata that overrides automatic extraction.
421
+ * @param {Partial<MediaContentBase & MediaContentMetadata<PictureData>> & { id?: string; weight?: number }} [metadata={}] - Optional manual metadata that overrides automatic extraction.
390
422
  * @param {ParseMediaContentMetadata} [parseFile] - Private helper to interface with parseFile.
391
423
  * @param {Object} [callbacks={}] - Callbacks for monitoring the loading process.
392
424
  * @param {(progress: LoadingMediaProgress) => void} [callbacks.onProgress] - Callback triggered on stage changes.
393
425
  * @param {(error: MediaLoadingErrorData) => void} [callbacks.onError] - Callback triggered when a non-fatal or fatal error occurs.
394
426
  * @param {UnknownArtistGetter} unknownArtist
395
- * @returns {Promise<MediaContent>} A promise that resolves to a valid MediaContent object.
427
+ * @returns {Promise<MediaContent<PictureData>>} A promise that resolves to a valid MediaContent object.
396
428
  * @throws {MediaLoadingError} If the preparation process fails at any stage.
397
429
  *
398
430
  * @example
@@ -422,7 +454,9 @@ export const extractMediaId3Tags = async (url, parseFile) => {
422
454
  * }
423
455
  * );
424
456
  */
425
- export const parseMediaMetadata = async (source, defaultMetadata = {}, metadata = {}, parseFile = (url) => {
457
+ export const parseMediaMetadata = async (source, defaultMetadata = {}, metadata = {}, parseFile = (data) => {
458
+ if (!(data instanceof Blob))
459
+ throw new TypeError('Expected "data" to be a Blob.');
426
460
  return new Promise((resolve, reject) => reject(new TypeError('parseFile library not found.')));
427
461
  }, callbacks = {}, unknownArtist = 'null') => {
428
462
  // Argument Validation
@@ -448,6 +482,10 @@ export const parseMediaMetadata = async (source, defaultMetadata = {}, metadata
448
482
  * @param {ProgressEvent<EventTarget>} [event]
449
483
  */
450
484
  const notifyProgress = (stage, event) => {
485
+ checkString(stage, 'stage');
486
+ if (event !== undefined && !(event instanceof Event)) {
487
+ throw new TypeError('Expected "event" to be an Event or undefined.');
488
+ }
451
489
  if (callbacks.onProgress) {
452
490
  callbacks.onProgress({
453
491
  event,
@@ -458,6 +496,9 @@ export const parseMediaMetadata = async (source, defaultMetadata = {}, metadata
458
496
  }
459
497
  };
460
498
  const notifyError = (/** @type {Error} */ error, /** @type {LoadingErrorStage} */ stage) => {
499
+ if (!(error instanceof Error))
500
+ throw new TypeError('Expected "error" to be an Error.');
501
+ checkString(stage, 'stage'); // Adicionado
461
502
  if (callbacks.onError) {
462
503
  callbacks.onError({
463
504
  error,
@@ -522,7 +563,7 @@ export const parseMediaMetadata = async (source, defaultMetadata = {}, metadata
522
563
  weight: metadata.weight ?? 1,
523
564
  };
524
565
  // 4. Automatic Metadata Extraction (ID3 Tags)
525
- /** @type {Partial<MediaContentMetadata>} */
566
+ /** @type {Partial<MediaContentMetadata<string>>} */
526
567
  let extractedMetadata = {};
527
568
  notifyProgress('EXTRACTING_ID3');
528
569
  try {
@@ -540,6 +581,7 @@ export const parseMediaMetadata = async (source, defaultMetadata = {}, metadata
540
581
  * @returns {string}
541
582
  */
542
583
  const getFallbackTitleFromUrl = (url) => {
584
+ checkString(url, 'url');
543
585
  try {
544
586
  // Remove query params or hashes, get the last segment, and strip extension
545
587
  const filename = url.split(/[?#]/)[0].split('/').pop();
@@ -570,7 +612,7 @@ export const parseMediaMetadata = async (source, defaultMetadata = {}, metadata
570
612
  url: url,
571
613
  });
572
614
  }
573
- return /** @type {MediaContent} */ (finalContent);
615
+ return /** @type {MediaContent<PictureData>} */ (finalContent);
574
616
  }
575
617
  catch (err) {
576
618
  // If it's already a MediaLoadingError, re-throw it.
@@ -10,7 +10,7 @@
10
10
  * countObj({ a: 1, b: 2 }); // 2
11
11
  * countObj('not an object'); // Throws TypeError
12
12
  */
13
- export function countObj(obj: Array<any> | Record<string | number | symbol, any>): number;
13
+ export declare function countObj(obj: Array<any> | Record<string | number | symbol, any>): number;
14
14
  /**
15
15
  * Determines whether a given value is a pure JSON object (plain object).
16
16
  *
@@ -26,5 +26,5 @@ export function countObj(obj: Array<any> | Record<string | number | symbol, any>
26
26
  * @param {unknown} value - The value to test.
27
27
  * @returns {value is Record<string | number | symbol, unknown>} Returns true if the value is a pure object.
28
28
  */
29
- export function isJsonObject(value: unknown): value is Record<string | number | symbol, unknown>;
29
+ export declare function isJsonObject(value: unknown): value is Record<string | number | symbol, unknown>;
30
30
  //# sourceMappingURL=objChecker.d.mts.map
@@ -272,7 +272,10 @@ extendObjType([
272
272
  ],
273
273
  [
274
274
  'array',
275
- /** @param {*} val @returns {val is any[]} */
275
+ /**
276
+ * @template {any} Value
277
+ * @param {*} val @returns {val is Value[]}
278
+ */
276
279
  (val) => Array.isArray(val),
277
280
  ],
278
281
  ]);
@@ -300,27 +303,44 @@ extendObjType([
300
303
  ],
301
304
  [
302
305
  'map',
303
- /** @param {*} val @returns {val is Map<unknown, unknown>} */
306
+ /**
307
+ * @template {any} Key
308
+ * @template {any} Value
309
+ * @param {*} val @returns {val is Map<Key, Value>}
310
+ */
304
311
  (val) => val instanceof Map,
305
312
  ],
306
313
  [
307
314
  'set',
308
- /** @param {*} val @returns {val is Set<unknown>} */
315
+ /**
316
+ * @template {any} Value
317
+ * @param {*} val @returns {val is Set<Value>}
318
+ */
309
319
  (val) => val instanceof Set,
310
320
  ],
311
321
  [
312
322
  'weakmap',
313
- /** @param {*} val @returns {val is WeakMap<unknown, unknown>} */
323
+ /**
324
+ * @template {WeakKey} Key
325
+ * @template {any} Value
326
+ * @param {*} val @returns {val is WeakMap<Key, Value>}
327
+ */
314
328
  (val) => val instanceof WeakMap,
315
329
  ],
316
330
  [
317
331
  'weakset',
318
- /** @param {*} val @returns {val is WeakSet<unknown>} */
332
+ /**
333
+ * @template {WeakKey} Value
334
+ * @param {*} val @returns {val is WeakSet<Value>}
335
+ */
319
336
  (val) => val instanceof WeakSet,
320
337
  ],
321
338
  [
322
339
  'promise',
323
- /** @param {*} val @returns {val is Promise<unknown>} */
340
+ /**
341
+ * @template {any} Value
342
+ * @param {*} val @returns {val is Promise<Value>}
343
+ */
324
344
  (val) => val instanceof Promise,
325
345
  ],
326
346
  ]);
@@ -338,7 +358,11 @@ if (isBrowser) {
338
358
  extendObjType([
339
359
  [
340
360
  'object',
341
- /** @param {*} val @returns {val is Record<string | number | symbol, unknown>} */
361
+ /**
362
+ * @template {string | number | symbol} Key
363
+ * @template {any} Value
364
+ * @param {*} val @returns {val is Record<Key, Value>}
365
+ */
342
366
  (val) => objChecker.isJsonObject(val),
343
367
  ],
344
368
  ]);