@await-widget/runtime 0.0.12 → 0.0.14

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.12",
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.14",
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?: AwaitMediaPlayConfig,
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;
@@ -175,7 +195,7 @@ type AwaitMusicPlayerCommand =
175
195
  | 'clearRating'
176
196
  | 'dislike';
177
197
 
178
- type AwaitMediaPlayConfig =
198
+ type AwaitMusicPlayConfig =
179
199
  | {
180
200
  source: 'song';
181
201
  id?: string;
@@ -183,7 +203,14 @@ type AwaitMediaPlayConfig =
183
203
  limit?: number;
184
204
  shuffle?: boolean;
185
205
  loop?: boolean;
186
- offset?: number;
206
+ }
207
+ | {
208
+ source: 'artist';
209
+ id?: string;
210
+ query?: string;
211
+ limit?: number;
212
+ shuffle?: boolean;
213
+ loop?: boolean;
187
214
  }
188
215
  | {
189
216
  source: 'album';