@xpadev-net/niconicomments 0.2.45 → 0.2.46

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 CHANGED
@@ -1,229 +1,260 @@
1
-
2
-
3
-
4
- declare class FlashComment implements IComment {
5
- private readonly context;
6
- readonly comment: formattedCommentWithSize;
7
- private readonly _globalScale;
8
- private scale;
9
- private scaleX;
10
- posY: number;
11
- image?: HTMLCanvasElement | null;
12
- constructor(comment: formattedComment, context: CanvasRenderingContext2D);
13
- get invisible(): boolean;
14
- get loc(): commentLoc;
15
- get long(): number;
16
- get vpos(): number;
17
- get width(): number;
18
- get height(): number;
19
- get flash(): boolean;
20
- get layer(): number;
21
- get owner(): boolean;
22
- get mail(): string[];
23
- get lineCount(): number;
24
- parseCommand(comment: formattedComment): parsedCommand;
25
- parseCommandAndNicoscript(comment: formattedComment): formattedCommentWithFont;
26
- measureText(comment: measureTextInput): measureTextResult;
27
- getCommentSize(parsedData: formattedCommentWithFont): formattedCommentWithSize;
28
- draw(vpos: number, showCollision: boolean, debug: boolean): void;
29
- getTextImage(): HTMLCanvasElement | null;
30
- }
31
-
32
-
33
-
34
-
35
-
36
- declare class HTML5Comment implements IComment {
37
- private readonly context;
38
- readonly comment: formattedCommentWithSize;
39
- posY: number;
40
- image?: HTMLCanvasElement | null;
41
- constructor(comment: formattedComment, context: CanvasRenderingContext2D);
42
- get invisible(): boolean;
43
- get loc(): commentLoc;
44
- get long(): number;
45
- get vpos(): number;
46
- get width(): number;
47
- get height(): number;
48
- get flash(): boolean;
49
- get layer(): number;
50
- get owner(): boolean;
51
- get mail(): string[];
52
- get lineCount(): number;
53
- parseCommandAndNicoscript(comment: formattedComment): formattedCommentWithFont;
54
- measureText(comment: measureTextInput): measureTextResult;
55
- getCommentSize(parsedData: formattedCommentWithFont): formattedCommentWithSize;
56
- draw(vpos: number, showCollision: boolean, debug: boolean): void;
57
- getTextImage(): HTMLCanvasElement | null;
58
- }
59
-
60
-
61
- declare let imageCache: {
62
- [key: string]: {
63
- image: HTMLCanvasElement;
64
- timeout: number;
65
- };
66
- };
67
- declare const resetImageCache: () => void;
68
-
69
-
70
-
71
- declare let nicoScripts: nicoScript;
72
- declare const resetNicoScripts: () => void;
73
-
74
-
75
-
76
- declare let plugins: IPlugin[];
77
- declare const setPlugins: (input: IPlugin[]) => void;
78
-
79
-
80
- declare const colors: {
81
- white: string;
82
- red: string;
83
- pink: string;
84
- orange: string;
85
- yellow: string;
86
- green: string;
87
- cyan: string;
88
- blue: string;
89
- purple: string;
90
- black: string;
91
- white2: string;
92
- niconicowhite: string;
93
- red2: string;
94
- truered: string;
95
- pink2: string;
96
- orange2: string;
97
- passionorange: string;
98
- yellow2: string;
99
- madyellow: string;
100
- green2: string;
101
- elementalgreen: string;
102
- cyan2: string;
103
- blue2: string;
104
- marinblue: string;
105
- purple2: string;
106
- nobleviolet: string;
107
- black2: string;
108
- };
109
-
110
-
111
-
112
-
113
- declare let defaultConfig: BaseConfig;
114
- declare const initConfig: () => void;
115
- declare const defaultOptions: BaseOptions;
116
- declare let config: BaseConfig;
117
- declare let options: BaseOptions;
118
- declare const setConfig: (value: BaseConfig) => BaseConfig;
119
- declare const setOptions: (value: BaseOptions) => BaseOptions;
120
-
121
-
122
- declare const fontTemplates: {
123
- arial: {
124
- font: string;
125
- offset: number;
126
- weight: number;
127
- };
128
- gothic: {
129
- font: string;
130
- offset: number;
131
- weight: number;
132
- };
133
- gulim: {
134
- font: string;
135
- offset: number;
136
- weight: number;
137
- };
138
- mincho: {
139
- font: string;
140
- offset: number;
141
- weight: number;
142
- };
143
- simsun: {
144
- font: string;
145
- offset: number;
146
- weight: number;
147
- };
148
- macGothicPro6: {
149
- font: string;
150
- offset: number;
151
- weight: number;
152
- };
153
- macGothicPro3: {
154
- font: string;
155
- offset: number;
156
- weight: number;
157
- };
158
- macMincho: {
159
- font: string;
160
- offset: number;
161
- weight: number;
162
- };
163
- macGothic1: {
164
- font: string;
165
- offset: number;
166
- weight: number;
167
- };
168
- macGothic2: {
169
- font: string;
170
- offset: number;
171
- weight: number;
172
- };
173
- sansSerif600: {
174
- font: string;
175
- offset: number;
176
- weight: number;
177
- };
178
- sansSerif400: {
179
- font: string;
180
- offset: number;
181
- weight: number;
182
- };
183
- serif: {
184
- font: string;
185
- offset: number;
186
- weight: number;
187
- };
188
- };
189
- declare const fonts: {
190
- win7: {
191
- defont: FontItem;
192
- gothic: FontItem;
193
- mincho: FontItem;
194
- };
195
- win8_1: {
196
- defont: FontItem;
197
- gothic: FontItem;
198
- mincho: FontItem;
199
- };
200
- win: {
201
- defont: FontItem;
202
- gothic: FontItem;
203
- mincho: FontItem;
204
- };
205
- mac10_9: {
206
- defont: FontItem;
207
- gothic: FontItem;
208
- mincho: FontItem;
209
- };
210
- mac10_11: {
211
- defont: FontItem;
212
- gothic: FontItem;
213
- mincho: FontItem;
214
- };
215
- mac: {
216
- defont: FontItem;
217
- gothic: FontItem;
218
- mincho: FontItem;
219
- };
220
- other: {
221
- defont: FontItem;
222
- gothic: FontItem;
223
- mincho: FontItem;
224
- };
225
- };
226
-
1
+
2
+
3
+
4
+ declare class FlashComment implements IComment {
5
+ private readonly context;
6
+ readonly comment: formattedCommentWithSize;
7
+ private readonly _globalScale;
8
+ private scale;
9
+ private scaleX;
10
+ posY: number;
11
+ image?: HTMLCanvasElement | null;
12
+ constructor(comment: formattedComment, context: CanvasRenderingContext2D);
13
+ get invisible(): boolean;
14
+ get loc(): commentLoc;
15
+ get long(): number;
16
+ get vpos(): number;
17
+ get width(): number;
18
+ get height(): number;
19
+ get flash(): boolean;
20
+ get layer(): number;
21
+ get owner(): boolean;
22
+ get mail(): string[];
23
+ get lineCount(): number;
24
+ parseCommandAndNicoscript(comment: formattedComment): formattedCommentWithFont;
25
+ measureText(comment: measureTextInput): measureTextResult;
26
+ getCommentSize(parsedData: formattedCommentWithFont): formattedCommentWithSize;
27
+ draw(vpos: number, showCollision: boolean, debug: boolean): void;
28
+ getTextImage(): HTMLCanvasElement | null;
29
+ }
30
+
31
+
32
+
33
+
34
+
35
+ declare class HTML5Comment implements IComment {
36
+ private readonly context;
37
+ readonly comment: formattedCommentWithSize;
38
+ posY: number;
39
+ image?: HTMLCanvasElement | null;
40
+ constructor(comment: formattedComment, context: CanvasRenderingContext2D);
41
+ get invisible(): boolean;
42
+ get loc(): commentLoc;
43
+ get long(): number;
44
+ get vpos(): number;
45
+ get width(): number;
46
+ get height(): number;
47
+ get flash(): boolean;
48
+ get layer(): number;
49
+ get owner(): boolean;
50
+ get mail(): string[];
51
+ get lineCount(): number;
52
+ parseCommandAndNicoscript(comment: formattedComment): formattedCommentWithFont;
53
+ measureText(comment: measureTextInput): measureTextResult;
54
+ getCommentSize(parsedData: formattedCommentWithFont): formattedCommentWithSize;
55
+ draw(vpos: number, showCollision: boolean, debug: boolean): void;
56
+ getTextImage(): HTMLCanvasElement | null;
57
+ }
58
+
59
+
60
+ declare let imageCache: {
61
+ [key: string]: {
62
+ image: HTMLCanvasElement;
63
+ timeout: number;
64
+ };
65
+ };
66
+ declare const resetImageCache: () => void;
67
+
68
+
69
+
70
+ declare let nicoScripts: nicoScript;
71
+ declare const resetNicoScripts: () => void;
72
+
73
+
74
+
75
+ declare let plugins: IPlugin[];
76
+ declare const setPlugins: (input: IPlugin[]) => void;
77
+
78
+
79
+ declare const colors: {
80
+ white: string;
81
+ red: string;
82
+ pink: string;
83
+ orange: string;
84
+ yellow: string;
85
+ green: string;
86
+ cyan: string;
87
+ blue: string;
88
+ purple: string;
89
+ black: string;
90
+ white2: string;
91
+ niconicowhite: string;
92
+ red2: string;
93
+ truered: string;
94
+ pink2: string;
95
+ orange2: string;
96
+ passionorange: string;
97
+ yellow2: string;
98
+ madyellow: string;
99
+ green2: string;
100
+ elementalgreen: string;
101
+ cyan2: string;
102
+ blue2: string;
103
+ marinblue: string;
104
+ purple2: string;
105
+ nobleviolet: string;
106
+ black2: string;
107
+ };
108
+
109
+
110
+
111
+
112
+ declare let defaultConfig: BaseConfig;
113
+ declare const initConfig: () => void;
114
+ declare const defaultOptions: BaseOptions;
115
+ declare let config: BaseConfig;
116
+ declare let options: BaseOptions;
117
+ declare const setConfig: (value: BaseConfig) => BaseConfig;
118
+ declare const setOptions: (value: BaseOptions) => BaseOptions;
119
+
120
+
121
+ declare const fontTemplates: {
122
+ arial: {
123
+ font: string;
124
+ offset: number;
125
+ weight: number;
126
+ };
127
+ gothic: {
128
+ font: string;
129
+ offset: number;
130
+ weight: number;
131
+ };
132
+ gulim: {
133
+ font: string;
134
+ offset: number;
135
+ weight: number;
136
+ };
137
+ mincho: {
138
+ font: string;
139
+ offset: number;
140
+ weight: number;
141
+ };
142
+ simsun: {
143
+ font: string;
144
+ offset: number;
145
+ weight: number;
146
+ };
147
+ macGothicPro6: {
148
+ font: string;
149
+ offset: number;
150
+ weight: number;
151
+ };
152
+ macGothicPro3: {
153
+ font: string;
154
+ offset: number;
155
+ weight: number;
156
+ };
157
+ macMincho: {
158
+ font: string;
159
+ offset: number;
160
+ weight: number;
161
+ };
162
+ macGothic1: {
163
+ font: string;
164
+ offset: number;
165
+ weight: number;
166
+ };
167
+ macGothic2: {
168
+ font: string;
169
+ offset: number;
170
+ weight: number;
171
+ };
172
+ sansSerif600: {
173
+ font: string;
174
+ offset: number;
175
+ weight: number;
176
+ };
177
+ sansSerif400: {
178
+ font: string;
179
+ offset: number;
180
+ weight: number;
181
+ };
182
+ serif: {
183
+ font: string;
184
+ offset: number;
185
+ weight: number;
186
+ };
187
+ };
188
+ declare const fonts: {
189
+ win7: {
190
+ defont: FontItem;
191
+ gothic: FontItem;
192
+ mincho: FontItem;
193
+ };
194
+ win8_1: {
195
+ defont: FontItem;
196
+ gothic: FontItem;
197
+ mincho: FontItem;
198
+ };
199
+ win: {
200
+ defont: FontItem;
201
+ gothic: FontItem;
202
+ mincho: FontItem;
203
+ };
204
+ mac10_9: {
205
+ defont: FontItem;
206
+ gothic: FontItem;
207
+ mincho: FontItem;
208
+ };
209
+ mac10_11: {
210
+ defont: FontItem;
211
+ gothic: FontItem;
212
+ mincho: FontItem;
213
+ };
214
+ mac: {
215
+ defont: FontItem;
216
+ gothic: FontItem;
217
+ mincho: FontItem;
218
+ };
219
+ other: {
220
+ defont: FontItem;
221
+ gothic: FontItem;
222
+ mincho: FontItem;
223
+ };
224
+ };
225
+
226
+
227
+
228
+
229
+ export interface IComment {
230
+ comment: formattedCommentWithSize;
231
+ invisible: boolean;
232
+ loc: commentLoc;
233
+ width: number;
234
+ long: number;
235
+ height: number;
236
+ vpos: number;
237
+ flash: boolean;
238
+ posY: number;
239
+ owner: boolean;
240
+ layer: number;
241
+ mail: string[];
242
+ image?: HTMLCanvasElement | null;
243
+ getTextImage: (vpos: number) => void;
244
+ draw: (vpos: number, showCollision: boolean, isDebug: boolean) => void;
245
+ }
246
+
247
+
248
+
249
+ export interface IPluginConstructor {
250
+ id: string;
251
+ new (Canvas: HTMLCanvasElement, comments: formattedComment[]): IPlugin;
252
+ }
253
+
254
+ export interface IPlugin {
255
+ draw(vpos: number): void;
256
+ addComments(comments: formattedComment[]): void;
257
+ }
227
258
 
