@xpadev-net/niconicomments 0.2.38 → 0.2.40

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,6 +1,6 @@
1
- import type { IComment } from "@/@types/IComment";
2
- import type { formattedCommentWithFont, formattedCommentWithSize, measureTextInput, measureTextResult, parsedCommand } from "@/@types/types";
3
- import type { formattedComment } from "@/@types/format.formatted";
1
+
2
+
3
+
4
4
  declare class FlashComment implements IComment {
5
5
  private readonly context;
6
6
  readonly comment: formattedCommentWithSize;
@@ -11,7 +11,7 @@ declare class FlashComment implements IComment {
11
11
  image?: HTMLCanvasElement | null;
12
12
  constructor(comment: formattedComment, context: CanvasRenderingContext2D);
13
13
  get invisible(): boolean;
14
- get loc(): import("@/@types/types").commentLoc;
14
+ get loc(): commentLoc;
15
15
  get long(): number;
16
16
  get vpos(): number;
17
17
  get width(): number;
@@ -30,9 +30,9 @@ declare class FlashComment implements IComment {
30
30
  }
31
31
 
32
32
 
33
- import type { IComment } from "@/@types/IComment";
34
- import type { formattedCommentWithFont, formattedCommentWithSize, measureTextInput, measureTextResult } from "@/@types/types";
35
- import type { formattedComment } from "@/@types/format.formatted";
33
+
34
+
35
+
36
36
  declare class HTML5Comment implements IComment {
37
37
  private readonly context;
38
38
  readonly comment: formattedCommentWithSize;
@@ -40,7 +40,7 @@ declare class HTML5Comment implements IComment {
40
40
  image?: HTMLCanvasElement | null;
41
41
  constructor(comment: formattedComment, context: CanvasRenderingContext2D);
42
42
  get invisible(): boolean;
43
- get loc(): import("@/@types/types").commentLoc;
43
+ get loc(): commentLoc;
44
44
  get long(): number;
45
45
  get vpos(): number;
46
46
  get width(): number;
@@ -67,7 +67,7 @@ declare let imageCache: {
67
67
  declare const resetImageCache: () => void;
68
68
 
69
69
 
70
- import type { nicoScript } from "@/@types/types";
70
+
71
71
  declare let nicoScripts: nicoScript;
72
72
  declare const resetNicoScripts: () => void;
73
73
 
@@ -103,8 +103,8 @@ declare const colors: {
103
103
  };
104
104
 
105
105
 
106
- import type { BaseConfig } from "@/@types/config";
107
- import type { BaseOptions } from "@/@types/options";
106
+
107
+
108
108
  declare let defaultConfig: BaseConfig;
109
109
  declare const initConfig: () => void;
110
110
  declare const defaultOptions: BaseOptions;
@@ -220,68 +220,68 @@ declare const fonts: {
220
220
  };
221
221
 
222
222
 
223
- type configItem<T> = T | { html5: T; flash: T };
224
- type configSizeItem<T> = { big: T; medium: T; small: T };
225
- type configResizedItem<T> = { default: T; resized: T };
226
-
227
- type commentStageSize = { width: number; fullWidth: number; height: number };
228
-
229
- type flashCharList = {
230
- [key in "simsunStrong" | "simsunWeak" | "gulim" | "gothic"]: string;
231
- };
232
- type flashMode = "xp" | "vista";
233
- type flashScriptChar = {
234
- [key in "super" | "sub"]: string;
235
- };
236
- type fontList = {
237
- [key in "gulim" | "simsun"]: string;
238
- };
239
- type lineCounts = {
240
- [key in "default" | "resized" | "doubleResized"]: configSizeItem<number>;
241
- };
242
- type typeDoubleResizeMaxWidth = {
243
- [key in "full" | "normal"]: number;
244
- };
245
-
246
- type BaseConfig = {
247
- cacheAge: number;
248
- canvasHeight: number;
249
- canvasWidth: number;
250
- collisionRange: { [key in "left" | "right"]: number };
251
- colors: { [key: string]: string };
252
- commentDrawPadding: number;
253
- commentDrawRange: number;
254
- commentScale: configItem<number>;
255
- commentStageSize: configItem<commentStageSize>;
256
- commentYMarginBottom: configSizeItem<number>;
257
- commentYOffset: configSizeItem<configResizedItem<number>>;
258
- commentYPaddingTop: configResizedItem<number>;
259
- contextFillLiveOpacity: number;
260
- contextLineWidth: number;
261
- contextStrokeColor: string;
262
- contextStrokeInversionColor: string;
263
- contextStrokeOpacity: number;
264
- doubleResizeMaxWidth: configItem<typeDoubleResizeMaxWidth>;
265
- flashChar: flashCharList;
266
- flashMode: flashMode;
267
- flashScriptChar: flashScriptChar;
268
- flashThreshold: number;
269
- font: fontList;
270
- fonts: platformFont;
271
- fontSize: configItem<configSizeItem<configResizedItem<number>>>;
272
- fpsInterval: number;
273
- hiResCommentCorrection: number;
274
- lineCounts: configItem<lineCounts>;
275
- lineHeight: configItem<configSizeItem<configResizedItem<number>>>;
276
- minFontSize: number;
277
- sameCAGap: number;
278
- sameCAMinScore: number;
279
- sameCARange: number;
280
- letterSpacing: number;
281
- scriptCharOffset: number;
282
- };
283
-
284
- export type Config = Partial<BaseConfig>;
223
+ type configItem<T> = T | { html5: T; flash: T };
224
+ type configSizeItem<T> = { big: T; medium: T; small: T };
225
+ type configResizedItem<T> = { default: T; resized: T };
226
+
227
+ type commentStageSize = { width: number; fullWidth: number; height: number };
228
+
229
+ type flashCharList = {
230
+ [key in "simsunStrong" | "simsunWeak" | "gulim" | "gothic"]: string;
231
+ };
232
+ type flashMode = "xp" | "vista";
233
+ type flashScriptChar = {
234
+ [key in "super" | "sub"]: string;
235
+ };
236
+ type fontList = {
237
+ [key in "gulim" | "simsun"]: string;
238
+ };
239
+ type lineCounts = {
240
+ [key in "default" | "resized" | "doubleResized"]: configSizeItem<number>;
241
+ };
242
+ type typeDoubleResizeMaxWidth = {
243
+ [key in "full" | "normal"]: number;
244
+ };
245
+
246
+ type BaseConfig = {
247
+ cacheAge: number;
248
+ canvasHeight: number;
249
+ canvasWidth: number;
250
+ collisionRange: { [key in "left" | "right"]: number };
251
+ colors: { [key: string]: string };
252
+ commentDrawPadding: number;
253
+ commentDrawRange: number;
254
+ commentScale: configItem<number>;
255
+ commentStageSize: configItem<commentStageSize>;
256
+ commentYMarginBottom: configSizeItem<number>;
257
+ commentYOffset: configSizeItem<configResizedItem<number>>;
258
+ commentYPaddingTop: configResizedItem<number>;
259
+ contextFillLiveOpacity: number;
260
+ contextLineWidth: number;
261
+ contextStrokeColor: string;
262
+ contextStrokeInversionColor: string;
263
+ contextStrokeOpacity: number;
264
+ doubleResizeMaxWidth: configItem<typeDoubleResizeMaxWidth>;
265
+ flashChar: flashCharList;
266
+ flashMode: flashMode;
267
+ flashScriptChar: flashScriptChar;
268
+ flashThreshold: number;
269
+ font: fontList;
270
+ fonts: platformFont;
271
+ fontSize: configItem<configSizeItem<configResizedItem<number>>>;
272
+ fpsInterval: number;
273
+ hiResCommentCorrection: number;
274
+ lineCounts: configItem<lineCounts>;
275
+ lineHeight: configItem<configSizeItem<configResizedItem<number>>>;
276
+ minFontSize: number;
277
+ sameCAGap: number;
278
+ sameCAMinScore: number;
279
+ sameCARange: number;
280
+ letterSpacing: number;
281
+ scriptCharOffset: number;
282
+ };
283
+
284
+ export type Config = Partial<BaseConfig>;
285
285
 
286
286
  type platform =
287
287
  | "win7"
@@ -301,94 +301,94 @@ type platformFont = {
301
301
  [key in HTML5Fonts]: FontItem;
302
302
  };
303
303
 
304
- export type formattedComment = {
305
- id: number;
306
- vpos: number;
307
- content: string;
308
- date: number;
309
- date_usec: number;
310
- owner: boolean;
311
- premium: boolean;
312
- mail: string[];
313
- user_id: number;
314
- layer: number;
315
- };
316
- export type formattedLegacyComment = {
317
- id: number;
318
- vpos: number;
319
- content: string;
320
- date: number;
321
- date_usec: number;
322
- owner: boolean;
323
- premium: boolean;
324
- mail: string[];
325
- };
304
+ export type formattedComment = {
305
+ id: number;
306
+ vpos: number;
307
+ content: string;
308
+ date: number;
309
+ date_usec: number;
310
+ owner: boolean;
311
+ premium: boolean;
312
+ mail: string[];
313
+ user_id: number;
314
+ layer: number;
315
+ };
316
+ export type formattedLegacyComment = {
317
+ id: number;
318
+ vpos: number;
319
+ content: string;
320
+ date: number;
321
+ date_usec: number;
322
+ owner: boolean;
323
+ premium: boolean;
324
+ mail: string[];
325
+ };
326
326
 
327
- export type rawApiResponse = {
328
- [key: string]: apiPing | apiThread | apiLeaf | apiGlobalNumRes | apiChat;
329
- };
330
- type apiPing = {
331
- content: string;
332
- };
333
- type apiThread = {
334
- resultcode: number;
335
- thread: string;
336
- server_time: number;
337
- ticket: string;
338
- revision: number;
339
- };
340
- type apiLeaf = {
341
- thread: string;
342
- count: number;
343
- };
344
- type apiGlobalNumRes = {
345
- thread: string;
346
- num_res: number;
347
- };
348
- type apiChat = {
349
- thread: string;
350
- no: number;
351
- vpos: number;
352
- date: number;
353
- date_usec: number;
354
- nicoru: number;
355
- premium: number;
356
- anonymity: number;
357
- user_id: string;
358
- mail: string;
359
- content: string;
360
- deleted: number;
361
- };
327
+ export type rawApiResponse = {
328
+ [key: string]: apiPing | apiThread | apiLeaf | apiGlobalNumRes | apiChat;
329
+ };
330
+ type apiPing = {
331
+ content: string;
332
+ };
333
+ type apiThread = {
334
+ resultcode: number;
335
+ thread: string;
336
+ server_time: number;
337
+ ticket: string;
338
+ revision: number;
339
+ };
340
+ type apiLeaf = {
341
+ thread: string;
342
+ count: number;
343
+ };
344
+ type apiGlobalNumRes = {
345
+ thread: string;
346
+ num_res: number;
347
+ };
348
+ type apiChat = {
349
+ thread: string;
350
+ no: number;
351
+ vpos: number;
352
+ date: number;
353
+ date_usec: number;
354
+ nicoru: number;
355
+ premium: number;
356
+ anonymity: number;
357
+ user_id: string;
358
+ mail: string;
359
+ content: string;
360
+ deleted: number;
361
+ };
362
362
 
363
- export type ownerComment = {
364
- time: string;
365
- command: string;
366
- comment: string;
367
- };
363
+ export type ownerComment = {
364
+ time: string;
365
+ command: string;
366
+ comment: string;
367
+ };
368
368
 
369
- export type v1Thread = {
370
- id: string;
371
- fork: string;
372
- commentCount: number;
373
- comments: { [key: string]: v1Comment };
374
- };
375
- type v1Comment = {
376
- id: string;
377
- no: number;
378
- vposMs: number;
379
- body: string;
380
- commands: string[];
381
- userId: string;
382
- isPremium: boolean;
383
- score: number;
384
- postedAt: string;
385
- nicoruCount: number;
386
- nicoruId: undefined;
387
- source: string;
388
- isMyPost: boolean;
389
- };
369
+ export type v1Thread = {
370
+ id: string;
371
+ fork: string;
372
+ commentCount: number;
373
+ comments: { [key: string]: v1Comment };
374
+ };
375
+ type v1Comment = {
376
+ id: string;
377
+ no: number;
378
+ vposMs: number;
379
+ body: string;
380
+ commands: string[];
381
+ userId: string;
382
+ isPremium: boolean;
383
+ score: number;
384
+ postedAt: string;
385
+ nicoruCount: number;
386
+ nicoruId: undefined;
387
+ source: string;
388
+ isMyPost: boolean;
389
+ };
390
390
 
391
- import { commentLoc, formattedCommentWithSize } from "@/@types/types";
391
+
392
392
 
393
393
  export interface IComment {
394
394
  comment: formattedCommentWithSize;
@@ -408,14 +408,11 @@ export interface IComment {
408
408
  draw: (vpos: number, showCollision: boolean, isDebug: boolean) => void;
409
409
  }
410
410
 
411
- import {
412
- formattedComment,
413
- formattedLegacyComment,
414
- } from "@/@types/format.formatted";
415
- import { rawApiResponse } from "@/@types/format.legacy";
416
- import { ownerComment } from "@/@types/format.owner";
417
- import { v1Thread } from "@/@types/format.v1";
418
- import { Config } from "@/@types/config";
411
+
412
+
413
+
414
+
415
+
419
416
 
420
417
  export type inputFormatType =
421
418
  | "XMLDocument"
@@ -454,7 +451,7 @@ type BaseOptions = {
454
451
  };
455
452
  export type Options = Partial<BaseOptions>;
456
453
 
457
- import { IComment } from "@/@types/IComment";
454
+
458
455
 
459
456
  type formattedCommentWithFont = {
460
457
  id: number;
@@ -606,13 +603,13 @@ type measureInput = {
606
603
  lineCount: number;
607
604
  };
608
605
 
609
- import type { inputFormatType } from "@/@types/options";
610
- import type { formattedComment } from "@/@types/format.formatted";
606
+
607
+
611
608
  declare const convert2formattedComment: (data: unknown, type: inputFormatType) => formattedComment[];
612
609
 
613
610
 
614
- import type { inputFormat, Options } from "@/@types/options";
615
- import type { formattedComment } from "@/@types/format.formatted";
611
+
612
+
616
613
  declare class NiconiComments {
617
614
  enableLegacyPiP: boolean;
618
615
  showCollision: boolean;
@@ -628,44 +625,44 @@ declare class NiconiComments {
628
625
  formatted: {
629
626
  comment: (i: unknown) => i is formattedComment;
630
627
  comments: (i: unknown) => i is formattedComment[];
631
- legacyComment: (i: unknown) => i is import("@/@types/format.formatted").formattedLegacyComment;
632
- legacyComments: (i: unknown) => i is import("@/@types/format.formatted").formattedLegacyComment[];
628
+ legacyComment: (i: unknown) => i is formattedLegacyComment;
629
+ legacyComments: (i: unknown) => i is formattedLegacyComment[];
633
630
  };
634
631
  legacy: {
635
- rawApiResponses: (i: unknown) => i is import("./@types/format.legacy").rawApiResponse[];
636
- apiChat: (i: unknown) => i is import("./@types/format.legacy").apiChat;
637
- apiGlobalNumRes: (i: unknown) => i is import("./@types/format.legacy").apiGlobalNumRes;
638
- apiLeaf: (i: unknown) => i is import("./@types/format.legacy").apiLeaf;
639
- apiPing: (i: unknown) => i is import("./@types/format.legacy").apiPing;
640
- apiThread: (i: unknown) => i is import("./@types/format.legacy").apiThread;
632
+ rawApiResponses: (i: unknown) => i is rawApiResponse[];
633
+ apiChat: (i: unknown) => i is apiChat;
634
+ apiGlobalNumRes: (i: unknown) => i is apiGlobalNumRes;
635
+ apiLeaf: (i: unknown) => i is apiLeaf;
636
+ apiPing: (i: unknown) => i is apiPing;
637
+ apiThread: (i: unknown) => i is apiThread;
641
638
  };
642
639
  xmlDocument: (i: unknown) => i is XMLDocument;
643
640
  legacyOwner: {
644
641
  comments: (i: unknown) => i is string;
645
642
  };
646
643
  owner: {
647
- comment: (i: unknown) => i is import("./@types/format.owner").ownerComment;
648
- comments: (i: unknown) => i is import("./@types/format.owner").ownerComment[];
644
+ comment: (i: unknown) => i is ownerComment;
645
+ comments: (i: unknown) => i is ownerComment[];
649
646
  };
650
647
  v1: {
651
- comment: (i: unknown) => i is import("./@types/format.v1").v1Comment;
652
- thread: (i: unknown) => i is import("./@types/format.v1").v1Thread;
653
- threads: (i: unknown) => i is import("./@types/format.v1").v1Thread[];
648
+ comment: (i: unknown) => i is v1Comment;
649
+ thread: (i: unknown) => i is v1Thread;
650
+ threads: (i: unknown) => i is v1Thread[];
654
651
  };
655
652
  nicoScript: {
656
653
  range: {
657
- target: (i: unknown) => i is import("@/@types/types").nicoScriptReverseTarget;
654
+ target: (i: unknown) => i is nicoScriptReverseTarget;
658
655
  };
659
656
  replace: {
660
- range: (i: unknown) => i is import("@/@types/types").nicoScriptReplaceRange;
661
- target: (i: unknown) => i is import("@/@types/types").nicoScriptReplaceTarget;
662
- condition: (i: unknown) => i is import("@/@types/types").nicoScriptReplaceCondition;
657
+ range: (i: unknown) => i is nicoScriptReplaceRange;
658
+ target: (i: unknown) => i is nicoScriptReplaceTarget;
659
+ condition: (i: unknown) => i is nicoScriptReplaceCondition;
663
660
  };
664
661
  };
665
662
  comment: {
666
- font: (i: unknown) => i is import("@/@types/types").commentFont;
667
- loc: (i: unknown) => i is import("@/@types/types").commentLoc;
668
- size: (i: unknown) => i is import("@/@types/types").commentSize;
663
+ font: (i: unknown) => i is commentFont;
664
+ loc: (i: unknown) => i is commentLoc;
665
+ size: (i: unknown) => i is commentSize;
669
666
  command: {
670
667
  key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
671
668
  };
@@ -673,7 +670,7 @@ declare class NiconiComments {
673
670
  colorCode: (i: unknown) => i is string;
674
671
  };
675
672
  config: {
676
- initOptions: (item: unknown) => item is Partial<import("@/@types/options").BaseOptions>;
673
+ initOptions: (item: unknown) => item is Partial<BaseOptions>;
677
674
  };
678
675
  };
679
676
  constructor(canvas: HTMLCanvasElement, data: inputFormat, initOptions?: Options);
@@ -686,7 +683,7 @@ declare class NiconiComments {
686
683
  }
687
684
 
688
685
 
689
- import type { commentSize, measureInput } from "@/@types/types";
686
+
690
687
  declare const getLineHeight: (fontSize: commentSize, isFlash: boolean, resized?: boolean) => number;
691
688
  declare const getCharSize: (fontSize: commentSize, isFlash: boolean) => number;
692
689
  declare const measure: (comment: measureInput, context: CanvasRenderingContext2D) => {
@@ -701,11 +698,11 @@ declare const getFontSizeAndScale: (charSize: number) => {
701
698
  };
702
699
 
703
700
 
704
- import type { formattedComment, formattedLegacyComment } from "@/@types/format.formatted";
705
- import type { apiChat, apiGlobalNumRes, apiLeaf, apiPing, apiThread, rawApiResponse } from "@/@types/format.legacy";
706
- import type { ownerComment } from "@/@types/format.owner";
707
- import type { v1Comment, v1Thread } from "@/@types/format.v1";
708
- import type { commentFont, commentLoc, commentSize, nicoScriptReplaceCondition, nicoScriptReplaceRange, nicoScriptReplaceTarget, nicoScriptReverseTarget } from "@/@types/types";
701
+
702
+
703
+
704
+
705
+
709
706
  declare const typeGuard: {
710
707
  formatted: {
711
708
  comment: (i: unknown) => i is formattedComment;
@@ -755,15 +752,15 @@ declare const typeGuard: {
755
752
  colorCode: (i: unknown) => i is string;
756
753
  };
757
754
  config: {
758
- initOptions: (item: unknown) => item is Partial<import("@/@types/options").BaseOptions>;
755
+ initOptions: (item: unknown) => item is Partial<BaseOptions>;
759
756
  };
760
757
  };
761
758
 
762
759
 
763
- import type { configItem } from "@/@types/config";
764
- import type { IComment } from "@/@types/IComment";
765
- import type { commentFont, formattedCommentWithFont, formattedCommentWithSize } from "@/@types/types";
766
- import type { formattedComment } from "@/@types/format.formatted";
760
+
761
+
762
+
763
+
767
764
  declare const getPosY: (currentPos: number, targetComment: IComment, collision: IComment[] | undefined) => {
768
765
  currentPos: number;
769
766
  isChanged: boolean;
package/dist/bundle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- niconicomments.js v0.2.38
2
+ niconicomments.js v0.2.40
3
3
  (c) 2021 xpadev-net https://xpadev.net
4
4
  Released under the MIT License.
5
5
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpadev-net/niconicomments",
3
- "version": "0.2.38",
3
+ "version": "0.2.40",
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",