@spicetify/kit 0.1.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.
Files changed (115) hide show
  1. package/bin/spicetify-kit.js +4 -0
  2. package/dist/build.js +335 -0
  3. package/dist/check.js +284 -0
  4. package/dist/classmap.js +187 -0
  5. package/dist/cli.js +53 -0
  6. package/dist/create.js +429 -0
  7. package/dist/dev.js +100 -0
  8. package/dist/from-theme.js +96 -0
  9. package/dist/install.js +60 -0
  10. package/dist/launch.js +122 -0
  11. package/dist/pack.js +31 -0
  12. package/dist/push.js +211 -0
  13. package/dist/vault.js +108 -0
  14. package/package.json +49 -0
  15. package/vendor/classmaps/1020096/classmap-19f856aefd5.json +109 -0
  16. package/vendor/shims/chunks.d.ts +10 -0
  17. package/vendor/shims/remote-modules.d.ts +6 -0
  18. package/vendor/shims/spicetify.d.ts +2437 -0
  19. package/vendor/stdlib/deps.ts +24 -0
  20. package/vendor/stdlib/index.ts +24 -0
  21. package/vendor/stdlib/lib/modal.tsx +128 -0
  22. package/vendor/stdlib/lib/popover.ts +84 -0
  23. package/vendor/stdlib/lib/primitives-classes.ts +66 -0
  24. package/vendor/stdlib/lib/primitives-vanilla.ts +277 -0
  25. package/vendor/stdlib/lib/primitives.tsx +314 -0
  26. package/vendor/stdlib/load.ts +17 -0
  27. package/vendor/stdlib/metadata.json +18 -0
  28. package/vendor/stdlib/mixin.ts +32 -0
  29. package/vendor/stdlib/mod.ts +26 -0
  30. package/vendor/stdlib/src/chunks.d.ts +10 -0
  31. package/vendor/stdlib/src/client.ts +114 -0
  32. package/vendor/stdlib/src/createIconComponent.tsx +29 -0
  33. package/vendor/stdlib/src/events.mix.ts +55 -0
  34. package/vendor/stdlib/src/events.ts +58 -0
  35. package/vendor/stdlib/src/expose/GraphQL.ts +40 -0
  36. package/vendor/stdlib/src/expose/Platform.ts +48 -0
  37. package/vendor/stdlib/src/expose/React.ts +95 -0
  38. package/vendor/stdlib/src/expose/ReactFlipToolkitSpring.ts +27 -0
  39. package/vendor/stdlib/src/expose/ReduxStore.ts +39 -0
  40. package/vendor/stdlib/src/expose/SettingsSection.ts +60 -0
  41. package/vendor/stdlib/src/expose/Snackbar.ts +34 -0
  42. package/vendor/stdlib/src/expose/Tippy.ts +26 -0
  43. package/vendor/stdlib/src/expose/enqueueImageSnackbar.ts +25 -0
  44. package/vendor/stdlib/src/expose/index.ts +14 -0
  45. package/vendor/stdlib/src/expose/jsx-runtime.ts +46 -0
  46. package/vendor/stdlib/src/expose/react-dom-shim.ts +50 -0
  47. package/vendor/stdlib/src/expose/react-shim.ts +116 -0
  48. package/vendor/stdlib/src/logger.ts +35 -0
  49. package/vendor/stdlib/src/playbar-compat.tsx +136 -0
  50. package/vendor/stdlib/src/registers/index.ts +176 -0
  51. package/vendor/stdlib/src/registers/menu.ts +160 -0
  52. package/vendor/stdlib/src/registers/mount.ts +307 -0
  53. package/vendor/stdlib/src/registers/nativeAnchors.ts +49 -0
  54. package/vendor/stdlib/src/registers/navlink.tsx +165 -0
  55. package/vendor/stdlib/src/registers/order.ts +22 -0
  56. package/vendor/stdlib/src/registers/panel.ts +168 -0
  57. package/vendor/stdlib/src/registers/playbarButton.tsx +93 -0
  58. package/vendor/stdlib/src/registers/playbarWidget.tsx +71 -0
  59. package/vendor/stdlib/src/registers/registry.ts +12 -0
  60. package/vendor/stdlib/src/registers/root.ts +101 -0
  61. package/vendor/stdlib/src/registers/route.ts +123 -0
  62. package/vendor/stdlib/src/registers/settingsRow.tsx +56 -0
  63. package/vendor/stdlib/src/registers/settingsSection.ts +59 -0
  64. package/vendor/stdlib/src/registers/topbarLeftButton.tsx +86 -0
  65. package/vendor/stdlib/src/registers/topbarRightButton.tsx +87 -0
  66. package/vendor/stdlib/src/storage.ts +163 -0
  67. package/vendor/stdlib/src/util.ts +62 -0
  68. package/vendor/stdlib/src/utils/index.ts +16 -0
  69. package/vendor/stdlib/src/webpack/ClassNames.gen.ts +10 -0
  70. package/vendor/stdlib/src/webpack/ClassNames.ts +6 -0
  71. package/vendor/stdlib/src/webpack/ClassNames.xpui.ts +16 -0
  72. package/vendor/stdlib/src/webpack/ComponentLibrary.gen.ts +10 -0
  73. package/vendor/stdlib/src/webpack/ComponentLibrary.ts +6 -0
  74. package/vendor/stdlib/src/webpack/ComponentLibrary.xpui.ts +18 -0
  75. package/vendor/stdlib/src/webpack/FilterContext.gen.ts +10 -0
  76. package/vendor/stdlib/src/webpack/FilterContext.ts +6 -0
  77. package/vendor/stdlib/src/webpack/FilterContext.xpui.ts +10 -0
  78. package/vendor/stdlib/src/webpack/Mousetrap.gen.ts +10 -0
  79. package/vendor/stdlib/src/webpack/Mousetrap.ts +6 -0
  80. package/vendor/stdlib/src/webpack/Mousetrap.xpui.ts +12 -0
  81. package/vendor/stdlib/src/webpack/React.gen.ts +14 -0
  82. package/vendor/stdlib/src/webpack/React.ts +6 -0
  83. package/vendor/stdlib/src/webpack/React.xpui.ts +15 -0
  84. package/vendor/stdlib/src/webpack/ReactComponents.desktop.ts +17 -0
  85. package/vendor/stdlib/src/webpack/ReactComponents.gen.ts +74 -0
  86. package/vendor/stdlib/src/webpack/ReactComponents.panel.ts +19 -0
  87. package/vendor/stdlib/src/webpack/ReactComponents.ts +50 -0
  88. package/vendor/stdlib/src/webpack/ReactComponents.xpui.ts +164 -0
  89. package/vendor/stdlib/src/webpack/ReactFlipToolkit.gen.ts +12 -0
  90. package/vendor/stdlib/src/webpack/ReactFlipToolkit.ts +6 -0
  91. package/vendor/stdlib/src/webpack/ReactFlipToolkit.xpui.ts +14 -0
  92. package/vendor/stdlib/src/webpack/ReactHooks.fullscreen.ts +15 -0
  93. package/vendor/stdlib/src/webpack/ReactHooks.gen.ts +32 -0
  94. package/vendor/stdlib/src/webpack/ReactHooks.ts +6 -0
  95. package/vendor/stdlib/src/webpack/ReactHooks.xpui.ts +38 -0
  96. package/vendor/stdlib/src/webpack/ReactQuery.gen.ts +26 -0
  97. package/vendor/stdlib/src/webpack/ReactQuery.ts +6 -0
  98. package/vendor/stdlib/src/webpack/ReactQuery.xpui.ts +46 -0
  99. package/vendor/stdlib/src/webpack/ReactRouter.gen.ts +12 -0
  100. package/vendor/stdlib/src/webpack/ReactRouter.ts +6 -0
  101. package/vendor/stdlib/src/webpack/ReactRouter.xpui.ts +22 -0
  102. package/vendor/stdlib/src/webpack/Snackbar.gen.ts +12 -0
  103. package/vendor/stdlib/src/webpack/Snackbar.ts +6 -0
  104. package/vendor/stdlib/src/webpack/Snackbar.xpui.ts +27 -0
  105. package/vendor/stdlib/src/webpack/URI.gen.ts +26 -0
  106. package/vendor/stdlib/src/webpack/URI.ts +82 -0
  107. package/vendor/stdlib/src/webpack/URI.xpui.ts +111 -0
  108. package/vendor/stdlib/src/webpack/capture-readiness.ts +49 -0
  109. package/vendor/stdlib/src/webpack/index.ts +186 -0
  110. package/vendor/stdlib/src/webpack/misc.gen.ts +16 -0
  111. package/vendor/stdlib/src/webpack/misc.ts +6 -0
  112. package/vendor/stdlib/src/webpack/misc.xpui.ts +27 -0
  113. package/vendor/stdlib/src/wpunpk.mix.ts +104 -0
  114. package/vendor/stdlib/src/wpunpk.ts +36 -0
  115. package/vendor/stdlib/vendor/rxjs.d.ts +5 -0
