tiny-essentials 1.26.3 → 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.
- package/.github/workflows/node.js.yml +1 -1
- package/README.md +0 -1
- package/changelog/1/26/4.md +10 -0
- package/changelog/1/27/0.md +24 -0
- package/dist/v1/ColorSafeStringify.min.js +1 -1
- package/dist/v1/TinyAdvancedRaffle.min.js +1 -1
- package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
- package/dist/v1/TinyAnalogClock.min.js +1 -1
- package/dist/v1/TinyArrayComparator.min.js +1 -1
- package/dist/v1/TinyArrayPaginator.min.js +1 -1
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyClassManager.min.js +1 -1
- package/dist/v1/TinyClipboard.min.js +1 -1
- package/dist/v1/TinyColorConverter.min.js +1 -1
- package/dist/v1/TinyColorValidator.min.js +1 -1
- package/dist/v1/TinyCookieConsent.min.js +1 -1
- package/dist/v1/TinyDayNightCycle.min.js +1 -1
- package/dist/v1/TinyDomReadyManager.min.js +1 -1
- package/dist/v1/TinyDragDropDetector.min.js +1 -1
- package/dist/v1/TinyDragger.min.js +1 -1
- package/dist/v1/TinyElementObserver.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyEvents.min.js +1 -1
- package/dist/v1/TinyGamepad.min.js +1 -1
- package/dist/v1/TinyHtml.min.js +1 -1
- package/dist/v1/TinyI18.min.js +1 -1
- package/dist/v1/TinyIframeEvents.min.js +1 -1
- package/dist/v1/TinyInventory.min.js +1 -1
- package/dist/v1/TinyInventoryTrader.min.js +1 -1
- package/dist/v1/TinyLevelUp.min.js +1 -1
- package/dist/v1/TinyLoadingScreen.min.js +1 -1
- package/dist/v1/TinyLocalStorage.min.js +1 -1
- package/dist/v1/TinyMaInSys.min.js +1 -1
- package/dist/v1/TinyMediaPlayer.min.js +1 -0
- package/dist/v1/TinyNeedBar.min.js +1 -1
- package/dist/v1/TinyNewWinEvents.min.js +1 -1
- package/dist/v1/TinyNotifications.min.js +1 -1
- package/dist/v1/TinyNotifyCenter.min.js +1 -1
- package/dist/v1/TinyPromiseQueue.min.js +1 -1
- package/dist/v1/TinyRadioFm.min.js +1 -0
- package/dist/v1/TinyRateLimiter.min.js +1 -1
- package/dist/v1/TinySimpleDice.min.js +1 -1
- package/dist/v1/TinySmartScroller.min.js +1 -1
- package/dist/v1/TinyTextDiffer.min.js +1 -1
- package/dist/v1/TinyTextRangeEditor.min.js +1 -1
- package/dist/v1/TinyTextarea.min.js +1 -1
- package/dist/v1/TinyTimeout.min.js +1 -1
- package/dist/v1/TinyToastNotify.min.js +1 -1
- package/dist/v1/TinyUploadClicker.min.js +1 -1
- package/dist/v1/UltraRandomMsgGen.min.js +1 -1
- package/dist/v1/basics/index.cjs +5 -0
- package/dist/v1/basics/index.d.mts +5 -1
- package/dist/v1/basics/index.mjs +2 -1
- package/dist/v1/basics/mediaContent.cjs +644 -0
- package/dist/v1/basics/mediaContent.d.mts +296 -0
- package/dist/v1/basics/mediaContent.mjs +557 -0
- package/dist/v1/build/TinyMediaPlayer.cjs +7 -0
- package/dist/v1/build/TinyMediaPlayer.d.mts +3 -0
- package/dist/v1/build/TinyMediaPlayer.mjs +2 -0
- package/dist/v1/build/TinyRadioFm.cjs +7 -0
- package/dist/v1/build/TinyRadioFm.d.mts +3 -0
- package/dist/v1/build/TinyRadioFm.mjs +2 -0
- package/dist/v1/index.cjs +9 -0
- package/dist/v1/index.d.mts +7 -1
- package/dist/v1/index.mjs +5 -2
- package/dist/v1/libs/ColorSafeStringify.d.mts +1 -1
- package/dist/v1/libs/TinyAfterScrollWatcher.cjs +16 -3
- package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +7 -3
- package/dist/v1/libs/TinyAfterScrollWatcher.mjs +13 -3
- package/dist/v1/libs/TinyArrayComparator.cjs +14 -11
- package/dist/v1/libs/TinyArrayComparator.d.mts +22 -19
- package/dist/v1/libs/TinyArrayComparator.mjs +14 -11
- package/dist/v1/libs/TinyArrayPaginator.cjs +23 -16
- package/dist/v1/libs/TinyArrayPaginator.d.mts +57 -30
- package/dist/v1/libs/TinyArrayPaginator.mjs +22 -16
- package/dist/v1/libs/TinyClassManager/TinyPluginInliner.cjs +265 -0
- package/dist/v1/libs/TinyClassManager/TinyPluginInliner.d.mts +92 -0
- package/dist/v1/libs/TinyClassManager/TinyPluginInliner.mjs +223 -0
- package/dist/v1/libs/TinyClassManager.cjs +124 -23
- package/dist/v1/libs/TinyClassManager.d.mts +33 -13
- package/dist/v1/libs/TinyClassManager.mjs +108 -23
- package/dist/v1/libs/TinyColorValidator.d.mts +16 -16
- package/dist/v1/libs/TinyDragDropDetector.cjs +9 -34
- package/dist/v1/libs/TinyDragDropDetector.d.mts +7 -21
- package/dist/v1/libs/TinyDragDropDetector.mjs +9 -24
- package/dist/v1/libs/TinyDragger.cjs +5 -5
- package/dist/v1/libs/TinyDragger.d.mts +4 -3
- package/dist/v1/libs/TinyDragger.mjs +5 -5
- package/dist/v1/libs/TinyElementObserver.cjs +6 -21
- package/dist/v1/libs/TinyElementObserver.d.mts +6 -15
- package/dist/v1/libs/TinyElementObserver.mjs +6 -20
- package/dist/v1/libs/TinyEvents.cjs +7 -0
- package/dist/v1/libs/TinyEvents.d.mts +4 -0
- package/dist/v1/libs/TinyEvents.mjs +6 -0
- package/dist/v1/libs/TinyGamepad.cjs +4 -6
- package/dist/v1/libs/TinyGamepad.d.mts +1 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlIcon.d.mts +1 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlTemplate.d.mts +1 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.d.mts +1 -1
- package/dist/v1/libs/TinyHtml/index.d.mts +1 -1
- package/dist/v1/libs/TinyHtml.cjs +72 -98
- package/dist/v1/libs/TinyHtml.d.mts +15 -32
- package/dist/v1/libs/TinyHtml.mjs +53 -77
- package/dist/v1/libs/TinyInventory.d.mts +1 -1
- package/dist/v1/libs/TinyMediaPlayer.cjs +844 -0
- package/dist/v1/libs/TinyMediaPlayer.d.mts +306 -0
- package/dist/v1/libs/TinyMediaPlayer.mjs +755 -0
- package/dist/v1/libs/TinyRadioFm.cjs +1378 -0
- package/dist/v1/libs/TinyRadioFm.d.mts +554 -0
- package/dist/v1/libs/TinyRadioFm.mjs +1137 -0
- package/dist/v1/libs/TinySmartScroller.cjs +39 -26
- package/dist/v1/libs/TinySmartScroller.d.mts +16 -62
- package/dist/v1/libs/TinySmartScroller.mjs +35 -26
- package/dist/v1/libs/UltraRandomMsgGen.d.mts +7 -7
- package/dist/v1/libs/examples/TinyClassManager.cjs +43 -41
- package/dist/v1/libs/examples/TinyClassManager.mjs +37 -37
- package/docs/v1/README.md +6 -0
- package/docs/v1/basics/mediaContent.md +131 -0
- package/docs/v1/libs/TinyClassManager/TinyPluginInliner.md +107 -0
- package/docs/v1/libs/TinyClassManager.md +69 -70
- package/docs/v1/libs/TinyDragDropDetector.md +5 -9
- package/docs/v1/libs/TinyElementObserver.md +3 -6
- package/docs/v1/libs/TinyEvents.md +1 -1
- package/docs/v1/libs/TinyHtml.md +0 -29
- package/docs/v1/libs/TinyMediaPlayer.md +100 -0
- package/docs/v1/libs/TinyRadioFm.md +141 -0
- package/docs/v1/libs/TinySmartScroller.md +3 -3
- package/package.json +40 -22
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
export default TinyRadioFm;
|
|
2
|
+
export type MediaContentBase = import("../basics/mediaContent.mjs").MediaContentBase;
|
|
3
|
+
export type MediaContentMetadata = import("../basics/mediaContent.mjs").MediaContentMetadata;
|
|
4
|
+
export type MediaContent = import("../basics/mediaContent.mjs").MediaContent;
|
|
5
|
+
export type IPicture = import("../basics/mediaContent.mjs").IPicture;
|
|
6
|
+
export type MediaNumber = import("../basics/mediaContent.mjs").MediaNumber;
|
|
7
|
+
export type MediaLoadingError = import("../basics/mediaContent.mjs").MediaLoadingError;
|
|
8
|
+
export type MediaLoadingErrorData = import("../basics/mediaContent.mjs").MediaLoadingErrorData;
|
|
9
|
+
export type LoadingMediaProgress = import("../basics/mediaContent.mjs").LoadingMediaProgress;
|
|
10
|
+
export type ParseMediaContentMetadata = import("../basics/mediaContent.mjs").ParseMediaContentMetadata;
|
|
11
|
+
export type UnknownArtistGetter = import("../basics/mediaContent.mjs").UnknownArtistGetter;
|
|
12
|
+
/**
|
|
13
|
+
* Represents a content item injected at a specific point in the absolute timeline.
|
|
14
|
+
*/
|
|
15
|
+
export type CustomPosition = {
|
|
16
|
+
/**
|
|
17
|
+
* - The audio/music content.
|
|
18
|
+
*/
|
|
19
|
+
content: MediaContent;
|
|
20
|
+
/**
|
|
21
|
+
* - The absolute Date.now() target.
|
|
22
|
+
*/
|
|
23
|
+
intendedTimestamp: number;
|
|
24
|
+
/**
|
|
25
|
+
* - The timestamp preserved for intelligent repositioning.
|
|
26
|
+
*/
|
|
27
|
+
originalTimestamp: number;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Data required to relocate an existing item within a playlist.
|
|
31
|
+
*/
|
|
32
|
+
export type ScheduledMovePayload = {
|
|
33
|
+
/**
|
|
34
|
+
* - Content ID to move.
|
|
35
|
+
*/
|
|
36
|
+
id: string;
|
|
37
|
+
/**
|
|
38
|
+
* - The target index in the playlist.
|
|
39
|
+
*/
|
|
40
|
+
newIndex: number;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* A union type representing the various data formats a scheduled task payload can take.
|
|
44
|
+
*/
|
|
45
|
+
export type ScheduledTaskPayload = MediaContent | string | ScheduledMovePayload;
|
|
46
|
+
/**
|
|
47
|
+
* A scheduled instruction to modify the radio state at a specific point in time.
|
|
48
|
+
*/
|
|
49
|
+
export type ScheduledTask = {
|
|
50
|
+
/**
|
|
51
|
+
* - The absolute time to execute the action.
|
|
52
|
+
*/
|
|
53
|
+
timestamp: number;
|
|
54
|
+
/**
|
|
55
|
+
* - The type of modification.
|
|
56
|
+
*/
|
|
57
|
+
action: "add" | "remove" | "move";
|
|
58
|
+
/**
|
|
59
|
+
* - Target playlist.
|
|
60
|
+
*/
|
|
61
|
+
type: "music" | "voice";
|
|
62
|
+
/**
|
|
63
|
+
* - Data relative to the action.
|
|
64
|
+
*/
|
|
65
|
+
payload: ScheduledTaskPayload;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* A standardized representation of an active or upcoming event in the radio timeline.
|
|
69
|
+
*/
|
|
70
|
+
export type RadioEvent = {
|
|
71
|
+
/**
|
|
72
|
+
* - Content ID.
|
|
73
|
+
*/
|
|
74
|
+
id: string;
|
|
75
|
+
/**
|
|
76
|
+
* - Content title.
|
|
77
|
+
*/
|
|
78
|
+
title: string;
|
|
79
|
+
/**
|
|
80
|
+
* - Content artist.
|
|
81
|
+
*/
|
|
82
|
+
artist: string;
|
|
83
|
+
/**
|
|
84
|
+
* - Source URL/Path.
|
|
85
|
+
*/
|
|
86
|
+
url: string;
|
|
87
|
+
/**
|
|
88
|
+
* - Total duration of the event.
|
|
89
|
+
*/
|
|
90
|
+
duration: number;
|
|
91
|
+
/**
|
|
92
|
+
* - Start timestamp within the absolute timeline.
|
|
93
|
+
*/
|
|
94
|
+
absoluteStart: number;
|
|
95
|
+
/**
|
|
96
|
+
* - End timestamp within the absolute timeline.
|
|
97
|
+
*/
|
|
98
|
+
absoluteEnd: number;
|
|
99
|
+
/**
|
|
100
|
+
* - How many ms have passed since the event started.
|
|
101
|
+
*/
|
|
102
|
+
elapsedTime: number;
|
|
103
|
+
/**
|
|
104
|
+
* - How many ms are left until the event ends.
|
|
105
|
+
*/
|
|
106
|
+
remainingTime: number;
|
|
107
|
+
/**
|
|
108
|
+
* - Percentage of completion (0 to 1).
|
|
109
|
+
*/
|
|
110
|
+
progress: number;
|
|
111
|
+
/**
|
|
112
|
+
* - Whether this is a user-defined custom position.
|
|
113
|
+
*/
|
|
114
|
+
isCustom: boolean;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* The available sequence logic modes for playlist playback.
|
|
118
|
+
*/
|
|
119
|
+
export type RadioModes = "playlist" | "random";
|
|
120
|
+
/**
|
|
121
|
+
* Global configuration settings for the radio engine behavior.
|
|
122
|
+
*/
|
|
123
|
+
export type RadioConfig = {
|
|
124
|
+
/**
|
|
125
|
+
* - Sequence mode for music.
|
|
126
|
+
*/
|
|
127
|
+
mode: RadioModes;
|
|
128
|
+
/**
|
|
129
|
+
* - Sequence mode for voices.
|
|
130
|
+
*/
|
|
131
|
+
voiceMode: RadioModes;
|
|
132
|
+
/**
|
|
133
|
+
* - Gap in ms between tracks.
|
|
134
|
+
*/
|
|
135
|
+
silenceDuration: number;
|
|
136
|
+
/**
|
|
137
|
+
* - Safety lock for max items processed.
|
|
138
|
+
*/
|
|
139
|
+
queryLimit: number;
|
|
140
|
+
/**
|
|
141
|
+
* - Whether to play voice messages after music tracks.
|
|
142
|
+
*/
|
|
143
|
+
voiceAfterMusic: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* - Minimum amount of voice messages to play if voiceAfterMusic is true.
|
|
146
|
+
*/
|
|
147
|
+
voiceMin: number;
|
|
148
|
+
/**
|
|
149
|
+
* - Maximum amount of voice messages to play.
|
|
150
|
+
*/
|
|
151
|
+
voiceMax: number;
|
|
152
|
+
/**
|
|
153
|
+
* - Max times a music track can repeat consecutively (-1 = unlimited, 0 = strictly no repetition).
|
|
154
|
+
*/
|
|
155
|
+
musicMaxConsecutive: number;
|
|
156
|
+
/**
|
|
157
|
+
* - Max times a voice track can repeat consecutively (-1 = unlimited, 0 = strictly no repetition).
|
|
158
|
+
*/
|
|
159
|
+
voiceMaxConsecutive: number;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* An extension of MediaContent that includes temporal boundaries within a generated cycle.
|
|
163
|
+
*/
|
|
164
|
+
export type CycleBlockData = MediaContent & {
|
|
165
|
+
cycleStart: number;
|
|
166
|
+
cycleEnd: number;
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* A structural block representing a single full iteration of the radio sequence.
|
|
170
|
+
*/
|
|
171
|
+
export type CycleBlock = {
|
|
172
|
+
/**
|
|
173
|
+
* - Items belonging to this cycle.
|
|
174
|
+
*/
|
|
175
|
+
items: CycleBlockData[];
|
|
176
|
+
/**
|
|
177
|
+
* - Total duration of the cycle block in ms.
|
|
178
|
+
*/
|
|
179
|
+
duration: number;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Information about the location of a specific cycle within the absolute timeline.
|
|
183
|
+
*/
|
|
184
|
+
export type CycleLocation = {
|
|
185
|
+
/**
|
|
186
|
+
* - The located cycle block.
|
|
187
|
+
*/
|
|
188
|
+
block: CycleBlock;
|
|
189
|
+
/**
|
|
190
|
+
* - The absolute start time of this cycle.
|
|
191
|
+
*/
|
|
192
|
+
startTimestamp: number;
|
|
193
|
+
/**
|
|
194
|
+
* - The specific loop iteration index.
|
|
195
|
+
*/
|
|
196
|
+
loopIndex: number;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* The complete state object used for exporting and importing the radio system.
|
|
200
|
+
*/
|
|
201
|
+
export type TinyRadioFmImport = {
|
|
202
|
+
/**
|
|
203
|
+
* - The music playlist.
|
|
204
|
+
*/
|
|
205
|
+
music: MediaContent[];
|
|
206
|
+
/**
|
|
207
|
+
* - The voice playlist.
|
|
208
|
+
*/
|
|
209
|
+
voice: MediaContent[];
|
|
210
|
+
/**
|
|
211
|
+
* - The custom position injections.
|
|
212
|
+
*/
|
|
213
|
+
custom: CustomPosition[];
|
|
214
|
+
/**
|
|
215
|
+
* - The pending scheduled tasks.
|
|
216
|
+
*/
|
|
217
|
+
tasks: ScheduledTask[];
|
|
218
|
+
/**
|
|
219
|
+
* - The randomness seed.
|
|
220
|
+
*/
|
|
221
|
+
seed: number;
|
|
222
|
+
/**
|
|
223
|
+
* - The timeline anchor timestamp.
|
|
224
|
+
*/
|
|
225
|
+
anchorDate: number;
|
|
226
|
+
/**
|
|
227
|
+
* - The engine configuration.
|
|
228
|
+
*/
|
|
229
|
+
config: RadioConfig;
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* @typedef {import('../basics/mediaContent.mjs').MediaContentBase} MediaContentBase
|
|
233
|
+
* @typedef {import('../basics/mediaContent.mjs').MediaContentMetadata} MediaContentMetadata
|
|
234
|
+
* @typedef {import('../basics/mediaContent.mjs').MediaContent} MediaContent
|
|
235
|
+
* @typedef {import('../basics/mediaContent.mjs').IPicture} IPicture
|
|
236
|
+
* @typedef {import('../basics/mediaContent.mjs').MediaNumber} MediaNumber
|
|
237
|
+
* @typedef {import('../basics/mediaContent.mjs').MediaLoadingError} MediaLoadingError
|
|
238
|
+
* @typedef {import('../basics/mediaContent.mjs').MediaLoadingErrorData} MediaLoadingErrorData
|
|
239
|
+
* @typedef {import('../basics/mediaContent.mjs').LoadingMediaProgress} LoadingMediaProgress
|
|
240
|
+
* @typedef {import('../basics/mediaContent.mjs').ParseMediaContentMetadata} ParseMediaContentMetadata
|
|
241
|
+
* @typedef {import('../basics/mediaContent.mjs').UnknownArtistGetter} UnknownArtistGetter
|
|
242
|
+
*/
|
|
243
|
+
/**
|
|
244
|
+
* Represents a content item injected at a specific point in the absolute timeline.
|
|
245
|
+
* @typedef {Object} CustomPosition
|
|
246
|
+
* @property {MediaContent} content - The audio/music content.
|
|
247
|
+
* @property {number} intendedTimestamp - The absolute Date.now() target.
|
|
248
|
+
* @property {number} originalTimestamp - The timestamp preserved for intelligent repositioning.
|
|
249
|
+
*/
|
|
250
|
+
/**
|
|
251
|
+
* Data required to relocate an existing item within a playlist.
|
|
252
|
+
* @typedef {Object} ScheduledMovePayload
|
|
253
|
+
* @property {string} id - Content ID to move.
|
|
254
|
+
* @property {number} newIndex - The target index in the playlist.
|
|
255
|
+
*/
|
|
256
|
+
/**
|
|
257
|
+
* A union type representing the various data formats a scheduled task payload can take.
|
|
258
|
+
* @typedef {MediaContent | string | ScheduledMovePayload} ScheduledTaskPayload
|
|
259
|
+
*/
|
|
260
|
+
/**
|
|
261
|
+
* A scheduled instruction to modify the radio state at a specific point in time.
|
|
262
|
+
* @typedef {Object} ScheduledTask
|
|
263
|
+
* @property {number} timestamp - The absolute time to execute the action.
|
|
264
|
+
* @property {'add'|'remove'|'move'} action - The type of modification.
|
|
265
|
+
* @property {'music'|'voice'} type - Target playlist.
|
|
266
|
+
* @property {ScheduledTaskPayload} payload - Data relative to the action.
|
|
267
|
+
*/
|
|
268
|
+
/**
|
|
269
|
+
* A standardized representation of an active or upcoming event in the radio timeline.
|
|
270
|
+
* @typedef {Object} RadioEvent
|
|
271
|
+
* @property {string} id - Content ID.
|
|
272
|
+
* @property {string} title - Content title.
|
|
273
|
+
* @property {string} artist - Content artist.
|
|
274
|
+
* @property {string} url - Source URL/Path.
|
|
275
|
+
* @property {number} duration - Total duration of the event.
|
|
276
|
+
* @property {number} absoluteStart - Start timestamp within the absolute timeline.
|
|
277
|
+
* @property {number} absoluteEnd - End timestamp within the absolute timeline.
|
|
278
|
+
* @property {number} elapsedTime - How many ms have passed since the event started.
|
|
279
|
+
* @property {number} remainingTime - How many ms are left until the event ends.
|
|
280
|
+
* @property {number} progress - Percentage of completion (0 to 1).
|
|
281
|
+
* @property {boolean} isCustom - Whether this is a user-defined custom position.
|
|
282
|
+
*/
|
|
283
|
+
/**
|
|
284
|
+
* The available sequence logic modes for playlist playback.
|
|
285
|
+
* @typedef {'playlist'|'random'} RadioModes
|
|
286
|
+
*/
|
|
287
|
+
/**
|
|
288
|
+
* Global configuration settings for the radio engine behavior.
|
|
289
|
+
* @typedef {Object} RadioConfig
|
|
290
|
+
* @property {RadioModes} mode - Sequence mode for music.
|
|
291
|
+
* @property {RadioModes} voiceMode - Sequence mode for voices.
|
|
292
|
+
* @property {number} silenceDuration - Gap in ms between tracks.
|
|
293
|
+
* @property {number} queryLimit - Safety lock for max items processed.
|
|
294
|
+
* @property {boolean} voiceAfterMusic - Whether to play voice messages after music tracks.
|
|
295
|
+
* @property {number} voiceMin - Minimum amount of voice messages to play if voiceAfterMusic is true.
|
|
296
|
+
* @property {number} voiceMax - Maximum amount of voice messages to play.
|
|
297
|
+
* @property {number} musicMaxConsecutive - Max times a music track can repeat consecutively (-1 = unlimited, 0 = strictly no repetition).
|
|
298
|
+
* @property {number} voiceMaxConsecutive - Max times a voice track can repeat consecutively (-1 = unlimited, 0 = strictly no repetition).
|
|
299
|
+
*/
|
|
300
|
+
/**
|
|
301
|
+
* An extension of MediaContent that includes temporal boundaries within a generated cycle.
|
|
302
|
+
* @typedef {MediaContent & { cycleStart: number; cycleEnd: number; }} CycleBlockData
|
|
303
|
+
*/
|
|
304
|
+
/**
|
|
305
|
+
* A structural block representing a single full iteration of the radio sequence.
|
|
306
|
+
* @typedef {Object} CycleBlock
|
|
307
|
+
* @property {CycleBlockData[]} items - Items belonging to this cycle.
|
|
308
|
+
* @property {number} duration - Total duration of the cycle block in ms.
|
|
309
|
+
*/
|
|
310
|
+
/**
|
|
311
|
+
* Information about the location of a specific cycle within the absolute timeline.
|
|
312
|
+
* @typedef {Object} CycleLocation
|
|
313
|
+
* @property {CycleBlock} block - The located cycle block.
|
|
314
|
+
* @property {number} startTimestamp - The absolute start time of this cycle.
|
|
315
|
+
* @property {number} loopIndex - The specific loop iteration index.
|
|
316
|
+
*/
|
|
317
|
+
/**
|
|
318
|
+
* The complete state object used for exporting and importing the radio system.
|
|
319
|
+
* @typedef {Object} TinyRadioFmImport
|
|
320
|
+
* @property {MediaContent[]} music - The music playlist.
|
|
321
|
+
* @property {MediaContent[]} voice - The voice playlist.
|
|
322
|
+
* @property {CustomPosition[]} custom - The custom position injections.
|
|
323
|
+
* @property {ScheduledTask[]} tasks - The pending scheduled tasks.
|
|
324
|
+
* @property {number} seed - The randomness seed.
|
|
325
|
+
* @property {number} anchorDate - The timeline anchor timestamp.
|
|
326
|
+
* @property {RadioConfig} config - The engine configuration.
|
|
327
|
+
*/
|
|
328
|
+
/**
|
|
329
|
+
* A deterministic, seed-based radio management system with scheduled adaptations and weighted random generation.
|
|
330
|
+
* @extends TinyEvents
|
|
331
|
+
* @beta
|
|
332
|
+
*/
|
|
333
|
+
declare class TinyRadioFm extends TinyEvents {
|
|
334
|
+
/**
|
|
335
|
+
* A Static Factory Method that prepares a MediaContent object by
|
|
336
|
+
* extracting metadata from an audio source.
|
|
337
|
+
*
|
|
338
|
+
* @param {string | HTMLMediaElement} source - A URL string or an existing Audio object.
|
|
339
|
+
* @param {Partial<MediaContentBase & MediaContentMetadata> & { id?: string; weight?: number }} [defaultMetadata={}] - Optional default metadata that overrides automatic extraction.
|
|
340
|
+
* @param {Partial<MediaContentBase & MediaContentMetadata> & { id?: string; weight?: number }} [metadata={}] - Optional manual metadata that overrides automatic extraction.
|
|
341
|
+
* @param {ParseMediaContentMetadata} [parseFile] - Private helper to interface with parseFile.
|
|
342
|
+
* @param {Object} [callbacks={}] - Callbacks for monitoring the loading process.
|
|
343
|
+
* @param {(progress: LoadingMediaProgress) => void} [callbacks.onProgress] - Callback triggered on stage changes.
|
|
344
|
+
* @param {(error: MediaLoadingErrorData) => void} [callbacks.onError] - Callback triggered when a non-fatal or fatal error occurs.
|
|
345
|
+
* @returns {Promise<MediaContent>} A promise that resolves to a valid MediaContent object.
|
|
346
|
+
* @throws {MediaLoadingError} If the preparation process fails at any stage.
|
|
347
|
+
*/
|
|
348
|
+
static parseContent(source: string | HTMLMediaElement, defaultMetadata?: Partial<MediaContentBase & MediaContentMetadata> & {
|
|
349
|
+
id?: string;
|
|
350
|
+
weight?: number;
|
|
351
|
+
}, metadata?: Partial<MediaContentBase & MediaContentMetadata> & {
|
|
352
|
+
id?: string;
|
|
353
|
+
weight?: number;
|
|
354
|
+
}, parseFile?: ParseMediaContentMetadata, callbacks?: {
|
|
355
|
+
onProgress?: ((progress: LoadingMediaProgress) => void) | undefined;
|
|
356
|
+
onError?: ((error: MediaLoadingErrorData) => void) | undefined;
|
|
357
|
+
}): Promise<MediaContent>;
|
|
358
|
+
/**
|
|
359
|
+
* @type {UnknownArtistGetter}
|
|
360
|
+
* The default identifier or function used when an artist cannot be determined.
|
|
361
|
+
*/
|
|
362
|
+
static #unknownArtist: UnknownArtistGetter;
|
|
363
|
+
/**
|
|
364
|
+
* Sets the value used to represent unknown artists.
|
|
365
|
+
* @param {UnknownArtistGetter} value - A string or a function that returns a string.
|
|
366
|
+
* @throws {TypeError} If the value is neither a string nor a function.
|
|
367
|
+
*/
|
|
368
|
+
static set unknownArtist(value: UnknownArtistGetter);
|
|
369
|
+
/**
|
|
370
|
+
* Gets the current value used to represent unknown artists.
|
|
371
|
+
* @returns {UnknownArtistGetter}
|
|
372
|
+
*/
|
|
373
|
+
static get unknownArtist(): UnknownArtistGetter;
|
|
374
|
+
/**
|
|
375
|
+
* Initializes the radio system.
|
|
376
|
+
* @param {TinyRadioFmImport|null} [initialData=null] - JSON object to hydrate the radio state.
|
|
377
|
+
* @param {number} [seed=0] - Initial seed for deterministic randomness.
|
|
378
|
+
* @throws {TypeError} If initialData is not an object or null, or if seed is not a number.
|
|
379
|
+
*/
|
|
380
|
+
constructor(initialData?: TinyRadioFmImport | null, seed?: number);
|
|
381
|
+
/**
|
|
382
|
+
* Gets the total count of all content items (music and voice) in the system.
|
|
383
|
+
* @returns {number}
|
|
384
|
+
*/
|
|
385
|
+
get size(): number;
|
|
386
|
+
/**
|
|
387
|
+
* Gets the total number of items in the music playlist.
|
|
388
|
+
* @returns {number}
|
|
389
|
+
*/
|
|
390
|
+
get musicSize(): number;
|
|
391
|
+
/**
|
|
392
|
+
* Gets the total number of items in the voice playlist.
|
|
393
|
+
* @returns {number}
|
|
394
|
+
*/
|
|
395
|
+
get voiceSize(): number;
|
|
396
|
+
/**
|
|
397
|
+
* Gets the number of active custom position injections.
|
|
398
|
+
* @returns {number}
|
|
399
|
+
*/
|
|
400
|
+
get customPosSize(): number;
|
|
401
|
+
/**
|
|
402
|
+
* Gets the number of pending scheduled tasks.
|
|
403
|
+
* @returns {number}
|
|
404
|
+
*/
|
|
405
|
+
get tasksSize(): number;
|
|
406
|
+
/**
|
|
407
|
+
* Gets the number of items currently stored in the cycle cache.
|
|
408
|
+
* @returns {number}
|
|
409
|
+
*/
|
|
410
|
+
get cycleCacheSize(): number;
|
|
411
|
+
/**
|
|
412
|
+
* Gets a deep clone of the music playlist.
|
|
413
|
+
* @returns {MediaContent[]}
|
|
414
|
+
*/
|
|
415
|
+
get musicList(): MediaContent[];
|
|
416
|
+
/**
|
|
417
|
+
* Gets a deep clone of the voice playlist.
|
|
418
|
+
* @returns {MediaContent[]}
|
|
419
|
+
*/
|
|
420
|
+
get voiceList(): MediaContent[];
|
|
421
|
+
/**
|
|
422
|
+
* Gets a deep clone of the custom position injections.
|
|
423
|
+
* @returns {CustomPosition[]}
|
|
424
|
+
*/
|
|
425
|
+
get customPositions(): CustomPosition[];
|
|
426
|
+
/**
|
|
427
|
+
* Gets a deep clone of the scheduled tasks.
|
|
428
|
+
* @returns {ScheduledTask[]}
|
|
429
|
+
*/
|
|
430
|
+
get scheduledTasks(): ScheduledTask[];
|
|
431
|
+
/**
|
|
432
|
+
* Returns a deep clone of the internal all list cache.
|
|
433
|
+
* @returns {MediaContent[]} A cloned object of the cache.
|
|
434
|
+
*/
|
|
435
|
+
get allList(): MediaContent[];
|
|
436
|
+
/**
|
|
437
|
+
* Sets the core randomness seed and clears the current cycle cache.
|
|
438
|
+
* @param {number} seed - The new seed.
|
|
439
|
+
*/
|
|
440
|
+
set seed(seed: number);
|
|
441
|
+
/**
|
|
442
|
+
* Gets the current randomness seed.
|
|
443
|
+
* @returns {number}
|
|
444
|
+
*/
|
|
445
|
+
get seed(): number;
|
|
446
|
+
/**
|
|
447
|
+
* Gets the absolute timestamp used as the timeline anchor.
|
|
448
|
+
* @returns {number}
|
|
449
|
+
*/
|
|
450
|
+
get anchorDate(): number;
|
|
451
|
+
/**
|
|
452
|
+
* Performs a complete replacement of the configuration.
|
|
453
|
+
* @param {RadioConfig} config - The new full configuration object.
|
|
454
|
+
* @throws {TypeError|RangeError} If the new configuration is invalid.
|
|
455
|
+
*/
|
|
456
|
+
set config(config: RadioConfig);
|
|
457
|
+
/**
|
|
458
|
+
* Gets a deep clone of the current radio configuration.
|
|
459
|
+
* @returns {RadioConfig}
|
|
460
|
+
*/
|
|
461
|
+
get config(): RadioConfig;
|
|
462
|
+
/**
|
|
463
|
+
* Adds new content instantly to the radio sequence.
|
|
464
|
+
* @param {'music'|'voice'|'custom'} type - The category of the content.
|
|
465
|
+
* @param {MediaContent & { timestamp?: number }} data - The content payload to insert.
|
|
466
|
+
* @param {boolean} [smartQueue=true] - If true, delays insertion until the end of the content playing at that timestamp (only affects 'custom').
|
|
467
|
+
* @throws {TypeError} If the type is invalid or the data lacks a valid ID and numerical duration.
|
|
468
|
+
*/
|
|
469
|
+
add(type: "music" | "voice" | "custom", data: MediaContent & {
|
|
470
|
+
timestamp?: number;
|
|
471
|
+
}, smartQueue?: boolean): void;
|
|
472
|
+
/**
|
|
473
|
+
* Schedules a modification to the base playlists, seamlessly breaking the timeline when activated.
|
|
474
|
+
* @param {number} timestamp - Epoch timestamp in ms.
|
|
475
|
+
* @param {'add'|'remove'|'move'} action - Action to perform.
|
|
476
|
+
* @param {'music'|'voice'} type - Target list.
|
|
477
|
+
* @param {ScheduledTaskPayload} payload - Data relative to the action.
|
|
478
|
+
* @param {boolean} [smartQueue=true] - If true, delays the task execution until the end of the content playing at that timestamp.
|
|
479
|
+
* @throws {TypeError} If arguments do not match the required types or action/type constraints.
|
|
480
|
+
*/
|
|
481
|
+
scheduleTask(timestamp: number, action: "add" | "remove" | "move", type: "music" | "voice", payload: ScheduledTaskPayload, smartQueue?: boolean): void;
|
|
482
|
+
/**
|
|
483
|
+
* Removes content instantly by ID across all active lists, positions, and future tasks.
|
|
484
|
+
* @param {string} id - The unique identifier of the content.
|
|
485
|
+
* @throws {TypeError} If the id is not a string.
|
|
486
|
+
*/
|
|
487
|
+
remove(id: string): void;
|
|
488
|
+
/**
|
|
489
|
+
* Performs a partial update of the configuration.
|
|
490
|
+
* @param {Partial<RadioConfig>} config - The configuration overrides.
|
|
491
|
+
* @throws {TypeError|RangeError} If the provided values or the resulting state is invalid.
|
|
492
|
+
*/
|
|
493
|
+
setConfig(config: Partial<RadioConfig>): void;
|
|
494
|
+
/**
|
|
495
|
+
* Retrieves the exact event playing at the current system time.
|
|
496
|
+
* @returns {RadioEvent|null} The current active event, or null if empty.
|
|
497
|
+
*/
|
|
498
|
+
getCurrentEvent(): RadioEvent | null;
|
|
499
|
+
/**
|
|
500
|
+
* Queries the timeline from a specific date forward to predict upcoming events.
|
|
501
|
+
* Uses a virtual clone to predict scheduled tasks accurately without mutating current state.
|
|
502
|
+
* @param {number} targetDate - The starting epoch timestamp.
|
|
503
|
+
* @param {number} [limit=10] - Maximum number of upcoming events to resolve.
|
|
504
|
+
* @returns {RadioEvent[]} Array of resolved upcoming events.
|
|
505
|
+
* @throws {TypeError} If limit is not a number.
|
|
506
|
+
* @throws {RangeError} If the limit exceeds the configured queryLimit or is <= 0.
|
|
507
|
+
*/
|
|
508
|
+
queryTimeline(targetDate: number, limit?: number): RadioEvent[];
|
|
509
|
+
/**
|
|
510
|
+
* Returns all active custom positions currently injected into the timeline.
|
|
511
|
+
* @returns {CustomPosition[]} Shallow copy of custom positions array.
|
|
512
|
+
*/
|
|
513
|
+
searchCustomPositions(): CustomPosition[];
|
|
514
|
+
/**
|
|
515
|
+
* Process a content list, waiting to convert the images from Blob URL to Base64.
|
|
516
|
+
* @param {MediaContent[]} list
|
|
517
|
+
* @returns {Promise<MediaContent[]>}
|
|
518
|
+
* @private
|
|
519
|
+
*/
|
|
520
|
+
private _processListForExport;
|
|
521
|
+
/**
|
|
522
|
+
* Exports the complete state of the radio, including caches and scheduled tasks.
|
|
523
|
+
* @returns {string} Stringified JSON state.
|
|
524
|
+
* @private
|
|
525
|
+
*/
|
|
526
|
+
private _exportState;
|
|
527
|
+
/**
|
|
528
|
+
* Exports the complete state of the radio, including caches and scheduled tasks.
|
|
529
|
+
* @returns {Promise<string>} Stringified JSON state.
|
|
530
|
+
*/
|
|
531
|
+
exportState(): Promise<string>;
|
|
532
|
+
/**
|
|
533
|
+
* Imports a previously exported state, overwriting the current instance.
|
|
534
|
+
* @param {string|TinyRadioFmImport} json - JSON state or object.
|
|
535
|
+
* @throws {TypeError} If json is not a valid string or object.
|
|
536
|
+
*/
|
|
537
|
+
importState(json: string | TinyRadioFmImport): void;
|
|
538
|
+
/**
|
|
539
|
+
* Mulberry32 Pseudo-Random Number Generator.
|
|
540
|
+
* @param {number} seed - The initialization seed.
|
|
541
|
+
* @returns {function(): number} PRNG function returning a float between 0 and 1.
|
|
542
|
+
* @private
|
|
543
|
+
*/
|
|
544
|
+
private _prng;
|
|
545
|
+
/**
|
|
546
|
+
* Destroys the radio instance, releasing all allocated memory (including Blob URLs)
|
|
547
|
+
* and permanently cleaning all caches, lists and tasks.
|
|
548
|
+
* @param {boolean} [destroyThumbs=true]
|
|
549
|
+
*/
|
|
550
|
+
destroy(destroyThumbs?: boolean): void;
|
|
551
|
+
#private;
|
|
552
|
+
}
|
|
553
|
+
import TinyEvents from './TinyEvents.mjs';
|
|
554
|
+
//# sourceMappingURL=TinyRadioFm.d.mts.map
|