tiny-essentials 1.28.3 → 1.28.5

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 (52) hide show
  1. package/changelog/1/28/4.md +4 -0
  2. package/changelog/1/28/5.md +31 -0
  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/TinyTimeout.min.js +1 -1
  7. package/dist/v1/TinyUploadClicker.min.js +1 -1
  8. package/dist/v1/basics/index.cjs +4 -0
  9. package/dist/v1/basics/index.d.mts +3 -2
  10. package/dist/v1/basics/index.mjs +3 -2
  11. package/dist/v1/basics/mediaContent.cjs +1 -0
  12. package/dist/v1/basics/mediaContent.d.mts +4 -0
  13. package/dist/v1/basics/mediaContent.mjs +1 -0
  14. package/dist/v1/basics/objChecker.cjs +16 -0
  15. package/dist/v1/basics/objChecker.d.mts +12 -0
  16. package/dist/v1/basics/objChecker.mjs +14 -0
  17. package/dist/v1/basics/objFilter.cjs +21 -30
  18. package/dist/v1/basics/objFilter.d.mts +0 -2
  19. package/dist/v1/basics/objFilter.mjs +21 -30
  20. package/dist/v1/basics/promiseUtils.cjs +101 -0
  21. package/dist/v1/basics/promiseUtils.d.mts +31 -0
  22. package/dist/v1/basics/promiseUtils.mjs +89 -0
  23. package/dist/v1/index.cjs +4 -0
  24. package/dist/v1/index.d.mts +3 -2
  25. package/dist/v1/index.mjs +3 -2
  26. package/dist/v1/libs/TinyMediaPlayer/HtmlAudio.cjs +268 -0
  27. package/dist/v1/libs/TinyMediaPlayer/HtmlAudio.d.mts +118 -0
  28. package/dist/v1/libs/TinyMediaPlayer/HtmlAudio.mjs +237 -0
  29. package/dist/v1/libs/TinyMediaPlayer/HtmlVideo.cjs +265 -0
  30. package/dist/v1/libs/TinyMediaPlayer/HtmlVideo.d.mts +118 -0
  31. package/dist/v1/libs/TinyMediaPlayer/HtmlVideo.mjs +234 -0
  32. package/dist/v1/libs/TinyMediaPlayer/Youtube.cjs +671 -0
  33. package/dist/v1/libs/TinyMediaPlayer/Youtube.d.mts +259 -0
  34. package/dist/v1/libs/TinyMediaPlayer/Youtube.mjs +597 -0
  35. package/dist/v1/libs/TinyMediaPlayer/docs/YouTubePlayer.cjs +546 -0
  36. package/dist/v1/libs/TinyMediaPlayer/docs/YouTubePlayer.d.mts +657 -0
  37. package/dist/v1/libs/TinyMediaPlayer/docs/YouTubePlayer.mjs +480 -0
  38. package/dist/v1/libs/TinyMediaPlayer/index.cjs +165 -0
  39. package/dist/v1/libs/TinyMediaPlayer/index.d.mts +102 -0
  40. package/dist/v1/libs/TinyMediaPlayer/index.mjs +144 -0
  41. package/dist/v1/libs/TinyMediaPlayer.cjs +589 -103
  42. package/dist/v1/libs/TinyMediaPlayer.d.mts +150 -65
  43. package/dist/v1/libs/TinyMediaPlayer.mjs +535 -93
  44. package/dist/v1/libs/TinyTimeout.cjs +4 -14
  45. package/dist/v1/libs/TinyTimeout.d.mts +1 -0
  46. package/dist/v1/libs/TinyTimeout.mjs +4 -13
  47. package/docs/v1/basics/mediaContent.md +1 -1
  48. package/docs/v1/basics/objChecker.md +13 -0
  49. package/docs/v1/basics/promiseUtils.md +32 -0
  50. package/docs/v1/libs/TinyMediaPlayer.md +239 -32
  51. package/docs/v1/libs/TinyTimeout.md +1 -14
  52. package/package.json +21 -1
