@xpadev-net/niconicomments 0.2.38 → 0.2.39

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;
@@ -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,14 @@ export interface IComment {
408
408
  draw: (vpos: number, showCollision: boolean, isDebug: boolean) => void;
409
409
  }
410
410
 
411
- import {
411
+ import type {
412
412
  formattedComment,
413
413
  formattedLegacyComment,
414
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";
415
+
416
+
417
+
418
+
419
419
 
420
420
  export type inputFormatType =
421
421
  | "XMLDocument"
@@ -454,7 +454,7 @@ type BaseOptions = {
454
454
  };
455
455
  export type Options = Partial<BaseOptions>;
456
456
 
457
- import { IComment } from "@/@types/IComment";
457
+
458
458
 
459
459
  type formattedCommentWithFont = {
460
460
  id: number;
@@ -606,13 +606,13 @@ type measureInput = {
606
606
  lineCount: number;
607
607
  };
608
608
 
609
- import type { inputFormatType } from "@/@types/options";
610
- import type { formattedComment } from "@/@types/format.formatted";
609
+
610
+
611
611
  declare const convert2formattedComment: (data: unknown, type: inputFormatType) => formattedComment[];
612
612
 
613
613
 
614
- import type { inputFormat, Options } from "@/@types/options";
615
- import type { formattedComment } from "@/@types/format.formatted";
614
+
615
+
616
616
  declare class NiconiComments {
617
617
  enableLegacyPiP: boolean;
618
618
  showCollision: boolean;
@@ -686,7 +686,7 @@ declare class NiconiComments {
686
686
  }
687
687
 
688
688
 
689
- import type { commentSize, measureInput } from "@/@types/types";
689
+
690
690
  declare const getLineHeight: (fontSize: commentSize, isFlash: boolean, resized?: boolean) => number;
691
691
  declare const getCharSize: (fontSize: commentSize, isFlash: boolean) => number;
692
692
  declare const measure: (comment: measureInput, context: CanvasRenderingContext2D) => {
@@ -701,11 +701,11 @@ declare const getFontSizeAndScale: (charSize: number) => {
701
701
  };
702
702
 
703
703
 
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";
704
+
705
+
706
+
707
+
708
+
709
709
  declare const typeGuard: {
710
710
  formatted: {
711
711
  comment: (i: unknown) => i is formattedComment;
@@ -760,10 +760,10 @@ declare const typeGuard: {
760
760
  };
761
761
 
762
762
 
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";
763
+
764
+
765
+
766
+
767
767
  declare const getPosY: (currentPos: number, targetComment: IComment, collision: IComment[] | undefined) => {
768
768
  currentPos: number;
769
769
  isChanged: boolean;
package/dist/bundle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- niconicomments.js v0.2.38
2
+ niconicomments.js v0.2.39
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.39",
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",