tiny-essentials 1.26.4 → 1.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/.github/workflows/node.js.yml +1 -1
  2. package/README.md +0 -1
  3. package/changelog/1/27/0.md +24 -0
  4. package/dist/v1/ColorSafeStringify.min.js +1 -1
  5. package/dist/v1/TinyAdvancedRaffle.min.js +1 -1
  6. package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
  7. package/dist/v1/TinyAnalogClock.min.js +1 -1
  8. package/dist/v1/TinyArrayComparator.min.js +1 -1
  9. package/dist/v1/TinyArrayPaginator.min.js +1 -1
  10. package/dist/v1/TinyBasicsEs.min.js +1 -1
  11. package/dist/v1/TinyClassManager.min.js +1 -1
  12. package/dist/v1/TinyClipboard.min.js +1 -1
  13. package/dist/v1/TinyColorConverter.min.js +1 -1
  14. package/dist/v1/TinyColorValidator.min.js +1 -1
  15. package/dist/v1/TinyCookieConsent.min.js +1 -1
  16. package/dist/v1/TinyDayNightCycle.min.js +1 -1
  17. package/dist/v1/TinyDomReadyManager.min.js +1 -1
  18. package/dist/v1/TinyDragDropDetector.min.js +1 -1
  19. package/dist/v1/TinyDragger.min.js +1 -1
  20. package/dist/v1/TinyElementObserver.min.js +1 -1
  21. package/dist/v1/TinyEssentials.min.js +1 -1
  22. package/dist/v1/TinyEvents.min.js +1 -1
  23. package/dist/v1/TinyGamepad.min.js +1 -1
  24. package/dist/v1/TinyHtml.min.js +1 -1
  25. package/dist/v1/TinyI18.min.js +1 -1
  26. package/dist/v1/TinyIframeEvents.min.js +1 -1
  27. package/dist/v1/TinyInventory.min.js +1 -1
  28. package/dist/v1/TinyInventoryTrader.min.js +1 -1
  29. package/dist/v1/TinyLevelUp.min.js +1 -1
  30. package/dist/v1/TinyLoadingScreen.min.js +1 -1
  31. package/dist/v1/TinyLocalStorage.min.js +1 -1
  32. package/dist/v1/TinyMaInSys.min.js +1 -1
  33. package/dist/v1/TinyMediaPlayer.min.js +1 -0
  34. package/dist/v1/TinyNeedBar.min.js +1 -1
  35. package/dist/v1/TinyNewWinEvents.min.js +1 -1
  36. package/dist/v1/TinyNotifications.min.js +1 -1
  37. package/dist/v1/TinyNotifyCenter.min.js +1 -1
  38. package/dist/v1/TinyPromiseQueue.min.js +1 -1
  39. package/dist/v1/TinyRadioFm.min.js +1 -0
  40. package/dist/v1/TinyRateLimiter.min.js +1 -1
  41. package/dist/v1/TinySimpleDice.min.js +1 -1
  42. package/dist/v1/TinySmartScroller.min.js +1 -1
  43. package/dist/v1/TinyTextDiffer.min.js +1 -1
  44. package/dist/v1/TinyTextRangeEditor.min.js +1 -1
  45. package/dist/v1/TinyTextarea.min.js +1 -1
  46. package/dist/v1/TinyTimeout.min.js +1 -1
  47. package/dist/v1/TinyToastNotify.min.js +1 -1
  48. package/dist/v1/TinyUploadClicker.min.js +1 -1
  49. package/dist/v1/UltraRandomMsgGen.min.js +1 -1
  50. package/dist/v1/basics/index.cjs +5 -0
  51. package/dist/v1/basics/index.d.mts +5 -1
  52. package/dist/v1/basics/index.mjs +2 -1
  53. package/dist/v1/basics/mediaContent.cjs +644 -0
  54. package/dist/v1/basics/mediaContent.d.mts +296 -0
  55. package/dist/v1/basics/mediaContent.mjs +557 -0
  56. package/dist/v1/build/TinyMediaPlayer.cjs +7 -0
  57. package/dist/v1/build/TinyMediaPlayer.d.mts +3 -0
  58. package/dist/v1/build/TinyMediaPlayer.mjs +2 -0
  59. package/dist/v1/build/TinyRadioFm.cjs +7 -0
  60. package/dist/v1/build/TinyRadioFm.d.mts +3 -0
  61. package/dist/v1/build/TinyRadioFm.mjs +2 -0
  62. package/dist/v1/index.cjs +9 -0
  63. package/dist/v1/index.d.mts +7 -1
  64. package/dist/v1/index.mjs +5 -2
  65. package/dist/v1/libs/ColorSafeStringify.d.mts +1 -1
  66. package/dist/v1/libs/TinyAfterScrollWatcher.cjs +16 -3
  67. package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +7 -3
  68. package/dist/v1/libs/TinyAfterScrollWatcher.mjs +13 -3
  69. package/dist/v1/libs/TinyArrayComparator.cjs +14 -11
  70. package/dist/v1/libs/TinyArrayComparator.d.mts +22 -19
  71. package/dist/v1/libs/TinyArrayComparator.mjs +14 -11
  72. package/dist/v1/libs/TinyArrayPaginator.cjs +23 -16
  73. package/dist/v1/libs/TinyArrayPaginator.d.mts +57 -30
  74. package/dist/v1/libs/TinyArrayPaginator.mjs +22 -16
  75. package/dist/v1/libs/TinyClassManager/TinyPluginInliner.cjs +265 -0
  76. package/dist/v1/libs/TinyClassManager/TinyPluginInliner.d.mts +92 -0
  77. package/dist/v1/libs/TinyClassManager/TinyPluginInliner.mjs +223 -0
  78. package/dist/v1/libs/TinyClassManager.cjs +52 -22
  79. package/dist/v1/libs/TinyClassManager.d.mts +26 -16
  80. package/dist/v1/libs/TinyClassManager.mjs +50 -21
  81. package/dist/v1/libs/TinyColorValidator.d.mts +16 -16
  82. package/dist/v1/libs/TinyDragDropDetector.cjs +9 -34
  83. package/dist/v1/libs/TinyDragDropDetector.d.mts +7 -21
  84. package/dist/v1/libs/TinyDragDropDetector.mjs +9 -24
  85. package/dist/v1/libs/TinyDragger.cjs +5 -5
  86. package/dist/v1/libs/TinyDragger.d.mts +4 -3
  87. package/dist/v1/libs/TinyDragger.mjs +5 -5
  88. package/dist/v1/libs/TinyElementObserver.cjs +6 -21
  89. package/dist/v1/libs/TinyElementObserver.d.mts +6 -15
  90. package/dist/v1/libs/TinyElementObserver.mjs +6 -20
  91. package/dist/v1/libs/TinyGamepad.cjs +4 -6
  92. package/dist/v1/libs/TinyGamepad.d.mts +1 -1
  93. package/dist/v1/libs/TinyHtml/TinyHtmlIcon.d.mts +1 -1
  94. package/dist/v1/libs/TinyHtml/TinyHtmlTemplate.d.mts +1 -1
  95. package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.d.mts +1 -1
  96. package/dist/v1/libs/TinyHtml/index.d.mts +1 -1
  97. package/dist/v1/libs/TinyHtml.cjs +72 -98
  98. package/dist/v1/libs/TinyHtml.d.mts +15 -32
  99. package/dist/v1/libs/TinyHtml.mjs +53 -77
  100. package/dist/v1/libs/TinyInventory.d.mts +1 -1
  101. package/dist/v1/libs/TinyMediaPlayer.cjs +844 -0
  102. package/dist/v1/libs/TinyMediaPlayer.d.mts +306 -0
  103. package/dist/v1/libs/TinyMediaPlayer.mjs +755 -0
  104. package/dist/v1/libs/TinyRadioFm.cjs +1378 -0
  105. package/dist/v1/libs/TinyRadioFm.d.mts +554 -0
  106. package/dist/v1/libs/TinyRadioFm.mjs +1137 -0
  107. package/dist/v1/libs/TinySmartScroller.cjs +39 -26
  108. package/dist/v1/libs/TinySmartScroller.d.mts +16 -62
  109. package/dist/v1/libs/TinySmartScroller.mjs +35 -26
  110. package/dist/v1/libs/UltraRandomMsgGen.d.mts +7 -7
  111. package/docs/v1/README.md +6 -0
  112. package/docs/v1/basics/mediaContent.md +131 -0
  113. package/docs/v1/libs/TinyClassManager/TinyPluginInliner.md +107 -0
  114. package/docs/v1/libs/TinyDragDropDetector.md +5 -9
  115. package/docs/v1/libs/TinyElementObserver.md +3 -6
  116. package/docs/v1/libs/TinyHtml.md +0 -29
  117. package/docs/v1/libs/TinyMediaPlayer.md +100 -0
  118. package/docs/v1/libs/TinyRadioFm.md +141 -0
  119. package/docs/v1/libs/TinySmartScroller.md +3 -3
  120. package/package.json +40 -22
