@xpadev-net/niconicomments 0.2.54 → 0.2.55

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 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.en.md CHANGED
@@ -1,53 +1,53 @@
1
- # [niconicomments](https://xpadev.net/niconicomments/)
2
-
3
- [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/xpadev-net/niconicomments/blob/master/LICENSE)
4
- [![CodeQL](https://github.com/xpadev-net/niconicomments/actions/workflows/codeql-analysis.yml/badge.svg?branch=master)](https://github.com/xpadev-net/niconicomments/actions/workflows/codeql-analysis.yml)
5
- [![TypeDoc](https://github.com/xpadev-net/niconicomments/actions/workflows/typedoc.yml/badge.svg?branch=master)](https://github.com/xpadev-net/niconicomments/actions/workflows/typedoc.yml)
6
-
7
- [[日本語](https://github.com/xpadev-net/niconicomments/blob/develop/README.md)]
8
-
9
- Comment rendering library that is somewhat compatible with the official Nico Nico Douga player
10
- Reference: https://xpadev-net.github.io/niconicomments/
11
- Github: https://github.com/xpadev-net/niconicomments
12
- npm: https://www.npmjs.com/package/@xpadev-net/niconicomments
13
-
14
- ## Installation
15
-
16
- ```html
17
- <script src="https://cdn.jsdelivr.net/npm/@xpadev-net/niconicomments@latest/dist/bundle.min.js"></script>
18
- ```
19
-
20
- or
21
-
22
- ```
23
- npm i @xpadev-net/niconicomments
24
- ```
25
-
26
- ## Examples
27
-
28
- ```javascript
29
- const canvas = document.getElementById("canvas");
30
- const video = document.getElementById("video");
31
- const req = await fetch("sample.json");
32
- const res = await req.json();
33
- const niconiComments = new NiconiComments(canvas, res);
34
- //If video.ontimeupdate is used, the comments will be choppy due to the small number of calls.
35
- setInterval(
36
- () => niconiComments.drawCanvas(Math.floor(video.currentTime * 100)),
37
- 10
38
- );
39
- ```
40
-
41
- ## Sample
42
-
43
- [Sample](https://xpadev-net.github.io/niconicomments/sample/)
44
-
45
- ### For users who use this library for domestic use in Japan
46
-
47
- This library may infringe on Dwango's patents depending on how it is used
48
- Please carefully review the following applicable patents and case law before using this library with caution.
49
- [JP,2006-333851](https://www.j-platpat.inpit.go.jp/c1800/PU/JP-2006-333851/7294651F33633E1EBF3DEC66FAE0ECAD878D19E1829C378FC81D26BBD0A4263B/10/en)
50
- [JP,2010-267283](https://www.j-platpat.inpit.go.jp/c1800/PU/JP-4734471/9085C128B7ED7D57F6C2F09D9BE4FCB496E638331DB9EC7ADE1E3A44999A3878/15/en)
51
- [JP,2018-202475](https://www.j-platpat.inpit.go.jp/c1800/PU/JP-6526304/D8AF77CFB92D96C785FEECBD690C53E2F9023F1739E7A5BBDAB588E2ECAC5316/15/en)
52
- [2018: Case No. Heisei 28 (wa) 38565, Patent Infringement Injunction, etc. Patent Right Civil Litigation](https://www.courts.go.jp/app/files/hanrei_jp/073/088073_hanrei.pdf)
53
- [2022: Heisei 30 (ne) 10077 Appeal for Patent Infringement Injunction, etc. Patent Right Civil Litigation](https://www.courts.go.jp/app/files/hanrei_jp/418/091418_hanrei.pdf)
1
+ # [niconicomments](https://xpadev.net/niconicomments/)
2
+
3
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/xpadev-net/niconicomments/blob/master/LICENSE)
4
+ [![CodeQL](https://github.com/xpadev-net/niconicomments/actions/workflows/codeql-analysis.yml/badge.svg?branch=master)](https://github.com/xpadev-net/niconicomments/actions/workflows/codeql-analysis.yml)
5
+ [![TypeDoc](https://github.com/xpadev-net/niconicomments/actions/workflows/typedoc.yml/badge.svg?branch=master)](https://github.com/xpadev-net/niconicomments/actions/workflows/typedoc.yml)
6
+
7
+ [[日本語](https://github.com/xpadev-net/niconicomments/blob/develop/README.md)]
8
+
9
+ Comment rendering library that is somewhat compatible with the official Nico Nico Douga player
10
+ Reference: https://xpadev-net.github.io/niconicomments/
11
+ Github: https://github.com/xpadev-net/niconicomments
12
+ npm: https://www.npmjs.com/package/@xpadev-net/niconicomments
13
+
14
+ ## Installation
15
+
16
+ ```html
17
+ <script src="https://cdn.jsdelivr.net/npm/@xpadev-net/niconicomments@latest/dist/bundle.min.js"></script>
18
+ ```
19
+
20
+ or
21
+
22
+ ```
23
+ npm i @xpadev-net/niconicomments
24
+ ```
25
+
26
+ ## Examples
27
+
28
+ ```javascript
29
+ const canvas = document.getElementById("canvas");
30
+ const video = document.getElementById("video");
31
+ const req = await fetch("sample.json");
32
+ const res = await req.json();
33
+ const niconiComments = new NiconiComments(canvas, res);
34
+ //If video.ontimeupdate is used, the comments will be choppy due to the small number of calls.
35
+ setInterval(
36
+ () => niconiComments.drawCanvas(Math.floor(video.currentTime * 100)),
37
+ 10
38
+ );
39
+ ```
40
+
41
+ ## Sample
42
+
43
+ [Sample](https://xpadev-net.github.io/niconicomments/sample/)
44
+
45
+ ### For users who use this library for domestic use in Japan
46
+
47
+ This library may infringe on Dwango's patents depending on how it is used
48
+ Please carefully review the following applicable patents and case law before using this library with caution.
49
+ [JP,2006-333851](https://www.j-platpat.inpit.go.jp/c1800/PU/JP-2006-333851/7294651F33633E1EBF3DEC66FAE0ECAD878D19E1829C378FC81D26BBD0A4263B/10/en)
50
+ [JP,2010-267283](https://www.j-platpat.inpit.go.jp/c1800/PU/JP-4734471/9085C128B7ED7D57F6C2F09D9BE4FCB496E638331DB9EC7ADE1E3A44999A3878/15/en)
51
+ [JP,2018-202475](https://www.j-platpat.inpit.go.jp/c1800/PU/JP-6526304/D8AF77CFB92D96C785FEECBD690C53E2F9023F1739E7A5BBDAB588E2ECAC5316/15/en)
52
+ [2018: Case No. Heisei 28 (wa) 38565, Patent Infringement Injunction, etc. Patent Right Civil Litigation](https://www.courts.go.jp/app/files/hanrei_jp/073/088073_hanrei.pdf)
53
+ [2022: Heisei 30 (ne) 10077 Appeal for Patent Infringement Injunction, etc. Patent Right Civil Litigation](https://www.courts.go.jp/app/files/hanrei_jp/418/091418_hanrei.pdf)
package/README.md CHANGED
@@ -1,51 +1,51 @@
1
- # [niconicomments](https://xpadev.net/niconicomments/)
2
-
3
- [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/xpadev-net/niconicomments/blob/master/LICENSE)
4
- [![CodeQL](https://github.com/xpadev-net/niconicomments/actions/workflows/codeql-analysis.yml/badge.svg?branch=master)](https://github.com/xpadev-net/niconicomments/actions/workflows/codeql-analysis.yml)
5
- [![TypeDoc](https://github.com/xpadev-net/niconicomments/actions/workflows/typedoc.yml/badge.svg?branch=master)](https://github.com/xpadev-net/niconicomments/actions/workflows/typedoc.yml)
6
-
7
- [[English](https://github.com/xpadev-net/niconicomments/blob/develop/README.en.md)]
8
-
9
- ニコニコ動画の公式プレイヤー互換の高パフォーマンスなコメント描画ライブラリ
10
- High peformance High compatibility comment drawing library
11
- Reference: https://xpadev-net.github.io/niconicomments/
12
- Github: https://github.com/xpadev-net/niconicomments
13
- npm: https://www.npmjs.com/package/@xpadev-net/niconicomments
14
-
15
-
16
- ## Installation
17
-
18
- ```html
19
- <script src="https://cdn.jsdelivr.net/npm/@xpadev-net/niconicomments@latest/dist/bundle.min.js"></script>
20
- ```
21
-
22
- or
23
-
24
- ```
25
- npm i @xpadev-net/niconicomments
26
- ```
27
-
28
- ## Examples
29
-
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(
38
- () => niconiComments.drawCanvas(Math.floor(video.currentTime * 100)),
39
- 10
40
- );
41
- ```
42
-
43
- ## Sample
44
-
45
- [サンプル](https://xpadev-net.github.io/niconicomments/sample/)
46
-
47
-
48
- ### このライブラリを使用される方へ
49
-
50
- このライブラリを使用するかどうかに関わらず、リアルタイムでコメントを取得、画面を描画、コメントの投稿という一連の流れを実装した場合、ニコニコの特許を侵害する可能性があります
1
+ # [niconicomments](https://xpadev.net/niconicomments/)
2
+
3
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/xpadev-net/niconicomments/blob/master/LICENSE)
4
+ [![CodeQL](https://github.com/xpadev-net/niconicomments/actions/workflows/codeql-analysis.yml/badge.svg?branch=master)](https://github.com/xpadev-net/niconicomments/actions/workflows/codeql-analysis.yml)
5
+ [![TypeDoc](https://github.com/xpadev-net/niconicomments/actions/workflows/typedoc.yml/badge.svg?branch=master)](https://github.com/xpadev-net/niconicomments/actions/workflows/typedoc.yml)
6
+
7
+ [[English](https://github.com/xpadev-net/niconicomments/blob/develop/README.en.md)]
8
+
9
+ ニコニコ動画の公式プレイヤー互換の高パフォーマンスなコメント描画ライブラリ
10
+ High peformance High compatibility comment drawing library
11
+ Reference: https://xpadev-net.github.io/niconicomments/
12
+ Github: https://github.com/xpadev-net/niconicomments
13
+ npm: https://www.npmjs.com/package/@xpadev-net/niconicomments
14
+
15
+
16
+ ## Installation
17
+
18
+ ```html
19
+ <script src="https://cdn.jsdelivr.net/npm/@xpadev-net/niconicomments@latest/dist/bundle.min.js"></script>
20
+ ```
21
+
22
+ or
23
+
24
+ ```
25
+ npm i @xpadev-net/niconicomments
26
+ ```
27
+
28
+ ## Examples
29
+
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(
38
+ () => niconiComments.drawCanvas(Math.floor(video.currentTime * 100)),
39
+ 10
40
+ );
41
+ ```
42
+
43
+ ## Sample
44
+
45
+ [サンプル](https://xpadev-net.github.io/niconicomments/sample/)
46
+
47
+
48
+ ### このライブラリを使用される方へ
49
+
50
+ このライブラリを使用するかどうかに関わらず、リアルタイムでコメントを取得、画面を描画、コメントの投稿という一連の流れを実装した場合、ニコニコの特許を侵害する可能性があります
51
51
  詳しくはこちら[ニコニコが保有する特許について](https://github.com/xpadev-net/niconicomments/blob/develop/ABOUT_PATENT.md)を参照してください
package/dist/bundle.d.ts CHANGED
@@ -441,197 +441,197 @@ type inputFormatType = InputFormatType;
441
441
  */
442
442
  type inputFormat = InputFormat;
443
443
 
444
- type FormattedCommentWithFont = {
445
- id: number;
446
- vpos: number;
447
- date: number;
448
- date_usec: number;
449
- owner: boolean;
450
- premium: boolean;
451
- mail: string[];
452
- user_id: number;
453
- layer: number;
454
- loc: CommentLoc;
455
- size: CommentSize;
456
- fontSize: number;
457
- font: CommentFont;
458
- color: string;
459
- strokeColor?: string;
460
- wakuColor?: string;
461
- fillColor?: string;
462
- full: boolean;
463
- ender: boolean;
464
- _live: boolean;
465
- long: number;
466
- invisible: boolean;
467
- content: CommentContentItem[];
468
- rawContent: string;
469
- flash: boolean;
470
- lineCount: number;
471
- lineOffset: number;
472
- };
473
- type FormattedCommentWithSize = FormattedCommentWithFont & {
474
- height: number;
475
- width: number;
476
- lineHeight: number;
477
- resized: boolean;
478
- resizedX: boolean;
479
- resizedY: boolean;
480
- content: CommentMeasuredContentItem[];
481
- charSize: number;
482
- };
483
- type ParseContentResult = {
484
- content: CommentContentItem[];
485
- lineCount: number;
486
- lineOffset: number;
487
- };
488
- type ParseCommandAndNicoScriptResult = {
489
- flash: boolean;
490
- loc: CommentLoc;
491
- size: CommentSize;
492
- fontSize: number;
493
- color: string;
494
- strokeColor?: string;
495
- wakuColor?: string;
496
- fillColor?: string;
497
- font: CommentFont;
498
- full: boolean;
499
- ender: boolean;
500
- _live: boolean;
501
- invisible: boolean;
502
- long: number;
503
- };
504
- type CommentContentItem = {
505
- content: string;
506
- slicedContent: string[];
507
- font?: CommentFlashFont;
508
- width?: number[];
509
- };
510
- type CommentMeasuredContentItem = CommentContentItem & {
511
- width: number[];
512
- };
513
- type CommentContentIndex = {
514
- index: number;
515
- font: "gothic" | "gulim" | "simsunStrong" | "simsunWeak";
516
- };
517
- type CommentFont = "defont" | "mincho" | "gothic" | "gulim" | "simsun";
518
- type CommentFlashFont = "defont" | "gulim" | "simsun";
519
- type CommentSize = "big" | "medium" | "small";
520
- type CommentLoc = "ue" | "naka" | "shita";
521
- type Collision = { [key in CollisionPos]: CollisionItem };
522
- type Timeline = { [key: number]: IComment[] };
523
- type CollisionPos = "ue" | "shita" | "right" | "left";
524
- type CollisionItem = { [p: number]: IComment[] };
525
- type NicoScript = {
526
- reverse: NicoScriptReverse[];
527
- ban: NicoScriptBan[];
528
- default: NicoScriptDefault[];
529
- replace: NicoScriptReplace[];
530
- seekDisable: NicoScriptSeekDisable[];
531
- jump: NicoScriptJump[];
532
- };
533
- type NicoScriptSeekDisable = {
534
- start: number;
535
- end: number;
536
- };
537
- type NicoScriptJump = {
538
- start: number;
539
- end?: number;
540
- to: string;
541
- message?: string;
542
- };
543
- type NicoScriptReverse = {
544
- target: NicoScriptReverseTarget;
545
- start: number;
546
- end: number;
547
- };
548
- type NicoScriptReverseTarget = "コメ" | "投コメ" | "全";
549
- type NicoScriptReplace = {
550
- start: number;
551
- long: number | undefined;
552
- keyword: string;
553
- replace: string;
554
- range: NicoScriptReplaceRange;
555
- target: NicoScriptReplaceTarget;
556
- condition: NicoScriptReplaceCondition;
557
- color: string | undefined;
558
- size: CommentSize | undefined;
559
- font: CommentFont | undefined;
560
- loc: CommentLoc | undefined;
561
- no: number;
562
- };
563
- type NicoScriptReplaceRange = "単" | "全";
564
- type NicoScriptReplaceTarget =
565
- | "コメ"
566
- | "投コメ"
567
- | "全"
568
- | "含まない"
569
- | "含む";
570
- type NicoScriptReplaceCondition = "完全一致" | "部分一致";
571
- type NicoScriptBan = {
572
- start: number;
573
- end: number;
574
- };
575
- type NicoScriptDefault = {
576
- start: number;
577
- long: number | undefined;
578
- color: string | undefined;
579
- size: CommentSize | undefined;
580
- font: CommentFont | undefined;
581
- loc: CommentLoc | undefined;
582
- };
583
- type MeasureTextResult = {
584
- width: number;
585
- height: number;
586
- resized: boolean;
587
- resizedX: boolean;
588
- resizedY: boolean;
589
- fontSize: number;
590
- lineHeight: number;
591
- content: CommentMeasuredContentItem[];
592
- charSize: number;
593
- };
594
- type ParsedCommand = {
595
- loc: CommentLoc | undefined;
596
- size: CommentSize | undefined;
597
- fontSize: number | undefined;
598
- color: string | undefined;
599
- strokeColor?: string;
600
- wakuColor?: string;
601
- fillColor?: string;
602
- font: CommentFont | undefined;
603
- full: boolean;
604
- ender: boolean;
605
- _live: boolean;
606
- invisible: boolean;
607
- long: number | undefined;
608
- };
609
-
610
- type MeasureTextInput = {
611
- content: CommentContentItem[];
612
- resized?: boolean;
613
- ender: boolean;
614
- size: CommentSize;
615
- fontSize: number;
616
- resizedY?: boolean;
617
- resizedX?: boolean;
618
- font: CommentFont;
619
- loc: CommentLoc;
620
- full: boolean;
621
- flash: boolean;
622
- lineCount: number;
623
- lineHeight?: number;
624
- charSize?: number;
625
- };
626
-
627
- type MeasureInput = {
628
- font: CommentFont;
629
- content: CommentContentItem[];
630
- lineHeight: number;
631
- charSize: number;
632
- lineCount: number;
633
- };
634
-
444
+ type FormattedCommentWithFont = {
445
+ id: number;
446
+ vpos: number;
447
+ date: number;
448
+ date_usec: number;
449
+ owner: boolean;
450
+ premium: boolean;
451
+ mail: string[];
452
+ user_id: number;
453
+ layer: number;
454
+ loc: CommentLoc;
455
+ size: CommentSize;
456
+ fontSize: number;
457
+ font: CommentFont;
458
+ color: string;
459
+ strokeColor?: string;
460
+ wakuColor?: string;
461
+ fillColor?: string;
462
+ full: boolean;
463
+ ender: boolean;
464
+ _live: boolean;
465
+ long: number;
466
+ invisible: boolean;
467
+ content: CommentContentItem[];
468
+ rawContent: string;
469
+ flash: boolean;
470
+ lineCount: number;
471
+ lineOffset: number;
472
+ };
473
+ type FormattedCommentWithSize = FormattedCommentWithFont & {
474
+ height: number;
475
+ width: number;
476
+ lineHeight: number;
477
+ resized: boolean;
478
+ resizedX: boolean;
479
+ resizedY: boolean;
480
+ content: CommentMeasuredContentItem[];
481
+ charSize: number;
482
+ };
483
+ type ParseContentResult = {
484
+ content: CommentContentItem[];
485
+ lineCount: number;
486
+ lineOffset: number;
487
+ };
488
+ type ParseCommandAndNicoScriptResult = {
489
+ flash: boolean;
490
+ loc: CommentLoc;
491
+ size: CommentSize;
492
+ fontSize: number;
493
+ color: string;
494
+ strokeColor?: string;
495
+ wakuColor?: string;
496
+ fillColor?: string;
497
+ font: CommentFont;
498
+ full: boolean;
499
+ ender: boolean;
500
+ _live: boolean;
501
+ invisible: boolean;
502
+ long: number;
503
+ };
504
+ type CommentContentItem = {
505
+ content: string;
506
+ slicedContent: string[];
507
+ font?: CommentFlashFont;
508
+ width?: number[];
509
+ };
510
+ type CommentMeasuredContentItem = CommentContentItem & {
511
+ width: number[];
512
+ };
513
+ type CommentContentIndex = {
514
+ index: number;
515
+ font: "gothic" | "gulim" | "simsunStrong" | "simsunWeak";
516
+ };
517
+ type CommentFont = "defont" | "mincho" | "gothic" | "gulim" | "simsun";
518
+ type CommentFlashFont = "defont" | "gulim" | "simsun";
519
+ type CommentSize = "big" | "medium" | "small";
520
+ type CommentLoc = "ue" | "naka" | "shita";
521
+ type Collision = { [key in CollisionPos]: CollisionItem };
522
+ type Timeline = { [key: number]: IComment[] };
523
+ type CollisionPos = "ue" | "shita" | "right" | "left";
524
+ type CollisionItem = { [p: number]: IComment[] };
525
+ type NicoScript = {
526
+ reverse: NicoScriptReverse[];
527
+ ban: NicoScriptBan[];
528
+ default: NicoScriptDefault[];
529
+ replace: NicoScriptReplace[];
530
+ seekDisable: NicoScriptSeekDisable[];
531
+ jump: NicoScriptJump[];
532
+ };
533
+ type NicoScriptSeekDisable = {
534
+ start: number;
535
+ end: number;
536
+ };
537
+ type NicoScriptJump = {
538
+ start: number;
539
+ end?: number;
540
+ to: string;
541
+ message?: string;
542
+ };
543
+ type NicoScriptReverse = {
544
+ target: NicoScriptReverseTarget;
545
+ start: number;
546
+ end: number;
547
+ };
548
+ type NicoScriptReverseTarget = "コメ" | "投コメ" | "全";
549
+ type NicoScriptReplace = {
550
+ start: number;
551
+ long: number | undefined;
552
+ keyword: string;
553
+ replace: string;
554
+ range: NicoScriptReplaceRange;
555
+ target: NicoScriptReplaceTarget;
556
+ condition: NicoScriptReplaceCondition;
557
+ color: string | undefined;
558
+ size: CommentSize | undefined;
559
+ font: CommentFont | undefined;
560
+ loc: CommentLoc | undefined;
561
+ no: number;
562
+ };
563
+ type NicoScriptReplaceRange = "単" | "全";
564
+ type NicoScriptReplaceTarget =
565
+ | "コメ"
566
+ | "投コメ"
567
+ | "全"
568
+ | "含まない"
569
+ | "含む";
570
+ type NicoScriptReplaceCondition = "完全一致" | "部分一致";
571
+ type NicoScriptBan = {
572
+ start: number;
573
+ end: number;
574
+ };
575
+ type NicoScriptDefault = {
576
+ start: number;
577
+ long: number | undefined;
578
+ color: string | undefined;
579
+ size: CommentSize | undefined;
580
+ font: CommentFont | undefined;
581
+ loc: CommentLoc | undefined;
582
+ };
583
+ type MeasureTextResult = {
584
+ width: number;
585
+ height: number;
586
+ resized: boolean;
587
+ resizedX: boolean;
588
+ resizedY: boolean;
589
+ fontSize: number;
590
+ lineHeight: number;
591
+ content: CommentMeasuredContentItem[];
592
+ charSize: number;
593
+ };
594
+ type ParsedCommand = {
595
+ loc: CommentLoc | undefined;
596
+ size: CommentSize | undefined;
597
+ fontSize: number | undefined;
598
+ color: string | undefined;
599
+ strokeColor?: string;
600
+ wakuColor?: string;
601
+ fillColor?: string;
602
+ font: CommentFont | undefined;
603
+ full: boolean;
604
+ ender: boolean;
605
+ _live: boolean;
606
+ invisible: boolean;
607
+ long: number | undefined;
608
+ };
609
+
610
+ type MeasureTextInput = {
611
+ content: CommentContentItem[];
612
+ resized?: boolean;
613
+ ender: boolean;
614
+ size: CommentSize;
615
+ fontSize: number;
616
+ resizedY?: boolean;
617
+ resizedX?: boolean;
618
+ font: CommentFont;
619
+ loc: CommentLoc;
620
+ full: boolean;
621
+ flash: boolean;
622
+ lineCount: number;
623
+ lineHeight?: number;
624
+ charSize?: number;
625
+ };
626
+
627
+ type MeasureInput = {
628
+ font: CommentFont;
629
+ content: CommentContentItem[];
630
+ lineHeight: number;
631
+ charSize: number;
632
+ lineCount: number;
633
+ };
634
+
635
635
  type ValueOf<T> = T[keyof T];
636
636
 
637
637
  declare let imageCache: {
package/dist/bundle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- niconicomments.js v0.2.54
2
+ niconicomments.js v0.2.55
3
3
  (c) 2021 xpadev-net https://xpadev.net
4
4
  Released under the MIT License.
5
5
  */
@@ -187,12 +187,13 @@
187
187
  };
188
188
  const getStrokeColor = (comment) => {
189
189
  if (comment.strokeColor) {
190
- const length = comment.strokeColor.length;
190
+ const color = comment.strokeColor.slice(1);
191
+ const length = color.length;
191
192
  if (length === 3 || length === 6) {
192
- return `rgba(${hex2rgb(comment.strokeColor).join(",")},${config.contextStrokeOpacity})`;
193
+ return `rgba(${hex2rgb(color).join(",")},${config.contextStrokeOpacity})`;
193
194
  }
194
195
  else if (length === 4 || length === 8) {
195
- return `rgba(${hex2rgba(comment.strokeColor).join(",")})`;
196
+ return `rgba(${hex2rgba(color).join(",")})`;
196
197
  }
197
198
  }
198
199
  return `rgba(${hex2rgb(comment.color === "#000000"
@@ -783,7 +784,7 @@
783
784
  return colors[value];
784
785
  }
785
786
  else if (typeGuard.comment.colorCodeAllowAlpha(value)) {
786
- return value.slice(1);
787
+ return value;
787
788
  }
788
789
  return;
789
790
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpadev-net/niconicomments",
3
- "version": "0.2.54",
3
+ "version": "0.2.55",
4
4
  "description": "NiconiComments is a comment drawing library that is somewhat compatible with the official Nico Nico Douga player.",
5
5
  "main": "dist/bundle.js",
6
6
  "types": "dist/bundle.d.ts",