@@ -0,0 +1,259 @@
1
+ /**
2
+ * @typedef {import('../../basics/mediaContent.mjs').PictureDataType} PictureDataType
3
+ * @typedef {import('../../basics/mediaContent.mjs').MediaContent<PictureDataType>} MediaContent
4
+ * @typedef {import('./index.mjs').ContentTimeData} ContentTimeData
5
+ *
6
+ * @typedef {import('./docs/YouTubePlayer.mjs').YTPlayerState} YTPlayerState
7
+ * @typedef {import('./docs/YouTubePlayer.mjs').YTPlayerErrors} YTPlayerErrors
8
+ * @typedef {import('./docs/YouTubePlayer.mjs').YTQuality} YTQuality
9
+ * @typedef {import('./docs/YouTubePlayer.mjs').YTSphericalProperties} YTSphericalProperties
10
+ * @typedef {import('./docs/YouTubePlayer.mjs').YouTubePlayerEventBase} YouTubePlayerEventBase
11
+ * @typedef {import('./docs/YouTubePlayer.mjs').YTPlayerOptionsEvents} YTPlayerOptionsEvents
12
+ * @typedef {import('./docs/YouTubePlayer.mjs').YTPlayerOptionsEvents} YTPlayerOptions
13
+ * @typedef {import('./docs/YouTubePlayer.mjs').EventNames} EventNames
14
+ * @typedef {import('./docs/YouTubePlayer.mjs').YTPlaylistOptions} YTPlaylistOptions
15
+ * @typedef {import('./docs/YouTubePlayer.mjs').VideoByUrlOptions} VideoByUrlOptions
16
+ * @typedef {import('./docs/YouTubePlayer.mjs').VideoByIdOptions} VideoByIdOptions
17
+ *
18
+ * @typedef {import('./docs/YouTubePlayer.mjs').OnReadyEvent} OnReadyEvent
19
+ * @typedef {import('./docs/YouTubePlayer.mjs').OnStateChangeEvent} OnStateChangeEvent
20
+ * @typedef {import('./docs/YouTubePlayer.mjs').OnErrorEvent} OnErrorEvent
21
+ * @typedef {import('./docs/YouTubePlayer.mjs').OnPlaybackQualityChangeEvent} OnPlaybackQualityChangeEvent
22
+ * @typedef {import('./docs/YouTubePlayer.mjs').OnPlaybackRateChangeEvent} OnPlaybackRateChangeEvent
23
+ * @typedef {import('./docs/YouTubePlayer.mjs').OnApiChangeEvent} OnApiChangeEvent
24
+ * @typedef {import('./docs/YouTubePlayer.mjs').OnAutoplayBlockedEvent} OnAutoplayBlockedEvent
25
+ */
26
+ export type PictureDataType = import('../../basics/mediaContent.mjs').PictureDataType;
27
+ export type MediaContent = import('../../basics/mediaContent.mjs').MediaContent<PictureDataType>;
28
+ export type ContentTimeData = import('./index.mjs').ContentTimeData;
29
+ export type YTPlayerState = import('./docs/YouTubePlayer.mjs').YTPlayerState;
30
+ export type YTPlayerErrors = import('./docs/YouTubePlayer.mjs').YTPlayerErrors;
31
+ export type YTQuality = import('./docs/YouTubePlayer.mjs').YTQuality;
32
+ export type YTSphericalProperties = import('./docs/YouTubePlayer.mjs').YTSphericalProperties;
33
+ export type YouTubePlayerEventBase = import('./docs/YouTubePlayer.mjs').YouTubePlayerEventBase;
34
+ export type YTPlayerOptionsEvents = import('./docs/YouTubePlayer.mjs').YTPlayerOptionsEvents;
35
+ export type YTPlayerOptions = import('./docs/YouTubePlayer.mjs').YTPlayerOptionsEvents;
36
+ export type EventNames = import('./docs/YouTubePlayer.mjs').EventNames;
37
+ export type YTPlaylistOptions = import('./docs/YouTubePlayer.mjs').YTPlaylistOptions;
38
+ export type VideoByUrlOptions = import('./docs/YouTubePlayer.mjs').VideoByUrlOptions;
39
+ export type VideoByIdOptions = import('./docs/YouTubePlayer.mjs').VideoByIdOptions;
40
+ export type OnReadyEvent = import('./docs/YouTubePlayer.mjs').OnReadyEvent;
41
+ export type OnStateChangeEvent = import('./docs/YouTubePlayer.mjs').OnStateChangeEvent;
42
+ export type OnErrorEvent = import('./docs/YouTubePlayer.mjs').OnErrorEvent;
43
+ export type OnPlaybackQualityChangeEvent = import('./docs/YouTubePlayer.mjs').OnPlaybackQualityChangeEvent;
44
+ export type OnPlaybackRateChangeEvent = import('./docs/YouTubePlayer.mjs').OnPlaybackRateChangeEvent;
45
+ export type OnApiChangeEvent = import('./docs/YouTubePlayer.mjs').OnApiChangeEvent;
46
+ export type OnAutoplayBlockedEvent = import('./docs/YouTubePlayer.mjs').OnAutoplayBlockedEvent;
47
+ export type HandlerFunc = (...args: any[]) => boolean;
48
+ export type IframeContainerOptions = {
49
+ /**
50
+ * - The YouTube video ID to be loaded.
51
+ */
52
+ videoId: string;
53
+ /**
54
+ * - The iframe width in pixels or a string (e.g., '100%').
55
+ */
56
+ width?: number | string;
57
+ /**
58
+ * - The iframe height in pixels or a string (e.g., '100%').
59
+ */
60
+ height?: number | string;
61
+ /**
62
+ * - If true, the iframe will be invisible (opacity 0) and will not respond to clicks (pointer-events none) and appends it to the document body.
63
+ */
64
+ hidden?: boolean;
65
+ /**
66
+ * - If true, the video will start automatically upon loading.
67
+ */
68
+ autoplay?: boolean;
69
+ };
70
+ import { BaseMediaAdapter } from './index.mjs';
71
+ import YouTubePlayer from './docs/YouTubePlayer.mjs';
72
+ /**
73
+ * Method to ensure the YouTube IFrame API script is loaded.
74
+ */
75
+ declare const loadYoutubeApi: () => Promise<any>;
76
+ /**
77
+ * Returns a deep clone of the current YouTube player state values.
78
+ * This ensures the returned object is a copy and does not maintain a reference to the original state.
79
+ * @returns {Record<string, number>} A copy of the PlayerState object.
80
+ */
81
+ declare const getPlayerStateValues: () => Record<string, number>;
82
+ /**
83
+ * Retrieves the YouTube Player constructor from the global window object.
84
+ * @returns {typeof YouTubePlayer} The YouTube Player constructor.
85
+ * @throws {Error} If the YouTube API is not detected in the global scope.
86
+ */
87
+ declare const getYtPlayer: () => typeof YouTubePlayer;
88
+ /**
89
+ * Implementation of BaseMediaAdapter for the YouTube IFrame Player API.
90
+ * This adapter manages the lifecycle of a YouTube player embedded in a container.
91
+ * @extends BaseMediaAdapter
92
+ */
93
+ declare class YoutubeMediaAdapter extends BaseMediaAdapter {
94
+ #private;
95
+ /**
96
+ * Mapping YouTube API events for internal adapter events.
97
+ * Includes semantic events triggered by state changes.
98
+ * @type {Record<string, string>}
99
+ * @private
100
+ */
101
+ private static EVENT_MAPPING;
102
+ /**
103
+ * Represents the current state of the player.
104
+ * @type {Record<string, number>}
105
+ */
106
+ static PlayerState: Record<string, number>;
107
+ /**
108
+ * Safety lock: If true, multiple instances can share the same player/iframe via WeakMap.
109
+ * If false, only one instance can be bound to a specific container at a time.
110
+ * @type {boolean}
111
+ */
112
+ static allowInstanceSharing: boolean;
113
+ /**
114
+ * Gets the globally configured default container for YouTube players.
115
+ * @returns {HTMLIFrameElement|null}
116
+ */
117
+ static get defaultContainer(): HTMLIFrameElement | null;
118
+ /**
119
+ * Sets the globally configured default container for YouTube players.
120
+ * @param {HTMLIFrameElement|null} element - The element to be used as the default container.
121
+ * @throws {TypeError} If the provided element is not an instance of HTMLIFrameElement.
122
+ */
123
+ static set defaultContainer(element: HTMLIFrameElement | null);
124
+ /**
125
+ * Creates a YouTube iframe element.
126
+ * This element can be used as the `defaultContainer` for the adapter.
127
+ *
128
+ * @param {IframeContainerOptions} options - Configuration for the iframe creation.
129
+ * @returns {HTMLIFrameElement} The created iframe element.
130
+ * @throws {TypeError} If the `videoId` is not a valid string.
131
+ */
132
+ static createIframeContainer(options: IframeContainerOptions): HTMLIFrameElement;
133
+ /**
134
+ * Returns the URL for a YouTube video thumbnail with a specified quality.
135
+ * @param {string} videoId - The YouTube video ID.
136
+ * @param {string} [quality='maxresdefault'] - The thumbnail quality (e.g., 'default', 'mqdefault', 'hqdefault', 'sddefault', 'maxresdefault').
137
+ * @returns {string} The thumbnail URL.
138
+ * @throws {TypeError} If the videoId is not a valid string.
139
+ */
140
+ static getThumbnailUrl(videoId: string, quality?: string): string;
141
+ get id(): string;
142
+ get currentContentId(): string | null;
143
+ /**
144
+ * Gets whether the adapter has been destroyed.
145
+ * @returns {boolean}
146
+ */
147
+ get destroyed(): boolean;
148
+ /**
149
+ * Initializes the YouTube Media Adapter.
150
+ * @throws {Error} If allowInstanceSharing is false and the container is already in use.
151
+ */
152
+ constructor();
153
+ /**
154
+ * @returns {YouTubePlayer} The current YouTube player instance.
155
+ * @throws {Error} If the player has not been initialized.
156
+ */
157
+ get player(): YouTubePlayer;
158
+ /**
159
+ * @param {number} value - The volume level from 0.0 to 1.0.
160
+ * @throws {RangeError} If the volume is not between 0.0 and 1.0.
161
+ */
162
+ set volume(value: number);
163
+ /**
164
+ * @returns {number} The current volume level from 0.0 to 1.0.
165
+ */
166
+ get volume(): number;
167
+ /**
168
+ * Retrieves a consolidated object containing all time-related metrics for the current media content.
169
+ * @returns {ContentTimeData} An object containing total, current, remaining time, and playback percentage.
170
+ */
171
+ getTimeData(): ContentTimeData;
172
+ /**
173
+ * Determines if the content is a valid YouTube URL or ID.
174
+ * @param {MediaContent} content - The media content to evaluate.
175
+ * @returns {boolean} True if the content is a YouTube link/ID, false otherwise.
176
+ */
177
+ canHandle(content: MediaContent): boolean;
178
+ /**
179
+ * Plays the media content. If the player is already initialized with a different video,
180
+ * it will load the new video automatically.
181
+ * @param {MediaContent} content - The media content to play.
182
+ * @returns {Promise<void>}
183
+ * @throws {TypeError} If the content data is invalid.
184
+ */
185
+ play(content: MediaContent): Promise<void>;
186
+ /**
187
+ * Pauses the current playback.
188
+ * @returns {Promise<void>}
189
+ */
190
+ pause(): Promise<void>;
191
+ /**
192
+ * Stops the playback completely.
193
+ * @returns {Promise<void>}
194
+ */
195
+ stop(): Promise<void>;
196
+ /**
197
+ * Seeks to a specific time in the media timeline.
198
+ * @param {number} timeMs - The target time in milliseconds.
199
+ * @returns {Promise<void>}
200
+ * @throws {TypeError} If timeMs is not a number.
201
+ */
202
+ seek(timeMs: number): Promise<void>;
203
+ /**
204
+ * Retrieves the current playback time.
205
+ * @returns {number} The current time in milliseconds.
206
+ */
207
+ getCurrentTime(): number;
208
+ /**
209
+ * Gets the total duration of the YouTube video.
210
+ * @returns {number} The total duration in milliseconds.
211
+ */
212
+ getTotalDuration(): number;
213
+ /**
214
+ * Gets the remaining time until the YouTube video ends.
215
+ * @returns {number} The remaining time in milliseconds.
216
+ */
217
+ getRemainingTime(): number;
218
+ /**
219
+ * Gets the percentage of the YouTube video that has been played.
220
+ * @returns {number} The percentage from 0 to 100.
221
+ */
222
+ getPlaybackPercentage(): number;
223
+ /**
224
+ * Sets the playback volume.
225
+ * @param {number} volume - The volume level from 0.0 to 1.0.
226
+ * @returns {void}
227
+ * @throws {RangeError} If volume is outside [0.0, 1.0].
228
+ */
229
+ setVolume(volume: number): void;
230
+ /**
231
+ * Gets the playback volume.
232
+ * @returns {number}
233
+ * @throws {RangeError} If volume is outside [0.0, 1.0].
234
+ */
235
+ getVolume(): number;
236
+ /**
237
+ * Retrieves the thumbnail URL for the currently loaded video with a specified quality.
238
+ * @param {string} [quality='maxresdefault'] - The thumbnail quality.
239
+ * @returns {string|null} The thumbnail URL or null if no video is loaded.
240
+ */
241
+ getThumbnailUrl(quality?: string): string | null;
242
+ /**
243
+ * Cleans up the instance and disconnects from the shared player.
244
+ */
245
+ destroy(): void;
246
+ }
247
+ /**
248
+ * Asynchronously ensures the YouTube IFrame API is loaded and returns
249
+ * the YouTube Player constructor and the current player state mapping.
250
+ *
251
+ * @returns {Promise<{ Player: typeof YouTubePlayer, PlayerState: Record<string, number> }>}
252
+ * An object containing the Player constructor and the current player state mapping.
253
+ */
254
+ declare const getYT: () => Promise<{
255
+ Player: typeof YouTubePlayer;
256
+ PlayerState: Record<string, number>;
257
+ }>;
258
+ export { YoutubeMediaAdapter, getYtPlayer, loadYoutubeApi, getPlayerStateValues, getYT };
259
+ //# sourceMappingURL=Youtube.d.mts.map