@@ -0,0 +1,296 @@
1
+ /**
2
+ * @typedef {string|(() => string)} UnknownArtistGetter
3
+ */
4
+ /**
5
+ * Represents an image attachment template.
6
+ * @template {Uint8Array|string} PictureData
7
+ * @typedef {Object} IPictureTemplate
8
+ * @property {string} format - The MIME type of the image (e.g., 'image/jpeg').
9
+ * @property {PictureData} data - The raw binary data of the image.
10
+ * @property {string} [description] - An optional textual description of the image.
11
+ * @property {string} [type] - The specific type of picture (e.g., 'cover', 'front', 'back').
12
+ * @property {string} [name] - The filename associated with the image.
13
+ */
14
+ /**
15
+ * Represents an image attachment, such as album art.
16
+ * @typedef {IPictureTemplate<string>} IPicture
17
+ */
18
+ /**
19
+ * A numeric structure representing track or disk indexing.
20
+ * @typedef {{no: number|null, of: number|null}} MediaNumber
21
+ */
22
+ /**
23
+ * This metadata structure is modeled template.
24
+ *
25
+ * @template {IPictureTemplate<Uint8Array|string>} IPictureContent
26
+ * @typedef {Object} ContentMetadataTemplate
27
+ * @property {string|null} title - The title of the track.
28
+ * @property {string|null} album - The name of the album.
29
+ * @property {string|null} albumartist - The primary artist of the album.
30
+ * @property {string[]} albumartists - An array of artists associated with the album.
31
+ * @property {string[]} genre - An array of genres associated with the track.
32
+ * @property {string[]} label - The record label.
33
+ * @property {string[]} composer - The composer of the track.
34
+ * @property {number|null} year - The release year.
35
+ * @property {string|null} artist - The primary artist of the track.
36
+ * @property {string[]} artists - An array of artists associated with the track.
37
+ * @property {MediaNumber} disk - Disk information containing the current disk number and total disks.
38
+ * @property {MediaNumber} track - Track information containing the current track number and total tracks.
39
+ * @property {IPictureContent[]} [picture] - An array of picture objects containing album art.
40
+ */
41
+ /**
42
+ * This metadata structure is modeled after the standard output of the
43
+ * `music-metadata@11.13.0` npm package.
44
+ *
45
+ * @typedef {ContentMetadataTemplate<IPicture>} MediaContentMetadata
46
+ */
47
+ /**
48
+ * The core properties required for any content item within the media system.
49
+ * @typedef {Object} MediaContentBase
50
+ * @property {string} id - Unique identifier.
51
+ * @property {string} title - Name of the track/message.
52
+ * @property {string} artist - Artist or speaker name.
53
+ * @property {number} duration - Duration in milliseconds.
54
+ * @property {string} url - Source URL/Path.
55
+ * @property {number} [weight=1] - Probability multiplier for random selection mode.
56
+ */
57
+ /**
58
+ * The final content object used within the media, combining
59
+ * core playback properties with rich metadata.
60
+ *
61
+ * @typedef {MediaContentBase & MediaContentMetadata} MediaContent
62
+ */
63
+ /**
64
+ * A promise that resolves to an object containing the extracted metadata.
65
+ * @callback ParseMediaContentMetadata
66
+ * @param {Blob} data - The raw file blob.
67
+ * @returns {Promise<{ common: Partial<ContentMetadataTemplate<IPictureTemplate<Uint8Array|string>>> }>} A promise resolving to the common metadata properties.
68
+ */
69
+ /**
70
+ * @typedef {Object} LoadingMediaProgress
71
+ * @property {'loading'|'success'} status - The current status of the operation.
72
+ * @property {LoadingProgressStage} stage - The current execution stage.
73
+ * @property {ProgressEvent<EventTarget>} [event] - The current loading event.
74
+ * @property {string} url - The URL being processed.
75
+ */
76
+ /**
77
+ * @typedef {'INITIALIZING'|'DOWNLOADING'|'METADATA_LOADED'|'EXTRACTING_ID3'|'COMPLETE'} LoadingProgressStage
78
+ */
79
+ /**
80
+ * @typedef {'INITIALIZING'|'DOWNLOADING'|'METADATA'|'ID3'|'UNKNOWN'} LoadingErrorStage
81
+ */
82
+ /**
83
+ * @typedef {Object} MediaLoadingErrorData
84
+ * @property {Error} error - The original error object.
85
+ * @property {string} url - The URL that failed.
86
+ * @property {LoadingErrorStage} stage - The stage where it failed.
87
+ */
88
+ /** @type {Map<string, number>} */
89
+ export const _blobCounter: Map<string, number>;
90
+ export function getMediaContentBase(): MediaContentBase;
91
+ export function getMediaContentMetadata(): MediaContentMetadata;
92
+ /**
93
+ * Custom error class to provide detailed context during the content preparation process.
94
+ * @extends Error
95
+ */
96
+ export class MediaLoadingError extends Error {
97
+ /**
98
+ * @param {string} message - Human-readable error message.
99
+ * @param {string} url - The URL that caused the error.
100
+ * @param {LoadingErrorStage} stage - The stage where the error occurred.
101
+ */
102
+ constructor(message: string, url: string, stage: LoadingErrorStage);
103
+ url: string;
104
+ stage: LoadingErrorStage;
105
+ }
106
+ export function generateSimpleHash(str: string): Promise<string>;
107
+ export function convertToBlobUrl(data: Uint8Array | string, format?: string): string;
108
+ export function blobUrlToBase64(url: string): Promise<string>;
109
+ export function revokeContentUrls(content: MediaContent): void;
110
+ export function valMediaContentMetadata(common: ContentMetadataTemplate<IPictureTemplate<string | Uint8Array<ArrayBufferLike>>>): void;
111
+ export function valMediaContentMetadataPartial(common: Partial<ContentMetadataTemplate<IPictureTemplate<string | Uint8Array<ArrayBufferLike>>>>): void;
112
+ export function extractMediaId3Tags(url: string, parseFile: ParseMediaContentMetadata): Promise<MediaContentMetadata>;
113
+ export function parseMediaMetadata(source: string | HTMLMediaElement, defaultMetadata?: Partial<MediaContentBase & MediaContentMetadata> & {
114
+ id?: string;
115
+ weight?: number;
116
+ }, metadata?: Partial<MediaContentBase & MediaContentMetadata> & {
117
+ id?: string;
118
+ weight?: number;
119
+ }, parseFile?: ParseMediaContentMetadata, callbacks?: {
120
+ onProgress?: ((progress: LoadingMediaProgress) => void) | undefined;
121
+ onError?: ((error: MediaLoadingErrorData) => void) | undefined;
122
+ }, unknownArtist?: UnknownArtistGetter): Promise<MediaContent>;
123
+ export type UnknownArtistGetter = string | (() => string);
124
+ /**
125
+ * Represents an image attachment template.
126
+ */
127
+ export type IPictureTemplate<PictureData extends Uint8Array | string> = {
128
+ /**
129
+ * - The MIME type of the image (e.g., 'image/jpeg').
130
+ */
131
+ format: string;
132
+ /**
133
+ * - The raw binary data of the image.
134
+ */
135
+ data: PictureData;
136
+ /**
137
+ * - An optional textual description of the image.
138
+ */
139
+ description?: string | undefined;
140
+ /**
141
+ * - The specific type of picture (e.g., 'cover', 'front', 'back').
142
+ */
143
+ type?: string | undefined;
144
+ /**
145
+ * - The filename associated with the image.
146
+ */
147
+ name?: string | undefined;
148
+ };
149
+ /**
150
+ * Represents an image attachment, such as album art.
151
+ */
152
+ export type IPicture = IPictureTemplate<string>;
153
+ /**
154
+ * A numeric structure representing track or disk indexing.
155
+ */
156
+ export type MediaNumber = {
157
+ no: number | null;
158
+ of: number | null;
159
+ };
160
+ /**
161
+ * This metadata structure is modeled template.
162
+ */
163
+ export type ContentMetadataTemplate<IPictureContent extends IPictureTemplate<Uint8Array | string>> = {
164
+ /**
165
+ * - The title of the track.
166
+ */
167
+ title: string | null;
168
+ /**
169
+ * - The name of the album.
170
+ */
171
+ album: string | null;
172
+ /**
173
+ * - The primary artist of the album.
174
+ */
175
+ albumartist: string | null;
176
+ /**
177
+ * - An array of artists associated with the album.
178
+ */
179
+ albumartists: string[];
180
+ /**
181
+ * - An array of genres associated with the track.
182
+ */
183
+ genre: string[];
184
+ /**
185
+ * - The record label.
186
+ */
187
+ label: string[];
188
+ /**
189
+ * - The composer of the track.
190
+ */
191
+ composer: string[];
192
+ /**
193
+ * - The release year.
194
+ */
195
+ year: number | null;
196
+ /**
197
+ * - The primary artist of the track.
198
+ */
199
+ artist: string | null;
200
+ /**
201
+ * - An array of artists associated with the track.
202
+ */
203
+ artists: string[];
204
+ /**
205
+ * - Disk information containing the current disk number and total disks.
206
+ */
207
+ disk: MediaNumber;
208
+ /**
209
+ * - Track information containing the current track number and total tracks.
210
+ */
211
+ track: MediaNumber;
212
+ /**
213
+ * - An array of picture objects containing album art.
214
+ */
215
+ picture?: IPictureContent[] | undefined;
216
+ };
217
+ /**
218
+ * This metadata structure is modeled after the standard output of the
219
+ * `music-metadata@11.13.0` npm package.
220
+ */
221
+ export type MediaContentMetadata = ContentMetadataTemplate<IPicture>;
222
+ /**
223
+ * The core properties required for any content item within the media system.
224
+ */
225
+ export type MediaContentBase = {
226
+ /**
227
+ * - Unique identifier.
228
+ */
229
+ id: string;
230
+ /**
231
+ * - Name of the track/message.
232
+ */
233
+ title: string;
234
+ /**
235
+ * - Artist or speaker name.
236
+ */
237
+ artist: string;
238
+ /**
239
+ * - Duration in milliseconds.
240
+ */
241
+ duration: number;
242
+ /**
243
+ * - Source URL/Path.
244
+ */
245
+ url: string;
246
+ /**
247
+ * - Probability multiplier for random selection mode.
248
+ */
249
+ weight?: number | undefined;
250
+ };
251
+ /**
252
+ * The final content object used within the media, combining
253
+ * core playback properties with rich metadata.
254
+ */
255
+ export type MediaContent = MediaContentBase & MediaContentMetadata;
256
+ /**
257
+ * A promise that resolves to an object containing the extracted metadata.
258
+ */
259
+ export type ParseMediaContentMetadata = (data: Blob) => Promise<{
260
+ common: Partial<ContentMetadataTemplate<IPictureTemplate<Uint8Array | string>>>;
261
+ }>;
262
+ export type LoadingMediaProgress = {
263
+ /**
264
+ * - The current status of the operation.
265
+ */
266
+ status: "loading" | "success";
267
+ /**
268
+ * - The current execution stage.
269
+ */
270
+ stage: LoadingProgressStage;
271
+ /**
272
+ * - The current loading event.
273
+ */
274
+ event?: ProgressEvent<EventTarget> | undefined;
275
+ /**
276
+ * - The URL being processed.
277
+ */
278
+ url: string;
279
+ };
280
+ export type LoadingProgressStage = "INITIALIZING" | "DOWNLOADING" | "METADATA_LOADED" | "EXTRACTING_ID3" | "COMPLETE";
281
+ export type LoadingErrorStage = "INITIALIZING" | "DOWNLOADING" | "METADATA" | "ID3" | "UNKNOWN";
282
+ export type MediaLoadingErrorData = {
283
+ /**
284
+ * - The original error object.
285
+ */
286
+ error: Error;
287
+ /**
288
+ * - The URL that failed.
289
+ */
290
+ url: string;
291
+ /**
292
+ * - The stage where it failed.
293
+ */
294
+ stage: LoadingErrorStage;
295
+ };
296
+ //# sourceMappingURL=mediaContent.d.mts.map