@xpadev-net/niconicomments 0.2.46 → 0.2.48
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/LICENSE +21 -21
- package/LICENSE_JP +11 -11
- package/README.en.md +43 -43
- package/README.md +43 -43
- package/dist/bundle.d.ts +674 -594
- package/dist/bundle.js +2820 -2675
- package/package.json +67 -67
package/dist/bundle.d.ts
CHANGED
|
@@ -1,260 +1,228 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare class FlashComment implements IComment {
|
|
5
|
-
private readonly context;
|
|
6
|
-
readonly comment: formattedCommentWithSize;
|
|
7
|
-
private readonly _globalScale;
|
|
8
|
-
private scale;
|
|
9
|
-
private scaleX;
|
|
10
|
-
posY: number;
|
|
11
|
-
image?: HTMLCanvasElement | null;
|
|
12
|
-
constructor(comment: formattedComment, context: CanvasRenderingContext2D);
|
|
13
|
-
get invisible(): boolean;
|
|
14
|
-
get loc(): commentLoc;
|
|
15
|
-
get long(): number;
|
|
16
|
-
get vpos(): number;
|
|
17
|
-
get width(): number;
|
|
18
|
-
get height(): number;
|
|
19
|
-
get flash(): boolean;
|
|
20
|
-
get layer(): number;
|
|
21
|
-
get owner(): boolean;
|
|
22
|
-
get mail(): string[];
|
|
23
|
-
get lineCount(): number;
|
|
24
|
-
parseCommandAndNicoscript(comment: formattedComment): formattedCommentWithFont;
|
|
25
|
-
measureText(comment: measureTextInput): measureTextResult;
|
|
26
|
-
getCommentSize(parsedData: formattedCommentWithFont): formattedCommentWithSize;
|
|
27
|
-
draw(vpos: number, showCollision: boolean, debug: boolean): void;
|
|
28
|
-
getTextImage(): HTMLCanvasElement | null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
declare class HTML5Comment implements IComment {
|
|
36
|
-
private readonly context;
|
|
37
|
-
readonly comment: formattedCommentWithSize;
|
|
38
|
-
posY: number;
|
|
39
|
-
image?: HTMLCanvasElement | null;
|
|
40
|
-
constructor(comment: formattedComment, context: CanvasRenderingContext2D);
|
|
41
|
-
get invisible(): boolean;
|
|
42
|
-
get loc(): commentLoc;
|
|
43
|
-
get long(): number;
|
|
44
|
-
get vpos(): number;
|
|
45
|
-
get width(): number;
|
|
46
|
-
get height(): number;
|
|
47
|
-
get flash(): boolean;
|
|
48
|
-
get layer(): number;
|
|
49
|
-
get owner(): boolean;
|
|
50
|
-
get mail(): string[];
|
|
51
|
-
get lineCount(): number;
|
|
52
|
-
parseCommandAndNicoscript(comment: formattedComment): formattedCommentWithFont;
|
|
53
|
-
measureText(comment: measureTextInput): measureTextResult;
|
|
54
|
-
getCommentSize(parsedData: formattedCommentWithFont): formattedCommentWithSize;
|
|
55
|
-
draw(vpos: number, showCollision: boolean, debug: boolean): void;
|
|
56
|
-
getTextImage(): HTMLCanvasElement | null;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
declare let imageCache: {
|
|
61
|
-
[key: string]: {
|
|
62
|
-
image: HTMLCanvasElement;
|
|
63
|
-
timeout: number;
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
declare const resetImageCache: () => void;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
declare let nicoScripts: nicoScript;
|
|
71
|
-
declare const resetNicoScripts: () => void;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
declare let plugins: IPlugin[];
|
|
76
|
-
declare const setPlugins: (input: IPlugin[]) => void;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
declare const colors: {
|
|
80
|
-
white: string;
|
|
81
|
-
red: string;
|
|
82
|
-
pink: string;
|
|
83
|
-
orange: string;
|
|
84
|
-
yellow: string;
|
|
85
|
-
green: string;
|
|
86
|
-
cyan: string;
|
|
87
|
-
blue: string;
|
|
88
|
-
purple: string;
|
|
89
|
-
black: string;
|
|
90
|
-
white2: string;
|
|
91
|
-
niconicowhite: string;
|
|
92
|
-
red2: string;
|
|
93
|
-
truered: string;
|
|
94
|
-
pink2: string;
|
|
95
|
-
orange2: string;
|
|
96
|
-
passionorange: string;
|
|
97
|
-
yellow2: string;
|
|
98
|
-
madyellow: string;
|
|
99
|
-
green2: string;
|
|
100
|
-
elementalgreen: string;
|
|
101
|
-
cyan2: string;
|
|
102
|
-
blue2: string;
|
|
103
|
-
marinblue: string;
|
|
104
|
-
purple2: string;
|
|
105
|
-
nobleviolet: string;
|
|
106
|
-
black2: string;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
declare let defaultConfig: BaseConfig;
|
|
113
|
-
declare const initConfig: () => void;
|
|
114
|
-
declare const defaultOptions: BaseOptions;
|
|
115
|
-
declare let config: BaseConfig;
|
|
116
|
-
declare let options: BaseOptions;
|
|
117
|
-
declare const setConfig: (value: BaseConfig) => BaseConfig;
|
|
118
|
-
declare const setOptions: (value: BaseOptions) => BaseOptions;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
declare const fontTemplates: {
|
|
122
|
-
arial: {
|
|
123
|
-
font: string;
|
|
124
|
-
offset: number;
|
|
125
|
-
weight: number;
|
|
126
|
-
};
|
|
127
|
-
gothic: {
|
|
128
|
-
font: string;
|
|
129
|
-
offset: number;
|
|
130
|
-
weight: number;
|
|
131
|
-
};
|
|
132
|
-
gulim: {
|
|
133
|
-
font: string;
|
|
134
|
-
offset: number;
|
|
135
|
-
weight: number;
|
|
136
|
-
};
|
|
137
|
-
mincho: {
|
|
138
|
-
font: string;
|
|
139
|
-
offset: number;
|
|
140
|
-
weight: number;
|
|
141
|
-
};
|
|
142
|
-
simsun: {
|
|
143
|
-
font: string;
|
|
144
|
-
offset: number;
|
|
145
|
-
weight: number;
|
|
146
|
-
};
|
|
147
|
-
macGothicPro6: {
|
|
148
|
-
font: string;
|
|
149
|
-
offset: number;
|
|
150
|
-
weight: number;
|
|
151
|
-
};
|
|
152
|
-
macGothicPro3: {
|
|
153
|
-
font: string;
|
|
154
|
-
offset: number;
|
|
155
|
-
weight: number;
|
|
156
|
-
};
|
|
157
|
-
macMincho: {
|
|
158
|
-
font: string;
|
|
159
|
-
offset: number;
|
|
160
|
-
weight: number;
|
|
161
|
-
};
|
|
162
|
-
macGothic1: {
|
|
163
|
-
font: string;
|
|
164
|
-
offset: number;
|
|
165
|
-
weight: number;
|
|
166
|
-
};
|
|
167
|
-
macGothic2: {
|
|
168
|
-
font: string;
|
|
169
|
-
offset: number;
|
|
170
|
-
weight: number;
|
|
171
|
-
};
|
|
172
|
-
sansSerif600: {
|
|
173
|
-
font: string;
|
|
174
|
-
offset: number;
|
|
175
|
-
weight: number;
|
|
176
|
-
};
|
|
177
|
-
sansSerif400: {
|
|
178
|
-
font: string;
|
|
179
|
-
offset: number;
|
|
180
|
-
weight: number;
|
|
181
|
-
};
|
|
182
|
-
serif: {
|
|
183
|
-
font: string;
|
|
184
|
-
offset: number;
|
|
185
|
-
weight: number;
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
declare const fonts: {
|
|
189
|
-
win7: {
|
|
190
|
-
defont: FontItem;
|
|
191
|
-
gothic: FontItem;
|
|
192
|
-
mincho: FontItem;
|
|
193
|
-
};
|
|
194
|
-
win8_1: {
|
|
195
|
-
defont: FontItem;
|
|
196
|
-
gothic: FontItem;
|
|
197
|
-
mincho: FontItem;
|
|
198
|
-
};
|
|
199
|
-
win: {
|
|
200
|
-
defont: FontItem;
|
|
201
|
-
gothic: FontItem;
|
|
202
|
-
mincho: FontItem;
|
|
203
|
-
};
|
|
204
|
-
mac10_9: {
|
|
205
|
-
defont: FontItem;
|
|
206
|
-
gothic: FontItem;
|
|
207
|
-
mincho: FontItem;
|
|
208
|
-
};
|
|
209
|
-
mac10_11: {
|
|
210
|
-
defont: FontItem;
|
|
211
|
-
gothic: FontItem;
|
|
212
|
-
mincho: FontItem;
|
|
213
|
-
};
|
|
214
|
-
mac: {
|
|
215
|
-
defont: FontItem;
|
|
216
|
-
gothic: FontItem;
|
|
217
|
-
mincho: FontItem;
|
|
218
|
-
};
|
|
219
|
-
other: {
|
|
220
|
-
defont: FontItem;
|
|
221
|
-
gothic: FontItem;
|
|
222
|
-
mincho: FontItem;
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
export interface IComment {
|
|
230
|
-
comment: formattedCommentWithSize;
|
|
231
|
-
invisible: boolean;
|
|
232
|
-
loc: commentLoc;
|
|
233
|
-
width: number;
|
|
234
|
-
long: number;
|
|
235
|
-
height: number;
|
|
236
|
-
vpos: number;
|
|
237
|
-
flash: boolean;
|
|
238
|
-
posY: number;
|
|
239
|
-
owner: boolean;
|
|
240
|
-
layer: number;
|
|
241
|
-
mail: string[];
|
|
242
|
-
image?: HTMLCanvasElement | null;
|
|
243
|
-
getTextImage: (vpos: number) => void;
|
|
244
|
-
draw: (vpos: number, showCollision: boolean, isDebug: boolean) => void;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
export interface IPluginConstructor {
|
|
250
|
-
id: string;
|
|
251
|
-
new (Canvas: HTMLCanvasElement, comments: formattedComment[]): IPlugin;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
export interface IPlugin {
|
|
255
|
-
draw(vpos: number): void;
|
|
256
|
-
addComments(comments: formattedComment[]): void;
|
|
257
|
-
}
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
declare class FlashComment implements IComment {
|
|
5
|
+
private readonly context;
|
|
6
|
+
readonly comment: formattedCommentWithSize;
|
|
7
|
+
private readonly _globalScale;
|
|
8
|
+
private scale;
|
|
9
|
+
private scaleX;
|
|
10
|
+
posY: number;
|
|
11
|
+
image?: HTMLCanvasElement | null;
|
|
12
|
+
constructor(comment: formattedComment, context: CanvasRenderingContext2D);
|
|
13
|
+
get invisible(): boolean;
|
|
14
|
+
get loc(): commentLoc;
|
|
15
|
+
get long(): number;
|
|
16
|
+
get vpos(): number;
|
|
17
|
+
get width(): number;
|
|
18
|
+
get height(): number;
|
|
19
|
+
get flash(): boolean;
|
|
20
|
+
get layer(): number;
|
|
21
|
+
get owner(): boolean;
|
|
22
|
+
get mail(): string[];
|
|
23
|
+
get lineCount(): number;
|
|
24
|
+
parseCommandAndNicoscript(comment: formattedComment): formattedCommentWithFont;
|
|
25
|
+
measureText(comment: measureTextInput): measureTextResult;
|
|
26
|
+
getCommentSize(parsedData: formattedCommentWithFont): formattedCommentWithSize;
|
|
27
|
+
draw(vpos: number, showCollision: boolean, debug: boolean): void;
|
|
28
|
+
getTextImage(): HTMLCanvasElement | null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
declare class HTML5Comment implements IComment {
|
|
36
|
+
private readonly context;
|
|
37
|
+
readonly comment: formattedCommentWithSize;
|
|
38
|
+
posY: number;
|
|
39
|
+
image?: HTMLCanvasElement | null;
|
|
40
|
+
constructor(comment: formattedComment, context: CanvasRenderingContext2D);
|
|
41
|
+
get invisible(): boolean;
|
|
42
|
+
get loc(): commentLoc;
|
|
43
|
+
get long(): number;
|
|
44
|
+
get vpos(): number;
|
|
45
|
+
get width(): number;
|
|
46
|
+
get height(): number;
|
|
47
|
+
get flash(): boolean;
|
|
48
|
+
get layer(): number;
|
|
49
|
+
get owner(): boolean;
|
|
50
|
+
get mail(): string[];
|
|
51
|
+
get lineCount(): number;
|
|
52
|
+
parseCommandAndNicoscript(comment: formattedComment): formattedCommentWithFont;
|
|
53
|
+
measureText(comment: measureTextInput): measureTextResult;
|
|
54
|
+
getCommentSize(parsedData: formattedCommentWithFont): formattedCommentWithSize;
|
|
55
|
+
draw(vpos: number, showCollision: boolean, debug: boolean): void;
|
|
56
|
+
getTextImage(): HTMLCanvasElement | null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
declare let imageCache: {
|
|
61
|
+
[key: string]: {
|
|
62
|
+
image: HTMLCanvasElement;
|
|
63
|
+
timeout: number;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
declare const resetImageCache: () => void;
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
declare let nicoScripts: nicoScript;
|
|
71
|
+
declare const resetNicoScripts: () => void;
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
declare let plugins: IPlugin[];
|
|
76
|
+
declare const setPlugins: (input: IPlugin[]) => void;
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
declare const colors: {
|
|
80
|
+
white: string;
|
|
81
|
+
red: string;
|
|
82
|
+
pink: string;
|
|
83
|
+
orange: string;
|
|
84
|
+
yellow: string;
|
|
85
|
+
green: string;
|
|
86
|
+
cyan: string;
|
|
87
|
+
blue: string;
|
|
88
|
+
purple: string;
|
|
89
|
+
black: string;
|
|
90
|
+
white2: string;
|
|
91
|
+
niconicowhite: string;
|
|
92
|
+
red2: string;
|
|
93
|
+
truered: string;
|
|
94
|
+
pink2: string;
|
|
95
|
+
orange2: string;
|
|
96
|
+
passionorange: string;
|
|
97
|
+
yellow2: string;
|
|
98
|
+
madyellow: string;
|
|
99
|
+
green2: string;
|
|
100
|
+
elementalgreen: string;
|
|
101
|
+
cyan2: string;
|
|
102
|
+
blue2: string;
|
|
103
|
+
marinblue: string;
|
|
104
|
+
purple2: string;
|
|
105
|
+
nobleviolet: string;
|
|
106
|
+
black2: string;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
declare let defaultConfig: BaseConfig;
|
|
113
|
+
declare const initConfig: () => void;
|
|
114
|
+
declare const defaultOptions: BaseOptions;
|
|
115
|
+
declare let config: BaseConfig;
|
|
116
|
+
declare let options: BaseOptions;
|
|
117
|
+
declare const setConfig: (value: BaseConfig) => BaseConfig;
|
|
118
|
+
declare const setOptions: (value: BaseOptions) => BaseOptions;
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
declare const fontTemplates: {
|
|
122
|
+
arial: {
|
|
123
|
+
font: string;
|
|
124
|
+
offset: number;
|
|
125
|
+
weight: number;
|
|
126
|
+
};
|
|
127
|
+
gothic: {
|
|
128
|
+
font: string;
|
|
129
|
+
offset: number;
|
|
130
|
+
weight: number;
|
|
131
|
+
};
|
|
132
|
+
gulim: {
|
|
133
|
+
font: string;
|
|
134
|
+
offset: number;
|
|
135
|
+
weight: number;
|
|
136
|
+
};
|
|
137
|
+
mincho: {
|
|
138
|
+
font: string;
|
|
139
|
+
offset: number;
|
|
140
|
+
weight: number;
|
|
141
|
+
};
|
|
142
|
+
simsun: {
|
|
143
|
+
font: string;
|
|
144
|
+
offset: number;
|
|
145
|
+
weight: number;
|
|
146
|
+
};
|
|
147
|
+
macGothicPro6: {
|
|
148
|
+
font: string;
|
|
149
|
+
offset: number;
|
|
150
|
+
weight: number;
|
|
151
|
+
};
|
|
152
|
+
macGothicPro3: {
|
|
153
|
+
font: string;
|
|
154
|
+
offset: number;
|
|
155
|
+
weight: number;
|
|
156
|
+
};
|
|
157
|
+
macMincho: {
|
|
158
|
+
font: string;
|
|
159
|
+
offset: number;
|
|
160
|
+
weight: number;
|
|
161
|
+
};
|
|
162
|
+
macGothic1: {
|
|
163
|
+
font: string;
|
|
164
|
+
offset: number;
|
|
165
|
+
weight: number;
|
|
166
|
+
};
|
|
167
|
+
macGothic2: {
|
|
168
|
+
font: string;
|
|
169
|
+
offset: number;
|
|
170
|
+
weight: number;
|
|
171
|
+
};
|
|
172
|
+
sansSerif600: {
|
|
173
|
+
font: string;
|
|
174
|
+
offset: number;
|
|
175
|
+
weight: number;
|
|
176
|
+
};
|
|
177
|
+
sansSerif400: {
|
|
178
|
+
font: string;
|
|
179
|
+
offset: number;
|
|
180
|
+
weight: number;
|
|
181
|
+
};
|
|
182
|
+
serif: {
|
|
183
|
+
font: string;
|
|
184
|
+
offset: number;
|
|
185
|
+
weight: number;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
declare const fonts: {
|
|
189
|
+
win7: {
|
|
190
|
+
defont: FontItem;
|
|
191
|
+
gothic: FontItem;
|
|
192
|
+
mincho: FontItem;
|
|
193
|
+
};
|
|
194
|
+
win8_1: {
|
|
195
|
+
defont: FontItem;
|
|
196
|
+
gothic: FontItem;
|
|
197
|
+
mincho: FontItem;
|
|
198
|
+
};
|
|
199
|
+
win: {
|
|
200
|
+
defont: FontItem;
|
|
201
|
+
gothic: FontItem;
|
|
202
|
+
mincho: FontItem;
|
|
203
|
+
};
|
|
204
|
+
mac10_9: {
|
|
205
|
+
defont: FontItem;
|
|
206
|
+
gothic: FontItem;
|
|
207
|
+
mincho: FontItem;
|
|
208
|
+
};
|
|
209
|
+
mac10_11: {
|
|
210
|
+
defont: FontItem;
|
|
211
|
+
gothic: FontItem;
|
|
212
|
+
mincho: FontItem;
|
|
213
|
+
};
|
|
214
|
+
mac: {
|
|
215
|
+
defont: FontItem;
|
|
216
|
+
gothic: FontItem;
|
|
217
|
+
mincho: FontItem;
|
|
218
|
+
};
|
|
219
|
+
other: {
|
|
220
|
+
defont: FontItem;
|
|
221
|
+
gothic: FontItem;
|
|
222
|
+
mincho: FontItem;
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
|
|
258
226
|
|
|
259
227
|
|
|
260
228
|
|
|
@@ -322,6 +290,63 @@ type BaseConfig = {
|
|
|
322
290
|
|
|
323
291
|
export type Config = Partial<BaseConfig>;
|
|
324
292
|
|
|
293
|
+
export interface CommentEventBase {
|
|
294
|
+
type: CommentEventName;
|
|
295
|
+
timeStamp: number;
|
|
296
|
+
vpos: number;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export interface SeekDisableEvent extends CommentEventBase {
|
|
300
|
+
type: "seekDisable";
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export type SeekDisableEventHandler = (event: SeekDisableEvent) => unknown;
|
|
304
|
+
|
|
305
|
+
export interface SeekEnableEvent extends CommentEventBase {
|
|
306
|
+
type: "seekEnable";
|
|
307
|
+
}
|
|
308
|
+
export type SeekEnableEventHandler = (event: SeekEnableEvent) => unknown;
|
|
309
|
+
|
|
310
|
+
export interface CommentDisableEvent extends CommentEventBase {
|
|
311
|
+
type: "commentDisable";
|
|
312
|
+
}
|
|
313
|
+
export type CommentDisableEventHandler = (
|
|
314
|
+
event: CommentDisableEvent
|
|
315
|
+
) => unknown;
|
|
316
|
+
|
|
317
|
+
export interface CommentEnableEvent extends CommentEventBase {
|
|
318
|
+
type: "commentEnable";
|
|
319
|
+
}
|
|
320
|
+
export type CommentEnableEventHandler = (event: CommentEnableEvent) => unknown;
|
|
321
|
+
|
|
322
|
+
export interface JumpEvent extends CommentEventBase {
|
|
323
|
+
type: "jump";
|
|
324
|
+
to: string;
|
|
325
|
+
message?: string;
|
|
326
|
+
}
|
|
327
|
+
export type JumpEventHandler = (event: JumpEvent) => unknown;
|
|
328
|
+
|
|
329
|
+
export type CommentEventName =
|
|
330
|
+
| "seekDisable"
|
|
331
|
+
| "seekEnable"
|
|
332
|
+
| "commentDisable"
|
|
333
|
+
| "commentEnable"
|
|
334
|
+
| "jump";
|
|
335
|
+
export interface CommentEventHandlerMap {
|
|
336
|
+
seekDisable: SeekDisableEventHandler;
|
|
337
|
+
seekEnable: SeekEnableEventHandler;
|
|
338
|
+
commentDisable: CommentDisableEventHandler;
|
|
339
|
+
commentEnable: CommentEnableEventHandler;
|
|
340
|
+
jump: JumpEventHandler;
|
|
341
|
+
}
|
|
342
|
+
export interface CommentEventMap {
|
|
343
|
+
seekDisable: SeekDisableEvent;
|
|
344
|
+
seekEnable: SeekEnableEvent;
|
|
345
|
+
commentDisable: CommentDisableEvent;
|
|
346
|
+
commentEnable: CommentEnableEvent;
|
|
347
|
+
jump: JumpEvent;
|
|
348
|
+
}
|
|
349
|
+
|
|
325
350
|
type platform =
|
|
326
351
|
| "win7"
|
|
327
352
|
| "win8_1"
|
|
@@ -429,6 +454,38 @@ type v1Comment = {
|
|
|
429
454
|
|
|
430
455
|
|
|
431
456
|
|
|
457
|
+
export interface IComment {
|
|
458
|
+
comment: formattedCommentWithSize;
|
|
459
|
+
invisible: boolean;
|
|
460
|
+
loc: commentLoc;
|
|
461
|
+
width: number;
|
|
462
|
+
long: number;
|
|
463
|
+
height: number;
|
|
464
|
+
vpos: number;
|
|
465
|
+
flash: boolean;
|
|
466
|
+
posY: number;
|
|
467
|
+
owner: boolean;
|
|
468
|
+
layer: number;
|
|
469
|
+
mail: string[];
|
|
470
|
+
image?: HTMLCanvasElement | null;
|
|
471
|
+
getTextImage: (vpos: number) => void;
|
|
472
|
+
draw: (vpos: number, showCollision: boolean, isDebug: boolean) => void;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
export interface IPluginConstructor {
|
|
478
|
+
id: string;
|
|
479
|
+
new (Canvas: HTMLCanvasElement, comments: formattedComment[]): IPlugin;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
export interface IPlugin {
|
|
483
|
+
draw(vpos: number): void;
|
|
484
|
+
addComments(comments: formattedComment[]): void;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
|
|
432
489
|
|
|
433
490
|
|
|
434
491
|
|
|
@@ -470,342 +527,365 @@ type BaseOptions = {
|
|
|
470
527
|
};
|
|
471
528
|
export type Options = Partial<BaseOptions>;
|
|
472
529
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
type formattedCommentWithFont = {
|
|
476
|
-
id: number;
|
|
477
|
-
vpos: number;
|
|
478
|
-
date: number;
|
|
479
|
-
date_usec: number;
|
|
480
|
-
owner: boolean;
|
|
481
|
-
premium: boolean;
|
|
482
|
-
mail: string[];
|
|
483
|
-
user_id: number;
|
|
484
|
-
layer: number;
|
|
485
|
-
loc: commentLoc;
|
|
486
|
-
size: commentSize;
|
|
487
|
-
fontSize: number;
|
|
488
|
-
font: commentFont;
|
|
489
|
-
color: string;
|
|
490
|
-
strokeColor?: string;
|
|
491
|
-
wakuColor?: string;
|
|
492
|
-
full: boolean;
|
|
493
|
-
ender: boolean;
|
|
494
|
-
_live: boolean;
|
|
495
|
-
long: number;
|
|
496
|
-
invisible: boolean;
|
|
497
|
-
content: commentContentItem[];
|
|
498
|
-
flash: boolean;
|
|
499
|
-
lineCount: number;
|
|
500
|
-
lineOffset: number;
|
|
501
|
-
};
|
|
502
|
-
type formattedCommentWithSize = formattedCommentWithFont & {
|
|
503
|
-
height: number;
|
|
504
|
-
width: number;
|
|
505
|
-
lineHeight: number;
|
|
506
|
-
resized: boolean;
|
|
507
|
-
resizedX: boolean;
|
|
508
|
-
resizedY: boolean;
|
|
509
|
-
content: commentMeasuredContentItem[];
|
|
510
|
-
charSize: number;
|
|
511
|
-
};
|
|
512
|
-
type parsedComment = formattedCommentWithSize & {
|
|
513
|
-
posY: number;
|
|
514
|
-
image?: HTMLCanvasElement | boolean;
|
|
515
|
-
};
|
|
516
|
-
type commentContentItem = {
|
|
517
|
-
content: string;
|
|
518
|
-
font?: commentFlashFont;
|
|
519
|
-
width?: number[];
|
|
520
|
-
};
|
|
521
|
-
type commentMeasuredContentItem = commentContentItem & {
|
|
522
|
-
width: number[];
|
|
523
|
-
};
|
|
524
|
-
type commentContentIndex = {
|
|
525
|
-
index: number;
|
|
526
|
-
font: "gothic" | "gulim" | "simsunStrong" | "simsunWeak";
|
|
527
|
-
};
|
|
528
|
-
type commentFont = "defont" | "mincho" | "gothic" | "gulim" | "simsun";
|
|
529
|
-
type commentFlashFont = "defont" | "gulim" | "simsun";
|
|
530
|
-
type commentSize = "big" | "medium" | "small";
|
|
531
|
-
type commentLoc = "ue" | "naka" | "shita";
|
|
532
|
-
type collision = { [key in collisionPos]: collisionItem };
|
|
533
|
-
type collisionPos = "ue" | "shita" | "right" | "left";
|
|
534
|
-
type collisionItem = { [p: number]: IComment[] };
|
|
535
|
-
type nicoScript = {
|
|
536
|
-
reverse: nicoScriptReverse[];
|
|
537
|
-
ban: nicoScriptBan[];
|
|
538
|
-
default: nicoScriptDefault[];
|
|
539
|
-
replace: nicoScriptReplace[];
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
type
|
|
548
|
-
start: number;
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
type
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
};
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
};
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
};
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
};
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
type formattedCommentWithFont = {
|
|
533
|
+
id: number;
|
|
534
|
+
vpos: number;
|
|
535
|
+
date: number;
|
|
536
|
+
date_usec: number;
|
|
537
|
+
owner: boolean;
|
|
538
|
+
premium: boolean;
|
|
539
|
+
mail: string[];
|
|
540
|
+
user_id: number;
|
|
541
|
+
layer: number;
|
|
542
|
+
loc: commentLoc;
|
|
543
|
+
size: commentSize;
|
|
544
|
+
fontSize: number;
|
|
545
|
+
font: commentFont;
|
|
546
|
+
color: string;
|
|
547
|
+
strokeColor?: string;
|
|
548
|
+
wakuColor?: string;
|
|
549
|
+
full: boolean;
|
|
550
|
+
ender: boolean;
|
|
551
|
+
_live: boolean;
|
|
552
|
+
long: number;
|
|
553
|
+
invisible: boolean;
|
|
554
|
+
content: commentContentItem[];
|
|
555
|
+
flash: boolean;
|
|
556
|
+
lineCount: number;
|
|
557
|
+
lineOffset: number;
|
|
558
|
+
};
|
|
559
|
+
type formattedCommentWithSize = formattedCommentWithFont & {
|
|
560
|
+
height: number;
|
|
561
|
+
width: number;
|
|
562
|
+
lineHeight: number;
|
|
563
|
+
resized: boolean;
|
|
564
|
+
resizedX: boolean;
|
|
565
|
+
resizedY: boolean;
|
|
566
|
+
content: commentMeasuredContentItem[];
|
|
567
|
+
charSize: number;
|
|
568
|
+
};
|
|
569
|
+
type parsedComment = formattedCommentWithSize & {
|
|
570
|
+
posY: number;
|
|
571
|
+
image?: HTMLCanvasElement | boolean;
|
|
572
|
+
};
|
|
573
|
+
type commentContentItem = {
|
|
574
|
+
content: string;
|
|
575
|
+
font?: commentFlashFont;
|
|
576
|
+
width?: number[];
|
|
577
|
+
};
|
|
578
|
+
type commentMeasuredContentItem = commentContentItem & {
|
|
579
|
+
width: number[];
|
|
580
|
+
};
|
|
581
|
+
type commentContentIndex = {
|
|
582
|
+
index: number;
|
|
583
|
+
font: "gothic" | "gulim" | "simsunStrong" | "simsunWeak";
|
|
584
|
+
};
|
|
585
|
+
type commentFont = "defont" | "mincho" | "gothic" | "gulim" | "simsun";
|
|
586
|
+
type commentFlashFont = "defont" | "gulim" | "simsun";
|
|
587
|
+
type commentSize = "big" | "medium" | "small";
|
|
588
|
+
type commentLoc = "ue" | "naka" | "shita";
|
|
589
|
+
type collision = { [key in collisionPos]: collisionItem };
|
|
590
|
+
type collisionPos = "ue" | "shita" | "right" | "left";
|
|
591
|
+
type collisionItem = { [p: number]: IComment[] };
|
|
592
|
+
type nicoScript = {
|
|
593
|
+
reverse: nicoScriptReverse[];
|
|
594
|
+
ban: nicoScriptBan[];
|
|
595
|
+
default: nicoScriptDefault[];
|
|
596
|
+
replace: nicoScriptReplace[];
|
|
597
|
+
seekDisable: nicoScriptSeekDisable[];
|
|
598
|
+
jump: nicoScriptJump[];
|
|
599
|
+
};
|
|
600
|
+
type nicoScriptSeekDisable = {
|
|
601
|
+
start: number;
|
|
602
|
+
end: number;
|
|
603
|
+
};
|
|
604
|
+
type nicoScriptJump = {
|
|
605
|
+
start: number;
|
|
606
|
+
end?: number;
|
|
607
|
+
to: string;
|
|
608
|
+
message?: string;
|
|
609
|
+
};
|
|
610
|
+
type nicoScriptReverse = {
|
|
611
|
+
target: nicoScriptReverseTarget;
|
|
612
|
+
start: number;
|
|
613
|
+
end: number;
|
|
614
|
+
};
|
|
615
|
+
type nicoScriptReverseTarget = "コメ" | "投コメ" | "全";
|
|
616
|
+
type nicoScriptReplace = {
|
|
617
|
+
start: number;
|
|
618
|
+
long: number | undefined;
|
|
619
|
+
keyword: string;
|
|
620
|
+
replace: string;
|
|
621
|
+
range: nicoScriptReplaceRange;
|
|
622
|
+
target: nicoScriptReplaceTarget;
|
|
623
|
+
condition: nicoScriptReplaceCondition;
|
|
624
|
+
color: string | undefined;
|
|
625
|
+
size: commentSize | undefined;
|
|
626
|
+
font: commentFont | undefined;
|
|
627
|
+
loc: commentLoc | undefined;
|
|
628
|
+
no: number;
|
|
629
|
+
};
|
|
630
|
+
type nicoScriptReplaceRange = "単" | "全";
|
|
631
|
+
type nicoScriptReplaceTarget = "コメ" | "投コメ" | "全" | "含まない" | "含む";
|
|
632
|
+
type nicoScriptReplaceCondition = "完全一致" | "部分一致";
|
|
633
|
+
type nicoScriptBan = {
|
|
634
|
+
start: number;
|
|
635
|
+
end: number;
|
|
636
|
+
};
|
|
637
|
+
type nicoScriptDefault = {
|
|
638
|
+
start: number;
|
|
639
|
+
long: number | undefined;
|
|
640
|
+
color: string | undefined;
|
|
641
|
+
size: commentSize | undefined;
|
|
642
|
+
font: commentFont | undefined;
|
|
643
|
+
loc: commentLoc | undefined;
|
|
644
|
+
};
|
|
645
|
+
type measureTextResult = {
|
|
646
|
+
width: number;
|
|
647
|
+
height: number;
|
|
648
|
+
resized: boolean;
|
|
649
|
+
resizedX: boolean;
|
|
650
|
+
resizedY: boolean;
|
|
651
|
+
fontSize: number;
|
|
652
|
+
lineHeight: number;
|
|
653
|
+
content: commentMeasuredContentItem[];
|
|
654
|
+
charSize: number;
|
|
655
|
+
};
|
|
656
|
+
type parsedCommand = {
|
|
657
|
+
loc: commentLoc | undefined;
|
|
658
|
+
size: commentSize | undefined;
|
|
659
|
+
fontSize: number | undefined;
|
|
660
|
+
color: string | undefined;
|
|
661
|
+
strokeColor?: string;
|
|
662
|
+
wakuColor?: string;
|
|
663
|
+
font: commentFont | undefined;
|
|
664
|
+
full: boolean;
|
|
665
|
+
ender: boolean;
|
|
666
|
+
_live: boolean;
|
|
667
|
+
invisible: boolean;
|
|
668
|
+
long: number | undefined;
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
type measureTextInput = {
|
|
672
|
+
content: commentContentItem[];
|
|
673
|
+
resized?: boolean;
|
|
674
|
+
ender: boolean;
|
|
675
|
+
size: commentSize;
|
|
676
|
+
fontSize: number;
|
|
677
|
+
resizedY?: boolean;
|
|
678
|
+
resizedX?: boolean;
|
|
679
|
+
font: commentFont;
|
|
680
|
+
loc: commentLoc;
|
|
681
|
+
full: boolean;
|
|
682
|
+
flash: boolean;
|
|
683
|
+
lineCount: number;
|
|
684
|
+
lineHeight?: number;
|
|
685
|
+
charSize?: number;
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
type measureInput = {
|
|
689
|
+
font: commentFont;
|
|
690
|
+
content: commentContentItem[];
|
|
691
|
+
lineHeight: number;
|
|
692
|
+
charSize: number;
|
|
693
|
+
lineCount: number;
|
|
694
|
+
};
|
|
695
|
+
|
|
696
|
+
type valueOf<T> = T[keyof T];
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
declare const registerHandler: <K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]) => void;
|
|
700
|
+
declare const removeHandler: <K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]) => void;
|
|
701
|
+
declare const triggerHandler: (vpos: number, lastVpos: number) => void;
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
declare const convert2formattedComment: (data: unknown, type: inputFormatType) => formattedComment[];
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
declare class NiconiComments {
|
|
713
|
+
enableLegacyPiP: boolean;
|
|
714
|
+
showCollision: boolean;
|
|
715
|
+
showFPS: boolean;
|
|
716
|
+
showCommentCount: boolean;
|
|
717
|
+
video: HTMLVideoElement | undefined;
|
|
718
|
+
private lastVpos;
|
|
719
|
+
private readonly canvas;
|
|
720
|
+
private readonly collision;
|
|
721
|
+
private readonly context;
|
|
722
|
+
private readonly timeline;
|
|
723
|
+
static typeGuard: {
|
|
724
|
+
formatted: {
|
|
725
|
+
comment: (i: unknown) => i is formattedComment;
|
|
726
|
+
comments: (i: unknown) => i is formattedComment[];
|
|
727
|
+
legacyComment: (i: unknown) => i is formattedLegacyComment;
|
|
728
|
+
legacyComments: (i: unknown) => i is formattedLegacyComment[];
|
|
729
|
+
};
|
|
730
|
+
legacy: {
|
|
731
|
+
rawApiResponses: (i: unknown) => i is rawApiResponse[];
|
|
732
|
+
apiChat: (i: unknown) => i is apiChat;
|
|
733
|
+
apiGlobalNumRes: (i: unknown) => i is apiGlobalNumRes;
|
|
734
|
+
apiLeaf: (i: unknown) => i is apiLeaf;
|
|
735
|
+
apiPing: (i: unknown) => i is apiPing;
|
|
736
|
+
apiThread: (i: unknown) => i is apiThread;
|
|
737
|
+
};
|
|
738
|
+
xmlDocument: (i: unknown) => i is XMLDocument;
|
|
739
|
+
legacyOwner: {
|
|
740
|
+
comments: (i: unknown) => i is string;
|
|
741
|
+
};
|
|
742
|
+
owner: {
|
|
743
|
+
comment: (i: unknown) => i is ownerComment;
|
|
744
|
+
comments: (i: unknown) => i is ownerComment[];
|
|
745
|
+
};
|
|
746
|
+
v1: {
|
|
747
|
+
comment: (i: unknown) => i is v1Comment;
|
|
748
|
+
thread: (i: unknown) => i is v1Thread;
|
|
749
|
+
threads: (i: unknown) => i is v1Thread[];
|
|
750
|
+
};
|
|
751
|
+
nicoScript: {
|
|
752
|
+
range: {
|
|
753
|
+
target: (i: unknown) => i is nicoScriptReverseTarget;
|
|
754
|
+
};
|
|
755
|
+
replace: {
|
|
756
|
+
range: (i: unknown) => i is nicoScriptReplaceRange;
|
|
757
|
+
target: (i: unknown) => i is nicoScriptReplaceTarget;
|
|
758
|
+
condition: (i: unknown) => i is nicoScriptReplaceCondition;
|
|
759
|
+
};
|
|
760
|
+
};
|
|
761
|
+
comment: {
|
|
762
|
+
font: (i: unknown) => i is commentFont;
|
|
763
|
+
loc: (i: unknown) => i is commentLoc;
|
|
764
|
+
size: (i: unknown) => i is commentSize;
|
|
765
|
+
command: {
|
|
766
|
+
key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
|
|
767
|
+
};
|
|
768
|
+
color: (i: unknown) => i is "white" | "red" | "pink" | "orange" | "yellow" | "green" | "cyan" | "blue" | "purple" | "black" | "white2" | "niconicowhite" | "red2" | "truered" | "pink2" | "orange2" | "passionorange" | "yellow2" | "madyellow" | "green2" | "elementalgreen" | "cyan2" | "blue2" | "marinblue" | "purple2" | "nobleviolet" | "black2";
|
|
769
|
+
colorCode: (i: unknown) => i is string;
|
|
770
|
+
};
|
|
771
|
+
config: {
|
|
772
|
+
initOptions: (item: unknown) => item is Partial<BaseOptions>;
|
|
773
|
+
};
|
|
774
|
+
};
|
|
775
|
+
static default: typeof NiconiComments;
|
|
776
|
+
constructor(canvas: HTMLCanvasElement, data: inputFormat, initOptions?: Options);
|
|
777
|
+
private preRendering;
|
|
778
|
+
private getCommentPos;
|
|
779
|
+
private sortComment;
|
|
780
|
+
addComments(...rawComments: formattedComment[]): void;
|
|
781
|
+
drawCanvas(vpos: number, forceRendering?: boolean): boolean;
|
|
782
|
+
addEventListener<K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]): void;
|
|
783
|
+
removeEventListener<K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]): void;
|
|
784
|
+
clear(): void;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
declare const getLineHeight: (fontSize: commentSize, isFlash: boolean, resized?: boolean) => number;
|
|
790
|
+
declare const getCharSize: (fontSize: commentSize, isFlash: boolean) => number;
|
|
791
|
+
declare const measure: (comment: measureInput, context: CanvasRenderingContext2D) => {
|
|
792
|
+
height: number;
|
|
793
|
+
width: number;
|
|
794
|
+
lineWidth: number[];
|
|
795
|
+
itemWidth: number[][];
|
|
796
|
+
};
|
|
797
|
+
declare const getFontSizeAndScale: (charSize: number) => {
|
|
798
|
+
scale: number;
|
|
799
|
+
fontSize: number;
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
declare const typeGuard: {
|
|
809
|
+
formatted: {
|
|
810
|
+
comment: (i: unknown) => i is formattedComment;
|
|
811
|
+
comments: (i: unknown) => i is formattedComment[];
|
|
812
|
+
legacyComment: (i: unknown) => i is formattedLegacyComment;
|
|
813
|
+
legacyComments: (i: unknown) => i is formattedLegacyComment[];
|
|
814
|
+
};
|
|
815
|
+
legacy: {
|
|
816
|
+
rawApiResponses: (i: unknown) => i is rawApiResponse[];
|
|
817
|
+
apiChat: (i: unknown) => i is apiChat;
|
|
818
|
+
apiGlobalNumRes: (i: unknown) => i is apiGlobalNumRes;
|
|
819
|
+
apiLeaf: (i: unknown) => i is apiLeaf;
|
|
820
|
+
apiPing: (i: unknown) => i is apiPing;
|
|
821
|
+
apiThread: (i: unknown) => i is apiThread;
|
|
822
|
+
};
|
|
823
|
+
xmlDocument: (i: unknown) => i is XMLDocument;
|
|
824
|
+
legacyOwner: {
|
|
825
|
+
comments: (i: unknown) => i is string;
|
|
826
|
+
};
|
|
827
|
+
owner: {
|
|
828
|
+
comment: (i: unknown) => i is ownerComment;
|
|
829
|
+
comments: (i: unknown) => i is ownerComment[];
|
|
830
|
+
};
|
|
831
|
+
v1: {
|
|
832
|
+
comment: (i: unknown) => i is v1Comment;
|
|
833
|
+
thread: (i: unknown) => i is v1Thread;
|
|
834
|
+
threads: (i: unknown) => i is v1Thread[];
|
|
835
|
+
};
|
|
836
|
+
nicoScript: {
|
|
837
|
+
range: {
|
|
838
|
+
target: (i: unknown) => i is nicoScriptReverseTarget;
|
|
839
|
+
};
|
|
840
|
+
replace: {
|
|
841
|
+
range: (i: unknown) => i is nicoScriptReplaceRange;
|
|
842
|
+
target: (i: unknown) => i is nicoScriptReplaceTarget;
|
|
843
|
+
condition: (i: unknown) => i is nicoScriptReplaceCondition;
|
|
844
|
+
};
|
|
845
|
+
};
|
|
846
|
+
comment: {
|
|
847
|
+
font: (i: unknown) => i is commentFont;
|
|
848
|
+
loc: (i: unknown) => i is commentLoc;
|
|
849
|
+
size: (i: unknown) => i is commentSize;
|
|
850
|
+
command: {
|
|
851
|
+
key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
|
|
852
|
+
};
|
|
853
|
+
color: (i: unknown) => i is "white" | "red" | "pink" | "orange" | "yellow" | "green" | "cyan" | "blue" | "purple" | "black" | "white2" | "niconicowhite" | "red2" | "truered" | "pink2" | "orange2" | "passionorange" | "yellow2" | "madyellow" | "green2" | "elementalgreen" | "cyan2" | "blue2" | "marinblue" | "purple2" | "nobleviolet" | "black2";
|
|
854
|
+
colorCode: (i: unknown) => i is string;
|
|
855
|
+
};
|
|
856
|
+
config: {
|
|
857
|
+
initOptions: (item: unknown) => item is Partial<BaseOptions>;
|
|
858
|
+
};
|
|
859
|
+
};
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
declare const getPosY: (currentPos: number, targetComment: IComment, collision: IComment[] | undefined) => {
|
|
868
|
+
currentPos: number;
|
|
869
|
+
isChanged: boolean;
|
|
870
|
+
isBreak: boolean;
|
|
871
|
+
};
|
|
872
|
+
declare const getPosX: (width: number, vpos: number, long: number) => number;
|
|
873
|
+
declare const parseFont: (font: commentFont, size: string | number) => string;
|
|
874
|
+
declare const arrayPush: (array: {
|
|
875
|
+
[key: number]: IComment[];
|
|
876
|
+
}, key: string | number, push: IComment) => void;
|
|
877
|
+
declare const hex2rgb: (hex: string) => number[];
|
|
878
|
+
declare const hex2rgba: (hex: string) => number[];
|
|
879
|
+
declare const changeCALayer: (rawData: formattedComment[]) => formattedComment[];
|
|
880
|
+
declare const getConfig: <T>(input: configItem<T>, isFlash?: boolean) => T;
|
|
881
|
+
declare const isFlashComment: (comment: formattedComment) => boolean;
|
|
882
|
+
declare const parseCommandAndNicoScript: (comment: formattedComment) => formattedCommentWithFont;
|
|
883
|
+
declare const getStrokeColor: (comment: formattedCommentWithSize) => string;
|
|
884
|
+
declare const ArrayEqual: (a: unknown[], b: unknown[]) => boolean;
|
|
885
|
+
declare const getFlashFontIndex: (part: string) => commentContentIndex[];
|
|
886
|
+
declare const getFlashFontName: (font: string) => commentFlashFont;
|
|
887
|
+
declare const getValue: <T>(value: T | null | undefined, alternative: T) => T;
|
|
888
|
+
declare const nativeSort: <T>(getter: (input: T) => number) => (a: T, b: T) => 0 | 1 | -1;
|
|
889
|
+
|
|
810
890
|
|
|
811
891
|
export default NiconiComments;
|