@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.
Files changed (80) hide show
  1. package/README.md +530 -169
  2. package/dist/TwitchEmoticons.cjs +950 -0
  3. package/dist/TwitchEmoticons.esm.min.js +7 -0
  4. package/dist/TwitchEmoticons.esm.min.js.map +7 -0
  5. package/dist/TwitchEmoticons.min.js +2 -20
  6. package/dist/TwitchEmoticons.min.js.map +4 -4
  7. package/package.json +99 -72
  8. package/src/index.js +38 -12
  9. package/src/struct/BTTVEmote.js +72 -74
  10. package/src/struct/Channel.js +48 -48
  11. package/src/struct/Emote.js +71 -71
  12. package/src/struct/EmoteFetcher.js +358 -322
  13. package/src/struct/EmoteParser.js +95 -84
  14. package/src/struct/EmoteTypeMapper.js +9 -9
  15. package/src/struct/FFZEmote.js +91 -93
  16. package/src/struct/SevenTVEmote.js +88 -90
  17. package/src/struct/TwitchEmote.js +72 -71
  18. package/src/util/Collection.js +69 -55
  19. package/src/util/Constants.js +30 -30
  20. package/typings/index.d.cts +254 -0
  21. package/typings/index.d.ts +216 -99
  22. package/.jsdoc.json +0 -46
  23. package/.nvmrc +0 -1
  24. package/docs/BTTVEmote.html +0 -1532
  25. package/docs/Channel.html +0 -824
  26. package/docs/Collection.html +0 -798
  27. package/docs/Emote.html +0 -832
  28. package/docs/EmoteFetcher.html +0 -3741
  29. package/docs/EmoteParser.html +0 -1187
  30. package/docs/FFZEmote.html +0 -1686
  31. package/docs/SevenTVEmote.html +0 -1596
  32. package/docs/TwitchEmote.html +0 -1528
  33. package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  34. package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  35. package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  36. package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  37. package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  38. package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  39. package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  40. package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  41. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  42. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -978
  43. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  44. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  45. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  46. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  47. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -1049
  48. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  49. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  50. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  51. package/docs/index.html +0 -233
  52. package/docs/scripts/collapse.js +0 -39
  53. package/docs/scripts/commonNav.js +0 -28
  54. package/docs/scripts/linenumber.js +0 -25
  55. package/docs/scripts/nav.js +0 -12
  56. package/docs/scripts/polyfill.js +0 -4
  57. package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
  58. package/docs/scripts/prettify/lang-css.js +0 -2
  59. package/docs/scripts/prettify/prettify.js +0 -28
  60. package/docs/scripts/search.js +0 -99
  61. package/docs/struct_BTTVEmote.js.html +0 -162
  62. package/docs/struct_Channel.js.html +0 -132
  63. package/docs/struct_Emote.js.html +0 -159
  64. package/docs/struct_EmoteFetcher.js.html +0 -429
  65. package/docs/struct_EmoteParser.js.html +0 -172
  66. package/docs/struct_FFZEmote.js.html +0 -185
  67. package/docs/struct_SevenTVEmote.js.html +0 -180
  68. package/docs/struct_TwitchEmote.js.html +0 -159
  69. package/docs/styles/jsdoc.css +0 -776
  70. package/docs/styles/prettify.css +0 -80
  71. package/docs/util_Collection.js.html +0 -151
  72. package/eslint.config.mjs +0 -215
  73. package/jest.config.js +0 -198
  74. package/test/BTTV.test.js +0 -48
  75. package/test/FFZ.test.js +0 -71
  76. package/test/SevenTV.test.js +0 -71
  77. package/test/ToFromObject.test.js +0 -156
  78. package/test/Twitch.test.js +0 -64
  79. package/test/__snapshots__/ToFromObject.test.js.snap +0 -121
  80. package/test/other.test.js +0 -72
