koishi-plugin-ciyi 1.4.0 → 1.4.1
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/lib/index.js +27 -27
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -430,7 +430,7 @@ function drawWordGrid(ctx, x, y, word, size, mask) {
|
|
|
430
430
|
const gap = s(g.gap);
|
|
431
431
|
const chars = Array.from(word || "");
|
|
432
432
|
if (chars.length === 0) {
|
|
433
|
-
textCenter(ctx, "—", x + s(14), y + cell / 2, `${s(13)}px ${FONT_SANS}`, C.
|
|
433
|
+
textCenter(ctx, "—", x + s(14), y + cell / 2, `${s(13)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
434
434
|
return s(28);
|
|
435
435
|
}
|
|
436
436
|
let cx = x;
|
|
@@ -472,7 +472,7 @@ function drawHeader(ctx, innerX, innerY, innerW, sub, right) {
|
|
|
472
472
|
brandX,
|
|
473
473
|
innerY + padTop + s(36),
|
|
474
474
|
`italic ${s(10)}px ${FONT_NUM}`,
|
|
475
|
-
C.
|
|
475
|
+
C.onSurfaceVariant
|
|
476
476
|
);
|
|
477
477
|
const subRight = right ? innerX + innerW - padX - s(150) : innerX + innerW - padX;
|
|
478
478
|
textLeftFit(
|
|
@@ -487,7 +487,7 @@ function drawHeader(ctx, innerX, innerY, innerW, sub, right) {
|
|
|
487
487
|
if (right) {
|
|
488
488
|
const rx = innerX + innerW - padX;
|
|
489
489
|
textRight(ctx, right.big, rx, innerY + padTop + s(16), `700 ${s(31)}px ${FONT_NUM}`, C.primary);
|
|
490
|
-
textRight(ctx, right.cap, rx, innerY + padTop + s(44), `${s(10.5)}px ${FONT_SANS}`, C.
|
|
490
|
+
textRight(ctx, right.cap, rx, innerY + padTop + s(44), `${s(10.5)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
491
491
|
}
|
|
492
492
|
const lineY = innerY + h2;
|
|
493
493
|
ctx.strokeStyle = C.outlineVariant;
|
|
@@ -527,7 +527,7 @@ function drawFooter(ctx, innerX, y, innerW, legendItems, tip) {
|
|
|
527
527
|
lx += s(9) + s(6);
|
|
528
528
|
textLeft(ctx, tier.name, lx, cy, `${s(11.5)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
529
529
|
lx += textWidth(tier.name, s(11.5)) + s(4);
|
|
530
|
-
textLeft(ctx, range, lx, cy, `${s(11)}px ${FONT_NUM}`, C.
|
|
530
|
+
textLeft(ctx, range, lx, cy, `${s(11)}px ${FONT_NUM}`, C.onSurfaceVariant);
|
|
531
531
|
lx += textWidth(range, s(11)) + s(13);
|
|
532
532
|
}
|
|
533
533
|
const tipFont = `${s(11.5)}px ${FONT_SANS}`;
|
|
@@ -538,7 +538,7 @@ function drawFooter(ctx, innerX, y, innerW, legendItems, tip) {
|
|
|
538
538
|
innerX + innerW - padX,
|
|
539
539
|
cy,
|
|
540
540
|
tipFont,
|
|
541
|
-
C.
|
|
541
|
+
C.onSurfaceVariant
|
|
542
542
|
);
|
|
543
543
|
return h2 + padY * 2;
|
|
544
544
|
}
|
|
@@ -552,8 +552,8 @@ function drawLegendFull(ctx, x, y, w) {
|
|
|
552
552
|
const cy = y + Math.floor(i / 2) * rowH;
|
|
553
553
|
fillRound(ctx, cx, cy - s(4.5), s(9), s(9), s(SHAPE.full), t.color);
|
|
554
554
|
textLeft(ctx, t.name, cx + s(15), cy, `${s(11.5)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
555
|
-
textLeft(ctx, tierRange(i), cx + s(52), cy, `${s(11)}px ${FONT_NUM}`, C.
|
|
556
|
-
textLeft(ctx, t.note, cx + s(100), cy, `${s(11.5)}px ${FONT_SANS}`, C.
|
|
555
|
+
textLeft(ctx, tierRange(i), cx + s(52), cy, `${s(11)}px ${FONT_NUM}`, C.onSurfaceVariant);
|
|
556
|
+
textLeft(ctx, t.note, cx + s(100), cy, `${s(11.5)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
557
557
|
}
|
|
558
558
|
return rowH * Math.ceil(TIERS.length / 2) + s(8);
|
|
559
559
|
}
|
|
@@ -637,12 +637,12 @@ function drawBoardTable(ctx, x, y, w, opts, rowH) {
|
|
|
637
637
|
const mtX = mt0 + Math.max(0, (cols.mt - meterBlockW) / 2);
|
|
638
638
|
const headY = y;
|
|
639
639
|
const fs = s(10.5);
|
|
640
|
-
textLeft(ctx, "序", noX, headY, `${fs}px ${FONT_SANS}`, C.
|
|
641
|
-
textCenter(ctx, "更近 ◀", nb0 + cols.nb / 2, headY, `${fs}px ${FONT_SANS}`, C.
|
|
642
|
-
textCenter(ctx, "猜测", gw0 + cols.gw / 2, headY, `${fs}px ${FONT_SANS}`, C.
|
|
643
|
-
textCenter(ctx, "▶ 更远", nb1 + cols.nb / 2, headY, `${fs}px ${FONT_SANS}`, C.
|
|
644
|
-
textCenter(ctx, "排名", rk0 + cols.rk / 2, headY, `${fs}px ${FONT_SANS}`, C.
|
|
645
|
-
textCenter(ctx, "亲疏", mt0 + cols.mt / 2, headY, `${fs}px ${FONT_SANS}`, C.
|
|
640
|
+
textLeft(ctx, "序", noX, headY, `${fs}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
641
|
+
textCenter(ctx, "更近 ◀", nb0 + cols.nb / 2, headY, `${fs}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
642
|
+
textCenter(ctx, "猜测", gw0 + cols.gw / 2, headY, `${fs}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
643
|
+
textCenter(ctx, "▶ 更远", nb1 + cols.nb / 2, headY, `${fs}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
644
|
+
textCenter(ctx, "排名", rk0 + cols.rk / 2, headY, `${fs}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
645
|
+
textCenter(ctx, "亲疏", mt0 + cols.mt / 2, headY, `${fs}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
646
646
|
let ry = y + s(22);
|
|
647
647
|
let ordinal = 0;
|
|
648
648
|
for (const row of opts.rows) {
|
|
@@ -654,7 +654,7 @@ function drawBoardTable(ctx, x, y, w, opts, rowH) {
|
|
|
654
654
|
cx + tableW / 2,
|
|
655
655
|
ry + s(10),
|
|
656
656
|
`${s(11.5)}px ${FONT_SANS}`,
|
|
657
|
-
C.
|
|
657
|
+
C.onSurfaceVariant
|
|
658
658
|
);
|
|
659
659
|
ctx.strokeStyle = C.outlineVariant;
|
|
660
660
|
ctx.beginPath();
|
|
@@ -684,7 +684,7 @@ function drawBoardTable(ctx, x, y, w, opts, rowH) {
|
|
|
684
684
|
noX,
|
|
685
685
|
midY,
|
|
686
686
|
`${s(13)}px ${FONT_NUM}`,
|
|
687
|
-
C.
|
|
687
|
+
C.onSurfaceVariant
|
|
688
688
|
);
|
|
689
689
|
const nbX = nb0 + (cols.nb - gridWidth(history.leftHint, "sm")) / 2;
|
|
690
690
|
drawWordGrid(ctx, nbX, midY - s(13), history.leftHint, "sm", 0);
|
|
@@ -698,7 +698,7 @@ function drawBoardTable(ctx, x, y, w, opts, rowH) {
|
|
|
698
698
|
const hashW = textWidth("#", s(13));
|
|
699
699
|
const rankBlock = hashW + s(3) + rankWidth;
|
|
700
700
|
const rankLeft = rk0 + (cols.rk - rankBlock) / 2;
|
|
701
|
-
textLeft(ctx, "#", rankLeft, midY, `${s(13)}px ${FONT_NUM}`, C.
|
|
701
|
+
textLeft(ctx, "#", rankLeft, midY, `${s(13)}px ${FONT_NUM}`, C.onSurfaceVariant);
|
|
702
702
|
textLeft(ctx, rankText, rankLeft + hashW + s(3), midY, rankFont, tier.color);
|
|
703
703
|
drawNearBar(ctx, mtX, midY, pct, tier);
|
|
704
704
|
ry += rowH;
|
|
@@ -789,7 +789,7 @@ function renderIntroCard(service, opts) {
|
|
|
789
789
|
ix + s(38),
|
|
790
790
|
y + s(104),
|
|
791
791
|
`${s(12)}px ${FONT_SANS}`,
|
|
792
|
-
C.
|
|
792
|
+
C.onSurfaceVariant
|
|
793
793
|
);
|
|
794
794
|
textLeft(
|
|
795
795
|
ctx,
|
|
@@ -797,7 +797,7 @@ function renderIntroCard(service, opts) {
|
|
|
797
797
|
ix + s(38),
|
|
798
798
|
y + s(126),
|
|
799
799
|
`${s(12)}px ${FONT_SANS}`,
|
|
800
|
-
C.
|
|
800
|
+
C.onSurfaceVariant
|
|
801
801
|
);
|
|
802
802
|
textLeft(
|
|
803
803
|
ctx,
|
|
@@ -828,7 +828,7 @@ function renderIntroCard(service, opts) {
|
|
|
828
828
|
ix + s(22),
|
|
829
829
|
iy + ih - s(30),
|
|
830
830
|
`${s(11.5)}px ${FONT_SANS}`,
|
|
831
|
-
C.
|
|
831
|
+
C.onSurfaceVariant
|
|
832
832
|
);
|
|
833
833
|
});
|
|
834
834
|
}
|
|
@@ -842,11 +842,11 @@ function renderWinCard(service, opts) {
|
|
|
842
842
|
const revealH = s(130);
|
|
843
843
|
drawPanel(ctx, ix + s(22), y, iw - s(44), revealH);
|
|
844
844
|
drawSeal(ctx, ix + iw - s(80), y - s(13), s(42), ["中"]);
|
|
845
|
-
textLeft(ctx, "今日答案", ix + s(38), y + s(24), `${s(11.5)}px ${FONT_SANS}`, C.
|
|
845
|
+
textLeft(ctx, "今日答案", ix + s(38), y + s(24), `${s(11.5)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
846
846
|
drawWordGrid(ctx, ix + s(38), y + s(40), opts.answer, "lg");
|
|
847
847
|
const ax = ix + iw - s(310);
|
|
848
848
|
if (opts.neighbors.length) {
|
|
849
|
-
textLeft(ctx, "意思最近的几个词", ax, y + s(24), `${s(11.5)}px ${FONT_SANS}`, C.
|
|
849
|
+
textLeft(ctx, "意思最近的几个词", ax, y + s(24), `${s(11.5)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
850
850
|
let nx = ax;
|
|
851
851
|
let ny = y + s(48);
|
|
852
852
|
const chipFont = `${s(14)}px ${FONT_SANS}`;
|
|
@@ -888,7 +888,7 @@ function renderWinCard(service, opts) {
|
|
|
888
888
|
if (stats[i].u) {
|
|
889
889
|
textLeft(ctx, stats[i].u, sx + s(14) + textWidth(stats[i].n, s(23)) + s(3), y + s(26), `${s(12)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
890
890
|
}
|
|
891
|
-
textLeft(ctx, stats[i].c, sx + s(14), y + s(44), `${s(10.5)}px ${FONT_SANS}`, C.
|
|
891
|
+
textLeft(ctx, stats[i].c, sx + s(14), y + s(44), `${s(10.5)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
892
892
|
}
|
|
893
893
|
const quip = opts.closest === null ? "一击即中,今日无需第二次落笔" : `从 #${opts.closest} 一步跨到 #1`;
|
|
894
894
|
const footerTip = opts.canStartToday ? "ciyi.猜 山水 · 开启今日新题" : "明日零点换新题 · ciyi.排行榜";
|
|
@@ -945,7 +945,7 @@ function renderRankCard(service, opts) {
|
|
|
945
945
|
panelX + panelW / 2,
|
|
946
946
|
y + s(31),
|
|
947
947
|
`${s(13.5)}px ${FONT_SANS}`,
|
|
948
|
-
C.
|
|
948
|
+
C.onSurfaceVariant
|
|
949
949
|
);
|
|
950
950
|
textCenter(
|
|
951
951
|
ctx,
|
|
@@ -953,7 +953,7 @@ function renderRankCard(service, opts) {
|
|
|
953
953
|
panelX + panelW / 2,
|
|
954
954
|
y + s(61),
|
|
955
955
|
`${s(13.5)}px ${FONT_SANS}`,
|
|
956
|
-
C.
|
|
956
|
+
C.onSurfaceVariant
|
|
957
957
|
);
|
|
958
958
|
} else {
|
|
959
959
|
let ry = y;
|
|
@@ -1005,7 +1005,7 @@ function renderRankCard(service, opts) {
|
|
|
1005
1005
|
`700 ${scoreFont}px ${FONT_NUM}`,
|
|
1006
1006
|
C.onSurface
|
|
1007
1007
|
);
|
|
1008
|
-
textRight(ctx, "次", contentRight, midY, `${unitFont}px ${FONT_SANS}`, C.
|
|
1008
|
+
textRight(ctx, "次", contentRight, midY, `${unitFont}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
1009
1009
|
ry += rowH;
|
|
1010
1010
|
}
|
|
1011
1011
|
if (opts.hidden > 0) {
|
|
@@ -1015,7 +1015,7 @@ function renderRankCard(service, opts) {
|
|
|
1015
1015
|
contentLeft,
|
|
1016
1016
|
ry + s(16),
|
|
1017
1017
|
`${s(11.5)}px ${FONT_SANS}`,
|
|
1018
|
-
C.
|
|
1018
|
+
C.onSurfaceVariant
|
|
1019
1019
|
);
|
|
1020
1020
|
}
|
|
1021
1021
|
}
|
|
@@ -1033,7 +1033,7 @@ function renderRankCard(service, opts) {
|
|
|
1033
1033
|
panelX,
|
|
1034
1034
|
iy + ih - s(30),
|
|
1035
1035
|
`${s(11.5)}px ${FONT_SANS}`,
|
|
1036
|
-
C.
|
|
1036
|
+
C.onSurfaceVariant
|
|
1037
1037
|
);
|
|
1038
1038
|
});
|
|
1039
1039
|
}
|