@xpadev-net/niconicomments 0.2.72 → 0.2.73

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.
Files changed (3) hide show
  1. package/dist/bundle.d.ts +64 -612
  2. package/dist/bundle.js +153 -191
  3. package/package.json +18 -22
package/dist/bundle.d.ts CHANGED
@@ -2789,336 +2789,68 @@ declare namespace index_d$1 {
2789
2789
 
2790
2790
  declare const typeGuard: {
2791
2791
  formatted: {
2792
- comment: (i: unknown) => i is {
2793
- owner: boolean;
2794
- content: string;
2795
- id: number;
2796
- vpos: number;
2797
- date: number;
2798
- date_usec: number;
2799
- premium: boolean;
2800
- mail: string[];
2801
- user_id: number;
2802
- layer: number;
2803
- is_my_post: boolean;
2804
- };
2805
- comments: (i: unknown) => i is {
2806
- owner: boolean;
2807
- content: string;
2808
- id: number;
2809
- vpos: number;
2810
- date: number;
2811
- date_usec: number;
2812
- premium: boolean;
2813
- mail: string[];
2814
- user_id: number;
2815
- layer: number;
2816
- is_my_post: boolean;
2817
- }[];
2818
- legacyComment: (i: unknown) => i is {
2819
- owner: boolean;
2820
- content: string;
2821
- id: number;
2822
- vpos: number;
2823
- date: number;
2824
- date_usec: number;
2825
- premium: boolean;
2826
- mail: string[];
2827
- };
2828
- legacyComments: (i: unknown) => i is {
2829
- owner: boolean;
2830
- content: string;
2831
- id: number;
2832
- vpos: number;
2833
- date: number;
2834
- date_usec: number;
2835
- premium: boolean;
2836
- mail: string[];
2837
- }[];
2792
+ comment: (i: unknown) => i is FormattedComment;
2793
+ comments: (i: unknown) => i is FormattedComment[];
2794
+ legacyComment: (i: unknown) => i is FormattedLegacyComment;
2795
+ legacyComments: (i: unknown) => i is FormattedLegacyComment[];
2838
2796
  };
2839
2797
  legacy: {
2840
- rawApiResponses: (i: unknown) => i is ({
2841
- chat: {
2842
- content: string;
2843
- vpos: number;
2844
- date: number;
2845
- date_usec: number;
2846
- premium: number;
2847
- mail: string;
2848
- user_id: string;
2849
- thread: string;
2850
- no: number;
2851
- nicoru: number;
2852
- anonymity: number;
2853
- deleted: number;
2854
- };
2855
- } | {
2856
- [x: string]: unknown;
2857
- })[];
2858
- apiChat: (i: unknown) => i is {
2859
- content: string;
2860
- vpos: number;
2861
- date: number;
2862
- date_usec: number;
2863
- premium: number;
2864
- mail: string;
2865
- user_id: string;
2866
- thread: string;
2867
- no: number;
2868
- nicoru: number;
2869
- anonymity: number;
2870
- deleted: number;
2871
- };
2872
- apiGlobalNumRes: (i: unknown) => i is {
2873
- thread: string;
2874
- num_res: number;
2875
- };
2876
- apiLeaf: (i: unknown) => i is {
2877
- count: number;
2878
- thread: string;
2879
- };
2880
- apiPing: (i: unknown) => i is {
2881
- content: string;
2882
- };
2883
- apiThread: (i: unknown) => i is {
2884
- thread: string;
2885
- resultcode: number;
2886
- server_time: number;
2887
- ticket: string;
2888
- revision: number;
2889
- };
2798
+ rawApiResponses: (i: unknown) => i is RawApiResponse[];
2799
+ apiChat: (i: unknown) => i is ApiChat;
2800
+ apiGlobalNumRes: (i: unknown) => i is ApiGlobalNumRes;
2801
+ apiLeaf: (i: unknown) => i is ApiLeaf;
2802
+ apiPing: (i: unknown) => i is ApiPing;
2803
+ apiThread: (i: unknown) => i is ApiThread;
2890
2804
  };
2891
2805
  xmlDocument: (i: unknown) => i is XMLDocument;
2892
2806
  xml2js: {
2893
- packet: (i: unknown) => i is {
2894
- packet: {
2895
- chat: {
2896
- _: string;
2897
- $: {
2898
- owner: string;
2899
- vpos: string;
2900
- date: string;
2901
- date_usec: string;
2902
- premium: string;
2903
- mail: string;
2904
- user_id?: string | undefined;
2905
- no?: string | undefined;
2906
- };
2907
- }[];
2908
- };
2909
- };
2910
- chat: (i: unknown) => i is {
2911
- chat: {
2912
- _: string;
2913
- $: {
2914
- owner: string;
2915
- vpos: string;
2916
- date: string;
2917
- date_usec: string;
2918
- premium: string;
2919
- mail: string;
2920
- user_id?: string | undefined;
2921
- no?: string | undefined;
2922
- };
2923
- }[];
2924
- };
2925
- chatItem: (i: unknown) => i is {
2926
- _: string;
2927
- $: {
2928
- owner: string;
2929
- vpos: string;
2930
- date: string;
2931
- date_usec: string;
2932
- premium: string;
2933
- mail: string;
2934
- user_id?: string | undefined;
2935
- no?: string | undefined;
2936
- };
2937
- };
2807
+ packet: (i: unknown) => i is Xml2jsPacket;
2808
+ chat: (i: unknown) => i is Xml2jsChat;
2809
+ chatItem: (i: unknown) => i is Xml2jsChatItem;
2938
2810
  };
2939
2811
  legacyOwner: {
2940
2812
  comments: (i: unknown) => i is string;
2941
2813
  };
2942
2814
  owner: {
2943
- comment: (i: unknown) => i is {
2944
- time: string;
2945
- command: string;
2946
- comment: string;
2947
- };
2948
- comments: (i: unknown) => i is {
2949
- time: string;
2950
- command: string;
2951
- comment: string;
2952
- }[];
2815
+ comment: (i: unknown) => i is OwnerComment;
2816
+ comments: (i: unknown) => i is OwnerComment[];
2953
2817
  };
2954
2818
  v1: {
2955
- comment: (i: unknown) => i is {
2956
- id: string;
2957
- no: number;
2958
- vposMs: number;
2959
- body: string;
2960
- commands: string[];
2961
- userId: string;
2962
- isPremium: boolean;
2963
- score: number;
2964
- postedAt: string;
2965
- nicoruCount: number;
2966
- nicoruId: string | null;
2967
- source: string;
2968
- isMyPost: boolean;
2969
- };
2970
- comments: (i: unknown) => i is {
2971
- id: string;
2972
- no: number;
2973
- vposMs: number;
2974
- body: string;
2975
- commands: string[];
2976
- userId: string;
2977
- isPremium: boolean;
2978
- score: number;
2979
- postedAt: string;
2980
- nicoruCount: number;
2981
- nicoruId: string | null;
2982
- source: string;
2983
- isMyPost: boolean;
2984
- }[];
2985
- thread: (i: unknown) => i is {
2986
- id: unknown;
2987
- fork: string;
2988
- commentCount: number;
2989
- comments: {
2990
- id: string;
2991
- no: number;
2992
- vposMs: number;
2993
- body: string;
2994
- commands: string[];
2995
- userId: string;
2996
- isPremium: boolean;
2997
- score: number;
2998
- postedAt: string;
2999
- nicoruCount: number;
3000
- nicoruId: string | null;
3001
- source: string;
3002
- isMyPost: boolean;
3003
- }[];
3004
- };
3005
- threads: (i: unknown) => i is {
3006
- id: unknown;
3007
- fork: string;
3008
- commentCount: number;
3009
- comments: {
3010
- id: string;
3011
- no: number;
3012
- vposMs: number;
3013
- body: string;
3014
- commands: string[];
3015
- userId: string;
3016
- isPremium: boolean;
3017
- score: number;
3018
- postedAt: string;
3019
- nicoruCount: number;
3020
- nicoruId: string | null;
3021
- source: string;
3022
- isMyPost: boolean;
3023
- }[];
3024
- }[];
2819
+ comment: (i: unknown) => i is V1Comment;
2820
+ comments: (i: unknown) => i is V1Comment[];
2821
+ thread: (i: unknown) => i is V1Thread;
2822
+ threads: (i: unknown) => i is V1Thread[];
3025
2823
  };
3026
2824
  nicoScript: {
3027
2825
  range: {
3028
- target: (i: unknown) => i is "コメ" | "投コメ" | "全";
2826
+ target: (i: unknown) => i is NicoScriptReverseTarget;
3029
2827
  };
3030
2828
  replace: {
3031
- range: (i: unknown) => i is "全" | "単";
3032
- target: (i: unknown) => i is "コメ" | "投コメ" | "全" | "含まない" | "含む";
3033
- condition: (i: unknown) => i is "部分一致" | "完全一致";
2829
+ range: (i: unknown) => i is NicoScriptReplaceRange;
2830
+ target: (i: unknown) => i is NicoScriptReplaceTarget;
2831
+ condition: (i: unknown) => i is NicoScriptReplaceCondition;
3034
2832
  };
3035
2833
  };
3036
2834
  comment: {
3037
- font: (i: unknown) => i is "defont" | "mincho" | "gothic" | "gulim" | "simsun";
3038
- loc: (i: unknown) => i is "ue" | "naka" | "shita";
3039
- size: (i: unknown) => i is "big" | "medium" | "small";
2835
+ font: (i: unknown) => i is CommentFont;
2836
+ loc: (i: unknown) => i is CommentLoc;
2837
+ size: (i: unknown) => i is CommentSize;
3040
2838
  command: {
3041
2839
  key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
3042
2840
  };
3043
- 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";
2841
+ color: (i: unknown) => i is keyof typeof colors;
3044
2842
  colorCode: (i: unknown) => i is string;
3045
2843
  colorCodeAllowAlpha: (i: unknown) => i is string;
3046
2844
  };
3047
2845
  config: {
3048
- initOptions: (item: unknown) => item is Partial<BaseOptions>;
2846
+ initOptions: (item: unknown) => item is Options;
3049
2847
  };
3050
2848
  internal: {
3051
- CommentMeasuredContentItem: (i: unknown) => i is {
3052
- type: "spacer";
3053
- char: string;
3054
- charWidth: number;
3055
- count: number;
3056
- isButton?: boolean | undefined;
3057
- font?: "defont" | "gulim" | "simsun" | undefined;
3058
- } | (({
3059
- type: "spacer";
3060
- char: string;
3061
- charWidth: number;
3062
- count: number;
3063
- isButton?: boolean | undefined;
3064
- font?: "defont" | "gulim" | "simsun" | undefined;
3065
- } | {
3066
- type: "text";
3067
- content: string;
3068
- slicedContent: string[];
3069
- isButton?: boolean | undefined;
3070
- font?: "defont" | "gulim" | "simsun" | undefined;
3071
- width?: number[] | undefined;
3072
- }) & {
3073
- width: number[];
3074
- });
3075
- CommentMeasuredContentItemArray: (i: unknown) => i is ({
3076
- type: "spacer";
3077
- char: string;
3078
- charWidth: number;
3079
- count: number;
3080
- isButton?: boolean | undefined;
3081
- font?: "defont" | "gulim" | "simsun" | undefined;
3082
- } | (({
3083
- type: "spacer";
3084
- char: string;
3085
- charWidth: number;
3086
- count: number;
3087
- isButton?: boolean | undefined;
3088
- font?: "defont" | "gulim" | "simsun" | undefined;
3089
- } | {
3090
- type: "text";
3091
- content: string;
3092
- slicedContent: string[];
3093
- isButton?: boolean | undefined;
3094
- font?: "defont" | "gulim" | "simsun" | undefined;
3095
- width?: number[] | undefined;
3096
- }) & {
3097
- width: number[];
3098
- }))[];
2849
+ CommentMeasuredContentItem: (i: unknown) => i is CommentMeasuredContentItem;
2850
+ CommentMeasuredContentItemArray: (i: unknown) => i is CommentMeasuredContentItem[];
3099
2851
  MultiConfigItem: <T>(i: unknown) => i is MultiConfigItem<T>;
3100
- HTML5Fonts: (i: unknown) => i is "defont" | "mincho" | "gothic";
3101
- MeasureInput: (i: unknown) => i is {
3102
- lineHeight: number;
3103
- font: "defont" | "mincho" | "gothic" | "gulim" | "simsun";
3104
- content: ({
3105
- type: "spacer";
3106
- char: string;
3107
- charWidth: number;
3108
- count: number;
3109
- isButton?: boolean | undefined;
3110
- font?: "defont" | "gulim" | "simsun" | undefined;
3111
- } | {
3112
- type: "text";
3113
- content: string;
3114
- slicedContent: string[];
3115
- isButton?: boolean | undefined;
3116
- font?: "defont" | "gulim" | "simsun" | undefined;
3117
- width?: number[] | undefined;
3118
- })[];
3119
- charSize: number;
3120
- lineCount: number;
3121
- };
2852
+ HTML5Fonts: (i: unknown) => i is HTML5Fonts;
2853
+ MeasureInput: (i: unknown) => i is MeasureInput;
3122
2854
  };
3123
2855
  };
3124
2856
 
@@ -3254,254 +2986,52 @@ declare class NiconiComments {
3254
2986
  private readonly timeline;
3255
2987
  static typeGuard: {
3256
2988
  formatted: {
3257
- comment: (i: unknown) => i is {
3258
- owner: boolean;
3259
- content: string;
3260
- id: number;
3261
- vpos: number;
3262
- date: number;
3263
- date_usec: number;
3264
- premium: boolean;
3265
- mail: string[];
3266
- user_id: number;
3267
- layer: number;
3268
- is_my_post: boolean;
3269
- };
3270
- comments: (i: unknown) => i is {
3271
- owner: boolean;
3272
- content: string;
3273
- id: number;
3274
- vpos: number;
3275
- date: number;
3276
- date_usec: number;
3277
- premium: boolean;
3278
- mail: string[];
3279
- user_id: number;
3280
- layer: number;
3281
- is_my_post: boolean;
3282
- }[];
3283
- legacyComment: (i: unknown) => i is {
3284
- owner: boolean;
3285
- content: string;
3286
- id: number;
3287
- vpos: number;
3288
- date: number;
3289
- date_usec: number;
3290
- premium: boolean;
3291
- mail: string[];
3292
- };
3293
- legacyComments: (i: unknown) => i is {
3294
- owner: boolean;
3295
- content: string;
3296
- id: number;
3297
- vpos: number;
3298
- date: number;
3299
- date_usec: number;
3300
- premium: boolean;
3301
- mail: string[];
3302
- }[];
2989
+ comment: (i: unknown) => i is FormattedComment;
2990
+ comments: (i: unknown) => i is FormattedComment[];
2991
+ legacyComment: (i: unknown) => i is FormattedLegacyComment;
2992
+ legacyComments: (i: unknown) => i is FormattedLegacyComment[];
3303
2993
  };
3304
2994
  legacy: {
3305
- rawApiResponses: (i: unknown) => i is ({
3306
- chat: {
3307
- content: string;
3308
- vpos: number;
3309
- date: number;
3310
- date_usec: number;
3311
- premium: number;
3312
- mail: string;
3313
- user_id: string;
3314
- thread: string;
3315
- no: number;
3316
- nicoru: number;
3317
- anonymity: number;
3318
- deleted: number;
3319
- };
3320
- } | {
3321
- [x: string]: unknown;
3322
- })[];
3323
- apiChat: (i: unknown) => i is {
3324
- content: string;
3325
- vpos: number;
3326
- date: number;
3327
- date_usec: number;
3328
- premium: number;
3329
- mail: string;
3330
- user_id: string;
3331
- thread: string;
3332
- no: number;
3333
- nicoru: number;
3334
- anonymity: number;
3335
- deleted: number;
3336
- };
3337
- apiGlobalNumRes: (i: unknown) => i is {
3338
- thread: string;
3339
- num_res: number;
3340
- };
3341
- apiLeaf: (i: unknown) => i is {
3342
- count: number;
3343
- thread: string;
3344
- };
3345
- apiPing: (i: unknown) => i is {
3346
- content: string;
3347
- };
3348
- apiThread: (i: unknown) => i is {
3349
- thread: string;
3350
- resultcode: number;
3351
- server_time: number;
3352
- ticket: string;
3353
- revision: number;
3354
- };
2995
+ rawApiResponses: (i: unknown) => i is RawApiResponse[];
2996
+ apiChat: (i: unknown) => i is ApiChat;
2997
+ apiGlobalNumRes: (i: unknown) => i is ApiGlobalNumRes;
2998
+ apiLeaf: (i: unknown) => i is ApiLeaf;
2999
+ apiPing: (i: unknown) => i is ApiPing;
3000
+ apiThread: (i: unknown) => i is ApiThread;
3355
3001
  };
3356
3002
  xmlDocument: (i: unknown) => i is XMLDocument;
3357
3003
  xml2js: {
3358
- packet: (i: unknown) => i is {
3359
- packet: {
3360
- chat: {
3361
- _: string;
3362
- $: {
3363
- owner: string;
3364
- vpos: string;
3365
- date: string;
3366
- date_usec: string;
3367
- premium: string;
3368
- mail: string;
3369
- user_id?: string | undefined;
3370
- no?: string | undefined;
3371
- };
3372
- }[];
3373
- };
3374
- };
3375
- chat: (i: unknown) => i is {
3376
- chat: {
3377
- _: string;
3378
- $: {
3379
- owner: string;
3380
- vpos: string;
3381
- date: string;
3382
- date_usec: string;
3383
- premium: string;
3384
- mail: string;
3385
- user_id?: string | undefined;
3386
- no?: string | undefined;
3387
- };
3388
- }[];
3389
- };
3390
- chatItem: (i: unknown) => i is {
3391
- _: string;
3392
- $: {
3393
- owner: string;
3394
- vpos: string;
3395
- date: string;
3396
- date_usec: string;
3397
- premium: string;
3398
- mail: string;
3399
- user_id?: string | undefined;
3400
- no?: string | undefined;
3401
- };
3402
- };
3004
+ packet: (i: unknown) => i is Xml2jsPacket;
3005
+ chat: (i: unknown) => i is Xml2jsChat;
3006
+ chatItem: (i: unknown) => i is Xml2jsChatItem;
3403
3007
  };
3404
3008
  legacyOwner: {
3405
3009
  comments: (i: unknown) => i is string;
3406
3010
  };
3407
3011
  owner: {
3408
- comment: (i: unknown) => i is {
3409
- time: string;
3410
- command: string;
3411
- comment: string;
3412
- };
3413
- comments: (i: unknown) => i is {
3414
- time: string;
3415
- command: string;
3416
- comment: string;
3417
- }[];
3012
+ comment: (i: unknown) => i is OwnerComment;
3013
+ comments: (i: unknown) => i is OwnerComment[];
3418
3014
  };
3419
3015
  v1: {
3420
- comment: (i: unknown) => i is {
3421
- id: string;
3422
- no: number;
3423
- vposMs: number;
3424
- body: string;
3425
- commands: string[];
3426
- userId: string;
3427
- isPremium: boolean;
3428
- score: number;
3429
- postedAt: string;
3430
- nicoruCount: number;
3431
- nicoruId: string | null;
3432
- source: string;
3433
- isMyPost: boolean;
3434
- };
3435
- comments: (i: unknown) => i is {
3436
- id: string;
3437
- no: number;
3438
- vposMs: number;
3439
- body: string;
3440
- commands: string[];
3441
- userId: string;
3442
- isPremium: boolean;
3443
- score: number;
3444
- postedAt: string;
3445
- nicoruCount: number;
3446
- nicoruId: string | null;
3447
- source: string;
3448
- isMyPost: boolean;
3449
- }[];
3450
- thread: (i: unknown) => i is {
3451
- id: unknown;
3452
- fork: string;
3453
- commentCount: number;
3454
- comments: {
3455
- id: string;
3456
- no: number;
3457
- vposMs: number;
3458
- body: string;
3459
- commands: string[];
3460
- userId: string;
3461
- isPremium: boolean;
3462
- score: number;
3463
- postedAt: string;
3464
- nicoruCount: number;
3465
- nicoruId: string | null;
3466
- source: string;
3467
- isMyPost: boolean;
3468
- }[];
3469
- };
3470
- threads: (i: unknown) => i is {
3471
- id: unknown;
3472
- fork: string;
3473
- commentCount: number;
3474
- comments: {
3475
- id: string;
3476
- no: number;
3477
- vposMs: number;
3478
- body: string;
3479
- commands: string[];
3480
- userId: string;
3481
- isPremium: boolean;
3482
- score: number;
3483
- postedAt: string;
3484
- nicoruCount: number;
3485
- nicoruId: string | null;
3486
- source: string;
3487
- isMyPost: boolean;
3488
- }[];
3489
- }[];
3016
+ comment: (i: unknown) => i is V1Comment;
3017
+ comments: (i: unknown) => i is V1Comment[];
3018
+ thread: (i: unknown) => i is V1Thread;
3019
+ threads: (i: unknown) => i is V1Thread[];
3490
3020
  };
3491
3021
  nicoScript: {
3492
3022
  range: {
3493
- target: (i: unknown) => i is "コメ" | "投コメ" | "全";
3023
+ target: (i: unknown) => i is NicoScriptReverseTarget;
3494
3024
  };
3495
3025
  replace: {
3496
- range: (i: unknown) => i is "全" | "単";
3497
- target: (i: unknown) => i is "コメ" | "投コメ" | "全" | "含まない" | "含む";
3498
- condition: (i: unknown) => i is "部分一致" | "完全一致";
3026
+ range: (i: unknown) => i is NicoScriptReplaceRange;
3027
+ target: (i: unknown) => i is NicoScriptReplaceTarget;
3028
+ condition: (i: unknown) => i is NicoScriptReplaceCondition;
3499
3029
  };
3500
3030
  };
3501
3031
  comment: {
3502
- font: (i: unknown) => i is "defont" | "mincho" | "gothic" | "gulim" | "simsun";
3503
- loc: (i: unknown) => i is "ue" | "naka" | "shita";
3504
- size: (i: unknown) => i is "big" | "medium" | "small";
3032
+ font: (i: unknown) => i is CommentFont;
3033
+ loc: (i: unknown) => i is CommentLoc;
3034
+ size: (i: unknown) => i is CommentSize;
3505
3035
  command: {
3506
3036
  key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
3507
3037
  };
@@ -3510,97 +3040,19 @@ declare class NiconiComments {
3510
3040
  colorCodeAllowAlpha: (i: unknown) => i is string;
3511
3041
  };
3512
3042
  config: {
3513
- initOptions: (item: unknown) => item is Partial<BaseOptions>;
3043
+ initOptions: (item: unknown) => item is Options;
3514
3044
  };
3515
3045
  internal: {
3516
- CommentMeasuredContentItem: (i: unknown) => i is {
3517
- type: "spacer";
3518
- char: string;
3519
- charWidth: number;
3520
- count: number;
3521
- isButton?: boolean | undefined;
3522
- font?: "defont" | "gulim" | "simsun" | undefined;
3523
- } | (({
3524
- type: "spacer";
3525
- char: string;
3526
- charWidth: number;
3527
- count: number;
3528
- isButton?: boolean | undefined;
3529
- font?: "defont" | "gulim" | "simsun" | undefined;
3530
- } | {
3531
- type: "text";
3532
- content: string;
3533
- slicedContent: string[];
3534
- isButton?: boolean | undefined;
3535
- font?: "defont" | "gulim" | "simsun" | undefined;
3536
- width?: number[] | undefined;
3537
- }) & {
3538
- width: number[];
3539
- });
3540
- CommentMeasuredContentItemArray: (i: unknown) => i is ({
3541
- type: "spacer";
3542
- char: string;
3543
- charWidth: number;
3544
- count: number;
3545
- isButton?: boolean | undefined;
3546
- font?: "defont" | "gulim" | "simsun" | undefined;
3547
- } | (({
3548
- type: "spacer";
3549
- char: string;
3550
- charWidth: number;
3551
- count: number;
3552
- isButton?: boolean | undefined;
3553
- font?: "defont" | "gulim" | "simsun" | undefined;
3554
- } | {
3555
- type: "text";
3556
- content: string;
3557
- slicedContent: string[];
3558
- isButton?: boolean | undefined;
3559
- font?: "defont" | "gulim" | "simsun" | undefined;
3560
- width?: number[] | undefined;
3561
- }) & {
3562
- width: number[];
3563
- }))[];
3046
+ CommentMeasuredContentItem: (i: unknown) => i is CommentMeasuredContentItem;
3047
+ CommentMeasuredContentItemArray: (i: unknown) => i is CommentMeasuredContentItem[];
3564
3048
  MultiConfigItem: <T>(i: unknown) => i is MultiConfigItem<T>;
3565
- HTML5Fonts: (i: unknown) => i is "defont" | "mincho" | "gothic";
3566
- MeasureInput: (i: unknown) => i is {
3567
- lineHeight: number;
3568
- font: "defont" | "mincho" | "gothic" | "gulim" | "simsun";
3569
- content: ({
3570
- type: "spacer";
3571
- char: string;
3572
- charWidth: number;
3573
- count: number;
3574
- isButton?: boolean | undefined;
3575
- font?: "defont" | "gulim" | "simsun" | undefined;
3576
- } | {
3577
- type: "text";
3578
- content: string;
3579
- slicedContent: string[];
3580
- isButton?: boolean | undefined;
3581
- font?: "defont" | "gulim" | "simsun" | undefined;
3582
- width?: number[] | undefined;
3583
- })[];
3584
- charSize: number;
3585
- lineCount: number;
3586
- };
3049
+ HTML5Fonts: (i: unknown) => i is HTML5Fonts;
3050
+ MeasureInput: (i: unknown) => i is MeasureInput;
3587
3051
  };
3588
3052
  };
3589
3053
  static default: typeof NiconiComments;
3590
3054
  static FlashComment: {
3591
- condition: (comment: {
3592
- owner: boolean;
3593
- content: string;
3594
- id: number;
3595
- vpos: number;
3596
- date: number;
3597
- date_usec: number;
3598
- premium: boolean;
3599
- mail: string[];
3600
- user_id: number;
3601
- layer: number;
3602
- is_my_post: boolean;
3603
- }) => boolean;
3055
+ condition: (comment: FormattedComment) => boolean;
3604
3056
  class: typeof FlashComment;
3605
3057
  };
3606
3058
  static internal: typeof internal;
package/dist/bundle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- niconicomments.js v0.2.72
2
+ niconicomments.js v0.2.73
3
3
  (c) 2021 xpadev-net https://xpadev.net
4
4
  Released under the MIT License.
5
5
  */
@@ -208,9 +208,27 @@
208
208
  : config.contextStrokeColor).join(",")},${config.contextStrokeOpacity})`;
209
209
  };
210
210
 
211
+ function _arrayLikeToArray(r, a) {
212
+ (null == a || a > r.length) && (a = r.length);
213
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
214
+ return n;
215
+ }
216
+ function _arrayWithHoles(r) {
217
+ if (Array.isArray(r)) return r;
218
+ }
219
+ function _arrayWithoutHoles(r) {
220
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
221
+ }
222
+ function _assertThisInitialized(e) {
223
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
224
+ return e;
225
+ }
211
226
  function _callSuper(t, o, e) {
212
227
  return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
213
228
  }
229
+ function _classCallCheck(a, n) {
230
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
231
+ }
214
232
  function _construct(t, e, r) {
215
233
  if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
216
234
  var o = [null];
@@ -218,6 +236,91 @@
218
236
  var p = new (t.bind.apply(t, o))();
219
237
  return r && _setPrototypeOf(p, r.prototype), p;
220
238
  }
239
+ function _createClass(e, r, t) {
240
+ return Object.defineProperty(e, "prototype", {
241
+ writable: !1
242
+ }), e;
243
+ }
244
+ function _createForOfIteratorHelper(r, e) {
245
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
246
+ if (!t) {
247
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
248
+ t && (r = t);
249
+ var n = 0,
250
+ F = function () {};
251
+ return {
252
+ s: F,
253
+ n: function () {
254
+ return n >= r.length ? {
255
+ done: !0
256
+ } : {
257
+ done: !1,
258
+ value: r[n++]
259
+ };
260
+ },
261
+ e: function (r) {
262
+ throw r;
263
+ },
264
+ f: F
265
+ };
266
+ }
267
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
268
+ }
269
+ var o,
270
+ a = !0,
271
+ u = !1;
272
+ return {
273
+ s: function () {
274
+ t = t.call(r);
275
+ },
276
+ n: function () {
277
+ var r = t.next();
278
+ return a = r.done, r;
279
+ },
280
+ e: function (r) {
281
+ u = !0, o = r;
282
+ },
283
+ f: function () {
284
+ try {
285
+ a || null == t.return || t.return();
286
+ } finally {
287
+ if (u) throw o;
288
+ }
289
+ }
290
+ };
291
+ }
292
+ function _defineProperty(e, r, t) {
293
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
294
+ value: t,
295
+ enumerable: !0,
296
+ configurable: !0,
297
+ writable: !0
298
+ }) : e[r] = t, e;
299
+ }
300
+ function _getPrototypeOf(t) {
301
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
302
+ return t.__proto__ || Object.getPrototypeOf(t);
303
+ }, _getPrototypeOf(t);
304
+ }
305
+ function _inherits(t, e) {
306
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
307
+ t.prototype = Object.create(e && e.prototype, {
308
+ constructor: {
309
+ value: t,
310
+ writable: !0,
311
+ configurable: !0
312
+ }
313
+ }), Object.defineProperty(t, "prototype", {
314
+ writable: !1
315
+ }), e && _setPrototypeOf(t, e);
316
+ }
317
+ function _isNativeFunction(t) {
318
+ try {
319
+ return -1 !== Function.toString.call(t).indexOf("[native code]");
320
+ } catch (n) {
321
+ return "function" == typeof t;
322
+ }
323
+ }
221
324
  function _isNativeReflectConstruct() {
222
325
  try {
223
326
  var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
@@ -226,6 +329,9 @@
226
329
  return !!t;
227
330
  })();
228
331
  }
332
+ function _iterableToArray(r) {
333
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
334
+ }
229
335
  function _iterableToArrayLimit(r, l) {
230
336
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
231
337
  if (null != t) {
@@ -253,6 +359,12 @@
253
359
  return a;
254
360
  }
255
361
  }
362
+ function _nonIterableRest() {
363
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
364
+ }
365
+ function _nonIterableSpread() {
366
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
367
+ }
256
368
  function ownKeys(e, r) {
257
369
  var t = Object.keys(e);
258
370
  if (Object.getOwnPropertySymbols) {
@@ -274,6 +386,22 @@
274
386
  }
275
387
  return e;
276
388
  }
389
+ function _possibleConstructorReturn(t, e) {
390
+ if (e && ("object" == typeof e || "function" == typeof e)) return e;
391
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
392
+ return _assertThisInitialized(t);
393
+ }
394
+ function _setPrototypeOf(t, e) {
395
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
396
+ return t.__proto__ = e, t;
397
+ }, _setPrototypeOf(t, e);
398
+ }
399
+ function _slicedToArray(r, e) {
400
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
401
+ }
402
+ function _toConsumableArray(r) {
403
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
404
+ }
277
405
  function _toPrimitive(t, r) {
278
406
  if ("object" != typeof t || !t) return t;
279
407
  var e = t[Symbol.toPrimitive];
@@ -297,202 +425,34 @@
297
425
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
298
426
  }, _typeof(o);
299
427
  }
300
- function _classCallCheck(instance, Constructor) {
301
- if (!(instance instanceof Constructor)) {
302
- throw new TypeError("Cannot call a class as a function");
303
- }
304
- }
305
- function _defineProperties(target, props) {
306
- for (var i = 0; i < props.length; i++) {
307
- var descriptor = props[i];
308
- descriptor.enumerable = descriptor.enumerable || false;
309
- descriptor.configurable = true;
310
- if ("value" in descriptor) descriptor.writable = true;
311
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
428
+ function _unsupportedIterableToArray(r, a) {
429
+ if (r) {
430
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
431
+ var t = {}.toString.call(r).slice(8, -1);
432
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
312
433
  }
313
434
  }
314
- function _createClass(Constructor, protoProps, staticProps) {
315
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
316
- if (staticProps) _defineProperties(Constructor, staticProps);
317
- Object.defineProperty(Constructor, "prototype", {
318
- writable: false
319
- });
320
- return Constructor;
321
- }
322
- function _defineProperty(obj, key, value) {
323
- key = _toPropertyKey(key);
324
- if (key in obj) {
325
- Object.defineProperty(obj, key, {
326
- value: value,
327
- enumerable: true,
328
- configurable: true,
329
- writable: true
330
- });
331
- } else {
332
- obj[key] = value;
333
- }
334
- return obj;
335
- }
336
- function _inherits(subClass, superClass) {
337
- if (typeof superClass !== "function" && superClass !== null) {
338
- throw new TypeError("Super expression must either be null or a function");
339
- }
340
- subClass.prototype = Object.create(superClass && superClass.prototype, {
341
- constructor: {
342
- value: subClass,
343
- writable: true,
344
- configurable: true
345
- }
346
- });
347
- Object.defineProperty(subClass, "prototype", {
348
- writable: false
349
- });
350
- if (superClass) _setPrototypeOf(subClass, superClass);
351
- }
352
- function _getPrototypeOf(o) {
353
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
354
- return o.__proto__ || Object.getPrototypeOf(o);
355
- };
356
- return _getPrototypeOf(o);
357
- }
358
- function _setPrototypeOf(o, p) {
359
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
360
- o.__proto__ = p;
361
- return o;
362
- };
363
- return _setPrototypeOf(o, p);
364
- }
365
- function _isNativeFunction(fn) {
366
- try {
367
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
368
- } catch (e) {
369
- return typeof fn === "function";
370
- }
371
- }
372
- function _wrapNativeSuper(Class) {
373
- var _cache = typeof Map === "function" ? new Map() : undefined;
374
- _wrapNativeSuper = function _wrapNativeSuper(Class) {
375
- if (Class === null || !_isNativeFunction(Class)) return Class;
376
- if (typeof Class !== "function") {
377
- throw new TypeError("Super expression must either be null or a function");
378
- }
379
- if (typeof _cache !== "undefined") {
380
- if (_cache.has(Class)) return _cache.get(Class);
381
- _cache.set(Class, Wrapper);
435
+ function _wrapNativeSuper(t) {
436
+ var r = "function" == typeof Map ? new Map() : void 0;
437
+ return _wrapNativeSuper = function (t) {
438
+ if (null === t || !_isNativeFunction(t)) return t;
439
+ if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
440
+ if (void 0 !== r) {
441
+ if (r.has(t)) return r.get(t);
442
+ r.set(t, Wrapper);
382
443
  }
383
444
  function Wrapper() {
384
- return _construct(Class, arguments, _getPrototypeOf(this).constructor);
445
+ return _construct(t, arguments, _getPrototypeOf(this).constructor);
385
446
  }
386
- Wrapper.prototype = Object.create(Class.prototype, {
447
+ return Wrapper.prototype = Object.create(t.prototype, {
387
448
  constructor: {
388
449
  value: Wrapper,
389
- enumerable: false,
390
- writable: true,
391
- configurable: true
450
+ enumerable: !1,
451
+ writable: !0,
452
+ configurable: !0
392
453
  }
393
- });
394
- return _setPrototypeOf(Wrapper, Class);
395
- };
396
- return _wrapNativeSuper(Class);
397
- }
398
- function _assertThisInitialized(self) {
399
- if (self === void 0) {
400
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
401
- }
402
- return self;
403
- }
404
- function _possibleConstructorReturn(self, call) {
405
- if (call && (typeof call === "object" || typeof call === "function")) {
406
- return call;
407
- } else if (call !== void 0) {
408
- throw new TypeError("Derived constructors may only return object or undefined");
409
- }
410
- return _assertThisInitialized(self);
411
- }
412
- function _slicedToArray(arr, i) {
413
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
414
- }
415
- function _toConsumableArray(arr) {
416
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
417
- }
418
- function _arrayWithoutHoles(arr) {
419
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
420
- }
421
- function _arrayWithHoles(arr) {
422
- if (Array.isArray(arr)) return arr;
423
- }
424
- function _iterableToArray(iter) {
425
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
426
- }
427
- function _unsupportedIterableToArray(o, minLen) {
428
- if (!o) return;
429
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
430
- var n = Object.prototype.toString.call(o).slice(8, -1);
431
- if (n === "Object" && o.constructor) n = o.constructor.name;
432
- if (n === "Map" || n === "Set") return Array.from(o);
433
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
434
- }
435
- function _arrayLikeToArray(arr, len) {
436
- if (len == null || len > arr.length) len = arr.length;
437
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
438
- return arr2;
439
- }
440
- function _nonIterableSpread() {
441
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
442
- }
443
- function _nonIterableRest() {
444
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
445
- }
446
- function _createForOfIteratorHelper(o, allowArrayLike) {
447
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
448
- if (!it) {
449
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
450
- if (it) o = it;
451
- var i = 0;
452
- var F = function () {};
453
- return {
454
- s: F,
455
- n: function () {
456
- if (i >= o.length) return {
457
- done: true
458
- };
459
- return {
460
- done: false,
461
- value: o[i++]
462
- };
463
- },
464
- e: function (e) {
465
- throw e;
466
- },
467
- f: F
468
- };
469
- }
470
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
471
- }
472
- var normalCompletion = true,
473
- didErr = false,
474
- err;
475
- return {
476
- s: function () {
477
- it = it.call(o);
478
- },
479
- n: function () {
480
- var step = it.next();
481
- normalCompletion = step.done;
482
- return step;
483
- },
484
- e: function (e) {
485
- didErr = true;
486
- err = e;
487
- },
488
- f: function () {
489
- try {
490
- if (!normalCompletion && it.return != null) it.return();
491
- } finally {
492
- if (didErr) throw err;
493
- }
494
- }
495
- };
454
+ }), _setPrototypeOf(Wrapper, t);
455
+ }, _wrapNativeSuper(t);
496
456
  }
497
457
 
498
458
  // src/error/ValiError/ValiError.ts
@@ -513,7 +473,7 @@
513
473
  }
514
474
  _inherits(ValiError, _Error);
515
475
  return _createClass(ValiError);
516
- }( /*#__PURE__*/_wrapNativeSuper(Error));
476
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
517
477
 
518
478
  // src/utils/actionIssue/actionIssue.ts
519
479
  function actionIssue(context, reference, input, label, received) {
@@ -2295,6 +2255,8 @@
2295
2255
  const posY = lazy ? -1 : getFixedPosY(comment, collision);
2296
2256
  for (let j = 0; j < comment.long; j++) {
2297
2257
  const vpos = comment.vpos + j;
2258
+ if (timeline[vpos]?.includes(comment))
2259
+ continue;
2298
2260
  arrayPush(timeline, vpos, comment);
2299
2261
  if (j > comment.long - 20)
2300
2262
  continue;
@@ -2309,7 +2271,7 @@
2309
2271
  const vpos = comment.vpos + j;
2310
2272
  const leftPos = getPosX(comment.comment, vpos);
2311
2273
  if (timeline[vpos]?.includes(comment))
2312
- break;
2274
+ continue;
2313
2275
  arrayPush(timeline, vpos, comment);
2314
2276
  if (leftPos + comment.width + config.collisionPadding >=
2315
2277
  config.collisionRange.right &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpadev-net/niconicomments",
3
- "version": "0.2.72",
3
+ "version": "0.2.73",
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",
@@ -18,7 +18,7 @@
18
18
  "format:fix": "biome format --write src",
19
19
  "lint": "biome check src",
20
20
  "lint:fix": "biome check --apply-unsafe src",
21
- "prepare": "husky install",
21
+ "prepare": "lefthook install",
22
22
  "test": "docker-compose run --rm pw",
23
23
  "test-server": "http-server"
24
24
  },
@@ -38,35 +38,31 @@
38
38
  "bugs": {
39
39
  "url": "https://github.com/xpadev-net/niconicomments/issues"
40
40
  },
41
- "files": [
42
- "dist/bundle.js",
43
- "dist/bundle.d.ts"
44
- ],
41
+ "files": ["dist/bundle.js", "dist/bundle.d.ts"],
45
42
  "homepage": "https://xpadev-net.github.io/niconicomments/",
46
43
  "license": "MIT",
47
44
  "devDependencies": {
48
- "@babel/core": "^7.24.4",
49
- "@babel/preset-env": "^7.24.4",
50
- "@biomejs/biome": "1.7.1",
51
- "@playwright/test": "^1.43.0",
45
+ "@babel/core": "^7.26.0",
46
+ "@babel/preset-env": "^7.26.0",
47
+ "@biomejs/biome": "^1.9.4",
48
+ "@playwright/test": "^1.49.0",
52
49
  "@rollup/plugin-babel": "^6.0.4",
53
- "@rollup/plugin-commonjs": "^25.0.7",
50
+ "@rollup/plugin-commonjs": "^28.0.1",
54
51
  "@rollup/plugin-json": "^6.1.0",
55
- "@rollup/plugin-node-resolve": "^15.2.3",
52
+ "@rollup/plugin-node-resolve": "^15.3.0",
56
53
  "@rollup/plugin-typescript": "^11.1.6",
57
- "@types/node": "^20.12.7",
54
+ "@types/node": "^22.9.0",
58
55
  "copyfiles": "^2.4.1",
59
56
  "http-server": "^14.1.1",
60
- "husky": "^9.0.11",
61
- "lint-staged": "^15.2.2",
62
- "rimraf": "^5.0.5",
63
- "rollup": "^4.14.1",
64
- "rollup-plugin-dts": "^6.1.0",
57
+ "lefthook": "^1.8.4",
58
+ "rimraf": "^6.0.1",
59
+ "rollup": "^4.27.3",
60
+ "rollup-plugin-dts": "^6.1.1",
65
61
  "rollup-plugin-typescript-paths": "^1.5.0",
66
- "tslib": "^2.6.2",
67
- "typedoc": "^0.25.13",
68
- "typedoc-plugin-missing-exports": "^2.2.0",
69
- "typescript": "^5.4.5",
62
+ "tslib": "^2.8.1",
63
+ "typedoc": "^0.26.11",
64
+ "typedoc-plugin-missing-exports": "^3.0.2",
65
+ "typescript": "^5.6.3",
70
66
  "valibot": "^0.30.0"
71
67
  }
72
68
  }