@@ -1,124 +1,241 @@
1
- declare module '@mkody/twitch-emoticons' {
2
- export class Channel {
3
- public constructor(fetcher: EmoteFetcher, id: number);
1
+ export class Channel {
2
+ public constructor (
3
+ fetcher: EmoteFetcher,
4
+ id: number
5
+ )
4
6
 
5
- public fetcher: EmoteFetcher;
6
- public id: number;
7
- public emotes: Collection<string, Emote>;
7
+ public fetcher: EmoteFetcher
8
+ public id: number
9
+ public emotes: Collection<string, Emote>
8
10
 
9
- public fetchBTTVEmotes(): Promise<Collection<string, BTTVEmote>>;
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
- export abstract class Emote {
15
- public constructor(channel: Channel, id: string, data: object);
13
+ public fetchFFZEmotes (): Promise<Collection<string, FFZEmote>>
16
14
 
17
- public fetcher: EmoteFetcher;
18
- public channel: Channel;
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
- export class EmoteFetcher {
25
- public constructor(
26
- clientId?: string,
27
- clientSecret?: string,
28
- options?: {
29
- apiClient?: object
30
- }
31
- );
32
-
33
- public emotes: Collection<string, Emote>;
34
- public channels: Collection<string, Channel>;
35
-
36
- public fetchTwitchEmotes(id?: number): Promise<Collection<string, TwitchEmote>>;
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
- export class EmoteParser {
44
- public constructor(
45
- fetcher: EmoteFetcher,
46
- options: {
47
- template?: string,
48
- type?: 'html' | 'markdown' | 'bbcode' | 'plain',
49
- match?: RegExp
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
- export class TwitchEmote extends Emote {
57
- public constructor(channel: Channel, id: string, data: object);
58
-
59
- public set?: string;
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
- public toLink(size: number): string;
65
- public toObject(): EmoteObject;
66
- }
48
+ public fetchTwitchEmotes (
49
+ id?: number
50
+ ): Promise<Collection<string, TwitchEmote>>
67
51
 
68
- export class BTTVEmote extends Emote {
69
- public constructor(channel: Channel, id: string, data: any);
52
+ public fetchBTTVEmotes (
53
+ id?: number
54
+ ): Promise<Collection<string, BTTVEmote>>
70
55
 
71
- public ownerName: string | null;
72
- public animated: boolean;
73
- public imageType: 'webp';
74
- public readonly owner?: Channel;
56
+ public fetchFFZEmotes (
57
+ id?: number
58
+ ): Promise<Collection<string, FFZEmote>>
75
59
 
76
- public toLink(size: number): string;
77
- public toObject(): EmoteObject;
60
+ public fetchSevenTVEmotes (
61
+ id?: number,
62
+ options?: {
63
+ format?: 'webp' | 'avif'
78
64
  }
65
+ ): Promise<Collection<string, SevenTVEmote>>
79
66
 
80
- export class FFZEmote extends Emote {
81
- public constructor(channel: Channel, id: string, data: object);
82
-
83
- public ownerName: string | null;
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
- public toLink(size: number): string;
91
- public toObject(): EmoteObject;
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
- export class SevenTVEmote extends Emote {
95
- public constructor(channel: Channel, id: string, data: object);
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
- public ownerName: string | null;
98
- public sizes: string[];
99
- public animated: boolean;
100
- public imageType: 'webp' | 'avif';
101
- public readonly owner?: Channel;
112
+ public toObject (): EmoteObject
113
+ }
102
114
 
103
- public toLink(size: number): string;
104
- public toObject(): EmoteObject;
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
- export interface EmoteObject {
108
- code: string,
109
- id: string,
110
- channel_id: string,
111
- type: 'twitch' | 'bttv' | 'ffz' | '7tv'
112
- animated?: boolean,
113
- ownerName?: string,
114
- sizes?: string[],
115
- set?: string,
116
- imageType?: string
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
- export class Collection<K, V> extends Map<K, V> {
120
- public find(propOrFunc: string | ((item: V, index: number, coll: this) => boolean), value?: any): V;
121
- public filter(func: (item: V, index: number, coll: this) => boolean): Collection<K, V>;
122
- public map(func: (item: V, index: number, coll: this) => any): Array<any>;
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