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
package/docs/v1/libs/TinyHtml.md
CHANGED
|
@@ -767,32 +767,6 @@ Finds elements by tag name in a namespace (defaults to XHTML).
|
|
|
767
767
|
|
|
768
768
|
## 🔍 Element Observer
|
|
769
769
|
|
|
770
|
-
### ⚡ `autoStartElemObserver`
|
|
771
|
-
|
|
772
|
-
A **flag** that determines whether the internal element observer should automatically start when some library code initializes.
|
|
773
|
-
|
|
774
|
-
* **Type** 🔘 — `boolean`
|
|
775
|
-
* **Default** 🏁 — `true`
|
|
776
|
-
|
|
777
|
-
#### 📥 Getter
|
|
778
|
-
|
|
779
|
-
```js
|
|
780
|
-
TinyHtml.autoStartElemObserver; // returns true or false
|
|
781
|
-
```
|
|
782
|
-
|
|
783
|
-
Returns the current state of the auto-start flag.
|
|
784
|
-
|
|
785
|
-
#### 📤 Setter
|
|
786
|
-
|
|
787
|
-
```js
|
|
788
|
-
TinyHtml.autoStartElemObserver = false;
|
|
789
|
-
```
|
|
790
|
-
|
|
791
|
-
Updates the flag.
|
|
792
|
-
⚠️ Throws a `TypeError` if the value is not a boolean.
|
|
793
|
-
|
|
794
|
-
---
|
|
795
|
-
|
|
796
770
|
### 👀 `tinyObserver`
|
|
797
771
|
|
|
798
772
|
The internal **[`TinyElementObserver`](./TinyElementObserver.md)** instance used by TinyHtml to track DOM changes.
|
|
@@ -857,9 +831,6 @@ document.addEventListener('tinyhtml.classchanged', (e) => {
|
|
|
857
831
|
console.log('🏷️ Class changed:', e.detail);
|
|
858
832
|
});
|
|
859
833
|
|
|
860
|
-
// Disable auto-start (if needed)
|
|
861
|
-
TinyHtml.autoStartElemObserver = false;
|
|
862
|
-
|
|
863
834
|
// Manually start the observer
|
|
864
835
|
TinyHtml.tinyObserver.start();
|
|
865
836
|
```
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# 🎧 TinyMediaPlayer Documentation
|
|
2
|
+
|
|
3
|
+
`TinyMediaPlayer` is a robust, universal media player manager designed to orchestrate playback across multiple different media providers (such as YouTube, Spotify, etc.) using an **Adapter Pattern**.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🧩 Core Architecture: The Adapter Pattern
|
|
8
|
+
|
|
9
|
+
To support different media platforms, `TinyMediaPlayer` relies on **Adapters**. You must create a class that extends `BaseMediaAdapter` for every new service you wish to support.
|
|
10
|
+
|
|
11
|
+
### 🛠️ `BaseMediaAdapter` (Abstract Class)
|
|
12
|
+
*This class cannot be instantiated directly. It serves as an interface.*
|
|
13
|
+
|
|
14
|
+
| Method | Description | Parameters | Returns |
|
|
15
|
+
| :--- | :--- | :--- | :--- |
|
|
16
|
+
| `canHandle` | Checks if the adapter supports a specific content item. | `content: MediaContent` | `boolean` |
|
|
17
|
+
| `play` | Starts or resumes playback. | `content: MediaContent` | `Promise<void>` |
|
|
18
|
+
| `pause` | Pauses the current playback. | None | `Promise<void>` |
|
|
19
|
+
| `stop` | Stops playback and resets the platform state. | None | `Promise<void>` |
|
|
20
|
+
| `seek` | Jumps to a specific time. | `timeMs: number` | `Promise<void>` |
|
|
21
|
+
| `getCurrentTime` | Gets the current playback position. | None | `number` (ms) |
|
|
22
|
+
| `setVolume` | Sets the volume level. | `volume: number` (0.0 to 1.0) | `void` |
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 🚀 `TinyMediaPlayer` Class
|
|
27
|
+
|
|
28
|
+
The main controller for managing playlists, playback state, and adapters.
|
|
29
|
+
|
|
30
|
+
### ⚙️ Configuration (Constructor Options)
|
|
31
|
+
When initializing `new TinyMediaPlayer(options)`, you can pass the following:
|
|
32
|
+
|
|
33
|
+
* **`persistVolume`** (`boolean`): If `true`, the volume level is automatically saved to and loaded from `localStorage`. (Default: `false`).
|
|
34
|
+
* **`volumeStorageKey`** (`string`): The key name used in `localStorage` to store the volume. (Default: `'tiny_media_player_volume'`).
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
### 🏗️ Static Members
|
|
39
|
+
|
|
40
|
+
#### Properties
|
|
41
|
+
* **`unknownArtist`**: A global setting for when an artist's name is unavailable.
|
|
42
|
+
* **Type**: `string` | `function` (returns a string).
|
|
43
|
+
* **Getter/Setter**: Allows you to define a custom string or a logic-based function.
|
|
44
|
+
|
|
45
|
+
#### Methods
|
|
46
|
+
* **`parseContent(source, defaultMetadata, metadata, parseFile, callbacks)`**:
|
|
47
|
+
* A static factory method to prepare a `MediaContent` object by extracting metadata from a URL or HTMLMediaElement.
|
|
48
|
+
* **Returns**: `Promise<MediaContent>`.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
### 📊 Instance Properties (Getters & Setters)
|
|
53
|
+
|
|
54
|
+
| Property | Type | Description |
|
|
55
|
+
| :--- | :--- | :--- |
|
|
56
|
+
| `playlist` | `MediaContent[]` | Returns a shallow copy of the current playlist. |
|
|
57
|
+
| `currentIndex` | `number` | The index of the currently playing track. |
|
|
58
|
+
| `loopMode` | `'NONE' \| 'TRACK' \| 'PLAYLIST'` | Defines how the player behaves at the end of a track. |
|
|
59
|
+
| `isRandom` | `boolean` | Enables or disables shuffle mode. |
|
|
60
|
+
| `isPlaying` | `boolean` | Indicates if media is currently playing. |
|
|
61
|
+
| `volume` | `number` | The current volume (constrained between `0.0` and `1.0`). |
|
|
62
|
+
| `persistVolume` | `boolean` | Enables/disables volume saving to `localStorage`. |
|
|
63
|
+
| `volumeStorageKey`| `string` | The key used for volume persistence. |
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
### 🕹️ Methods
|
|
68
|
+
|
|
69
|
+
#### 🔌 Adapter Management
|
|
70
|
+
* **`registerAdapter(id, adapter)`**: Registers a new provider.
|
|
71
|
+
* `id`: A unique string (e.g., `'youtube'`).
|
|
72
|
+
* `adapter`: An instance of a class extending `BaseMediaAdapter`.
|
|
73
|
+
|
|
74
|
+
#### 📋 Playlist Management
|
|
75
|
+
* **`addTrack(content)`**: Adds a new `MediaContent` object to the end of the playlist.
|
|
76
|
+
* **`existsTrack(index)`**: Returns `true` if a track exists at the given index.
|
|
77
|
+
* **`getTrack(index)`**: Retrieves the track at the specified index.
|
|
78
|
+
* **`removeTrack(index)`**: Removes a track. If the current track is removed, playback stops or adjusts.
|
|
79
|
+
* **`searchTrack(query)`**: Searches the playlist.
|
|
80
|
+
* `query`: A `string` (searches title, artist, or album) or a `function` (custom logic).
|
|
81
|
+
* **Returns**: `SearchResult[]` (array of objects containing the track and its index).
|
|
82
|
+
* **`clearPlaylist()`**: Stops playback and empties the playlist.
|
|
83
|
+
|
|
84
|
+
#### ⏯️ Playback Controls
|
|
85
|
+
* **`play()`**: Starts playback of the current track.
|
|
86
|
+
* **`pause()`**: Pauses the current track.
|
|
87
|
+
* **`stop()`**: Stops the current track completely.
|
|
88
|
+
* **`next()`**: Advances to the next track (respects `loopMode` and `isRandom`).
|
|
89
|
+
* **`prev()`**: Returns to the previous track (respects `loopMode` and `isRandom`).
|
|
90
|
+
* **`seek(timeMs)`**: Jumps to a specific millisecond in the current track.
|
|
91
|
+
* **`step(stepMs)`**: Moves the timeline forward (positive) or backward (negative) by a specific amount.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## ⚠️ Error Handling
|
|
96
|
+
|
|
97
|
+
The class uses strict validation. The following errors may be thrown:
|
|
98
|
+
* **`TypeError`**: Thrown when an argument is of the wrong type (e.g., passing a string to `volume`).
|
|
99
|
+
* **`RangeError`**: Thrown when a number is out of allowed bounds (e.g., an index that doesn't exist or volume > 1.0).
|
|
100
|
+
* **`Error`**: Thrown if no compatible adapter is found for the current content.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# 📻 TinyRadioFm Documentation
|
|
2
|
+
|
|
3
|
+
`TinyRadioFm` is a powerful, deterministic, and seed-based radio management system. It is designed to handle complex playback sequences, including music and voice playlists, scheduled timeline mutations, and custom content injections, all while maintaining absolute reproducibility through a mathematical seed. 🎯
|
|
4
|
+
|
|
5
|
+
> **Beta Status:** This engine is currently in beta.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## ✨ Key Features
|
|
10
|
+
|
|
11
|
+
* **🎯 Deterministic Playback:** Uses a `Mulberry32` PRNG to ensure that the same seed always produces the exact same radio sequence.
|
|
12
|
+
* **🎵 Dual-Stream Logic:** Manages separate playlists for `music` and `voice`, with configurable interaction rules (e.g., playing voices after music).
|
|
13
|
+
* **📅 Scheduled Mutations:** Schedule tasks to `add`, `remove`, or `move` items in the playlist at specific future timestamps.
|
|
14
|
+
* **⚡ Custom Injections:** Inject "Custom Positions" into the timeline that interrupt the standard cycle.
|
|
15
|
+
* **🧠 Smart Queuing:** Intelligent logic to prevent audio overlaps by automatically adjusting timestamps to the end of currently playing content.
|
|
16
|
+
* **💾 State Persistence:** Full export/import capabilities, including automatic conversion of Blob URLs to Base64 for easy storage.
|
|
17
|
+
* **🧹 Memory Management:** Proactive cleanup of Blob URLs and event listeners to prevent memory leaks.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## ⚙️ Configuration
|
|
22
|
+
|
|
23
|
+
The behavior of the engine is controlled via the `RadioConfig` object.
|
|
24
|
+
|
|
25
|
+
| Property | Type | Default | Description |
|
|
26
|
+
| :--- | :--- | :--- | :--- |
|
|
27
|
+
| `mode` | `'playlist' \| 'random'` | `'playlist'` | Sequence logic for the music playlist. |
|
|
28
|
+
| `voiceMode` | `'playlist' \| 'random'` | `'playlist'` | Sequence logic for the voice playlist. |
|
|
29
|
+
| `silenceDuration` | `number` | `0` | Gap in milliseconds between tracks. |
|
|
30
|
+
| `queryLimit` | `number` | `100000` | Safety lock for maximum items processed during queries. |
|
|
31
|
+
| `voiceAfterMusic` | `boolean` | `true` | If `true`, voice messages play after music tracks. |
|
|
32
|
+
| `voiceMin` | `number` | `0` | Minimum number of voice messages to play in a cycle. |
|
|
33
|
+
| `voiceMax` | `number` | `1` | Maximum number of voice messages to play in a cycle. |
|
|
34
|
+
| `musicMaxConsecutive`| `number` | `0` | Max consecutive music repeats (`-1` = unlimited, `0` = no repeats). |
|
|
35
|
+
| `voiceMaxConsecutive`| `number` | `0` | Max consecutive voice repeats (`-1` = unlimited, `0` = no repeats). |
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 🛠️ Core API Reference
|
|
40
|
+
|
|
41
|
+
### 🏗️ Static Methods
|
|
42
|
+
|
|
43
|
+
#### `static parseContent(source, defaultMetadata, metadata, parseFile, callbacks)`
|
|
44
|
+
Prepares a `MediaContent` object by extracting metadata from an audio source.
|
|
45
|
+
* **Parameters:**
|
|
46
|
+
* `source`: A URL string or an existing `HTMLMediaElement`.
|
|
47
|
+
* `defaultMetadata`: Optional base metadata.
|
|
48
|
+
* `metadata`: Optional manual overrides.
|
|
49
|
+
* `parseFile`: Internal helper for file parsing.
|
|
50
|
+
* `callbacks`: Object containing `onProgress` and `onError` handlers.
|
|
51
|
+
* **Returns:** `Promise<MediaContent>`
|
|
52
|
+
* **Throws:** `MediaLoadingError`
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
### 📥 Content Management
|
|
57
|
+
|
|
58
|
+
#### `add(type, data, smartQueue = true)`
|
|
59
|
+
Adds new content to the engine immediately.
|
|
60
|
+
* **Parameters:**
|
|
61
|
+
* `type`: `'music' | 'voice' | 'custom'`.
|
|
62
|
+
* `data`: The `MediaContent` object (must include `id` and `duration`).
|
|
63
|
+
* `smartQueue`: If `true`, delays insertion until the current content ends (primarily for `custom`).
|
|
64
|
+
* **Emits:** `contentAdded`
|
|
65
|
+
|
|
66
|
+
#### `remove(id)`
|
|
67
|
+
Instantly removes content by its unique ID across all lists, custom positions, and pending tasks. It also revokes associated Blob URLs.
|
|
68
|
+
* **Parameters:** `id` (string)
|
|
69
|
+
* **Emits:** `contentRemoved`
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### 📅 Task & Config Management
|
|
74
|
+
|
|
75
|
+
#### `scheduleTask(timestamp, action, type, payload, smartQueue = true)`
|
|
76
|
+
Schedules a modification to the playlists at a specific point in time.
|
|
77
|
+
* **Parameters:**
|
|
78
|
+
* `timestamp`: Target epoch timestamp (ms).
|
|
79
|
+
* `action`: `'add' | 'remove' | 'move'`.
|
|
80
|
+
* `type`: `'music' | 'voice'`.
|
|
81
|
+
* `payload`: Data required for the action (`MediaContent` for add, `string` for remove, or `ScheduledMovePayload` for move).
|
|
82
|
+
* `smartQueue`: If `true`, aligns the task to the end of the current event.
|
|
83
|
+
* **Emits:** `taskScheduled`
|
|
84
|
+
|
|
85
|
+
#### `setConfig(config)`
|
|
86
|
+
Performs a partial or full update of the engine configuration.
|
|
87
|
+
* **Parameters:** `config` (Partial or full `RadioConfig` object).
|
|
88
|
+
* **Emits:** `configChanged`
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
### 🔍 Timeline & Querying
|
|
93
|
+
|
|
94
|
+
#### `getCurrentEvent()`
|
|
95
|
+
Retrieves the exact event currently playing at the system's current time.
|
|
96
|
+
* **Returns:** `RadioEvent | null`
|
|
97
|
+
|
|
98
|
+
#### `queryTimeline(targetDate, limit = 10)`
|
|
99
|
+
Predicts upcoming events from a specific date forward using a virtual sandbox to prevent state mutation.
|
|
100
|
+
* **Parameters:**
|
|
101
|
+
* `targetDate`: Starting epoch timestamp.
|
|
102
|
+
* `limit`: Maximum number of events to return.
|
|
103
|
+
* **Returns:** `RadioEvent[]`
|
|
104
|
+
* **Throws:** `TypeError` or `RangeError` if limit is invalid.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### 💾 Persistence & Lifecycle
|
|
109
|
+
|
|
110
|
+
#### `async exportState()`
|
|
111
|
+
Exports the entire radio state (playlists, tasks, seed, config) as a JSON string. Automatically converts all image Blob URLs to **Base64** for portability.
|
|
112
|
+
* **Returns:** `Promise<string>`
|
|
113
|
+
|
|
114
|
+
#### `importState(json)`
|
|
115
|
+
Hydrates the engine with a previously exported state.
|
|
116
|
+
* **Parameters:** `json` (A JSON string or a state object).
|
|
117
|
+
* **Emits:** `stateImported`
|
|
118
|
+
|
|
119
|
+
#### `destroy(destroyThumbs = true)`
|
|
120
|
+
Performs a complete cleanup. It wipes all lists, clears the cache, removes all listeners, and revokes all Blob URLs to free up system memory.
|
|
121
|
+
* **Parameters:** `destroyThumbs` (boolean) - Whether to revoke image Blob URLs.
|
|
122
|
+
* **Emits:** `destroyed`
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## 📊 Data Models (Summary)
|
|
127
|
+
|
|
128
|
+
### `RadioEvent` 📡
|
|
129
|
+
The standardized object returned when querying the timeline.
|
|
130
|
+
* `id`, `title`, `artist`, `url`, `duration`
|
|
131
|
+
* `absoluteStart`, `absoluteEnd`
|
|
132
|
+
* `elapsedTime`, `remainingTime`
|
|
133
|
+
* `progress` (0 to 1)
|
|
134
|
+
* `isCustom` (boolean)
|
|
135
|
+
|
|
136
|
+
### `ScheduledTask` 📝
|
|
137
|
+
An instruction to change the radio state.
|
|
138
|
+
* `timestamp`: Execution time.
|
|
139
|
+
* `action`: `'add' | 'remove' | 'move'`.
|
|
140
|
+
* `type`: `'music' | 'voice'`.
|
|
141
|
+
* `payload`: Action-specific data.
|
|
@@ -358,15 +358,15 @@ scroller._listenLoadEvents(imgElement);
|
|
|
358
358
|
|
|
359
359
|
## 🧱 DOM and Element Accessors
|
|
360
360
|
|
|
361
|
-
### 🎯 `
|
|
361
|
+
### 🎯 `targetElement`
|
|
362
362
|
|
|
363
363
|
Returns the internal scroll container element being monitored.
|
|
364
364
|
|
|
365
365
|
```js
|
|
366
|
-
const container = scroller.
|
|
366
|
+
const container = scroller.targetElement;
|
|
367
367
|
```
|
|
368
368
|
|
|
369
|
-
* 🔙 Returns the target DOM element
|
|
369
|
+
* 🔙 Returns the target DOM element.
|
|
370
370
|
|
|
371
371
|
### 🕵️♀️ `getOldSize(el)`
|
|
372
372
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiny-essentials",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.0",
|
|
4
4
|
"description": "Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tiny-essentials-fork": "./TinyFork.mjs"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
9
|
"test": "npm run test:mjs && npm run test:cjs && npm run test:js",
|
|
10
|
-
"test:js": "
|
|
10
|
+
"test:js": "node -r @babel/register test/index.js",
|
|
11
11
|
"test:cjs": "node test/index.cjs",
|
|
12
12
|
"test:mjs": "node test/index.mjs",
|
|
13
13
|
"test:mjs:web": "node test/express.mjs",
|
|
@@ -60,6 +60,10 @@
|
|
|
60
60
|
"require": "./dist/v1/basics/index.cjs",
|
|
61
61
|
"import": "./dist/v1/basics/index.mjs"
|
|
62
62
|
},
|
|
63
|
+
"./basics/mediaContent": {
|
|
64
|
+
"require": "./dist/v1/basics/mediaContent.cjs",
|
|
65
|
+
"import": "./dist/v1/basics/mediaContent.mjs"
|
|
66
|
+
},
|
|
63
67
|
"./basics/array": {
|
|
64
68
|
"require": "./dist/v1/basics/array.cjs",
|
|
65
69
|
"import": "./dist/v1/basics/array.mjs"
|
|
@@ -112,6 +116,14 @@
|
|
|
112
116
|
"require": "./dist/v1/libs/ColorSafeStringify.cjs",
|
|
113
117
|
"import": "./dist/v1/libs/ColorSafeStringify.mjs"
|
|
114
118
|
},
|
|
119
|
+
"./libs/TinyMediaPlayer": {
|
|
120
|
+
"require": "./dist/v1/libs/TinyMediaPlayer.cjs",
|
|
121
|
+
"import": "./dist/v1/libs/TinyMediaPlayer.mjs"
|
|
122
|
+
},
|
|
123
|
+
"./libs/TinyRadioFm": {
|
|
124
|
+
"require": "./dist/v1/libs/TinyRadioFm.cjs",
|
|
125
|
+
"import": "./dist/v1/libs/TinyRadioFm.mjs"
|
|
126
|
+
},
|
|
115
127
|
"./libs/UltraRandomMsgGen": {
|
|
116
128
|
"require": "./dist/v1/libs/UltraRandomMsgGen.cjs",
|
|
117
129
|
"import": "./dist/v1/libs/UltraRandomMsgGen.mjs"
|
|
@@ -268,6 +280,10 @@
|
|
|
268
280
|
"require": "./dist/v1/libs/TinyAdvancedRaffle.cjs",
|
|
269
281
|
"import": "./dist/v1/libs/TinyAdvancedRaffle.mjs"
|
|
270
282
|
},
|
|
283
|
+
"./libs/TinyClassManager/TinyPluginInliner": {
|
|
284
|
+
"require": "./dist/v1/libs/TinyClassManager/TinyPluginInliner.cjs",
|
|
285
|
+
"import": "./dist/v1/libs/TinyClassManager/TinyPluginInliner.mjs"
|
|
286
|
+
},
|
|
271
287
|
"./libs/TinyClassManager": {
|
|
272
288
|
"require": "./dist/v1/libs/TinyClassManager.cjs",
|
|
273
289
|
"import": "./dist/v1/libs/TinyClassManager.mjs"
|
|
@@ -501,36 +517,38 @@
|
|
|
501
517
|
},
|
|
502
518
|
"homepage": "https://github.com/Tiny-Essentials/Tiny-Essentials#readme",
|
|
503
519
|
"devDependencies": {
|
|
504
|
-
"@babel/cli": "^
|
|
505
|
-
"@babel/core": "^
|
|
506
|
-
"@babel/generator": "^
|
|
507
|
-
"@babel/node": "^
|
|
508
|
-
"@babel/parser": "^
|
|
509
|
-
"@babel/preset-env": "^
|
|
510
|
-
"@babel/
|
|
511
|
-
"@babel/
|
|
512
|
-
"@
|
|
520
|
+
"@babel/cli": "^8.0.1",
|
|
521
|
+
"@babel/core": "^8.0.1",
|
|
522
|
+
"@babel/generator": "^8.0.0",
|
|
523
|
+
"@babel/node": "^8.0.1",
|
|
524
|
+
"@babel/parser": "^8.0.0",
|
|
525
|
+
"@babel/preset-env": "^8.0.2",
|
|
526
|
+
"@babel/register": "^8.0.1",
|
|
527
|
+
"@babel/traverse": "^8.0.0",
|
|
528
|
+
"@babel/types": "^8.0.0",
|
|
529
|
+
"@rollup/plugin-commonjs": "^29.0.3",
|
|
513
530
|
"@rollup/plugin-json": "^6.1.0",
|
|
514
|
-
"@rollup/plugin-node-resolve": "^16.0.
|
|
515
|
-
"@rollup/plugin-typescript": "^12.
|
|
531
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
532
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
516
533
|
"@types/lodash": "^4.17.16",
|
|
517
|
-
"@types/md5": "^2.3.
|
|
534
|
+
"@types/md5": "^2.3.6",
|
|
535
|
+
"@types/node": "^26.1.0",
|
|
518
536
|
"@types/node-fetch": "^2.6.12",
|
|
519
537
|
"babel-preset-es2015": "^6.24.1",
|
|
520
|
-
"esbuild": "^0.
|
|
538
|
+
"esbuild": "^0.28.1",
|
|
521
539
|
"express": "^5.1.0",
|
|
522
540
|
"lodash": "^4.17.21",
|
|
523
|
-
"marked": "^
|
|
541
|
+
"marked": "^18.0.5",
|
|
524
542
|
"node-polyfill-webpack-plugin": "^4.1.0",
|
|
525
|
-
"prettier": "3.
|
|
526
|
-
"rollup": "^4.
|
|
543
|
+
"prettier": "^3.9.4",
|
|
544
|
+
"rollup": "^4.62.2",
|
|
527
545
|
"rollup-preserve-directives": "^1.1.3",
|
|
528
546
|
"safe-stable-stringify": "^2.5.0",
|
|
529
|
-
"sass": "^1.
|
|
547
|
+
"sass": "^1.101.0",
|
|
530
548
|
"tslib": "^2.8.1",
|
|
531
|
-
"type-fest": "^5.0
|
|
532
|
-
"typescript": "^
|
|
549
|
+
"type-fest": "^5.7.0",
|
|
550
|
+
"typescript": "^6.0.3",
|
|
533
551
|
"webpack": "^5.99.6",
|
|
534
|
-
"webpack-cli": "^
|
|
552
|
+
"webpack-cli": "^7.1.0"
|
|
535
553
|
}
|
|
536
554
|
}
|