@await-widget/runtime 0.0.11 → 0.0.13

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/package.json CHANGED
@@ -1,33 +1,33 @@
1
1
  {
2
- "name": "@await-widget/runtime",
3
- "version": "0.0.11",
4
- "description": "TypeScript declarations for Await widgets.",
5
- "license": "MIT",
6
- "author": "LitoMore",
7
- "type": "module",
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/await-widget/runtime.git"
11
- },
12
- "publishConfig": {
13
- "access": "public"
14
- },
15
- "files": [
16
- "types/*.d.ts"
17
- ],
18
- "types": "./types/index.d.ts",
19
- "exports": {
20
- ".": {
21
- "types": "./types/index.d.ts"
22
- }
23
- },
24
- "scripts": {
25
- "format:types": "xo --fix types/*.d.ts",
26
- "test": "tsc --noEmit -p test/tsconfig.json",
27
- "pack:dry": "npm --cache .npm-cache pack --dry-run"
28
- },
29
- "devDependencies": {
30
- "typescript": "^6.0.2",
31
- "xo": "^2.0.2"
32
- }
2
+ "name": "@await-widget/runtime",
3
+ "version": "0.0.13",
4
+ "description": "TypeScript declarations for Await widgets.",
5
+ "license": "MIT",
6
+ "author": "LitoMore",
7
+ "type": "module",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/await-widget/runtime.git"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "files": [
16
+ "types/*.d.ts"
17
+ ],
18
+ "types": "./types/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./types/index.d.ts"
22
+ }
23
+ },
24
+ "scripts": {
25
+ "format:types": "xo --fix types/*.d.ts",
26
+ "test": "tsc --noEmit -p test/tsconfig.json",
27
+ "pack:dry": "npm --cache .npm-cache pack --dry-run"
28
+ },
29
+ "devDependencies": {
30
+ "typescript": "^6.0.2",
31
+ "xo": "^2.0.2"
32
+ }
33
33
  }
package/types/bridge.d.ts CHANGED
@@ -65,11 +65,11 @@ export declare const AwaitAlarm: {
65
65
  schedule(config: AwaitAlarmScheduleConfig): Promise<string>;
66
66
  cancel(id: string): any;
67
67
  };
68
- export declare const AwaitMedia: {
69
- nowPlayingMedia(config?: AwaitNowPlayingConfig): Promise<AwaitNowPlayingInfo>;
70
- mediaPlayerCommand(
68
+ export declare const AwaitMusic: {
69
+ nowPlaying(config?: AwaitNowPlayingConfig): Promise<AwaitNowPlayingInfo>;
70
+ playerCommand(
71
71
  command: AwaitMusicPlayerCommand,
72
- config?: AwaitMediaCommandConfig,
72
+ config?: AwaitMusicPlayConfig,
73
73
  ): Promise<void>;
74
74
  };
75
75
  export declare const AwaitStore: {
@@ -167,7 +167,7 @@ type AwaitCalendarGlobal = typeof AwaitCalendar;
167
167
  type AwaitReminderGlobal = typeof AwaitReminder;
168
168
  type AwaitSystemGlobal = typeof AwaitSystem;
169
169
  type AwaitAlarmGlobal = typeof AwaitAlarm;
170
- type AwaitMediaGlobal = typeof AwaitMedia;
170
+ type AwaitMusicGlobal = typeof AwaitMusic;
171
171
  type AwaitStoreGlobal = typeof AwaitStore;
172
172
  type AwaitFileGlobal = typeof AwaitFile;
173
173
  type AwaitAudioGlobal = typeof AwaitAudio;
@@ -186,7 +186,7 @@ declare global {
186
186
  const AwaitReminder: AwaitReminderGlobal;
187
187
  const AwaitSystem: AwaitSystemGlobal;
188
188
  const AwaitAlarm: AwaitAlarmGlobal;
189
- const AwaitMedia: AwaitMediaGlobal;
189
+ const AwaitMusic: AwaitMusicGlobal;
190
190
  const AwaitStore: AwaitStoreGlobal;
191
191
  const AwaitFile: AwaitFileGlobal;
192
192
  const AwaitAudio: AwaitAudioGlobal;
package/types/model.d.ts CHANGED
@@ -141,6 +141,26 @@ type AwaitNowPlayingConfig = {
141
141
  artworkSize?: number;
142
142
  };
143
143
 
144
+ type AwaitMusicSource =
145
+ | {
146
+ type: 'song';
147
+ }
148
+ | {
149
+ type: 'artist';
150
+ id: string;
151
+ name: string;
152
+ }
153
+ | {
154
+ type: 'album';
155
+ id: string;
156
+ name: string;
157
+ }
158
+ | {
159
+ type: 'station';
160
+ id: string;
161
+ name: string;
162
+ };
163
+
144
164
  type AwaitNowPlayingInfo = {
145
165
  state?:
146
166
  | 'playing'
@@ -149,7 +169,7 @@ type AwaitNowPlayingInfo = {
149
169
  | 'interrupted'
150
170
  | 'seekingForward'
151
171
  | 'seekingBackward';
152
- sourceConfig?: AwaitMediaPlayConfig;
172
+ source?: AwaitMusicSource;
153
173
  id?: string;
154
174
  title?: string;
155
175
  artistName?: string;
@@ -171,9 +191,11 @@ type AwaitMusicPlayerCommand =
171
191
  | 'toggle'
172
192
  | 'next'
173
193
  | 'previous'
174
- | 'favorite';
194
+ | 'favorite'
195
+ | 'clearRating'
196
+ | 'dislike';
175
197
 
176
- type AwaitMediaPlayConfig =
198
+ type AwaitMusicPlayConfig =
177
199
  | {
178
200
  source: 'song';
179
201
  id?: string;
@@ -183,6 +205,14 @@ type AwaitMediaPlayConfig =
183
205
  loop?: boolean;
184
206
  offset?: number;
185
207
  }
208
+ | {
209
+ source: 'artist';
210
+ id?: string;
211
+ query?: string;
212
+ limit?: number;
213
+ shuffle?: boolean;
214
+ loop?: boolean;
215
+ }
186
216
  | {
187
217
  source: 'album';
188
218
  id?: string;
@@ -197,12 +227,6 @@ type AwaitMediaPlayConfig =
197
227
  id?: string;
198
228
  };
199
229
 
200
- type AwaitMediaFavoriteConfig = {
201
- rating?: -1 | 0 | 1;
202
- };
203
-
204
- type AwaitMediaCommandConfig = AwaitMediaPlayConfig | AwaitMediaFavoriteConfig;
205
-
206
230
  type AwaitCalendarConfig = {
207
231
  start?: Date;
208
232
  end?: Date;