spotifyplus 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/animated.d.ts +8 -0
- package/animated.js +25164 -0
- package/components.d.ts +283 -0
- package/components.js +25272 -0
- package/entities.d.ts +103 -0
- package/entities.js +131 -0
- package/index.cjs +39 -0
- package/index.d.ts +1 -0
- package/internal/components.d.ts +1115 -0
- package/internal/legacy-animated.d.ts +217 -0
- package/internal/native-animation-core.d.ts +129 -0
- package/internal/native-animation.d.ts +8 -0
- package/internal/renderer.d.ts +163 -0
- package/internal/script-api.d.ts +72 -0
- package/internal/script-registry.d.ts +5 -0
- package/package.json +113 -0
package/entities.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface SpotifyTrackData {
|
|
3
|
+
title: string;
|
|
4
|
+
trackNumber: number;
|
|
5
|
+
durationMs: number;
|
|
6
|
+
explicit: boolean;
|
|
7
|
+
uri: string;
|
|
8
|
+
artist: string;
|
|
9
|
+
artists: string[];
|
|
10
|
+
album: SpotifyAlbumData;
|
|
11
|
+
}
|
|
12
|
+
export interface SpotifyAlbumData {
|
|
13
|
+
title: string;
|
|
14
|
+
artist: string;
|
|
15
|
+
release?: Date;
|
|
16
|
+
image: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class SpotifyAlbum {
|
|
19
|
+
readonly title: string;
|
|
20
|
+
readonly artist: string;
|
|
21
|
+
readonly release?: Date;
|
|
22
|
+
readonly image: string;
|
|
23
|
+
constructor(title: string, artist: string, image: string, release?: Date);
|
|
24
|
+
static from(data: SpotifyAlbumData): SpotifyAlbum;
|
|
25
|
+
toJSON(): SpotifyAlbumData;
|
|
26
|
+
}
|
|
27
|
+
export declare class SpotifyTrack {
|
|
28
|
+
readonly title: string;
|
|
29
|
+
readonly trackNumber: number;
|
|
30
|
+
readonly durationMs: number;
|
|
31
|
+
readonly explicit: boolean;
|
|
32
|
+
readonly uri: string;
|
|
33
|
+
readonly id: string;
|
|
34
|
+
readonly artist: string;
|
|
35
|
+
readonly artists: string[];
|
|
36
|
+
readonly album: SpotifyAlbumData;
|
|
37
|
+
constructor(data: SpotifyTrackData);
|
|
38
|
+
static from(data: SpotifyTrackData): SpotifyTrack;
|
|
39
|
+
get displayName(): string;
|
|
40
|
+
toJSON(): SpotifyTrackData;
|
|
41
|
+
}
|
|
42
|
+
export interface GetProgressData {
|
|
43
|
+
position: number;
|
|
44
|
+
}
|
|
45
|
+
export interface MenuItemDefinition {
|
|
46
|
+
id: string;
|
|
47
|
+
title: string;
|
|
48
|
+
}
|
|
49
|
+
export interface MenuContext {
|
|
50
|
+
type: string;
|
|
51
|
+
track?: SpotifyTrackData;
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
}
|
|
54
|
+
export interface PlatformData {
|
|
55
|
+
/** The current version of the Spotify app */
|
|
56
|
+
clientVersion: string;
|
|
57
|
+
/** The name of the operating system */
|
|
58
|
+
osName: string;
|
|
59
|
+
/** The current major version of Android */
|
|
60
|
+
osVersion: string;
|
|
61
|
+
/** The current Android SDK version or API level */
|
|
62
|
+
sdkVersion: number;
|
|
63
|
+
}
|
|
64
|
+
export interface Session {
|
|
65
|
+
/** The user's Spotify access token. This is used to authenticate requests to the Spotify API */
|
|
66
|
+
accessToken: string;
|
|
67
|
+
}
|
|
68
|
+
export type ContextMenuRegister = (menu: ContextMenu) => void;
|
|
69
|
+
export type OnClickCallback = (uri: string) => void;
|
|
70
|
+
export type ShouldAddCallback = (uri: string, contextUri: string) => boolean;
|
|
71
|
+
export declare class ContextMenu {
|
|
72
|
+
private readonly registerThing?;
|
|
73
|
+
name: string;
|
|
74
|
+
readonly onClick: OnClickCallback;
|
|
75
|
+
readonly shouldAdd?: ShouldAddCallback;
|
|
76
|
+
disabled: boolean;
|
|
77
|
+
constructor(name: string, onClick: OnClickCallback, shouldAdd?: ShouldAddCallback, disabled?: boolean, registerThing?: ContextMenuRegister);
|
|
78
|
+
register(): this;
|
|
79
|
+
}
|
|
80
|
+
export type SideDrawerRegister = (drawer: SideDrawerItem) => void;
|
|
81
|
+
export type SideOnClickCallback = () => React.ReactElement | void;
|
|
82
|
+
export declare class SideDrawerItem {
|
|
83
|
+
private readonly registerThing?;
|
|
84
|
+
name: string;
|
|
85
|
+
readonly onClick: SideOnClickCallback;
|
|
86
|
+
constructor(name: string, onClick: SideOnClickCallback, registerThing?: SideDrawerRegister);
|
|
87
|
+
register(): this;
|
|
88
|
+
}
|
|
89
|
+
export interface UriData {
|
|
90
|
+
type: string;
|
|
91
|
+
id?: string;
|
|
92
|
+
}
|
|
93
|
+
export declare class Uri {
|
|
94
|
+
type: string;
|
|
95
|
+
id?: string;
|
|
96
|
+
constructor(type: string, props?: UriData);
|
|
97
|
+
static from(data: UriData): Uri;
|
|
98
|
+
toString(): string;
|
|
99
|
+
}
|
|
100
|
+
export type Surface = {
|
|
101
|
+
id: string;
|
|
102
|
+
type: string;
|
|
103
|
+
};
|
package/entities.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// sdk/entities.ts
|
|
21
|
+
var entities_exports = {};
|
|
22
|
+
__export(entities_exports, {
|
|
23
|
+
ContextMenu: () => ContextMenu,
|
|
24
|
+
SideDrawerItem: () => SideDrawerItem,
|
|
25
|
+
SpotifyAlbum: () => SpotifyAlbum,
|
|
26
|
+
SpotifyTrack: () => SpotifyTrack,
|
|
27
|
+
Uri: () => Uri
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(entities_exports);
|
|
30
|
+
|
|
31
|
+
// core/models.ts
|
|
32
|
+
var SpotifyAlbum = class _SpotifyAlbum {
|
|
33
|
+
constructor(title, artist, image, release) {
|
|
34
|
+
this.title = title;
|
|
35
|
+
this.artist = artist;
|
|
36
|
+
this.release = release;
|
|
37
|
+
this.image = image;
|
|
38
|
+
}
|
|
39
|
+
static from(data) {
|
|
40
|
+
return new _SpotifyAlbum(data.title, data.artist, data.image, data.release);
|
|
41
|
+
}
|
|
42
|
+
toJSON() {
|
|
43
|
+
return {
|
|
44
|
+
title: this.title,
|
|
45
|
+
artist: this.artist,
|
|
46
|
+
release: this.release,
|
|
47
|
+
image: this.image
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var SpotifyTrack = class _SpotifyTrack {
|
|
52
|
+
constructor(data) {
|
|
53
|
+
this.uri = data.uri;
|
|
54
|
+
this.id = this.uri.split(":")[2];
|
|
55
|
+
this.title = data.title;
|
|
56
|
+
this.trackNumber = data.trackNumber;
|
|
57
|
+
this.artist = data.artist;
|
|
58
|
+
this.artists = data.artists;
|
|
59
|
+
this.album = data.album;
|
|
60
|
+
this.durationMs = data.durationMs;
|
|
61
|
+
this.explicit = data.explicit;
|
|
62
|
+
}
|
|
63
|
+
static from(data) {
|
|
64
|
+
return new _SpotifyTrack(data);
|
|
65
|
+
}
|
|
66
|
+
get displayName() {
|
|
67
|
+
return `${this.title} - ${this.artist}`;
|
|
68
|
+
}
|
|
69
|
+
toJSON() {
|
|
70
|
+
return {
|
|
71
|
+
title: this.title,
|
|
72
|
+
trackNumber: this.trackNumber,
|
|
73
|
+
durationMs: this.durationMs,
|
|
74
|
+
explicit: this.explicit,
|
|
75
|
+
uri: this.uri,
|
|
76
|
+
artist: this.artist,
|
|
77
|
+
album: this.album,
|
|
78
|
+
artists: this.artists
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var ContextMenu = class {
|
|
83
|
+
constructor(name, onClick, shouldAdd, disabled, registerThing) {
|
|
84
|
+
this.name = name;
|
|
85
|
+
this.onClick = onClick;
|
|
86
|
+
this.shouldAdd = shouldAdd;
|
|
87
|
+
this.disabled = disabled ?? false;
|
|
88
|
+
this.registerThing = registerThing;
|
|
89
|
+
}
|
|
90
|
+
register() {
|
|
91
|
+
if (!this.registerThing) {
|
|
92
|
+
throw new Error("ContextMenu register thing has not been initialized");
|
|
93
|
+
}
|
|
94
|
+
this.registerThing(this);
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var SideDrawerItem = class {
|
|
99
|
+
constructor(name, onClick, registerThing) {
|
|
100
|
+
this.name = name;
|
|
101
|
+
this.onClick = onClick;
|
|
102
|
+
this.registerThing = registerThing;
|
|
103
|
+
}
|
|
104
|
+
register() {
|
|
105
|
+
if (!this.registerThing) {
|
|
106
|
+
throw new Error("SideDrawer register thing has not been initialized");
|
|
107
|
+
}
|
|
108
|
+
this.registerThing(this);
|
|
109
|
+
return this;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
var Uri = class _Uri {
|
|
113
|
+
constructor(type, props) {
|
|
114
|
+
this.type = type;
|
|
115
|
+
this.id = props?.id;
|
|
116
|
+
}
|
|
117
|
+
static from(data) {
|
|
118
|
+
return new _Uri(data.type, data);
|
|
119
|
+
}
|
|
120
|
+
toString() {
|
|
121
|
+
return this.id ? `spotify:${this.type}:${this.id}` : `spotify:${this.type}`;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
125
|
+
0 && (module.exports = {
|
|
126
|
+
ContextMenu,
|
|
127
|
+
SideDrawerItem,
|
|
128
|
+
SpotifyAlbum,
|
|
129
|
+
SpotifyTrack,
|
|
130
|
+
Uri
|
|
131
|
+
});
|
package/index.cjs
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// sdk/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
SpotifyPlus: () => SpotifyPlus
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
27
|
+
// sdk/runtime.ts
|
|
28
|
+
function getSpotifyPlusApi() {
|
|
29
|
+
const api = globalThis.__spotifyplus_api__;
|
|
30
|
+
if (!api) throw new Error("SpotifyPlus API is not available in this environment!");
|
|
31
|
+
return api;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// sdk/index.ts
|
|
35
|
+
var SpotifyPlus = getSpotifyPlusApi();
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
SpotifyPlus
|
|
39
|
+
});
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SpotifyPlus: import("spotifyplus/internal/script-api").SpotifyPlusApi;
|