228
259
 
229
260
 
@@ -378,7 +409,7 @@ export type v1Thread = {
378
409
  id: string;
379
410
  fork: string;
380
411
  commentCount: number;
381
- comments: { [key: string]: v1Comment };
412
+ comments: v1Comment[];
382
413
  };
383
414
  type v1Comment = {
384
415
  id: string;
@@ -398,38 +429,6 @@ type v1Comment = {
398
429
 
399
430
 
400
431
 
401
- export interface IComment {
402
- comment: formattedCommentWithSize;
403
- invisible: boolean;
404
- loc: commentLoc;
405
- width: number;
406
- long: number;
407
- height: number;
408
- vpos: number;
409
- flash: boolean;
410
- posY: number;
411
- owner: boolean;
412
- layer: number;
413
- mail: string[];
414
- image?: HTMLCanvasElement | null;
415
- getTextImage: (vpos: number) => void;
416
- draw: (vpos: number, showCollision: boolean, isDebug: boolean) => void;
417
- }
418
-
419
-
420
-
421
- export interface IPluginConstructor {
422
- id: string;
423
- new (Canvas: HTMLCanvasElement, comments: formattedComment[]): IPlugin;
424
- }
425
-
426
- export interface IPlugin {
427
- draw(vpos: number): void;
428
- addComments(comments: formattedComment[]): void;
429
- }
430
-
431
-
432
-
433
432
 
434
433
 
435
434
 
@@ -489,6 +488,7 @@ type formattedCommentWithFont = {
489
488
  font: commentFont;
490
489
  color: string;
491
490
  strokeColor?: string;
491
+ wakuColor?: string;
492
492
  full: boolean;
493
493
  ender: boolean;
494
494
  _live: boolean;
@@ -590,6 +590,7 @@ type parsedCommand = {
590
590
  fontSize: number | undefined;
591
591
  color: string | undefined;
592
592
  strokeColor?: string;
593
+ wakuColor?: string;
593
594
  font: commentFont | undefined;
594
595
  full: boolean;
595
596
  ender: boolean;
@@ -623,183 +624,188 @@ type measureInput = {
623
624
  lineCount: number;
624
625
  };
625
626
 
626
-
627
-
628
- declare const convert2formattedComment: (data: unknown, type: inputFormatType) => formattedComment[];
629
-
630
-
631
-
632
-
633
- declare class NiconiComments {
634
- enableLegacyPiP: boolean;
635
- showCollision: boolean;
636
- showFPS: boolean;
637
- showCommentCount: boolean;
638
- video: HTMLVideoElement | undefined;
639
- private lastVpos;
640
- private readonly canvas;
641
- private readonly collision;
642
- private readonly context;
643
- private readonly timeline;
644
- static typeGuard: {
645
- formatted: {
646
- comment: (i: unknown) => i is formattedComment;
647
- comments: (i: unknown) => i is formattedComment[];
648
- legacyComment: (i: unknown) => i is formattedLegacyComment;
649
- legacyComments: (i: unknown) => i is formattedLegacyComment[];
650
- };
651
- legacy: {
652
- rawApiResponses: (i: unknown) => i is rawApiResponse[];
653
- apiChat: (i: unknown) => i is apiChat;
654
- apiGlobalNumRes: (i: unknown) => i is apiGlobalNumRes;
655
- apiLeaf: (i: unknown) => i is apiLeaf;
656
- apiPing: (i: unknown) => i is apiPing;
657
- apiThread: (i: unknown) => i is apiThread;
658
- };
659
- xmlDocument: (i: unknown) => i is XMLDocument;
660
- legacyOwner: {
661
- comments: (i: unknown) => i is string;
662
- };
663
- owner: {
664
- comment: (i: unknown) => i is ownerComment;
665
- comments: (i: unknown) => i is ownerComment[];
666
- };
667
- v1: {
668
- comment: (i: unknown) => i is v1Comment;
669
- thread: (i: unknown) => i is v1Thread;
670
- threads: (i: unknown) => i is v1Thread[];
671
- };
672
- nicoScript: {
673
- range: {
674
- target: (i: unknown) => i is nicoScriptReverseTarget;
675
- };
676
- replace: {
677
- range: (i: unknown) => i is nicoScriptReplaceRange;
678
- target: (i: unknown) => i is nicoScriptReplaceTarget;
679
- condition: (i: unknown) => i is nicoScriptReplaceCondition;
680
- };
681
- };
682
- comment: {
683
- font: (i: unknown) => i is commentFont;
684
- loc: (i: unknown) => i is commentLoc;
685
- size: (i: unknown) => i is commentSize;
686
- command: {
687
- key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
688
- };
689
- 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";
690
- colorCode: (i: unknown) => i is string;
691
- };
692
- config: {
693
- initOptions: (item: unknown) => item is Partial<BaseOptions>;
694
- };
695
- };
696
- static default: typeof NiconiComments;
697
- constructor(canvas: HTMLCanvasElement, data: inputFormat, initOptions?: Options);
698
- private preRendering;
699
- private getCommentPos;
700
- private sortComment;
701
- addComments(...rawComments: formattedComment[]): void;
702
- drawCanvas(vpos: number, forceRendering?: boolean): boolean;
703
- clear(): void;
704
- }
705
-
706
-
707
-
708
- declare const getLineHeight: (fontSize: commentSize, isFlash: boolean, resized?: boolean) => number;
709
- declare const getCharSize: (fontSize: commentSize, isFlash: boolean) => number;
710
- declare const measure: (comment: measureInput, context: CanvasRenderingContext2D) => {
711
- height: number;
712
- width: number;
713
- lineWidth: number[];
714
- itemWidth: number[][];
715
- };
716
- declare const getFontSizeAndScale: (charSize: number) => {
717
- scale: number;
718
- fontSize: number;
719
- };
720
-
721
-
722
-
723
-
724
-
725
-
726
-
727
- declare const typeGuard: {
728
- formatted: {
729
- comment: (i: unknown) => i is formattedComment;
730
- comments: (i: unknown) => i is formattedComment[];
731
- legacyComment: (i: unknown) => i is formattedLegacyComment;
732
- legacyComments: (i: unknown) => i is formattedLegacyComment[];
733
- };
734
- legacy: {
735
- rawApiResponses: (i: unknown) => i is rawApiResponse[];
736
- apiChat: (i: unknown) => i is apiChat;
737
- apiGlobalNumRes: (i: unknown) => i is apiGlobalNumRes;
738
- apiLeaf: (i: unknown) => i is apiLeaf;
739
- apiPing: (i: unknown) => i is apiPing;
740
- apiThread: (i: unknown) => i is apiThread;
741
- };
742
- xmlDocument: (i: unknown) => i is XMLDocument;
743
- legacyOwner: {
744
- comments: (i: unknown) => i is string;
745
- };
746
- owner: {
747
- comment: (i: unknown) => i is ownerComment;
748
- comments: (i: unknown) => i is ownerComment[];
749
- };
750
- v1: {
751
- comment: (i: unknown) => i is v1Comment;
752
- thread: (i: unknown) => i is v1Thread;
753
- threads: (i: unknown) => i is v1Thread[];
754
- };
755
- nicoScript: {
756
- range: {
757
- target: (i: unknown) => i is nicoScriptReverseTarget;
758
- };
759
- replace: {
760
- range: (i: unknown) => i is nicoScriptReplaceRange;
761
- target: (i: unknown) => i is nicoScriptReplaceTarget;
762
- condition: (i: unknown) => i is nicoScriptReplaceCondition;
763
- };
764
- };
765
- comment: {
766
- font: (i: unknown) => i is commentFont;
767
- loc: (i: unknown) => i is commentLoc;
768
- size: (i: unknown) => i is commentSize;
769
- command: {
770
- key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
771
- };
772
- 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";
773
- colorCode: (i: unknown) => i is string;
774
- };
775
- config: {
776
- initOptions: (item: unknown) => item is Partial<BaseOptions>;
777
- };
778
- };
779
-
780
-
781
-
782
-
783
-
784
-
785
- declare const getPosY: (currentPos: number, targetComment: IComment, collision: IComment[] | undefined) => {
786
- currentPos: number;
787
- isChanged: boolean;
788
- isBreak: boolean;
789
- };
790
- declare const getPosX: (width: number, vpos: number, long: number) => number;
791
- declare const parseFont: (font: commentFont, size: string | number) => string;
792
- declare const arrayPush: (array: {
793
- [key: number]: IComment[];
794
- }, key: string | number, push: IComment) => void;
795
- declare const hex2rgb: (hex: string) => number[];
796
- declare const hex2rgba: (hex: string) => number[];
797
- declare const changeCALayer: (rawData: formattedComment[]) => formattedComment[];
798
- declare const getConfig: <T>(input: configItem<T>, isFlash?: boolean) => T;
799
- declare const isFlashComment: (comment: formattedComment) => boolean;
800
- declare const parseCommandAndNicoScript: (comment: formattedComment) => formattedCommentWithFont;
801
- declare const getStrokeColor: (comment: formattedCommentWithSize) => string;
802
- declare const ArrayEqual: (a: unknown[], b: unknown[]) => boolean;
803
-
627
+
628
+
629
+ declare const convert2formattedComment: (data: unknown, type: inputFormatType) => formattedComment[];
630
+
631
+
632
+
633
+
634
+ declare class NiconiComments {
635
+ enableLegacyPiP: boolean;
636
+ showCollision: boolean;
637
+ showFPS: boolean;
638
+ showCommentCount: boolean;
639
+ video: HTMLVideoElement | undefined;
640
+ private lastVpos;
641
+ private readonly canvas;
642
+ private readonly collision;
643
+ private readonly context;
644
+ private readonly timeline;
645
+ static typeGuard: {
646
+ formatted: {
647
+ comment: (i: unknown) => i is formattedComment;
648
+ comments: (i: unknown) => i is formattedComment[];
649
+ legacyComment: (i: unknown) => i is formattedLegacyComment;
650
+ legacyComments: (i: unknown) => i is formattedLegacyComment[];
651
+ };
652
+ legacy: {
653
+ rawApiResponses: (i: unknown) => i is rawApiResponse[];
654
+ apiChat: (i: unknown) => i is apiChat;
655
+ apiGlobalNumRes: (i: unknown) => i is apiGlobalNumRes;
656
+ apiLeaf: (i: unknown) => i is apiLeaf;
657
+ apiPing: (i: unknown) => i is apiPing;
658
+ apiThread: (i: unknown) => i is apiThread;
659
+ };
660
+ xmlDocument: (i: unknown) => i is XMLDocument;
661
+ legacyOwner: {
662
+ comments: (i: unknown) => i is string;
663
+ };
664
+ owner: {
665
+ comment: (i: unknown) => i is ownerComment;
666
+ comments: (i: unknown) => i is ownerComment[];
667
+ };
668
+ v1: {
669
+ comment: (i: unknown) => i is v1Comment;
670
+ thread: (i: unknown) => i is v1Thread;
671
+ threads: (i: unknown) => i is v1Thread[];
672
+ };
673
+ nicoScript: {
674
+ range: {
675
+ target: (i: unknown) => i is nicoScriptReverseTarget;
676
+ };
677
+ replace: {
678
+ range: (i: unknown) => i is nicoScriptReplaceRange;
679
+ target: (i: unknown) => i is nicoScriptReplaceTarget;
680
+ condition: (i: unknown) => i is nicoScriptReplaceCondition;
681
+ };
682
+ };
683
+ comment: {
684
+ font: (i: unknown) => i is commentFont;
685
+ loc: (i: unknown) => i is commentLoc;
686
+ size: (i: unknown) => i is commentSize;
687
+ command: {
688
+ key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
689
+ };
690
+ 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";
691
+ colorCode: (i: unknown) => i is string;
692
+ };
693
+ config: {
694
+ initOptions: (item: unknown) => item is Partial<BaseOptions>;
695
+ };
696
+ };
697
+ static default: typeof NiconiComments;
698
+ constructor(canvas: HTMLCanvasElement, data: inputFormat, initOptions?: Options);
699
+ private preRendering;
700
+ private getCommentPos;
701
+ private sortComment;
702
+ addComments(...rawComments: formattedComment[]): void;
703
+ drawCanvas(vpos: number, forceRendering?: boolean): boolean;
704
+ clear(): void;
705
+ }
706
+
707
+
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
+
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
+
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
+
804
810
 
805
811
  export default NiconiComments;