koishi-plugin-mcdle 0.1.6 → 0.2.0
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 +552 -151
- package/lib/m3.d.ts +256 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -14621,7 +14621,355 @@ var itemChineseTitle = [
|
|
|
14621
14621
|
"铜粒"
|
|
14622
14622
|
];
|
|
14623
14623
|
|
|
14624
|
+
// src/m3.ts
|
|
14625
|
+
var WHITE_X = 95.047;
|
|
14626
|
+
var WHITE_Y = 100;
|
|
14627
|
+
var WHITE_Z = 108.883;
|
|
14628
|
+
function labToXyz(l, a, b) {
|
|
14629
|
+
const fy = (l + 16) / 116;
|
|
14630
|
+
const fx = fy + a / 500;
|
|
14631
|
+
const fz = fy - b / 200;
|
|
14632
|
+
const f = /* @__PURE__ */ __name((t) => t > 6 / 29 ? t * t * t : 3 * (6 / 29) ** 2 * (t - 4 / 29), "f");
|
|
14633
|
+
return [f(fx) * WHITE_X, f(fy) * WHITE_Y, f(fz) * WHITE_Z];
|
|
14634
|
+
}
|
|
14635
|
+
__name(labToXyz, "labToXyz");
|
|
14636
|
+
function gamma(value) {
|
|
14637
|
+
return value <= 31308e-7 ? value * 12.92 : 1.055 * value ** (1 / 2.4) - 0.055;
|
|
14638
|
+
}
|
|
14639
|
+
__name(gamma, "gamma");
|
|
14640
|
+
function xyzToRgb(x, y, z) {
|
|
14641
|
+
x /= 100;
|
|
14642
|
+
y /= 100;
|
|
14643
|
+
z /= 100;
|
|
14644
|
+
return [
|
|
14645
|
+
gamma(3.2406 * x - 1.5372 * y - 0.4986 * z),
|
|
14646
|
+
gamma(-0.9689 * x + 1.8758 * y + 0.0415 * z),
|
|
14647
|
+
gamma(0.0557 * x - 0.204 * y + 1.057 * z)
|
|
14648
|
+
];
|
|
14649
|
+
}
|
|
14650
|
+
__name(xyzToRgb, "xyzToRgb");
|
|
14651
|
+
var EPSILON = 1 / 512;
|
|
14652
|
+
function lch(tone, chroma, hue) {
|
|
14653
|
+
const radian = hue * Math.PI / 180;
|
|
14654
|
+
const at = /* @__PURE__ */ __name((c) => xyzToRgb(...labToXyz(tone, Math.cos(radian) * c, Math.sin(radian) * c)), "at");
|
|
14655
|
+
const inGamut = /* @__PURE__ */ __name((rgb2) => rgb2.every((value) => value >= -EPSILON && value <= 1 + EPSILON), "inGamut");
|
|
14656
|
+
let rgb = at(chroma);
|
|
14657
|
+
if (!inGamut(rgb)) {
|
|
14658
|
+
let low = 0;
|
|
14659
|
+
let high = chroma;
|
|
14660
|
+
while (high - low > 0.05) {
|
|
14661
|
+
const mid = (low + high) / 2;
|
|
14662
|
+
if (inGamut(at(mid))) low = mid;
|
|
14663
|
+
else high = mid;
|
|
14664
|
+
}
|
|
14665
|
+
rgb = at(low);
|
|
14666
|
+
}
|
|
14667
|
+
return "#" + rgb.map((value) => Math.round(Math.min(1, Math.max(0, value)) * 255).toString(16).padStart(2, "0")).join("");
|
|
14668
|
+
}
|
|
14669
|
+
__name(lch, "lch");
|
|
14670
|
+
function palette(hue, chroma) {
|
|
14671
|
+
const cache = /* @__PURE__ */ new Map();
|
|
14672
|
+
return (tone) => {
|
|
14673
|
+
const hit = cache.get(tone);
|
|
14674
|
+
if (hit) return hit;
|
|
14675
|
+
const value = lch(tone, chroma, hue);
|
|
14676
|
+
cache.set(tone, value);
|
|
14677
|
+
return value;
|
|
14678
|
+
};
|
|
14679
|
+
}
|
|
14680
|
+
__name(palette, "palette");
|
|
14681
|
+
function palettesOf(hue, options = {}) {
|
|
14682
|
+
const { chroma = 56, tertiaryShift = 60 } = options;
|
|
14683
|
+
return {
|
|
14684
|
+
primary: palette(hue, chroma),
|
|
14685
|
+
secondary: palette(hue, Math.max(16, chroma / 3.2)),
|
|
14686
|
+
tertiary: palette(hue + tertiaryShift, Math.max(28, chroma / 1.8)),
|
|
14687
|
+
neutral: palette(hue, 4),
|
|
14688
|
+
neutralVariant: palette(hue, 9),
|
|
14689
|
+
error: palette(36, 68)
|
|
14690
|
+
};
|
|
14691
|
+
}
|
|
14692
|
+
__name(palettesOf, "palettesOf");
|
|
14693
|
+
function scheme(hue, dark = false, options = {}) {
|
|
14694
|
+
const p = palettesOf(hue, options);
|
|
14695
|
+
const { primary: P, secondary: S, tertiary: T, neutral: N, neutralVariant: V, error: E } = p;
|
|
14696
|
+
if (dark) {
|
|
14697
|
+
return {
|
|
14698
|
+
primary: P(80),
|
|
14699
|
+
onPrimary: P(20),
|
|
14700
|
+
primaryContainer: P(30),
|
|
14701
|
+
onPrimaryContainer: P(90),
|
|
14702
|
+
secondary: S(80),
|
|
14703
|
+
onSecondary: S(20),
|
|
14704
|
+
secondaryContainer: S(30),
|
|
14705
|
+
onSecondaryContainer: S(90),
|
|
14706
|
+
tertiary: T(80),
|
|
14707
|
+
onTertiary: T(20),
|
|
14708
|
+
tertiaryContainer: T(30),
|
|
14709
|
+
onTertiaryContainer: T(90),
|
|
14710
|
+
error: E(80),
|
|
14711
|
+
onError: E(20),
|
|
14712
|
+
errorContainer: E(30),
|
|
14713
|
+
onErrorContainer: E(90),
|
|
14714
|
+
background: N(6),
|
|
14715
|
+
onBackground: N(90),
|
|
14716
|
+
surface: N(6),
|
|
14717
|
+
onSurface: N(90),
|
|
14718
|
+
surfaceVariant: V(30),
|
|
14719
|
+
onSurfaceVariant: V(80),
|
|
14720
|
+
surfaceDim: N(6),
|
|
14721
|
+
surfaceBright: N(24),
|
|
14722
|
+
surfaceContainerLowest: N(4),
|
|
14723
|
+
surfaceContainerLow: N(10),
|
|
14724
|
+
surfaceContainer: N(12),
|
|
14725
|
+
surfaceContainerHigh: N(17),
|
|
14726
|
+
surfaceContainerHighest: N(22),
|
|
14727
|
+
outline: V(60),
|
|
14728
|
+
outlineVariant: V(30),
|
|
14729
|
+
inverseSurface: N(90),
|
|
14730
|
+
inverseOnSurface: N(20),
|
|
14731
|
+
inversePrimary: P(40),
|
|
14732
|
+
scrim: N(0),
|
|
14733
|
+
shadow: N(0)
|
|
14734
|
+
};
|
|
14735
|
+
}
|
|
14736
|
+
return {
|
|
14737
|
+
primary: P(40),
|
|
14738
|
+
onPrimary: P(100),
|
|
14739
|
+
primaryContainer: P(90),
|
|
14740
|
+
onPrimaryContainer: P(30),
|
|
14741
|
+
secondary: S(40),
|
|
14742
|
+
onSecondary: S(100),
|
|
14743
|
+
secondaryContainer: S(90),
|
|
14744
|
+
onSecondaryContainer: S(30),
|
|
14745
|
+
tertiary: T(40),
|
|
14746
|
+
onTertiary: T(100),
|
|
14747
|
+
tertiaryContainer: T(90),
|
|
14748
|
+
onTertiaryContainer: T(30),
|
|
14749
|
+
error: E(40),
|
|
14750
|
+
onError: E(100),
|
|
14751
|
+
errorContainer: E(90),
|
|
14752
|
+
onErrorContainer: E(30),
|
|
14753
|
+
background: N(98),
|
|
14754
|
+
onBackground: N(10),
|
|
14755
|
+
surface: N(98),
|
|
14756
|
+
onSurface: N(10),
|
|
14757
|
+
surfaceVariant: V(90),
|
|
14758
|
+
onSurfaceVariant: V(30),
|
|
14759
|
+
surfaceDim: N(87),
|
|
14760
|
+
surfaceBright: N(98),
|
|
14761
|
+
surfaceContainerLowest: N(100),
|
|
14762
|
+
surfaceContainerLow: N(96),
|
|
14763
|
+
surfaceContainer: N(94),
|
|
14764
|
+
surfaceContainerHigh: N(92),
|
|
14765
|
+
surfaceContainerHighest: N(90),
|
|
14766
|
+
outline: V(50),
|
|
14767
|
+
outlineVariant: V(80),
|
|
14768
|
+
inverseSurface: N(20),
|
|
14769
|
+
inverseOnSurface: N(95),
|
|
14770
|
+
inversePrimary: P(80),
|
|
14771
|
+
scrim: N(0),
|
|
14772
|
+
shadow: N(0)
|
|
14773
|
+
};
|
|
14774
|
+
}
|
|
14775
|
+
__name(scheme, "scheme");
|
|
14776
|
+
var SHAPE = {
|
|
14777
|
+
none: 0,
|
|
14778
|
+
extraSmall: 4,
|
|
14779
|
+
small: 8,
|
|
14780
|
+
medium: 12,
|
|
14781
|
+
large: 16,
|
|
14782
|
+
largeIncreased: 20,
|
|
14783
|
+
extraLarge: 28,
|
|
14784
|
+
extraLargeIncreased: 32,
|
|
14785
|
+
extraExtraLarge: 48,
|
|
14786
|
+
full: 9999
|
|
14787
|
+
};
|
|
14788
|
+
var FONT_STACK = '"Roboto Flex", "Roboto", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", system-ui, sans-serif';
|
|
14789
|
+
var MONO_STACK = '"Roboto Mono", "JetBrains Mono", "SF Mono", "Cascadia Mono", Consolas, "Noto Sans Mono", monospace';
|
|
14790
|
+
var TYPE = {
|
|
14791
|
+
displayLarge: { size: 57, line: 64, weight: 400, tracking: -0.25 },
|
|
14792
|
+
displayMedium: { size: 45, line: 52, weight: 400, tracking: 0 },
|
|
14793
|
+
displaySmall: { size: 36, line: 44, weight: 400, tracking: 0 },
|
|
14794
|
+
headlineLarge: { size: 32, line: 40, weight: 400, tracking: 0 },
|
|
14795
|
+
headlineMedium: { size: 28, line: 36, weight: 400, tracking: 0 },
|
|
14796
|
+
headlineSmall: { size: 24, line: 32, weight: 400, tracking: 0 },
|
|
14797
|
+
titleLarge: { size: 22, line: 28, weight: 400, tracking: 0 },
|
|
14798
|
+
titleMedium: { size: 16, line: 24, weight: 500, tracking: 0.15 },
|
|
14799
|
+
titleSmall: { size: 14, line: 20, weight: 500, tracking: 0.1 },
|
|
14800
|
+
bodyLarge: { size: 16, line: 24, weight: 400, tracking: 0.5 },
|
|
14801
|
+
bodyMedium: { size: 14, line: 20, weight: 400, tracking: 0.25 },
|
|
14802
|
+
bodySmall: { size: 12, line: 16, weight: 400, tracking: 0.4 },
|
|
14803
|
+
labelLarge: { size: 14, line: 20, weight: 500, tracking: 0.1 },
|
|
14804
|
+
labelMedium: { size: 12, line: 16, weight: 500, tracking: 0.5 },
|
|
14805
|
+
labelSmall: { size: 11, line: 16, weight: 500, tracking: 0.5 }
|
|
14806
|
+
};
|
|
14807
|
+
var ELEVATION = [
|
|
14808
|
+
"none",
|
|
14809
|
+
"0 1px 2px 0 rgba(0,0,0,.30), 0 1px 3px 1px rgba(0,0,0,.15)",
|
|
14810
|
+
"0 1px 2px 0 rgba(0,0,0,.30), 0 2px 6px 2px rgba(0,0,0,.15)",
|
|
14811
|
+
"0 1px 3px 0 rgba(0,0,0,.30), 0 4px 8px 3px rgba(0,0,0,.15)",
|
|
14812
|
+
"0 2px 3px 0 rgba(0,0,0,.30), 0 6px 10px 4px rgba(0,0,0,.15)",
|
|
14813
|
+
"0 4px 4px 0 rgba(0,0,0,.30), 0 8px 12px 6px rgba(0,0,0,.15)"
|
|
14814
|
+
];
|
|
14815
|
+
var kebab = /* @__PURE__ */ __name((name2) => name2.replace(/[A-Z]/g, (c) => "-" + c.toLowerCase()), "kebab");
|
|
14816
|
+
function colorVars(s) {
|
|
14817
|
+
return Object.entries(s).map(([role, value]) => `--md-sys-color-${kebab(role)}:${value}`).join(";");
|
|
14818
|
+
}
|
|
14819
|
+
__name(colorVars, "colorVars");
|
|
14820
|
+
function systemVars() {
|
|
14821
|
+
const shape = Object.entries(SHAPE).map(([name2, value]) => `--md-sys-shape-corner-${kebab(name2)}:${value}px`);
|
|
14822
|
+
const elevation = ELEVATION.map((value, level) => `--md-sys-elevation-level${level}:${value}`);
|
|
14823
|
+
const type = Object.entries(TYPE).flatMap(([name2, style]) => [
|
|
14824
|
+
`--md-sys-typescale-${kebab(name2)}-size:${style.size}px`,
|
|
14825
|
+
`--md-sys-typescale-${kebab(name2)}-line-height:${style.line}px`,
|
|
14826
|
+
`--md-sys-typescale-${kebab(name2)}-weight:${style.weight}`,
|
|
14827
|
+
`--md-sys-typescale-${kebab(name2)}-tracking:${style.tracking}px`
|
|
14828
|
+
]);
|
|
14829
|
+
return [...shape, ...elevation, ...type, `--md-sys-typescale-font:${FONT_STACK}`, `--md-sys-typescale-font-mono:${MONO_STACK}`].join(";");
|
|
14830
|
+
}
|
|
14831
|
+
__name(systemVars, "systemVars");
|
|
14832
|
+
function baseline(s) {
|
|
14833
|
+
return `
|
|
14834
|
+
:root{${colorVars(s)};${systemVars()}}
|
|
14835
|
+
*,*::before,*::after{box-sizing:border-box}
|
|
14836
|
+
html,body{margin:0;padding:0}
|
|
14837
|
+
body{
|
|
14838
|
+
background:var(--md-sys-color-background);
|
|
14839
|
+
color:var(--md-sys-color-on-surface);
|
|
14840
|
+
font-family:var(--md-sys-typescale-font);
|
|
14841
|
+
font-synthesis-weight:none;
|
|
14842
|
+
-webkit-font-smoothing:antialiased;
|
|
14843
|
+
text-rendering:optimizeLegibility;
|
|
14844
|
+
font-variant-numeric:tabular-nums;
|
|
14845
|
+
}
|
|
14846
|
+
.m3-display-large{font-size:57px;line-height:64px;font-weight:600;letter-spacing:-.25px}
|
|
14847
|
+
.m3-display-medium{font-size:45px;line-height:52px;font-weight:600;letter-spacing:0}
|
|
14848
|
+
.m3-display-small{font-size:36px;line-height:44px;font-weight:600;letter-spacing:0}
|
|
14849
|
+
.m3-headline-large{font-size:32px;line-height:40px;font-weight:600;letter-spacing:0}
|
|
14850
|
+
.m3-headline-medium{font-size:28px;line-height:36px;font-weight:600;letter-spacing:0}
|
|
14851
|
+
.m3-headline-small{font-size:24px;line-height:32px;font-weight:600;letter-spacing:0}
|
|
14852
|
+
.m3-title-large{font-size:22px;line-height:28px;font-weight:600;letter-spacing:0}
|
|
14853
|
+
.m3-title-medium{font-size:16px;line-height:24px;font-weight:600;letter-spacing:.15px}
|
|
14854
|
+
.m3-title-small{font-size:14px;line-height:20px;font-weight:600;letter-spacing:.1px}
|
|
14855
|
+
.m3-body-large{font-size:16px;line-height:24px;font-weight:400;letter-spacing:.5px}
|
|
14856
|
+
.m3-body-medium{font-size:14px;line-height:20px;font-weight:400;letter-spacing:.25px}
|
|
14857
|
+
.m3-body-small{font-size:12px;line-height:16px;font-weight:400;letter-spacing:.4px}
|
|
14858
|
+
.m3-label-large{font-size:14px;line-height:20px;font-weight:600;letter-spacing:.1px}
|
|
14859
|
+
.m3-label-medium{font-size:12px;line-height:16px;font-weight:600;letter-spacing:.5px}
|
|
14860
|
+
.m3-label-small{font-size:11px;line-height:16px;font-weight:600;letter-spacing:.5px}
|
|
14861
|
+
`;
|
|
14862
|
+
}
|
|
14863
|
+
__name(baseline, "baseline");
|
|
14864
|
+
var MEDAL = {
|
|
14865
|
+
gold: lch(58, 52, 85),
|
|
14866
|
+
silver: lch(66, 5, 260),
|
|
14867
|
+
bronze: lch(48, 36, 48)
|
|
14868
|
+
};
|
|
14869
|
+
function components() {
|
|
14870
|
+
return `
|
|
14871
|
+
.m3-surface{background:var(--md-sys-color-surface);color:var(--md-sys-color-on-surface)}
|
|
14872
|
+
.m3-card{
|
|
14873
|
+
background:var(--md-sys-color-surface-container-low);
|
|
14874
|
+
color:var(--md-sys-color-on-surface);
|
|
14875
|
+
border-radius:var(--md-sys-shape-corner-extra-large);
|
|
14876
|
+
padding:24px;
|
|
14877
|
+
}
|
|
14878
|
+
.m3-card--elevated{background:var(--md-sys-color-surface-container-low);box-shadow:var(--md-sys-elevation-level1)}
|
|
14879
|
+
.m3-card--outlined{background:var(--md-sys-color-surface);border:1px solid var(--md-sys-color-outline-variant)}
|
|
14880
|
+
.m3-card--filled{background:var(--md-sys-color-surface-container-highest)}
|
|
14881
|
+
|
|
14882
|
+
/* 药丸形,Expressive 里用得最多的一种形状 */
|
|
14883
|
+
.m3-chip{
|
|
14884
|
+
display:inline-flex;align-items:center;gap:6px;
|
|
14885
|
+
height:32px;padding:0 16px;
|
|
14886
|
+
border-radius:var(--md-sys-shape-corner-full);
|
|
14887
|
+
background:var(--md-sys-color-secondary-container);
|
|
14888
|
+
color:var(--md-sys-color-on-secondary-container);
|
|
14889
|
+
font-size:14px;line-height:20px;font-weight:600;letter-spacing:.1px;white-space:nowrap;
|
|
14890
|
+
}
|
|
14891
|
+
.m3-chip--primary{background:var(--md-sys-color-primary-container);color:var(--md-sys-color-on-primary-container)}
|
|
14892
|
+
.m3-chip--tertiary{background:var(--md-sys-color-tertiary-container);color:var(--md-sys-color-on-tertiary-container)}
|
|
14893
|
+
.m3-chip--error{background:var(--md-sys-color-error-container);color:var(--md-sys-color-on-error-container)}
|
|
14894
|
+
.m3-chip--outlined{background:transparent;border:1px solid var(--md-sys-color-outline);color:var(--md-sys-color-on-surface-variant)}
|
|
14895
|
+
|
|
14896
|
+
.m3-divider{height:1px;border:0;margin:0;background:var(--md-sys-color-outline-variant)}
|
|
14897
|
+
|
|
14898
|
+
/* 列表项:靠圆角与容器色分组,不画分隔线 */
|
|
14899
|
+
.m3-list{display:flex;flex-direction:column;gap:4px;margin:0;padding:0;list-style:none}
|
|
14900
|
+
.m3-list-item{
|
|
14901
|
+
display:flex;align-items:center;gap:16px;
|
|
14902
|
+
min-height:56px;padding:8px 16px;
|
|
14903
|
+
border-radius:var(--md-sys-shape-corner-medium);
|
|
14904
|
+
background:var(--md-sys-color-surface-container);
|
|
14905
|
+
color:var(--md-sys-color-on-surface);
|
|
14906
|
+
}
|
|
14907
|
+
/* 一组里的首尾项圆角放大,整组读起来像一个整体 */
|
|
14908
|
+
.m3-list-item:first-child{border-top-left-radius:var(--md-sys-shape-corner-extra-large);border-top-right-radius:var(--md-sys-shape-corner-extra-large)}
|
|
14909
|
+
.m3-list-item:last-child{border-bottom-left-radius:var(--md-sys-shape-corner-extra-large);border-bottom-right-radius:var(--md-sys-shape-corner-extra-large)}
|
|
14910
|
+
.m3-list-item--accent{background:var(--md-sys-color-primary-container);color:var(--md-sys-color-on-primary-container)}
|
|
14911
|
+
|
|
14912
|
+
.m3-avatar{
|
|
14913
|
+
width:40px;height:40px;flex:none;
|
|
14914
|
+
border-radius:var(--md-sys-shape-corner-full);
|
|
14915
|
+
object-fit:cover;background:var(--md-sys-color-surface-container-highest);
|
|
14916
|
+
}
|
|
14917
|
+
|
|
14918
|
+
/* 序号徽章,名次靠它一眼可辨 */
|
|
14919
|
+
.m3-badge{
|
|
14920
|
+
display:inline-flex;align-items:center;justify-content:center;
|
|
14921
|
+
min-width:28px;height:28px;padding:0 8px;flex:none;
|
|
14922
|
+
border-radius:var(--md-sys-shape-corner-full);
|
|
14923
|
+
background:var(--md-sys-color-surface-container-highest);
|
|
14924
|
+
color:var(--md-sys-color-on-surface-variant);
|
|
14925
|
+
font-size:14px;font-weight:600;letter-spacing:0;
|
|
14926
|
+
font-variant-numeric:tabular-nums;
|
|
14927
|
+
}
|
|
14928
|
+
/*
|
|
14929
|
+
* 前三名用真正的金银铜,而不是主题的主 / 次 / 第三色:
|
|
14930
|
+
* 名次的含义是固定的,跟着主题变色反而认不出来。三种金属色本身也走 LCh,
|
|
14931
|
+
* 色调彼此拉开一档,所以放在任何主题里明暗关系都成立。
|
|
14932
|
+
*/
|
|
14933
|
+
.m3-badge--gold{background:${MEDAL.gold};color:#fff}
|
|
14934
|
+
.m3-badge--silver{background:${MEDAL.silver};color:#fff}
|
|
14935
|
+
.m3-badge--bronze{background:${MEDAL.bronze};color:#fff}
|
|
14936
|
+
|
|
14937
|
+
/*
|
|
14938
|
+
* 进度 / 排行条。填充与轨道是两个独立的全圆角色块,中间留 4px 空隙——
|
|
14939
|
+
* 这是 M3 新版进度指示器的标志性细节,靠 flex 比例分配长度,不必算百分比。
|
|
14940
|
+
*/
|
|
14941
|
+
.m3-bar{display:flex;align-items:center;gap:4px;height:16px;flex:1;min-width:0}
|
|
14942
|
+
.m3-bar__fill{
|
|
14943
|
+
height:100%;min-width:16px;
|
|
14944
|
+
border-radius:var(--md-sys-shape-corner-full);
|
|
14945
|
+
background:var(--md-sys-color-primary);
|
|
14946
|
+
}
|
|
14947
|
+
.m3-bar__track{
|
|
14948
|
+
height:100%;
|
|
14949
|
+
border-radius:var(--md-sys-shape-corner-full);
|
|
14950
|
+
background:var(--md-sys-color-surface-container-highest);
|
|
14951
|
+
}
|
|
14952
|
+
.m3-bar--on-accent .m3-bar__track{background:var(--md-sys-color-surface-container-lowest)}
|
|
14953
|
+
|
|
14954
|
+
/* 页眉:大标题 + 辅助说明,Expressive 强调标题本身的体量 */
|
|
14955
|
+
.m3-header{display:flex;flex-direction:column;gap:4px;padding:8px 4px 20px}
|
|
14956
|
+
.m3-header__title{font-size:32px;line-height:40px;font-weight:600;letter-spacing:0;color:var(--md-sys-color-on-surface);margin:0}
|
|
14957
|
+
.m3-header__support{font-size:14px;line-height:20px;font-weight:400;letter-spacing:.25px;color:var(--md-sys-color-on-surface-variant);margin:0}
|
|
14958
|
+
|
|
14959
|
+
/* 页脚署名,压到最低对比度,不与正文抢视线 */
|
|
14960
|
+
.m3-footnote{
|
|
14961
|
+
padding-top:16px;text-align:center;
|
|
14962
|
+
font-size:12px;line-height:16px;letter-spacing:.4px;
|
|
14963
|
+
color:var(--md-sys-color-outline);
|
|
14964
|
+
}
|
|
14965
|
+
`;
|
|
14966
|
+
}
|
|
14967
|
+
__name(components, "components");
|
|
14968
|
+
|
|
14624
14969
|
// src/view.ts
|
|
14970
|
+
var HUE = 138;
|
|
14971
|
+
var SCHEME = scheme(HUE, true);
|
|
14972
|
+
var accentOf = /* @__PURE__ */ __name((hue) => lch(80, 46, hue), "accentOf");
|
|
14625
14973
|
var PIXELS = {
|
|
14626
14974
|
// 品牌与模式
|
|
14627
14975
|
creeper: [
|
|
@@ -14988,7 +15336,7 @@ var MODES = {
|
|
|
14988
15336
|
mob: {
|
|
14989
15337
|
name: "生物",
|
|
14990
15338
|
icon: "creeper",
|
|
14991
|
-
accent:
|
|
15339
|
+
accent: accentOf(138),
|
|
14992
15340
|
pixelArt: false,
|
|
14993
15341
|
tagline: "从生命、体型与生成方式里辨认它",
|
|
14994
15342
|
total: mobData.length
|
|
@@ -14996,7 +15344,7 @@ var MODES = {
|
|
|
14996
15344
|
item: {
|
|
14997
15345
|
name: "物品",
|
|
14998
15346
|
icon: "ingot",
|
|
14999
|
-
accent:
|
|
15347
|
+
accent: accentOf(82),
|
|
15000
15348
|
pixelArt: true,
|
|
15001
15349
|
tagline: "从稀有度、来源与用途里辨认它",
|
|
15002
15350
|
total: itemData.length
|
|
@@ -15004,7 +15352,7 @@ var MODES = {
|
|
|
15004
15352
|
block: {
|
|
15005
15353
|
name: "方块",
|
|
15006
15354
|
icon: "grassblock",
|
|
15007
|
-
accent:
|
|
15355
|
+
accent: accentOf(238),
|
|
15008
15356
|
pixelArt: true,
|
|
15009
15357
|
tagline: "从硬度、工具与光学性质里辨认它",
|
|
15010
15358
|
total: blockData.length
|
|
@@ -15110,207 +15458,260 @@ function statusOf(guess, key) {
|
|
|
15110
15458
|
return STATUS_META[v] ? v : "unknown";
|
|
15111
15459
|
}
|
|
15112
15460
|
__name(statusOf, "statusOf");
|
|
15113
|
-
var
|
|
15461
|
+
var STATUS_TILE = {
|
|
15462
|
+
hit: lch(42, 44, 142),
|
|
15463
|
+
half: lch(44, 46, 82),
|
|
15464
|
+
miss: lch(42, 48, 28),
|
|
15465
|
+
none: SCHEME.surfaceContainerHigh
|
|
15466
|
+
};
|
|
15467
|
+
var FONT_STACK_CJK = `"Minecraft", "Fusion Pixel 12px monospaced", "Fusion Pixel 12px", "Zpix", ` + FONT_STACK;
|
|
15114
15468
|
var CSS = `
|
|
15115
|
-
|
|
15469
|
+
${baseline(SCHEME)}${components()}
|
|
15470
|
+
body{font-family:${FONT_STACK_CJK};background:transparent}
|
|
15116
15471
|
html,body{background:transparent}
|
|
15117
|
-
body{font-family:${FONT_STACK};-webkit-font-smoothing:antialiased}
|
|
15118
15472
|
.px{display:block;flex:none}
|
|
15119
15473
|
|
|
15120
15474
|
#card{
|
|
15121
15475
|
position:relative;
|
|
15122
15476
|
display:inline-block;
|
|
15123
|
-
|
|
15124
|
-
color
|
|
15125
|
-
|
|
15126
|
-
|
|
15127
|
-
/* 石质底噪:两层错位的斜向条纹,比纯色更有材质但不抢内容 */
|
|
15128
|
-
background-image:
|
|
15129
|
-
repeating-linear-gradient(135deg, rgba(255,255,255,.016) 0 2px, transparent 2px 5px),
|
|
15130
|
-
repeating-linear-gradient(45deg, rgba(0,0,0,.10) 0 3px, transparent 3px 7px);
|
|
15477
|
+
overflow:hidden;
|
|
15478
|
+
background:var(--md-sys-color-surface);
|
|
15479
|
+
color:var(--md-sys-color-on-surface);
|
|
15480
|
+
border-radius:${SHAPE.extraLarge}px;
|
|
15131
15481
|
}
|
|
15132
|
-
|
|
15133
|
-
content:"";position:absolute;inset:0;pointer-events:none;
|
|
15134
|
-
background:radial-gradient(120% 90% at 50% 0%, rgba(255,255,255,.05), transparent 60%);
|
|
15135
|
-
}
|
|
15136
|
-
.pad{padding:22px 24px 20px}
|
|
15482
|
+
.pad{padding:24px}
|
|
15137
15483
|
|
|
15138
|
-
/* ──
|
|
15139
|
-
.hd{
|
|
15140
|
-
|
|
15141
|
-
|
|
15142
|
-
|
|
15143
|
-
|
|
15144
|
-
|
|
15145
|
-
|
|
15146
|
-
|
|
15147
|
-
background:
|
|
15148
|
-
|
|
15149
|
-
.
|
|
15150
|
-
.brand
|
|
15151
|
-
.brand .
|
|
15152
|
-
|
|
15153
|
-
.brand .word b{color:var(--accent)}
|
|
15154
|
-
.hd .sub{margin-top:
|
|
15155
|
-
text-shadow:2px 2px 0 rgba(0,0,0,.4)}
|
|
15484
|
+
/* ── 页眉 ─────────────────────────────────────────── */
|
|
15485
|
+
.hd{
|
|
15486
|
+
position:relative;
|
|
15487
|
+
background:var(--md-sys-color-surface-container);
|
|
15488
|
+
padding:20px 24px 18px;
|
|
15489
|
+
}
|
|
15490
|
+
/* 顶端那道强调色仍在,但收成一条细的圆头指示条,不再模拟草皮 */
|
|
15491
|
+
.hd .turf{
|
|
15492
|
+
position:absolute;left:24px;top:14px;width:56px;height:4px;
|
|
15493
|
+
border-radius:${SHAPE.full}px;background:var(--accent);
|
|
15494
|
+
}
|
|
15495
|
+
.hd-row{display:flex;align-items:flex-end;justify-content:space-between;gap:24px;margin-top:18px}
|
|
15496
|
+
.brand{display:flex;align-items:center;gap:12px}
|
|
15497
|
+
.brand .mark{color:var(--accent)}
|
|
15498
|
+
.brand .word{font-size:28px;font-weight:600;letter-spacing:.18em;line-height:1}
|
|
15499
|
+
.brand .word b{color:var(--accent);font-weight:600}
|
|
15500
|
+
.hd .sub{margin-top:8px;font-size:13px;letter-spacing:.05em;color:var(--md-sys-color-on-surface-variant)}
|
|
15156
15501
|
.hd-meta{text-align:right;flex:none}
|
|
15157
|
-
.hd-meta .big{font-size:
|
|
15158
|
-
|
|
15159
|
-
.hd-meta .cap{font-size:11px;letter-spacing:.2em;color:#939b8b;margin-top:6px}
|
|
15502
|
+
.hd-meta .big{font-size:28px;font-weight:600;color:var(--accent);line-height:1;font-variant-numeric:tabular-nums}
|
|
15503
|
+
.hd-meta .cap{font-size:11px;letter-spacing:.1em;color:var(--md-sys-color-on-surface-variant);margin-top:6px}
|
|
15160
15504
|
|
|
15161
|
-
/*
|
|
15162
|
-
.badge{
|
|
15163
|
-
|
|
15164
|
-
|
|
15505
|
+
/* 模式徽记:药丸形 */
|
|
15506
|
+
.badge{
|
|
15507
|
+
display:inline-flex;align-items:center;gap:7px;padding:6px 14px;
|
|
15508
|
+
border-radius:${SHAPE.full}px;
|
|
15509
|
+
background:var(--accent);color:var(--md-sys-color-surface);
|
|
15510
|
+
font-size:12.5px;letter-spacing:.06em;font-weight:600;
|
|
15511
|
+
}
|
|
15165
15512
|
|
|
15166
15513
|
/* ── 猜测板 ───────────────────────────────────────── */
|
|
15167
|
-
table{border-collapse:separate;border-spacing:
|
|
15168
|
-
th{padding:0 0
|
|
15169
|
-
.col{display:flex;flex-direction:column;align-items:center;gap:
|
|
15170
|
-
min-width:80px;max-width:132px;color
|
|
15171
|
-
.col .lb{font-size:11px;letter-spacing:.
|
|
15514
|
+
table{border-collapse:separate;border-spacing:6px;margin:0 -6px}
|
|
15515
|
+
th{padding:0 0 8px;vertical-align:bottom}
|
|
15516
|
+
.col{display:flex;flex-direction:column;align-items:center;gap:6px;
|
|
15517
|
+
min-width:80px;max-width:132px;color:var(--md-sys-color-on-surface-variant)}
|
|
15518
|
+
.col .lb{font-size:11px;letter-spacing:.04em;color:var(--md-sys-color-on-surface-variant);
|
|
15519
|
+
text-align:center;line-height:1.25;font-weight:600}
|
|
15172
15520
|
th.n .col{align-items:flex-start;min-width:150px}
|
|
15173
15521
|
|
|
15174
15522
|
td{padding:0}
|
|
15175
|
-
.tile{
|
|
15176
|
-
|
|
15523
|
+
.tile{
|
|
15524
|
+
position:relative;overflow:hidden;height:100%;
|
|
15525
|
+
min-height:60px;min-width:76px;max-width:132px;
|
|
15526
|
+
padding:9px 10px;
|
|
15527
|
+
display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;
|
|
15528
|
+
border-radius:${SHAPE.medium}px;
|
|
15177
15529
|
background:var(--tile);
|
|
15178
|
-
|
|
15530
|
+
}
|
|
15179
15531
|
/* 多标签字段给更宽的上限,否则一列里会折成很高的一坨 */
|
|
15180
15532
|
.tile.list{max-width:168px}
|
|
15181
15533
|
th.list .col{max-width:168px}
|
|
15182
|
-
.tile .v{font-size:13px;font-weight:
|
|
15183
|
-
|
|
15184
|
-
.tile .chips{display:flex;flex-wrap:wrap;gap:
|
|
15185
|
-
.chip{
|
|
15186
|
-
|
|
15534
|
+
.tile .v{font-size:13px;font-weight:600;line-height:1.35;text-align:center;
|
|
15535
|
+
color:#fff;word-break:break-word}
|
|
15536
|
+
.tile .chips{display:flex;flex-wrap:wrap;gap:4px;justify-content:center}
|
|
15537
|
+
.chip{
|
|
15538
|
+
font-size:11.5px;line-height:1.35;padding:2px 8px;
|
|
15539
|
+
border-radius:${SHAPE.full}px;
|
|
15540
|
+
color:#fff;background:rgba(0,0,0,.24);
|
|
15541
|
+
}
|
|
15187
15542
|
/* 部分匹配时把真正命中的标签点亮,让「黄」变得可读 */
|
|
15188
|
-
.chip.on{background
|
|
15189
|
-
|
|
15190
|
-
.tile .flag{position:absolute;top:4px;right:4px;color:rgba(255,255,255,.8)}
|
|
15543
|
+
.chip.on{background:#fff;color:${SCHEME.surface};font-weight:600}
|
|
15544
|
+
.tile .flag{position:absolute;top:5px;right:5px;color:rgba(255,255,255,.85)}
|
|
15191
15545
|
/* 数值方向不只靠角标:整块的上/下边缘会亮起一条,指向答案所在的一侧 */
|
|
15192
|
-
.tile.s-up::after,.tile.s-down::after{content:"";position:absolute;left:
|
|
15193
|
-
background:rgba(255,255,255,.
|
|
15194
|
-
.tile.s-up::after{top:
|
|
15195
|
-
.tile.s-down::after{bottom:
|
|
15546
|
+
.tile.s-up::after,.tile.s-down::after{content:"";position:absolute;left:12px;right:12px;height:4px;
|
|
15547
|
+
border-radius:${SHAPE.full}px;background:rgba(255,255,255,.62)}
|
|
15548
|
+
.tile.s-up::after{top:5px}
|
|
15549
|
+
.tile.s-down::after{bottom:5px}
|
|
15196
15550
|
|
|
15197
|
-
.s-hit{--tile
|
|
15198
|
-
.s-half{--tile
|
|
15199
|
-
.s-miss{--tile
|
|
15200
|
-
.s-none{--tile
|
|
15551
|
+
.s-hit{--tile:${STATUS_TILE.hit}}
|
|
15552
|
+
.s-half{--tile:${STATUS_TILE.half}}
|
|
15553
|
+
.s-miss{--tile:${STATUS_TILE.miss}}
|
|
15554
|
+
.s-none{--tile:${STATUS_TILE.none}}
|
|
15201
15555
|
|
|
15202
15556
|
/* 名称格 */
|
|
15203
|
-
.name{
|
|
15204
|
-
|
|
15205
|
-
|
|
15206
|
-
.
|
|
15207
|
-
|
|
15208
|
-
|
|
15557
|
+
.name{
|
|
15558
|
+
display:flex;align-items:center;gap:12px;min-height:60px;min-width:150px;
|
|
15559
|
+
padding:8px 12px 8px 9px;
|
|
15560
|
+
border-radius:${SHAPE.medium}px;
|
|
15561
|
+
background:var(--md-sys-color-surface-container-high);
|
|
15562
|
+
}
|
|
15563
|
+
.name.correct{background:${STATUS_TILE.hit}}
|
|
15564
|
+
.thumb{
|
|
15565
|
+
width:44px;height:44px;flex:none;
|
|
15566
|
+
display:flex;align-items:center;justify-content:center;
|
|
15567
|
+
border-radius:${SHAPE.small}px;
|
|
15568
|
+
background:var(--md-sys-color-surface-container-lowest);
|
|
15569
|
+
}
|
|
15209
15570
|
.thumb img{max-width:38px;max-height:38px;display:block}
|
|
15210
15571
|
.thumb img.sharp{image-rendering:pixelated}
|
|
15211
15572
|
.thumb img.broken{display:none}
|
|
15212
|
-
.thumb .fb{display:none;color
|
|
15573
|
+
.thumb .fb{display:none;color:var(--md-sys-color-outline)}
|
|
15213
15574
|
.thumb.failed .fb{display:block}
|
|
15214
15575
|
.name .txt{min-width:0}
|
|
15215
|
-
.name .cn{font-size:15px;font-weight:
|
|
15216
|
-
.name .en{font-size:10.5px;letter-spacing:.
|
|
15576
|
+
.name .cn{font-size:15px;font-weight:600;line-height:1.25}
|
|
15577
|
+
.name .en{font-size:10.5px;letter-spacing:.04em;color:var(--md-sys-color-on-surface-variant);margin-top:3px;
|
|
15217
15578
|
white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:150px}
|
|
15218
|
-
.name.correct .en{color
|
|
15219
|
-
.name .no{
|
|
15220
|
-
.name
|
|
15579
|
+
.name.correct .cn,.name.correct .en,.name.correct .no{color:#fff}
|
|
15580
|
+
.name.correct .en,.name.correct .no{opacity:.78}
|
|
15581
|
+
.name .no{font-size:10px;color:var(--md-sys-color-outline);margin-top:3px}
|
|
15221
15582
|
|
|
15222
|
-
/*
|
|
15223
|
-
tr.fresh .tile,tr.fresh .name{box-shadow:
|
|
15224
|
-
inset 4px 4px 0 rgba(255,255,255,.16), 0 0 0 2px var(--accent)}
|
|
15583
|
+
/* 最新一行的强调:外圈描边 + 行首的圆头标记 */
|
|
15584
|
+
tr.fresh .tile,tr.fresh .name{box-shadow:0 0 0 2px var(--accent)}
|
|
15225
15585
|
tr.fresh .name{position:relative}
|
|
15226
|
-
tr.fresh .name::before{content:"";position:absolute;left:0;top:
|
|
15586
|
+
tr.fresh .name::before{content:"";position:absolute;left:0;top:14px;bottom:14px;width:4px;
|
|
15587
|
+
border-radius:${SHAPE.full}px;background:var(--accent)}
|
|
15227
15588
|
|
|
15228
15589
|
/* ── 进度条 ───────────────────────────────────────── */
|
|
15229
|
-
.prog{display:flex;align-items:center;gap:
|
|
15230
|
-
.prog .bar{
|
|
15231
|
-
|
|
15232
|
-
.
|
|
15233
|
-
|
|
15234
|
-
|
|
15590
|
+
.prog{display:flex;align-items:center;gap:12px;margin-top:20px}
|
|
15591
|
+
.prog .bar{
|
|
15592
|
+
flex:1;height:12px;overflow:hidden;
|
|
15593
|
+
border-radius:${SHAPE.full}px;
|
|
15594
|
+
background:var(--md-sys-color-surface-container-highest);
|
|
15595
|
+
}
|
|
15596
|
+
.prog .fill{height:100%;border-radius:${SHAPE.full}px;background:var(--accent)}
|
|
15597
|
+
.prog .num{font-size:12px;color:var(--md-sys-color-on-surface-variant);letter-spacing:.04em;flex:none;
|
|
15598
|
+
font-variant-numeric:tabular-nums}
|
|
15235
15599
|
|
|
15236
15600
|
/* ── 图例 / 页脚 ──────────────────────────────────── */
|
|
15237
|
-
.legend{
|
|
15238
|
-
|
|
15239
|
-
|
|
15240
|
-
background:var(--
|
|
15241
|
-
|
|
15601
|
+
.legend{
|
|
15602
|
+
display:flex;flex-wrap:wrap;gap:8px 10px;align-items:center;
|
|
15603
|
+
padding:14px 24px;
|
|
15604
|
+
background:var(--md-sys-color-surface-container);
|
|
15605
|
+
}
|
|
15606
|
+
.lg{
|
|
15607
|
+
display:flex;align-items:center;gap:6px;padding:5px 12px;
|
|
15608
|
+
border-radius:${SHAPE.full}px;
|
|
15609
|
+
font-size:11.5px;color:#fff;background:var(--tile);
|
|
15610
|
+
}
|
|
15611
|
+
.lg.s-none{color:var(--md-sys-color-on-surface-variant)}
|
|
15612
|
+
.tip{margin-left:auto;font-size:11.5px;color:var(--md-sys-color-outline);letter-spacing:.02em}
|
|
15242
15613
|
|
|
15243
15614
|
/* ── 通用区块 ─────────────────────────────────────── */
|
|
15244
|
-
.sec{margin-top:
|
|
15615
|
+
.sec{margin-top:22px}
|
|
15245
15616
|
.sec:first-child{margin-top:0}
|
|
15246
|
-
.sec-t{display:flex;align-items:center;gap:
|
|
15247
|
-
margin-bottom:
|
|
15248
|
-
.sec-t::after{content:"";flex:1;height:
|
|
15249
|
-
|
|
15250
|
-
|
|
15251
|
-
|
|
15252
|
-
|
|
15253
|
-
|
|
15254
|
-
.
|
|
15255
|
-
.row
|
|
15256
|
-
|
|
15257
|
-
|
|
15617
|
+
.sec-t{display:flex;align-items:center;gap:10px;font-size:12px;letter-spacing:.1em;
|
|
15618
|
+
font-weight:600;color:var(--md-sys-color-on-surface-variant);margin-bottom:12px}
|
|
15619
|
+
.sec-t::after{content:"";flex:1;height:1px;background:var(--md-sys-color-outline-variant)}
|
|
15620
|
+
.panel{
|
|
15621
|
+
padding:16px 18px;
|
|
15622
|
+
border-radius:${SHAPE.large}px;
|
|
15623
|
+
background:var(--md-sys-color-surface-container);
|
|
15624
|
+
}
|
|
15625
|
+
.rows{display:flex;flex-direction:column;gap:9px}
|
|
15626
|
+
.row{display:flex;align-items:center;gap:10px;font-size:13.5px;
|
|
15627
|
+
color:var(--md-sys-color-on-surface);line-height:1.5}
|
|
15628
|
+
.row .k{color:var(--accent);flex:none;font-weight:600}
|
|
15629
|
+
.row .m{color:var(--md-sys-color-on-surface-variant);font-size:12px}
|
|
15630
|
+
.cmd{
|
|
15631
|
+
font-weight:600;color:var(--md-sys-color-on-surface);
|
|
15632
|
+
background:var(--md-sys-color-surface-container-highest);
|
|
15633
|
+
padding:2px 9px;border-radius:${SHAPE.small}px;
|
|
15634
|
+
}
|
|
15258
15635
|
|
|
15259
|
-
.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:
|
|
15260
|
-
.mode-card{
|
|
15261
|
-
|
|
15262
|
-
|
|
15263
|
-
|
|
15264
|
-
|
|
15636
|
+
.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
|
|
15637
|
+
.mode-card{
|
|
15638
|
+
padding:15px 16px;
|
|
15639
|
+
border-radius:${SHAPE.large}px;
|
|
15640
|
+
background:var(--md-sys-color-surface-container);
|
|
15641
|
+
}
|
|
15642
|
+
.mode-card .top{display:flex;align-items:center;gap:9px;font-size:15px;font-weight:600}
|
|
15643
|
+
.mode-card .cnt{font-size:11.5px;color:var(--md-sys-color-on-surface-variant);margin-top:8px;letter-spacing:.04em}
|
|
15644
|
+
.mode-card .tl{font-size:11.5px;color:var(--md-sys-color-on-surface-variant);margin-top:6px;line-height:1.5}
|
|
15265
15645
|
|
|
15266
|
-
.attrs{display:flex;flex-wrap:wrap;gap:
|
|
15267
|
-
.attr{
|
|
15268
|
-
|
|
15646
|
+
.attrs{display:flex;flex-wrap:wrap;gap:8px}
|
|
15647
|
+
.attr{
|
|
15648
|
+
display:flex;align-items:center;gap:7px;padding:7px 14px;
|
|
15649
|
+
border-radius:${SHAPE.full}px;
|
|
15650
|
+
font-size:12.5px;color:var(--md-sys-color-on-secondary-container);
|
|
15651
|
+
background:var(--md-sys-color-secondary-container);
|
|
15652
|
+
}
|
|
15269
15653
|
.attr .px{color:var(--accent)}
|
|
15270
15654
|
|
|
15271
15655
|
/* ── 揭晓卡 ───────────────────────────────────────── */
|
|
15272
|
-
.reveal{display:flex;align-items:center;gap:
|
|
15656
|
+
.reveal{display:flex;align-items:center;gap:22px}
|
|
15273
15657
|
.reveal .who{flex:1;min-width:0}
|
|
15274
15658
|
.reveal .cn .crown{display:inline-block;vertical-align:middle;margin-left:12px;color:var(--accent)}
|
|
15275
|
-
.reveal .big-thumb{
|
|
15276
|
-
|
|
15277
|
-
|
|
15659
|
+
.reveal .big-thumb{
|
|
15660
|
+
width:136px;height:136px;flex:none;
|
|
15661
|
+
display:flex;align-items:center;justify-content:center;
|
|
15662
|
+
border-radius:${SHAPE.extraLarge}px;
|
|
15663
|
+
background:var(--md-sys-color-surface-container);
|
|
15664
|
+
}
|
|
15665
|
+
.reveal .big-thumb img{max-width:112px;max-height:112px;display:block}
|
|
15278
15666
|
.reveal .big-thumb img.sharp{image-rendering:pixelated}
|
|
15279
15667
|
.reveal .big-thumb img.broken{display:none}
|
|
15280
|
-
.reveal .big-thumb .fb{display:none;color
|
|
15668
|
+
.reveal .big-thumb .fb{display:none;color:var(--md-sys-color-outline)}
|
|
15281
15669
|
.reveal .big-thumb.failed .fb{display:block}
|
|
15282
|
-
.reveal .cn{font-size:
|
|
15283
|
-
.reveal .en{font-size:13px;letter-spacing:.
|
|
15284
|
-
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:
|
|
15285
|
-
.stat{
|
|
15286
|
-
|
|
15287
|
-
.
|
|
15288
|
-
|
|
15289
|
-
|
|
15670
|
+
.reveal .cn{font-size:36px;font-weight:600;line-height:1.1}
|
|
15671
|
+
.reveal .en{font-size:13px;letter-spacing:.1em;color:var(--md-sys-color-on-surface-variant);margin-top:10px}
|
|
15672
|
+
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
|
|
15673
|
+
.stat{
|
|
15674
|
+
padding:13px 16px;
|
|
15675
|
+
border-radius:${SHAPE.large}px;
|
|
15676
|
+
background:var(--md-sys-color-surface-container);
|
|
15677
|
+
}
|
|
15678
|
+
.stat .n{font-size:22px;font-weight:600;color:var(--accent);line-height:1;font-variant-numeric:tabular-nums}
|
|
15679
|
+
.stat .c{font-size:10.5px;color:var(--md-sys-color-on-surface-variant);margin-top:7px;letter-spacing:.06em}
|
|
15290
15680
|
|
|
15291
15681
|
/* ── 排行榜 ───────────────────────────────────────── */
|
|
15292
15682
|
.rank{display:flex;flex-direction:column;gap:6px}
|
|
15293
|
-
.rk{
|
|
15294
|
-
|
|
15295
|
-
.
|
|
15296
|
-
|
|
15297
|
-
|
|
15298
|
-
.rk.
|
|
15299
|
-
.rk.
|
|
15300
|
-
.rk
|
|
15301
|
-
|
|
15683
|
+
.rk{
|
|
15684
|
+
display:flex;align-items:center;gap:14px;padding:12px 14px;
|
|
15685
|
+
border-radius:${SHAPE.medium}px;
|
|
15686
|
+
background:var(--md-sys-color-surface-container);
|
|
15687
|
+
}
|
|
15688
|
+
.rk:first-child{border-top-left-radius:${SHAPE.extraLarge}px;border-top-right-radius:${SHAPE.extraLarge}px}
|
|
15689
|
+
.rk:last-child{border-bottom-left-radius:${SHAPE.extraLarge}px;border-bottom-right-radius:${SHAPE.extraLarge}px}
|
|
15690
|
+
.rk .pos{
|
|
15691
|
+
width:34px;height:34px;flex:none;
|
|
15692
|
+
display:flex;align-items:center;justify-content:center;
|
|
15693
|
+
border-radius:${SHAPE.full}px;
|
|
15694
|
+
font-size:15px;font-weight:600;
|
|
15695
|
+
color:var(--md-sys-color-on-surface-variant);
|
|
15696
|
+
background:var(--md-sys-color-surface-container-highest);
|
|
15697
|
+
}
|
|
15698
|
+
.rk.p1 .pos,.rk.p2 .pos,.rk.p3 .pos{color:#fff}
|
|
15699
|
+
.rk.p1 .pos{background:${MEDAL.gold}}
|
|
15700
|
+
.rk.p2 .pos{background:${MEDAL.silver}}
|
|
15701
|
+
.rk.p3 .pos{background:${MEDAL.bronze}}
|
|
15702
|
+
.rk.p1{box-shadow:0 0 0 2px ${MEDAL.gold}}
|
|
15302
15703
|
.rk .who{flex:1;min-width:0}
|
|
15303
|
-
.rk .nm{font-size:14.5px;font-weight:
|
|
15704
|
+
.rk .nm{font-size:14.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
|
|
15304
15705
|
max-width:260px}
|
|
15305
|
-
.rk .split{display:flex;gap:
|
|
15306
|
-
.rk .sp{display:flex;align-items:center;gap:4px;font-size:11px;color
|
|
15706
|
+
.rk .split{display:flex;gap:10px;margin-top:6px}
|
|
15707
|
+
.rk .sp{display:flex;align-items:center;gap:4px;font-size:11px;color:var(--md-sys-color-on-surface-variant)}
|
|
15307
15708
|
.rk .tot{flex:none;text-align:right}
|
|
15308
|
-
.rk .tot .n{font-size:
|
|
15309
|
-
|
|
15310
|
-
.rk .tot .c{font-size:10px;color:#7c856f;margin-top:5px;letter-spacing:.1em}
|
|
15709
|
+
.rk .tot .n{font-size:22px;font-weight:600;color:var(--accent);line-height:1;font-variant-numeric:tabular-nums}
|
|
15710
|
+
.rk .tot .c{font-size:10px;color:var(--md-sys-color-outline);margin-top:5px;letter-spacing:.06em}
|
|
15311
15711
|
|
|
15312
|
-
.empty{padding:
|
|
15313
|
-
.
|
|
15712
|
+
.empty{padding:36px 20px;min-width:400px;text-align:center;
|
|
15713
|
+
color:var(--md-sys-color-on-surface-variant);font-size:13.5px;line-height:2}
|
|
15714
|
+
.empty .px{margin:0 auto 14px;color:var(--md-sys-color-outline)}
|
|
15314
15715
|
`;
|
|
15315
15716
|
function shell(body, opts) {
|
|
15316
15717
|
const width = opts.width ? `width:${opts.width}px;` : "";
|
|
@@ -15532,21 +15933,21 @@ function helpCard(dailyLimit, allowRepeat, middleware) {
|
|
|
15532
15933
|
</div></div>
|
|
15533
15934
|
</div>
|
|
15534
15935
|
</div>` + noteRow("灵感来自 Wordle 与 mcdle.net");
|
|
15535
|
-
return shell(body, { accent:
|
|
15936
|
+
return shell(body, { accent: accentOf(138), width: 760 });
|
|
15536
15937
|
}
|
|
15537
15938
|
__name(helpCard, "helpCard");
|
|
15538
15939
|
function rankCard(entries, shown) {
|
|
15539
15940
|
if (!entries.length) {
|
|
15540
15941
|
const body2 = header(null, "排行榜", { big: "0", cap: "上榜人数" }) + `<div class="pad"><div class="empty">${px("trophy", 44)}
|
|
15541
15942
|
榜单还空着<br><span style="font-size:12px">用 <span class="cmd">mcdle.猜 苦力怕</span> 开出第一局,成为榜首</span></div></div>`;
|
|
15542
|
-
return shell(body2, { accent:
|
|
15943
|
+
return shell(body2, { accent: accentOf(90), width: 560 });
|
|
15543
15944
|
}
|
|
15544
15945
|
const max = Math.max(...entries.map((e) => e.total), 1);
|
|
15545
15946
|
const rows = entries.map((e, i) => {
|
|
15546
15947
|
const pos = i + 1;
|
|
15547
15948
|
const split = ["mob", "item", "block"].map((m) => {
|
|
15548
15949
|
const n = m === "mob" ? e.mob : m === "item" ? e.item : e.block;
|
|
15549
|
-
return `<span class="sp" style="color:${n ? MODES[m].accent :
|
|
15950
|
+
return `<span class="sp" style="color:${n ? MODES[m].accent : SCHEME.outline}">${px(MODES[m].icon, 10)}<span>${n}</span></span>`;
|
|
15550
15951
|
}).join("");
|
|
15551
15952
|
const w = Math.round(e.total / max * 100);
|
|
15552
15953
|
return `<div class="rk p${pos <= 3 ? pos : "n"}">
|
|
@@ -15558,7 +15959,7 @@ function rankCard(entries, shown) {
|
|
|
15558
15959
|
</div>`;
|
|
15559
15960
|
}).join("");
|
|
15560
15961
|
const body = header(null, "群内战绩 · 按累计猜中排序", { big: `${shown}`, cap: "上榜人数" }) + `<div class="pad"><div class="rank">${rows}</div></div>` + noteRow("每猜中一局记一分,按模式分别计数");
|
|
15561
|
-
return shell(body, { accent:
|
|
15962
|
+
return shell(body, { accent: accentOf(90), width: 560 });
|
|
15562
15963
|
}
|
|
15563
15964
|
__name(rankCard, "rankCard");
|
|
15564
15965
|
|
package/lib/m3.d.ts
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Material 3 Expressive 设计系统。
|
|
3
|
+
*
|
|
4
|
+
* 只依赖标准库,输出纯 CSS 变量与常量,任何渲染后端(puppeteer / canvas)都能用。
|
|
5
|
+
* 色板按 M3 的做法从一个源色推出六套色调板,再按角色映射成明暗两套配色。
|
|
6
|
+
*/
|
|
7
|
+
/** M3 的「色调」就是 CIE L*,0 为黑、100 为白。 */
|
|
8
|
+
export type Tone = number;
|
|
9
|
+
/** LCh -> #rrggbb。超出 sRGB 色域时按二分法降低彩度,色调与色相保持不变。 */
|
|
10
|
+
export declare function lch(tone: Tone, chroma: number, hue: number): string;
|
|
11
|
+
/** `#rrggbb` -> LCh,`lch()` 的逆运算。 */
|
|
12
|
+
export declare function lchOf(hex: string): {
|
|
13
|
+
tone: number;
|
|
14
|
+
chroma: number;
|
|
15
|
+
hue: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* 把一个任意来源的颜色(头像主色、用户自选色)收进本设计系统。
|
|
19
|
+
*
|
|
20
|
+
* 只保留它的色相,色调与彩度一律换成设计系统里的取值——于是每个人都还有
|
|
21
|
+
* 自己的颜色,整张图的明度节奏却是齐的,不会因为某个头像特别暗就糊成一团。
|
|
22
|
+
* 彩度太低的灰色头像没有可用的色相,退回主色。
|
|
23
|
+
*/
|
|
24
|
+
export declare function harmonize(hex: string, tone: Tone, chroma?: number, fallbackHue?: number): string;
|
|
25
|
+
/** 一套色调板:固定色相与彩度,按色调取色。 */
|
|
26
|
+
export type Palette = (tone: Tone) => string;
|
|
27
|
+
export declare function palette(hue: number, chroma: number): Palette;
|
|
28
|
+
export interface Palettes {
|
|
29
|
+
primary: Palette;
|
|
30
|
+
secondary: Palette;
|
|
31
|
+
tertiary: Palette;
|
|
32
|
+
neutral: Palette;
|
|
33
|
+
neutralVariant: Palette;
|
|
34
|
+
error: Palette;
|
|
35
|
+
}
|
|
36
|
+
export interface SourceOptions {
|
|
37
|
+
/** 主色彩度,默认 56,够鲜艳又不至于在浅色调上大面积溢出色域。 */
|
|
38
|
+
chroma?: number;
|
|
39
|
+
/**
|
|
40
|
+
* 第三色相对主色的相位差,默认 +60°。
|
|
41
|
+
* 这个值规范里是个经验值,并非永远合适:暖橙 +60° 会落到发闷的橄榄绿,
|
|
42
|
+
* 这种时候改成 -60° 取玫红,强调色才跳得出来。
|
|
43
|
+
*/
|
|
44
|
+
tertiaryShift?: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 按 M3 的推导规则从源色相生成六套色调板。
|
|
48
|
+
*
|
|
49
|
+
* Expressive 相比基础风格更敢用彩度:第三色比规范里的保守取值更高,
|
|
50
|
+
* 中性色也留了一点源色的味道,成片的表面不会灰得发死。
|
|
51
|
+
*/
|
|
52
|
+
export declare function palettesOf(hue: number, options?: SourceOptions): Palettes;
|
|
53
|
+
export interface Scheme {
|
|
54
|
+
primary: string;
|
|
55
|
+
onPrimary: string;
|
|
56
|
+
primaryContainer: string;
|
|
57
|
+
onPrimaryContainer: string;
|
|
58
|
+
secondary: string;
|
|
59
|
+
onSecondary: string;
|
|
60
|
+
secondaryContainer: string;
|
|
61
|
+
onSecondaryContainer: string;
|
|
62
|
+
tertiary: string;
|
|
63
|
+
onTertiary: string;
|
|
64
|
+
tertiaryContainer: string;
|
|
65
|
+
onTertiaryContainer: string;
|
|
66
|
+
error: string;
|
|
67
|
+
onError: string;
|
|
68
|
+
errorContainer: string;
|
|
69
|
+
onErrorContainer: string;
|
|
70
|
+
background: string;
|
|
71
|
+
onBackground: string;
|
|
72
|
+
surface: string;
|
|
73
|
+
onSurface: string;
|
|
74
|
+
surfaceVariant: string;
|
|
75
|
+
onSurfaceVariant: string;
|
|
76
|
+
surfaceDim: string;
|
|
77
|
+
surfaceBright: string;
|
|
78
|
+
surfaceContainerLowest: string;
|
|
79
|
+
surfaceContainerLow: string;
|
|
80
|
+
surfaceContainer: string;
|
|
81
|
+
surfaceContainerHigh: string;
|
|
82
|
+
surfaceContainerHighest: string;
|
|
83
|
+
outline: string;
|
|
84
|
+
outlineVariant: string;
|
|
85
|
+
inverseSurface: string;
|
|
86
|
+
inverseOnSurface: string;
|
|
87
|
+
inversePrimary: string;
|
|
88
|
+
scrim: string;
|
|
89
|
+
shadow: string;
|
|
90
|
+
}
|
|
91
|
+
/** 生成一套完整的角色配色。`dark` 为真时返回暗色方案。 */
|
|
92
|
+
export declare function scheme(hue: number, dark?: boolean, options?: SourceOptions): Scheme;
|
|
93
|
+
/**
|
|
94
|
+
* M3 Expressive 形状刻度(px)。
|
|
95
|
+
* Expressive 把圆角整体推大了一档,容器之间靠「圆角差」而不是分隔线来分层。
|
|
96
|
+
*/
|
|
97
|
+
export declare const SHAPE: {
|
|
98
|
+
readonly none: 0;
|
|
99
|
+
readonly extraSmall: 4;
|
|
100
|
+
readonly small: 8;
|
|
101
|
+
readonly medium: 12;
|
|
102
|
+
readonly large: 16;
|
|
103
|
+
readonly largeIncreased: 20;
|
|
104
|
+
readonly extraLarge: 28;
|
|
105
|
+
readonly extraLargeIncreased: 32;
|
|
106
|
+
readonly extraExtraLarge: 48;
|
|
107
|
+
readonly full: 9999;
|
|
108
|
+
};
|
|
109
|
+
/** 正文与标题字体栈,覆盖 Windows / macOS / Linux 与随包字体三种情况。 */
|
|
110
|
+
export declare const FONT_STACK = "\"Roboto Flex\", \"Roboto\", \"Noto Sans SC\", \"PingFang SC\", \"Microsoft YaHei\", \"Source Han Sans SC\", system-ui, sans-serif";
|
|
111
|
+
/** 等宽字体栈,用于比分、倒计时这类需要对齐的数字。 */
|
|
112
|
+
export declare const MONO_STACK = "\"Roboto Mono\", \"JetBrains Mono\", \"SF Mono\", \"Cascadia Mono\", Consolas, \"Noto Sans Mono\", monospace";
|
|
113
|
+
export interface TypeStyle {
|
|
114
|
+
size: number;
|
|
115
|
+
line: number;
|
|
116
|
+
weight: number;
|
|
117
|
+
tracking: number;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* M3 Expressive 字阶。`emphasized` 档提高字重,用在需要被一眼看到的地方,
|
|
121
|
+
* 这是 Expressive 与基础风格最直观的差别之一。
|
|
122
|
+
*/
|
|
123
|
+
export declare const TYPE: {
|
|
124
|
+
displayLarge: {
|
|
125
|
+
size: number;
|
|
126
|
+
line: number;
|
|
127
|
+
weight: number;
|
|
128
|
+
tracking: number;
|
|
129
|
+
};
|
|
130
|
+
displayMedium: {
|
|
131
|
+
size: number;
|
|
132
|
+
line: number;
|
|
133
|
+
weight: number;
|
|
134
|
+
tracking: number;
|
|
135
|
+
};
|
|
136
|
+
displaySmall: {
|
|
137
|
+
size: number;
|
|
138
|
+
line: number;
|
|
139
|
+
weight: number;
|
|
140
|
+
tracking: number;
|
|
141
|
+
};
|
|
142
|
+
headlineLarge: {
|
|
143
|
+
size: number;
|
|
144
|
+
line: number;
|
|
145
|
+
weight: number;
|
|
146
|
+
tracking: number;
|
|
147
|
+
};
|
|
148
|
+
headlineMedium: {
|
|
149
|
+
size: number;
|
|
150
|
+
line: number;
|
|
151
|
+
weight: number;
|
|
152
|
+
tracking: number;
|
|
153
|
+
};
|
|
154
|
+
headlineSmall: {
|
|
155
|
+
size: number;
|
|
156
|
+
line: number;
|
|
157
|
+
weight: number;
|
|
158
|
+
tracking: number;
|
|
159
|
+
};
|
|
160
|
+
titleLarge: {
|
|
161
|
+
size: number;
|
|
162
|
+
line: number;
|
|
163
|
+
weight: number;
|
|
164
|
+
tracking: number;
|
|
165
|
+
};
|
|
166
|
+
titleMedium: {
|
|
167
|
+
size: number;
|
|
168
|
+
line: number;
|
|
169
|
+
weight: number;
|
|
170
|
+
tracking: number;
|
|
171
|
+
};
|
|
172
|
+
titleSmall: {
|
|
173
|
+
size: number;
|
|
174
|
+
line: number;
|
|
175
|
+
weight: number;
|
|
176
|
+
tracking: number;
|
|
177
|
+
};
|
|
178
|
+
bodyLarge: {
|
|
179
|
+
size: number;
|
|
180
|
+
line: number;
|
|
181
|
+
weight: number;
|
|
182
|
+
tracking: number;
|
|
183
|
+
};
|
|
184
|
+
bodyMedium: {
|
|
185
|
+
size: number;
|
|
186
|
+
line: number;
|
|
187
|
+
weight: number;
|
|
188
|
+
tracking: number;
|
|
189
|
+
};
|
|
190
|
+
bodySmall: {
|
|
191
|
+
size: number;
|
|
192
|
+
line: number;
|
|
193
|
+
weight: number;
|
|
194
|
+
tracking: number;
|
|
195
|
+
};
|
|
196
|
+
labelLarge: {
|
|
197
|
+
size: number;
|
|
198
|
+
line: number;
|
|
199
|
+
weight: number;
|
|
200
|
+
tracking: number;
|
|
201
|
+
};
|
|
202
|
+
labelMedium: {
|
|
203
|
+
size: number;
|
|
204
|
+
line: number;
|
|
205
|
+
weight: number;
|
|
206
|
+
tracking: number;
|
|
207
|
+
};
|
|
208
|
+
labelSmall: {
|
|
209
|
+
size: number;
|
|
210
|
+
line: number;
|
|
211
|
+
weight: number;
|
|
212
|
+
tracking: number;
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Expressive 的强调字重。取 600 而非规范里的 500:很多机器上只装了 400 / 700 两档,
|
|
217
|
+
* 500 会回落成常规字重,强调就白做了;600 在这种字体集下会匹配到 700,效果才稳定。
|
|
218
|
+
* 正文维持 400,字重拉高反而伤可读性。
|
|
219
|
+
*/
|
|
220
|
+
export declare const EMPHASIZED_WEIGHT: {
|
|
221
|
+
readonly display: 600;
|
|
222
|
+
readonly headline: 600;
|
|
223
|
+
readonly title: 600;
|
|
224
|
+
readonly label: 600;
|
|
225
|
+
};
|
|
226
|
+
/** 阴影高度(dp -> box-shadow),M3 只有 0 ~ 5 六档。 */
|
|
227
|
+
export declare const ELEVATION: readonly ["none", "0 1px 2px 0 rgba(0,0,0,.30), 0 1px 3px 1px rgba(0,0,0,.15)", "0 1px 2px 0 rgba(0,0,0,.30), 0 2px 6px 2px rgba(0,0,0,.15)", "0 1px 3px 0 rgba(0,0,0,.30), 0 4px 8px 3px rgba(0,0,0,.15)", "0 2px 3px 0 rgba(0,0,0,.30), 0 6px 10px 4px rgba(0,0,0,.15)", "0 4px 4px 0 rgba(0,0,0,.30), 0 8px 12px 6px rgba(0,0,0,.15)"];
|
|
228
|
+
/** 把配色方案铺成 `--md-sys-color-*` 变量。 */
|
|
229
|
+
export declare function colorVars(s: Scheme): string;
|
|
230
|
+
/** 形状、字阶、高度的变量,与配色一起构成完整的令牌集。 */
|
|
231
|
+
export declare function systemVars(): string;
|
|
232
|
+
/** 一段可直接塞进 `<style>` 的基础样式:令牌 + 排版重置。 */
|
|
233
|
+
export declare function baseline(s: Scheme): string;
|
|
234
|
+
/**
|
|
235
|
+
* 通用组件样式。各插件按需挑用,命名统一为 `m3-` 前缀。
|
|
236
|
+
*
|
|
237
|
+
* Expressive 的取向体现在三处:圆角整体偏大且同一张图里刻意拉开层次、
|
|
238
|
+
* 强调元素用高彩度的容器色而不是描边、以及成组元素之间用间距而不是分隔线来断句。
|
|
239
|
+
*/
|
|
240
|
+
/** 金银铜。色调依次 58 / 66 / 48,深浅本身就排出了名次。 */
|
|
241
|
+
export declare const MEDAL: {
|
|
242
|
+
readonly gold: string;
|
|
243
|
+
readonly silver: string;
|
|
244
|
+
readonly bronze: string;
|
|
245
|
+
};
|
|
246
|
+
export declare function components(): string;
|
|
247
|
+
/**
|
|
248
|
+
* 浏览器端的配色小库,序列化进页面脚本用。
|
|
249
|
+
*
|
|
250
|
+
* 有些图是在页面里用 canvas 画的,那边拿不到这个模块。与其在客户端另写一套
|
|
251
|
+
* HSL 近似,不如把同一套 LCh 运算原样送过去——服务端与浏览器端算出来的颜色
|
|
252
|
+
* 必须一致,否则「同一支色相」的承诺在两边会对不上。
|
|
253
|
+
*
|
|
254
|
+
* 暴露的接口与本模块同名:`M3.lch` / `M3.lchOf` / `M3.harmonize`。
|
|
255
|
+
*/
|
|
256
|
+
export declare function clientColorScript(): string;
|