@@ -0,0 +1,2437 @@
1
+ /*
2
+ * Ambient type surface for the client's `Spicetify` global, so module authors
3
+ * get autocomplete and typechecking on it by default (no import, no cast).
4
+ * Derived from the community Spicetify type definitions; v3-specific members
5
+ * (Modules, _platform) and a TrackMetadata index signature are layered on top.
6
+ * SPDX-License-Identifier: GPL-3.0-or-later
7
+ */
8
+ declare namespace Spicetify {
9
+ /** v3 modular loader runtime: Spicetify.Modules.report/list()/manifest/etc. */
10
+ const Modules: any;
11
+ /** Internal platform registry that backs `Platform`. */
12
+ const _platform: any;
13
+ type Icon =
14
+ | "album"
15
+ | "artist"
16
+ | "block"
17
+ | "brightness"
18
+ | "car"
19
+ | "chart-down"
20
+ | "chart-up"
21
+ | "check"
22
+ | "check-alt-fill"
23
+ | "chevron-left"
24
+ | "chevron-right"
25
+ | "chromecast-disconnected"
26
+ | "clock"
27
+ | "collaborative"
28
+ | "computer"
29
+ | "copy"
30
+ | "download"
31
+ | "downloaded"
32
+ | "edit"
33
+ | "enhance"
34
+ | "exclamation-circle"
35
+ | "external-link"
36
+ | "facebook"
37
+ | "follow"
38
+ | "fullscreen"
39
+ | "gamepad"
40
+ | "grid-view"
41
+ | "heart"
42
+ | "heart-active"
43
+ | "instagram"
44
+ | "laptop"
45
+ | "library"
46
+ | "list-view"
47
+ | "location"
48
+ | "locked"
49
+ | "locked-active"
50
+ | "lyrics"
51
+ | "menu"
52
+ | "minimize"
53
+ | "minus"
54
+ | "more"
55
+ | "new-spotify-connect"
56
+ | "offline"
57
+ | "pause"
58
+ | "phone"
59
+ | "play"
60
+ | "playlist"
61
+ | "playlist-folder"
62
+ | "plus-alt"
63
+ | "plus2px"
64
+ | "podcasts"
65
+ | "projector"
66
+ | "queue"
67
+ | "repeat"
68
+ | "repeat-once"
69
+ | "search"
70
+ | "search-active"
71
+ | "shuffle"
72
+ | "skip-back"
73
+ | "skip-back15"
74
+ | "skip-forward"
75
+ | "skip-forward15"
76
+ | "soundbetter"
77
+ | "speaker"
78
+ | "spotify"
79
+ | "subtitles"
80
+ | "tablet"
81
+ | "ticket"
82
+ | "twitter"
83
+ | "visualizer"
84
+ | "voice"
85
+ | "volume"
86
+ | "volume-off"
87
+ | "volume-one-wave"
88
+ | "volume-two-wave"
89
+ | "watch"
90
+ | "x";
91
+ type Variant =
92
+ | "bass"
93
+ | "forte"
94
+ | "brio"
95
+ | "altoBrio"
96
+ | "alto"
97
+ | "canon"
98
+ | "celloCanon"
99
+ | "cello"
100
+ | "ballad"
101
+ | "balladBold"
102
+ | "viola"
103
+ | "violaBold"
104
+ | "mesto"
105
+ | "mestoBold"
106
+ | "metronome"
107
+ | "finale"
108
+ | "finaleBold"
109
+ | "minuet"
110
+ | "minuetBold";
111
+ type SemanticColor =
112
+ | "textBase"
113
+ | "textSubdued"
114
+ | "textBrightAccent"
115
+ | "textNegative"
116
+ | "textWarning"
117
+ | "textPositive"
118
+ | "textAnnouncement"
119
+ | "essentialBase"
120
+ | "essentialSubdued"
121
+ | "essentialBrightAccent"
122
+ | "essentialNegative"
123
+ | "essentialWarning"
124
+ | "essentialPositive"
125
+ | "essentialAnnouncement"
126
+ | "decorativeBase"
127
+ | "decorativeSubdued"
128
+ | "backgroundBase"
129
+ | "backgroundHighlight"
130
+ | "backgroundPress"
131
+ | "backgroundElevatedBase"
132
+ | "backgroundElevatedHighlight"
133
+ | "backgroundElevatedPress"
134
+ | "backgroundTintedBase"
135
+ | "backgroundTintedHighlight"
136
+ | "backgroundTintedPress"
137
+ | "backgroundUnsafeForSmallTextBase"
138
+ | "backgroundUnsafeForSmallTextHighlight"
139
+ | "backgroundUnsafeForSmallTextPress";
140
+ type ColorSet =
141
+ | "base"
142
+ | "brightAccent"
143
+ | "negative"
144
+ | "warning"
145
+ | "positive"
146
+ | "announcement"
147
+ | "invertedDark"
148
+ | "invertedLight"
149
+ | "mutedAccent"
150
+ | "overMedia";
151
+ type ColorSetBackgroundColors = {
152
+ base: string;
153
+ highlight: string;
154
+ press: string;
155
+ };
156
+ type ColorSetNamespaceColors = {
157
+ announcement: string;
158
+ base: string;
159
+ brightAccent: string;
160
+ negative: string;
161
+ positive: string;
162
+ subdued: string;
163
+ warning: string;
164
+ };
165
+ type ColorSetBody = {
166
+ background: ColorSetBackgroundColors & {
167
+ elevated: ColorSetBackgroundColors;
168
+ tinted: ColorSetBackgroundColors;
169
+ unsafeForSmallText: ColorSetBackgroundColors;
170
+ };
171
+ decorative: {
172
+ base: string;
173
+ subdued: string;
174
+ };
175
+ essential: ColorSetNamespaceColors;
176
+ text: ColorSetNamespaceColors;
177
+ };
178
+ type Metadata = Partial<Record<string, string>>;
179
+ type ContextTrack = {
180
+ uri: string;
181
+ uid?: string;
182
+ metadata?: Metadata;
183
+ };
184
+ type PlayerState = {
185
+ timestamp: number;
186
+ context: PlayerContext;
187
+ index: PlayerIndex;
188
+ item: PlayerTrack;
189
+ shuffle: boolean;
190
+ repeat: number;
191
+ speed: number;
192
+ positionAsOfTimestamp: number;
193
+ duration: number;
194
+ hasContext: boolean;
195
+ isPaused: boolean;
196
+ isBuffering: boolean;
197
+ restrictions: Restrictions;
198
+ previousItems?: PlayerTrack[];
199
+ nextItems?: PlayerTrack[];
200
+ playbackQuality: PlaybackQuality;
201
+ playbackId: string;
202
+ sessionId: string;
203
+ signals?: any[];
204
+ };
205
+ type PlayerContext = {
206
+ uri: string;
207
+ url: string;
208
+ metadata: {
209
+ "player.arch": string;
210
+ };
211
+ };
212
+ type PlayerIndex = {
213
+ pageURI?: string | null;
214
+ pageIndex: number;
215
+ itemIndex: number;
216
+ };
217
+ type PlayerTrack = {
218
+ type: string;
219
+ uri: string;
220
+ uid: string;
221
+ name: string;
222
+ mediaType: string;
223
+ duration: {
224
+ milliseconds: number;
225
+ };
226
+ album: Album;
227
+ artists?: ArtistsEntity[];
228
+ isLocal: boolean;
229
+ isExplicit: boolean;
230
+ is19PlusOnly: boolean;
231
+ provider: string;
232
+ metadata: TrackMetadata;
233
+ images?: ImagesEntity[];
234
+ };
235
+ type TrackMetadata = {
236
+ // Track metadata is an open string map; the named keys below are the
237
+ // common ones, but dynamic/indexed access (e.g. `artist_uri:${n}`,
238
+ // "media.type") must stay valid.
239
+ [key: string]: string | undefined;
240
+ artist_uri: string;
241
+ entity_uri: string;
242
+ iteration: string;
243
+ title: string;
244
+ "collection.is_banned": string;
245
+ "artist_uri:1": string;
246
+ "collection.in_collection": string;
247
+ image_small_url: string;
248
+ "collection.can_ban": string;
249
+ is_explicit: string;
250
+ album_disc_number: string;
251
+ album_disc_count: string;
252
+ track_player: string;
253
+ album_title: string;
254
+ "collection.can_add": string;
255
+ image_large_url: string;
256
+ "actions.skipping_prev_past_track": string;
257
+ page_instance_id: string;
258
+ image_xlarge_url: string;
259
+ marked_for_download: string;
260
+ "actions.skipping_next_past_track": string;
261
+ context_uri: string;
262
+ "artist_name:1": string;
263
+ has_lyrics: string;
264
+ interaction_id: string;
265
+ image_url: string;
266
+ album_uri: string;
267
+ album_artist_name: string;
268
+ album_track_number: string;
269
+ artist_name: string;
270
+ duration: string;
271
+ album_track_count: string;
272
+ popularity: string;
273
+ };
274
+ type Album = {
275
+ type: string;
276
+ uri: string;
277
+ name: string;
278
+ images?: ImagesEntity[];
279
+ };
280
+ type ImagesEntity = {
281
+ url: string;
282
+ label: string;
283
+ };
284
+ type ArtistsEntity = {
285
+ type: string;
286
+ uri: string;
287
+ name: string;
288
+ };
289
+ type Restrictions = {
290
+ canPause: boolean;
291
+ canResume: boolean;
292
+ canSeek: boolean;
293
+ canSkipPrevious: boolean;
294
+ canSkipNext: boolean;
295
+ canToggleRepeatContext: boolean;
296
+ canToggleRepeatTrack: boolean;
297
+ canToggleShuffle: boolean;
298
+ disallowPausingReasons?: string[];
299
+ disallowResumingReasons?: string[];
300
+ disallowSeekingReasons?: string[];
301
+ disallowSkippingPreviousReasons?: string[];
302
+ disallowSkippingNextReasons?: string[];
303
+ disallowTogglingRepeatContextReasons?: string[];
304
+ disallowTogglingRepeatTrackReasons?: string[];
305
+ disallowTogglingShuffleReasons?: string[];
306
+ disallowTransferringPlaybackReasons?: string[];
307
+ };
308
+ type PlaybackQuality = {
309
+ bitrateLevel: number;
310
+ strategy: number;
311
+ targetBitrateLevel: number;
312
+ targetBitrateAvailable: boolean;
313
+ hifiStatus: number;
314
+ };
315
+ namespace Player {
316
+ /**
317
+ * Register a listener `type` on Spicetify.Player.
318
+ *
319
+ * On default, `Spicetify.Player` always dispatch:
320
+ * - `songchange` type when player changes track.
321
+ * - `onplaypause` type when player plays or pauses.
322
+ * - `onprogress` type when track progress changes.
323
+ * - `appchange` type when user changes page.
324
+ */
325
+ function addEventListener(type: string, callback: (event?: Event) => void): void;
326
+ function addEventListener(type: "songchange", callback: (event?: Event & { data: PlayerState }) => void): void;
327
+ function addEventListener(type: "onplaypause", callback: (event?: Event & { data: PlayerState }) => void): void;
328
+ function addEventListener(type: "onprogress", callback: (event?: Event & { data: number }) => void): void;
329
+ function addEventListener(
330
+ type: "appchange",
331
+ callback: (
332
+ event?: Event & {
333
+ data: {
334
+ /**
335
+ * App href path
336
+ */
337
+ path: string;
338
+ /**
339
+ * App container
340
+ */
341
+ container: HTMLElement;
342
+ };
343
+ }
344
+ ) => void
345
+ ): void;
346
+ /**
347
+ * Skip to previous track.
348
+ */
349
+ function back(): void;
350
+ /**
351
+ * An object contains all information about current track and player.
352
+ */
353
+ const data: PlayerState;
354
+ /**
355
+ * Decrease a small amount of volume.
356
+ */
357
+ function decreaseVolume(): void;
358
+ /**
359
+ * Dispatches an event at `Spicetify.Player`.
360
+ *
361
+ * On default, `Spicetify.Player` always dispatch
362
+ * - `songchange` type when player changes track.
363
+ * - `onplaypause` type when player plays or pauses.
364
+ * - `onprogress` type when track progress changes.
365
+ * - `appchange` type when user changes page.
366
+ */
367
+ function dispatchEvent(event: Event): void;
368
+ const eventListeners: {
369
+ [key: string]: Array<(event?: Event) => void>;
370
+ };
371
+ /**
372
+ * Convert milisecond to `mm:ss` format
373
+ * @param milisecond
374
+ */
375
+ function formatTime(milisecond: number): string;
376
+ /**
377
+ * Return song total duration in milisecond.
378
+ */
379
+ function getDuration(): number;
380
+ /**
381
+ * Return mute state
382
+ */
383
+ function getMute(): boolean;
384
+ /**
385
+ * Return elapsed duration in milisecond.
386
+ */
387
+ function getProgress(): number;
388
+ /**
389
+ * Return elapsed duration in percentage (0 to 1).
390
+ */
391
+ function getProgressPercent(): number;
392
+ /**
393
+ * Return current Repeat state (No repeat = 0/Repeat all = 1/Repeat one = 2).
394
+ */
395
+ function getRepeat(): number;
396
+ /**
397
+ * Return current shuffle state.
398
+ */
399
+ function getShuffle(): boolean;
400
+ /**
401
+ * Return track heart state.
402
+ */
403
+ function getHeart(): boolean;
404
+ /**
405
+ * Return current volume level (0 to 1).
406
+ */
407
+ function getVolume(): number;
408
+ /**
409
+ * Increase a small amount of volume.
410
+ */
411
+ function increaseVolume(): void;
412
+ /**
413
+ * Return a boolean whether player is playing.
414
+ */
415
+ function isPlaying(): boolean;
416
+ /**
417
+ * Skip to next track.
418
+ */
419
+ function next(): void;
420
+ /**
421
+ * Pause track.
422
+ */
423
+ function pause(): void;
424
+ /**
425
+ * Resume track.
426
+ */
427
+ function play(): void;
428
+ /**
429
+ * Play a track, playlist, album, etc. immediately
430
+ * @param uri Spotify URI
431
+ * @param context
432
+ * @param options
433
+ */
434
+ function playUri(uri: string, context?: any, options?: any): Promise<void>;
435
+ /**
436
+ * Unregister added event listener `type`.
437
+ * @param type
438
+ * @param callback
439
+ */
440
+ function removeEventListener(type: string, callback: (event?: Event) => void): void;
441
+ /**
442
+ * Seek track to position.
443
+ * @param position can be in percentage (0 to 1) or in milisecond.
444
+ */
445
+ function seek(position: number): void;
446
+ /**
447
+ * Turn mute on/off
448
+ * @param state
449
+ */
450
+ function setMute(state: boolean): void;
451
+ /**
452
+ * Change Repeat mode
453
+ * @param mode `0` No repeat. `1` Repeat all. `2` Repeat one track.
454
+ */
455
+ function setRepeat(mode: number): void;
456
+ /**
457
+ * Turn shuffle on/off.
458
+ * @param state
459
+ */
460
+ function setShuffle(state: boolean): void;
461
+ /**
462
+ * Set volume level
463
+ * @param level 0 to 1
464
+ */
465
+ function setVolume(level: number): void;
466
+ /**
467
+ * Seek to previous `amount` of milisecond
468
+ * @param amount in milisecond. Default: 15000.
469
+ */
470
+ function skipBack(amount?: number): void;
471
+ /**
472
+ * Seek to next `amount` of milisecond
473
+ * @param amount in milisecond. Default: 15000.
474
+ */
475
+ function skipForward(amount?: number): void;
476
+ /**
477
+ * Toggle Heart (Favourite) track state.
478
+ */
479
+ function toggleHeart(): void;
480
+ /**
481
+ * Toggle Mute/No mute.
482
+ */
483
+ function toggleMute(): void;
484
+ /**
485
+ * Toggle Play/Pause.
486
+ */
487
+ function togglePlay(): void;
488
+ /**
489
+ * Toggle No repeat/Repeat all/Repeat one.
490
+ */
491
+ function toggleRepeat(): void;
492
+ /**
493
+ * Toggle Shuffle/No shuffle.
494
+ */
495
+ function toggleShuffle(): void;
496
+ }
497
+ /**
498
+ * Adds a track or array of tracks to prioritized queue.
499
+ */
500
+ function addToQueue(uri: ContextTrack[]): Promise<void>;
501
+ /**
502
+ * @deprecated
503
+ */
504
+ const BridgeAPI: any;
505
+ /**
506
+ * @deprecated
507
+ */
508
+ const CosmosAPI: any;
509
+ /**
510
+ * Reaches hosts that refuse the client's origin, through the local daemon
511
+ * when it is running and the hosted proxy otherwise. Setting
512
+ * `spicetify:corsProxyTemplate` replaces the chain with that one template.
513
+ */
514
+ namespace CORSProxy {
515
+ /** The proxied URL for `target` using the first template in the chain. */
516
+ function url(target: string): string;
517
+ /** Fetches `target` proxied, falling back to the next template only when a request gets no answer. */
518
+ function fetch(target: string, options?: RequestInit): Promise<Response>;
519
+ /** The active chain, in order of preference. */
520
+ function templates(): string[];
521
+ }
522
+ /**
523
+ * Async wrappers of CosmosAPI
524
+ */
525
+ namespace CosmosAsync {
526
+ type Method = "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT" | "SUB";
527
+ interface Error {
528
+ code: number;
529
+ error: string;
530
+ message: string;
531
+ stack?: string;
532
+ }
533
+
534
+ type Headers = Record<string, string>;
535
+ type Body = Record<string, any>;
536
+
537
+ interface Response {
538
+ body: any;
539
+ headers: Headers;
540
+ status: number;
541
+ uri?: string;
542
+ }
543
+
544
+ function head(url: string, headers?: Headers): Promise<Headers>;
545
+ function get(url: string, body?: Body, headers?: Headers): Promise<Response["body"]>;
546
+ function post(url: string, body?: Body, headers?: Headers): Promise<Response["body"]>;
547
+ function put(url: string, body?: Body, headers?: Headers): Promise<Response["body"]>;
548
+ function del(url: string, body?: Body, headers?: Headers): Promise<Response["body"]>;
549
+ function patch(url: string, body?: Body, headers?: Headers): Promise<Response["body"]>;
550
+ function sub(
551
+ url: string,
552
+ callback: (b: Response["body"]) => void,
553
+ onError?: (e: Error) => void,
554
+ body?: Body,
555
+ headers?: Headers
556
+ ): Promise<Response["body"]>;
557
+ function postSub(
558
+ url: string,
559
+ body: Body | null,
560
+ callback: (b: Response["body"]) => void,
561
+ onError?: (e: Error) => void
562
+ ): Promise<Response["body"]>;
563
+ function request(method: Method, url: string, body?: Body, headers?: Headers): Promise<Response>;
564
+ function resolve(method: Method, url: string, body?: Body, headers?: Headers): Promise<Response>;
565
+ }
566
+ /**
567
+ * Fetch interesting colors from URI.
568
+ * @param uri Any type of URI that has artwork (playlist, track, album, artist, show, ...)
569
+ */
570
+ function colorExtractor(uri: string): Promise<{
571
+ DESATURATED: string;
572
+ LIGHT_VIBRANT: string;
573
+ PROMINENT: string;
574
+ VIBRANT: string;
575
+ VIBRANT_NON_ALARMING: string;
576
+ }>;
577
+ /**
578
+ * @deprecated
579
+ */
580
+ function getAblumArtColors(): any;
581
+ /**
582
+ * Fetch track analyzed audio data.
583
+ * Beware, not all tracks have audio data.
584
+ * @param uri is optional. Leave it blank to get current track
585
+ * or specify another track uri.
586
+ */
587
+ function getAudioData(uri?: string): Promise<any>;
588
+ /**
589
+ * Set of APIs method to register, deregister hotkeys/shortcuts
590
+ */
591
+ namespace Keyboard {
592
+ type ValidKey =
593
+ | "BACKSPACE"
594
+ | "TAB"
595
+ | "ENTER"
596
+ | "SHIFT"
597
+ | "CTRL"
598
+ | "ALT"
599
+ | "CAPS"
600
+ | "ESCAPE"
601
+ | "SPACE"
602
+ | "PAGE_UP"
603
+ | "PAGE_DOWN"
604
+ | "END"
605
+ | "HOME"
606
+ | "ARROW_LEFT"
607
+ | "ARROW_UP"
608
+ | "ARROW_RIGHT"
609
+ | "ARROW_DOWN"
610
+ | "INSERT"
611
+ | "DELETE"
612
+ | "A"
613
+ | "B"
614
+ | "C"
615
+ | "D"
616
+ | "E"
617
+ | "F"
618
+ | "G"
619
+ | "H"
620
+ | "I"
621
+ | "J"
622
+ | "K"
623
+ | "L"
624
+ | "M"
625
+ | "N"
626
+ | "O"
627
+ | "P"
628
+ | "Q"
629
+ | "R"
630
+ | "S"
631
+ | "T"
632
+ | "U"
633
+ | "V"
634
+ | "W"
635
+ | "X"
636
+ | "Y"
637
+ | "Z"
638
+ | "WINDOW_LEFT"
639
+ | "WINDOW_RIGHT"
640
+ | "SELECT"
641
+ | "NUMPAD_0"
642
+ | "NUMPAD_1"
643
+ | "NUMPAD_2"
644
+ | "NUMPAD_3"
645
+ | "NUMPAD_4"
646
+ | "NUMPAD_5"
647
+ | "NUMPAD_6"
648
+ | "NUMPAD_7"
649
+ | "NUMPAD_8"
650
+ | "NUMPAD_9"
651
+ | "MULTIPLY"
652
+ | "ADD"
653
+ | "SUBTRACT"
654
+ | "DECIMAL_POINT"
655
+ | "DIVIDE"
656
+ | "F1"
657
+ | "F2"
658
+ | "F3"
659
+ | "F4"
660
+ | "F5"
661
+ | "F6"
662
+ | "F7"
663
+ | "F8"
664
+ | "F9"
665
+ | "F10"
666
+ | "F11"
667
+ | "F12"
668
+ | ";"
669
+ | "="
670
+ | " | "
671
+ | "-"
672
+ | "."
673
+ | "/"
674
+ | "`"
675
+ | "["
676
+ | "\\"
677
+ | "]"
678
+ | '"'
679
+ | "~"
680
+ | "!"
681
+ | "@"
682
+ | "#"
683
+ | "$"
684
+ | "%"
685
+ | "^"
686
+ | "&"
687
+ | "*"
688
+ | "("
689
+ | ")"
690
+ | "_"
691
+ | "+"
692
+ | ":"
693
+ | "<"
694
+ | ">"
695
+ | "?"
696
+ | "|";
697
+ type KeysDefine =
698
+ | string
699
+ | {
700
+ key: string;
701
+ ctrl?: boolean;
702
+ shift?: boolean;
703
+ alt?: boolean;
704
+ meta?: boolean;
705
+ };
706
+ const KEYS: Record<ValidKey, string>;
707
+ function registerShortcut(keys: KeysDefine, callback: (event: KeyboardEvent) => void): void;
708
+ function registerIsolatedShortcut(keys: KeysDefine, callback: (event: KeyboardEvent) => void): void;
709
+ function registerImportantShortcut(keys: KeysDefine, callback: (event: KeyboardEvent) => void): void;
710
+ function _deregisterShortcut(keys: KeysDefine): void;
711
+ function deregisterImportantShortcut(keys: KeysDefine): void;
712
+ function changeShortcut(keys: KeysDefine, newKeys: KeysDefine): void;
713
+ }
714
+
715
+ /**
716
+ * @deprecated
717
+ */
718
+ const LiveAPI: any;
719
+
720
+ namespace LocalStorage {
721
+ /**
722
+ * Empties the list associated with the object of all key/value pairs, if there are any.
723
+ */
724
+ function clear(): void;
725
+ /**
726
+ * Get key value
727
+ */
728
+ function get(key: string): string | null;
729
+ /**
730
+ * Delete key
731
+ */
732
+ function remove(key: string): void;
733
+ /**
734
+ * Set new value for key
735
+ */
736
+ function set(key: string, value: string): void;
737
+ }
738
+ /**
739
+ * To create and prepend custom menu item in profile menu.
740
+ */
741
+ namespace Menu {
742
+ /**
743
+ * Create a single toggle.
744
+ */
745
+ class Item {
746
+ constructor(name: string, isEnabled: boolean, onClick: (self: Item) => void, icon?: Icon | string);
747
+ name: string;
748
+ isEnabled: boolean;
749
+ /**
750
+ * Change item name
751
+ */
752
+ setName(name: string): void;
753
+ /**
754
+ * Change item enabled state.
755
+ * Visually, item would has a tick next to it if its state is enabled.
756
+ */
757
+ setState(isEnabled: boolean): void;
758
+ /**
759
+ * Change icon
760
+ */
761
+ setIcon(icon: Icon | string): void;
762
+ /**
763
+ * Item is only available in Profile menu when method "register" is called.
764
+ */
765
+ register(): void;
766
+ /**
767
+ * Stop item to be prepended into Profile menu.
768
+ */
769
+ deregister(): void;
770
+ }
771
+
772
+ /**
773
+ * Create a sub menu to contain Item toggles.
774
+ * `Item`s in `subItems` array shouldn't be registered.
775
+ */
776
+ class SubMenu {
777
+ constructor(name: string, subItems: Item[]);
778
+ name: string;
779
+ /**
780
+ * Change SubMenu name
781
+ */
782
+ setName(name: string): void;
783
+ /**
784
+ * Add an item to sub items list
785
+ */
786
+ addItem(item: Item);
787
+ /**
788
+ * Remove an item from sub items list
789
+ */
790
+ removeItem(item: Item);
791
+ /**
792
+ * SubMenu is only available in Profile menu when method "register" is called.
793
+ */
794
+ register(): void;
795
+ /**
796
+ * Stop SubMenu to be prepended into Profile menu.
797
+ */
798
+ deregister(): void;
799
+ }
800
+ }
801
+
802
+ /**
803
+ * Keyboard shortcut library
804
+ *
805
+ * Documentation: https://craig.is/killing/mice v1.6.5
806
+ *
807
+ * Spicetify.Keyboard is wrapper of this library to be compatible with legacy Spotify,
808
+ * so new extension should use this library instead.
809
+ */
810
+ const Mousetrap: {
811
+ (element?: any): any;
812
+ new (element?: any): any;
813
+ bind(keys: string | string[], callback: (e: KeyboardEvent, combo: string) => void, action?: string): void;
814
+ unbind(keys: string | string[], action?: string): void;
815
+ trigger(keys: string, action?: string): void;
816
+ handleKey(character: string, modifiers: string[], e: KeyboardEvent): void;
817
+ reset(): void;
818
+ [key: string]: any;
819
+ };
820
+
821
+ /**
822
+ * The client's internal platform APIs. Typed from the generated
823
+ * PlatformAutoGen surface, exposing both the property form the client uses
824
+ * (`Platform.LibraryAPI`) and the generated `getLibraryAPI()` methods:
825
+ * every `getFooAPI(): R` yields a `FooAPI: R` property too.
826
+ */
827
+ type PlatformAutoGen = import("/hooks/PlatformAutoGen").PlatformAutoGen;
828
+ // One level of member names per API — enough to autocomplete which methods an
829
+ // API exposes (Platform.LibraryAPI.getContents…), with every value left `any`.
830
+ // The generated method signatures are unreliable (arg counts and nullability
831
+ // differ from runtime), so surfacing them strictly turns correct calls into
832
+ // false errors; `Shape` keeps the discoverable member names and drops the
833
+ // untrustworthy signatures.
834
+ type Shape<T> = T extends (...args: any[]) => any
835
+ ? (...args: any[]) => any
836
+ : T extends object
837
+ ? { [M in keyof T]: any }
838
+ : T;
839
+ // Both forms the client offers: the getFooAPI() methods (permissive args,
840
+ // shaped return) and each getFooAPI(): R also as a FooAPI: R property (the
841
+ // form the client uses). The Record<string, any> tail keeps unknown keys open.
842
+ type PlatformApis =
843
+ & {
844
+ [K in keyof PlatformAutoGen]: PlatformAutoGen[K] extends (...args: any[]) => infer R
845
+ ? (...args: any[]) => Shape<R>
846
+ : PlatformAutoGen[K];
847
+ }
848
+ & {
849
+ [K in keyof PlatformAutoGen as K extends `get${infer Name}` ? Name : never]: PlatformAutoGen[K] extends (
850
+ ...args: any[]
851
+ ) => infer R
852
+ ? Shape<R>
853
+ : never;
854
+ };
855
+ const Platform: PlatformApis & Record<string, any>;
856
+ /**
857
+ * Queue object contains list of queuing tracks,
858
+ * history of played tracks and current track metadata.
859
+ */
860
+ const Queue: {
861
+ nextTracks: any[];
862
+ prevTracks: any[];
863
+ queueRevision: string;
864
+ track: any;
865
+ };
866
+ /**
867
+ * Remove a track or array of tracks from current queue.
868
+ */
869
+ function removeFromQueue(uri: ContextTrack[]): Promise<void>;
870
+ /**
871
+ * Display a bubble of notification. Useful for a visual feedback.
872
+ * @param message Message to display. Can use inline HTML for styling.
873
+ * @param isError If true, bubble will be red. Defaults to false.
874
+ * @param msTimeout Time in milliseconds to display the bubble. Defaults to Spotify's value.
875
+ */
876
+ function showNotification(message: React.ReactNode, isError?: boolean, msTimeout?: number): void;
877
+ /**
878
+ * Set of APIs method to parse and validate URIs.
879
+ */
880
+ class URI {
881
+ constructor(type: string, props: any);
882
+ public type: string;
883
+ public hasBase62Id: boolean;
884
+
885
+ public id?: string;
886
+ public disc?: any;
887
+ public args?: any;
888
+ public category?: string;
889
+ public username?: string;
890
+ public track?: string;
891
+ public artist?: string;
892
+ public album?: string;
893
+ public duration?: number;
894
+ public query?: string;
895
+ public country?: string;
896
+ public global?: boolean;
897
+ public context?: string | typeof URI | null;
898
+ public anchor?: string;
899
+ public play?: any;
900
+ public toplist?: any;
901
+
902
+ /**
903
+ *
904
+ * @return The URI representation of this uri.
905
+ */
906
+ toURI(): string;
907
+
908
+ /**
909
+ *
910
+ * @return The URI representation of this uri.
911
+ */
912
+ toString(): string;
913
+
914
+ /**
915
+ * Get the URL path of this uri.
916
+ *
917
+ * @param opt_leadingSlash True if a leading slash should be prepended.
918
+ * @return The path of this uri.
919
+ */
920
+ toURLPath(opt_leadingSlash: boolean): string;
921
+
922
+ /**
923
+ *
924
+ * @param origin The origin to use for the URL.
925
+ * @return The URL string for the uri.
926
+ */
927
+ toURL(origin?: string): string;
928
+
929
+ /**
930
+ * Clones a given SpotifyURI instance.
931
+ *
932
+ * @return An instance of URI.
933
+ */
934
+ clone(): URI | null;
935
+
936
+ /**
937
+ * Gets the path of the URI object by removing all hash and query parameters.
938
+ *
939
+ * @return The path of the URI object.
940
+ */
941
+ getPath(): string;
942
+
943
+ /**
944
+ * The various URI Types.
945
+ *
946
+ * Note that some of the types in this enum are not real URI types, but are
947
+ * actually URI particles. They are marked so.
948
+ *
949
+ */
950
+ static Type: {
951
+ AD: string;
952
+ ALBUM: string;
953
+ GENRE: string;
954
+ QUEUE: string;
955
+ APPLICATION: string;
956
+ ARTIST: string;
957
+ ARTIST_TOPLIST: string;
958
+ ARTIST_CONCERTS: string;
959
+ AUDIO_FILE: string;
960
+ COLLECTION: string;
961
+ COLLECTION_ALBUM: string;
962
+ COLLECTION_ARTIST: string;
963
+ COLLECTION_MISSING_ALBUM: string;
964
+ COLLECTION_TRACK_LIST: string;
965
+ CONCERT: string;
966
+ CONTEXT_GROUP: string;
967
+ DAILY_MIX: string;
968
+ EMPTY: string;
969
+ EPISODE: string;
970
+ /** URI particle; not an actual URI. */
971
+ FACEBOOK: string;
972
+ FOLDER: string;
973
+ FOLLOWERS: string;
974
+ FOLLOWING: string;
975
+ IMAGE: string;
976
+ INBOX: string;
977
+ INTERRUPTION: string;
978
+ LIBRARY: string;
979
+ LIVE: string;
980
+ ROOM: string;
981
+ EXPRESSION: string;
982
+ LOCAL: string;
983
+ LOCAL_TRACK: string;
984
+ LOCAL_ALBUM: string;
985
+ LOCAL_ARTIST: string;
986
+ MERCH: string;
987
+ MOSAIC: string;
988
+ PLAYLIST: string;
989
+ PLAYLIST_V2: string;
990
+ PRERELEASE: string;
991
+ PROFILE: string;
992
+ PUBLISHED_ROOTLIST: string;
993
+ RADIO: string;
994
+ ROOTLIST: string;
995
+ SEARCH: string;
996
+ SHOW: string;
997
+ SOCIAL_SESSION: string;
998
+ SPECIAL: string;
999
+ STARRED: string;
1000
+ STATION: string;
1001
+ TEMP_PLAYLIST: string;
1002
+ TOPLIST: string;
1003
+ TRACK: string;
1004
+ TRACKSET: string;
1005
+ USER_TOPLIST: string;
1006
+ USER_TOP_TRACKS: string;
1007
+ UNKNOWN: string;
1008
+ MEDIA: string;
1009
+ QUESTION: string;
1010
+ POLL: string;
1011
+ };
1012
+
1013
+ /**
1014
+ * Creates a new URI object from a parsed string argument.
1015
+ *
1016
+ * @param str The string that will be parsed into a URI object.
1017
+ * @throws TypeError If the string argument is not a valid URI, a TypeError will
1018
+ * be thrown.
1019
+ * @return The parsed URI object.
1020
+ */
1021
+ static fromString(str: string): URI;
1022
+
1023
+ /**
1024
+ * Parses a given object into a URI instance.
1025
+ *
1026
+ * Unlike URI.fromString, this function could receive any kind of value. If
1027
+ * the value is already a URI instance, it is simply returned.
1028
+ * Otherwise the value will be stringified before parsing.
1029
+ *
1030
+ * This function also does not throw an error like URI.fromString, but
1031
+ * instead simply returns null if it can't parse the value.
1032
+ *
1033
+ * @param value The value to parse.
1034
+ * @return The corresponding URI instance, or null if the
1035
+ * passed value is not a valid value.
1036
+ */
1037
+ static from(value: any): URI | null;
1038
+
1039
+ /**
1040
+ * Checks whether two URI:s refer to the same thing even though they might
1041
+ * not necessarily be equal.
1042
+ *
1043
+ * These two Playlist URIs, for example, refer to the same playlist:
1044
+ *
1045
+ * spotify:user:napstersean:playlist:3vxotOnOGDlZXyzJPLFnm2
1046
+ * spotify:playlist:3vxotOnOGDlZXyzJPLFnm2
1047
+ *
1048
+ * @param baseUri The first URI to compare.
1049
+ * @param refUri The second URI to compare.
1050
+ * @return Whether they shared idenitity
1051
+ */
1052
+ static isSameIdentity(baseUri: URI | string, refUri: URI | string): boolean;
1053
+
1054
+ /**
1055
+ * Returns the hex representation of a Base62 encoded id.
1056
+ *
1057
+ * @param id The base62 encoded id.
1058
+ * @return The hex representation of the base62 id.
1059
+ */
1060
+ static idToHex(id: string): string;
1061
+
1062
+ /**
1063
+ * Returns the base62 representation of a hex encoded id.
1064
+ *
1065
+ * @param hex The hex encoded id.
1066
+ * @return The base62 representation of the id.
1067
+ */
1068
+ static hexToId(hex: string): string;
1069
+
1070
+ /**
1071
+ * Creates a new 'album' type URI.
1072
+ *
1073
+ * @param id The id of the album.
1074
+ * @param disc The disc number of the album.
1075
+ * @return The album URI.
1076
+ */
1077
+ static albumURI(id: string, disc: number): URI;
1078
+
1079
+ /**
1080
+ * Creates a new 'application' type URI.
1081
+ *
1082
+ * @param id The id of the application.
1083
+ * @param args An array containing the arguments to the app.
1084
+ * @return The application URI.
1085
+ */
1086
+ static applicationURI(id: string, args: string[]): URI;
1087
+
1088
+ /**
1089
+ * Creates a new 'artist' type URI.
1090
+ *
1091
+ * @param id The id of the artist.
1092
+ * @return The artist URI.
1093
+ */
1094
+ static artistURI(id: string): URI;
1095
+
1096
+ /**
1097
+ * Creates a new 'collection' type URI.
1098
+ *
1099
+ * @param username The non-canonical username of the rootlist owner.
1100
+ * @param category The category of the collection.
1101
+ * @return The collection URI.
1102
+ */
1103
+ static collectionURI(username: string, category: string): URI;
1104
+
1105
+ /**
1106
+ * Creates a new 'collection-album' type URI.
1107
+ *
1108
+ * @param username The non-canonical username of the rootlist owner.
1109
+ * @param id The id of the album.
1110
+ * @return The collection album URI.
1111
+ */
1112
+ static collectionAlbumURI(username: string, id: string): URI;
1113
+
1114
+ /**
1115
+ * Creates a new 'collection-artist' type URI.
1116
+ *
1117
+ * @param username The non-canonical username of the rootlist owner.
1118
+ * @param id The id of the artist.
1119
+ * @return The collection artist URI.
1120
+ */
1121
+ static collectionAlbumURI(username: string, id: string): URI;
1122
+
1123
+ /**
1124
+ * Creates a new 'concert' type URI.
1125
+ *
1126
+ * @param id The id of the concert.
1127
+ * @return The concert URI.
1128
+ */
1129
+ static concertURI(id: string): URI;
1130
+
1131
+ /**
1132
+ * Creates a new 'episode' type URI.
1133
+ *
1134
+ * @param id The id of the episode.
1135
+ * @return The episode URI.
1136
+ */
1137
+ static episodeURI(id: string): URI;
1138
+
1139
+ /**
1140
+ * Creates a new 'folder' type URI.
1141
+ *
1142
+ * @param id The id of the folder.
1143
+ * @return The folder URI.
1144
+ */
1145
+ static folderURI(id: string): URI;
1146
+
1147
+ /**
1148
+ * Creates a new 'local-album' type URI.
1149
+ *
1150
+ * @param artist The artist of the album.
1151
+ * @param album The name of the album.
1152
+ * @return The local album URI.
1153
+ */
1154
+ static localAlbumURI(artist: string, album: string): URI;
1155
+
1156
+ /**
1157
+ * Creates a new 'local-artist' type URI.
1158
+ *
1159
+ * @param artist The name of the artist.
1160
+ * @return The local artist URI.
1161
+ */
1162
+ static localArtistURI(artist: string): URI;
1163
+
1164
+ /**
1165
+ * Creates a new 'playlist-v2' type URI.
1166
+ *
1167
+ * @param id The id of the playlist.
1168
+ * @return The playlist URI.
1169
+ */
1170
+ static playlistV2URI(id: string): URI;
1171
+
1172
+ /**
1173
+ * Creates a new 'prerelease' type URI.
1174
+ *
1175
+ * @param id The id of the prerelease.
1176
+ * @return The prerelease URI.
1177
+ */
1178
+ static prereleaseURI(id: string): URI;
1179
+
1180
+ /**
1181
+ * Creates a new 'profile' type URI.
1182
+ *
1183
+ * @param username The non-canonical username of the rootlist owner.
1184
+ * @param args A list of arguments.
1185
+ * @return The profile URI.
1186
+ */
1187
+ static profileURI(username: string, args: string[]): URI;
1188
+
1189
+ /**
1190
+ * Creates a new 'search' type URI.
1191
+ *
1192
+ * @param query The unencoded search query.
1193
+ * @return The search URI
1194
+ */
1195
+ static searchURI(query: string): URI;
1196
+
1197
+ /**
1198
+ * Creates a new 'show' type URI.
1199
+ *
1200
+ * @param id The id of the show.
1201
+ * @return The show URI.
1202
+ */
1203
+ static showURI(id: string): URI;
1204
+
1205
+ /**
1206
+ * Creates a new 'station' type URI.
1207
+ *
1208
+ * @param args An array of arguments for the station.
1209
+ * @return The station URI.
1210
+ */
1211
+ static stationURI(args: string[]): URI;
1212
+
1213
+ /**
1214
+ * Creates a new 'track' type URI.
1215
+ *
1216
+ * @param id The id of the track.
1217
+ * @param anchor The point in the track formatted as mm:ss
1218
+ * @param context An optional context URI
1219
+ * @param play Toggles autoplay
1220
+ * @return The track URI.
1221
+ */
1222
+ static trackURI(id: string, anchor: string, context?: string, play?: boolean): URI;
1223
+
1224
+ /**
1225
+ * Creates a new 'user-toplist' type URI.
1226
+ *
1227
+ * @param username The non-canonical username of the toplist owner.
1228
+ * @param toplist The toplist type.
1229
+ * @return The user-toplist URI.
1230
+ */
1231
+ static userToplistURI(username: string, toplist: string): URI;
1232
+
1233
+ static isAd(uri: URI | string): boolean;
1234
+ static isAlbum(uri: URI | string): boolean;
1235
+ static isGenre(uri: URI | string): boolean;
1236
+ static isQueue(uri: URI | string): boolean;
1237
+ static isApplication(uri: URI | string): boolean;
1238
+ static isArtist(uri: URI | string): boolean;
1239
+ static isArtistToplist(uri: URI | string): boolean;
1240
+ static isArtistConcerts(uri: URI | string): boolean;
1241
+ static isAudioFile(uri: URI | string): boolean;
1242
+ static isCollection(uri: URI | string): boolean;
1243
+ static isCollectionAlbum(uri: URI | string): boolean;
1244
+ static isCollectionArtist(uri: URI | string): boolean;
1245
+ static isCollectionMissingAlbum(uri: URI | string): boolean;
1246
+ static isCollectionTrackList(uri: URI | string): boolean;
1247
+ static isConcert(uri: URI | string): boolean;
1248
+ static isContextGroup(uri: URI | string): boolean;
1249
+ static isDailyMix(uri: URI | string): boolean;
1250
+ static isEmpty(uri: URI | string): boolean;
1251
+ static isEpisode(uri: URI | string): boolean;
1252
+ static isFacebook(uri: URI | string): boolean;
1253
+ static isFolder(uri: URI | string): boolean;
1254
+ static isFollowers(uri: URI | string): boolean;
1255
+ static isFollowing(uri: URI | string): boolean;
1256
+ static isImage(uri: URI | string): boolean;
1257
+ static isInbox(uri: URI | string): boolean;
1258
+ static isInterruption(uri: URI | string): boolean;
1259
+ static isLibrary(uri: URI | string): boolean;
1260
+ static isLive(uri: URI | string): boolean;
1261
+ static isRoom(uri: URI | string): boolean;
1262
+ static isExpression(uri: URI | string): boolean;
1263
+ static isLocal(uri: URI | string): boolean;
1264
+ static isLocalTrack(uri: URI | string): boolean;
1265
+ static isLocalAlbum(uri: URI | string): boolean;
1266
+ static isLocalArtist(uri: URI | string): boolean;
1267
+ static isMerch(uri: URI | string): boolean;
1268
+ static isMosaic(uri: URI | string): boolean;
1269
+ static isPlaylist(uri: URI | string): boolean;
1270
+ static isPlaylistV2(uri: URI | string): boolean;
1271
+ static isPrerelease(uri: URI | string): boolean;
1272
+ static isProfile(uri: URI | string): boolean;
1273
+ static isPublishedRootlist(uri: URI | string): boolean;
1274
+ static isRadio(uri: URI | string): boolean;
1275
+ static isRootlist(uri: URI | string): boolean;
1276
+ static isSearch(uri: URI | string): boolean;
1277
+ static isShow(uri: URI | string): boolean;
1278
+ static isSocialSession(uri: URI | string): boolean;
1279
+ static isSpecial(uri: URI | string): boolean;
1280
+ static isStarred(uri: URI | string): boolean;
1281
+ static isStation(uri: URI | string): boolean;
1282
+ static isTempPlaylist(uri: URI | string): boolean;
1283
+ static isToplist(uri: URI | string): boolean;
1284
+ static isTrack(uri: URI | string): boolean;
1285
+ static isTrackset(uri: URI | string): boolean;
1286
+ static isUserToplist(uri: URI | string): boolean;
1287
+ static isUserTopTracks(uri: URI | string): boolean;
1288
+ static isUnknown(uri: URI | string): boolean;
1289
+ static isMedia(uri: URI | string): boolean;
1290
+ static isQuestion(uri: URI | string): boolean;
1291
+ static isPoll(uri: URI | string): boolean;
1292
+ static isPlaylistV1OrV2(uri: URI | string): boolean;
1293
+ }
1294
+
1295
+ /**
1296
+ * Create custom menu item and prepend to right click context menu
1297
+ */
1298
+ namespace ContextMenu {
1299
+ type OnClickCallback = (uris: string[], uids?: string[], contextUri?: string) => void;
1300
+ type ShouldAddCallback = (uris: string[], uids?: string[], contextUri?: string) => boolean;
1301
+
1302
+ // Single context menu item
1303
+ class Item {
1304
+ /**
1305
+ * List of valid icons to use.
1306
+ */
1307
+ static readonly iconList: Icon[];
1308
+ constructor(name: string, onClick: OnClickCallback, shouldAdd?: ShouldAddCallback, icon?: Icon | string, disabled?: boolean);
1309
+ name: string;
1310
+ icon: Icon | string;
1311
+ disabled: boolean;
1312
+ /**
1313
+ * A function returning boolean determines whether item should be prepended.
1314
+ */
1315
+ shouldAdd: ShouldAddCallback;
1316
+ /**
1317
+ * A function to call when item is clicked
1318
+ */
1319
+ onClick: OnClickCallback;
1320
+ /**
1321
+ * Item is only available in Context Menu when method "register" is called.
1322
+ */
1323
+ register: () => void;
1324
+ /**
1325
+ * Stop Item to be prepended into Context Menu.
1326
+ */
1327
+ deregister: () => void;
1328
+ }
1329
+
1330
+ /**
1331
+ * Create a sub menu to contain `Item`s.
1332
+ * `Item`s in `subItems` array shouldn't be registered.
1333
+ */
1334
+ class SubMenu {
1335
+ constructor(name: string, subItems: Iterable<Item>, shouldAdd?: ShouldAddCallback, disabled?: boolean);
1336
+ name: string;
1337
+ disabled: boolean;
1338
+ /**
1339
+ * A function returning boolean determines whether item should be prepended.
1340
+ */
1341
+ shouldAdd: ShouldAddCallback;
1342
+ addItem: (item: Item) => void;
1343
+ removeItem: (item: Item) => void;
1344
+ /**
1345
+ * SubMenu is only available in Context Menu when method "register" is called.
1346
+ */
1347
+ register: () => void;
1348
+ /**
1349
+ * Stop SubMenu to be prepended into Context Menu.
1350
+ */
1351
+ deregister: () => void;
1352
+ }
1353
+ }
1354
+
1355
+ /**
1356
+ * Popup Modal
1357
+ */
1358
+ namespace PopupModal {
1359
+ interface Content {
1360
+ title: string;
1361
+ /**
1362
+ * You can specify a string for simple text display
1363
+ * or a HTML element for interactive config/setting menu
1364
+ */
1365
+ content: string | Element;
1366
+ /**
1367
+ * Bigger window
1368
+ */
1369
+ isLarge?: boolean;
1370
+ }
1371
+
1372
+ function display(e: Content): void;
1373
+ function hide(): void;
1374
+ }
1375
+
1376
+ /** React instance to create components */
1377
+ const React: any;
1378
+ /** React DOM instance to render and mount components */
1379
+ const ReactDOM: any;
1380
+ /** React DOM Server instance to render components to string */
1381
+ const ReactDOMServer: any;
1382
+
1383
+ /** Stock React components exposed from Spotify library */
1384
+ namespace ReactComponent {
1385
+ type ContextMenuProps = {
1386
+ /**
1387
+ * Decide whether to use the global singleton context menu (rendered in <body>)
1388
+ * or a new inline context menu (rendered in a sibling
1389
+ * element to `children`)
1390
+ */
1391
+ renderInline?: boolean;
1392
+ /**
1393
+ * Determins what will trigger the context menu. For example, a click, or a right-click
1394
+ */
1395
+ trigger?: "click" | "right-click";
1396
+ /**
1397
+ * Determins is the context menu should open or toggle when triggered
1398
+ */
1399
+ action?: "toggle" | "open";
1400
+ /**
1401
+ * The preferred placement of the context menu when it opens.
1402
+ * Relative to trigger element.
1403
+ */
1404
+ placement?:
1405
+ | "top"
1406
+ | "top-start"
1407
+ | "top-end"
1408
+ | "right"
1409
+ | "right-start"
1410
+ | "right-end"
1411
+ | "bottom"
1412
+ | "bottom-start"
1413
+ | "bottom-end"
1414
+ | "left"
1415
+ | "left-start"
1416
+ | "left-end";
1417
+ /**
1418
+ * The x and y offset distances at which the context menu should open.
1419
+ * Relative to trigger element and `position`.
1420
+ */
1421
+ offset?: [number, number];
1422
+ /**
1423
+ * Will stop the client from scrolling while the context menu is open
1424
+ */
1425
+ preventScrollingWhileOpen?: boolean;
1426
+ /**
1427
+ * The menu UI to render inside of the context menu.
1428
+ */
1429
+ menu:
1430
+ | typeof Spicetify.ReactComponent.Menu
1431
+ | typeof Spicetify.ReactComponent.AlbumMenu
1432
+ | typeof Spicetify.ReactComponent.PodcastShowMenu
1433
+ | typeof Spicetify.ReactComponent.ArtistMenu
1434
+ | typeof Spicetify.ReactComponent.PlaylistMenu;
1435
+ /**
1436
+ * A child of the context menu. Should be `<button>`, `<a>`,
1437
+ * a custom react component that forwards a ref to a `<button>` or `<a>`,
1438
+ * or a function. If a function is passed it will be called with
1439
+ * (`isOpen`, `handleContextMenu`, `ref`) as arguments.
1440
+ */
1441
+ children: Element | ((isOpen?: boolean, handleContextMenu?: (e: MouseEvent) => void, ref?: (e: Element) => void) => Element);
1442
+ };
1443
+ type MenuProps = {
1444
+ /**
1445
+ * Function that is called when the menu is closed
1446
+ */
1447
+ onClose?: () => void;
1448
+ /**
1449
+ * Function that provides the element that focus should jump to when the menu
1450
+ * is opened
1451
+ */
1452
+ getInitialFocusElement?: (el: HTMLElement | null) => HTMLElement | undefined | null;
1453
+ };
1454
+ type MenuItemProps = {
1455
+ /**
1456
+ * Function that runs when `MenuItem` is clicked
1457
+ */
1458
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
1459
+ /**
1460
+ * Indicates if `MenuItem` is disabled. Disabled items will not cause
1461
+ * the `Menu` to close when clicked.
1462
+ */
1463
+ disabled?: boolean;
1464
+ /**
1465
+ * Indicate that a divider line should be added `before` or `after` this `MenuItem`
1466
+ */
1467
+ divider?: "before" | "after" | "both";
1468
+ /**
1469
+ * React component icon that will be rendered at the end of the `MenuItem`
1470
+ * @deprecated Since Spotify `1.2.8`. Use `leadingIcon` or `trailingIcon` instead
1471
+ */
1472
+ icon?: React.ReactNode;
1473
+ /**
1474
+ * React component icon that will be rendered at the start of the `MenuItem`
1475
+ * @since Spotify `1.2.8`
1476
+ */
1477
+ leadingIcon?: React.ReactNode;
1478
+ /**
1479
+ * React component icon that will be rendered at the end of the `MenuItem`
1480
+ * @since Spotify `1.2.8`
1481
+ */
1482
+ trailingIcon?: React.ReactNode;
1483
+ };
1484
+ type TooltipProps = {
1485
+ /**
1486
+ * Label to display in the tooltip
1487
+ */
1488
+ label: string | React.ReactNode;
1489
+ /**
1490
+ * The child element that the tooltip will be attached to
1491
+ * and will display when hovered over
1492
+ */
1493
+ children: React.ReactNode;
1494
+ /**
1495
+ * Decide whether to use the global singleton tooltip (rendered in `<body>`)
1496
+ * or a new inline tooltip (rendered in a sibling
1497
+ * element to `children`)
1498
+ */
1499
+ renderInline?: boolean;
1500
+ /**
1501
+ * Delay in milliseconds before the tooltip is displayed
1502
+ * after the user hovers over the child element
1503
+ */
1504
+ showDelay?: number;
1505
+ /**
1506
+ * Determine whether the tooltip should be displayed
1507
+ */
1508
+ disabled?: boolean;
1509
+ /**
1510
+ * The preferred placement of the context menu when it opens.
1511
+ * Relative to trigger element.
1512
+ * @default 'top'
1513
+ */
1514
+ placement?:
1515
+ | "top"
1516
+ | "top-start"
1517
+ | "top-end"
1518
+ | "right"
1519
+ | "right-start"
1520
+ | "right-end"
1521
+ | "bottom"
1522
+ | "bottom-start"
1523
+ | "bottom-end"
1524
+ | "left"
1525
+ | "left-start"
1526
+ | "left-end";
1527
+ /**
1528
+ * Class name to apply to the tooltip
1529
+ */
1530
+ labelClassName?: string;
1531
+ };
1532
+ type IconComponentProps = {
1533
+ /**
1534
+ * Icon size
1535
+ * @default 24
1536
+ */
1537
+ iconSize?: number;
1538
+ /**
1539
+ * Icon color
1540
+ * Might not be used by component
1541
+ * @default 'currentColor'
1542
+ */
1543
+ color?: string;
1544
+ /**
1545
+ * Semantic color name
1546
+ * Matches color variables used in xpui
1547
+ * @default Inherit from parent
1548
+ */
1549
+ semanticColor?: SemanticColor;
1550
+ /**
1551
+ * Icon title
1552
+ * @default ''
1553
+ */
1554
+ title?: string;
1555
+ /**
1556
+ * Title ID (internal)
1557
+ */
1558
+ titleId?: string;
1559
+ /**
1560
+ * Icon description
1561
+ */
1562
+ desc?: string;
1563
+ /**
1564
+ * Description ID (internal)
1565
+ */
1566
+ descId?: string;
1567
+ /**
1568
+ * Auto mirror icon
1569
+ * @default false
1570
+ */
1571
+ autoMirror?: boolean;
1572
+ };
1573
+ type TextComponentProps = {
1574
+ /**
1575
+ * Text color
1576
+ * Might not be used by component
1577
+ * @default 'currentColor'
1578
+ */
1579
+ color?: string;
1580
+ /**
1581
+ * Semantic color name
1582
+ * Matches color variables used in xpui
1583
+ * @default Inherit from parent
1584
+ */
1585
+ semanticColor?: SemanticColor;
1586
+ /**
1587
+ * Text style variant
1588
+ * @default 'viola'
1589
+ */
1590
+ variant?: Variant;
1591
+ /**
1592
+ * Bottom padding size
1593
+ */
1594
+ paddingBottom?: string;
1595
+ /**
1596
+ * Font weight
1597
+ */
1598
+ weight?: "book" | "bold" | "black";
1599
+ };
1600
+ type ConfirmDialogProps = {
1601
+ /**
1602
+ * Boolean to determine if the dialog should be opened
1603
+ * @default true
1604
+ */
1605
+ isOpen?: boolean;
1606
+ /**
1607
+ * Whether to allow inline HTML in component text
1608
+ * @default false
1609
+ */
1610
+ allowHTML?: boolean;
1611
+ /**
1612
+ * Dialog title. Can be inline HTML if `allowHTML` is true
1613
+ */
1614
+ titleText: string;
1615
+ /**
1616
+ * Dialog description. Can be inline HTML if `allowHTML` is true
1617
+ */
1618
+ descriptionText?: string;
1619
+ /**
1620
+ * Confirm button text
1621
+ */
1622
+ confirmText?: string;
1623
+ /**
1624
+ * Cancel button text
1625
+ */
1626
+ cancelText?: string;
1627
+ /**
1628
+ * Confirm button aria-label
1629
+ */
1630
+ confirmLabel?: string;
1631
+ /**
1632
+ * Function to run when confirm button is clicked
1633
+ * The dialog does not close automatically, a handler must be included.
1634
+ * @param {React.MouseEvent<HTMLButtonElement>} event
1635
+ */
1636
+ onConfirm?: (event: React.MouseEvent<HTMLButtonElement>) => void;
1637
+ /**
1638
+ * Function to run when cancel button is clicked.
1639
+ * The dialog does not close automatically, a handler must be included.
1640
+ * @param {React.MouseEvent<HTMLButtonElement>} event
1641
+ */
1642
+ onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
1643
+ /**
1644
+ * Function to run when dialog is clicked outside of.
1645
+ * By default, this will run `onClose`.
1646
+ * A handler must be included to close the dialog.
1647
+ * @param {React.MouseEvent<HTMLButtonElement>} event
1648
+ */
1649
+ onOutside?: (event: React.MouseEvent<HTMLButtonElement>) => void;
1650
+ };
1651
+ type SliderProps = {
1652
+ /**
1653
+ * Label for the slider.
1654
+ */
1655
+ labelText?: string;
1656
+ /**
1657
+ * The current value of the slider.
1658
+ */
1659
+ value: number;
1660
+ /**
1661
+ * The minimum value of the slider.
1662
+ */
1663
+ min: number;
1664
+ /**
1665
+ * The maximum value of the slider.
1666
+ */
1667
+ max: number;
1668
+ /**
1669
+ * The step value of the slider.
1670
+ */
1671
+ step: number;
1672
+ /**
1673
+ * Whether or not the slider is disabled/can be interacted with.
1674
+ * @default true
1675
+ */
1676
+ isInteractive?: boolean;
1677
+ /**
1678
+ * Whether or not the active style of the slider should be shown.
1679
+ * This is equivalent to the slider being focused/hovered.
1680
+ * @default false
1681
+ */
1682
+ forceActiveStyles?: boolean;
1683
+ /**
1684
+ * Callback function that is called when the slider starts being dragged.
1685
+ *
1686
+ * @param {number} value The current value of the slider in percent.
1687
+ */
1688
+ onDragStart: (value: number) => void;
1689
+ /**
1690
+ * Callback function that is called when the slider is being dragged.
1691
+ *
1692
+ * @param {number} value The current value of the slider in percent.
1693
+ */
1694
+ onDragMove: (value: number) => void;
1695
+ /**
1696
+ * Callback function that is called when the slider stops being dragged.
1697
+ *
1698
+ * @param {number} value The current value of the slider in percent.
1699
+ */
1700
+ onDragEnd: (value: number) => void;
1701
+ /**
1702
+ * Callback function that is called when the slider incremented a step.
1703
+ *
1704
+ * @deprecated Use `onDrag` props instead.
1705
+ */
1706
+ onStepForward?: () => void;
1707
+ /**
1708
+ * Callback function that is called when the slider decremented a step.
1709
+ *
1710
+ * @deprecated Use `onDrag` props instead.
1711
+ */
1712
+ onStepBackward?: () => void;
1713
+ };
1714
+ type ButtonProps = {
1715
+ component: any;
1716
+ /**
1717
+ * Color set for the button.
1718
+ * @default "brightAccent"
1719
+ */
1720
+ colorSet?: ColorSet;
1721
+ /**
1722
+ * Size for the button.
1723
+ * @default "md"
1724
+ */
1725
+ buttonSize?: "sm" | "md" | "lg";
1726
+ /**
1727
+ * Size for the button.
1728
+ * @deprecated Use `buttonSize` prop instead, as it will take precedence.
1729
+ * @default "medium"
1730
+ */
1731
+ size?: "small" | "medium" | "large";
1732
+ /**
1733
+ * Unused by Spotify. Usage unknown.
1734
+ */
1735
+ fullWidth?: any;
1736
+ /**
1737
+ * React component to render for an icon placed before children. Component, not element!
1738
+ */
1739
+ iconLeading?: (props: any) => any | string;
1740
+ /**
1741
+ * React component to render for an icon placed after children. Component, not element!
1742
+ */
1743
+ iconTrailing?: (props: any) => any | string;
1744
+ /**
1745
+ * React component to render for an icon used as button body. Component, not element!
1746
+ */
1747
+ iconOnly?: (props: any) => any | string;
1748
+ /**
1749
+ * Additional class name to apply to the button.
1750
+ */
1751
+ className?: string;
1752
+ /**
1753
+ * Label of the element for screen readers.
1754
+ */
1755
+ "aria-label"?: string;
1756
+ /**
1757
+ * ID of an element that describes the button for screen readers.
1758
+ */
1759
+ "aria-labelledby"?: string;
1760
+ /**
1761
+ * Unsafely set the color set for the button.
1762
+ * Values from the colorSet will be pasted into the CSS.
1763
+ */
1764
+ UNSAFE_colorSet?: ColorSetBody;
1765
+ onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
1766
+ onMouseEnter?: (event: MouseEvent<HTMLButtonElement>) => void;
1767
+ onMouseLeave?: (event: MouseEvent<HTMLButtonElement>) => void;
1768
+ onMouseDown?: (event: MouseEvent<HTMLButtonElement>) => void;
1769
+ onMouseUp?: (event: MouseEvent<HTMLButtonElement>) => void;
1770
+ onFocus?: (event: FocusEvent<HTMLButtonElement>) => void;
1771
+ onBlur?: (event: FocusEvent<HTMLButtonElement>) => void;
1772
+ };
1773
+ /**
1774
+ * Generic context menu provider
1775
+ *
1776
+ * Props:
1777
+ * @see Spicetify.ReactComponent.ContextMenuProps
1778
+ */
1779
+ const ContextMenu: any;
1780
+ /**
1781
+ * Wrapper of ReactComponent.ContextMenu with props: action = 'toggle' and trigger = 'right-click'
1782
+ *
1783
+ * Props:
1784
+ * @see Spicetify.ReactComponent.ContextMenuProps
1785
+ */
1786
+ const RightClickMenu: any;
1787
+ /**
1788
+ * Outer layer contain ReactComponent.MenuItem(s)
1789
+ *
1790
+ * Props:
1791
+ * @see Spicetify.ReactComponent.MenuProps
1792
+ */
1793
+ const Menu: any;
1794
+ /**
1795
+ * Component to construct menu item
1796
+ * Used as ReactComponent.Menu children
1797
+ *
1798
+ * Props:
1799
+ * @see Spicetify.ReactComponent.MenuItemProps
1800
+ */
1801
+ const MenuItem: any;
1802
+ /**
1803
+ * Tailored ReactComponent.Menu for specific type of object
1804
+ *
1805
+ * Props: {
1806
+ * uri: string;
1807
+ * onRemoveCallback?: (uri: string) => void;
1808
+ * }
1809
+ */
1810
+ const AlbumMenu: any;
1811
+ const PodcastShowMenu: any;
1812
+ const ArtistMenu: any;
1813
+ const PlaylistMenu: any;
1814
+ const TrackMenu: any;
1815
+ /**
1816
+ * Component to display tooltip when hovering over element
1817
+ * Useful for accessibility
1818
+ *
1819
+ * Props:
1820
+ * @see Spicetify.ReactComponent.TooltipProps
1821
+ */
1822
+ const TooltipWrapper: any;
1823
+ /**
1824
+ * Component to render Spotify-style icon
1825
+ * @since Spotify `1.1.95`
1826
+ *
1827
+ * Props:
1828
+ * @see Spicetify.ReactComponent.IconComponentProps
1829
+ */
1830
+ const IconComponent: any;
1831
+ /**
1832
+ * Component to render Spotify-style text
1833
+ * @since Spotify `1.1.95`
1834
+ *
1835
+ * Props:
1836
+ * @see Spicetify.ReactComponent.TextComponentProps
1837
+ */
1838
+ const TextComponent: any;
1839
+ /**
1840
+ * Component to render Spotify-style confirm dialog
1841
+ *
1842
+ * Props:
1843
+ * @see Spicetify.ReactComponent.ConfirmDialogProps
1844
+ */
1845
+ const ConfirmDialog: any;
1846
+ /**
1847
+ * Component to render Spotify slider
1848
+ *
1849
+ * Used in progress bar, volume slider, crossfade settings, etc.
1850
+ *
1851
+ * Props:
1852
+ * @see Spicetify.ReactComponent.SliderProps
1853
+ */
1854
+ const Slider: any;
1855
+ /**
1856
+ * Component to render Spotify primary button
1857
+ *
1858
+ * Props:
1859
+ * @see Spicetify.ReactComponent.ButtonProps
1860
+ */
1861
+ const ButtonPrimary: any;
1862
+ /**
1863
+ * Component to render Spotify secondary button
1864
+ *
1865
+ * Props:
1866
+ * @see Spicetify.ReactComponent.ButtonProps
1867
+ */
1868
+ const ButtonSecondary: any;
1869
+ /**
1870
+ * Component to render Spotify tertiary button
1871
+ *
1872
+ * Props:
1873
+ * @see Spicetify.ReactComponent.ButtonProps
1874
+ */
1875
+ const ButtonTertiary: any;
1876
+ }
1877
+
1878
+ /**
1879
+ * Add button in top bar next to navigation buttons
1880
+ */
1881
+ namespace Topbar {
1882
+ class Button {
1883
+ constructor(label: string, icon: Icon | string, onClick: (self: Button) => void, disabled?: boolean);
1884
+ label: string;
1885
+ icon: string;
1886
+ onClick: (self: Button) => void;
1887
+ disabled: boolean;
1888
+ element: HTMLButtonElement;
1889
+ tippy: any;
1890
+ }
1891
+ }
1892
+
1893
+ /**
1894
+ * Add button in player controls
1895
+ */
1896
+ namespace Playbar {
1897
+ /**
1898
+ * Create a button on the right side of the playbar
1899
+ */
1900
+ class Button {
1901
+ constructor(
1902
+ label: string,
1903
+ icon: Icon | string,
1904
+ onClick?: (self: Button) => void,
1905
+ disabled?: boolean,
1906
+ active?: boolean,
1907
+ registerOnCreate?: boolean
1908
+ );
1909
+ label: string;
1910
+ icon: string;
1911
+ onClick: (self: Button) => void;
1912
+ disabled: boolean;
1913
+ active: boolean;
1914
+ element: HTMLButtonElement;
1915
+ tippy: any;
1916
+ register: () => void;
1917
+ deregister: () => void;
1918
+ }
1919
+
1920
+ /**
1921
+ * Create a widget next to track info
1922
+ */
1923
+ class Widget {
1924
+ constructor(
1925
+ label: string,
1926
+ icon: Icon | string,
1927
+ onClick?: (self: Widget) => void,
1928
+ disabled?: boolean,
1929
+ active?: boolean,
1930
+ registerOnCreate?: boolean
1931
+ );
1932
+ label: string;
1933
+ icon: string;
1934
+ onClick: (self: Widget) => void;
1935
+ disabled: boolean;
1936
+ active: boolean;
1937
+ element: HTMLButtonElement;
1938
+ tippy: any;
1939
+ register: () => void;
1940
+ deregister: () => void;
1941
+ }
1942
+ }
1943
+
1944
+ /**
1945
+ * SVG icons
1946
+ */
1947
+ const SVGIcons: Record<Icon, string>;
1948
+
1949
+ /**
1950
+ * Return font styling used by Spotify.
1951
+ * @param font Name of the font.
1952
+ * Can match any of the fonts listed in `Spicetify._fontStyle` or returns a generic style otherwise.
1953
+ */
1954
+ function getFontStyle(font: Variant): string;
1955
+
1956
+ /**
1957
+ * A filtered copy of user's `config-xpui` file.
1958
+ */
1959
+ namespace Config {
1960
+ const version: string;
1961
+ const current_theme: string;
1962
+ const color_scheme: string;
1963
+ const extensions: string[];
1964
+ const custom_apps: string[];
1965
+ }
1966
+
1967
+ /**
1968
+ * Tippy.js instance used by Spotify
1969
+ */
1970
+ const Tippy: any;
1971
+ /**
1972
+ * Spicetify's predefined props for Tippy.js
1973
+ * Used to mimic Spotify's tooltip behavior
1974
+ */
1975
+ const TippyProps: any;
1976
+
1977
+ /**
1978
+ * Interface for interacting with Spotify client's app title
1979
+ */
1980
+ namespace AppTitle {
1981
+ /**
1982
+ * Set default app title. This has no effect if the player is running.
1983
+ * Will override any previous forced title.
1984
+ * @param title Title to set
1985
+ * @return Promise that resolves to a function to cancel forced title. This doesn't reset the title.
1986
+ */
1987
+ function set(title: string): Promise<{ clear: () => void }>;
1988
+ /**
1989
+ * Reset app title to default
1990
+ */
1991
+ function reset(): Promise<void>;
1992
+ /**
1993
+ * Get current default app title
1994
+ * @return Current default app title
1995
+ */
1996
+ function get(): Promise<string>;
1997
+ /**
1998
+ * Subscribe to title changes.
1999
+ * This event is not fired when the player changes app title.
2000
+ * @param callback Callback to call when title changes
2001
+ * @return Object with method to unsubscribe
2002
+ */
2003
+ function sub(callback: (title: string) => void): { clear: () => void };
2004
+ }
2005
+
2006
+ /**
2007
+ * Spicetify's QraphQL wrapper for Spotify's GraphQL API endpoints
2008
+ */
2009
+ namespace GraphQL {
2010
+ /**
2011
+ * Possible types of entities.
2012
+ *
2013
+ * This list is dynamic and may change in the future.
2014
+ */
2015
+ type Query =
2016
+ | "decorateItemsForEnhance"
2017
+ | "imageURLAndSize"
2018
+ | "imageSources"
2019
+ | "audioItems"
2020
+ | "creator"
2021
+ | "extractedColors"
2022
+ | "extractedColorsAndImageSources"
2023
+ | "fetchExtractedColorAndImageForAlbumEntity"
2024
+ | "fetchExtractedColorAndImageForArtistEntity"
2025
+ | "fetchExtractedColorAndImageForEpisodeEntity"
2026
+ | "fetchExtractedColorAndImageForPlaylistEntity"
2027
+ | "fetchExtractedColorAndImageForPodcastEntity"
2028
+ | "fetchExtractedColorAndImageForTrackEntity"
2029
+ | "fetchExtractedColorForAlbumEntity"
2030
+ | "fetchExtractedColorForArtistEntity"
2031
+ | "fetchExtractedColorForEpisodeEntity"
2032
+ | "fetchExtractedColorForPlaylistEntity"
2033
+ | "fetchExtractedColorForPodcastEntity"
2034
+ | "fetchExtractedColorForTrackEntity"
2035
+ | "getAlbumNameAndTracks"
2036
+ | "getEpisodeName"
2037
+ | "getTrackName"
2038
+ | "queryAlbumTrackUris"
2039
+ | "queryTrackArtists"
2040
+ | "decorateContextEpisodesOrChapters"
2041
+ | "decorateContextTracks"
2042
+ | "fetchTracksForRadioStation"
2043
+ | "decoratePlaylists"
2044
+ | "playlistUser"
2045
+ | "FetchPlaylistMetadata"
2046
+ | "playlistContentsItemTrackArtist"
2047
+ | "playlistContentsItemTrackAlbum"
2048
+ | "playlistContentsItemTrack"
2049
+ | "playlistContentsItemLocalTrack"
2050
+ | "playlistContentsItemEpisodeShow"
2051
+ | "playlistContentsItemEpisode"
2052
+ | "playlistContentsItemResponse"
2053
+ | "playlistContentsItem"
2054
+ | "FetchPlaylistContents"
2055
+ | "episodeTrailerUri"
2056
+ | "podcastEpisode"
2057
+ | "podcastMetadataV2"
2058
+ | "minimalAudiobook"
2059
+ | "audiobookChapter"
2060
+ | "audiobookMetadataV2"
2061
+ | "fetchExtractedColors"
2062
+ | "queryFullscreenMode"
2063
+ | "queryNpvEpisode"
2064
+ | "queryNpvArtist"
2065
+ | "albumTrack"
2066
+ | "getAlbum"
2067
+ | "queryAlbumTracks"
2068
+ | "queryArtistOverview"
2069
+ | "queryArtistAppearsOn"
2070
+ | "discographyAlbum"
2071
+ | "albumMetadataReleases"
2072
+ | "albumMetadata"
2073
+ | "queryArtistDiscographyAlbums"
2074
+ | "queryArtistDiscographySingles"
2075
+ | "queryArtistDiscographyCompilations"
2076
+ | "queryArtistDiscographyAll"
2077
+ | "queryArtistDiscographyOverview"
2078
+ | "artistPlaylist"
2079
+ | "queryArtistPlaylists"
2080
+ | "queryArtistDiscoveredOn"
2081
+ | "queryArtistFeaturing"
2082
+ | "queryArtistRelated"
2083
+ | "queryArtistMinimal"
2084
+ | "searchModalResults"
2085
+ | "queryWhatsNewFeed"
2086
+ | "whatsNewFeedNewItems"
2087
+ | "SetItemsStateInWhatsNewFeed"
2088
+ | "browseImageURLAndSize"
2089
+ | "browseImageSources"
2090
+ | "browseAlbum"
2091
+ | "browseArtist"
2092
+ | "browseEpisode"
2093
+ | "browseChapter"
2094
+ | "browsePlaylist"
2095
+ | "browsePodcast"
2096
+ | "browseAudiobook"
2097
+ | "browseTrack"
2098
+ | "browseUser"
2099
+ | "browseMerch"
2100
+ | "browseArtistConcerts"
2101
+ | "browseContent"
2102
+ | "browseSectionContainer"
2103
+ | "browseClientFeature"
2104
+ | "browseItem"
2105
+ | "browseAll"
2106
+ | "browsePage";
2107
+ /**
2108
+ * Collection of GraphQL definitions.
2109
+ */
2110
+ const Definitions: Record<Query | string, any>;
2111
+ /**
2112
+ * GraphQL query definitions. Subset of `Definitions` that are used as query requests.
2113
+ */
2114
+ const QueryDefinitions: Record<Query | string, any>;
2115
+ /**
2116
+ * GraphQL mutation definitions. Subset of `Definitions` that are used as mutation requests.
2117
+ */
2118
+ const MutationDefinitions: Record<Query | string, any>;
2119
+ /**
2120
+ * GraphQL response definitions. Subset of `Definitions` that are used as response types.
2121
+ */
2122
+ const ResponseDefinitions: Record<Query | string, any>;
2123
+ /**
2124
+ * Sends a GraphQL query to Spotify.
2125
+ * @description A preinitialized version of `Spicetify.GraphQL.Handler` using current context.
2126
+ * @param query Query to send
2127
+ * @param variables Variables to use
2128
+ * @param context Context to use
2129
+ * @return Promise that resolves to the response
2130
+ */
2131
+ function Request(query: (typeof Definitions)[Query | string], variables?: Record<string, any>, context?: Record<string, any>): Promise<any>;
2132
+ /**
2133
+ * Context for GraphQL queries.
2134
+ * @description Used to set context for the handler and initialze it.
2135
+ */
2136
+ const Context: Record<string, any>;
2137
+ /**
2138
+ * Handler for GraphQL queries.
2139
+ * @param context Context to use
2140
+ * @return Function to handle GraphQL queries
2141
+ */
2142
+ function Handler(
2143
+ context: Record<string, any>
2144
+ ): (query: (typeof Definitions)[Query | string], variables?: Record<string, any>, context?: Record<string, any>) => Promise<any>;
2145
+ }
2146
+
2147
+ namespace ReactHook {
2148
+ /**
2149
+ * React Hook to create interactive drag-and-drop element
2150
+ * @description Used to create a draggable element that can be dropped into Spotify's components (e.g. Playlist, Folder, Sidebar, Queue)
2151
+ * @param uris List of URIs to be dragged
2152
+ * @param label Label to be displayed when dragging
2153
+ * @param contextUri Context URI of the element from which the drag originated (e.g. Playlist URI)
2154
+ * @param sectionIndex Index of the section in which the drag originated
2155
+ * @param dropOriginUri URI of the desired drop target. Leave empty to allow drop anywhere
2156
+ * @return Function to handle drag event. Should be passed to `onDragStart` prop of the element. All parameters passed onto the hook will be passed onto the handler unless declared otherwise.
2157
+ *
2158
+ */
2159
+ function DragHandler(
2160
+ uris?: string[],
2161
+ label?: string,
2162
+ contextUri?: string,
2163
+ sectionIndex?: number,
2164
+ dropOriginUri?: string
2165
+ ): (event: React.DragEvent, uris?: string[], label?: string, contextUri?: string, sectionIndex?: number) => void;
2166
+
2167
+ /**
2168
+ * React Hook to use extracted color from GraphQL
2169
+ *
2170
+ * @note This is a wrapper of ReactQuery's `useQuery` hook.
2171
+ * The component using this hook must be wrapped in a `QueryClientProvider` component.
2172
+ *
2173
+ * @see https://tanstack.com/query/v3/docs/react/reference/QueryClientProvider
2174
+ *
2175
+ * @param uri URI of the Spotify image to extract color from.
2176
+ * @param fallbackColor Fallback color to use if the image is not available. Defaults to `#535353`.
2177
+ * @param variant Variant of the color to use. Defaults to `colorRaw`.
2178
+ *
2179
+ * @return Extracted color hex code.
2180
+ */
2181
+ function useExtractedColor(uri: string, fallbackColor?: string, variant?: "colorRaw" | "colorLight" | "colorDark"): string;
2182
+ }
2183
+
2184
+ /**
2185
+ * react-flip-toolkit
2186
+ * @description A lightweight magic-move library for configurable layout transitions.
2187
+ * @link https://github.com/aholachek/react-flip-toolkit
2188
+ */
2189
+ namespace ReactFlipToolkit {
2190
+ const Flipper: any;
2191
+ const Flipped: any;
2192
+ const spring: any;
2193
+ }
2194
+
2195
+ /**
2196
+ * classnames
2197
+ * @description A simple JavaScript utility for conditionally joining classNames together.
2198
+ * @link https://github.com/JedWatson/classnames
2199
+ */
2200
+ function classnames(...args: any[]): string;
2201
+
2202
+ /**
2203
+ * React Query v3
2204
+ * @description A hook for fetching, caching and updating asynchronous data in React.
2205
+ * @link https://github.com/TanStack/query/tree/v3
2206
+ */
2207
+ const ReactQuery: any;
2208
+
2209
+ /**
2210
+ * Analyse and extract color presets from an image. Works for any valid image URL/URI.
2211
+ * @param image Spotify URI to an image, or an image URL.
2212
+ */
2213
+ function extractColorPreset(image: string | string[]): Promise<
2214
+ {
2215
+ colorRaw: Color;
2216
+ colorLight: Color;
2217
+ colorDark: Color;
2218
+ isFallback: boolean;
2219
+ }[]
2220
+ >;
2221
+
2222
+ interface hsl {
2223
+ h: number;
2224
+ s: number;
2225
+ l: number;
2226
+ }
2227
+ interface hsv {
2228
+ h: number;
2229
+ s: number;
2230
+ v: number;
2231
+ }
2232
+ interface rgb {
2233
+ r: number;
2234
+ g: number;
2235
+ b: number;
2236
+ }
2237
+ type CSSColors = "HEX" | "HEXA" | "HSL" | "HSLA" | "RGB" | "RGBA";
2238
+ /**
2239
+ * Spotify's internal color class
2240
+ */
2241
+ class Color {
2242
+ constructor(rgb: rgb, hsl: hsl, hsv: hsv, alpha?: number);
2243
+
2244
+ static BLACK: Color;
2245
+ static WHITE: Color;
2246
+ static CSSFormat: Record<CSSColors, number> & Record<number, CSSColors>;
2247
+
2248
+ a: number;
2249
+ hsl: hsl;
2250
+ hsv: hsv;
2251
+ rgb: rgb;
2252
+
2253
+ /**
2254
+ * Convert CSS representation to Color
2255
+ * @param cssColor CSS representation of the color. Must not contain spaces.
2256
+ * @param alpha Alpha value of the color. Defaults to 1.
2257
+ * @return Color object
2258
+ * @throws {Error} If the CSS color is invalid or unsupported
2259
+ */
2260
+ static fromCSS(cssColor: string, alpha?: number): Color;
2261
+ static fromHSL(hsl: hsl, alpha?: number): Color;
2262
+ static fromHSV(hsv: hsv, alpha?: number): Color;
2263
+ static fromRGB(rgb: rgb, alpha?: number): Color;
2264
+ static fromHex(hex: string, alpha?: number): Color;
2265
+
2266
+ /**
2267
+ * Change the contrast of the color against another so that
2268
+ * the contrast between them is at least `strength`.
2269
+ */
2270
+ contrastAdjust(against: Color, strength?: number): Color;
2271
+
2272
+ /**
2273
+ * Stringify JSON result
2274
+ */
2275
+ stringify(): string;
2276
+
2277
+ /**
2278
+ * Convert to CSS representation
2279
+ * @param colorFormat CSS color format to convert to
2280
+ * @return CSS representation of the color
2281
+ */
2282
+ toCSS(colorFormat: number): string;
2283
+
2284
+ /**
2285
+ * Return RGBA representation of the color
2286
+ */
2287
+ toString(): string;
2288
+ }
2289
+
2290
+ /**
2291
+ * Spotify internal library for localization
2292
+ */
2293
+ namespace Locale {
2294
+ /**
2295
+ * Relative time format
2296
+ */
2297
+ const _relativeTimeFormat: Intl.RelativeTimeFormat | null;
2298
+ /**
2299
+ * Registered date time formats in the current session
2300
+ */
2301
+ const _dateTimeFormats: Record<string, Intl.DateTimeFormat>;
2302
+ /**
2303
+ * Current locale of the client
2304
+ */
2305
+ const _locale: string;
2306
+ const _urlLocale: string;
2307
+ /**
2308
+ * Collection of supported locales
2309
+ */
2310
+ const _supportedLocales: Record<string, string>;
2311
+ /**
2312
+ * Dictionary of localized strings
2313
+ */
2314
+ const _dictionary: Record<string, string | { one: string; other: string }>;
2315
+
2316
+ /**
2317
+ * Format date into locale string
2318
+ *
2319
+ * @param date Date to format
2320
+ * @param options Options to use
2321
+ * @return Localized string
2322
+ * @throws {RangeError} If the date is invalid
2323
+ */
2324
+ function formatDate(date: number | Date | undefined, options?: Intl.DateTimeFormatOptions): string;
2325
+ /**
2326
+ * Format time into relative locale string
2327
+ *
2328
+ * @param date Date to format
2329
+ * @param options Options to use
2330
+ * @return Localized string
2331
+ * @throws {RangeError} If the date is invalid
2332
+ */
2333
+ function formatRelativeTime(date: number | Date | undefined, options?: Intl.DateTimeFormatOptions): string;
2334
+ /**
2335
+ * Format number into locale string
2336
+ *
2337
+ * @param number Number to format
2338
+ * @param options Options to use
2339
+ * @return Localized string
2340
+ */
2341
+ function formatNumber(number: number, options?: Intl.NumberFormatOptions): string;
2342
+ /**
2343
+ * Format number into compact locale string
2344
+ *
2345
+ * @param number Number to format
2346
+ * @return Localized string
2347
+ */
2348
+ function formatNumberCompact(number: number): string;
2349
+ /**
2350
+ * Get localized string
2351
+ *
2352
+ * @param key Key of the string
2353
+ * @param children React children to pass the string into
2354
+ * @return Localized string or React Fragment of the children
2355
+ */
2356
+ function get(key: string, ...children: React.ReactNode[]): string | React.ReactNode;
2357
+ /**
2358
+ * Get date time format of the passed options.
2359
+ *
2360
+ * Function calls here will register to the `_dateTimeFormats` dictionary.
2361
+ *
2362
+ * @param options Options to use
2363
+ * @return Date time format
2364
+ */
2365
+ function getDateTimeFormat(options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;
2366
+ /**
2367
+ * Get the current locale dictionary
2368
+ *
2369
+ * @return Current locale dictionary
2370
+ */
2371
+ function getDictionary(): Record<string, string | { one: string; other: string }>;
2372
+ /**
2373
+ * Get the current locale
2374
+ *
2375
+ * @return Current locale
2376
+ */
2377
+ function getLocale(): string;
2378
+ /**
2379
+ * Get the current locale code for Smartling
2380
+ *
2381
+ * @return Current locale code for Smartling
2382
+ */
2383
+ function getSmartlingLocale(): string;
2384
+ /**
2385
+ * Get the current locale code for URL
2386
+ *
2387
+ * @return Current locale code for URL
2388
+ */
2389
+ function getUrlLocale(): string;
2390
+ /**
2391
+ * Get the current relative time format
2392
+ *
2393
+ * @return Current relative time format
2394
+ */
2395
+ function getRelativeTimeFormat(): Intl.RelativeTimeFormat;
2396
+ /**
2397
+ * Get the separator for the current locale
2398
+ *
2399
+ * @return Separator for the current locale
2400
+ */
2401
+ function getSeparator(): string;
2402
+ /**
2403
+ * Set the current locale
2404
+ *
2405
+ * This will clear all previously set relative time formats and key-value pairs.
2406
+ *
2407
+ * @param locale Locale to set
2408
+ */
2409
+ function setLocale(locale: string): void;
2410
+ /**
2411
+ * Set the current locale code for URL
2412
+ *
2413
+ * @param locale Locale code for URL to set
2414
+ */
2415
+ function setUrlLocale(locale: string): void;
2416
+ /**
2417
+ * Set the dictionary for the current locale
2418
+ *
2419
+ * @param dictionary Dictionary to set
2420
+ */
2421
+ function setDictionary(dictionary: Record<string, string | { one: string; other: string }>): void;
2422
+ /**
2423
+ * Transform text into locale lowercase
2424
+ *
2425
+ * @param text Text to transform
2426
+ * @return Locale lowercase text
2427
+ */
2428
+ function toLocaleLowerCase(text: string): string;
2429
+ /**
2430
+ * Transform text into locale uppercase
2431
+ *
2432
+ * @param text Text to transform
2433
+ * @return Locale uppercase text
2434
+ */
2435
+ function toLocaleUpperCase(text: string): string;
2436
+ }
2437
+ }