@xpadev-net/niconicomments 0.2.23 → 0.2.25
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.md +42 -42
- package/dist/bundle.d.ts +368 -0
- package/dist/bundle.js +1503 -1510
- package/package.json +61 -60
- package/dist/dts/types.d.ts +0 -226
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 xpadev-net
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 xpadev-net
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
# [niconicomments](https://xpadev.net/niconicomments/)
|
|
2
|
-
[](https://github.com/xpadev-net/niconicomments/blob/master/LICENSE)
|
|
3
|
-
[](https://lgtm.com/projects/g/xpadev-net/niconicomments/alerts/)
|
|
4
|
-
[](https://lgtm.com/projects/g/xpadev-net/niconicomments/context:javascript)
|
|
5
|
-
|
|
6
|
-
ニコニコ動画の公式プレイヤー互換の高パフォーマンスなコメント描画ライブラリ
|
|
7
|
-
High peformance High compatibility comment drawing library
|
|
8
|
-
Reference: https://xpadev-net.github.io/niconicomments/
|
|
9
|
-
Github: https://github.com/xpadev-net/niconicomments
|
|
10
|
-
npm: https://www.npmjs.com/package/@xpadev-net/niconicomments
|
|
11
|
-
|
|
12
|
-
## [重要]このライブラリを使用される方へ
|
|
13
|
-
ニコニコ運営が画面にコメントを流すアドオンを特許侵害だと騒ぎ立てて潰して回っているようです
|
|
14
|
-
このライブラリ本体は描画部分のみのため特許侵害に当たるとは考えていませんが、ニコニコ動画運営(とその近辺の人)に叩かれる可能性があります
|
|
15
|
-
(名前は出しませんがすでにいくつかのOSSに被害が出ています)
|
|
16
|
-
また、このライブラリを使用するかどうかに関わらず、リアルタイムでコメントを取得、画面を描画、コメントの投稿という一連の流れを実装した場合、ニコニコの特許を侵害する可能性があります
|
|
17
|
-
詳しくはこちら[ニコニコが保有する特許について](https://github.com/xpadev-net/niconicomments/blob/master/ABOUT_PATENT.md)を参照してください
|
|
18
|
-
**※当ライブラリを削除する予定は一切ありません**
|
|
19
|
-
|
|
20
|
-
## Installation
|
|
21
|
-
```html
|
|
22
|
-
<script src="https://cdn.jsdelivr.net/npm/@xpadev-net/niconicomments@latest/dist/bundle.min.js"></script>
|
|
23
|
-
```
|
|
24
|
-
or
|
|
25
|
-
```
|
|
26
|
-
npm i @xpadev-net/niconicomments
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Examples
|
|
30
|
-
```javascript
|
|
31
|
-
const canvas = document.getElementById("canvas");
|
|
32
|
-
const video = document.getElementById("video");
|
|
33
|
-
const req = await fetch("sample.json");
|
|
34
|
-
const res = await req.json();
|
|
35
|
-
const niconiComments = new NiconiComments(canvas, res);
|
|
36
|
-
//video.ontimeupdateを使用すると、呼び出し回数の関係でコメントカクつく
|
|
37
|
-
setInterval(() => niconiComments.drawCanvas(Math.floor(video.currentTime * 100)), 10);
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Sample
|
|
41
|
-
[サンプル](https://xpadev-net.github.io/niconicomments/sample/)
|
|
42
|
-
[CodePen](https://codepen.io/xpadev-net/pen/mdBdQmX)
|
|
1
|
+
# [niconicomments](https://xpadev.net/niconicomments/)
|
|
2
|
+
[](https://github.com/xpadev-net/niconicomments/blob/master/LICENSE)
|
|
3
|
+
[](https://lgtm.com/projects/g/xpadev-net/niconicomments/alerts/)
|
|
4
|
+
[](https://lgtm.com/projects/g/xpadev-net/niconicomments/context:javascript)
|
|
5
|
+
|
|
6
|
+
ニコニコ動画の公式プレイヤー互換の高パフォーマンスなコメント描画ライブラリ
|
|
7
|
+
High peformance High compatibility comment drawing library
|
|
8
|
+
Reference: https://xpadev-net.github.io/niconicomments/
|
|
9
|
+
Github: https://github.com/xpadev-net/niconicomments
|
|
10
|
+
npm: https://www.npmjs.com/package/@xpadev-net/niconicomments
|
|
11
|
+
|
|
12
|
+
## [重要]このライブラリを使用される方へ
|
|
13
|
+
ニコニコ運営が画面にコメントを流すアドオンを特許侵害だと騒ぎ立てて潰して回っているようです
|
|
14
|
+
このライブラリ本体は描画部分のみのため特許侵害に当たるとは考えていませんが、ニコニコ動画運営(とその近辺の人)に叩かれる可能性があります
|
|
15
|
+
(名前は出しませんがすでにいくつかのOSSに被害が出ています)
|
|
16
|
+
また、このライブラリを使用するかどうかに関わらず、リアルタイムでコメントを取得、画面を描画、コメントの投稿という一連の流れを実装した場合、ニコニコの特許を侵害する可能性があります
|
|
17
|
+
詳しくはこちら[ニコニコが保有する特許について](https://github.com/xpadev-net/niconicomments/blob/master/ABOUT_PATENT.md)を参照してください
|
|
18
|
+
**※当ライブラリを削除する予定は一切ありません**
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
```html
|
|
22
|
+
<script src="https://cdn.jsdelivr.net/npm/@xpadev-net/niconicomments@latest/dist/bundle.min.js"></script>
|
|
23
|
+
```
|
|
24
|
+
or
|
|
25
|
+
```
|
|
26
|
+
npm i @xpadev-net/niconicomments
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Examples
|
|
30
|
+
```javascript
|
|
31
|
+
const canvas = document.getElementById("canvas");
|
|
32
|
+
const video = document.getElementById("video");
|
|
33
|
+
const req = await fetch("sample.json");
|
|
34
|
+
const res = await req.json();
|
|
35
|
+
const niconiComments = new NiconiComments(canvas, res);
|
|
36
|
+
//video.ontimeupdateを使用すると、呼び出し回数の関係でコメントカクつく
|
|
37
|
+
setInterval(() => niconiComments.drawCanvas(Math.floor(video.currentTime * 100)), 10);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Sample
|
|
41
|
+
[サンプル](https://xpadev-net.github.io/niconicomments/sample/)
|
|
42
|
+
[CodePen](https://codepen.io/xpadev-net/pen/mdBdQmX)
|
package/dist/bundle.d.ts
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
declare const colors: {
|
|
2
|
+
[key: string]: string;
|
|
3
|
+
};
|
|
4
|
+
declare const commentYPaddingTop = 0.08;
|
|
5
|
+
declare const commentYMarginBottom = 0.24;
|
|
6
|
+
declare const fontSize: typeFontSize;
|
|
7
|
+
declare const lineHeight: typeFontSize;
|
|
8
|
+
declare const doubleResizeMaxWidth: typeDoubleResizeMaxWidth;
|
|
9
|
+
declare const defaultOptions: Options;
|
|
10
|
+
declare const fpsInterval = 500;
|
|
11
|
+
declare const cacheAge = 2000;
|
|
12
|
+
declare const canvasWidth = 1920;
|
|
13
|
+
declare const canvasHeight = 1080;
|
|
14
|
+
declare const commentDrawRange = 1450;
|
|
15
|
+
declare const commentDrawPadding: number;
|
|
16
|
+
declare const collisionRange: {
|
|
17
|
+
left: number;
|
|
18
|
+
right: number;
|
|
19
|
+
};
|
|
20
|
+
declare const sameCARange = 3600;
|
|
21
|
+
declare const sameCAGap = 100;
|
|
22
|
+
declare const sameCAMinScore = 10;
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=definition.d.ts.map
|
|
25
|
+
type inputFormatType =
|
|
26
|
+
| "niconicome"
|
|
27
|
+
| "formatted"
|
|
28
|
+
| "legacy"
|
|
29
|
+
| "legacyOwner"
|
|
30
|
+
| "owner"
|
|
31
|
+
| "v1"
|
|
32
|
+
| "default";
|
|
33
|
+
type InitOptions = {
|
|
34
|
+
useLegacy?: boolean;
|
|
35
|
+
formatted?: boolean;
|
|
36
|
+
format?: inputFormatType;
|
|
37
|
+
video?: HTMLVideoElement | undefined;
|
|
38
|
+
showCollision?: boolean;
|
|
39
|
+
showFPS?: boolean;
|
|
40
|
+
showCommentCount?: boolean;
|
|
41
|
+
drawAllImageOnLoad?: boolean;
|
|
42
|
+
debug?: boolean;
|
|
43
|
+
enableLegacyPiP?: boolean;
|
|
44
|
+
keepCA?: boolean;
|
|
45
|
+
};
|
|
46
|
+
type Options = {
|
|
47
|
+
useLegacy: boolean;
|
|
48
|
+
formatted: boolean;
|
|
49
|
+
format: inputFormatType;
|
|
50
|
+
video: HTMLVideoElement | undefined;
|
|
51
|
+
showCollision: boolean;
|
|
52
|
+
showFPS: boolean;
|
|
53
|
+
showCommentCount: boolean;
|
|
54
|
+
drawAllImageOnLoad: boolean;
|
|
55
|
+
debug: boolean;
|
|
56
|
+
enableLegacyPiP: boolean;
|
|
57
|
+
keepCA: boolean;
|
|
58
|
+
};
|
|
59
|
+
type rawApiResponse = {
|
|
60
|
+
[key: string]: apiPing | apiThread | apiLeaf | apiGlobalNumRes | apiChat;
|
|
61
|
+
};
|
|
62
|
+
type apiPing = {
|
|
63
|
+
content: string;
|
|
64
|
+
};
|
|
65
|
+
type apiThread = {
|
|
66
|
+
resultcode: number;
|
|
67
|
+
thread: string;
|
|
68
|
+
server_time: number;
|
|
69
|
+
ticket: string;
|
|
70
|
+
revision: number;
|
|
71
|
+
};
|
|
72
|
+
type apiLeaf = {
|
|
73
|
+
thread: string;
|
|
74
|
+
count: number;
|
|
75
|
+
};
|
|
76
|
+
type apiGlobalNumRes = {
|
|
77
|
+
thread: string;
|
|
78
|
+
num_res: number;
|
|
79
|
+
};
|
|
80
|
+
type apiChat = {
|
|
81
|
+
thread: string;
|
|
82
|
+
no: number;
|
|
83
|
+
vpos: number;
|
|
84
|
+
date: number;
|
|
85
|
+
date_usec: number;
|
|
86
|
+
nicoru: number;
|
|
87
|
+
premium: number;
|
|
88
|
+
anonymity: number;
|
|
89
|
+
user_id: string;
|
|
90
|
+
mail: string;
|
|
91
|
+
content: string;
|
|
92
|
+
deleted: number;
|
|
93
|
+
};
|
|
94
|
+
type formattedComment = {
|
|
95
|
+
id: number;
|
|
96
|
+
vpos: number;
|
|
97
|
+
content: string;
|
|
98
|
+
date: number;
|
|
99
|
+
date_usec: number;
|
|
100
|
+
owner: boolean;
|
|
101
|
+
premium: boolean;
|
|
102
|
+
mail: string[];
|
|
103
|
+
user_id: number;
|
|
104
|
+
layer: number;
|
|
105
|
+
};
|
|
106
|
+
type formattedLegacyComment = {
|
|
107
|
+
id: number;
|
|
108
|
+
vpos: number;
|
|
109
|
+
content: string;
|
|
110
|
+
date: number;
|
|
111
|
+
date_usec: number;
|
|
112
|
+
owner: boolean;
|
|
113
|
+
premium: boolean;
|
|
114
|
+
mail: string[];
|
|
115
|
+
};
|
|
116
|
+
type formattedCommentWithFont = formattedComment & {
|
|
117
|
+
loc: commentLoc;
|
|
118
|
+
size: commentSize;
|
|
119
|
+
fontSize: number;
|
|
120
|
+
font: commentFont;
|
|
121
|
+
color: string;
|
|
122
|
+
full: boolean;
|
|
123
|
+
ender: boolean;
|
|
124
|
+
_live: boolean;
|
|
125
|
+
long: number;
|
|
126
|
+
invisible: boolean;
|
|
127
|
+
};
|
|
128
|
+
type formattedCommentWithSize = formattedCommentWithFont & {
|
|
129
|
+
height: number;
|
|
130
|
+
width: number;
|
|
131
|
+
width_max: number;
|
|
132
|
+
width_min: number;
|
|
133
|
+
lineHeight: number;
|
|
134
|
+
};
|
|
135
|
+
type parsedComment = formattedCommentWithSize & {
|
|
136
|
+
posY: number;
|
|
137
|
+
image?: HTMLCanvasElement | boolean;
|
|
138
|
+
};
|
|
139
|
+
type groupedResult = formattedCommentWithFont & {
|
|
140
|
+
index: number;
|
|
141
|
+
};
|
|
142
|
+
type groupedComments = {
|
|
143
|
+
[key in commentFont]: { [key: string]: groupedResult[] };
|
|
144
|
+
};
|
|
145
|
+
type commentFont = "defont" | "mincho" | "gothic";
|
|
146
|
+
type commentSize = "big" | "medium" | "small";
|
|
147
|
+
type commentLoc = "ue" | "naka" | "shita";
|
|
148
|
+
type collision = { [key in collisionPos]: collisionItem };
|
|
149
|
+
type collisionPos = "ue" | "shita" | "right" | "left";
|
|
150
|
+
type collisionItem = { [p: number]: number[] };
|
|
151
|
+
type nicoScript = {
|
|
152
|
+
reverse: nicoScriptReverse[];
|
|
153
|
+
ban: nicoScriptBan[];
|
|
154
|
+
default: nicoScriptDefault[];
|
|
155
|
+
replace: nicoScriptReplace[];
|
|
156
|
+
};
|
|
157
|
+
type nicoScriptReverse = {
|
|
158
|
+
target: nicoScriptReverseTarget;
|
|
159
|
+
start: number;
|
|
160
|
+
end: number;
|
|
161
|
+
};
|
|
162
|
+
type nicoScriptReverseTarget = "コメ" | "投コメ" | "全";
|
|
163
|
+
type nicoScriptReplace = {
|
|
164
|
+
start: number;
|
|
165
|
+
long: number | undefined;
|
|
166
|
+
keyword: string;
|
|
167
|
+
replace: string;
|
|
168
|
+
range: nicoScriptReplaceRange;
|
|
169
|
+
target: nicoScriptReplaceTarget;
|
|
170
|
+
condition: nicoScriptReplaceCondition;
|
|
171
|
+
color: string | undefined;
|
|
172
|
+
size: commentSize | undefined;
|
|
173
|
+
font: commentFont | undefined;
|
|
174
|
+
loc: commentLoc | undefined;
|
|
175
|
+
no: number;
|
|
176
|
+
};
|
|
177
|
+
type nicoScriptReplaceRange = "単" | "全";
|
|
178
|
+
type nicoScriptReplaceTarget = "コメ" | "投コメ" | "全" | "含まない" | "含む";
|
|
179
|
+
type nicoScriptReplaceCondition = "完全一致" | "部分一致";
|
|
180
|
+
type nicoScriptBan = {
|
|
181
|
+
start: number;
|
|
182
|
+
end: number;
|
|
183
|
+
};
|
|
184
|
+
type nicoScriptDefault = {
|
|
185
|
+
start: number;
|
|
186
|
+
long: number | undefined;
|
|
187
|
+
color: string | undefined;
|
|
188
|
+
size: commentSize | undefined;
|
|
189
|
+
font: commentFont | undefined;
|
|
190
|
+
loc: commentLoc | undefined;
|
|
191
|
+
};
|
|
192
|
+
type measureTextResult = {
|
|
193
|
+
width: number;
|
|
194
|
+
width_max: number;
|
|
195
|
+
width_min: number;
|
|
196
|
+
height: number;
|
|
197
|
+
resized: boolean;
|
|
198
|
+
fontSize: number;
|
|
199
|
+
lineHeight: number;
|
|
200
|
+
};
|
|
201
|
+
type parsedCommand = {
|
|
202
|
+
loc: commentLoc | undefined;
|
|
203
|
+
size: commentSize | undefined;
|
|
204
|
+
fontSize: number | undefined;
|
|
205
|
+
color: string | undefined;
|
|
206
|
+
font: commentFont | undefined;
|
|
207
|
+
full: boolean;
|
|
208
|
+
ender: boolean;
|
|
209
|
+
_live: boolean;
|
|
210
|
+
invisible: boolean;
|
|
211
|
+
long: number | undefined;
|
|
212
|
+
};
|
|
213
|
+
type typeFontSize = {
|
|
214
|
+
[key in commentSize]: {
|
|
215
|
+
default: number;
|
|
216
|
+
resized: number;
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
type typeDoubleResizeMaxWidth = {
|
|
220
|
+
[key in "full" | "normal"]: {
|
|
221
|
+
legacy: number;
|
|
222
|
+
default: number;
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
type v1Thread = {
|
|
226
|
+
id: string;
|
|
227
|
+
fork: string;
|
|
228
|
+
commentCount: number;
|
|
229
|
+
comments: { [key: string]: v1Comment };
|
|
230
|
+
};
|
|
231
|
+
type v1Comment = {
|
|
232
|
+
id: string;
|
|
233
|
+
no: number;
|
|
234
|
+
vposMs: number;
|
|
235
|
+
body: string;
|
|
236
|
+
commands: string[];
|
|
237
|
+
userId: string;
|
|
238
|
+
isPremium: boolean;
|
|
239
|
+
score: number;
|
|
240
|
+
postedAt: string;
|
|
241
|
+
nicoruCount: number;
|
|
242
|
+
nicoruId: undefined;
|
|
243
|
+
source: string;
|
|
244
|
+
isMyPost: boolean;
|
|
245
|
+
};
|
|
246
|
+
type ownerComment = {
|
|
247
|
+
time: string;
|
|
248
|
+
command: string;
|
|
249
|
+
comment: string;
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
declare const convert2formattedComment: (data: unknown, type: inputFormatType) => formattedComment[];
|
|
253
|
+
|
|
254
|
+
//# sourceMappingURL=inputParser.d.ts.map
|
|
255
|
+
declare class NiconiComments {
|
|
256
|
+
enableLegacyPiP: boolean;
|
|
257
|
+
showCollision: boolean;
|
|
258
|
+
showFPS: boolean;
|
|
259
|
+
showCommentCount: boolean;
|
|
260
|
+
video: HTMLVideoElement | undefined;
|
|
261
|
+
private data;
|
|
262
|
+
private fps;
|
|
263
|
+
private fpsCount;
|
|
264
|
+
private lastVpos;
|
|
265
|
+
private readonly cacheIndex;
|
|
266
|
+
private readonly canvas;
|
|
267
|
+
private readonly collision;
|
|
268
|
+
private readonly context;
|
|
269
|
+
private readonly keepCA;
|
|
270
|
+
private readonly nicoScripts;
|
|
271
|
+
private readonly timeline;
|
|
272
|
+
private readonly useLegacy;
|
|
273
|
+
constructor(canvas: HTMLCanvasElement, data: (rawApiResponse | formattedComment)[], initOptions?: InitOptions);
|
|
274
|
+
preRendering(rawData: formattedComment[], drawAll: boolean): void;
|
|
275
|
+
getFont(parsedData: formattedComment[]): formattedCommentWithFont[];
|
|
276
|
+
getCommentSize(parsedData: formattedCommentWithFont[]): formattedCommentWithSize[];
|
|
277
|
+
getCommentPos(data: parsedComment[]): parsedComment[];
|
|
278
|
+
sortComment(parsedData: parsedComment[]): parsedComment[];
|
|
279
|
+
measureText(comment: {
|
|
280
|
+
content: string;
|
|
281
|
+
resized?: boolean;
|
|
282
|
+
ender: boolean;
|
|
283
|
+
size: commentSize;
|
|
284
|
+
fontSize: number;
|
|
285
|
+
resizedY?: boolean;
|
|
286
|
+
resizedX?: boolean;
|
|
287
|
+
font: commentFont;
|
|
288
|
+
loc: commentLoc;
|
|
289
|
+
full: boolean;
|
|
290
|
+
lineHeight?: number;
|
|
291
|
+
}): measureTextResult;
|
|
292
|
+
drawText(comment: parsedComment, vpos: number): void;
|
|
293
|
+
getTextImage(i: number, preRendering?: boolean): void;
|
|
294
|
+
parseCommand(comment: formattedComment): parsedCommand;
|
|
295
|
+
parseCommandAndNicoscript(comment: formattedComment): formattedCommentWithFont;
|
|
296
|
+
drawCanvas(vpos: number, forceRendering?: boolean): void;
|
|
297
|
+
clear(): void;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
//# sourceMappingURL=main.d.ts.map
|
|
301
|
+
declare const typeGuard: {
|
|
302
|
+
formatted: {
|
|
303
|
+
comment: (i: unknown) => i is formattedComment;
|
|
304
|
+
comments: (i: unknown) => i is formattedComment[];
|
|
305
|
+
legacyComment: (i: unknown) => i is formattedLegacyComment;
|
|
306
|
+
legacyComments: (i: unknown) => i is formattedLegacyComment[];
|
|
307
|
+
};
|
|
308
|
+
legacy: {
|
|
309
|
+
rawApiResponses: (i: unknown) => i is rawApiResponse[];
|
|
310
|
+
apiChat: (i: unknown) => i is apiChat;
|
|
311
|
+
apiGlobalNumRes: (i: unknown) => i is apiGlobalNumRes;
|
|
312
|
+
apiLeaf: (i: unknown) => i is apiLeaf;
|
|
313
|
+
apiPing: (i: unknown) => i is apiPing;
|
|
314
|
+
apiThread: (i: unknown) => i is apiThread;
|
|
315
|
+
};
|
|
316
|
+
niconicome: {
|
|
317
|
+
xmlDocument: (i: unknown) => i is XMLDocument;
|
|
318
|
+
};
|
|
319
|
+
legacyOwner: {
|
|
320
|
+
comments: (i: unknown) => i is string;
|
|
321
|
+
};
|
|
322
|
+
owner: {
|
|
323
|
+
comment: (i: unknown) => i is ownerComment;
|
|
324
|
+
comments: (i: unknown) => i is ownerComment[];
|
|
325
|
+
};
|
|
326
|
+
v1: {
|
|
327
|
+
comment: (i: unknown) => i is apiThread;
|
|
328
|
+
thread: (i: unknown) => i is v1Thread;
|
|
329
|
+
threads: (i: unknown) => i is v1Thread[];
|
|
330
|
+
};
|
|
331
|
+
nicoScript: {
|
|
332
|
+
range: {
|
|
333
|
+
target: (i: unknown) => i is nicoScriptReverseTarget;
|
|
334
|
+
};
|
|
335
|
+
replace: {
|
|
336
|
+
range: (i: unknown) => i is nicoScriptReplaceRange;
|
|
337
|
+
target: (i: unknown) => i is nicoScriptReplaceTarget;
|
|
338
|
+
condition: (i: unknown) => i is nicoScriptReplaceCondition;
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
comment: {
|
|
342
|
+
font: (i: unknown) => i is commentFont;
|
|
343
|
+
loc: (i: unknown) => i is commentLoc;
|
|
344
|
+
size: (i: unknown) => i is commentSize;
|
|
345
|
+
command: {
|
|
346
|
+
key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
|
|
347
|
+
};
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
//# sourceMappingURL=typeGuard.d.ts.map
|
|
352
|
+
declare const groupBy: (array: formattedCommentWithFont[]) => groupedComments;
|
|
353
|
+
declare const getPosY: (currentPos: number, targetComment: parsedComment, collision: number[] | undefined, data: parsedComment[]) => {
|
|
354
|
+
currentPos: number;
|
|
355
|
+
isChanged: boolean;
|
|
356
|
+
isBreak: boolean;
|
|
357
|
+
};
|
|
358
|
+
declare const getPosX: (width: number, vpos: number, long: number) => number;
|
|
359
|
+
declare const parseFont: (font: commentFont, size: string | number, useLegacy: boolean) => string;
|
|
360
|
+
declare const arrayPush: (array: {
|
|
361
|
+
[key: number]: number[];
|
|
362
|
+
}, key: string | number, push: number) => void;
|
|
363
|
+
declare const hex2rgb: (hex: string) => number[];
|
|
364
|
+
declare const replaceAll: (string: string, target: string, replace: string) => string;
|
|
365
|
+
declare const changeCALayer: (rawData: formattedComment[]) => formattedComment[];
|
|
366
|
+
|
|
367
|
+
//# sourceMappingURL=util.d.ts.map
|
|
368
|
+
export default NiconiComments;
|