@xpadev-net/niconicomments 0.2.62 → 0.2.64

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- niconicomments.js v0.2.62
2
+ niconicomments.js v0.2.64
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,13 +1,13 @@
1
1
  {
2
2
  "name": "@xpadev-net/niconicomments",
3
- "version": "0.2.62",
3
+ "version": "0.2.64",
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",
7
7
  "scripts": {
8
8
  "build": "npx rimraf dist&&npm run build:ts&&npm run build:dts",
9
9
  "build:ts": "rollup -c rollup.config.mjs",
10
- "build:dts": "npx copyfiles -u 2 src/@types/*.d.ts dist/dts/@types/&&node ./util/resolve-path-alias.js&&rollup -c rollup.config.dts.mjs",
10
+ "build:dts": "npx copyfiles -u 2 src/@types/*.d.ts dist/dts/@types/&&node ./util/resolve-path-alias.js&&rollup -c rollup.config.dts.mjs&& npx dts-bundle-generator --external-inlines=valibot -o dist/bundle.d.ts dist/bundle_.d.ts",
11
11
  "watch": "rollup -c rollup.config.mjs -w",
12
12
  "typedoc": "typedoc --entryPointStrategy Expand --out ./docs/type/ ./src/",
13
13
  "prepublishOnly": "npm run build",
@@ -56,6 +56,7 @@
56
56
  "@typescript-eslint/eslint-plugin": "^6.13.1",
57
57
  "@typescript-eslint/parser": "^6.13.1",
58
58
  "copyfiles": "^2.4.1",
59
+ "dts-bundle-generator": "^9.0.0",
59
60
  "eslint": "^8.54.0",
60
61
  "eslint-config-prettier": "^9.0.0",
61
62
  "eslint-plugin-jsdoc": "^46.9.0",