@mkody/twitch-emoticons 2.9.6 → 3.0.0-beta.2
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/README.md +530 -169
- package/dist/TwitchEmoticons.cjs +950 -0
- package/dist/TwitchEmoticons.esm.min.js +7 -0
- package/dist/TwitchEmoticons.esm.min.js.map +7 -0
- package/dist/TwitchEmoticons.min.js +2 -20
- package/dist/TwitchEmoticons.min.js.map +4 -4
- package/package.json +99 -72
- package/src/index.js +38 -12
- package/src/struct/BTTVEmote.js +72 -74
- package/src/struct/Channel.js +48 -48
- package/src/struct/Emote.js +71 -71
- package/src/struct/EmoteFetcher.js +358 -322
- package/src/struct/EmoteParser.js +95 -84
- package/src/struct/EmoteTypeMapper.js +9 -9
- package/src/struct/FFZEmote.js +91 -93
- package/src/struct/SevenTVEmote.js +88 -90
- package/src/struct/TwitchEmote.js +72 -71
- package/src/util/Collection.js +69 -55
- package/src/util/Constants.js +30 -30
- package/typings/index.d.cts +254 -0
- package/typings/index.d.ts +216 -99
- package/.jsdoc.json +0 -46
- package/.nvmrc +0 -1
- package/docs/BTTVEmote.html +0 -1532
- package/docs/Channel.html +0 -824
- package/docs/Collection.html +0 -798
- package/docs/Emote.html +0 -832
- package/docs/EmoteFetcher.html +0 -3741
- package/docs/EmoteParser.html +0 -1187
- package/docs/FFZEmote.html +0 -1686
- package/docs/SevenTVEmote.html +0 -1596
- package/docs/TwitchEmote.html +0 -1528
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -978
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -1049
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/index.html +0 -233
- package/docs/scripts/collapse.js +0 -39
- package/docs/scripts/commonNav.js +0 -28
- package/docs/scripts/linenumber.js +0 -25
- package/docs/scripts/nav.js +0 -12
- package/docs/scripts/polyfill.js +0 -4
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/scripts/prettify/lang-css.js +0 -2
- package/docs/scripts/prettify/prettify.js +0 -28
- package/docs/scripts/search.js +0 -99
- package/docs/struct_BTTVEmote.js.html +0 -162
- package/docs/struct_Channel.js.html +0 -132
- package/docs/struct_Emote.js.html +0 -159
- package/docs/struct_EmoteFetcher.js.html +0 -429
- package/docs/struct_EmoteParser.js.html +0 -172
- package/docs/struct_FFZEmote.js.html +0 -185
- package/docs/struct_SevenTVEmote.js.html +0 -180
- package/docs/struct_TwitchEmote.js.html +0 -159
- package/docs/styles/jsdoc.css +0 -776
- package/docs/styles/prettify.css +0 -80
- package/docs/util_Collection.js.html +0 -151
- package/eslint.config.mjs +0 -215
- package/jest.config.js +0 -198
- package/test/BTTV.test.js +0 -48
- package/test/FFZ.test.js +0 -71
- package/test/SevenTV.test.js +0 -71
- package/test/ToFromObject.test.js +0 -156
- package/test/Twitch.test.js +0 -64
- package/test/__snapshots__/ToFromObject.test.js.snap +0 -121
- package/test/other.test.js +0 -72
package/typings/index.d.ts
CHANGED
|
@@ -1,124 +1,241 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export class Channel {
|
|
2
|
+
public constructor (
|
|
3
|
+
fetcher: EmoteFetcher,
|
|
4
|
+
id: number
|
|
5
|
+
)
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
public fetcher: EmoteFetcher
|
|
8
|
+
public id: number
|
|
9
|
+
public emotes: Collection<string, Emote>
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
public fetchFFZEmotes(): Promise<Collection<string, FFZEmote>>;
|
|
11
|
-
public fetchSevenTVEmotes(): Promise<Collection<string, SevenTVEmote>>;
|
|
12
|
-
}
|
|
11
|
+
public fetchBTTVEmotes (): Promise<Collection<string, BTTVEmote>>
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
public constructor(channel: Channel, id: string, data: object);
|
|
13
|
+
public fetchFFZEmotes (): Promise<Collection<string, FFZEmote>>
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
public id: string;
|
|
20
|
-
public type: 'twitch' | 'bttv' | 'ffz' | '7tv';
|
|
21
|
-
public code: string;
|
|
22
|
-
}
|
|
15
|
+
public fetchSevenTVEmotes (): Promise<Collection<string, SevenTVEmote>>
|
|
16
|
+
}
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
public fetchBTTVEmotes(id?: number): Promise<Collection<string, BTTVEmote>>;
|
|
38
|
-
public fetchFFZEmotes(id?: number): Promise<Collection<string, FFZEmote>>;
|
|
39
|
-
public fetchSevenTVEmotes(id?: number, format?: 'webp' | 'avif'): Promise<Collection<string, SevenTVEmote>>;
|
|
40
|
-
public fromObject(emotesArray: EmoteObject[]): Emote[];
|
|
41
|
-
}
|
|
18
|
+
export abstract class Emote {
|
|
19
|
+
public constructor (
|
|
20
|
+
channel: Channel,
|
|
21
|
+
id: string,
|
|
22
|
+
data: object
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
public fetcher: EmoteFetcher
|
|
26
|
+
public channel: Channel
|
|
27
|
+
public id: string
|
|
28
|
+
public type: 'twitch' | 'bttv' | 'ffz' | '7tv' | null
|
|
29
|
+
public code: string
|
|
30
|
+
}
|
|
42
31
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
public parse(text: string, size?: number): string;
|
|
32
|
+
export class EmoteFetcher {
|
|
33
|
+
public constructor (
|
|
34
|
+
options?: {
|
|
35
|
+
twitchAppID?: string,
|
|
36
|
+
twitchAppSecret?: string,
|
|
37
|
+
apiClient?: object,
|
|
38
|
+
forceStatic?: boolean,
|
|
39
|
+
twitchThemeMode?: 'dark' | 'light'
|
|
54
40
|
}
|
|
41
|
+
)
|
|
55
42
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
public animated: boolean;
|
|
61
|
-
public imageType: 'png' | 'gif';
|
|
62
|
-
public readonly owner: Channel;
|
|
43
|
+
public emotes: Collection<string, Emote>
|
|
44
|
+
public channels: Collection<string, Channel>
|
|
45
|
+
public forceStatic: boolean
|
|
46
|
+
public twitchThemeMode: 'dark' | 'light'
|
|
63
47
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
public fetchTwitchEmotes (
|
|
49
|
+
id?: number
|
|
50
|
+
): Promise<Collection<string, TwitchEmote>>
|
|
67
51
|
|
|
68
|
-
|
|
69
|
-
|
|
52
|
+
public fetchBTTVEmotes (
|
|
53
|
+
id?: number
|
|
54
|
+
): Promise<Collection<string, BTTVEmote>>
|
|
70
55
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
public readonly owner?: Channel;
|
|
56
|
+
public fetchFFZEmotes (
|
|
57
|
+
id?: number
|
|
58
|
+
): Promise<Collection<string, FFZEmote>>
|
|
75
59
|
|
|
76
|
-
|
|
77
|
-
|
|
60
|
+
public fetchSevenTVEmotes (
|
|
61
|
+
id?: number,
|
|
62
|
+
options?: {
|
|
63
|
+
format?: 'webp' | 'avif'
|
|
78
64
|
}
|
|
65
|
+
): Promise<Collection<string, SevenTVEmote>>
|
|
79
66
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
public sizes: string[];
|
|
85
|
-
public animated: boolean;
|
|
86
|
-
public imageType: 'png' | 'webp';
|
|
87
|
-
public modifier: boolean;
|
|
88
|
-
public readonly owner?: Channel;
|
|
67
|
+
public fromObject (
|
|
68
|
+
emotesArray: EmoteObject[]
|
|
69
|
+
): Emote[]
|
|
70
|
+
}
|
|
89
71
|
|
|
90
|
-
|
|
91
|
-
|
|
72
|
+
export class EmoteParser {
|
|
73
|
+
public constructor (
|
|
74
|
+
fetcher: EmoteFetcher,
|
|
75
|
+
options?: {
|
|
76
|
+
template?: string,
|
|
77
|
+
type?: 'html' | 'markdown' | 'bbcode' | 'plain',
|
|
78
|
+
match?: RegExp
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
public parse (
|
|
83
|
+
text: string,
|
|
84
|
+
options?: {
|
|
85
|
+
size?: number,
|
|
86
|
+
forceStatic?: boolean,
|
|
87
|
+
themeMode?: 'dark' | 'light'
|
|
92
88
|
}
|
|
89
|
+
): string
|
|
90
|
+
}
|
|
93
91
|
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
export class TwitchEmote extends Emote {
|
|
93
|
+
public constructor (
|
|
94
|
+
channel: Channel,
|
|
95
|
+
id: string,
|
|
96
|
+
data: object
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
public set?: string;
|
|
100
|
+
public animated: boolean
|
|
101
|
+
public imageType: 'png' | 'gif'
|
|
102
|
+
public readonly owner: Channel
|
|
103
|
+
|
|
104
|
+
public toLink (
|
|
105
|
+
options?: {
|
|
106
|
+
size: number,
|
|
107
|
+
forceStatic?: boolean,
|
|
108
|
+
themeMode?: 'dark' | 'light'
|
|
109
|
+
}
|
|
110
|
+
): string
|
|
96
111
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
public animated: boolean;
|
|
100
|
-
public imageType: 'webp' | 'avif';
|
|
101
|
-
public readonly owner?: Channel;
|
|
112
|
+
public toObject (): EmoteObject
|
|
113
|
+
}
|
|
102
114
|
|
|
103
|
-
|
|
104
|
-
|
|
115
|
+
export class BTTVEmote extends Emote {
|
|
116
|
+
public constructor (
|
|
117
|
+
channel: Channel,
|
|
118
|
+
id: string,
|
|
119
|
+
data: any
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
public ownerName: string | null
|
|
123
|
+
public animated: boolean
|
|
124
|
+
public imageType: 'webp'
|
|
125
|
+
public readonly owner?: Channel
|
|
126
|
+
|
|
127
|
+
public toLink (
|
|
128
|
+
options?: {
|
|
129
|
+
size: number,
|
|
130
|
+
forceStatic?: boolean
|
|
105
131
|
}
|
|
132
|
+
): string
|
|
106
133
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
134
|
+
public toObject (): EmoteObject
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export class FFZEmote extends Emote {
|
|
138
|
+
public constructor (
|
|
139
|
+
channel: Channel,
|
|
140
|
+
id: string,
|
|
141
|
+
data: object
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
public ownerName: string | null
|
|
145
|
+
public sizes: string[]
|
|
146
|
+
public animated: boolean
|
|
147
|
+
public imageType: 'png' | 'webp'
|
|
148
|
+
public modifier: boolean
|
|
149
|
+
public readonly owner?: Channel
|
|
150
|
+
|
|
151
|
+
public toLink (
|
|
152
|
+
options?: {
|
|
153
|
+
size: number,
|
|
154
|
+
forceStatic?: boolean
|
|
117
155
|
}
|
|
156
|
+
): string
|
|
157
|
+
|
|
158
|
+
public toObject (): EmoteObject
|
|
159
|
+
}
|
|
118
160
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
161
|
+
export class SevenTVEmote extends Emote {
|
|
162
|
+
public constructor (
|
|
163
|
+
channel: Channel,
|
|
164
|
+
id: string,
|
|
165
|
+
data: object
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
public ownerName: string | null
|
|
169
|
+
public sizes: string[]
|
|
170
|
+
public animated: boolean
|
|
171
|
+
public imageType: 'webp' | 'avif'
|
|
172
|
+
public readonly owner?: Channel
|
|
173
|
+
|
|
174
|
+
public toLink (
|
|
175
|
+
options?: {
|
|
176
|
+
size: number,
|
|
177
|
+
forceStatic?: boolean
|
|
123
178
|
}
|
|
179
|
+
): string
|
|
180
|
+
|
|
181
|
+
public toObject (): EmoteObject
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface EmoteObject {
|
|
185
|
+
code: string,
|
|
186
|
+
id: string,
|
|
187
|
+
channel_id: string | null,
|
|
188
|
+
type: 'twitch' | 'bttv' | 'ffz' | '7tv' | null,
|
|
189
|
+
animated?: boolean,
|
|
190
|
+
ownerName?: string,
|
|
191
|
+
sizes?: string[],
|
|
192
|
+
set?: string,
|
|
193
|
+
imageType?: string
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export declare const Constants: {
|
|
197
|
+
Twitch: {
|
|
198
|
+
CDN: (id: string, size?: number, forceStatic?: boolean, theme?: 'dark' | 'light') => string;
|
|
199
|
+
};
|
|
200
|
+
BTTV: {
|
|
201
|
+
Global: string;
|
|
202
|
+
Channel: (id: string) => string;
|
|
203
|
+
CDN: (id: string, size?: number, forceStatic?: boolean) => string;
|
|
204
|
+
};
|
|
205
|
+
SevenTV: {
|
|
206
|
+
Global: string;
|
|
207
|
+
Channel: (id: string) => string;
|
|
208
|
+
CDN: (id: string, format: string, size?: number, forceStatic?: boolean) => string;
|
|
209
|
+
};
|
|
210
|
+
FFZ: {
|
|
211
|
+
sets: {
|
|
212
|
+
Global: number;
|
|
213
|
+
Modifiers: number;
|
|
214
|
+
};
|
|
215
|
+
Set: (id: string) => string;
|
|
216
|
+
Channel: (id: string) => string;
|
|
217
|
+
CDN: (id: string, size?: number) => string;
|
|
218
|
+
CDNAnimated: (id: string, size?: number) => string;
|
|
219
|
+
};
|
|
220
|
+
Templates: {
|
|
221
|
+
html: string;
|
|
222
|
+
markdown: string;
|
|
223
|
+
bbcode: string;
|
|
224
|
+
plain: string;
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export class Collection<K, V> extends Map<K, V> {
|
|
229
|
+
public find (
|
|
230
|
+
propOrFunc: string | ((item: V, index: number, coll: this) => boolean),
|
|
231
|
+
value?: any
|
|
232
|
+
): V
|
|
233
|
+
|
|
234
|
+
public filter (
|
|
235
|
+
func: (item: V, index: number, coll: this) => boolean
|
|
236
|
+
): Collection<K, V>
|
|
237
|
+
|
|
238
|
+
public map (
|
|
239
|
+
func: (item: V, index: number, coll: this) => any
|
|
240
|
+
): Array<any>
|
|
124
241
|
}
|
package/.jsdoc.json
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"tags": {
|
|
3
|
-
"allowUnknownTags": true,
|
|
4
|
-
"dictionaries": ["jsdoc"]
|
|
5
|
-
},
|
|
6
|
-
"source": {
|
|
7
|
-
"include": ["README.md", "src/struct", "src/util", "package.json"],
|
|
8
|
-
"includePattern": ".js$",
|
|
9
|
-
"excludePattern": "(node_modules/|docs)"
|
|
10
|
-
},
|
|
11
|
-
"templates": {
|
|
12
|
-
"cleverLinks": false,
|
|
13
|
-
"monospaceLinks": true,
|
|
14
|
-
"useLongnameInNav": false,
|
|
15
|
-
"default": {
|
|
16
|
-
"includeDate": false
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"opts": {
|
|
20
|
-
"destination": "./docs",
|
|
21
|
-
"encoding": "utf8",
|
|
22
|
-
"private": true,
|
|
23
|
-
"recurse": true,
|
|
24
|
-
"verbose": true,
|
|
25
|
-
"template": "./node_modules/docdash"
|
|
26
|
-
},
|
|
27
|
-
"plugins": ["plugins/markdown"],
|
|
28
|
-
"markdown": {
|
|
29
|
-
"hardwrap": true
|
|
30
|
-
},
|
|
31
|
-
"docdash": {
|
|
32
|
-
"sort": false,
|
|
33
|
-
"private": false,
|
|
34
|
-
"menu": {
|
|
35
|
-
"GitHub": {
|
|
36
|
-
"href":"https://github.com/mkody/twitch-emoticons",
|
|
37
|
-
"target":"_blank",
|
|
38
|
-
"class":"menu-item",
|
|
39
|
-
"id":"github_link"
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
"scopeInOutputPath": false,
|
|
43
|
-
"nameInOutputPath": false,
|
|
44
|
-
"versionInOutputPath": false
|
|
45
|
-
}
|
|
46
|
-
}
|
package/.nvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
24
|