@xpadev-net/niconicomments 0.2.62 → 0.2.63

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
@@ -41,6 +41,7 @@ type DefaultCommand = {
41
41
  interface IRenderer {
42
42
  readonly canvas: HTMLCanvasElement;
43
43
  readonly video?: HTMLVideoElement;
44
+ destroy(): void;
44
45
  drawVideo(enableLegacyPip: boolean): void;
45
46
  getFont(): string;
46
47
  getFillStyle(): string | CanvasGradient | CanvasPattern;
@@ -385,9 +386,9 @@ declare const ZFormattedComment: valibot.ObjectSchema<{
385
386
  }, undefined, {
386
387
  owner: boolean;
387
388
  content: string;
389
+ id: number;
388
390
  vpos: number;
389
391
  date: number;
390
- id: number;
391
392
  date_usec: number;
392
393
  premium: boolean;
393
394
  mail: string[];
@@ -411,9 +412,9 @@ declare const ZFormattedLegacyComment: valibot.ObjectSchema<Omit<{
411
412
  }, "user_id" | "layer" | "is_my_post">, undefined, {
412
413
  owner: boolean;
413
414
  content: string;
415
+ id: number;
414
416
  vpos: number;
415
417
  date: number;
416
- id: number;
417
418
  date_usec: number;
418
419
  premium: boolean;
419
420
  mail: string[];
@@ -1524,6 +1525,7 @@ declare class CanvasRenderer implements IRenderer {
1524
1525
  save(): void;
1525
1526
  restore(): void;
1526
1527
  getCanvas(): IRenderer;
1528
+ destroy(): void;
1527
1529
  }
1528
1530
 
1529
1531
  type index_d$1_CanvasRenderer = CanvasRenderer;
@@ -1533,10 +1535,194 @@ declare namespace index_d$1 {
1533
1535
  }
1534
1536
 
1535
1537
  declare const typeGuard: {
1538
+ formatted: {
1539
+ comment: (i: unknown) => i is {
1540
+ owner: boolean;
1541
+ content: string;
1542
+ id: number;
1543
+ vpos: number;
1544
+ date: number;
1545
+ date_usec: number;
1546
+ premium: boolean;
1547
+ mail: string[];
1548
+ user_id: number;
1549
+ layer: number;
1550
+ is_my_post: boolean;
1551
+ };
1552
+ comments: (i: unknown) => i is {
1553
+ owner: boolean;
1554
+ content: string;
1555
+ id: number;
1556
+ vpos: number;
1557
+ date: number;
1558
+ date_usec: number;
1559
+ premium: boolean;
1560
+ mail: string[];
1561
+ user_id: number;
1562
+ layer: number;
1563
+ is_my_post: boolean;
1564
+ }[];
1565
+ legacyComment: (i: unknown) => i is {
1566
+ owner: boolean;
1567
+ content: string;
1568
+ id: number;
1569
+ vpos: number;
1570
+ date: number;
1571
+ date_usec: number;
1572
+ premium: boolean;
1573
+ mail: string[];
1574
+ };
1575
+ legacyComments: (i: unknown) => i is {
1576
+ owner: boolean;
1577
+ content: string;
1578
+ id: number;
1579
+ vpos: number;
1580
+ date: number;
1581
+ date_usec: number;
1582
+ premium: boolean;
1583
+ mail: string[];
1584
+ }[];
1585
+ };
1586
+ legacy: {
1587
+ rawApiResponses: (i: unknown) => i is ({
1588
+ chat: {
1589
+ content: string;
1590
+ vpos: number;
1591
+ date: number;
1592
+ date_usec: number;
1593
+ premium: number;
1594
+ mail: string;
1595
+ user_id: string;
1596
+ thread: string;
1597
+ no: number;
1598
+ nicoru: number;
1599
+ anonymity: number;
1600
+ deleted: number;
1601
+ };
1602
+ } | {
1603
+ [x: string]: unknown;
1604
+ })[];
1605
+ apiChat: (i: unknown) => i is {
1606
+ content: string;
1607
+ vpos: number;
1608
+ date: number;
1609
+ date_usec: number;
1610
+ premium: number;
1611
+ mail: string;
1612
+ user_id: string;
1613
+ thread: string;
1614
+ no: number;
1615
+ nicoru: number;
1616
+ anonymity: number;
1617
+ deleted: number;
1618
+ };
1619
+ apiGlobalNumRes: (i: unknown) => i is {
1620
+ thread: string;
1621
+ num_res: number;
1622
+ };
1623
+ apiLeaf: (i: unknown) => i is {
1624
+ count: number;
1625
+ thread: string;
1626
+ };
1627
+ apiPing: (i: unknown) => i is {
1628
+ content: string;
1629
+ };
1630
+ apiThread: (i: unknown) => i is {
1631
+ thread: string;
1632
+ resultcode: number;
1633
+ server_time: number;
1634
+ ticket: string;
1635
+ revision: number;
1636
+ };
1637
+ };
1536
1638
  xmlDocument: (i: unknown) => i is XMLDocument;
1537
1639
  legacyOwner: {
1538
1640
  comments: (i: unknown) => i is string;
1539
1641
  };
1642
+ owner: {
1643
+ comment: (i: unknown) => i is {
1644
+ time: string;
1645
+ command: string;
1646
+ comment: string;
1647
+ };
1648
+ comments: (i: unknown) => i is {
1649
+ time: string;
1650
+ command: string;
1651
+ comment: string;
1652
+ }[];
1653
+ };
1654
+ v1: {
1655
+ comment: (i: unknown) => i is {
1656
+ id: string;
1657
+ no: number;
1658
+ vposMs: number;
1659
+ body: string;
1660
+ commands: string[];
1661
+ userId: string;
1662
+ isPremium: boolean;
1663
+ score: number;
1664
+ postedAt: string;
1665
+ nicoruCount: number;
1666
+ nicoruId: string | null;
1667
+ source: string;
1668
+ isMyPost: boolean;
1669
+ };
1670
+ comments: (i: unknown) => i is {
1671
+ id: string;
1672
+ no: number;
1673
+ vposMs: number;
1674
+ body: string;
1675
+ commands: string[];
1676
+ userId: string;
1677
+ isPremium: boolean;
1678
+ score: number;
1679
+ postedAt: string;
1680
+ nicoruCount: number;
1681
+ nicoruId: string | null;
1682
+ source: string;
1683
+ isMyPost: boolean;
1684
+ }[];
1685
+ thread: (i: unknown) => i is {
1686
+ fork: string;
1687
+ commentCount: number;
1688
+ comments: {
1689
+ id: string;
1690
+ no: number;
1691
+ vposMs: number;
1692
+ body: string;
1693
+ commands: string[];
1694
+ userId: string;
1695
+ isPremium: boolean;
1696
+ score: number;
1697
+ postedAt: string;
1698
+ nicoruCount: number;
1699
+ nicoruId: string | null;
1700
+ source: string;
1701
+ isMyPost: boolean;
1702
+ }[];
1703
+ id?: unknown;
1704
+ };
1705
+ threads: (i: unknown) => i is {
1706
+ fork: string;
1707
+ commentCount: number;
1708
+ comments: {
1709
+ id: string;
1710
+ no: number;
1711
+ vposMs: number;
1712
+ body: string;
1713
+ commands: string[];
1714
+ userId: string;
1715
+ isPremium: boolean;
1716
+ score: number;
1717
+ postedAt: string;
1718
+ nicoruCount: number;
1719
+ nicoruId: string | null;
1720
+ source: string;
1721
+ isMyPost: boolean;
1722
+ }[];
1723
+ id?: unknown;
1724
+ }[];
1725
+ };
1540
1726
  nicoScript: {
1541
1727
  range: {
1542
1728
  target: (i: unknown) => i is NicoScriptReverseTarget;
@@ -1548,16 +1734,44 @@ declare const typeGuard: {
1548
1734
  };
1549
1735
  };
1550
1736
  comment: {
1737
+ font: (i: unknown) => i is "defont" | "mincho" | "gothic" | "gulim" | "simsun";
1738
+ loc: (i: unknown) => i is "ue" | "naka" | "shita";
1739
+ size: (i: unknown) => i is "big" | "medium" | "small";
1551
1740
  command: {
1552
1741
  key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
1553
1742
  };
1554
1743
  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";
1744
+ colorCode: (i: unknown) => i is string;
1555
1745
  colorCodeAllowAlpha: (i: unknown) => i is string;
1556
1746
  };
1557
1747
  config: {
1558
1748
  initOptions: (item: unknown) => item is Partial<BaseOptions>;
1559
1749
  };
1560
1750
  internal: {
1751
+ CommentMeasuredContentItem: (i: unknown) => i is {
1752
+ type: "spacer";
1753
+ char: string;
1754
+ charWidth: number;
1755
+ count: number;
1756
+ isButton?: boolean | undefined;
1757
+ font?: "defont" | "gulim" | "simsun" | undefined;
1758
+ } | (({
1759
+ type: "spacer";
1760
+ char: string;
1761
+ charWidth: number;
1762
+ count: number;
1763
+ isButton?: boolean | undefined;
1764
+ font?: "defont" | "gulim" | "simsun" | undefined;
1765
+ } | {
1766
+ type: "text";
1767
+ content: string;
1768
+ slicedContent: string[];
1769
+ isButton?: boolean | undefined;
1770
+ font?: "defont" | "gulim" | "simsun" | undefined;
1771
+ width?: number[] | undefined;
1772
+ }) & {
1773
+ width: number[];
1774
+ });
1561
1775
  CommentMeasuredContentItemArray: (i: unknown) => i is ({
1562
1776
  type: "spacer";
1563
1777
  char: string;
@@ -1732,10 +1946,194 @@ declare class NiconiComments {
1732
1946
  private readonly collision;
1733
1947
  private readonly timeline;
1734
1948
  static typeGuard: {
1949
+ formatted: {
1950
+ comment: (i: unknown) => i is {
1951
+ owner: boolean;
1952
+ content: string;
1953
+ id: number;
1954
+ vpos: number;
1955
+ date: number;
1956
+ date_usec: number;
1957
+ premium: boolean;
1958
+ mail: string[];
1959
+ user_id: number;
1960
+ layer: number;
1961
+ is_my_post: boolean;
1962
+ };
1963
+ comments: (i: unknown) => i is {
1964
+ owner: boolean;
1965
+ content: string;
1966
+ id: number;
1967
+ vpos: number;
1968
+ date: number;
1969
+ date_usec: number;
1970
+ premium: boolean;
1971
+ mail: string[];
1972
+ user_id: number;
1973
+ layer: number;
1974
+ is_my_post: boolean;
1975
+ }[];
1976
+ legacyComment: (i: unknown) => i is {
1977
+ owner: boolean;
1978
+ content: string;
1979
+ id: number;
1980
+ vpos: number;
1981
+ date: number;
1982
+ date_usec: number;
1983
+ premium: boolean;
1984
+ mail: string[];
1985
+ };
1986
+ legacyComments: (i: unknown) => i is {
1987
+ owner: boolean;
1988
+ content: string;
1989
+ id: number;
1990
+ vpos: number;
1991
+ date: number;
1992
+ date_usec: number;
1993
+ premium: boolean;
1994
+ mail: string[];
1995
+ }[];
1996
+ };
1997
+ legacy: {
1998
+ rawApiResponses: (i: unknown) => i is ({
1999
+ chat: {
2000
+ content: string;
2001
+ vpos: number;
2002
+ date: number;
2003
+ date_usec: number;
2004
+ premium: number;
2005
+ mail: string;
2006
+ user_id: string;
2007
+ thread: string;
2008
+ no: number;
2009
+ nicoru: number;
2010
+ anonymity: number;
2011
+ deleted: number;
2012
+ };
2013
+ } | {
2014
+ [x: string]: unknown;
2015
+ })[];
2016
+ apiChat: (i: unknown) => i is {
2017
+ content: string;
2018
+ vpos: number;
2019
+ date: number;
2020
+ date_usec: number;
2021
+ premium: number;
2022
+ mail: string;
2023
+ user_id: string;
2024
+ thread: string;
2025
+ no: number;
2026
+ nicoru: number;
2027
+ anonymity: number;
2028
+ deleted: number;
2029
+ };
2030
+ apiGlobalNumRes: (i: unknown) => i is {
2031
+ thread: string;
2032
+ num_res: number;
2033
+ };
2034
+ apiLeaf: (i: unknown) => i is {
2035
+ count: number;
2036
+ thread: string;
2037
+ };
2038
+ apiPing: (i: unknown) => i is {
2039
+ content: string;
2040
+ };
2041
+ apiThread: (i: unknown) => i is {
2042
+ thread: string;
2043
+ resultcode: number;
2044
+ server_time: number;
2045
+ ticket: string;
2046
+ revision: number;
2047
+ };
2048
+ };
1735
2049
  xmlDocument: (i: unknown) => i is XMLDocument;
1736
2050
  legacyOwner: {
1737
2051
  comments: (i: unknown) => i is string;
1738
2052
  };
2053
+ owner: {
2054
+ comment: (i: unknown) => i is {
2055
+ time: string;
2056
+ command: string;
2057
+ comment: string;
2058
+ };
2059
+ comments: (i: unknown) => i is {
2060
+ time: string;
2061
+ command: string;
2062
+ comment: string;
2063
+ }[];
2064
+ };
2065
+ v1: {
2066
+ comment: (i: unknown) => i is {
2067
+ id: string;
2068
+ no: number;
2069
+ vposMs: number;
2070
+ body: string;
2071
+ commands: string[];
2072
+ userId: string;
2073
+ isPremium: boolean;
2074
+ score: number;
2075
+ postedAt: string;
2076
+ nicoruCount: number;
2077
+ nicoruId: string | null;
2078
+ source: string;
2079
+ isMyPost: boolean;
2080
+ };
2081
+ comments: (i: unknown) => i is {
2082
+ id: string;
2083
+ no: number;
2084
+ vposMs: number;
2085
+ body: string;
2086
+ commands: string[];
2087
+ userId: string;
2088
+ isPremium: boolean;
2089
+ score: number;
2090
+ postedAt: string;
2091
+ nicoruCount: number;
2092
+ nicoruId: string | null;
2093
+ source: string;
2094
+ isMyPost: boolean;
2095
+ }[];
2096
+ thread: (i: unknown) => i is {
2097
+ fork: string;
2098
+ commentCount: number;
2099
+ comments: {
2100
+ id: string;
2101
+ no: number;
2102
+ vposMs: number;
2103
+ body: string;
2104
+ commands: string[];
2105
+ userId: string;
2106
+ isPremium: boolean;
2107
+ score: number;
2108
+ postedAt: string;
2109
+ nicoruCount: number;
2110
+ nicoruId: string | null;
2111
+ source: string;
2112
+ isMyPost: boolean;
2113
+ }[];
2114
+ id?: unknown;
2115
+ };
2116
+ threads: (i: unknown) => i is {
2117
+ fork: string;
2118
+ commentCount: number;
2119
+ comments: {
2120
+ id: string;
2121
+ no: number;
2122
+ vposMs: number;
2123
+ body: string;
2124
+ commands: string[];
2125
+ userId: string;
2126
+ isPremium: boolean;
2127
+ score: number;
2128
+ postedAt: string;
2129
+ nicoruCount: number;
2130
+ nicoruId: string | null;
2131
+ source: string;
2132
+ isMyPost: boolean;
2133
+ }[];
2134
+ id?: unknown;
2135
+ }[];
2136
+ };
1739
2137
  nicoScript: {
1740
2138
  range: {
1741
2139
  target: (i: unknown) => i is NicoScriptReverseTarget;
@@ -1747,16 +2145,44 @@ declare class NiconiComments {
1747
2145
  };
1748
2146
  };
1749
2147
  comment: {
2148
+ font: (i: unknown) => i is "defont" | "mincho" | "gothic" | "gulim" | "simsun";
2149
+ loc: (i: unknown) => i is "ue" | "naka" | "shita";
2150
+ size: (i: unknown) => i is "big" | "medium" | "small";
1750
2151
  command: {
1751
2152
  key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
1752
2153
  };
1753
2154
  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";
2155
+ colorCode: (i: unknown) => i is string;
1754
2156
  colorCodeAllowAlpha: (i: unknown) => i is string;
1755
2157
  };
1756
2158
  config: {
1757
2159
  initOptions: (item: unknown) => item is Partial<BaseOptions>;
1758
2160
  };
1759
2161
  internal: {
2162
+ CommentMeasuredContentItem: (i: unknown) => i is {
2163
+ type: "spacer";
2164
+ char: string;
2165
+ charWidth: number;
2166
+ count: number;
2167
+ isButton?: boolean | undefined;
2168
+ font?: "defont" | "gulim" | "simsun" | undefined;
2169
+ } | (({
2170
+ type: "spacer";
2171
+ char: string;
2172
+ charWidth: number;
2173
+ count: number;
2174
+ isButton?: boolean | undefined;
2175
+ font?: "defont" | "gulim" | "simsun" | undefined;
2176
+ } | {
2177
+ type: "text";
2178
+ content: string;
2179
+ slicedContent: string[];
2180
+ isButton?: boolean | undefined;
2181
+ font?: "defont" | "gulim" | "simsun" | undefined;
2182
+ width?: number[] | undefined;
2183
+ }) & {
2184
+ width: number[];
2185
+ });
1760
2186
  CommentMeasuredContentItemArray: (i: unknown) => i is ({
1761
2187
  type: "spacer";
1762
2188
  char: string;
@@ -1811,9 +2237,9 @@ declare class NiconiComments {
1811
2237
  condition: (comment: {
1812
2238
  owner: boolean;
1813
2239
  content: string;
2240
+ id: number;
1814
2241
  vpos: number;
1815
2242
  date: number;
1816
- id: number;
1817
2243
  date_usec: number;
1818
2244
  premium: boolean;
1819
2245
  mail: string[];
@@ -1841,4 +2267,4 @@ declare class NiconiComments {
1841
2267
  click(vpos: number, pos: Position): void;
1842
2268
  }
1843
2269
 
1844
- export { type ApiChat, type ApiGlobalNumRes, type ApiLeaf, type ApiPing, type ApiThread, type BaseConfig, type BaseOptions, type ButtonList, type ButtonParams, type ButtonPartLeft, type ButtonPartMiddle, type ButtonPartRight, type Canvas, type Collision, type CollisionItem, type CollisionPos, type CommentContentIndex, type CommentContentItem, type CommentContentItemText, type CommentDisableEvent, type CommentDisableEventHandler, type CommentEnableEvent, type CommentEnableEventHandler, type CommentEventBase, type CommentEventHandler, type CommentEventHandlerMap, type CommentEventMap, type CommentEventName, type CommentFlashFont, type CommentFlashFontParsed, type CommentFont, type CommentHTML5Font, type CommentLoc, type CommentMeasuredContentItem, type CommentSize, type CommentStageSize, type Config, type ConfigItem, type Context2D, type DefaultCommand, type FlashMode, type FlashScriptChar, type FontItem, type FormattedComment, type FormattedCommentWithFont, type FormattedCommentWithSize, type FormattedLegacyComment, type HTML5Fonts, type IComment, type IPlugin, type IPluginConstructor, type IPluginList, type InputFormat, type InputFormatType, type JumpEvent, type JumpEventHandler, type MeasureInput, type MeasureTextInput, type MeasureTextResult, type MultiConfigItem, type NicoScript, type NicoScriptReplace, type NicoScriptReplaceCondition, type NicoScriptReplaceRange, type NicoScriptReplaceTarget, type NicoScriptReverseTarget, type Options, type OwnerComment, type ParseCommandAndNicoScriptResult, type ParseContentResult, type ParsedCommand, type Platform, type PlatformFont, type Position, type RawApiResponse, type SeekDisableEvent, type SeekDisableEventHandler, type SeekEnableEvent, type SeekEnableEventHandler, type Timeline, type V1Comment, type V1Thread, type ValueOf, ZApiChat, ZApiGlobalNumRes, ZApiLeaf, ZApiPing, ZApiThread, ZCommentContentItem, ZCommentContentItemSpacer, ZCommentContentItemText, ZCommentFlashFont, ZCommentFont, ZCommentHTML5Font, ZCommentLoc, ZCommentMeasuredContentItem, ZCommentMeasuredContentItemText, ZCommentSize, ZFormattedComment, ZFormattedLegacyComment, ZHTML5Fonts, ZMeasureInput, ZOwnerComment, ZRawApiResponse, ZV1Comment, ZV1Thread, NiconiComments as default, type formattedComment, type formattedLegacyComment, type inputFormat, type inputFormatType, type ownerComment, type rawApiResponse, type v1Thread };
2270
+ export { type ApiChat, type ApiGlobalNumRes, type ApiLeaf, type ApiPing, type ApiThread, type BaseConfig, type BaseOptions, type ButtonList, type ButtonParams, type ButtonPartLeft, type ButtonPartMiddle, type ButtonPartRight, type Canvas, type Collision, type CollisionItem, type CollisionPos, type CommentContentIndex, type CommentContentItem, type CommentContentItemText, type CommentDisableEvent, type CommentDisableEventHandler, type CommentEnableEvent, type CommentEnableEventHandler, type CommentEventBase, type CommentEventHandler, type CommentEventHandlerMap, type CommentEventMap, type CommentEventName, type CommentFlashFont, type CommentFlashFontParsed, type CommentFont, type CommentHTML5Font, type CommentLoc, type CommentMeasuredContentItem, type CommentSize, type CommentStageSize, type Config, type ConfigItem, type Context2D, type DefaultCommand, type FlashMode, type FlashScriptChar, type FontItem, type FormattedComment, type FormattedCommentWithFont, type FormattedCommentWithSize, type FormattedLegacyComment, type HTML5Fonts, type IComment, type IPlugin, type IPluginConstructor, type IPluginList, type IRenderer, type InputFormat, type InputFormatType, type JumpEvent, type JumpEventHandler, type MeasureInput, type MeasureTextInput, type MeasureTextResult, type MultiConfigItem, type NicoScript, type NicoScriptReplace, type NicoScriptReplaceCondition, type NicoScriptReplaceRange, type NicoScriptReplaceTarget, type NicoScriptReverseTarget, type Options, type OwnerComment, type ParseCommandAndNicoScriptResult, type ParseContentResult, type ParsedCommand, type Platform, type PlatformFont, type Position, type RawApiResponse, type SeekDisableEvent, type SeekDisableEventHandler, type SeekEnableEvent, type SeekEnableEventHandler, type Timeline, type V1Comment, type V1Thread, type ValueOf, ZApiChat, ZApiGlobalNumRes, ZApiLeaf, ZApiPing, ZApiThread, ZCommentContentItem, ZCommentContentItemSpacer, ZCommentContentItemText, ZCommentFlashFont, ZCommentFont, ZCommentHTML5Font, ZCommentLoc, ZCommentMeasuredContentItem, ZCommentMeasuredContentItemText, ZCommentSize, ZFormattedComment, ZFormattedLegacyComment, ZHTML5Fonts, ZMeasureInput, ZOwnerComment, ZRawApiResponse, ZV1Comment, ZV1Thread, NiconiComments as default, type formattedComment, type formattedLegacyComment, type inputFormat, type inputFormatType, type ownerComment, type rawApiResponse, type v1Thread };
package/dist/bundle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- niconicomments.js v0.2.62
2
+ niconicomments.js v0.2.63
3
3
  (c) 2021 xpadev-net https://xpadev.net
4
4
  Released under the MIT License.
5
5
  */
@@ -1518,7 +1518,7 @@
1518
1518
  layer: optional(number(), -1),
1519
1519
  is_my_post: optional(_boolean(), false),
1520
1520
  });
1521
- omit(ZFormattedComment, [
1521
+ const ZFormattedLegacyComment = omit(ZFormattedComment, [
1522
1522
  "layer",
1523
1523
  "user_id",
1524
1524
  "is_my_post",
@@ -1542,21 +1542,21 @@
1542
1542
  object({ chat: ZApiChat }),
1543
1543
  record(string([notValue("chat")]), unknown()),
1544
1544
  ]);
1545
- object({
1545
+ const ZApiPing = object({
1546
1546
  content: string(),
1547
1547
  });
1548
- object({
1548
+ const ZApiThread = object({
1549
1549
  resultcode: number(),
1550
1550
  thread: string(),
1551
1551
  server_time: number(),
1552
1552
  ticket: string(),
1553
1553
  revision: number(),
1554
1554
  });
1555
- object({
1555
+ const ZApiLeaf = object({
1556
1556
  thread: string(),
1557
1557
  count: number(),
1558
1558
  });
1559
- object({
1559
+ const ZApiGlobalNumRes = object({
1560
1560
  thread: string(),
1561
1561
  num_res: number(),
1562
1562
  });
@@ -1688,6 +1688,20 @@
1688
1688
  const isNumber = (i) => typeof i === "number";
1689
1689
  const isObject = (i) => typeof i === "object";
1690
1690
  const typeGuard = {
1691
+ formatted: {
1692
+ comment: (i) => is(ZFormattedComment, i),
1693
+ comments: (i) => is(array(ZFormattedComment), i),
1694
+ legacyComment: (i) => is(ZFormattedLegacyComment, i),
1695
+ legacyComments: (i) => is(array(ZFormattedLegacyComment), i),
1696
+ },
1697
+ legacy: {
1698
+ rawApiResponses: (i) => is(array(ZRawApiResponse), i),
1699
+ apiChat: (i) => is(ZApiChat, i),
1700
+ apiGlobalNumRes: (i) => is(ZApiGlobalNumRes, i),
1701
+ apiLeaf: (i) => is(ZApiLeaf, i),
1702
+ apiPing: (i) => is(ZApiPing, i),
1703
+ apiThread: (i) => is(ZApiThread, i),
1704
+ },
1691
1705
  xmlDocument: (i) => {
1692
1706
  if (!i.documentElement ||
1693
1707
  i.documentElement.nodeName !== "packet")
@@ -1715,6 +1729,16 @@
1715
1729
  }),
1716
1730
  ]), i),
1717
1731
  },
1732
+ owner: {
1733
+ comment: (i) => is(ZOwnerComment, i),
1734
+ comments: (i) => is(array(ZOwnerComment), i),
1735
+ },
1736
+ v1: {
1737
+ comment: (i) => is(ZV1Comment, i),
1738
+ comments: (i) => is(array(ZV1Comment), i),
1739
+ thread: (i) => is(ZV1Thread, i),
1740
+ threads: (i) => is(array(ZV1Thread), i),
1741
+ },
1718
1742
  nicoScript: {
1719
1743
  range: {
1720
1744
  target: (i) => is(string([regex(/^(?:\u6295?\u30b3\u30e1|\u5168)$/)]), i),
@@ -1730,6 +1754,9 @@
1730
1754
  },
1731
1755
  },
1732
1756
  comment: {
1757
+ font: (i) => is(ZCommentFont, i),
1758
+ loc: (i) => is(ZCommentLoc, i),
1759
+ size: (i) => is(ZCommentSize, i),
1733
1760
  command: {
1734
1761
  key: (i) => is(union([
1735
1762
  literal("full"),
@@ -1739,6 +1766,7 @@
1739
1766
  ]), i),
1740
1767
  },
1741
1768
  color: (i) => is(string([custom((i) => Object.keys(colors).includes(i))]), i),
1769
+ colorCode: (i) => is(string([regex(/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6})$/)]), i),
1742
1770
  colorCodeAllowAlpha: (i) => is(string([
1743
1771
  regex(/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/),
1744
1772
  ]), i),
@@ -1774,6 +1802,7 @@
1774
1802
  },
1775
1803
  },
1776
1804
  internal: {
1805
+ CommentMeasuredContentItem: (i) => is(ZCommentMeasuredContentItem, i),
1777
1806
  CommentMeasuredContentItemArray: (i) => is(array(ZCommentMeasuredContentItem), i),
1778
1807
  MultiConfigItem: (i) => typeof i === "object" && objectVerify(i, ["html5", "flash"]),
1779
1808
  HTML5Fonts: (i) => is(ZHTML5Fonts, i),
@@ -2980,6 +3009,7 @@
2980
3009
  }, this.comment.long * 10 + config.cacheAge);
2981
3010
  clearTimeout(cache.timeout);
2982
3011
  cache.timeout = setTimeout(() => {
3012
+ imageCache[this.cacheKey]?.image.destroy();
2983
3013
  delete imageCache[this.cacheKey];
2984
3014
  }, this.comment.long * 10 + config.cacheAge);
2985
3015
  return cache.image;
@@ -4549,6 +4579,8 @@
4549
4579
  getCanvas() {
4550
4580
  return new CanvasRenderer();
4551
4581
  }
4582
+ destroy() {
4583
+ }
4552
4584
  }
4553
4585
 
4554
4586
  var index = /*#__PURE__*/Object.freeze({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpadev-net/niconicomments",
3
- "version": "0.2.62",
3
+ "version": "0.2.63",
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",