@xpadev-net/niconicomments 0.2.49 → 0.2.51
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/README.en.md +53 -43
- package/README.md +53 -43
- package/dist/bundle.d.ts +1101 -754
- package/dist/bundle.js +1070 -1133
- package/package.json +24 -20
package/dist/bundle.d.ts
CHANGED
|
@@ -1,15 +1,213 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* MIT License
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2020 lynweklm@gmail.com
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*
|
|
25
|
+
* original source: @napi-rs/canvas
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
declare class NodeCanvas {
|
|
29
|
+
constructor(width: number, height: number, flag?: SvgExportFlag);
|
|
30
|
+
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
getContext(
|
|
34
|
+
contextType: "2d",
|
|
35
|
+
contextAttributes?: ContextAttributes
|
|
36
|
+
): NodeContext;
|
|
37
|
+
encodeSync(format: "webp" | "jpeg", quality?: number): Buffer;
|
|
38
|
+
encodeSync(format: "png"): Buffer;
|
|
39
|
+
encodeSync(format: "avif", cfg?: AvifConfig): Buffer;
|
|
40
|
+
encode(format: "webp" | "jpeg", quality?: number): Promise<Buffer>;
|
|
41
|
+
encode(format: "png"): Promise<Buffer>;
|
|
42
|
+
encode(format: "avif", cfg?: AvifConfig): Promise<Buffer>;
|
|
43
|
+
|
|
44
|
+
toBuffer(mime: "image/png"): Buffer;
|
|
45
|
+
toBuffer(mime: "image/jpeg" | "image/webp", quality?: number): Buffer;
|
|
46
|
+
toBuffer(mime: "image/avif", cfg?: AvifConfig): Buffer;
|
|
47
|
+
// raw pixels
|
|
48
|
+
data(): Buffer;
|
|
49
|
+
toDataURL(mime?: "image/png"): string;
|
|
50
|
+
toDataURL(mime: "image/jpeg" | "image/webp", quality?: number): string;
|
|
51
|
+
toDataURL(
|
|
52
|
+
mime?: "image/jpeg" | "image/webp" | "image/png",
|
|
53
|
+
quality?: number
|
|
54
|
+
): string;
|
|
55
|
+
toDataURL(mime?: "image/avif", cfg?: AvifConfig): string;
|
|
56
|
+
|
|
57
|
+
toDataURLAsync(mime?: "image/png"): Promise<string>;
|
|
58
|
+
toDataURLAsync(
|
|
59
|
+
mime: "image/jpeg" | "image/webp",
|
|
60
|
+
quality?: number
|
|
61
|
+
): Promise<string>;
|
|
62
|
+
toDataURLAsync(
|
|
63
|
+
mime?: "image/jpeg" | "image/webp" | "image/png",
|
|
64
|
+
quality?: number
|
|
65
|
+
): Promise<string>;
|
|
66
|
+
toDataURLAsync(mime?: "image/avif", cfg?: AvifConfig): Promise<string>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
declare enum SvgExportFlag {
|
|
70
|
+
ConvertTextToPaths = 0x01,
|
|
71
|
+
NoPrettyXML = 0x02,
|
|
72
|
+
RelativePathEncoding = 0x04,
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
interface AvifConfig {
|
|
76
|
+
/** 0-100 scale, 100 is lossless */
|
|
77
|
+
quality?: number;
|
|
78
|
+
/** 0-100 scale */
|
|
79
|
+
alphaQuality?: number;
|
|
80
|
+
/** rav1e preset 1 (slow) 10 (fast but crappy), default is 4 */
|
|
81
|
+
speed?: number;
|
|
82
|
+
/** How many threads should be used (0 = match core count) */
|
|
83
|
+
threads?: number;
|
|
84
|
+
/** set to '4:2:0' to use chroma subsampling, default '4:4:4' */
|
|
85
|
+
chromaSubsampling?: ChromaSubsampling;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* https://en.wikipedia.org/wiki/Chroma_subsampling#Types_of_sampling_and_subsampling
|
|
89
|
+
* https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Video_concepts
|
|
90
|
+
*/
|
|
91
|
+
declare enum ChromaSubsampling {
|
|
92
|
+
/**
|
|
93
|
+
* Each of the three Y'CbCr components has the same sample rate, thus there is no chroma subsampling. This scheme is sometimes used in high-end film scanners and cinematic post-production.
|
|
94
|
+
* Note that "4:4:4" may instead be wrongly referring to R'G'B' color space, which implicitly also does not have any chroma subsampling (except in JPEG R'G'B' can be subsampled).
|
|
95
|
+
* Formats such as HDCAM SR can record 4:4:4 R'G'B' over dual-link HD-SDI.
|
|
96
|
+
*/
|
|
97
|
+
Yuv444 = 0,
|
|
98
|
+
/**
|
|
99
|
+
* The two chroma components are sampled at half the horizontal sample rate of luma: the horizontal chroma resolution is halved. This reduces the bandwidth of an uncompressed video signal by one-third.
|
|
100
|
+
* Many high-end digital video formats and interfaces use this scheme:
|
|
101
|
+
* - [AVC-Intra 100](https://en.wikipedia.org/wiki/AVC-Intra)
|
|
102
|
+
* - [Digital Betacam](https://en.wikipedia.org/wiki/Betacam#Digital_Betacam)
|
|
103
|
+
* - [Betacam SX](https://en.wikipedia.org/wiki/Betacam#Betacam_SX)
|
|
104
|
+
* - [DVCPRO50](https://en.wikipedia.org/wiki/DV#DVCPRO) and [DVCPRO HD](https://en.wikipedia.org/wiki/DV#DVCPRO_HD)
|
|
105
|
+
* - [Digital-S](https://en.wikipedia.org/wiki/Digital-S)
|
|
106
|
+
* - [CCIR 601](https://en.wikipedia.org/wiki/Rec._601) / [Serial Digital Interface](https://en.wikipedia.org/wiki/Serial_digital_interface) / [D1](https://en.wikipedia.org/wiki/D-1_(Sony))
|
|
107
|
+
* - [ProRes (HQ, 422, LT, and Proxy)](https://en.wikipedia.org/wiki/Apple_ProRes)
|
|
108
|
+
* - [XDCAM HD422](https://en.wikipedia.org/wiki/XDCAM)
|
|
109
|
+
* - [Canon MXF HD422](https://en.wikipedia.org/wiki/Canon_XF-300)
|
|
110
|
+
*/
|
|
111
|
+
Yuv422 = 1,
|
|
112
|
+
/**
|
|
113
|
+
* n 4:2:0, the horizontal sampling is doubled compared to 4:1:1,
|
|
114
|
+
* but as the **Cb** and **Cr** channels are only sampled on each alternate line in this scheme, the vertical resolution is halved.
|
|
115
|
+
* The data rate is thus the same.
|
|
116
|
+
* This fits reasonably well with the PAL color encoding system, since this has only half the vertical chrominance resolution of [NTSC](https://en.wikipedia.org/wiki/NTSC).
|
|
117
|
+
* It would also fit extremely well with the [SECAM](https://en.wikipedia.org/wiki/SECAM) color encoding system,
|
|
118
|
+
* since like that format, 4:2:0 only stores and transmits one color channel per line (the other channel being recovered from the previous line).
|
|
119
|
+
* However, little equipment has actually been produced that outputs a SECAM analogue video signal.
|
|
120
|
+
* In general, SECAM territories either have to use a PAL-capable display or a [transcoder](https://en.wikipedia.org/wiki/Transcoding) to convert the PAL signal to SECAM for display.
|
|
121
|
+
*/
|
|
122
|
+
Yuv420 = 2,
|
|
123
|
+
/**
|
|
124
|
+
* What if the chroma subsampling model is 4:0:0?
|
|
125
|
+
* That says to use every pixel of luma data, but that each row has 0 chroma samples applied to it. The resulting image, then, is comprised solely of the luminance data—a greyscale image.
|
|
126
|
+
*/
|
|
127
|
+
Yuv400 = 3,
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface ContextAttributes {
|
|
131
|
+
alpha?: boolean;
|
|
132
|
+
colorSpace?: ColorSpace;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface NodeContext
|
|
136
|
+
extends Omit<
|
|
137
|
+
CanvasRenderingContext2D,
|
|
138
|
+
| "drawImage"
|
|
139
|
+
| "createPattern"
|
|
140
|
+
| "getTransform"
|
|
141
|
+
| "drawFocusIfNeeded"
|
|
142
|
+
| "scrollPathIntoView"
|
|
143
|
+
| "canvas"
|
|
144
|
+
> {
|
|
145
|
+
canvas: NodeCanvas;
|
|
146
|
+
/**
|
|
147
|
+
* @param startAngle The angle at which to begin the gradient, in radians. Angle measurements start vertically above the centre and move around clockwise.
|
|
148
|
+
* @param x The x-axis coordinate of the centre of the gradient.
|
|
149
|
+
* @param y The y-axis coordinate of the centre of the gradient.
|
|
150
|
+
*/
|
|
151
|
+
createConicGradient(startAngle: number, x: number, y: number): CanvasGradient;
|
|
152
|
+
drawImage(image: Image | NodeCanvas, dx: number, dy: number): void;
|
|
153
|
+
drawImage(
|
|
154
|
+
image: Image | NodeCanvas,
|
|
155
|
+
dx: number,
|
|
156
|
+
dy: number,
|
|
157
|
+
dw: number,
|
|
158
|
+
dh: number
|
|
159
|
+
): void;
|
|
160
|
+
drawImage(
|
|
161
|
+
image: Image | NodeCanvas,
|
|
162
|
+
sx: number,
|
|
163
|
+
sy: number,
|
|
164
|
+
sw: number,
|
|
165
|
+
sh: number,
|
|
166
|
+
dx: number,
|
|
167
|
+
dy: number,
|
|
168
|
+
dw: number,
|
|
169
|
+
dh: number
|
|
170
|
+
): void;
|
|
171
|
+
createPattern(
|
|
172
|
+
image: Image | ImageData,
|
|
173
|
+
repeat: "repeat" | "repeat-x" | "repeat-y" | "no-repeat" | null
|
|
174
|
+
): CanvasPattern;
|
|
175
|
+
getContextAttributes(): { alpha: boolean; desynchronized: boolean };
|
|
176
|
+
getTransform(): DOMMatrix;
|
|
177
|
+
}
|
|
178
|
+
declare class Image {
|
|
179
|
+
constructor();
|
|
180
|
+
// attrs only affects SVG
|
|
181
|
+
constructor(
|
|
182
|
+
width: number,
|
|
183
|
+
height: number,
|
|
184
|
+
attrs?: { colorSpace?: ColorSpace }
|
|
185
|
+
);
|
|
186
|
+
width: number;
|
|
187
|
+
height: number;
|
|
188
|
+
readonly naturalWidth: number;
|
|
189
|
+
readonly naturalHeight: number;
|
|
190
|
+
readonly complete: boolean;
|
|
191
|
+
alt: string;
|
|
192
|
+
src: Buffer;
|
|
193
|
+
onload?(): void;
|
|
194
|
+
onerror?(err: Error): void;
|
|
195
|
+
}
|
|
196
|
+
type ColorSpace = "srgb" | "display-p3";
|
|
197
|
+
|
|
198
|
+
type Canvas = NodeCanvas | HTMLCanvasElement;
|
|
199
|
+
type Context2D = NodeContext | CanvasRenderingContext2D;
|
|
200
|
+
|
|
3
201
|
declare class BaseComment implements IComment {
|
|
4
|
-
protected readonly context:
|
|
5
|
-
protected
|
|
6
|
-
comment:
|
|
202
|
+
protected readonly context: Context2D;
|
|
203
|
+
protected cacheKey: string;
|
|
204
|
+
comment: FormattedCommentWithSize;
|
|
7
205
|
posY: number;
|
|
8
206
|
readonly pluginName: string;
|
|
9
|
-
image?:
|
|
10
|
-
constructor(comment:
|
|
207
|
+
image?: Canvas | null;
|
|
208
|
+
constructor(comment: FormattedComment, context: Context2D);
|
|
11
209
|
get invisible(): boolean;
|
|
12
|
-
get loc():
|
|
210
|
+
get loc(): CommentLoc;
|
|
13
211
|
get long(): number;
|
|
14
212
|
get vpos(): number;
|
|
15
213
|
get width(): number;
|
|
@@ -18,165 +216,646 @@ declare class BaseComment implements IComment {
|
|
|
18
216
|
get layer(): number;
|
|
19
217
|
get owner(): boolean;
|
|
20
218
|
get mail(): string[];
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
protected
|
|
24
|
-
protected
|
|
219
|
+
get content(): string;
|
|
220
|
+
set content(_: string);
|
|
221
|
+
protected getCommentSize(parsedData: FormattedCommentWithFont): FormattedCommentWithSize;
|
|
222
|
+
protected parseCommandAndNicoscript(comment: FormattedComment): FormattedCommentWithFont;
|
|
223
|
+
protected parseContent(comment: string): ParseContentResult;
|
|
224
|
+
protected measureText(comment: MeasureTextInput): MeasureTextResult;
|
|
225
|
+
protected convertComment(comment: FormattedComment): FormattedCommentWithSize;
|
|
25
226
|
draw(vpos: number, showCollision: boolean, debug: boolean): void;
|
|
26
227
|
protected _draw(posX: number, posY: number): void;
|
|
27
228
|
protected _drawRectColor(posX: number, posY: number): void;
|
|
28
229
|
protected _drawDebugInfo(posX: number, posY: number, debug: boolean): void;
|
|
29
230
|
protected _drawCollision(posX: number, posY: number, showCollision: boolean): void;
|
|
30
|
-
protected getTextImage():
|
|
31
|
-
protected _generateTextImage():
|
|
32
|
-
protected _cacheImage(image:
|
|
231
|
+
protected getTextImage(): Canvas | null;
|
|
232
|
+
protected _generateTextImage(): Canvas;
|
|
233
|
+
protected _cacheImage(image: Canvas): void;
|
|
33
234
|
protected createCanvas(): {
|
|
34
|
-
image:
|
|
35
|
-
context:
|
|
235
|
+
image: Canvas;
|
|
236
|
+
context: Context2D;
|
|
36
237
|
};
|
|
37
238
|
}
|
|
38
239
|
|
|
39
|
-
|
|
40
|
-
import type { formattedComment, formattedCommentWithFont, formattedCommentWithSize, measureTextInput, measureTextResult } from "@/@types/";
|
|
41
|
-
import { BaseComment } from "./BaseComment";
|
|
42
240
|
declare class FlashComment extends BaseComment {
|
|
43
241
|
private _globalScale;
|
|
44
242
|
private scale;
|
|
45
243
|
private scaleX;
|
|
46
244
|
readonly pluginName: string;
|
|
47
|
-
constructor(comment:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
245
|
+
constructor(comment: FormattedComment, context: Context2D);
|
|
246
|
+
get content(): string;
|
|
247
|
+
set content(input: string);
|
|
248
|
+
convertComment(comment: FormattedComment): FormattedCommentWithSize;
|
|
249
|
+
getCommentSize(parsedData: FormattedCommentWithFont): FormattedCommentWithSize;
|
|
250
|
+
parseCommandAndNicoscript(comment: FormattedComment): FormattedCommentWithFont;
|
|
251
|
+
parseContent(input: string): {
|
|
252
|
+
content: CommentContentItem[];
|
|
253
|
+
lineCount: number;
|
|
254
|
+
lineOffset: number;
|
|
255
|
+
};
|
|
256
|
+
measureText(comment: MeasureTextInput): MeasureTextResult;
|
|
257
|
+
private _measureContent;
|
|
52
258
|
_drawCollision(posX: number, posY: number, showCollision: boolean): void;
|
|
53
|
-
_generateTextImage():
|
|
259
|
+
_generateTextImage(): Canvas;
|
|
54
260
|
}
|
|
55
261
|
|
|
56
|
-
|
|
57
|
-
import type { formattedComment, formattedCommentWithFont, formattedCommentWithSize, measureTextInput, measureTextResult } from "@/@types/";
|
|
58
|
-
import { BaseComment } from "./BaseComment";
|
|
59
262
|
declare class HTML5Comment extends BaseComment {
|
|
60
263
|
readonly pluginName: string;
|
|
61
|
-
constructor(comment:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
264
|
+
constructor(comment: FormattedComment, context: Context2D);
|
|
265
|
+
get content(): string;
|
|
266
|
+
set content(input: string);
|
|
267
|
+
convertComment(comment: FormattedComment): FormattedCommentWithSize;
|
|
268
|
+
getCommentSize(parsedData: FormattedCommentWithFont): FormattedCommentWithSize;
|
|
269
|
+
parseCommandAndNicoscript(comment: FormattedComment): FormattedCommentWithFont;
|
|
270
|
+
parseContent(input: string): {
|
|
271
|
+
content: CommentContentItem[];
|
|
272
|
+
lineCount: number;
|
|
273
|
+
lineOffset: number;
|
|
274
|
+
};
|
|
275
|
+
measureText(comment: MeasureTextInput): MeasureTextResult;
|
|
66
276
|
private _measureComment;
|
|
67
277
|
private _processResizeX;
|
|
68
278
|
_drawCollision(posX: number, posY: number, showCollision: boolean): void;
|
|
69
|
-
_generateTextImage():
|
|
279
|
+
_generateTextImage(): Canvas;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
type index_d$3_BaseComment = BaseComment;
|
|
283
|
+
declare const index_d$3_BaseComment: typeof BaseComment;
|
|
284
|
+
type index_d$3_FlashComment = FlashComment;
|
|
285
|
+
declare const index_d$3_FlashComment: typeof FlashComment;
|
|
286
|
+
type index_d$3_HTML5Comment = HTML5Comment;
|
|
287
|
+
declare const index_d$3_HTML5Comment: typeof HTML5Comment;
|
|
288
|
+
declare namespace index_d$3 {
|
|
289
|
+
export {
|
|
290
|
+
index_d$3_BaseComment as BaseComment,
|
|
291
|
+
index_d$3_FlashComment as FlashComment,
|
|
292
|
+
index_d$3_HTML5Comment as HTML5Comment,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
type ConfigItem<T> = T | { html5: T; flash: T };
|
|
297
|
+
type ConfigSizeItem<T> = { big: T; medium: T; small: T };
|
|
298
|
+
type ConfigResizedItem<T> = { default: T; resized: T };
|
|
299
|
+
|
|
300
|
+
type CommentStageSize = {
|
|
301
|
+
width: number;
|
|
302
|
+
fullWidth: number;
|
|
303
|
+
height: number;
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
type FlashCharList = {
|
|
307
|
+
[key in "simsunStrong" | "simsunWeak" | "gulim" | "gothic"]: string;
|
|
308
|
+
};
|
|
309
|
+
type FlashMode = "xp" | "vista";
|
|
310
|
+
type FlashScriptChar = {
|
|
311
|
+
[key in "super" | "sub"]: string;
|
|
312
|
+
};
|
|
313
|
+
type FontList = {
|
|
314
|
+
[key in "gulim" | "simsun"]: string;
|
|
315
|
+
};
|
|
316
|
+
type LineCounts = {
|
|
317
|
+
[key in "default" | "resized" | "doubleResized"]: ConfigSizeItem<number>;
|
|
318
|
+
};
|
|
319
|
+
type TypeDoubleResizeMaxWidth = {
|
|
320
|
+
[key in "full" | "normal"]: number;
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
type BaseConfig = {
|
|
324
|
+
cacheAge: number;
|
|
325
|
+
canvasHeight: number;
|
|
326
|
+
canvasWidth: number;
|
|
327
|
+
collisionRange: { [key in "left" | "right"]: number };
|
|
328
|
+
colors: { [key: string]: string };
|
|
329
|
+
commentDrawPadding: number;
|
|
330
|
+
commentDrawRange: number;
|
|
331
|
+
commentScale: ConfigItem<number>;
|
|
332
|
+
CommentStageSize: ConfigItem<CommentStageSize>;
|
|
333
|
+
commentYMarginBottom: ConfigSizeItem<number>;
|
|
334
|
+
commentYOffset: ConfigSizeItem<ConfigResizedItem<number>>;
|
|
335
|
+
commentYPaddingTop: ConfigResizedItem<number>;
|
|
336
|
+
contextFillLiveOpacity: number;
|
|
337
|
+
contextLineWidth: number;
|
|
338
|
+
contextStrokeColor: string;
|
|
339
|
+
contextStrokeInversionColor: string;
|
|
340
|
+
contextStrokeOpacity: number;
|
|
341
|
+
doubleResizeMaxWidth: ConfigItem<TypeDoubleResizeMaxWidth>;
|
|
342
|
+
flashChar: FlashCharList;
|
|
343
|
+
FlashMode: FlashMode;
|
|
344
|
+
FlashScriptChar: FlashScriptChar;
|
|
345
|
+
flashThreshold: number;
|
|
346
|
+
font: FontList;
|
|
347
|
+
fonts: PlatformFont;
|
|
348
|
+
fontSize: ConfigItem<ConfigSizeItem<ConfigResizedItem<number>>>;
|
|
349
|
+
fpsInterval: number;
|
|
350
|
+
hiResCommentCorrection: number;
|
|
351
|
+
lineCounts: ConfigItem<LineCounts>;
|
|
352
|
+
lineHeight: ConfigItem<ConfigSizeItem<ConfigResizedItem<number>>>;
|
|
353
|
+
minFontSize: number;
|
|
354
|
+
sameCAGap: number;
|
|
355
|
+
sameCAMinScore: number;
|
|
356
|
+
sameCARange: number;
|
|
357
|
+
sameCATimestampRange: number;
|
|
358
|
+
letterSpacing: number;
|
|
359
|
+
scriptCharOffset: number;
|
|
360
|
+
plugins: IPluginConstructor[];
|
|
361
|
+
commentPlugins: {
|
|
362
|
+
class: typeof BaseComment;
|
|
363
|
+
condition: (comment: FormattedComment) => boolean;
|
|
364
|
+
}[];
|
|
365
|
+
commentLimit: number | undefined;
|
|
366
|
+
hideCommentOrder: "asc" | "desc";
|
|
367
|
+
lineBreakCount: { [key in CommentSize]: number };
|
|
368
|
+
nakaCommentSpeedOffset: number;
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
type Config = Partial<BaseConfig>;
|
|
372
|
+
|
|
373
|
+
interface CommentEventBase {
|
|
374
|
+
type: CommentEventName;
|
|
375
|
+
timeStamp: number;
|
|
376
|
+
vpos: number;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
interface SeekDisableEvent extends CommentEventBase {
|
|
380
|
+
type: "seekDisable";
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
type SeekDisableEventHandler = (event: SeekDisableEvent) => unknown;
|
|
384
|
+
|
|
385
|
+
interface SeekEnableEvent extends CommentEventBase {
|
|
386
|
+
type: "seekEnable";
|
|
387
|
+
}
|
|
388
|
+
type SeekEnableEventHandler = (event: SeekEnableEvent) => unknown;
|
|
389
|
+
|
|
390
|
+
interface CommentDisableEvent extends CommentEventBase {
|
|
391
|
+
type: "commentDisable";
|
|
392
|
+
}
|
|
393
|
+
type CommentDisableEventHandler = (
|
|
394
|
+
event: CommentDisableEvent
|
|
395
|
+
) => unknown;
|
|
396
|
+
|
|
397
|
+
interface CommentEnableEvent extends CommentEventBase {
|
|
398
|
+
type: "commentEnable";
|
|
399
|
+
}
|
|
400
|
+
type CommentEnableEventHandler = (event: CommentEnableEvent) => unknown;
|
|
401
|
+
|
|
402
|
+
interface JumpEvent extends CommentEventBase {
|
|
403
|
+
type: "jump";
|
|
404
|
+
to: string;
|
|
405
|
+
message?: string;
|
|
406
|
+
}
|
|
407
|
+
type JumpEventHandler = (event: JumpEvent) => unknown;
|
|
408
|
+
|
|
409
|
+
type CommentEventName =
|
|
410
|
+
| "seekDisable"
|
|
411
|
+
| "seekEnable"
|
|
412
|
+
| "commentDisable"
|
|
413
|
+
| "commentEnable"
|
|
414
|
+
| "jump";
|
|
415
|
+
type CommentEventHandler =
|
|
416
|
+
| SeekDisableEventHandler
|
|
417
|
+
| SeekEnableEventHandler
|
|
418
|
+
| CommentDisableEventHandler
|
|
419
|
+
| CommentEnableEventHandler
|
|
420
|
+
| JumpEventHandler;
|
|
421
|
+
interface CommentEventHandlerMap {
|
|
422
|
+
seekDisable: SeekDisableEventHandler;
|
|
423
|
+
seekEnable: SeekEnableEventHandler;
|
|
424
|
+
commentDisable: CommentDisableEventHandler;
|
|
425
|
+
commentEnable: CommentEnableEventHandler;
|
|
426
|
+
jump: JumpEventHandler;
|
|
427
|
+
}
|
|
428
|
+
interface CommentEventMap {
|
|
429
|
+
seekDisable: SeekDisableEvent;
|
|
430
|
+
seekEnable: SeekEnableEvent;
|
|
431
|
+
commentDisable: CommentDisableEvent;
|
|
432
|
+
commentEnable: CommentEnableEvent;
|
|
433
|
+
jump: JumpEvent;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
type Platform =
|
|
437
|
+
| "win7"
|
|
438
|
+
| "win8_1"
|
|
439
|
+
| "win"
|
|
440
|
+
| "mac10_9"
|
|
441
|
+
| "mac10_11"
|
|
442
|
+
| "mac"
|
|
443
|
+
| "other";
|
|
444
|
+
type HTML5Fonts = "gothic" | "mincho" | "defont";
|
|
445
|
+
type FontItem = {
|
|
446
|
+
font: string;
|
|
447
|
+
offset: number;
|
|
448
|
+
weight: number;
|
|
449
|
+
};
|
|
450
|
+
type PlatformFont = {
|
|
451
|
+
[key in HTML5Fonts]: FontItem;
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
type FormattedComment = {
|
|
455
|
+
id: number;
|
|
456
|
+
vpos: number;
|
|
457
|
+
content: string;
|
|
458
|
+
date: number;
|
|
459
|
+
date_usec: number;
|
|
460
|
+
owner: boolean;
|
|
461
|
+
premium: boolean;
|
|
462
|
+
mail: string[];
|
|
463
|
+
user_id: number;
|
|
464
|
+
layer: number;
|
|
465
|
+
};
|
|
466
|
+
type FormattedLegacyComment = {
|
|
467
|
+
id: number;
|
|
468
|
+
vpos: number;
|
|
469
|
+
content: string;
|
|
470
|
+
date: number;
|
|
471
|
+
date_usec: number;
|
|
472
|
+
owner: boolean;
|
|
473
|
+
premium: boolean;
|
|
474
|
+
mail: string[];
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* @deprecated
|
|
479
|
+
*/
|
|
480
|
+
type formattedComment = FormattedComment;
|
|
481
|
+
/**
|
|
482
|
+
* @deprecated
|
|
483
|
+
*/
|
|
484
|
+
type formattedLegacyComment = FormattedLegacyComment;
|
|
485
|
+
|
|
486
|
+
type RawApiResponse = {
|
|
487
|
+
[key: string]: ApiPing | ApiThread | ApiLeaf | ApiGlobalNumRes | ApiChat;
|
|
488
|
+
};
|
|
489
|
+
type ApiPing = {
|
|
490
|
+
content: string;
|
|
491
|
+
};
|
|
492
|
+
type ApiThread = {
|
|
493
|
+
resultcode: number;
|
|
494
|
+
thread: string;
|
|
495
|
+
server_time: number;
|
|
496
|
+
ticket: string;
|
|
497
|
+
revision: number;
|
|
498
|
+
};
|
|
499
|
+
type ApiLeaf = {
|
|
500
|
+
thread: string;
|
|
501
|
+
count: number;
|
|
502
|
+
};
|
|
503
|
+
type ApiGlobalNumRes = {
|
|
504
|
+
thread: string;
|
|
505
|
+
num_res: number;
|
|
506
|
+
};
|
|
507
|
+
type ApiChat = {
|
|
508
|
+
thread: string;
|
|
509
|
+
no: number;
|
|
510
|
+
vpos: number;
|
|
511
|
+
date: number;
|
|
512
|
+
date_usec: number;
|
|
513
|
+
nicoru: number;
|
|
514
|
+
premium: number;
|
|
515
|
+
anonymity: number;
|
|
516
|
+
user_id: string;
|
|
517
|
+
mail: string;
|
|
518
|
+
content: string;
|
|
519
|
+
deleted: number;
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* @deprecated
|
|
524
|
+
*/
|
|
525
|
+
type rawApiResponse = RawApiResponse;
|
|
526
|
+
|
|
527
|
+
type OwnerComment = {
|
|
528
|
+
time: string;
|
|
529
|
+
command: string;
|
|
530
|
+
comment: string;
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* @deprecated
|
|
535
|
+
*/
|
|
536
|
+
type ownerComment = OwnerComment;
|
|
537
|
+
|
|
538
|
+
type V1Thread = {
|
|
539
|
+
id: string;
|
|
540
|
+
fork: string;
|
|
541
|
+
commentCount: number;
|
|
542
|
+
comments: V1Comment[];
|
|
543
|
+
};
|
|
544
|
+
type V1Comment = {
|
|
545
|
+
id: string;
|
|
546
|
+
no: number;
|
|
547
|
+
vposMs: number;
|
|
548
|
+
body: string;
|
|
549
|
+
commands: string[];
|
|
550
|
+
userId: string;
|
|
551
|
+
isPremium: boolean;
|
|
552
|
+
score: number;
|
|
553
|
+
postedAt: string;
|
|
554
|
+
nicoruCount: number;
|
|
555
|
+
nicoruId: undefined;
|
|
556
|
+
source: string;
|
|
557
|
+
isMyPost: boolean;
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* @deprecated
|
|
562
|
+
*/
|
|
563
|
+
type v1Thread = V1Thread;
|
|
564
|
+
|
|
565
|
+
interface IComment {
|
|
566
|
+
comment: FormattedCommentWithSize;
|
|
567
|
+
invisible: boolean;
|
|
568
|
+
loc: CommentLoc;
|
|
569
|
+
width: number;
|
|
570
|
+
long: number;
|
|
571
|
+
height: number;
|
|
572
|
+
vpos: number;
|
|
573
|
+
flash: boolean;
|
|
574
|
+
posY: number;
|
|
575
|
+
owner: boolean;
|
|
576
|
+
layer: number;
|
|
577
|
+
mail: string[];
|
|
578
|
+
content: string;
|
|
579
|
+
image?: Canvas | null;
|
|
580
|
+
draw: (vpos: number, showCollision: boolean, isDebug: boolean) => void;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
interface IPluginConstructor {
|
|
584
|
+
id: string;
|
|
585
|
+
new (Canvas: Canvas, comments: IComment[]): IPlugin;
|
|
70
586
|
}
|
|
71
587
|
|
|
588
|
+
interface IPlugin {
|
|
589
|
+
draw(vpos: number): void;
|
|
590
|
+
addComments(comments: IComment[]): void;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
type InputFormatType =
|
|
594
|
+
| "XMLDocument"
|
|
595
|
+
| "niconicome"
|
|
596
|
+
| "formatted"
|
|
597
|
+
| "legacy"
|
|
598
|
+
| "legacyOwner"
|
|
599
|
+
| "owner"
|
|
600
|
+
| "v1"
|
|
601
|
+
| "empty"
|
|
602
|
+
| "default";
|
|
603
|
+
type InputFormat =
|
|
604
|
+
| XMLDocument
|
|
605
|
+
| FormattedComment[]
|
|
606
|
+
| FormattedLegacyComment[]
|
|
607
|
+
| RawApiResponse[]
|
|
608
|
+
| OwnerComment[]
|
|
609
|
+
| V1Thread[]
|
|
610
|
+
| string
|
|
611
|
+
| undefined;
|
|
612
|
+
type ModeType = "default" | "html5" | "flash";
|
|
613
|
+
type BaseOptions = {
|
|
614
|
+
config: Config;
|
|
615
|
+
debug: boolean;
|
|
616
|
+
enableLegacyPiP: boolean;
|
|
617
|
+
format: InputFormatType;
|
|
618
|
+
formatted: boolean;
|
|
619
|
+
keepCA: boolean;
|
|
620
|
+
mode: ModeType;
|
|
621
|
+
scale: number;
|
|
622
|
+
showCollision: boolean;
|
|
623
|
+
showCommentCount: boolean;
|
|
624
|
+
showFPS: boolean;
|
|
625
|
+
useLegacy: boolean;
|
|
626
|
+
video: HTMLVideoElement | undefined;
|
|
627
|
+
};
|
|
628
|
+
type Options = Partial<BaseOptions>;
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* @deprecated
|
|
632
|
+
*/
|
|
633
|
+
type inputFormatType = InputFormatType;
|
|
634
|
+
/**
|
|
635
|
+
* @deprecated
|
|
636
|
+
*/
|
|
637
|
+
type inputFormat = InputFormat;
|
|
638
|
+
|
|
639
|
+
type FormattedCommentWithFont = {
|
|
640
|
+
id: number;
|
|
641
|
+
vpos: number;
|
|
642
|
+
date: number;
|
|
643
|
+
date_usec: number;
|
|
644
|
+
owner: boolean;
|
|
645
|
+
premium: boolean;
|
|
646
|
+
mail: string[];
|
|
647
|
+
user_id: number;
|
|
648
|
+
layer: number;
|
|
649
|
+
loc: CommentLoc;
|
|
650
|
+
size: CommentSize;
|
|
651
|
+
fontSize: number;
|
|
652
|
+
font: CommentFont;
|
|
653
|
+
color: string;
|
|
654
|
+
strokeColor?: string;
|
|
655
|
+
wakuColor?: string;
|
|
656
|
+
full: boolean;
|
|
657
|
+
ender: boolean;
|
|
658
|
+
_live: boolean;
|
|
659
|
+
long: number;
|
|
660
|
+
invisible: boolean;
|
|
661
|
+
content: CommentContentItem[];
|
|
662
|
+
rawContent: string;
|
|
663
|
+
flash: boolean;
|
|
664
|
+
lineCount: number;
|
|
665
|
+
lineOffset: number;
|
|
666
|
+
};
|
|
667
|
+
type FormattedCommentWithSize = FormattedCommentWithFont & {
|
|
668
|
+
height: number;
|
|
669
|
+
width: number;
|
|
670
|
+
lineHeight: number;
|
|
671
|
+
resized: boolean;
|
|
672
|
+
resizedX: boolean;
|
|
673
|
+
resizedY: boolean;
|
|
674
|
+
content: CommentMeasuredContentItem[];
|
|
675
|
+
charSize: number;
|
|
676
|
+
};
|
|
677
|
+
type ParseContentResult = {
|
|
678
|
+
content: CommentContentItem[];
|
|
679
|
+
lineCount: number;
|
|
680
|
+
lineOffset: number;
|
|
681
|
+
};
|
|
682
|
+
type ParseCommandAndNicoScriptResult = {
|
|
683
|
+
flash: boolean;
|
|
684
|
+
loc: CommentLoc;
|
|
685
|
+
size: CommentSize;
|
|
686
|
+
fontSize: number;
|
|
687
|
+
color: string;
|
|
688
|
+
strokeColor?: string;
|
|
689
|
+
wakuColor?: string;
|
|
690
|
+
font: CommentFont;
|
|
691
|
+
full: boolean;
|
|
692
|
+
ender: boolean;
|
|
693
|
+
_live: boolean;
|
|
694
|
+
invisible: boolean;
|
|
695
|
+
long: number;
|
|
696
|
+
};
|
|
697
|
+
type CommentContentItem = {
|
|
698
|
+
content: string;
|
|
699
|
+
slicedContent: string[];
|
|
700
|
+
font?: CommentFlashFont;
|
|
701
|
+
width?: number[];
|
|
702
|
+
};
|
|
703
|
+
type CommentMeasuredContentItem = CommentContentItem & {
|
|
704
|
+
width: number[];
|
|
705
|
+
};
|
|
706
|
+
type CommentContentIndex = {
|
|
707
|
+
index: number;
|
|
708
|
+
font: "gothic" | "gulim" | "simsunStrong" | "simsunWeak";
|
|
709
|
+
};
|
|
710
|
+
type CommentFont = "defont" | "mincho" | "gothic" | "gulim" | "simsun";
|
|
711
|
+
type CommentFlashFont = "defont" | "gulim" | "simsun";
|
|
712
|
+
type CommentSize = "big" | "medium" | "small";
|
|
713
|
+
type CommentLoc = "ue" | "naka" | "shita";
|
|
714
|
+
type Collision = { [key in CollisionPos]: CollisionItem };
|
|
715
|
+
type Timeline = { [key: number]: IComment[] };
|
|
716
|
+
type CollisionPos = "ue" | "shita" | "right" | "left";
|
|
717
|
+
type CollisionItem = { [p: number]: IComment[] };
|
|
718
|
+
type NicoScript = {
|
|
719
|
+
reverse: NicoScriptReverse[];
|
|
720
|
+
ban: NicoScriptBan[];
|
|
721
|
+
default: NicoScriptDefault[];
|
|
722
|
+
replace: NicoScriptReplace[];
|
|
723
|
+
seekDisable: NicoScriptSeekDisable[];
|
|
724
|
+
jump: NicoScriptJump[];
|
|
725
|
+
};
|
|
726
|
+
type NicoScriptSeekDisable = {
|
|
727
|
+
start: number;
|
|
728
|
+
end: number;
|
|
729
|
+
};
|
|
730
|
+
type NicoScriptJump = {
|
|
731
|
+
start: number;
|
|
732
|
+
end?: number;
|
|
733
|
+
to: string;
|
|
734
|
+
message?: string;
|
|
735
|
+
};
|
|
736
|
+
type NicoScriptReverse = {
|
|
737
|
+
target: NicoScriptReverseTarget;
|
|
738
|
+
start: number;
|
|
739
|
+
end: number;
|
|
740
|
+
};
|
|
741
|
+
type NicoScriptReverseTarget = "コメ" | "投コメ" | "全";
|
|
742
|
+
type NicoScriptReplace = {
|
|
743
|
+
start: number;
|
|
744
|
+
long: number | undefined;
|
|
745
|
+
keyword: string;
|
|
746
|
+
replace: string;
|
|
747
|
+
range: NicoScriptReplaceRange;
|
|
748
|
+
target: NicoScriptReplaceTarget;
|
|
749
|
+
condition: NicoScriptReplaceCondition;
|
|
750
|
+
color: string | undefined;
|
|
751
|
+
size: CommentSize | undefined;
|
|
752
|
+
font: CommentFont | undefined;
|
|
753
|
+
loc: CommentLoc | undefined;
|
|
754
|
+
no: number;
|
|
755
|
+
};
|
|
756
|
+
type NicoScriptReplaceRange = "単" | "全";
|
|
757
|
+
type NicoScriptReplaceTarget =
|
|
758
|
+
| "コメ"
|
|
759
|
+
| "投コメ"
|
|
760
|
+
| "全"
|
|
761
|
+
| "含まない"
|
|
762
|
+
| "含む";
|
|
763
|
+
type NicoScriptReplaceCondition = "完全一致" | "部分一致";
|
|
764
|
+
type NicoScriptBan = {
|
|
765
|
+
start: number;
|
|
766
|
+
end: number;
|
|
767
|
+
};
|
|
768
|
+
type NicoScriptDefault = {
|
|
769
|
+
start: number;
|
|
770
|
+
long: number | undefined;
|
|
771
|
+
color: string | undefined;
|
|
772
|
+
size: CommentSize | undefined;
|
|
773
|
+
font: CommentFont | undefined;
|
|
774
|
+
loc: CommentLoc | undefined;
|
|
775
|
+
};
|
|
776
|
+
type MeasureTextResult = {
|
|
777
|
+
width: number;
|
|
778
|
+
height: number;
|
|
779
|
+
resized: boolean;
|
|
780
|
+
resizedX: boolean;
|
|
781
|
+
resizedY: boolean;
|
|
782
|
+
fontSize: number;
|
|
783
|
+
lineHeight: number;
|
|
784
|
+
content: CommentMeasuredContentItem[];
|
|
785
|
+
charSize: number;
|
|
786
|
+
};
|
|
787
|
+
type ParsedCommand = {
|
|
788
|
+
loc: CommentLoc | undefined;
|
|
789
|
+
size: CommentSize | undefined;
|
|
790
|
+
fontSize: number | undefined;
|
|
791
|
+
color: string | undefined;
|
|
792
|
+
strokeColor?: string;
|
|
793
|
+
wakuColor?: string;
|
|
794
|
+
font: CommentFont | undefined;
|
|
795
|
+
full: boolean;
|
|
796
|
+
ender: boolean;
|
|
797
|
+
_live: boolean;
|
|
798
|
+
invisible: boolean;
|
|
799
|
+
long: number | undefined;
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
type MeasureTextInput = {
|
|
803
|
+
content: CommentContentItem[];
|
|
804
|
+
resized?: boolean;
|
|
805
|
+
ender: boolean;
|
|
806
|
+
size: CommentSize;
|
|
807
|
+
fontSize: number;
|
|
808
|
+
resizedY?: boolean;
|
|
809
|
+
resizedX?: boolean;
|
|
810
|
+
font: CommentFont;
|
|
811
|
+
loc: CommentLoc;
|
|
812
|
+
full: boolean;
|
|
813
|
+
flash: boolean;
|
|
814
|
+
lineCount: number;
|
|
815
|
+
lineHeight?: number;
|
|
816
|
+
charSize?: number;
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
type MeasureInput = {
|
|
820
|
+
font: CommentFont;
|
|
821
|
+
content: CommentContentItem[];
|
|
822
|
+
lineHeight: number;
|
|
823
|
+
charSize: number;
|
|
824
|
+
lineCount: number;
|
|
825
|
+
};
|
|
72
826
|
|
|
73
|
-
|
|
74
|
-
export * from "./FlashComment";
|
|
75
|
-
export * from "./HTML5Comment";
|
|
76
|
-
|
|
77
|
-
import type {
|
|
78
|
-
commentSize,
|
|
79
|
-
formattedComment,
|
|
80
|
-
IPluginConstructor,
|
|
81
|
-
platformFont,
|
|
82
|
-
} from "@/@types/";
|
|
83
|
-
import { BaseComment } from "@/comments/";
|
|
84
|
-
|
|
85
|
-
type configItem<T> = T | { html5: T; flash: T };
|
|
86
|
-
type configSizeItem<T> = { big: T; medium: T; small: T };
|
|
87
|
-
type configResizedItem<T> = { default: T; resized: T };
|
|
88
|
-
|
|
89
|
-
type commentStageSize = { width: number; fullWidth: number; height: number };
|
|
90
|
-
|
|
91
|
-
type flashCharList = {
|
|
92
|
-
[key in "simsunStrong" | "simsunWeak" | "gulim" | "gothic"]: string;
|
|
93
|
-
};
|
|
94
|
-
type flashMode = "xp" | "vista";
|
|
95
|
-
type flashScriptChar = {
|
|
96
|
-
[key in "super" | "sub"]: string;
|
|
97
|
-
};
|
|
98
|
-
type fontList = {
|
|
99
|
-
[key in "gulim" | "simsun"]: string;
|
|
100
|
-
};
|
|
101
|
-
type lineCounts = {
|
|
102
|
-
[key in "default" | "resized" | "doubleResized"]: configSizeItem<number>;
|
|
103
|
-
};
|
|
104
|
-
type typeDoubleResizeMaxWidth = {
|
|
105
|
-
[key in "full" | "normal"]: number;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
type BaseConfig = {
|
|
109
|
-
cacheAge: number;
|
|
110
|
-
canvasHeight: number;
|
|
111
|
-
canvasWidth: number;
|
|
112
|
-
collisionRange: { [key in "left" | "right"]: number };
|
|
113
|
-
colors: { [key: string]: string };
|
|
114
|
-
commentDrawPadding: number;
|
|
115
|
-
commentDrawRange: number;
|
|
116
|
-
commentScale: configItem<number>;
|
|
117
|
-
commentStageSize: configItem<commentStageSize>;
|
|
118
|
-
commentYMarginBottom: configSizeItem<number>;
|
|
119
|
-
commentYOffset: configSizeItem<configResizedItem<number>>;
|
|
120
|
-
commentYPaddingTop: configResizedItem<number>;
|
|
121
|
-
contextFillLiveOpacity: number;
|
|
122
|
-
contextLineWidth: number;
|
|
123
|
-
contextStrokeColor: string;
|
|
124
|
-
contextStrokeInversionColor: string;
|
|
125
|
-
contextStrokeOpacity: number;
|
|
126
|
-
doubleResizeMaxWidth: configItem<typeDoubleResizeMaxWidth>;
|
|
127
|
-
flashChar: flashCharList;
|
|
128
|
-
flashMode: flashMode;
|
|
129
|
-
flashScriptChar: flashScriptChar;
|
|
130
|
-
flashThreshold: number;
|
|
131
|
-
font: fontList;
|
|
132
|
-
fonts: platformFont;
|
|
133
|
-
fontSize: configItem<configSizeItem<configResizedItem<number>>>;
|
|
134
|
-
fpsInterval: number;
|
|
135
|
-
hiResCommentCorrection: number;
|
|
136
|
-
lineCounts: configItem<lineCounts>;
|
|
137
|
-
lineHeight: configItem<configSizeItem<configResizedItem<number>>>;
|
|
138
|
-
minFontSize: number;
|
|
139
|
-
sameCAGap: number;
|
|
140
|
-
sameCAMinScore: number;
|
|
141
|
-
sameCARange: number;
|
|
142
|
-
sameCATimestampRange: number;
|
|
143
|
-
letterSpacing: number;
|
|
144
|
-
scriptCharOffset: number;
|
|
145
|
-
plugins: IPluginConstructor[];
|
|
146
|
-
commentPlugins: {
|
|
147
|
-
class: typeof BaseComment;
|
|
148
|
-
condition: (comment: formattedComment) => boolean;
|
|
149
|
-
}[];
|
|
150
|
-
commentLimit: number | undefined;
|
|
151
|
-
hideCommentOrder: "asc" | "desc";
|
|
152
|
-
lineBreakCount: { [key in commentSize]: number };
|
|
153
|
-
nakaCommentSpeedOffset: number;
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
export type Config = Partial<BaseConfig>;
|
|
827
|
+
type ValueOf<T> = T[keyof T];
|
|
157
828
|
|
|
158
829
|
declare let imageCache: {
|
|
159
830
|
[key: string]: {
|
|
160
|
-
image:
|
|
161
|
-
timeout: number;
|
|
831
|
+
image: Canvas;
|
|
832
|
+
timeout: number | NodeJS.Timeout;
|
|
162
833
|
};
|
|
163
834
|
};
|
|
164
835
|
declare const resetImageCache: () => void;
|
|
165
836
|
|
|
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;
|
|
837
|
+
declare let nicoScripts: NicoScript;
|
|
173
838
|
declare const resetNicoScripts: () => void;
|
|
174
839
|
|
|
175
|
-
|
|
176
|
-
import type { IPlugin } from "@/@types/";
|
|
177
840
|
declare let plugins: IPlugin[];
|
|
178
841
|
declare const setPlugins: (input: IPlugin[]) => void;
|
|
179
842
|
|
|
843
|
+
declare const index_d$2_imageCache: typeof imageCache;
|
|
844
|
+
declare const index_d$2_nicoScripts: typeof nicoScripts;
|
|
845
|
+
declare const index_d$2_plugins: typeof plugins;
|
|
846
|
+
declare const index_d$2_resetImageCache: typeof resetImageCache;
|
|
847
|
+
declare const index_d$2_resetNicoScripts: typeof resetNicoScripts;
|
|
848
|
+
declare const index_d$2_setPlugins: typeof setPlugins;
|
|
849
|
+
declare namespace index_d$2 {
|
|
850
|
+
export {
|
|
851
|
+
index_d$2_imageCache as imageCache,
|
|
852
|
+
index_d$2_nicoScripts as nicoScripts,
|
|
853
|
+
index_d$2_plugins as plugins,
|
|
854
|
+
index_d$2_resetImageCache as resetImageCache,
|
|
855
|
+
index_d$2_resetNicoScripts as resetNicoScripts,
|
|
856
|
+
index_d$2_setPlugins as setPlugins,
|
|
857
|
+
};
|
|
858
|
+
}
|
|
180
859
|
|
|
181
860
|
declare const colors: {
|
|
182
861
|
white: string;
|
|
@@ -208,18 +887,40 @@ declare const colors: {
|
|
|
208
887
|
black2: string;
|
|
209
888
|
};
|
|
210
889
|
|
|
890
|
+
declare const colors$1_colors: typeof colors;
|
|
891
|
+
declare namespace colors$1 {
|
|
892
|
+
export {
|
|
893
|
+
colors$1_colors as colors,
|
|
894
|
+
};
|
|
895
|
+
}
|
|
211
896
|
|
|
212
|
-
import type { BaseConfig, BaseOptions } from "@/@types/";
|
|
213
897
|
declare let defaultConfig: BaseConfig;
|
|
214
898
|
declare const updateConfig: (config: BaseConfig) => void;
|
|
215
899
|
declare const defaultOptions: BaseOptions;
|
|
216
900
|
declare let config: BaseConfig;
|
|
217
901
|
declare let options: BaseOptions;
|
|
218
|
-
declare const setConfig: (value: BaseConfig) =>
|
|
219
|
-
declare const setOptions: (value: BaseOptions) =>
|
|
220
|
-
|
|
902
|
+
declare const setConfig: (value: BaseConfig) => void;
|
|
903
|
+
declare const setOptions: (value: BaseOptions) => void;
|
|
904
|
+
|
|
905
|
+
declare const config$1_config: typeof config;
|
|
906
|
+
declare const config$1_defaultConfig: typeof defaultConfig;
|
|
907
|
+
declare const config$1_defaultOptions: typeof defaultOptions;
|
|
908
|
+
declare const config$1_options: typeof options;
|
|
909
|
+
declare const config$1_setConfig: typeof setConfig;
|
|
910
|
+
declare const config$1_setOptions: typeof setOptions;
|
|
911
|
+
declare const config$1_updateConfig: typeof updateConfig;
|
|
912
|
+
declare namespace config$1 {
|
|
913
|
+
export {
|
|
914
|
+
config$1_config as config,
|
|
915
|
+
config$1_defaultConfig as defaultConfig,
|
|
916
|
+
config$1_defaultOptions as defaultOptions,
|
|
917
|
+
config$1_options as options,
|
|
918
|
+
config$1_setConfig as setConfig,
|
|
919
|
+
config$1_setOptions as setOptions,
|
|
920
|
+
config$1_updateConfig as updateConfig,
|
|
921
|
+
};
|
|
922
|
+
}
|
|
221
923
|
|
|
222
|
-
import { FontItem } from "@/@types";
|
|
223
924
|
declare const fontTemplates: {
|
|
224
925
|
arial: {
|
|
225
926
|
font: string;
|
|
@@ -325,9 +1026,23 @@ declare const fonts: {
|
|
|
325
1026
|
};
|
|
326
1027
|
};
|
|
327
1028
|
|
|
1029
|
+
declare const fonts$1_fontTemplates: typeof fontTemplates;
|
|
1030
|
+
declare const fonts$1_fonts: typeof fonts;
|
|
1031
|
+
declare namespace fonts$1 {
|
|
1032
|
+
export {
|
|
1033
|
+
fonts$1_fontTemplates as fontTemplates,
|
|
1034
|
+
fonts$1_fonts as fonts,
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
328
1037
|
|
|
329
1038
|
declare const initConfig: () => void;
|
|
330
1039
|
|
|
1040
|
+
declare const initConfig$1_initConfig: typeof initConfig;
|
|
1041
|
+
declare namespace initConfig$1 {
|
|
1042
|
+
export {
|
|
1043
|
+
initConfig$1_initConfig as initConfig,
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
331
1046
|
|
|
332
1047
|
declare class CanvasRenderingContext2DError extends Error {
|
|
333
1048
|
constructor(options?: {
|
|
@@ -335,26 +1050,18 @@ declare class CanvasRenderingContext2DError extends Error {
|
|
|
335
1050
|
});
|
|
336
1051
|
}
|
|
337
1052
|
|
|
338
|
-
|
|
339
|
-
export * from "./CanvasRenderingContext2DError";
|
|
340
|
-
export * from "./InvalidFormatError";
|
|
341
|
-
export * from "./InvalidOptionError";
|
|
342
|
-
export * from "./NotImplementedError";
|
|
343
|
-
|
|
344
1053
|
declare class InvalidFormatError extends Error {
|
|
345
1054
|
constructor(options?: {
|
|
346
1055
|
[key: string]: unknown;
|
|
347
1056
|
});
|
|
348
1057
|
}
|
|
349
1058
|
|
|
350
|
-
|
|
351
1059
|
declare class InvalidOptionError extends Error {
|
|
352
1060
|
constructor(options?: {
|
|
353
1061
|
[key: string]: unknown;
|
|
354
1062
|
});
|
|
355
1063
|
}
|
|
356
1064
|
|
|
357
|
-
|
|
358
1065
|
declare class NotImplementedError extends Error {
|
|
359
1066
|
pluginName: string;
|
|
360
1067
|
methodName: string;
|
|
@@ -363,427 +1070,88 @@ declare class NotImplementedError extends Error {
|
|
|
363
1070
|
});
|
|
364
1071
|
}
|
|
365
1072
|
|
|
1073
|
+
type index_d$1_CanvasRenderingContext2DError = CanvasRenderingContext2DError;
|
|
1074
|
+
declare const index_d$1_CanvasRenderingContext2DError: typeof CanvasRenderingContext2DError;
|
|
1075
|
+
type index_d$1_InvalidFormatError = InvalidFormatError;
|
|
1076
|
+
declare const index_d$1_InvalidFormatError: typeof InvalidFormatError;
|
|
1077
|
+
type index_d$1_InvalidOptionError = InvalidOptionError;
|
|
1078
|
+
declare const index_d$1_InvalidOptionError: typeof InvalidOptionError;
|
|
1079
|
+
type index_d$1_NotImplementedError = NotImplementedError;
|
|
1080
|
+
declare const index_d$1_NotImplementedError: typeof NotImplementedError;
|
|
1081
|
+
declare namespace index_d$1 {
|
|
1082
|
+
export {
|
|
1083
|
+
index_d$1_CanvasRenderingContext2DError as CanvasRenderingContext2DError,
|
|
1084
|
+
index_d$1_InvalidFormatError as InvalidFormatError,
|
|
1085
|
+
index_d$1_InvalidOptionError as InvalidOptionError,
|
|
1086
|
+
index_d$1_NotImplementedError as NotImplementedError,
|
|
1087
|
+
};
|
|
1088
|
+
}
|
|
366
1089
|
|
|
367
|
-
export interface CommentEventBase {
|
|
368
|
-
type: CommentEventName;
|
|
369
|
-
timeStamp: number;
|
|
370
|
-
vpos: number;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
export interface SeekDisableEvent extends CommentEventBase {
|
|
374
|
-
type: "seekDisable";
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
export type SeekDisableEventHandler = (event: SeekDisableEvent) => unknown;
|
|
378
|
-
|
|
379
|
-
export interface SeekEnableEvent extends CommentEventBase {
|
|
380
|
-
type: "seekEnable";
|
|
381
|
-
}
|
|
382
|
-
export type SeekEnableEventHandler = (event: SeekEnableEvent) => unknown;
|
|
383
|
-
|
|
384
|
-
export interface CommentDisableEvent extends CommentEventBase {
|
|
385
|
-
type: "commentDisable";
|
|
386
|
-
}
|
|
387
|
-
export type CommentDisableEventHandler = (
|
|
388
|
-
event: CommentDisableEvent
|
|
389
|
-
) => unknown;
|
|
390
|
-
|
|
391
|
-
export interface CommentEnableEvent extends CommentEventBase {
|
|
392
|
-
type: "commentEnable";
|
|
393
|
-
}
|
|
394
|
-
export type CommentEnableEventHandler = (event: CommentEnableEvent) => unknown;
|
|
395
|
-
|
|
396
|
-
export interface JumpEvent extends CommentEventBase {
|
|
397
|
-
type: "jump";
|
|
398
|
-
to: string;
|
|
399
|
-
message?: string;
|
|
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
1090
|
declare const registerHandler: <K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]) => void;
|
|
432
1091
|
declare const removeHandler: <K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]) => void;
|
|
433
1092
|
declare const triggerHandler: (vpos: number, lastVpos: number) => void;
|
|
434
1093
|
|
|
1094
|
+
declare const eventHandler_d_registerHandler: typeof registerHandler;
|
|
1095
|
+
declare const eventHandler_d_removeHandler: typeof removeHandler;
|
|
1096
|
+
declare const eventHandler_d_triggerHandler: typeof triggerHandler;
|
|
1097
|
+
declare namespace eventHandler_d {
|
|
1098
|
+
export {
|
|
1099
|
+
eventHandler_d_registerHandler as registerHandler,
|
|
1100
|
+
eventHandler_d_removeHandler as removeHandler,
|
|
1101
|
+
eventHandler_d_triggerHandler as triggerHandler,
|
|
1102
|
+
};
|
|
1103
|
+
}
|
|
435
1104
|
|
|
436
|
-
|
|
437
|
-
| "win7"
|
|
438
|
-
| "win8_1"
|
|
439
|
-
| "win"
|
|
440
|
-
| "mac10_9"
|
|
441
|
-
| "mac10_11"
|
|
442
|
-
| "mac"
|
|
443
|
-
| "other";
|
|
444
|
-
export type HTML5Fonts = "gothic" | "mincho" | "defont";
|
|
445
|
-
export type FontItem = {
|
|
446
|
-
font: string;
|
|
447
|
-
offset: number;
|
|
448
|
-
weight: number;
|
|
449
|
-
};
|
|
450
|
-
export type platformFont = {
|
|
451
|
-
[key in HTML5Fonts]: FontItem;
|
|
452
|
-
};
|
|
453
|
-
|
|
454
|
-
export type formattedComment = {
|
|
455
|
-
id: number;
|
|
456
|
-
vpos: number;
|
|
457
|
-
content: string;
|
|
458
|
-
date: number;
|
|
459
|
-
date_usec: number;
|
|
460
|
-
owner: boolean;
|
|
461
|
-
premium: boolean;
|
|
462
|
-
mail: string[];
|
|
463
|
-
user_id: number;
|
|
464
|
-
layer: number;
|
|
465
|
-
};
|
|
466
|
-
export type formattedLegacyComment = {
|
|
467
|
-
id: number;
|
|
468
|
-
vpos: number;
|
|
469
|
-
content: string;
|
|
470
|
-
date: number;
|
|
471
|
-
date_usec: number;
|
|
472
|
-
owner: boolean;
|
|
473
|
-
premium: boolean;
|
|
474
|
-
mail: string[];
|
|
475
|
-
};
|
|
476
|
-
|
|
477
|
-
export type rawApiResponse = {
|
|
478
|
-
[key: string]: apiPing | apiThread | apiLeaf | apiGlobalNumRes | apiChat;
|
|
479
|
-
};
|
|
480
|
-
type apiPing = {
|
|
481
|
-
content: string;
|
|
482
|
-
};
|
|
483
|
-
type apiThread = {
|
|
484
|
-
resultcode: number;
|
|
485
|
-
thread: string;
|
|
486
|
-
server_time: number;
|
|
487
|
-
ticket: string;
|
|
488
|
-
revision: number;
|
|
489
|
-
};
|
|
490
|
-
type apiLeaf = {
|
|
491
|
-
thread: string;
|
|
492
|
-
count: number;
|
|
493
|
-
};
|
|
494
|
-
type apiGlobalNumRes = {
|
|
495
|
-
thread: string;
|
|
496
|
-
num_res: number;
|
|
497
|
-
};
|
|
498
|
-
type apiChat = {
|
|
499
|
-
thread: string;
|
|
500
|
-
no: number;
|
|
501
|
-
vpos: number;
|
|
502
|
-
date: number;
|
|
503
|
-
date_usec: number;
|
|
504
|
-
nicoru: number;
|
|
505
|
-
premium: number;
|
|
506
|
-
anonymity: number;
|
|
507
|
-
user_id: string;
|
|
508
|
-
mail: string;
|
|
509
|
-
content: string;
|
|
510
|
-
deleted: number;
|
|
511
|
-
};
|
|
512
|
-
|
|
513
|
-
export type ownerComment = {
|
|
514
|
-
time: string;
|
|
515
|
-
command: string;
|
|
516
|
-
comment: string;
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
export type v1Thread = {
|
|
520
|
-
id: string;
|
|
521
|
-
fork: string;
|
|
522
|
-
commentCount: number;
|
|
523
|
-
comments: v1Comment[];
|
|
524
|
-
};
|
|
525
|
-
type v1Comment = {
|
|
526
|
-
id: string;
|
|
527
|
-
no: number;
|
|
528
|
-
vposMs: number;
|
|
529
|
-
body: string;
|
|
530
|
-
commands: string[];
|
|
531
|
-
userId: string;
|
|
532
|
-
isPremium: boolean;
|
|
533
|
-
score: number;
|
|
534
|
-
postedAt: string;
|
|
535
|
-
nicoruCount: number;
|
|
536
|
-
nicoruId: undefined;
|
|
537
|
-
source: string;
|
|
538
|
-
isMyPost: boolean;
|
|
539
|
-
};
|
|
540
|
-
|
|
541
|
-
import type { commentLoc, formattedCommentWithSize } from "@/@types/";
|
|
542
|
-
|
|
543
|
-
export interface IComment {
|
|
544
|
-
comment: formattedCommentWithSize;
|
|
545
|
-
invisible: boolean;
|
|
546
|
-
loc: commentLoc;
|
|
547
|
-
width: number;
|
|
548
|
-
long: number;
|
|
549
|
-
height: number;
|
|
550
|
-
vpos: number;
|
|
551
|
-
flash: boolean;
|
|
552
|
-
posY: number;
|
|
553
|
-
owner: boolean;
|
|
554
|
-
layer: number;
|
|
555
|
-
mail: string[];
|
|
556
|
-
image?: HTMLCanvasElement | null;
|
|
557
|
-
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
|
-
|
|
1105
|
+
declare const convert2formattedComment: (data: unknown, type: InputFormatType) => FormattedComment[];
|
|
595
1106
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
new (Canvas: HTMLCanvasElement, comments: formattedComment[]): IPlugin;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
export interface IPlugin {
|
|
604
|
-
draw(vpos: number): void;
|
|
605
|
-
addComments(comments: formattedComment[]): void;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
import type { CommentEventHandlerMap, formattedComment, inputFormat, Options } from "@/@types/";
|
|
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;
|
|
1107
|
+
declare namespace inputParser_d {
|
|
1108
|
+
export {
|
|
1109
|
+
convert2formattedComment as default,
|
|
1110
|
+
};
|
|
695
1111
|
}
|
|
696
1112
|
|
|
697
|
-
|
|
698
|
-
import type {
|
|
699
|
-
Config,
|
|
700
|
-
formattedComment,
|
|
701
|
-
formattedLegacyComment,
|
|
702
|
-
ownerComment,
|
|
703
|
-
rawApiResponse,
|
|
704
|
-
v1Thread,
|
|
705
|
-
} from "@/@types/";
|
|
706
|
-
|
|
707
|
-
export type inputFormatType =
|
|
708
|
-
| "XMLDocument"
|
|
709
|
-
| "niconicome"
|
|
710
|
-
| "formatted"
|
|
711
|
-
| "legacy"
|
|
712
|
-
| "legacyOwner"
|
|
713
|
-
| "owner"
|
|
714
|
-
| "v1"
|
|
715
|
-
| "empty"
|
|
716
|
-
| "default";
|
|
717
|
-
export type inputFormat =
|
|
718
|
-
| XMLDocument
|
|
719
|
-
| formattedComment[]
|
|
720
|
-
| formattedLegacyComment[]
|
|
721
|
-
| rawApiResponse[]
|
|
722
|
-
| ownerComment[]
|
|
723
|
-
| v1Thread[]
|
|
724
|
-
| string
|
|
725
|
-
| undefined;
|
|
726
|
-
type modeType = "default" | "html5" | "flash";
|
|
727
|
-
type BaseOptions = {
|
|
728
|
-
config: Config;
|
|
729
|
-
debug: boolean;
|
|
730
|
-
enableLegacyPiP: boolean;
|
|
731
|
-
format: inputFormatType;
|
|
732
|
-
formatted: boolean;
|
|
733
|
-
keepCA: boolean;
|
|
734
|
-
mode: modeType;
|
|
735
|
-
scale: number;
|
|
736
|
-
showCollision: boolean;
|
|
737
|
-
showCommentCount: boolean;
|
|
738
|
-
showFPS: boolean;
|
|
739
|
-
useLegacy: boolean;
|
|
740
|
-
video: HTMLVideoElement | undefined;
|
|
741
|
-
};
|
|
742
|
-
export type Options = Partial<BaseOptions>;
|
|
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
1113
|
declare const typeGuard: {
|
|
746
1114
|
formatted: {
|
|
747
|
-
comment: (i: unknown) => i is
|
|
748
|
-
comments: (i: unknown) => i is
|
|
749
|
-
legacyComment: (i: unknown) => i is
|
|
750
|
-
legacyComments: (i: unknown) => i is
|
|
1115
|
+
comment: (i: unknown) => i is FormattedComment;
|
|
1116
|
+
comments: (i: unknown) => i is FormattedComment[];
|
|
1117
|
+
legacyComment: (i: unknown) => i is FormattedLegacyComment;
|
|
1118
|
+
legacyComments: (i: unknown) => i is FormattedLegacyComment[];
|
|
751
1119
|
};
|
|
752
1120
|
legacy: {
|
|
753
|
-
rawApiResponses: (i: unknown) => i is
|
|
754
|
-
apiChat: (i: unknown) => i is
|
|
755
|
-
apiGlobalNumRes: (i: unknown) => i is
|
|
756
|
-
apiLeaf: (i: unknown) => i is
|
|
757
|
-
apiPing: (i: unknown) => i is
|
|
758
|
-
apiThread: (i: unknown) => i is
|
|
1121
|
+
rawApiResponses: (i: unknown) => i is RawApiResponse[];
|
|
1122
|
+
apiChat: (i: unknown) => i is ApiChat;
|
|
1123
|
+
apiGlobalNumRes: (i: unknown) => i is ApiGlobalNumRes;
|
|
1124
|
+
apiLeaf: (i: unknown) => i is ApiLeaf;
|
|
1125
|
+
apiPing: (i: unknown) => i is ApiPing;
|
|
1126
|
+
apiThread: (i: unknown) => i is ApiThread;
|
|
759
1127
|
};
|
|
760
1128
|
xmlDocument: (i: unknown) => i is XMLDocument;
|
|
761
1129
|
legacyOwner: {
|
|
762
1130
|
comments: (i: unknown) => i is string;
|
|
763
1131
|
};
|
|
764
1132
|
owner: {
|
|
765
|
-
comment: (i: unknown) => i is
|
|
766
|
-
comments: (i: unknown) => i is
|
|
1133
|
+
comment: (i: unknown) => i is OwnerComment;
|
|
1134
|
+
comments: (i: unknown) => i is OwnerComment[];
|
|
767
1135
|
};
|
|
768
1136
|
v1: {
|
|
769
|
-
comment: (i: unknown) => i is
|
|
770
|
-
thread: (i: unknown) => i is
|
|
771
|
-
threads: (i: unknown) => i is
|
|
1137
|
+
comment: (i: unknown) => i is V1Comment;
|
|
1138
|
+
thread: (i: unknown) => i is V1Thread;
|
|
1139
|
+
threads: (i: unknown) => i is V1Thread[];
|
|
772
1140
|
};
|
|
773
1141
|
nicoScript: {
|
|
774
1142
|
range: {
|
|
775
|
-
target: (i: unknown) => i is
|
|
1143
|
+
target: (i: unknown) => i is NicoScriptReverseTarget;
|
|
776
1144
|
};
|
|
777
1145
|
replace: {
|
|
778
|
-
range: (i: unknown) => i is
|
|
779
|
-
target: (i: unknown) => i is
|
|
780
|
-
condition: (i: unknown) => i is
|
|
1146
|
+
range: (i: unknown) => i is NicoScriptReplaceRange;
|
|
1147
|
+
target: (i: unknown) => i is NicoScriptReplaceTarget;
|
|
1148
|
+
condition: (i: unknown) => i is NicoScriptReplaceCondition;
|
|
781
1149
|
};
|
|
782
1150
|
};
|
|
783
1151
|
comment: {
|
|
784
|
-
font: (i: unknown) => i is
|
|
785
|
-
loc: (i: unknown) => i is
|
|
786
|
-
size: (i: unknown) => i is
|
|
1152
|
+
font: (i: unknown) => i is CommentFont;
|
|
1153
|
+
loc: (i: unknown) => i is CommentLoc;
|
|
1154
|
+
size: (i: unknown) => i is CommentSize;
|
|
787
1155
|
command: {
|
|
788
1156
|
key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
|
|
789
1157
|
};
|
|
@@ -794,242 +1162,61 @@ declare const typeGuard: {
|
|
|
794
1162
|
config: {
|
|
795
1163
|
initOptions: (item: unknown) => item is Partial<BaseOptions>;
|
|
796
1164
|
};
|
|
1165
|
+
canvas: {
|
|
1166
|
+
nodeCanvas: (_: Canvas) => _ is NodeCanvas;
|
|
1167
|
+
nodeContext: (_: Context2D) => _ is NodeContext;
|
|
1168
|
+
};
|
|
797
1169
|
};
|
|
798
1170
|
|
|
1171
|
+
declare namespace typeGuard_d {
|
|
1172
|
+
export {
|
|
1173
|
+
typeGuard as default,
|
|
1174
|
+
};
|
|
1175
|
+
}
|
|
799
1176
|
|
|
800
|
-
import type { IComment } from "@/@types/";
|
|
801
|
-
|
|
802
|
-
type formattedCommentWithFont = {
|
|
803
|
-
id: number;
|
|
804
|
-
vpos: number;
|
|
805
|
-
date: number;
|
|
806
|
-
date_usec: number;
|
|
807
|
-
owner: boolean;
|
|
808
|
-
premium: boolean;
|
|
809
|
-
mail: string[];
|
|
810
|
-
user_id: number;
|
|
811
|
-
layer: number;
|
|
812
|
-
loc: commentLoc;
|
|
813
|
-
size: commentSize;
|
|
814
|
-
fontSize: number;
|
|
815
|
-
font: commentFont;
|
|
816
|
-
color: string;
|
|
817
|
-
strokeColor?: string;
|
|
818
|
-
wakuColor?: string;
|
|
819
|
-
full: boolean;
|
|
820
|
-
ender: boolean;
|
|
821
|
-
_live: boolean;
|
|
822
|
-
long: number;
|
|
823
|
-
invisible: boolean;
|
|
824
|
-
content: commentContentItem[];
|
|
825
|
-
flash: boolean;
|
|
826
|
-
lineCount: number;
|
|
827
|
-
lineOffset: number;
|
|
828
|
-
};
|
|
829
|
-
type formattedCommentWithSize = formattedCommentWithFont & {
|
|
830
|
-
height: number;
|
|
831
|
-
width: number;
|
|
832
|
-
lineHeight: number;
|
|
833
|
-
resized: boolean;
|
|
834
|
-
resizedX: boolean;
|
|
835
|
-
resizedY: boolean;
|
|
836
|
-
content: commentMeasuredContentItem[];
|
|
837
|
-
charSize: number;
|
|
838
|
-
};
|
|
839
|
-
type parsedComment = formattedCommentWithSize & {
|
|
840
|
-
posY: number;
|
|
841
|
-
image?: HTMLCanvasElement | boolean;
|
|
842
|
-
};
|
|
843
|
-
type commentContentItem = {
|
|
844
|
-
content: string;
|
|
845
|
-
slicedContent: string[];
|
|
846
|
-
font?: commentFlashFont;
|
|
847
|
-
width?: number[];
|
|
848
|
-
};
|
|
849
|
-
type commentMeasuredContentItem = commentContentItem & {
|
|
850
|
-
width: number[];
|
|
851
|
-
};
|
|
852
|
-
type commentContentIndex = {
|
|
853
|
-
index: number;
|
|
854
|
-
font: "gothic" | "gulim" | "simsunStrong" | "simsunWeak";
|
|
855
|
-
};
|
|
856
|
-
type commentFont = "defont" | "mincho" | "gothic" | "gulim" | "simsun";
|
|
857
|
-
type commentFlashFont = "defont" | "gulim" | "simsun";
|
|
858
|
-
type commentSize = "big" | "medium" | "small";
|
|
859
|
-
type commentLoc = "ue" | "naka" | "shita";
|
|
860
|
-
type collision = { [key in collisionPos]: collisionItem };
|
|
861
|
-
type Timeline = { [key: number]: IComment[] };
|
|
862
|
-
type collisionPos = "ue" | "shita" | "right" | "left";
|
|
863
|
-
type collisionItem = { [p: number]: IComment[] };
|
|
864
|
-
type nicoScript = {
|
|
865
|
-
reverse: nicoScriptReverse[];
|
|
866
|
-
ban: nicoScriptBan[];
|
|
867
|
-
default: nicoScriptDefault[];
|
|
868
|
-
replace: nicoScriptReplace[];
|
|
869
|
-
seekDisable: nicoScriptSeekDisable[];
|
|
870
|
-
jump: nicoScriptJump[];
|
|
871
|
-
};
|
|
872
|
-
type nicoScriptSeekDisable = {
|
|
873
|
-
start: number;
|
|
874
|
-
end: number;
|
|
875
|
-
};
|
|
876
|
-
type nicoScriptJump = {
|
|
877
|
-
start: number;
|
|
878
|
-
end?: number;
|
|
879
|
-
to: string;
|
|
880
|
-
message?: string;
|
|
881
|
-
};
|
|
882
|
-
type nicoScriptReverse = {
|
|
883
|
-
target: nicoScriptReverseTarget;
|
|
884
|
-
start: number;
|
|
885
|
-
end: number;
|
|
886
|
-
};
|
|
887
|
-
type nicoScriptReverseTarget = "コメ" | "投コメ" | "全";
|
|
888
|
-
type nicoScriptReplace = {
|
|
889
|
-
start: number;
|
|
890
|
-
long: number | undefined;
|
|
891
|
-
keyword: string;
|
|
892
|
-
replace: string;
|
|
893
|
-
range: nicoScriptReplaceRange;
|
|
894
|
-
target: nicoScriptReplaceTarget;
|
|
895
|
-
condition: nicoScriptReplaceCondition;
|
|
896
|
-
color: string | undefined;
|
|
897
|
-
size: commentSize | undefined;
|
|
898
|
-
font: commentFont | undefined;
|
|
899
|
-
loc: commentLoc | undefined;
|
|
900
|
-
no: number;
|
|
901
|
-
};
|
|
902
|
-
type nicoScriptReplaceRange = "単" | "全";
|
|
903
|
-
type nicoScriptReplaceTarget = "コメ" | "投コメ" | "全" | "含まない" | "含む";
|
|
904
|
-
type nicoScriptReplaceCondition = "完全一致" | "部分一致";
|
|
905
|
-
type nicoScriptBan = {
|
|
906
|
-
start: number;
|
|
907
|
-
end: number;
|
|
908
|
-
};
|
|
909
|
-
type nicoScriptDefault = {
|
|
910
|
-
start: number;
|
|
911
|
-
long: number | undefined;
|
|
912
|
-
color: string | undefined;
|
|
913
|
-
size: commentSize | undefined;
|
|
914
|
-
font: commentFont | undefined;
|
|
915
|
-
loc: commentLoc | undefined;
|
|
916
|
-
};
|
|
917
|
-
type measureTextResult = {
|
|
918
|
-
width: number;
|
|
919
|
-
height: number;
|
|
920
|
-
resized: boolean;
|
|
921
|
-
resizedX: boolean;
|
|
922
|
-
resizedY: boolean;
|
|
923
|
-
fontSize: number;
|
|
924
|
-
lineHeight: number;
|
|
925
|
-
content: commentMeasuredContentItem[];
|
|
926
|
-
charSize: number;
|
|
927
|
-
};
|
|
928
|
-
type parsedCommand = {
|
|
929
|
-
loc: commentLoc | undefined;
|
|
930
|
-
size: commentSize | undefined;
|
|
931
|
-
fontSize: number | undefined;
|
|
932
|
-
color: string | undefined;
|
|
933
|
-
strokeColor?: string;
|
|
934
|
-
wakuColor?: string;
|
|
935
|
-
font: commentFont | undefined;
|
|
936
|
-
full: boolean;
|
|
937
|
-
ender: boolean;
|
|
938
|
-
_live: boolean;
|
|
939
|
-
invisible: boolean;
|
|
940
|
-
long: number | undefined;
|
|
941
|
-
};
|
|
942
|
-
|
|
943
|
-
type measureTextInput = {
|
|
944
|
-
content: commentContentItem[];
|
|
945
|
-
resized?: boolean;
|
|
946
|
-
ender: boolean;
|
|
947
|
-
size: commentSize;
|
|
948
|
-
fontSize: number;
|
|
949
|
-
resizedY?: boolean;
|
|
950
|
-
resizedX?: boolean;
|
|
951
|
-
font: commentFont;
|
|
952
|
-
loc: commentLoc;
|
|
953
|
-
full: boolean;
|
|
954
|
-
flash: boolean;
|
|
955
|
-
lineCount: number;
|
|
956
|
-
lineHeight?: number;
|
|
957
|
-
charSize?: number;
|
|
958
|
-
};
|
|
959
|
-
|
|
960
|
-
type measureInput = {
|
|
961
|
-
font: commentFont;
|
|
962
|
-
content: commentContentItem[];
|
|
963
|
-
lineHeight: number;
|
|
964
|
-
charSize: number;
|
|
965
|
-
lineCount: number;
|
|
966
|
-
};
|
|
967
|
-
|
|
968
|
-
type valueOf<T> = T[keyof T];
|
|
969
|
-
|
|
970
|
-
import type { IComment } from "@/@types";
|
|
971
1177
|
declare const ArrayPush: (array: {
|
|
972
1178
|
[key: number]: IComment[];
|
|
973
1179
|
}, key: string | number, push: IComment) => void;
|
|
974
1180
|
declare const ArrayEqual: (a: unknown[], b: unknown[]) => boolean;
|
|
975
1181
|
|
|
976
|
-
|
|
977
|
-
import { formattedCommentWithSize } from "@/@types";
|
|
978
1182
|
declare const hex2rgb: (hex: string) => number[];
|
|
979
1183
|
declare const hex2rgba: (hex: string) => number[];
|
|
980
|
-
declare const getStrokeColor: (comment:
|
|
1184
|
+
declare const getStrokeColor: (comment: FormattedCommentWithSize) => string;
|
|
981
1185
|
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
color: string | undefined;
|
|
988
|
-
size: commentSize | undefined;
|
|
989
|
-
font: commentFont | undefined;
|
|
990
|
-
loc: commentLoc | undefined;
|
|
1186
|
+
type DefaultCommand = {
|
|
1187
|
+
color?: string;
|
|
1188
|
+
size?: CommentSize;
|
|
1189
|
+
font?: CommentFont;
|
|
1190
|
+
loc?: CommentLoc;
|
|
991
1191
|
};
|
|
992
|
-
|
|
993
|
-
declare const
|
|
1192
|
+
|
|
1193
|
+
declare const isLineBreakResize: (comment: MeasureTextInput) => boolean;
|
|
1194
|
+
declare const getDefaultCommand: (vpos: number) => DefaultCommand;
|
|
1195
|
+
declare const parseCommandAndNicoScript: (comment: FormattedComment) => ParseCommandAndNicoScriptResult;
|
|
1196
|
+
declare const isFlashComment: (comment: FormattedComment) => boolean;
|
|
994
1197
|
declare const isReverseActive: (vpos: number, isOwner: boolean) => boolean;
|
|
995
1198
|
declare const isBanActive: (vpos: number) => boolean;
|
|
996
|
-
declare const processFixedComment: (comment: IComment, collision:
|
|
997
|
-
declare const processMovableComment: (comment: IComment, collision:
|
|
1199
|
+
declare const processFixedComment: (comment: IComment, collision: CollisionItem, timeline: Timeline) => void;
|
|
1200
|
+
declare const processMovableComment: (comment: IComment, collision: Collision, timeline: Timeline) => void;
|
|
998
1201
|
declare const getPosY: (currentPos: number, targetComment: IComment, collision: IComment[] | undefined) => {
|
|
999
1202
|
currentPos: number;
|
|
1000
1203
|
isChanged: boolean;
|
|
1001
1204
|
isBreak: boolean;
|
|
1002
1205
|
};
|
|
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;
|
|
1206
|
+
declare const getPosX: (comment: FormattedCommentWithSize, vpos: number, isReverse?: boolean) => number;
|
|
1207
|
+
declare const parseFont: (font: CommentFont, size: string | number) => string;
|
|
1013
1208
|
|
|
1209
|
+
declare const changeCALayer: (rawData: FormattedComment[]) => FormattedComment[];
|
|
1014
1210
|
|
|
1015
|
-
|
|
1016
|
-
declare const getFlashFontIndex: (part: string) => commentContentIndex[];
|
|
1017
|
-
declare const getFlashFontName: (font: string) => commentFlashFont;
|
|
1211
|
+
declare const getConfig: <T>(input: ConfigItem<T>, isFlash?: boolean) => T;
|
|
1018
1212
|
|
|
1213
|
+
declare const getFlashFontIndex: (part: string) => CommentContentIndex[];
|
|
1214
|
+
declare const getFlashFontName: (font: string) => CommentFlashFont;
|
|
1215
|
+
declare const parseContent: (content: string) => CommentContentItem[];
|
|
1019
1216
|
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
export * from "./commentArt";
|
|
1024
|
-
export * from "./config";
|
|
1025
|
-
export * from "./flash";
|
|
1026
|
-
export * from "./niconico";
|
|
1027
|
-
export * from "./sort";
|
|
1028
|
-
|
|
1029
|
-
import type { commentSize, measureInput } from "@/@types";
|
|
1030
|
-
declare const getLineHeight: (fontSize: commentSize, isFlash: boolean, resized?: boolean) => number;
|
|
1031
|
-
declare const getCharSize: (fontSize: commentSize, isFlash: boolean) => number;
|
|
1032
|
-
declare const measure: (comment: measureInput, context: CanvasRenderingContext2D) => {
|
|
1217
|
+
declare const getLineHeight: (fontSize: CommentSize, isFlash: boolean, resized?: boolean) => number;
|
|
1218
|
+
declare const getCharSize: (fontSize: CommentSize, isFlash: boolean) => number;
|
|
1219
|
+
declare const measure: (comment: MeasureInput, context: Context2D) => {
|
|
1033
1220
|
height: number;
|
|
1034
1221
|
width: number;
|
|
1035
1222
|
lineWidth: number[];
|
|
@@ -1040,14 +1227,174 @@ declare const getFontSizeAndScale: (charSize: number) => {
|
|
|
1040
1227
|
fontSize: number;
|
|
1041
1228
|
};
|
|
1042
1229
|
|
|
1043
|
-
|
|
1044
|
-
import { formattedComment } from "@/@types";
|
|
1045
|
-
declare const createCommentInstance: (comment: formattedComment, context: CanvasRenderingContext2D) => BaseComment;
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
1230
|
declare const nativeSort: <T>(getter: (input: T) => number) => (a: T, b: T) => 1 | 0 | -1;
|
|
1049
1231
|
|
|
1232
|
+
declare const index_d_ArrayEqual: typeof ArrayEqual;
|
|
1233
|
+
declare const index_d_ArrayPush: typeof ArrayPush;
|
|
1234
|
+
declare const index_d_changeCALayer: typeof changeCALayer;
|
|
1235
|
+
declare const index_d_getCharSize: typeof getCharSize;
|
|
1236
|
+
declare const index_d_getConfig: typeof getConfig;
|
|
1237
|
+
declare const index_d_getDefaultCommand: typeof getDefaultCommand;
|
|
1238
|
+
declare const index_d_getFlashFontIndex: typeof getFlashFontIndex;
|
|
1239
|
+
declare const index_d_getFlashFontName: typeof getFlashFontName;
|
|
1240
|
+
declare const index_d_getFontSizeAndScale: typeof getFontSizeAndScale;
|
|
1241
|
+
declare const index_d_getLineHeight: typeof getLineHeight;
|
|
1242
|
+
declare const index_d_getPosX: typeof getPosX;
|
|
1243
|
+
declare const index_d_getPosY: typeof getPosY;
|
|
1244
|
+
declare const index_d_getStrokeColor: typeof getStrokeColor;
|
|
1245
|
+
declare const index_d_hex2rgb: typeof hex2rgb;
|
|
1246
|
+
declare const index_d_hex2rgba: typeof hex2rgba;
|
|
1247
|
+
declare const index_d_isBanActive: typeof isBanActive;
|
|
1248
|
+
declare const index_d_isFlashComment: typeof isFlashComment;
|
|
1249
|
+
declare const index_d_isLineBreakResize: typeof isLineBreakResize;
|
|
1250
|
+
declare const index_d_isReverseActive: typeof isReverseActive;
|
|
1251
|
+
declare const index_d_measure: typeof measure;
|
|
1252
|
+
declare const index_d_nativeSort: typeof nativeSort;
|
|
1253
|
+
declare const index_d_parseCommandAndNicoScript: typeof parseCommandAndNicoScript;
|
|
1254
|
+
declare const index_d_parseContent: typeof parseContent;
|
|
1255
|
+
declare const index_d_parseFont: typeof parseFont;
|
|
1256
|
+
declare const index_d_processFixedComment: typeof processFixedComment;
|
|
1257
|
+
declare const index_d_processMovableComment: typeof processMovableComment;
|
|
1258
|
+
declare namespace index_d {
|
|
1259
|
+
export {
|
|
1260
|
+
index_d_ArrayEqual as ArrayEqual,
|
|
1261
|
+
index_d_ArrayPush as ArrayPush,
|
|
1262
|
+
index_d_changeCALayer as changeCALayer,
|
|
1263
|
+
index_d_getCharSize as getCharSize,
|
|
1264
|
+
index_d_getConfig as getConfig,
|
|
1265
|
+
index_d_getDefaultCommand as getDefaultCommand,
|
|
1266
|
+
index_d_getFlashFontIndex as getFlashFontIndex,
|
|
1267
|
+
index_d_getFlashFontName as getFlashFontName,
|
|
1268
|
+
index_d_getFontSizeAndScale as getFontSizeAndScale,
|
|
1269
|
+
index_d_getLineHeight as getLineHeight,
|
|
1270
|
+
index_d_getPosX as getPosX,
|
|
1271
|
+
index_d_getPosY as getPosY,
|
|
1272
|
+
index_d_getStrokeColor as getStrokeColor,
|
|
1273
|
+
index_d_hex2rgb as hex2rgb,
|
|
1274
|
+
index_d_hex2rgba as hex2rgba,
|
|
1275
|
+
index_d_isBanActive as isBanActive,
|
|
1276
|
+
index_d_isFlashComment as isFlashComment,
|
|
1277
|
+
index_d_isLineBreakResize as isLineBreakResize,
|
|
1278
|
+
index_d_isReverseActive as isReverseActive,
|
|
1279
|
+
index_d_measure as measure,
|
|
1280
|
+
index_d_nativeSort as nativeSort,
|
|
1281
|
+
index_d_parseCommandAndNicoScript as parseCommandAndNicoScript,
|
|
1282
|
+
index_d_parseContent as parseContent,
|
|
1283
|
+
index_d_parseFont as parseFont,
|
|
1284
|
+
index_d_processFixedComment as processFixedComment,
|
|
1285
|
+
index_d_processMovableComment as processMovableComment,
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
declare const definition: {
|
|
1290
|
+
colors: typeof colors$1;
|
|
1291
|
+
config: typeof config$1;
|
|
1292
|
+
fonts: typeof fonts$1;
|
|
1293
|
+
initConfig: typeof initConfig$1;
|
|
1294
|
+
};
|
|
1050
1295
|
|
|
1296
|
+
declare const internal_definition: typeof definition;
|
|
1297
|
+
declare namespace internal {
|
|
1298
|
+
export {
|
|
1299
|
+
index_d$3 as comments,
|
|
1300
|
+
index_d$2 as contexts,
|
|
1301
|
+
internal_definition as definition,
|
|
1302
|
+
index_d$1 as errors,
|
|
1303
|
+
eventHandler_d as eventHandler,
|
|
1304
|
+
inputParser_d as inputParser,
|
|
1305
|
+
typeGuard_d as typeGuard,
|
|
1306
|
+
index_d as utils,
|
|
1307
|
+
};
|
|
1308
|
+
}
|
|
1051
1309
|
|
|
1310
|
+
declare class NiconiComments {
|
|
1311
|
+
enableLegacyPiP: boolean;
|
|
1312
|
+
showCollision: boolean;
|
|
1313
|
+
showFPS: boolean;
|
|
1314
|
+
showCommentCount: boolean;
|
|
1315
|
+
video: HTMLVideoElement | undefined;
|
|
1316
|
+
private lastVpos;
|
|
1317
|
+
private readonly canvas;
|
|
1318
|
+
private readonly collision;
|
|
1319
|
+
private readonly context;
|
|
1320
|
+
private readonly timeline;
|
|
1321
|
+
static typeGuard: {
|
|
1322
|
+
formatted: {
|
|
1323
|
+
comment: (i: unknown) => i is FormattedComment;
|
|
1324
|
+
comments: (i: unknown) => i is FormattedComment[];
|
|
1325
|
+
legacyComment: (i: unknown) => i is FormattedLegacyComment;
|
|
1326
|
+
legacyComments: (i: unknown) => i is FormattedLegacyComment[];
|
|
1327
|
+
};
|
|
1328
|
+
legacy: {
|
|
1329
|
+
rawApiResponses: (i: unknown) => i is RawApiResponse[];
|
|
1330
|
+
apiChat: (i: unknown) => i is ApiChat;
|
|
1331
|
+
apiGlobalNumRes: (i: unknown) => i is ApiGlobalNumRes;
|
|
1332
|
+
apiLeaf: (i: unknown) => i is ApiLeaf;
|
|
1333
|
+
apiPing: (i: unknown) => i is ApiPing;
|
|
1334
|
+
apiThread: (i: unknown) => i is ApiThread;
|
|
1335
|
+
};
|
|
1336
|
+
xmlDocument: (i: unknown) => i is XMLDocument;
|
|
1337
|
+
legacyOwner: {
|
|
1338
|
+
comments: (i: unknown) => i is string;
|
|
1339
|
+
};
|
|
1340
|
+
owner: {
|
|
1341
|
+
comment: (i: unknown) => i is OwnerComment;
|
|
1342
|
+
comments: (i: unknown) => i is OwnerComment[];
|
|
1343
|
+
};
|
|
1344
|
+
v1: {
|
|
1345
|
+
comment: (i: unknown) => i is V1Comment;
|
|
1346
|
+
thread: (i: unknown) => i is V1Thread;
|
|
1347
|
+
threads: (i: unknown) => i is V1Thread[];
|
|
1348
|
+
};
|
|
1349
|
+
nicoScript: {
|
|
1350
|
+
range: {
|
|
1351
|
+
target: (i: unknown) => i is NicoScriptReverseTarget;
|
|
1352
|
+
};
|
|
1353
|
+
replace: {
|
|
1354
|
+
range: (i: unknown) => i is NicoScriptReplaceRange;
|
|
1355
|
+
target: (i: unknown) => i is NicoScriptReplaceTarget;
|
|
1356
|
+
condition: (i: unknown) => i is NicoScriptReplaceCondition;
|
|
1357
|
+
};
|
|
1358
|
+
};
|
|
1359
|
+
comment: {
|
|
1360
|
+
font: (i: unknown) => i is CommentFont;
|
|
1361
|
+
loc: (i: unknown) => i is CommentLoc;
|
|
1362
|
+
size: (i: unknown) => i is CommentSize;
|
|
1363
|
+
command: {
|
|
1364
|
+
key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
|
|
1365
|
+
};
|
|
1366
|
+
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";
|
|
1367
|
+
colorCode: (i: unknown) => i is string;
|
|
1368
|
+
colorCodeAllowAlpha: (i: unknown) => i is string;
|
|
1369
|
+
};
|
|
1370
|
+
config: {
|
|
1371
|
+
initOptions: (item: unknown) => item is Partial<BaseOptions>;
|
|
1372
|
+
};
|
|
1373
|
+
canvas: {
|
|
1374
|
+
nodeCanvas: (_: Canvas) => _ is NodeCanvas;
|
|
1375
|
+
nodeContext: (_: Context2D) => _ is NodeContext;
|
|
1376
|
+
};
|
|
1377
|
+
};
|
|
1378
|
+
static default: typeof NiconiComments;
|
|
1379
|
+
static FlashComment: {
|
|
1380
|
+
condition: (comment: FormattedComment) => boolean;
|
|
1381
|
+
class: typeof FlashComment;
|
|
1382
|
+
};
|
|
1383
|
+
static internal: typeof internal;
|
|
1384
|
+
constructor(canvas: Canvas, data: InputFormat, initOptions?: Options);
|
|
1385
|
+
private preRendering;
|
|
1386
|
+
private getCommentPos;
|
|
1387
|
+
private sortComment;
|
|
1388
|
+
addComments(...rawComments: FormattedComment[]): void;
|
|
1389
|
+
drawCanvas(vpos: number, forceRendering?: boolean): boolean;
|
|
1390
|
+
private _drawVideo;
|
|
1391
|
+
private _drawComments;
|
|
1392
|
+
private _drawCollision;
|
|
1393
|
+
private _drawFPS;
|
|
1394
|
+
private _drawCommentCount;
|
|
1395
|
+
addEventListener<K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]): void;
|
|
1396
|
+
removeEventListener<K extends keyof CommentEventHandlerMap>(eventName: K, handler: CommentEventHandlerMap[K]): void;
|
|
1397
|
+
clear(): void;
|
|
1398
|
+
}
|
|
1052
1399
|
|
|
1053
|
-
export default
|
|
1400
|
+
export { ApiChat, ApiGlobalNumRes, ApiLeaf, ApiPing, ApiThread, AvifConfig, BaseConfig, BaseOptions, Canvas, ChromaSubsampling, Collision, CollisionItem, CollisionPos, ColorSpace, CommentContentIndex, CommentContentItem, CommentDisableEvent, CommentDisableEventHandler, CommentEnableEvent, CommentEnableEventHandler, CommentEventBase, CommentEventHandler, CommentEventHandlerMap, CommentEventMap, CommentEventName, CommentFlashFont, CommentFont, CommentLoc, CommentMeasuredContentItem, CommentSize, CommentStageSize, Config, ConfigItem, Context2D, ContextAttributes, FlashMode, FlashScriptChar, FontItem, FormattedComment, FormattedCommentWithFont, FormattedCommentWithSize, FormattedLegacyComment, HTML5Fonts, IComment, IPlugin, IPluginConstructor, Image, InputFormat, InputFormatType, JumpEvent, JumpEventHandler, MeasureInput, MeasureTextInput, MeasureTextResult, NicoScript, NicoScriptReplace, NicoScriptReplaceCondition, NicoScriptReplaceRange, NicoScriptReplaceTarget, NicoScriptReverseTarget, NodeCanvas, NodeContext, Options, OwnerComment, ParseCommandAndNicoScriptResult, ParseContentResult, ParsedCommand, Platform, PlatformFont, RawApiResponse, SeekDisableEvent, SeekDisableEventHandler, SeekEnableEvent, SeekEnableEventHandler, SvgExportFlag, Timeline, V1Comment, V1Thread, ValueOf, NiconiComments as default, formattedComment, formattedLegacyComment, inputFormat, inputFormatType, ownerComment, rawApiResponse, v1Thread };
|