koishi-plugin-mcdle 0.1.5 → 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/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;
package/lib/view.d.ts CHANGED
@@ -57,7 +57,6 @@ export interface WinOptions {
57
57
  export declare function formatDuration(seconds: number): string;
58
58
  export declare function winCard(o: WinOptions): string;
59
59
  export declare function helpCard(dailyLimit: number, allowRepeat: boolean, middleware: boolean): string;
60
- export declare function introCard(dailyLimit: number, middleware: boolean): string;
61
60
  export interface RankEntry {
62
61
  username: string;
63
62
  userId: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-mcdle",
3
3
  "description": "Koishi 的 Minecraft 猜词游戏插件。",
4
- "version": "0.1.5",
4
+ "version": "0.2.0",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
package/readme.md DELETED
@@ -1,52 +0,0 @@
1
- koishi-plugin-mcdle
2
- ===================
3
-
4
- [<img alt="github" src="https://img.shields.io/badge/github-araea/koishi__plugin__mcdle-8da0cb?style=for-the-badge&labelColor=555555&logo=github" height="20">](https://github.com/araea/koishi-plugin-mcdle)
5
- [<img alt="npm" src="https://img.shields.io/npm/v/koishi-plugin-mcdle.svg?style=for-the-badge&color=fc8d62&logo=npm" height="20">](https://www.npmjs.com/package/koishi-plugin-mcdle)
6
-
7
- Koishi 的 Minecraft 猜词游戏插件。
8
-
9
- ## 使用
10
-
11
- `mcdle.猜 [名称]` 使用词库中的有效名称开局或猜测。首个词条决定生物、物品或方块模式,系统再从同类词库中抽取答案。开局后可用 `mcdle.裸猜` 临时切换本群的无前缀续猜;这一状态不改插件配置,插件重载后自动复原。
12
-
13
- ## 提示
14
-
15
- | 符号 | 含义 |
16
- | --- | --- |
17
- | 🟩 | 完全匹配 |
18
- | 🟨 | 部分匹配 |
19
- | 🟥 | 不匹配 |
20
- | 🟥⬆️ / 🟥⬇️ | 答案更大 / 更小 |
21
-
22
- ## 指令
23
-
24
- | 指令 | 说明 |
25
- | --- | --- |
26
- | `mcdle` | 查看帮助 |
27
- | `mcdle.猜 [名称]` | 用有效词条开局或猜测 |
28
- | `mcdle.裸猜 [开/关]` | 临时切换本群无前缀续猜 |
29
- | `mcdle.帮助` | 完整说明 |
30
- | `mcdle.排行榜` | 群内战绩 |
31
- | `mcdle.词库` | 全部词条 |
32
-
33
- ## QQ 群
34
-
35
- 956758505
36
-
37
- <br>
38
-
39
- #### License
40
-
41
- <sup>
42
- Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
43
- 2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option.
44
- </sup>
45
-
46
- <br>
47
-
48
- <sub>
49
- Unless you explicitly state otherwise, any contribution intentionally submitted
50
- for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
51
- be dual licensed as above, without any additional terms or conditions.
52
- </sub>