@xpadev-net/niconicomments 0.2.47 → 0.2.49
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/dist/bundle.d.ts +835 -593
- package/dist/bundle.js +2971 -2683
- package/package.json +71 -67
- package/LICENSE_JP +0 -11
package/dist/bundle.d.ts
CHANGED
|
@@ -1,377 +1,520 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
get
|
|
14
|
-
get
|
|
15
|
-
get
|
|
16
|
-
get
|
|
17
|
-
get
|
|
18
|
-
get
|
|
19
|
-
get
|
|
20
|
-
get
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
import type { formattedComment, formattedCommentWithSize, IComment } from "@/@types/";
|
|
2
|
+
import { formattedCommentWithFont, measureTextInput, measureTextResult } from "@/@types/";
|
|
3
|
+
declare class BaseComment implements IComment {
|
|
4
|
+
protected readonly context: CanvasRenderingContext2D;
|
|
5
|
+
protected readonly cacheKey: string;
|
|
6
|
+
comment: formattedCommentWithSize;
|
|
7
|
+
posY: number;
|
|
8
|
+
readonly pluginName: string;
|
|
9
|
+
image?: HTMLCanvasElement | null;
|
|
10
|
+
constructor(comment: formattedComment, context: CanvasRenderingContext2D);
|
|
11
|
+
get invisible(): boolean;
|
|
12
|
+
get loc(): commentLoc;
|
|
13
|
+
get long(): number;
|
|
14
|
+
get vpos(): number;
|
|
15
|
+
get width(): number;
|
|
16
|
+
get height(): number;
|
|
17
|
+
get flash(): boolean;
|
|
18
|
+
get layer(): number;
|
|
19
|
+
get owner(): boolean;
|
|
20
|
+
get mail(): string[];
|
|
21
|
+
protected getCommentSize(parsedData: formattedCommentWithFont): formattedCommentWithSize;
|
|
22
|
+
protected parseCommandAndNicoscript(comment: formattedComment): formattedCommentWithFont;
|
|
23
|
+
protected measureText(comment: measureTextInput): measureTextResult;
|
|
24
|
+
protected convertComment(comment: formattedComment): formattedCommentWithSize;
|
|
25
|
+
draw(vpos: number, showCollision: boolean, debug: boolean): void;
|
|
26
|
+
protected _draw(posX: number, posY: number): void;
|
|
27
|
+
protected _drawRectColor(posX: number, posY: number): void;
|
|
28
|
+
protected _drawDebugInfo(posX: number, posY: number, debug: boolean): void;
|
|
29
|
+
protected _drawCollision(posX: number, posY: number, showCollision: boolean): void;
|
|
30
|
+
protected getTextImage(): HTMLCanvasElement | null;
|
|
31
|
+
protected _generateTextImage(): HTMLCanvasElement;
|
|
32
|
+
protected _cacheImage(image: HTMLCanvasElement): void;
|
|
33
|
+
protected createCanvas(): {
|
|
34
|
+
image: HTMLCanvasElement;
|
|
35
|
+
context: CanvasRenderingContext2D;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
31
38
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
declare class HTML5Comment implements IComment {
|
|
36
|
-
private readonly context;
|
|
37
|
-
readonly comment: formattedCommentWithSize;
|
|
38
|
-
posY: number;
|
|
39
|
-
image?: HTMLCanvasElement | null;
|
|
40
|
-
constructor(comment: formattedComment, context: CanvasRenderingContext2D);
|
|
41
|
-
get invisible(): boolean;
|
|
42
|
-
get loc(): commentLoc;
|
|
43
|
-
get long(): number;
|
|
44
|
-
get vpos(): number;
|
|
45
|
-
get width(): number;
|
|
46
|
-
get height(): number;
|
|
47
|
-
get flash(): boolean;
|
|
48
|
-
get layer(): number;
|
|
49
|
-
get owner(): boolean;
|
|
50
|
-
get mail(): string[];
|
|
51
|
-
get lineCount(): number;
|
|
52
|
-
parseCommandAndNicoscript(comment: formattedComment): formattedCommentWithFont;
|
|
53
|
-
measureText(comment: measureTextInput): measureTextResult;
|
|
54
|
-
getCommentSize(parsedData: formattedCommentWithFont): formattedCommentWithSize;
|
|
55
|
-
draw(vpos: number, showCollision: boolean, debug: boolean): void;
|
|
56
|
-
getTextImage(): HTMLCanvasElement | null;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
39
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
40
|
+
import type { formattedComment, formattedCommentWithFont, formattedCommentWithSize, measureTextInput, measureTextResult } from "@/@types/";
|
|
41
|
+
import { BaseComment } from "./BaseComment";
|
|
42
|
+
declare class FlashComment extends BaseComment {
|
|
43
|
+
private _globalScale;
|
|
44
|
+
private scale;
|
|
45
|
+
private scaleX;
|
|
46
|
+
readonly pluginName: string;
|
|
47
|
+
constructor(comment: formattedComment, context: CanvasRenderingContext2D);
|
|
48
|
+
convertComment(comment: formattedComment): formattedCommentWithSize;
|
|
49
|
+
getCommentSize(parsedData: formattedCommentWithFont): formattedCommentWithSize;
|
|
50
|
+
parseCommandAndNicoscript(comment: formattedComment): formattedCommentWithFont;
|
|
51
|
+
measureText(comment: measureTextInput): measureTextResult;
|
|
52
|
+
_drawCollision(posX: number, posY: number, showCollision: boolean): void;
|
|
53
|
+
_generateTextImage(): HTMLCanvasElement;
|
|
54
|
+
}
|
|
68
55
|
|
|
69
|
-
|
|
70
|
-
declare let nicoScripts: nicoScript;
|
|
71
|
-
declare const resetNicoScripts: () => void;
|
|
72
|
-
|
|
73
56
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
declare
|
|
77
|
-
|
|
57
|
+
import type { formattedComment, formattedCommentWithFont, formattedCommentWithSize, measureTextInput, measureTextResult } from "@/@types/";
|
|
58
|
+
import { BaseComment } from "./BaseComment";
|
|
59
|
+
declare class HTML5Comment extends BaseComment {
|
|
60
|
+
readonly pluginName: string;
|
|
61
|
+
constructor(comment: formattedComment, context: CanvasRenderingContext2D);
|
|
62
|
+
convertComment(comment: formattedComment): formattedCommentWithSize;
|
|
63
|
+
getCommentSize(parsedData: formattedCommentWithFont): formattedCommentWithSize;
|
|
64
|
+
parseCommandAndNicoscript(comment: formattedComment): formattedCommentWithFont;
|
|
65
|
+
measureText(comment: measureTextInput): measureTextResult;
|
|
66
|
+
private _measureComment;
|
|
67
|
+
private _processResizeX;
|
|
68
|
+
_drawCollision(posX: number, posY: number, showCollision: boolean): void;
|
|
69
|
+
_generateTextImage(): HTMLCanvasElement;
|
|
70
|
+
}
|
|
78
71
|
|
|
79
|
-
declare const colors: {
|
|
80
|
-
white: string;
|
|
81
|
-
red: string;
|
|
82
|
-
pink: string;
|
|
83
|
-
orange: string;
|
|
84
|
-
yellow: string;
|
|
85
|
-
green: string;
|
|
86
|
-
cyan: string;
|
|
87
|
-
blue: string;
|
|
88
|
-
purple: string;
|
|
89
|
-
black: string;
|
|
90
|
-
white2: string;
|
|
91
|
-
niconicowhite: string;
|
|
92
|
-
red2: string;
|
|
93
|
-
truered: string;
|
|
94
|
-
pink2: string;
|
|
95
|
-
orange2: string;
|
|
96
|
-
passionorange: string;
|
|
97
|
-
yellow2: string;
|
|
98
|
-
madyellow: string;
|
|
99
|
-
green2: string;
|
|
100
|
-
elementalgreen: string;
|
|
101
|
-
cyan2: string;
|
|
102
|
-
blue2: string;
|
|
103
|
-
marinblue: string;
|
|
104
|
-
purple2: string;
|
|
105
|
-
nobleviolet: string;
|
|
106
|
-
black2: string;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
72
|
|
|
73
|
+
export * from "./BaseComment";
|
|
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/";
|
|
110
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 };
|
|
111
88
|
|
|
112
|
-
|
|
113
|
-
declare const initConfig: () => void;
|
|
114
|
-
declare const defaultOptions: BaseOptions;
|
|
115
|
-
declare let config: BaseConfig;
|
|
116
|
-
declare let options: BaseOptions;
|
|
117
|
-
declare const setConfig: (value: BaseConfig) => BaseConfig;
|
|
118
|
-
declare const setOptions: (value: BaseOptions) => BaseOptions;
|
|
89
|
+
type commentStageSize = { width: number; fullWidth: number; height: number };
|
|
119
90
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
font: string;
|
|
184
|
-
offset: number;
|
|
185
|
-
weight: number;
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
declare const fonts: {
|
|
189
|
-
win7: {
|
|
190
|
-
defont: FontItem;
|
|
191
|
-
gothic: FontItem;
|
|
192
|
-
mincho: FontItem;
|
|
193
|
-
};
|
|
194
|
-
win8_1: {
|
|
195
|
-
defont: FontItem;
|
|
196
|
-
gothic: FontItem;
|
|
197
|
-
mincho: FontItem;
|
|
198
|
-
};
|
|
199
|
-
win: {
|
|
200
|
-
defont: FontItem;
|
|
201
|
-
gothic: FontItem;
|
|
202
|
-
mincho: FontItem;
|
|
203
|
-
};
|
|
204
|
-
mac10_9: {
|
|
205
|
-
defont: FontItem;
|
|
206
|
-
gothic: FontItem;
|
|
207
|
-
mincho: FontItem;
|
|
208
|
-
};
|
|
209
|
-
mac10_11: {
|
|
210
|
-
defont: FontItem;
|
|
211
|
-
gothic: FontItem;
|
|
212
|
-
mincho: FontItem;
|
|
213
|
-
};
|
|
214
|
-
mac: {
|
|
215
|
-
defont: FontItem;
|
|
216
|
-
gothic: FontItem;
|
|
217
|
-
mincho: FontItem;
|
|
218
|
-
};
|
|
219
|
-
other: {
|
|
220
|
-
defont: FontItem;
|
|
221
|
-
gothic: FontItem;
|
|
222
|
-
mincho: FontItem;
|
|
223
|
-
};
|
|
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;
|
|
224
154
|
};
|
|
225
155
|
|
|
156
|
+
export type Config = Partial<BaseConfig>;
|
|
226
157
|
|
|
158
|
+
declare let imageCache: {
|
|
159
|
+
[key: string]: {
|
|
160
|
+
image: HTMLCanvasElement;
|
|
161
|
+
timeout: number;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
declare const resetImageCache: () => void;
|
|
227
165
|
|
|
228
166
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
167
|
+
export * from "./cache";
|
|
168
|
+
export * from "./nicoscript";
|
|
169
|
+
export * from "./plugins";
|
|
232
170
|
|
|
233
|
-
type
|
|
171
|
+
import type { nicoScript } from "@/@types/";
|
|
172
|
+
declare let nicoScripts: nicoScript;
|
|
173
|
+
declare const resetNicoScripts: () => void;
|
|
234
174
|
|
|
235
|
-
type flashCharList = {
|
|
236
|
-
[key in "simsunStrong" | "simsunWeak" | "gulim" | "gothic"]: string;
|
|
237
|
-
};
|
|
238
|
-
type flashMode = "xp" | "vista";
|
|
239
|
-
type flashScriptChar = {
|
|
240
|
-
[key in "super" | "sub"]: string;
|
|
241
|
-
};
|
|
242
|
-
type fontList = {
|
|
243
|
-
[key in "gulim" | "simsun"]: string;
|
|
244
|
-
};
|
|
245
|
-
type lineCounts = {
|
|
246
|
-
[key in "default" | "resized" | "doubleResized"]: configSizeItem<number>;
|
|
247
|
-
};
|
|
248
|
-
type typeDoubleResizeMaxWidth = {
|
|
249
|
-
[key in "full" | "normal"]: number;
|
|
250
|
-
};
|
|
251
175
|
|
|
252
|
-
type
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
canvasWidth: number;
|
|
256
|
-
collisionRange: { [key in "left" | "right"]: number };
|
|
257
|
-
colors: { [key: string]: string };
|
|
258
|
-
commentDrawPadding: number;
|
|
259
|
-
commentDrawRange: number;
|
|
260
|
-
commentScale: configItem<number>;
|
|
261
|
-
commentStageSize: configItem<commentStageSize>;
|
|
262
|
-
commentYMarginBottom: configSizeItem<number>;
|
|
263
|
-
commentYOffset: configSizeItem<configResizedItem<number>>;
|
|
264
|
-
commentYPaddingTop: configResizedItem<number>;
|
|
265
|
-
contextFillLiveOpacity: number;
|
|
266
|
-
contextLineWidth: number;
|
|
267
|
-
contextStrokeColor: string;
|
|
268
|
-
contextStrokeInversionColor: string;
|
|
269
|
-
contextStrokeOpacity: number;
|
|
270
|
-
doubleResizeMaxWidth: configItem<typeDoubleResizeMaxWidth>;
|
|
271
|
-
flashChar: flashCharList;
|
|
272
|
-
flashMode: flashMode;
|
|
273
|
-
flashScriptChar: flashScriptChar;
|
|
274
|
-
flashThreshold: number;
|
|
275
|
-
font: fontList;
|
|
276
|
-
fonts: platformFont;
|
|
277
|
-
fontSize: configItem<configSizeItem<configResizedItem<number>>>;
|
|
278
|
-
fpsInterval: number;
|
|
279
|
-
hiResCommentCorrection: number;
|
|
280
|
-
lineCounts: configItem<lineCounts>;
|
|
281
|
-
lineHeight: configItem<configSizeItem<configResizedItem<number>>>;
|
|
282
|
-
minFontSize: number;
|
|
283
|
-
sameCAGap: number;
|
|
284
|
-
sameCAMinScore: number;
|
|
285
|
-
sameCARange: number;
|
|
286
|
-
letterSpacing: number;
|
|
287
|
-
scriptCharOffset: number;
|
|
288
|
-
plugins: IPluginConstructor[];
|
|
289
|
-
};
|
|
176
|
+
import type { IPlugin } from "@/@types/";
|
|
177
|
+
declare let plugins: IPlugin[];
|
|
178
|
+
declare const setPlugins: (input: IPlugin[]) => void;
|
|
290
179
|
|
|
291
|
-
export type Config = Partial<BaseConfig>;
|
|
292
|
-
|
|
293
|
-
type platform =
|
|
294
|
-
| "win7"
|
|
295
|
-
| "win8_1"
|
|
296
|
-
| "win"
|
|
297
|
-
| "mac10_9"
|
|
298
|
-
| "mac10_11"
|
|
299
|
-
| "mac"
|
|
300
|
-
| "other";
|
|
301
|
-
type HTML5Fonts = "gothic" | "mincho" | "defont";
|
|
302
|
-
type FontItem = {
|
|
303
|
-
font: string;
|
|
304
|
-
offset: number;
|
|
305
|
-
weight: number;
|
|
306
|
-
};
|
|
307
|
-
type platformFont = {
|
|
308
|
-
[key in HTML5Fonts]: FontItem;
|
|
309
|
-
};
|
|
310
180
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
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;
|
|
332
209
|
};
|
|
333
210
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
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
|
+
};
|
|
354
289
|
};
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
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
|
+
};
|
|
368
326
|
};
|
|
369
327
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
328
|
+
|
|
329
|
+
declare const initConfig: () => void;
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
declare class CanvasRenderingContext2DError extends Error {
|
|
333
|
+
constructor(options?: {
|
|
334
|
+
[key: string]: unknown;
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
export * from "./CanvasRenderingContext2DError";
|
|
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
|
+
});
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
declare class InvalidOptionError extends Error {
|
|
352
|
+
constructor(options?: {
|
|
353
|
+
[key: string]: unknown;
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
declare class NotImplementedError extends Error {
|
|
359
|
+
pluginName: string;
|
|
360
|
+
methodName: string;
|
|
361
|
+
constructor(pluginName: string, methodName: string, options?: {
|
|
362
|
+
[key: string]: unknown;
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
|
|
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
|
+
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
|
+
|
|
435
|
+
|
|
436
|
+
export type platform =
|
|
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
|
+
};
|
|
375
518
|
|
|
376
519
|
export type v1Thread = {
|
|
377
520
|
id: string;
|
|
@@ -395,82 +538,266 @@ type v1Comment = {
|
|
|
395
538
|
isMyPost: boolean;
|
|
396
539
|
};
|
|
397
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
|
+
}
|
|
398
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";
|
|
399
571
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
invisible: boolean;
|
|
403
|
-
loc: commentLoc;
|
|
404
|
-
width: number;
|
|
405
|
-
long: number;
|
|
406
|
-
height: number;
|
|
407
|
-
vpos: number;
|
|
408
|
-
flash: boolean;
|
|
409
|
-
posY: number;
|
|
410
|
-
owner: boolean;
|
|
411
|
-
layer: number;
|
|
412
|
-
mail: string[];
|
|
413
|
-
image?: HTMLCanvasElement | null;
|
|
414
|
-
getTextImage: (vpos: number) => void;
|
|
415
|
-
draw: (vpos: number, showCollision: boolean, isDebug: boolean) => void;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
export interface IPluginConstructor {
|
|
421
|
-
id: string;
|
|
422
|
-
new (Canvas: HTMLCanvasElement, comments: formattedComment[]): IPlugin;
|
|
423
|
-
}
|
|
572
|
+
import type { formattedComment, inputFormatType } from "@/@types/";
|
|
573
|
+
declare const convert2formattedComment: (data: unknown, type: inputFormatType) => formattedComment[];
|
|
424
574
|
|
|
425
|
-
export interface IPlugin {
|
|
426
|
-
draw(vpos: number): void;
|
|
427
|
-
addComments(comments: formattedComment[]): void;
|
|
428
|
-
}
|
|
429
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
|
+
};
|
|
430
594
|
|
|
431
595
|
|
|
596
|
+
import type { formattedComment } from "@/@types/";
|
|
597
|
+
|
|
598
|
+
export interface IPluginConstructor {
|
|
599
|
+
id: string;
|
|
600
|
+
new (Canvas: HTMLCanvasElement, comments: formattedComment[]): IPlugin;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
export interface IPlugin {
|
|
604
|
+
draw(vpos: number): void;
|
|
605
|
+
addComments(comments: formattedComment[]): void;
|
|
606
|
+
}
|
|
432
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;
|
|
695
|
+
}
|
|
433
696
|
|
|
434
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>;
|
|
435
743
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
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
|
+
};
|
|
470
797
|
};
|
|
471
|
-
export type Options = Partial<BaseOptions>;
|
|
472
798
|
|
|
473
|
-
|
|
799
|
+
|
|
800
|
+
import type { IComment } from "@/@types/";
|
|
474
801
|
|
|
475
802
|
type formattedCommentWithFont = {
|
|
476
803
|
id: number;
|
|
@@ -515,6 +842,7 @@ type parsedComment = formattedCommentWithSize & {
|
|
|
515
842
|
};
|
|
516
843
|
type commentContentItem = {
|
|
517
844
|
content: string;
|
|
845
|
+
slicedContent: string[];
|
|
518
846
|
font?: commentFlashFont;
|
|
519
847
|
width?: number[];
|
|
520
848
|
};
|
|
@@ -530,6 +858,7 @@ type commentFlashFont = "defont" | "gulim" | "simsun";
|
|
|
530
858
|
type commentSize = "big" | "medium" | "small";
|
|
531
859
|
type commentLoc = "ue" | "naka" | "shita";
|
|
532
860
|
type collision = { [key in collisionPos]: collisionItem };
|
|
861
|
+
type Timeline = { [key: number]: IComment[] };
|
|
533
862
|
type collisionPos = "ue" | "shita" | "right" | "left";
|
|
534
863
|
type collisionItem = { [p: number]: IComment[] };
|
|
535
864
|
type nicoScript = {
|
|
@@ -537,6 +866,18 @@ type nicoScript = {
|
|
|
537
866
|
ban: nicoScriptBan[];
|
|
538
867
|
default: nicoScriptDefault[];
|
|
539
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;
|
|
540
881
|
};
|
|
541
882
|
type nicoScriptReverse = {
|
|
542
883
|
target: nicoScriptReverseTarget;
|
|
@@ -623,189 +964,90 @@ type measureInput = {
|
|
|
623
964
|
charSize: number;
|
|
624
965
|
lineCount: number;
|
|
625
966
|
};
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
declare const convert2formattedComment: (data: unknown, type: inputFormatType) => formattedComment[];
|
|
630
967
|
|
|
968
|
+
type valueOf<T> = T[keyof T];
|
|
631
969
|
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
970
|
+
import type { IComment } from "@/@types";
|
|
971
|
+
declare const ArrayPush: (array: {
|
|
972
|
+
[key: number]: IComment[];
|
|
973
|
+
}, key: string | number, push: IComment) => void;
|
|
974
|
+
declare const ArrayEqual: (a: unknown[], b: unknown[]) => boolean;
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
import { formattedCommentWithSize } from "@/@types";
|
|
978
|
+
declare const hex2rgb: (hex: string) => number[];
|
|
979
|
+
declare const hex2rgba: (hex: string) => number[];
|
|
980
|
+
declare const getStrokeColor: (comment: formattedCommentWithSize) => string;
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
import type { collision, commentFont, commentLoc, commentSize, formattedComment, formattedCommentWithFont, formattedCommentWithSize, measureTextInput } from "@/@types/";
|
|
984
|
+
import { collisionItem, IComment, Timeline } from "@/@types/";
|
|
985
|
+
declare const isLineBreakResize: (comment: measureTextInput) => boolean;
|
|
986
|
+
declare const getDefaultCommand: (vpos: number) => {
|
|
987
|
+
color: string | undefined;
|
|
988
|
+
size: commentSize | undefined;
|
|
989
|
+
font: commentFont | undefined;
|
|
990
|
+
loc: commentLoc | undefined;
|
|
991
|
+
};
|
|
992
|
+
declare const parseCommandAndNicoScript: (comment: formattedComment) => formattedCommentWithFont;
|
|
993
|
+
declare const isFlashComment: (comment: formattedComment) => boolean;
|
|
994
|
+
declare const isReverseActive: (vpos: number, isOwner: boolean) => boolean;
|
|
995
|
+
declare const isBanActive: (vpos: number) => boolean;
|
|
996
|
+
declare const processFixedComment: (comment: IComment, collision: collisionItem, timeline: Timeline) => void;
|
|
997
|
+
declare const processMovableComment: (comment: IComment, collision: collision, timeline: Timeline) => void;
|
|
998
|
+
declare const getPosY: (currentPos: number, targetComment: IComment, collision: IComment[] | undefined) => {
|
|
999
|
+
currentPos: number;
|
|
1000
|
+
isChanged: boolean;
|
|
1001
|
+
isBreak: boolean;
|
|
1002
|
+
};
|
|
1003
|
+
declare const getPosX: (comment: formattedCommentWithSize, vpos: number, isReverse?: boolean) => number;
|
|
1004
|
+
declare const parseFont: (font: commentFont, size: string | number) => string;
|
|
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
|
+
|
|
1014
|
+
|
|
1015
|
+
import type { commentContentIndex, commentFlashFont } from "@/@types";
|
|
1016
|
+
declare const getFlashFontIndex: (part: string) => commentContentIndex[];
|
|
1017
|
+
declare const getFlashFontName: (font: string) => commentFlashFont;
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
export * from "./array";
|
|
1021
|
+
export * from "./color";
|
|
1022
|
+
export * from "./comment";
|
|
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) => {
|
|
1033
|
+
height: number;
|
|
1034
|
+
width: number;
|
|
1035
|
+
lineWidth: number[];
|
|
1036
|
+
itemWidth: number[][];
|
|
1037
|
+
};
|
|
1038
|
+
declare const getFontSizeAndScale: (charSize: number) => {
|
|
1039
|
+
scale: number;
|
|
1040
|
+
fontSize: number;
|
|
1041
|
+
};
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
import { formattedComment } from "@/@types";
|
|
1045
|
+
declare const createCommentInstance: (comment: formattedComment, context: CanvasRenderingContext2D) => BaseComment;
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
declare const nativeSort: <T>(getter: (input: T) => number) => (a: T, b: T) => 1 | 0 | -1;
|
|
707
1049
|
|
|
708
|
-
|
|
709
|
-
declare const getLineHeight: (fontSize: commentSize, isFlash: boolean, resized?: boolean) => number;
|
|
710
|
-
declare const getCharSize: (fontSize: commentSize, isFlash: boolean) => number;
|
|
711
|
-
declare const measure: (comment: measureInput, context: CanvasRenderingContext2D) => {
|
|
712
|
-
height: number;
|
|
713
|
-
width: number;
|
|
714
|
-
lineWidth: number[];
|
|
715
|
-
itemWidth: number[][];
|
|
716
|
-
};
|
|
717
|
-
declare const getFontSizeAndScale: (charSize: number) => {
|
|
718
|
-
scale: number;
|
|
719
|
-
fontSize: number;
|
|
720
|
-
};
|
|
721
|
-
|
|
722
1050
|
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
declare const typeGuard: {
|
|
729
|
-
formatted: {
|
|
730
|
-
comment: (i: unknown) => i is formattedComment;
|
|
731
|
-
comments: (i: unknown) => i is formattedComment[];
|
|
732
|
-
legacyComment: (i: unknown) => i is formattedLegacyComment;
|
|
733
|
-
legacyComments: (i: unknown) => i is formattedLegacyComment[];
|
|
734
|
-
};
|
|
735
|
-
legacy: {
|
|
736
|
-
rawApiResponses: (i: unknown) => i is rawApiResponse[];
|
|
737
|
-
apiChat: (i: unknown) => i is apiChat;
|
|
738
|
-
apiGlobalNumRes: (i: unknown) => i is apiGlobalNumRes;
|
|
739
|
-
apiLeaf: (i: unknown) => i is apiLeaf;
|
|
740
|
-
apiPing: (i: unknown) => i is apiPing;
|
|
741
|
-
apiThread: (i: unknown) => i is apiThread;
|
|
742
|
-
};
|
|
743
|
-
xmlDocument: (i: unknown) => i is XMLDocument;
|
|
744
|
-
legacyOwner: {
|
|
745
|
-
comments: (i: unknown) => i is string;
|
|
746
|
-
};
|
|
747
|
-
owner: {
|
|
748
|
-
comment: (i: unknown) => i is ownerComment;
|
|
749
|
-
comments: (i: unknown) => i is ownerComment[];
|
|
750
|
-
};
|
|
751
|
-
v1: {
|
|
752
|
-
comment: (i: unknown) => i is v1Comment;
|
|
753
|
-
thread: (i: unknown) => i is v1Thread;
|
|
754
|
-
threads: (i: unknown) => i is v1Thread[];
|
|
755
|
-
};
|
|
756
|
-
nicoScript: {
|
|
757
|
-
range: {
|
|
758
|
-
target: (i: unknown) => i is nicoScriptReverseTarget;
|
|
759
|
-
};
|
|
760
|
-
replace: {
|
|
761
|
-
range: (i: unknown) => i is nicoScriptReplaceRange;
|
|
762
|
-
target: (i: unknown) => i is nicoScriptReplaceTarget;
|
|
763
|
-
condition: (i: unknown) => i is nicoScriptReplaceCondition;
|
|
764
|
-
};
|
|
765
|
-
};
|
|
766
|
-
comment: {
|
|
767
|
-
font: (i: unknown) => i is commentFont;
|
|
768
|
-
loc: (i: unknown) => i is commentLoc;
|
|
769
|
-
size: (i: unknown) => i is commentSize;
|
|
770
|
-
command: {
|
|
771
|
-
key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
|
|
772
|
-
};
|
|
773
|
-
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";
|
|
774
|
-
colorCode: (i: unknown) => i is string;
|
|
775
|
-
};
|
|
776
|
-
config: {
|
|
777
|
-
initOptions: (item: unknown) => item is Partial<BaseOptions>;
|
|
778
|
-
};
|
|
779
|
-
};
|
|
780
|
-
|
|
781
1051
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
declare const getPosY: (currentPos: number, targetComment: IComment, collision: IComment[] | undefined) => {
|
|
788
|
-
currentPos: number;
|
|
789
|
-
isChanged: boolean;
|
|
790
|
-
isBreak: boolean;
|
|
791
|
-
};
|
|
792
|
-
declare const getPosX: (width: number, vpos: number, long: number) => number;
|
|
793
|
-
declare const parseFont: (font: commentFont, size: string | number) => string;
|
|
794
|
-
declare const arrayPush: (array: {
|
|
795
|
-
[key: number]: IComment[];
|
|
796
|
-
}, key: string | number, push: IComment) => void;
|
|
797
|
-
declare const hex2rgb: (hex: string) => number[];
|
|
798
|
-
declare const hex2rgba: (hex: string) => number[];
|
|
799
|
-
declare const changeCALayer: (rawData: formattedComment[]) => formattedComment[];
|
|
800
|
-
declare const getConfig: <T>(input: configItem<T>, isFlash?: boolean) => T;
|
|
801
|
-
declare const isFlashComment: (comment: formattedComment) => boolean;
|
|
802
|
-
declare const parseCommandAndNicoScript: (comment: formattedComment) => formattedCommentWithFont;
|
|
803
|
-
declare const getStrokeColor: (comment: formattedCommentWithSize) => string;
|
|
804
|
-
declare const ArrayEqual: (a: unknown[], b: unknown[]) => boolean;
|
|
805
|
-
declare const getFlashFontIndex: (part: string) => commentContentIndex[];
|
|
806
|
-
declare const getFlashFontName: (font: string) => commentFlashFont;
|
|
807
|
-
declare const getValue: <T>(value: T | null | undefined, alternative: T) => T;
|
|
808
|
-
declare const nativeSort: <T>(getter: (input: T) => number) => (a: T, b: T) => 0 | 1 | -1;
|
|
809
|
-
|
|
810
1052
|
|
|
811
1053
|
export default NiconiComments;
|