koishi-plugin-chat-analyse 1.2.4 → 1.2.5

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 (2) hide show
  1. package/lib/index.js +8 -7
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1733,11 +1733,13 @@ var Renderer = class {
1733
1733
  if (!words?.length) return;
1734
1734
  const wordsJson = JSON.stringify(words);
1735
1735
  const selectedPalette = this.COLOR_PALETTES[Math.floor(Math.random() * this.COLOR_PALETTES.length)];
1736
+ const shapes = ["circle", "cardioid", "diamond", "triangle-forward", "triangle", "pentagon", "star", "square"];
1737
+ const randomShape = shapes[Math.floor(Math.random() * shapes.length)];
1736
1738
  const weights = words.map((w) => w[1]);
1737
1739
  const maxWeight = Math.max(...weights, 1);
1738
1740
  const minWeight = Math.min(...weights);
1739
- const MAX_FONT_SIZE = 96;
1740
- const MIN_FONT_SIZE = 8;
1741
+ const MAX_FONT_SIZE = 64;
1742
+ const MIN_FONT_SIZE = 4;
1741
1743
  const cardHtml = `
1742
1744
  <div class="container">
1743
1745
  <div class="header">
@@ -1750,7 +1752,6 @@ var Renderer = class {
1750
1752
  <script>
1751
1753
  const palette = ${JSON.stringify(selectedPalette)};
1752
1754
  WordCloud(document.getElementById('wordcloud-container'), {
1753
- list: ${wordsJson},
1754
1755
  fontFamily: '"Noto Sans CJK SC", "Arial", sans-serif',
1755
1756
  weightFactor: (size) => {
1756
1757
  if (${maxWeight} === ${minWeight}) return (${MIN_FONT_SIZE} + ${MAX_FONT_SIZE}) / 2;
@@ -1760,14 +1761,14 @@ var Renderer = class {
1760
1761
  color: (word, weight, fontSize, distance, theta) => {
1761
1762
  return palette[Math.floor(Math.random() * palette.length)];
1762
1763
  },
1763
- backgroundColor: 'transparent',
1764
- clearCanvas: true,
1765
- shape: 'square',
1764
+ list: ${wordsJson},
1765
+ shape: '${randomShape}',
1766
1766
  ellipticity: 1,
1767
- gridSize: 1,
1768
1767
  rotateRatio: 1,
1769
1768
  minRotation: -Math.PI / 4,
1770
1769
  maxRotation: Math.PI / 4,
1770
+ backgroundColor: 'transparent',
1771
+ clearCanvas: true,
1771
1772
  shuffle: true,
1772
1773
  });
1773
1774
  </script>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-chat-analyse",
3
3
  "description": "强大而全面的聊天数据分析,支持统计命令,发言,消息类型,活跃度,支持发言排行和生成词云",
4
- "version": "1.2.4",
4
+ "version": "1.2.5",
5
5
  "contributors": [
6
6
  "Yis_Rime <yis_rime@outlook.com>"
7
7
  ],