@spicemod/creator 0.0.22 → 0.0.24

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