@xpadev-net/niconicomments 0.2.49 → 0.2.50
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.en.md +13 -3
- package/README.md +14 -4
- package/dist/bundle.d.ts +773 -679
- package/dist/bundle.js +776 -978
- package/package.json +6 -3
package/dist/bundle.d.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import type { formattedComment, formattedCommentWithSize, IComment } from "@/@types/";
|
|
2
|
-
import { formattedCommentWithFont, measureTextInput, measureTextResult } from "@/@types/";
|
|
3
1
|
declare class BaseComment implements IComment {
|
|
4
2
|
protected readonly context: CanvasRenderingContext2D;
|
|
5
3
|
protected readonly cacheKey: string;
|
|
6
|
-
comment:
|
|
4
|
+
comment: FormattedCommentWithSize;
|
|
7
5
|
posY: number;
|
|
8
6
|
readonly pluginName: string;
|
|
9
7
|
image?: HTMLCanvasElement | null;
|
|
10
|
-
constructor(comment:
|
|
8
|
+
constructor(comment: FormattedComment, context: CanvasRenderingContext2D);
|
|
11
9
|
get invisible(): boolean;
|
|
12
|
-
get loc():
|
|
10
|
+
get loc(): CommentLoc;
|
|
13
11
|
get long(): number;
|
|
14
12
|
get vpos(): number;
|
|
15
13
|
get width(): number;
|
|
@@ -18,10 +16,10 @@ declare class BaseComment implements IComment {
|
|
|
18
16
|
get layer(): number;
|
|
19
17
|
get owner(): boolean;
|
|
20
18
|
get mail(): string[];
|
|
21
|
-
protected getCommentSize(parsedData:
|
|
22
|
-
protected parseCommandAndNicoscript(comment:
|
|
23
|
-
protected measureText(comment:
|
|
24
|
-
protected convertComment(comment:
|
|
19
|
+
protected getCommentSize(parsedData: FormattedCommentWithFont): FormattedCommentWithSize;
|
|
20
|
+
protected parseCommandAndNicoscript(comment: FormattedComment): FormattedCommentWithFont;
|
|
21
|
+
protected measureText(comment: MeasureTextInput): MeasureTextResult;
|
|
22
|
+
protected convertComment(comment: FormattedComment): FormattedCommentWithSize;
|
|
25
23
|
draw(vpos: number, showCollision: boolean, debug: boolean): void;
|
|
26
24
|
protected _draw(posX: number, posY: number): void;
|
|
27
25
|
protected _drawRectColor(posX: number, posY: number): void;
|
|
@@ -36,72 +34,71 @@ declare class BaseComment implements IComment {
|
|
|
36
34
|
};
|
|
37
35
|
}
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
import type { formattedComment, formattedCommentWithFont, formattedCommentWithSize, measureTextInput, measureTextResult } from "@/@types/";
|
|
41
|
-
import { BaseComment } from "./BaseComment";
|
|
42
37
|
declare class FlashComment extends BaseComment {
|
|
43
38
|
private _globalScale;
|
|
44
39
|
private scale;
|
|
45
40
|
private scaleX;
|
|
46
41
|
readonly pluginName: string;
|
|
47
|
-
constructor(comment:
|
|
48
|
-
convertComment(comment:
|
|
49
|
-
getCommentSize(parsedData:
|
|
50
|
-
parseCommandAndNicoscript(comment:
|
|
51
|
-
measureText(comment:
|
|
42
|
+
constructor(comment: FormattedComment, context: CanvasRenderingContext2D);
|
|
43
|
+
convertComment(comment: FormattedComment): FormattedCommentWithSize;
|
|
44
|
+
getCommentSize(parsedData: FormattedCommentWithFont): FormattedCommentWithSize;
|
|
45
|
+
parseCommandAndNicoscript(comment: FormattedComment): FormattedCommentWithFont;
|
|
46
|
+
measureText(comment: MeasureTextInput): MeasureTextResult;
|
|
52
47
|
_drawCollision(posX: number, posY: number, showCollision: boolean): void;
|
|
53
48
|
_generateTextImage(): HTMLCanvasElement;
|
|
54
49
|
}
|
|
55
50
|
|
|
56
|
-
|
|
57
|
-
import type { formattedComment, formattedCommentWithFont, formattedCommentWithSize, measureTextInput, measureTextResult } from "@/@types/";
|
|
58
|
-
import { BaseComment } from "./BaseComment";
|
|
59
51
|
declare class HTML5Comment extends BaseComment {
|
|
60
52
|
readonly pluginName: string;
|
|
61
|
-
constructor(comment:
|
|
62
|
-
convertComment(comment:
|
|
63
|
-
getCommentSize(parsedData:
|
|
64
|
-
parseCommandAndNicoscript(comment:
|
|
65
|
-
measureText(comment:
|
|
53
|
+
constructor(comment: FormattedComment, context: CanvasRenderingContext2D);
|
|
54
|
+
convertComment(comment: FormattedComment): FormattedCommentWithSize;
|
|
55
|
+
getCommentSize(parsedData: FormattedCommentWithFont): FormattedCommentWithSize;
|
|
56
|
+
parseCommandAndNicoscript(comment: FormattedComment): FormattedCommentWithFont;
|
|
57
|
+
measureText(comment: MeasureTextInput): MeasureTextResult;
|
|
66
58
|
private _measureComment;
|
|
67
59
|
private _processResizeX;
|
|
68
60
|
_drawCollision(posX: number, posY: number, showCollision: boolean): void;
|
|
69
61
|
_generateTextImage(): HTMLCanvasElement;
|
|
70
62
|
}
|
|
71
63
|
|
|
64
|
+
type index_d$3_BaseComment = BaseComment;
|
|
65
|
+
declare const index_d$3_BaseComment: typeof BaseComment;
|
|
66
|
+
type index_d$3_FlashComment = FlashComment;
|
|
67
|
+
declare const index_d$3_FlashComment: typeof FlashComment;
|
|
68
|
+
type index_d$3_HTML5Comment = HTML5Comment;
|
|
69
|
+
declare const index_d$3_HTML5Comment: typeof HTML5Comment;
|
|
70
|
+
declare namespace index_d$3 {
|
|
71
|
+
export {
|
|
72
|
+
index_d$3_BaseComment as BaseComment,
|
|
73
|
+
index_d$3_FlashComment as FlashComment,
|
|
74
|
+
index_d$3_HTML5Comment as HTML5Comment,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
72
77
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
import type {
|
|
78
|
-
commentSize,
|
|
79
|
-
formattedComment,
|
|
80
|
-
IPluginConstructor,
|
|
81
|
-
platformFont,
|
|
82
|
-
} from "@/@types/";
|
|
83
|
-
import { BaseComment } from "@/comments/";
|
|
78
|
+
type ConfigItem<T> = T | { html5: T; flash: T };
|
|
79
|
+
type ConfigSizeItem<T> = { big: T; medium: T; small: T };
|
|
80
|
+
type ConfigResizedItem<T> = { default: T; resized: T };
|
|
84
81
|
|
|
85
|
-
type
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
type CommentStageSize = {
|
|
83
|
+
width: number;
|
|
84
|
+
fullWidth: number;
|
|
85
|
+
height: number;
|
|
86
|
+
};
|
|
90
87
|
|
|
91
|
-
type
|
|
88
|
+
type FlashCharList = {
|
|
92
89
|
[key in "simsunStrong" | "simsunWeak" | "gulim" | "gothic"]: string;
|
|
93
90
|
};
|
|
94
|
-
type
|
|
95
|
-
type
|
|
91
|
+
type FlashMode = "xp" | "vista";
|
|
92
|
+
type FlashScriptChar = {
|
|
96
93
|
[key in "super" | "sub"]: string;
|
|
97
94
|
};
|
|
98
|
-
type
|
|
95
|
+
type FontList = {
|
|
99
96
|
[key in "gulim" | "simsun"]: string;
|
|
100
97
|
};
|
|
101
|
-
type
|
|
102
|
-
[key in "default" | "resized" | "doubleResized"]:
|
|
98
|
+
type LineCounts = {
|
|
99
|
+
[key in "default" | "resized" | "doubleResized"]: ConfigSizeItem<number>;
|
|
103
100
|
};
|
|
104
|
-
type
|
|
101
|
+
type TypeDoubleResizeMaxWidth = {
|
|
105
102
|
[key in "full" | "normal"]: number;
|
|
106
103
|
};
|
|
107
104
|
|
|
@@ -113,28 +110,28 @@ type BaseConfig = {
|
|
|
113
110
|
colors: { [key: string]: string };
|
|
114
111
|
commentDrawPadding: number;
|
|
115
112
|
commentDrawRange: number;
|
|
116
|
-
commentScale:
|
|
117
|
-
|
|
118
|
-
commentYMarginBottom:
|
|
119
|
-
commentYOffset:
|
|
120
|
-
commentYPaddingTop:
|
|
113
|
+
commentScale: ConfigItem<number>;
|
|
114
|
+
CommentStageSize: ConfigItem<CommentStageSize>;
|
|
115
|
+
commentYMarginBottom: ConfigSizeItem<number>;
|
|
116
|
+
commentYOffset: ConfigSizeItem<ConfigResizedItem<number>>;
|
|
117
|
+
commentYPaddingTop: ConfigResizedItem<number>;
|
|
121
118
|
contextFillLiveOpacity: number;
|
|
122
119
|
contextLineWidth: number;
|
|
123
120
|
contextStrokeColor: string;
|
|
124
121
|
contextStrokeInversionColor: string;
|
|
125
122
|
contextStrokeOpacity: number;
|
|
126
|
-
doubleResizeMaxWidth:
|
|
127
|
-
flashChar:
|
|
128
|
-
|
|
129
|
-
|
|
123
|
+
doubleResizeMaxWidth: ConfigItem<TypeDoubleResizeMaxWidth>;
|
|
124
|
+
flashChar: FlashCharList;
|
|
125
|
+
FlashMode: FlashMode;
|
|
126
|
+
FlashScriptChar: FlashScriptChar;
|
|
130
127
|
flashThreshold: number;
|
|
131
|
-
font:
|
|
132
|
-
fonts:
|
|
133
|
-
fontSize:
|
|
128
|
+
font: FontList;
|
|
129
|
+
fonts: PlatformFont;
|
|
130
|
+
fontSize: ConfigItem<ConfigSizeItem<ConfigResizedItem<number>>>;
|
|
134
131
|
fpsInterval: number;
|
|
135
132
|
hiResCommentCorrection: number;
|
|
136
|
-
lineCounts:
|
|
137
|
-
lineHeight:
|
|
133
|
+
lineCounts: ConfigItem<LineCounts>;
|
|
134
|
+
lineHeight: ConfigItem<ConfigSizeItem<ConfigResizedItem<number>>>;
|
|
138
135
|
minFontSize: number;
|
|
139
136
|
sameCAGap: number;
|
|
140
137
|
sameCAMinScore: number;
|
|
@@ -145,295 +142,80 @@ type BaseConfig = {
|
|
|
145
142
|
plugins: IPluginConstructor[];
|
|
146
143
|
commentPlugins: {
|
|
147
144
|
class: typeof BaseComment;
|
|
148
|
-
condition: (comment:
|
|
145
|
+
condition: (comment: FormattedComment) => boolean;
|
|
149
146
|
}[];
|
|
150
147
|
commentLimit: number | undefined;
|
|
151
148
|
hideCommentOrder: "asc" | "desc";
|
|
152
|
-
lineBreakCount: { [key in
|
|
149
|
+
lineBreakCount: { [key in CommentSize]: number };
|
|
153
150
|
nakaCommentSpeedOffset: number;
|
|
154
151
|
};
|
|
155
152
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
declare let imageCache: {
|
|
159
|
-
[key: string]: {
|
|
160
|
-
image: HTMLCanvasElement;
|
|
161
|
-
timeout: number;
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
declare const resetImageCache: () => void;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
export * from "./cache";
|
|
168
|
-
export * from "./nicoscript";
|
|
169
|
-
export * from "./plugins";
|
|
170
|
-
|
|
171
|
-
import type { nicoScript } from "@/@types/";
|
|
172
|
-
declare let nicoScripts: nicoScript;
|
|
173
|
-
declare const resetNicoScripts: () => void;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
import type { IPlugin } from "@/@types/";
|
|
177
|
-
declare let plugins: IPlugin[];
|
|
178
|
-
declare const setPlugins: (input: IPlugin[]) => void;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
declare const colors: {
|
|
182
|
-
white: string;
|
|
183
|
-
red: string;
|
|
184
|
-
pink: string;
|
|
185
|
-
orange: string;
|
|
186
|
-
yellow: string;
|
|
187
|
-
green: string;
|
|
188
|
-
cyan: string;
|
|
189
|
-
blue: string;
|
|
190
|
-
purple: string;
|
|
191
|
-
black: string;
|
|
192
|
-
white2: string;
|
|
193
|
-
niconicowhite: string;
|
|
194
|
-
red2: string;
|
|
195
|
-
truered: string;
|
|
196
|
-
pink2: string;
|
|
197
|
-
orange2: string;
|
|
198
|
-
passionorange: string;
|
|
199
|
-
yellow2: string;
|
|
200
|
-
madyellow: string;
|
|
201
|
-
green2: string;
|
|
202
|
-
elementalgreen: string;
|
|
203
|
-
cyan2: string;
|
|
204
|
-
blue2: string;
|
|
205
|
-
marinblue: string;
|
|
206
|
-
purple2: string;
|
|
207
|
-
nobleviolet: string;
|
|
208
|
-
black2: string;
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
import type { BaseConfig, BaseOptions } from "@/@types/";
|
|
213
|
-
declare let defaultConfig: BaseConfig;
|
|
214
|
-
declare const updateConfig: (config: BaseConfig) => void;
|
|
215
|
-
declare const defaultOptions: BaseOptions;
|
|
216
|
-
declare let config: BaseConfig;
|
|
217
|
-
declare let options: BaseOptions;
|
|
218
|
-
declare const setConfig: (value: BaseConfig) => BaseConfig;
|
|
219
|
-
declare const setOptions: (value: BaseOptions) => BaseOptions;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
import { FontItem } from "@/@types";
|
|
223
|
-
declare const fontTemplates: {
|
|
224
|
-
arial: {
|
|
225
|
-
font: string;
|
|
226
|
-
offset: number;
|
|
227
|
-
weight: number;
|
|
228
|
-
};
|
|
229
|
-
gothic: {
|
|
230
|
-
font: string;
|
|
231
|
-
offset: number;
|
|
232
|
-
weight: number;
|
|
233
|
-
};
|
|
234
|
-
gulim: {
|
|
235
|
-
font: string;
|
|
236
|
-
offset: number;
|
|
237
|
-
weight: number;
|
|
238
|
-
};
|
|
239
|
-
mincho: {
|
|
240
|
-
font: string;
|
|
241
|
-
offset: number;
|
|
242
|
-
weight: number;
|
|
243
|
-
};
|
|
244
|
-
simsun: {
|
|
245
|
-
font: string;
|
|
246
|
-
offset: number;
|
|
247
|
-
weight: number;
|
|
248
|
-
};
|
|
249
|
-
macGothicPro6: {
|
|
250
|
-
font: string;
|
|
251
|
-
offset: number;
|
|
252
|
-
weight: number;
|
|
253
|
-
};
|
|
254
|
-
macGothicPro3: {
|
|
255
|
-
font: string;
|
|
256
|
-
offset: number;
|
|
257
|
-
weight: number;
|
|
258
|
-
};
|
|
259
|
-
macMincho: {
|
|
260
|
-
font: string;
|
|
261
|
-
offset: number;
|
|
262
|
-
weight: number;
|
|
263
|
-
};
|
|
264
|
-
macGothic1: {
|
|
265
|
-
font: string;
|
|
266
|
-
offset: number;
|
|
267
|
-
weight: number;
|
|
268
|
-
};
|
|
269
|
-
macGothic2: {
|
|
270
|
-
font: string;
|
|
271
|
-
offset: number;
|
|
272
|
-
weight: number;
|
|
273
|
-
};
|
|
274
|
-
sansSerif600: {
|
|
275
|
-
font: string;
|
|
276
|
-
offset: number;
|
|
277
|
-
weight: number;
|
|
278
|
-
};
|
|
279
|
-
sansSerif400: {
|
|
280
|
-
font: string;
|
|
281
|
-
offset: number;
|
|
282
|
-
weight: number;
|
|
283
|
-
};
|
|
284
|
-
serif: {
|
|
285
|
-
font: string;
|
|
286
|
-
offset: number;
|
|
287
|
-
weight: number;
|
|
288
|
-
};
|
|
289
|
-
};
|
|
290
|
-
declare const fonts: {
|
|
291
|
-
win7: {
|
|
292
|
-
defont: FontItem;
|
|
293
|
-
gothic: FontItem;
|
|
294
|
-
mincho: FontItem;
|
|
295
|
-
};
|
|
296
|
-
win8_1: {
|
|
297
|
-
defont: FontItem;
|
|
298
|
-
gothic: FontItem;
|
|
299
|
-
mincho: FontItem;
|
|
300
|
-
};
|
|
301
|
-
win: {
|
|
302
|
-
defont: FontItem;
|
|
303
|
-
gothic: FontItem;
|
|
304
|
-
mincho: FontItem;
|
|
305
|
-
};
|
|
306
|
-
mac10_9: {
|
|
307
|
-
defont: FontItem;
|
|
308
|
-
gothic: FontItem;
|
|
309
|
-
mincho: FontItem;
|
|
310
|
-
};
|
|
311
|
-
mac10_11: {
|
|
312
|
-
defont: FontItem;
|
|
313
|
-
gothic: FontItem;
|
|
314
|
-
mincho: FontItem;
|
|
315
|
-
};
|
|
316
|
-
mac: {
|
|
317
|
-
defont: FontItem;
|
|
318
|
-
gothic: FontItem;
|
|
319
|
-
mincho: FontItem;
|
|
320
|
-
};
|
|
321
|
-
other: {
|
|
322
|
-
defont: FontItem;
|
|
323
|
-
gothic: FontItem;
|
|
324
|
-
mincho: FontItem;
|
|
325
|
-
};
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
declare const initConfig: () => void;
|
|
330
|
-
|
|
153
|
+
type Config = Partial<BaseConfig>;
|
|
331
154
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
155
|
+
interface CommentEventBase {
|
|
156
|
+
type: CommentEventName;
|
|
157
|
+
timeStamp: number;
|
|
158
|
+
vpos: number;
|
|
336
159
|
}
|
|
337
160
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
export * from "./InvalidFormatError";
|
|
341
|
-
export * from "./InvalidOptionError";
|
|
342
|
-
export * from "./NotImplementedError";
|
|
343
|
-
|
|
344
|
-
declare class InvalidFormatError extends Error {
|
|
345
|
-
constructor(options?: {
|
|
346
|
-
[key: string]: unknown;
|
|
347
|
-
});
|
|
161
|
+
interface SeekDisableEvent extends CommentEventBase {
|
|
162
|
+
type: "seekDisable";
|
|
348
163
|
}
|
|
349
164
|
|
|
165
|
+
type SeekDisableEventHandler = (event: SeekDisableEvent) => unknown;
|
|
350
166
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
[key: string]: unknown;
|
|
354
|
-
});
|
|
167
|
+
interface SeekEnableEvent extends CommentEventBase {
|
|
168
|
+
type: "seekEnable";
|
|
355
169
|
}
|
|
170
|
+
type SeekEnableEventHandler = (event: SeekEnableEvent) => unknown;
|
|
356
171
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
pluginName: string;
|
|
360
|
-
methodName: string;
|
|
361
|
-
constructor(pluginName: string, methodName: string, options?: {
|
|
362
|
-
[key: string]: unknown;
|
|
363
|
-
});
|
|
172
|
+
interface CommentDisableEvent extends CommentEventBase {
|
|
173
|
+
type: "commentDisable";
|
|
364
174
|
}
|
|
175
|
+
type CommentDisableEventHandler = (
|
|
176
|
+
event: CommentDisableEvent
|
|
177
|
+
) => unknown;
|
|
365
178
|
|
|
179
|
+
interface CommentEnableEvent extends CommentEventBase {
|
|
180
|
+
type: "commentEnable";
|
|
181
|
+
}
|
|
182
|
+
type CommentEnableEventHandler = (event: CommentEnableEvent) => unknown;
|
|
366
183
|
|
|
367
|
-
|
|
368
|
-
type:
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
}
|
|
401
|
-
export type JumpEventHandler = (event: JumpEvent) => unknown;
|
|
402
|
-
|
|
403
|
-
export type CommentEventName =
|
|
404
|
-
| "seekDisable"
|
|
405
|
-
| "seekEnable"
|
|
406
|
-
| "commentDisable"
|
|
407
|
-
| "commentEnable"
|
|
408
|
-
| "jump";
|
|
409
|
-
export type CommentEventHandler =
|
|
410
|
-
| SeekDisableEventHandler
|
|
411
|
-
| SeekEnableEventHandler
|
|
412
|
-
| CommentDisableEventHandler
|
|
413
|
-
| CommentEnableEventHandler
|
|
414
|
-
| JumpEventHandler;
|
|
415
|
-
export interface CommentEventHandlerMap {
|
|
416
|
-
seekDisable: SeekDisableEventHandler;
|
|
417
|
-
seekEnable: SeekEnableEventHandler;
|
|
418
|
-
commentDisable: CommentDisableEventHandler;
|
|
419
|
-
commentEnable: CommentEnableEventHandler;
|
|
420
|
-
jump: JumpEventHandler;
|
|
421
|
-
}
|
|
422
|
-
export interface CommentEventMap {
|
|
423
|
-
seekDisable: SeekDisableEvent;
|
|
424
|
-
seekEnable: SeekEnableEvent;
|
|
425
|
-
commentDisable: CommentDisableEvent;
|
|
426
|
-
commentEnable: CommentEnableEvent;
|
|
427
|
-
jump: JumpEvent;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
import type { CommentEventHandlerMap } from "@/@types/";
|
|
431
|
-
declare const registerHandler: <K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]) => void;
|
|
432
|
-
declare const removeHandler: <K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]) => void;
|
|
433
|
-
declare const triggerHandler: (vpos: number, lastVpos: number) => void;
|
|
434
|
-
|
|
184
|
+
interface JumpEvent extends CommentEventBase {
|
|
185
|
+
type: "jump";
|
|
186
|
+
to: string;
|
|
187
|
+
message?: string;
|
|
188
|
+
}
|
|
189
|
+
type JumpEventHandler = (event: JumpEvent) => unknown;
|
|
190
|
+
|
|
191
|
+
type CommentEventName =
|
|
192
|
+
| "seekDisable"
|
|
193
|
+
| "seekEnable"
|
|
194
|
+
| "commentDisable"
|
|
195
|
+
| "commentEnable"
|
|
196
|
+
| "jump";
|
|
197
|
+
type CommentEventHandler =
|
|
198
|
+
| SeekDisableEventHandler
|
|
199
|
+
| SeekEnableEventHandler
|
|
200
|
+
| CommentDisableEventHandler
|
|
201
|
+
| CommentEnableEventHandler
|
|
202
|
+
| JumpEventHandler;
|
|
203
|
+
interface CommentEventHandlerMap {
|
|
204
|
+
seekDisable: SeekDisableEventHandler;
|
|
205
|
+
seekEnable: SeekEnableEventHandler;
|
|
206
|
+
commentDisable: CommentDisableEventHandler;
|
|
207
|
+
commentEnable: CommentEnableEventHandler;
|
|
208
|
+
jump: JumpEventHandler;
|
|
209
|
+
}
|
|
210
|
+
interface CommentEventMap {
|
|
211
|
+
seekDisable: SeekDisableEvent;
|
|
212
|
+
seekEnable: SeekEnableEvent;
|
|
213
|
+
commentDisable: CommentDisableEvent;
|
|
214
|
+
commentEnable: CommentEnableEvent;
|
|
215
|
+
jump: JumpEvent;
|
|
216
|
+
}
|
|
435
217
|
|
|
436
|
-
|
|
218
|
+
type Platform =
|
|
437
219
|
| "win7"
|
|
438
220
|
| "win8_1"
|
|
439
221
|
| "win"
|
|
@@ -441,17 +223,17 @@ export type platform =
|
|
|
441
223
|
| "mac10_11"
|
|
442
224
|
| "mac"
|
|
443
225
|
| "other";
|
|
444
|
-
|
|
445
|
-
|
|
226
|
+
type HTML5Fonts = "gothic" | "mincho" | "defont";
|
|
227
|
+
type FontItem = {
|
|
446
228
|
font: string;
|
|
447
229
|
offset: number;
|
|
448
230
|
weight: number;
|
|
449
231
|
};
|
|
450
|
-
|
|
232
|
+
type PlatformFont = {
|
|
451
233
|
[key in HTML5Fonts]: FontItem;
|
|
452
|
-
};
|
|
234
|
+
};
|
|
453
235
|
|
|
454
|
-
|
|
236
|
+
type FormattedComment = {
|
|
455
237
|
id: number;
|
|
456
238
|
vpos: number;
|
|
457
239
|
content: string;
|
|
@@ -463,7 +245,7 @@ export type formattedComment = {
|
|
|
463
245
|
user_id: number;
|
|
464
246
|
layer: number;
|
|
465
247
|
};
|
|
466
|
-
|
|
248
|
+
type FormattedLegacyComment = {
|
|
467
249
|
id: number;
|
|
468
250
|
vpos: number;
|
|
469
251
|
content: string;
|
|
@@ -473,29 +255,38 @@ export type formattedLegacyComment = {
|
|
|
473
255
|
premium: boolean;
|
|
474
256
|
mail: string[];
|
|
475
257
|
};
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* @deprecated
|
|
261
|
+
*/
|
|
262
|
+
type formattedComment = FormattedComment;
|
|
263
|
+
/**
|
|
264
|
+
* @deprecated
|
|
265
|
+
*/
|
|
266
|
+
type formattedLegacyComment = FormattedLegacyComment;
|
|
267
|
+
|
|
268
|
+
type RawApiResponse = {
|
|
269
|
+
[key: string]: ApiPing | ApiThread | ApiLeaf | ApiGlobalNumRes | ApiChat;
|
|
479
270
|
};
|
|
480
|
-
type
|
|
271
|
+
type ApiPing = {
|
|
481
272
|
content: string;
|
|
482
273
|
};
|
|
483
|
-
type
|
|
274
|
+
type ApiThread = {
|
|
484
275
|
resultcode: number;
|
|
485
276
|
thread: string;
|
|
486
277
|
server_time: number;
|
|
487
278
|
ticket: string;
|
|
488
279
|
revision: number;
|
|
489
280
|
};
|
|
490
|
-
type
|
|
281
|
+
type ApiLeaf = {
|
|
491
282
|
thread: string;
|
|
492
283
|
count: number;
|
|
493
284
|
};
|
|
494
|
-
type
|
|
285
|
+
type ApiGlobalNumRes = {
|
|
495
286
|
thread: string;
|
|
496
287
|
num_res: number;
|
|
497
288
|
};
|
|
498
|
-
type
|
|
289
|
+
type ApiChat = {
|
|
499
290
|
thread: string;
|
|
500
291
|
no: number;
|
|
501
292
|
vpos: number;
|
|
@@ -509,20 +300,30 @@ type apiChat = {
|
|
|
509
300
|
content: string;
|
|
510
301
|
deleted: number;
|
|
511
302
|
};
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* @deprecated
|
|
306
|
+
*/
|
|
307
|
+
type rawApiResponse = RawApiResponse;
|
|
512
308
|
|
|
513
|
-
|
|
309
|
+
type OwnerComment = {
|
|
514
310
|
time: string;
|
|
515
311
|
command: string;
|
|
516
312
|
comment: string;
|
|
517
313
|
};
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* @deprecated
|
|
317
|
+
*/
|
|
318
|
+
type ownerComment = OwnerComment;
|
|
518
319
|
|
|
519
|
-
|
|
320
|
+
type V1Thread = {
|
|
520
321
|
id: string;
|
|
521
322
|
fork: string;
|
|
522
323
|
commentCount: number;
|
|
523
|
-
comments:
|
|
324
|
+
comments: V1Comment[];
|
|
524
325
|
};
|
|
525
|
-
type
|
|
326
|
+
type V1Comment = {
|
|
526
327
|
id: string;
|
|
527
328
|
no: number;
|
|
528
329
|
vposMs: number;
|
|
@@ -537,13 +338,16 @@ type v1Comment = {
|
|
|
537
338
|
source: string;
|
|
538
339
|
isMyPost: boolean;
|
|
539
340
|
};
|
|
540
|
-
|
|
541
|
-
import type { commentLoc, formattedCommentWithSize } from "@/@types/";
|
|
542
341
|
|
|
543
|
-
|
|
544
|
-
|
|
342
|
+
/**
|
|
343
|
+
* @deprecated
|
|
344
|
+
*/
|
|
345
|
+
type v1Thread = V1Thread;
|
|
346
|
+
|
|
347
|
+
interface IComment {
|
|
348
|
+
comment: FormattedCommentWithSize;
|
|
545
349
|
invisible: boolean;
|
|
546
|
-
loc:
|
|
350
|
+
loc: CommentLoc;
|
|
547
351
|
width: number;
|
|
548
352
|
long: number;
|
|
549
353
|
height: number;
|
|
@@ -555,156 +359,19 @@ export interface IComment {
|
|
|
555
359
|
mail: string[];
|
|
556
360
|
image?: HTMLCanvasElement | null;
|
|
557
361
|
draw: (vpos: number, showCollision: boolean, isDebug: boolean) => void;
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
export * from "./config";
|
|
561
|
-
export * from "./event";
|
|
562
|
-
export * from "./fonts";
|
|
563
|
-
export * from "./format.formatted";
|
|
564
|
-
export * from "./format.legacy";
|
|
565
|
-
export * from "./format.owner";
|
|
566
|
-
export * from "./format.v1";
|
|
567
|
-
export * from "./IComment";
|
|
568
|
-
export * from "./IPlugins";
|
|
569
|
-
export * from "./options";
|
|
570
|
-
export * from "./types";
|
|
571
|
-
|
|
572
|
-
import type { formattedComment, inputFormatType } from "@/@types/";
|
|
573
|
-
declare const convert2formattedComment: (data: unknown, type: inputFormatType) => formattedComment[];
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
import type * as types from "@/@types/";
|
|
577
|
-
import * as comments from "@/comments";
|
|
578
|
-
import * as contexts from "@/contexts";
|
|
579
|
-
import * as colors from "@/definition/colors";
|
|
580
|
-
import * as config from "@/definition/config";
|
|
581
|
-
import * as fonts from "@/definition/fonts";
|
|
582
|
-
import * as initConfig from "@/definition/initConfig";
|
|
583
|
-
import * as errors from "@/errors";
|
|
584
|
-
import * as eventHandler from "@/eventHandler";
|
|
585
|
-
import * as inputParser from "@/inputParser";
|
|
586
|
-
import * as typeGuard from "@/typeGuard";
|
|
587
|
-
import * as utils from "@/utils";
|
|
588
|
-
declare const definition: {
|
|
589
|
-
colors: typeof colors;
|
|
590
|
-
config: typeof config;
|
|
591
|
-
fonts: typeof fonts;
|
|
592
|
-
initConfig: typeof initConfig;
|
|
593
|
-
};
|
|
594
|
-
|
|
362
|
+
}
|
|
595
363
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
export interface IPluginConstructor {
|
|
364
|
+
interface IPluginConstructor {
|
|
599
365
|
id: string;
|
|
600
|
-
new (Canvas: HTMLCanvasElement, comments:
|
|
366
|
+
new (Canvas: HTMLCanvasElement, comments: FormattedComment[]): IPlugin;
|
|
601
367
|
}
|
|
602
368
|
|
|
603
|
-
|
|
369
|
+
interface IPlugin {
|
|
604
370
|
draw(vpos: number): void;
|
|
605
|
-
addComments(comments:
|
|
606
|
-
}
|
|
371
|
+
addComments(comments: FormattedComment[]): void;
|
|
372
|
+
}
|
|
607
373
|
|
|
608
|
-
|
|
609
|
-
import { FlashComment } from "@/comments/";
|
|
610
|
-
import * as internal from "./internal";
|
|
611
|
-
declare class NiconiComments {
|
|
612
|
-
enableLegacyPiP: boolean;
|
|
613
|
-
showCollision: boolean;
|
|
614
|
-
showFPS: boolean;
|
|
615
|
-
showCommentCount: boolean;
|
|
616
|
-
video: HTMLVideoElement | undefined;
|
|
617
|
-
private lastVpos;
|
|
618
|
-
private readonly canvas;
|
|
619
|
-
private readonly collision;
|
|
620
|
-
private readonly context;
|
|
621
|
-
private readonly timeline;
|
|
622
|
-
static typeGuard: {
|
|
623
|
-
formatted: {
|
|
624
|
-
comment: (i: unknown) => i is formattedComment;
|
|
625
|
-
comments: (i: unknown) => i is formattedComment[];
|
|
626
|
-
legacyComment: (i: unknown) => i is internal.types.formattedLegacyComment;
|
|
627
|
-
legacyComments: (i: unknown) => i is internal.types.formattedLegacyComment[];
|
|
628
|
-
};
|
|
629
|
-
legacy: {
|
|
630
|
-
rawApiResponses: (i: unknown) => i is internal.types.rawApiResponse[];
|
|
631
|
-
apiChat: (i: unknown) => i is internal.types.apiChat;
|
|
632
|
-
apiGlobalNumRes: (i: unknown) => i is internal.types.apiGlobalNumRes;
|
|
633
|
-
apiLeaf: (i: unknown) => i is internal.types.apiLeaf;
|
|
634
|
-
apiPing: (i: unknown) => i is internal.types.apiPing;
|
|
635
|
-
apiThread: (i: unknown) => i is internal.types.apiThread;
|
|
636
|
-
};
|
|
637
|
-
xmlDocument: (i: unknown) => i is XMLDocument;
|
|
638
|
-
legacyOwner: {
|
|
639
|
-
comments: (i: unknown) => i is string;
|
|
640
|
-
};
|
|
641
|
-
owner: {
|
|
642
|
-
comment: (i: unknown) => i is internal.types.ownerComment;
|
|
643
|
-
comments: (i: unknown) => i is internal.types.ownerComment[];
|
|
644
|
-
};
|
|
645
|
-
v1: {
|
|
646
|
-
comment: (i: unknown) => i is internal.types.v1Comment;
|
|
647
|
-
thread: (i: unknown) => i is internal.types.v1Thread;
|
|
648
|
-
threads: (i: unknown) => i is internal.types.v1Thread[];
|
|
649
|
-
};
|
|
650
|
-
nicoScript: {
|
|
651
|
-
range: {
|
|
652
|
-
target: (i: unknown) => i is internal.types.nicoScriptReverseTarget;
|
|
653
|
-
};
|
|
654
|
-
replace: {
|
|
655
|
-
range: (i: unknown) => i is internal.types.nicoScriptReplaceRange;
|
|
656
|
-
target: (i: unknown) => i is internal.types.nicoScriptReplaceTarget;
|
|
657
|
-
condition: (i: unknown) => i is internal.types.nicoScriptReplaceCondition;
|
|
658
|
-
};
|
|
659
|
-
};
|
|
660
|
-
comment: {
|
|
661
|
-
font: (i: unknown) => i is internal.types.commentFont;
|
|
662
|
-
loc: (i: unknown) => i is internal.types.commentLoc;
|
|
663
|
-
size: (i: unknown) => i is internal.types.commentSize;
|
|
664
|
-
command: {
|
|
665
|
-
key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
|
|
666
|
-
};
|
|
667
|
-
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";
|
|
668
|
-
colorCode: (i: unknown) => i is string;
|
|
669
|
-
colorCodeAllowAlpha: (i: unknown) => i is string;
|
|
670
|
-
};
|
|
671
|
-
config: {
|
|
672
|
-
initOptions: (item: unknown) => item is Partial<internal.types.BaseOptions>;
|
|
673
|
-
};
|
|
674
|
-
};
|
|
675
|
-
static default: typeof NiconiComments;
|
|
676
|
-
static FlashComment: {
|
|
677
|
-
condition: (comment: formattedComment) => boolean;
|
|
678
|
-
class: typeof FlashComment;
|
|
679
|
-
};
|
|
680
|
-
static internal: typeof internal;
|
|
681
|
-
constructor(canvas: HTMLCanvasElement, data: inputFormat, initOptions?: Options);
|
|
682
|
-
private preRendering;
|
|
683
|
-
private getCommentPos;
|
|
684
|
-
private sortComment;
|
|
685
|
-
addComments(...rawComments: formattedComment[]): void;
|
|
686
|
-
drawCanvas(vpos: number, forceRendering?: boolean): boolean;
|
|
687
|
-
private _drawVideo;
|
|
688
|
-
private _drawComments;
|
|
689
|
-
private _drawCollision;
|
|
690
|
-
private _drawFPS;
|
|
691
|
-
private _drawCommentCount;
|
|
692
|
-
addEventListener<K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]): void;
|
|
693
|
-
removeEventListener<K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]): void;
|
|
694
|
-
clear(): void;
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
import type {
|
|
699
|
-
Config,
|
|
700
|
-
formattedComment,
|
|
701
|
-
formattedLegacyComment,
|
|
702
|
-
ownerComment,
|
|
703
|
-
rawApiResponse,
|
|
704
|
-
v1Thread,
|
|
705
|
-
} from "@/@types/";
|
|
706
|
-
|
|
707
|
-
export type inputFormatType =
|
|
374
|
+
type InputFormatType =
|
|
708
375
|
| "XMLDocument"
|
|
709
376
|
| "niconicome"
|
|
710
377
|
| "formatted"
|
|
@@ -714,24 +381,24 @@ export type inputFormatType =
|
|
|
714
381
|
| "v1"
|
|
715
382
|
| "empty"
|
|
716
383
|
| "default";
|
|
717
|
-
|
|
384
|
+
type InputFormat =
|
|
718
385
|
| XMLDocument
|
|
719
|
-
|
|
|
720
|
-
|
|
|
721
|
-
|
|
|
722
|
-
|
|
|
723
|
-
|
|
|
386
|
+
| FormattedComment[]
|
|
387
|
+
| FormattedLegacyComment[]
|
|
388
|
+
| RawApiResponse[]
|
|
389
|
+
| OwnerComment[]
|
|
390
|
+
| V1Thread[]
|
|
724
391
|
| string
|
|
725
392
|
| undefined;
|
|
726
|
-
type
|
|
393
|
+
type ModeType = "default" | "html5" | "flash";
|
|
727
394
|
type BaseOptions = {
|
|
728
395
|
config: Config;
|
|
729
396
|
debug: boolean;
|
|
730
397
|
enableLegacyPiP: boolean;
|
|
731
|
-
format:
|
|
398
|
+
format: InputFormatType;
|
|
732
399
|
formatted: boolean;
|
|
733
400
|
keepCA: boolean;
|
|
734
|
-
mode:
|
|
401
|
+
mode: ModeType;
|
|
735
402
|
scale: number;
|
|
736
403
|
showCollision: boolean;
|
|
737
404
|
showCommentCount: boolean;
|
|
@@ -739,67 +406,18 @@ type BaseOptions = {
|
|
|
739
406
|
useLegacy: boolean;
|
|
740
407
|
video: HTMLVideoElement | undefined;
|
|
741
408
|
};
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
import type { apiChat, apiGlobalNumRes, apiLeaf, apiPing, apiThread, commentFont, commentLoc, commentSize, formattedComment, formattedLegacyComment, nicoScriptReplaceCondition, nicoScriptReplaceRange, nicoScriptReplaceTarget, nicoScriptReverseTarget, ownerComment, rawApiResponse, v1Comment, v1Thread } from "@/@types/";
|
|
745
|
-
declare const typeGuard: {
|
|
746
|
-
formatted: {
|
|
747
|
-
comment: (i: unknown) => i is formattedComment;
|
|
748
|
-
comments: (i: unknown) => i is formattedComment[];
|
|
749
|
-
legacyComment: (i: unknown) => i is formattedLegacyComment;
|
|
750
|
-
legacyComments: (i: unknown) => i is formattedLegacyComment[];
|
|
751
|
-
};
|
|
752
|
-
legacy: {
|
|
753
|
-
rawApiResponses: (i: unknown) => i is rawApiResponse[];
|
|
754
|
-
apiChat: (i: unknown) => i is apiChat;
|
|
755
|
-
apiGlobalNumRes: (i: unknown) => i is apiGlobalNumRes;
|
|
756
|
-
apiLeaf: (i: unknown) => i is apiLeaf;
|
|
757
|
-
apiPing: (i: unknown) => i is apiPing;
|
|
758
|
-
apiThread: (i: unknown) => i is apiThread;
|
|
759
|
-
};
|
|
760
|
-
xmlDocument: (i: unknown) => i is XMLDocument;
|
|
761
|
-
legacyOwner: {
|
|
762
|
-
comments: (i: unknown) => i is string;
|
|
763
|
-
};
|
|
764
|
-
owner: {
|
|
765
|
-
comment: (i: unknown) => i is ownerComment;
|
|
766
|
-
comments: (i: unknown) => i is ownerComment[];
|
|
767
|
-
};
|
|
768
|
-
v1: {
|
|
769
|
-
comment: (i: unknown) => i is v1Comment;
|
|
770
|
-
thread: (i: unknown) => i is v1Thread;
|
|
771
|
-
threads: (i: unknown) => i is v1Thread[];
|
|
772
|
-
};
|
|
773
|
-
nicoScript: {
|
|
774
|
-
range: {
|
|
775
|
-
target: (i: unknown) => i is nicoScriptReverseTarget;
|
|
776
|
-
};
|
|
777
|
-
replace: {
|
|
778
|
-
range: (i: unknown) => i is nicoScriptReplaceRange;
|
|
779
|
-
target: (i: unknown) => i is nicoScriptReplaceTarget;
|
|
780
|
-
condition: (i: unknown) => i is nicoScriptReplaceCondition;
|
|
781
|
-
};
|
|
782
|
-
};
|
|
783
|
-
comment: {
|
|
784
|
-
font: (i: unknown) => i is commentFont;
|
|
785
|
-
loc: (i: unknown) => i is commentLoc;
|
|
786
|
-
size: (i: unknown) => i is commentSize;
|
|
787
|
-
command: {
|
|
788
|
-
key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
|
|
789
|
-
};
|
|
790
|
-
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";
|
|
791
|
-
colorCode: (i: unknown) => i is string;
|
|
792
|
-
colorCodeAllowAlpha: (i: unknown) => i is string;
|
|
793
|
-
};
|
|
794
|
-
config: {
|
|
795
|
-
initOptions: (item: unknown) => item is Partial<BaseOptions>;
|
|
796
|
-
};
|
|
797
|
-
};
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
import type { IComment } from "@/@types/";
|
|
409
|
+
type Options = Partial<BaseOptions>;
|
|
801
410
|
|
|
802
|
-
|
|
411
|
+
/**
|
|
412
|
+
* @deprecated
|
|
413
|
+
*/
|
|
414
|
+
type inputFormatType = InputFormatType;
|
|
415
|
+
/**
|
|
416
|
+
* @deprecated
|
|
417
|
+
*/
|
|
418
|
+
type inputFormat = InputFormat;
|
|
419
|
+
|
|
420
|
+
type FormattedCommentWithFont = {
|
|
803
421
|
id: number;
|
|
804
422
|
vpos: number;
|
|
805
423
|
date: number;
|
|
@@ -809,10 +427,10 @@ type formattedCommentWithFont = {
|
|
|
809
427
|
mail: string[];
|
|
810
428
|
user_id: number;
|
|
811
429
|
layer: number;
|
|
812
|
-
loc:
|
|
813
|
-
size:
|
|
430
|
+
loc: CommentLoc;
|
|
431
|
+
size: CommentSize;
|
|
814
432
|
fontSize: number;
|
|
815
|
-
font:
|
|
433
|
+
font: CommentFont;
|
|
816
434
|
color: string;
|
|
817
435
|
strokeColor?: string;
|
|
818
436
|
wakuColor?: string;
|
|
@@ -821,100 +439,101 @@ type formattedCommentWithFont = {
|
|
|
821
439
|
_live: boolean;
|
|
822
440
|
long: number;
|
|
823
441
|
invisible: boolean;
|
|
824
|
-
content:
|
|
442
|
+
content: CommentContentItem[];
|
|
825
443
|
flash: boolean;
|
|
826
444
|
lineCount: number;
|
|
827
445
|
lineOffset: number;
|
|
828
446
|
};
|
|
829
|
-
type
|
|
447
|
+
type FormattedCommentWithSize = FormattedCommentWithFont & {
|
|
830
448
|
height: number;
|
|
831
449
|
width: number;
|
|
832
450
|
lineHeight: number;
|
|
833
451
|
resized: boolean;
|
|
834
452
|
resizedX: boolean;
|
|
835
453
|
resizedY: boolean;
|
|
836
|
-
content:
|
|
454
|
+
content: CommentMeasuredContentItem[];
|
|
837
455
|
charSize: number;
|
|
838
456
|
};
|
|
839
|
-
type
|
|
840
|
-
posY: number;
|
|
841
|
-
image?: HTMLCanvasElement | boolean;
|
|
842
|
-
};
|
|
843
|
-
type commentContentItem = {
|
|
457
|
+
type CommentContentItem = {
|
|
844
458
|
content: string;
|
|
845
459
|
slicedContent: string[];
|
|
846
|
-
font?:
|
|
460
|
+
font?: CommentFlashFont;
|
|
847
461
|
width?: number[];
|
|
848
462
|
};
|
|
849
|
-
type
|
|
463
|
+
type CommentMeasuredContentItem = CommentContentItem & {
|
|
850
464
|
width: number[];
|
|
851
465
|
};
|
|
852
|
-
type
|
|
466
|
+
type CommentContentIndex = {
|
|
853
467
|
index: number;
|
|
854
468
|
font: "gothic" | "gulim" | "simsunStrong" | "simsunWeak";
|
|
855
469
|
};
|
|
856
|
-
type
|
|
857
|
-
type
|
|
858
|
-
type
|
|
859
|
-
type
|
|
860
|
-
type
|
|
470
|
+
type CommentFont = "defont" | "mincho" | "gothic" | "gulim" | "simsun";
|
|
471
|
+
type CommentFlashFont = "defont" | "gulim" | "simsun";
|
|
472
|
+
type CommentSize = "big" | "medium" | "small";
|
|
473
|
+
type CommentLoc = "ue" | "naka" | "shita";
|
|
474
|
+
type Collision = { [key in CollisionPos]: CollisionItem };
|
|
861
475
|
type Timeline = { [key: number]: IComment[] };
|
|
862
|
-
type
|
|
863
|
-
type
|
|
864
|
-
type
|
|
865
|
-
reverse:
|
|
866
|
-
ban:
|
|
867
|
-
default:
|
|
868
|
-
replace:
|
|
869
|
-
seekDisable:
|
|
870
|
-
jump:
|
|
476
|
+
type CollisionPos = "ue" | "shita" | "right" | "left";
|
|
477
|
+
type CollisionItem = { [p: number]: IComment[] };
|
|
478
|
+
type NicoScript = {
|
|
479
|
+
reverse: NicoScriptReverse[];
|
|
480
|
+
ban: NicoScriptBan[];
|
|
481
|
+
default: NicoScriptDefault[];
|
|
482
|
+
replace: NicoScriptReplace[];
|
|
483
|
+
seekDisable: NicoScriptSeekDisable[];
|
|
484
|
+
jump: NicoScriptJump[];
|
|
871
485
|
};
|
|
872
|
-
type
|
|
486
|
+
type NicoScriptSeekDisable = {
|
|
873
487
|
start: number;
|
|
874
488
|
end: number;
|
|
875
489
|
};
|
|
876
|
-
type
|
|
490
|
+
type NicoScriptJump = {
|
|
877
491
|
start: number;
|
|
878
492
|
end?: number;
|
|
879
493
|
to: string;
|
|
880
494
|
message?: string;
|
|
881
495
|
};
|
|
882
|
-
type
|
|
883
|
-
target:
|
|
496
|
+
type NicoScriptReverse = {
|
|
497
|
+
target: NicoScriptReverseTarget;
|
|
884
498
|
start: number;
|
|
885
499
|
end: number;
|
|
886
500
|
};
|
|
887
|
-
type
|
|
888
|
-
type
|
|
501
|
+
type NicoScriptReverseTarget = "コメ" | "投コメ" | "全";
|
|
502
|
+
type NicoScriptReplace = {
|
|
889
503
|
start: number;
|
|
890
504
|
long: number | undefined;
|
|
891
505
|
keyword: string;
|
|
892
506
|
replace: string;
|
|
893
|
-
range:
|
|
894
|
-
target:
|
|
895
|
-
condition:
|
|
507
|
+
range: NicoScriptReplaceRange;
|
|
508
|
+
target: NicoScriptReplaceTarget;
|
|
509
|
+
condition: NicoScriptReplaceCondition;
|
|
896
510
|
color: string | undefined;
|
|
897
|
-
size:
|
|
898
|
-
font:
|
|
899
|
-
loc:
|
|
511
|
+
size: CommentSize | undefined;
|
|
512
|
+
font: CommentFont | undefined;
|
|
513
|
+
loc: CommentLoc | undefined;
|
|
900
514
|
no: number;
|
|
901
515
|
};
|
|
902
|
-
type
|
|
903
|
-
type
|
|
904
|
-
|
|
905
|
-
|
|
516
|
+
type NicoScriptReplaceRange = "単" | "全";
|
|
517
|
+
type NicoScriptReplaceTarget =
|
|
518
|
+
| "コメ"
|
|
519
|
+
| "投コメ"
|
|
520
|
+
| "全"
|
|
521
|
+
| "含まない"
|
|
522
|
+
| "含む";
|
|
523
|
+
type NicoScriptReplaceCondition = "完全一致" | "部分一致";
|
|
524
|
+
type NicoScriptBan = {
|
|
906
525
|
start: number;
|
|
907
526
|
end: number;
|
|
908
527
|
};
|
|
909
|
-
type
|
|
528
|
+
type NicoScriptDefault = {
|
|
910
529
|
start: number;
|
|
911
530
|
long: number | undefined;
|
|
912
531
|
color: string | undefined;
|
|
913
|
-
size:
|
|
914
|
-
font:
|
|
915
|
-
loc:
|
|
532
|
+
size: CommentSize | undefined;
|
|
533
|
+
font: CommentFont | undefined;
|
|
534
|
+
loc: CommentLoc | undefined;
|
|
916
535
|
};
|
|
917
|
-
type
|
|
536
|
+
type MeasureTextResult = {
|
|
918
537
|
width: number;
|
|
919
538
|
height: number;
|
|
920
539
|
resized: boolean;
|
|
@@ -922,17 +541,17 @@ type measureTextResult = {
|
|
|
922
541
|
resizedY: boolean;
|
|
923
542
|
fontSize: number;
|
|
924
543
|
lineHeight: number;
|
|
925
|
-
content:
|
|
544
|
+
content: CommentMeasuredContentItem[];
|
|
926
545
|
charSize: number;
|
|
927
546
|
};
|
|
928
|
-
type
|
|
929
|
-
loc:
|
|
930
|
-
size:
|
|
547
|
+
type ParsedCommand = {
|
|
548
|
+
loc: CommentLoc | undefined;
|
|
549
|
+
size: CommentSize | undefined;
|
|
931
550
|
fontSize: number | undefined;
|
|
932
551
|
color: string | undefined;
|
|
933
552
|
strokeColor?: string;
|
|
934
553
|
wakuColor?: string;
|
|
935
|
-
font:
|
|
554
|
+
font: CommentFont | undefined;
|
|
936
555
|
full: boolean;
|
|
937
556
|
ender: boolean;
|
|
938
557
|
_live: boolean;
|
|
@@ -940,16 +559,16 @@ type parsedCommand = {
|
|
|
940
559
|
long: number | undefined;
|
|
941
560
|
};
|
|
942
561
|
|
|
943
|
-
type
|
|
944
|
-
content:
|
|
562
|
+
type MeasureTextInput = {
|
|
563
|
+
content: CommentContentItem[];
|
|
945
564
|
resized?: boolean;
|
|
946
565
|
ender: boolean;
|
|
947
|
-
size:
|
|
566
|
+
size: CommentSize;
|
|
948
567
|
fontSize: number;
|
|
949
568
|
resizedY?: boolean;
|
|
950
569
|
resizedX?: boolean;
|
|
951
|
-
font:
|
|
952
|
-
loc:
|
|
570
|
+
font: CommentFont;
|
|
571
|
+
loc: CommentLoc;
|
|
953
572
|
full: boolean;
|
|
954
573
|
flash: boolean;
|
|
955
574
|
lineCount: number;
|
|
@@ -957,79 +576,400 @@ type measureTextInput = {
|
|
|
957
576
|
charSize?: number;
|
|
958
577
|
};
|
|
959
578
|
|
|
960
|
-
type
|
|
961
|
-
font:
|
|
962
|
-
content:
|
|
579
|
+
type MeasureInput = {
|
|
580
|
+
font: CommentFont;
|
|
581
|
+
content: CommentContentItem[];
|
|
963
582
|
lineHeight: number;
|
|
964
583
|
charSize: number;
|
|
965
584
|
lineCount: number;
|
|
966
585
|
};
|
|
967
586
|
|
|
968
|
-
type
|
|
587
|
+
type ValueOf<T> = T[keyof T];
|
|
588
|
+
|
|
589
|
+
declare let imageCache: {
|
|
590
|
+
[key: string]: {
|
|
591
|
+
image: HTMLCanvasElement;
|
|
592
|
+
timeout: number;
|
|
593
|
+
};
|
|
594
|
+
};
|
|
595
|
+
declare const resetImageCache: () => void;
|
|
596
|
+
|
|
597
|
+
declare let nicoScripts: NicoScript;
|
|
598
|
+
declare const resetNicoScripts: () => void;
|
|
599
|
+
|
|
600
|
+
declare let plugins: IPlugin[];
|
|
601
|
+
declare const setPlugins: (input: IPlugin[]) => void;
|
|
602
|
+
|
|
603
|
+
declare const index_d$2_imageCache: typeof imageCache;
|
|
604
|
+
declare const index_d$2_nicoScripts: typeof nicoScripts;
|
|
605
|
+
declare const index_d$2_plugins: typeof plugins;
|
|
606
|
+
declare const index_d$2_resetImageCache: typeof resetImageCache;
|
|
607
|
+
declare const index_d$2_resetNicoScripts: typeof resetNicoScripts;
|
|
608
|
+
declare const index_d$2_setPlugins: typeof setPlugins;
|
|
609
|
+
declare namespace index_d$2 {
|
|
610
|
+
export {
|
|
611
|
+
index_d$2_imageCache as imageCache,
|
|
612
|
+
index_d$2_nicoScripts as nicoScripts,
|
|
613
|
+
index_d$2_plugins as plugins,
|
|
614
|
+
index_d$2_resetImageCache as resetImageCache,
|
|
615
|
+
index_d$2_resetNicoScripts as resetNicoScripts,
|
|
616
|
+
index_d$2_setPlugins as setPlugins,
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
declare const colors: {
|
|
621
|
+
white: string;
|
|
622
|
+
red: string;
|
|
623
|
+
pink: string;
|
|
624
|
+
orange: string;
|
|
625
|
+
yellow: string;
|
|
626
|
+
green: string;
|
|
627
|
+
cyan: string;
|
|
628
|
+
blue: string;
|
|
629
|
+
purple: string;
|
|
630
|
+
black: string;
|
|
631
|
+
white2: string;
|
|
632
|
+
niconicowhite: string;
|
|
633
|
+
red2: string;
|
|
634
|
+
truered: string;
|
|
635
|
+
pink2: string;
|
|
636
|
+
orange2: string;
|
|
637
|
+
passionorange: string;
|
|
638
|
+
yellow2: string;
|
|
639
|
+
madyellow: string;
|
|
640
|
+
green2: string;
|
|
641
|
+
elementalgreen: string;
|
|
642
|
+
cyan2: string;
|
|
643
|
+
blue2: string;
|
|
644
|
+
marinblue: string;
|
|
645
|
+
purple2: string;
|
|
646
|
+
nobleviolet: string;
|
|
647
|
+
black2: string;
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
declare const colors$1_colors: typeof colors;
|
|
651
|
+
declare namespace colors$1 {
|
|
652
|
+
export {
|
|
653
|
+
colors$1_colors as colors,
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
declare let defaultConfig: BaseConfig;
|
|
658
|
+
declare const updateConfig: (config: BaseConfig) => void;
|
|
659
|
+
declare const defaultOptions: BaseOptions;
|
|
660
|
+
declare let config: BaseConfig;
|
|
661
|
+
declare let options: BaseOptions;
|
|
662
|
+
declare const setConfig: (value: BaseConfig) => BaseConfig;
|
|
663
|
+
declare const setOptions: (value: BaseOptions) => BaseOptions;
|
|
664
|
+
|
|
665
|
+
declare const config$1_config: typeof config;
|
|
666
|
+
declare const config$1_defaultConfig: typeof defaultConfig;
|
|
667
|
+
declare const config$1_defaultOptions: typeof defaultOptions;
|
|
668
|
+
declare const config$1_options: typeof options;
|
|
669
|
+
declare const config$1_setConfig: typeof setConfig;
|
|
670
|
+
declare const config$1_setOptions: typeof setOptions;
|
|
671
|
+
declare const config$1_updateConfig: typeof updateConfig;
|
|
672
|
+
declare namespace config$1 {
|
|
673
|
+
export {
|
|
674
|
+
config$1_config as config,
|
|
675
|
+
config$1_defaultConfig as defaultConfig,
|
|
676
|
+
config$1_defaultOptions as defaultOptions,
|
|
677
|
+
config$1_options as options,
|
|
678
|
+
config$1_setConfig as setConfig,
|
|
679
|
+
config$1_setOptions as setOptions,
|
|
680
|
+
config$1_updateConfig as updateConfig,
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
declare const fontTemplates: {
|
|
685
|
+
arial: {
|
|
686
|
+
font: string;
|
|
687
|
+
offset: number;
|
|
688
|
+
weight: number;
|
|
689
|
+
};
|
|
690
|
+
gothic: {
|
|
691
|
+
font: string;
|
|
692
|
+
offset: number;
|
|
693
|
+
weight: number;
|
|
694
|
+
};
|
|
695
|
+
gulim: {
|
|
696
|
+
font: string;
|
|
697
|
+
offset: number;
|
|
698
|
+
weight: number;
|
|
699
|
+
};
|
|
700
|
+
mincho: {
|
|
701
|
+
font: string;
|
|
702
|
+
offset: number;
|
|
703
|
+
weight: number;
|
|
704
|
+
};
|
|
705
|
+
simsun: {
|
|
706
|
+
font: string;
|
|
707
|
+
offset: number;
|
|
708
|
+
weight: number;
|
|
709
|
+
};
|
|
710
|
+
macGothicPro6: {
|
|
711
|
+
font: string;
|
|
712
|
+
offset: number;
|
|
713
|
+
weight: number;
|
|
714
|
+
};
|
|
715
|
+
macGothicPro3: {
|
|
716
|
+
font: string;
|
|
717
|
+
offset: number;
|
|
718
|
+
weight: number;
|
|
719
|
+
};
|
|
720
|
+
macMincho: {
|
|
721
|
+
font: string;
|
|
722
|
+
offset: number;
|
|
723
|
+
weight: number;
|
|
724
|
+
};
|
|
725
|
+
macGothic1: {
|
|
726
|
+
font: string;
|
|
727
|
+
offset: number;
|
|
728
|
+
weight: number;
|
|
729
|
+
};
|
|
730
|
+
macGothic2: {
|
|
731
|
+
font: string;
|
|
732
|
+
offset: number;
|
|
733
|
+
weight: number;
|
|
734
|
+
};
|
|
735
|
+
sansSerif600: {
|
|
736
|
+
font: string;
|
|
737
|
+
offset: number;
|
|
738
|
+
weight: number;
|
|
739
|
+
};
|
|
740
|
+
sansSerif400: {
|
|
741
|
+
font: string;
|
|
742
|
+
offset: number;
|
|
743
|
+
weight: number;
|
|
744
|
+
};
|
|
745
|
+
serif: {
|
|
746
|
+
font: string;
|
|
747
|
+
offset: number;
|
|
748
|
+
weight: number;
|
|
749
|
+
};
|
|
750
|
+
};
|
|
751
|
+
declare const fonts: {
|
|
752
|
+
win7: {
|
|
753
|
+
defont: FontItem;
|
|
754
|
+
gothic: FontItem;
|
|
755
|
+
mincho: FontItem;
|
|
756
|
+
};
|
|
757
|
+
win8_1: {
|
|
758
|
+
defont: FontItem;
|
|
759
|
+
gothic: FontItem;
|
|
760
|
+
mincho: FontItem;
|
|
761
|
+
};
|
|
762
|
+
win: {
|
|
763
|
+
defont: FontItem;
|
|
764
|
+
gothic: FontItem;
|
|
765
|
+
mincho: FontItem;
|
|
766
|
+
};
|
|
767
|
+
mac10_9: {
|
|
768
|
+
defont: FontItem;
|
|
769
|
+
gothic: FontItem;
|
|
770
|
+
mincho: FontItem;
|
|
771
|
+
};
|
|
772
|
+
mac10_11: {
|
|
773
|
+
defont: FontItem;
|
|
774
|
+
gothic: FontItem;
|
|
775
|
+
mincho: FontItem;
|
|
776
|
+
};
|
|
777
|
+
mac: {
|
|
778
|
+
defont: FontItem;
|
|
779
|
+
gothic: FontItem;
|
|
780
|
+
mincho: FontItem;
|
|
781
|
+
};
|
|
782
|
+
other: {
|
|
783
|
+
defont: FontItem;
|
|
784
|
+
gothic: FontItem;
|
|
785
|
+
mincho: FontItem;
|
|
786
|
+
};
|
|
787
|
+
};
|
|
788
|
+
|
|
789
|
+
declare const fonts$1_fontTemplates: typeof fontTemplates;
|
|
790
|
+
declare const fonts$1_fonts: typeof fonts;
|
|
791
|
+
declare namespace fonts$1 {
|
|
792
|
+
export {
|
|
793
|
+
fonts$1_fontTemplates as fontTemplates,
|
|
794
|
+
fonts$1_fonts as fonts,
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
declare const initConfig: () => void;
|
|
799
|
+
|
|
800
|
+
declare const initConfig$1_initConfig: typeof initConfig;
|
|
801
|
+
declare namespace initConfig$1 {
|
|
802
|
+
export {
|
|
803
|
+
initConfig$1_initConfig as initConfig,
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
declare class CanvasRenderingContext2DError extends Error {
|
|
808
|
+
constructor(options?: {
|
|
809
|
+
[key: string]: unknown;
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
declare class InvalidFormatError extends Error {
|
|
814
|
+
constructor(options?: {
|
|
815
|
+
[key: string]: unknown;
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
declare class InvalidOptionError extends Error {
|
|
820
|
+
constructor(options?: {
|
|
821
|
+
[key: string]: unknown;
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
declare class NotImplementedError extends Error {
|
|
826
|
+
pluginName: string;
|
|
827
|
+
methodName: string;
|
|
828
|
+
constructor(pluginName: string, methodName: string, options?: {
|
|
829
|
+
[key: string]: unknown;
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
type index_d$1_CanvasRenderingContext2DError = CanvasRenderingContext2DError;
|
|
834
|
+
declare const index_d$1_CanvasRenderingContext2DError: typeof CanvasRenderingContext2DError;
|
|
835
|
+
type index_d$1_InvalidFormatError = InvalidFormatError;
|
|
836
|
+
declare const index_d$1_InvalidFormatError: typeof InvalidFormatError;
|
|
837
|
+
type index_d$1_InvalidOptionError = InvalidOptionError;
|
|
838
|
+
declare const index_d$1_InvalidOptionError: typeof InvalidOptionError;
|
|
839
|
+
type index_d$1_NotImplementedError = NotImplementedError;
|
|
840
|
+
declare const index_d$1_NotImplementedError: typeof NotImplementedError;
|
|
841
|
+
declare namespace index_d$1 {
|
|
842
|
+
export {
|
|
843
|
+
index_d$1_CanvasRenderingContext2DError as CanvasRenderingContext2DError,
|
|
844
|
+
index_d$1_InvalidFormatError as InvalidFormatError,
|
|
845
|
+
index_d$1_InvalidOptionError as InvalidOptionError,
|
|
846
|
+
index_d$1_NotImplementedError as NotImplementedError,
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
declare const registerHandler: <K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]) => void;
|
|
851
|
+
declare const removeHandler: <K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]) => void;
|
|
852
|
+
declare const triggerHandler: (vpos: number, lastVpos: number) => void;
|
|
853
|
+
|
|
854
|
+
declare const eventHandler_d_registerHandler: typeof registerHandler;
|
|
855
|
+
declare const eventHandler_d_removeHandler: typeof removeHandler;
|
|
856
|
+
declare const eventHandler_d_triggerHandler: typeof triggerHandler;
|
|
857
|
+
declare namespace eventHandler_d {
|
|
858
|
+
export {
|
|
859
|
+
eventHandler_d_registerHandler as registerHandler,
|
|
860
|
+
eventHandler_d_removeHandler as removeHandler,
|
|
861
|
+
eventHandler_d_triggerHandler as triggerHandler,
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
declare const convert2formattedComment: (data: unknown, type: InputFormatType) => FormattedComment[];
|
|
866
|
+
|
|
867
|
+
declare namespace inputParser_d {
|
|
868
|
+
export {
|
|
869
|
+
convert2formattedComment as default,
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
declare const typeGuard: {
|
|
874
|
+
formatted: {
|
|
875
|
+
comment: (i: unknown) => i is FormattedComment;
|
|
876
|
+
comments: (i: unknown) => i is FormattedComment[];
|
|
877
|
+
legacyComment: (i: unknown) => i is FormattedLegacyComment;
|
|
878
|
+
legacyComments: (i: unknown) => i is FormattedLegacyComment[];
|
|
879
|
+
};
|
|
880
|
+
legacy: {
|
|
881
|
+
rawApiResponses: (i: unknown) => i is RawApiResponse[];
|
|
882
|
+
apiChat: (i: unknown) => i is ApiChat;
|
|
883
|
+
apiGlobalNumRes: (i: unknown) => i is ApiGlobalNumRes;
|
|
884
|
+
apiLeaf: (i: unknown) => i is ApiLeaf;
|
|
885
|
+
apiPing: (i: unknown) => i is ApiPing;
|
|
886
|
+
apiThread: (i: unknown) => i is ApiThread;
|
|
887
|
+
};
|
|
888
|
+
xmlDocument: (i: unknown) => i is XMLDocument;
|
|
889
|
+
legacyOwner: {
|
|
890
|
+
comments: (i: unknown) => i is string;
|
|
891
|
+
};
|
|
892
|
+
owner: {
|
|
893
|
+
comment: (i: unknown) => i is OwnerComment;
|
|
894
|
+
comments: (i: unknown) => i is OwnerComment[];
|
|
895
|
+
};
|
|
896
|
+
v1: {
|
|
897
|
+
comment: (i: unknown) => i is V1Comment;
|
|
898
|
+
thread: (i: unknown) => i is V1Thread;
|
|
899
|
+
threads: (i: unknown) => i is V1Thread[];
|
|
900
|
+
};
|
|
901
|
+
nicoScript: {
|
|
902
|
+
range: {
|
|
903
|
+
target: (i: unknown) => i is NicoScriptReverseTarget;
|
|
904
|
+
};
|
|
905
|
+
replace: {
|
|
906
|
+
range: (i: unknown) => i is NicoScriptReplaceRange;
|
|
907
|
+
target: (i: unknown) => i is NicoScriptReplaceTarget;
|
|
908
|
+
condition: (i: unknown) => i is NicoScriptReplaceCondition;
|
|
909
|
+
};
|
|
910
|
+
};
|
|
911
|
+
comment: {
|
|
912
|
+
font: (i: unknown) => i is CommentFont;
|
|
913
|
+
loc: (i: unknown) => i is CommentLoc;
|
|
914
|
+
size: (i: unknown) => i is CommentSize;
|
|
915
|
+
command: {
|
|
916
|
+
key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
|
|
917
|
+
};
|
|
918
|
+
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";
|
|
919
|
+
colorCode: (i: unknown) => i is string;
|
|
920
|
+
colorCodeAllowAlpha: (i: unknown) => i is string;
|
|
921
|
+
};
|
|
922
|
+
config: {
|
|
923
|
+
initOptions: (item: unknown) => item is Partial<BaseOptions>;
|
|
924
|
+
};
|
|
925
|
+
};
|
|
926
|
+
|
|
927
|
+
declare namespace typeGuard_d {
|
|
928
|
+
export {
|
|
929
|
+
typeGuard as default,
|
|
930
|
+
};
|
|
931
|
+
}
|
|
969
932
|
|
|
970
|
-
import type { IComment } from "@/@types";
|
|
971
933
|
declare const ArrayPush: (array: {
|
|
972
934
|
[key: number]: IComment[];
|
|
973
935
|
}, key: string | number, push: IComment) => void;
|
|
974
936
|
declare const ArrayEqual: (a: unknown[], b: unknown[]) => boolean;
|
|
975
937
|
|
|
976
|
-
|
|
977
|
-
import { formattedCommentWithSize } from "@/@types";
|
|
978
938
|
declare const hex2rgb: (hex: string) => number[];
|
|
979
939
|
declare const hex2rgba: (hex: string) => number[];
|
|
980
|
-
declare const getStrokeColor: (comment:
|
|
981
|
-
|
|
940
|
+
declare const getStrokeColor: (comment: FormattedCommentWithSize) => string;
|
|
982
941
|
|
|
983
|
-
|
|
984
|
-
import { collisionItem, IComment, Timeline } from "@/@types/";
|
|
985
|
-
declare const isLineBreakResize: (comment: measureTextInput) => boolean;
|
|
942
|
+
declare const isLineBreakResize: (comment: MeasureTextInput) => boolean;
|
|
986
943
|
declare const getDefaultCommand: (vpos: number) => {
|
|
987
944
|
color: string | undefined;
|
|
988
|
-
size:
|
|
989
|
-
font:
|
|
990
|
-
loc:
|
|
945
|
+
size: CommentSize | undefined;
|
|
946
|
+
font: CommentFont | undefined;
|
|
947
|
+
loc: CommentLoc | undefined;
|
|
991
948
|
};
|
|
992
|
-
declare const parseCommandAndNicoScript: (comment:
|
|
993
|
-
declare const isFlashComment: (comment:
|
|
949
|
+
declare const parseCommandAndNicoScript: (comment: FormattedComment) => FormattedCommentWithFont;
|
|
950
|
+
declare const isFlashComment: (comment: FormattedComment) => boolean;
|
|
994
951
|
declare const isReverseActive: (vpos: number, isOwner: boolean) => boolean;
|
|
995
952
|
declare const isBanActive: (vpos: number) => boolean;
|
|
996
|
-
declare const processFixedComment: (comment: IComment, collision:
|
|
997
|
-
declare const processMovableComment: (comment: IComment, collision:
|
|
953
|
+
declare const processFixedComment: (comment: IComment, collision: CollisionItem, timeline: Timeline) => void;
|
|
954
|
+
declare const processMovableComment: (comment: IComment, collision: Collision, timeline: Timeline) => void;
|
|
998
955
|
declare const getPosY: (currentPos: number, targetComment: IComment, collision: IComment[] | undefined) => {
|
|
999
956
|
currentPos: number;
|
|
1000
957
|
isChanged: boolean;
|
|
1001
958
|
isBreak: boolean;
|
|
1002
959
|
};
|
|
1003
|
-
declare const getPosX: (comment:
|
|
1004
|
-
declare const parseFont: (font:
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
import { formattedComment } from "@/@types";
|
|
1008
|
-
declare const changeCALayer: (rawData: formattedComment[]) => formattedComment[];
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
import { configItem } from "@/@types";
|
|
1012
|
-
declare const getConfig: <T>(input: configItem<T>, isFlash?: boolean) => T;
|
|
1013
|
-
|
|
960
|
+
declare const getPosX: (comment: FormattedCommentWithSize, vpos: number, isReverse?: boolean) => number;
|
|
961
|
+
declare const parseFont: (font: CommentFont, size: string | number) => string;
|
|
1014
962
|
|
|
1015
|
-
|
|
1016
|
-
declare const getFlashFontIndex: (part: string) => commentContentIndex[];
|
|
1017
|
-
declare const getFlashFontName: (font: string) => commentFlashFont;
|
|
963
|
+
declare const changeCALayer: (rawData: FormattedComment[]) => FormattedComment[];
|
|
1018
964
|
|
|
965
|
+
declare const getConfig: <T>(input: ConfigItem<T>, isFlash?: boolean) => T;
|
|
1019
966
|
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
export * from "./comment";
|
|
1023
|
-
export * from "./commentArt";
|
|
1024
|
-
export * from "./config";
|
|
1025
|
-
export * from "./flash";
|
|
1026
|
-
export * from "./niconico";
|
|
1027
|
-
export * from "./sort";
|
|
967
|
+
declare const getFlashFontIndex: (part: string) => CommentContentIndex[];
|
|
968
|
+
declare const getFlashFontName: (font: string) => CommentFlashFont;
|
|
1028
969
|
|
|
1029
|
-
|
|
1030
|
-
declare const
|
|
1031
|
-
declare const
|
|
1032
|
-
declare const measure: (comment: measureInput, context: CanvasRenderingContext2D) => {
|
|
970
|
+
declare const getLineHeight: (fontSize: CommentSize, isFlash: boolean, resized?: boolean) => number;
|
|
971
|
+
declare const getCharSize: (fontSize: CommentSize, isFlash: boolean) => number;
|
|
972
|
+
declare const measure: (comment: MeasureInput, context: CanvasRenderingContext2D) => {
|
|
1033
973
|
height: number;
|
|
1034
974
|
width: number;
|
|
1035
975
|
lineWidth: number[];
|
|
@@ -1040,14 +980,168 @@ declare const getFontSizeAndScale: (charSize: number) => {
|
|
|
1040
980
|
fontSize: number;
|
|
1041
981
|
};
|
|
1042
982
|
|
|
1043
|
-
|
|
1044
|
-
import { formattedComment } from "@/@types";
|
|
1045
|
-
declare const createCommentInstance: (comment: formattedComment, context: CanvasRenderingContext2D) => BaseComment;
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
983
|
declare const nativeSort: <T>(getter: (input: T) => number) => (a: T, b: T) => 1 | 0 | -1;
|
|
1049
984
|
|
|
985
|
+
declare const index_d_ArrayEqual: typeof ArrayEqual;
|
|
986
|
+
declare const index_d_ArrayPush: typeof ArrayPush;
|
|
987
|
+
declare const index_d_changeCALayer: typeof changeCALayer;
|
|
988
|
+
declare const index_d_getCharSize: typeof getCharSize;
|
|
989
|
+
declare const index_d_getConfig: typeof getConfig;
|
|
990
|
+
declare const index_d_getDefaultCommand: typeof getDefaultCommand;
|
|
991
|
+
declare const index_d_getFlashFontIndex: typeof getFlashFontIndex;
|
|
992
|
+
declare const index_d_getFlashFontName: typeof getFlashFontName;
|
|
993
|
+
declare const index_d_getFontSizeAndScale: typeof getFontSizeAndScale;
|
|
994
|
+
declare const index_d_getLineHeight: typeof getLineHeight;
|
|
995
|
+
declare const index_d_getPosX: typeof getPosX;
|
|
996
|
+
declare const index_d_getPosY: typeof getPosY;
|
|
997
|
+
declare const index_d_getStrokeColor: typeof getStrokeColor;
|
|
998
|
+
declare const index_d_hex2rgb: typeof hex2rgb;
|
|
999
|
+
declare const index_d_hex2rgba: typeof hex2rgba;
|
|
1000
|
+
declare const index_d_isBanActive: typeof isBanActive;
|
|
1001
|
+
declare const index_d_isFlashComment: typeof isFlashComment;
|
|
1002
|
+
declare const index_d_isLineBreakResize: typeof isLineBreakResize;
|
|
1003
|
+
declare const index_d_isReverseActive: typeof isReverseActive;
|
|
1004
|
+
declare const index_d_measure: typeof measure;
|
|
1005
|
+
declare const index_d_nativeSort: typeof nativeSort;
|
|
1006
|
+
declare const index_d_parseCommandAndNicoScript: typeof parseCommandAndNicoScript;
|
|
1007
|
+
declare const index_d_parseFont: typeof parseFont;
|
|
1008
|
+
declare const index_d_processFixedComment: typeof processFixedComment;
|
|
1009
|
+
declare const index_d_processMovableComment: typeof processMovableComment;
|
|
1010
|
+
declare namespace index_d {
|
|
1011
|
+
export {
|
|
1012
|
+
index_d_ArrayEqual as ArrayEqual,
|
|
1013
|
+
index_d_ArrayPush as ArrayPush,
|
|
1014
|
+
index_d_changeCALayer as changeCALayer,
|
|
1015
|
+
index_d_getCharSize as getCharSize,
|
|
1016
|
+
index_d_getConfig as getConfig,
|
|
1017
|
+
index_d_getDefaultCommand as getDefaultCommand,
|
|
1018
|
+
index_d_getFlashFontIndex as getFlashFontIndex,
|
|
1019
|
+
index_d_getFlashFontName as getFlashFontName,
|
|
1020
|
+
index_d_getFontSizeAndScale as getFontSizeAndScale,
|
|
1021
|
+
index_d_getLineHeight as getLineHeight,
|
|
1022
|
+
index_d_getPosX as getPosX,
|
|
1023
|
+
index_d_getPosY as getPosY,
|
|
1024
|
+
index_d_getStrokeColor as getStrokeColor,
|
|
1025
|
+
index_d_hex2rgb as hex2rgb,
|
|
1026
|
+
index_d_hex2rgba as hex2rgba,
|
|
1027
|
+
index_d_isBanActive as isBanActive,
|
|
1028
|
+
index_d_isFlashComment as isFlashComment,
|
|
1029
|
+
index_d_isLineBreakResize as isLineBreakResize,
|
|
1030
|
+
index_d_isReverseActive as isReverseActive,
|
|
1031
|
+
index_d_measure as measure,
|
|
1032
|
+
index_d_nativeSort as nativeSort,
|
|
1033
|
+
index_d_parseCommandAndNicoScript as parseCommandAndNicoScript,
|
|
1034
|
+
index_d_parseFont as parseFont,
|
|
1035
|
+
index_d_processFixedComment as processFixedComment,
|
|
1036
|
+
index_d_processMovableComment as processMovableComment,
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1050
1039
|
|
|
1040
|
+
declare const definition: {
|
|
1041
|
+
colors: typeof colors$1;
|
|
1042
|
+
config: typeof config$1;
|
|
1043
|
+
fonts: typeof fonts$1;
|
|
1044
|
+
initConfig: typeof initConfig$1;
|
|
1045
|
+
};
|
|
1051
1046
|
|
|
1047
|
+
declare const internal_definition: typeof definition;
|
|
1048
|
+
declare namespace internal {
|
|
1049
|
+
export {
|
|
1050
|
+
index_d$3 as comments,
|
|
1051
|
+
index_d$2 as contexts,
|
|
1052
|
+
internal_definition as definition,
|
|
1053
|
+
index_d$1 as errors,
|
|
1054
|
+
eventHandler_d as eventHandler,
|
|
1055
|
+
inputParser_d as inputParser,
|
|
1056
|
+
typeGuard_d as typeGuard,
|
|
1057
|
+
index_d as utils,
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
declare class NiconiComments {
|
|
1062
|
+
enableLegacyPiP: boolean;
|
|
1063
|
+
showCollision: boolean;
|
|
1064
|
+
showFPS: boolean;
|
|
1065
|
+
showCommentCount: boolean;
|
|
1066
|
+
video: HTMLVideoElement | undefined;
|
|
1067
|
+
private lastVpos;
|
|
1068
|
+
private readonly canvas;
|
|
1069
|
+
private readonly collision;
|
|
1070
|
+
private readonly context;
|
|
1071
|
+
private readonly timeline;
|
|
1072
|
+
static typeGuard: {
|
|
1073
|
+
formatted: {
|
|
1074
|
+
comment: (i: unknown) => i is FormattedComment;
|
|
1075
|
+
comments: (i: unknown) => i is FormattedComment[];
|
|
1076
|
+
legacyComment: (i: unknown) => i is FormattedLegacyComment;
|
|
1077
|
+
legacyComments: (i: unknown) => i is FormattedLegacyComment[];
|
|
1078
|
+
};
|
|
1079
|
+
legacy: {
|
|
1080
|
+
rawApiResponses: (i: unknown) => i is RawApiResponse[];
|
|
1081
|
+
apiChat: (i: unknown) => i is ApiChat;
|
|
1082
|
+
apiGlobalNumRes: (i: unknown) => i is ApiGlobalNumRes;
|
|
1083
|
+
apiLeaf: (i: unknown) => i is ApiLeaf;
|
|
1084
|
+
apiPing: (i: unknown) => i is ApiPing;
|
|
1085
|
+
apiThread: (i: unknown) => i is ApiThread;
|
|
1086
|
+
};
|
|
1087
|
+
xmlDocument: (i: unknown) => i is XMLDocument;
|
|
1088
|
+
legacyOwner: {
|
|
1089
|
+
comments: (i: unknown) => i is string;
|
|
1090
|
+
};
|
|
1091
|
+
owner: {
|
|
1092
|
+
comment: (i: unknown) => i is OwnerComment;
|
|
1093
|
+
comments: (i: unknown) => i is OwnerComment[];
|
|
1094
|
+
};
|
|
1095
|
+
v1: {
|
|
1096
|
+
comment: (i: unknown) => i is V1Comment;
|
|
1097
|
+
thread: (i: unknown) => i is V1Thread;
|
|
1098
|
+
threads: (i: unknown) => i is V1Thread[];
|
|
1099
|
+
};
|
|
1100
|
+
nicoScript: {
|
|
1101
|
+
range: {
|
|
1102
|
+
target: (i: unknown) => i is NicoScriptReverseTarget;
|
|
1103
|
+
};
|
|
1104
|
+
replace: {
|
|
1105
|
+
range: (i: unknown) => i is NicoScriptReplaceRange;
|
|
1106
|
+
target: (i: unknown) => i is NicoScriptReplaceTarget;
|
|
1107
|
+
condition: (i: unknown) => i is NicoScriptReplaceCondition;
|
|
1108
|
+
};
|
|
1109
|
+
};
|
|
1110
|
+
comment: {
|
|
1111
|
+
font: (i: unknown) => i is CommentFont;
|
|
1112
|
+
loc: (i: unknown) => i is CommentLoc;
|
|
1113
|
+
size: (i: unknown) => i is CommentSize;
|
|
1114
|
+
command: {
|
|
1115
|
+
key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
|
|
1116
|
+
};
|
|
1117
|
+
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";
|
|
1118
|
+
colorCode: (i: unknown) => i is string;
|
|
1119
|
+
colorCodeAllowAlpha: (i: unknown) => i is string;
|
|
1120
|
+
};
|
|
1121
|
+
config: {
|
|
1122
|
+
initOptions: (item: unknown) => item is Partial<BaseOptions>;
|
|
1123
|
+
};
|
|
1124
|
+
};
|
|
1125
|
+
static default: typeof NiconiComments;
|
|
1126
|
+
static FlashComment: {
|
|
1127
|
+
condition: (comment: FormattedComment) => boolean;
|
|
1128
|
+
class: typeof FlashComment;
|
|
1129
|
+
};
|
|
1130
|
+
static internal: typeof internal;
|
|
1131
|
+
constructor(canvas: HTMLCanvasElement, data: InputFormat, initOptions?: Options);
|
|
1132
|
+
private preRendering;
|
|
1133
|
+
private getCommentPos;
|
|
1134
|
+
private sortComment;
|
|
1135
|
+
addComments(...rawComments: FormattedComment[]): void;
|
|
1136
|
+
drawCanvas(vpos: number, forceRendering?: boolean): boolean;
|
|
1137
|
+
private _drawVideo;
|
|
1138
|
+
private _drawComments;
|
|
1139
|
+
private _drawCollision;
|
|
1140
|
+
private _drawFPS;
|
|
1141
|
+
private _drawCommentCount;
|
|
1142
|
+
addEventListener<K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]): void;
|
|
1143
|
+
removeEventListener<K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]): void;
|
|
1144
|
+
clear(): void;
|
|
1145
|
+
}
|
|
1052
1146
|
|
|
1053
|
-
export default
|
|
1147
|
+
export { ApiChat, ApiGlobalNumRes, ApiLeaf, ApiPing, ApiThread, BaseConfig, BaseOptions, Collision, CollisionItem, CollisionPos, CommentContentIndex, CommentContentItem, CommentDisableEvent, CommentDisableEventHandler, CommentEnableEvent, CommentEnableEventHandler, CommentEventBase, CommentEventHandler, CommentEventHandlerMap, CommentEventMap, CommentEventName, CommentFlashFont, CommentFont, CommentLoc, CommentMeasuredContentItem, CommentSize, CommentStageSize, Config, ConfigItem, FlashMode, FlashScriptChar, FontItem, FormattedComment, FormattedCommentWithFont, FormattedCommentWithSize, FormattedLegacyComment, HTML5Fonts, IComment, IPlugin, IPluginConstructor, InputFormat, InputFormatType, JumpEvent, JumpEventHandler, MeasureInput, MeasureTextInput, MeasureTextResult, NicoScript, NicoScriptReplace, NicoScriptReplaceCondition, NicoScriptReplaceRange, NicoScriptReplaceTarget, NicoScriptReverseTarget, Options, OwnerComment, ParsedCommand, Platform, PlatformFont, RawApiResponse, SeekDisableEvent, SeekDisableEventHandler, SeekEnableEvent, SeekEnableEventHandler, Timeline, V1Comment, V1Thread, ValueOf, NiconiComments as default, formattedComment, formattedLegacyComment, inputFormat, inputFormatType, ownerComment, rawApiResponse, v1Thread };
|