@linhey/rhine-design 0.2.0 → 0.4.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/CONTRIBUTING.md +6 -0
  3. package/README.md +70 -26
  4. package/components/Actions.tsx +6 -4
  5. package/components/COMMON_COMPONENTS.md +5 -1
  6. package/components/Data.tsx +8 -8
  7. package/components/FormWorkflow.tsx +25 -0
  8. package/components/Forms.tsx +11 -11
  9. package/components/Layout.tsx +4 -4
  10. package/components/Logo.tsx +7 -7
  11. package/components/MOTION.md +7 -3
  12. package/components/Navigation.tsx +42 -0
  13. package/components/Overlays.tsx +17 -11
  14. package/components/README.md +19 -11
  15. package/components/SPACING.md +82 -0
  16. package/components/Select.tsx +5 -5
  17. package/components/StatusTimeline.tsx +29 -0
  18. package/components/TYPOGRAPHY.md +35 -3
  19. package/components/Toast.tsx +2 -2
  20. package/components/Toolbar.tsx +3 -3
  21. package/components/Typography.tsx +1 -1
  22. package/components/common.css +78 -69
  23. package/components/components.tsx +28 -28
  24. package/components/index.ts +7 -1
  25. package/components/patterns.css +39 -0
  26. package/components/styles.css +105 -101
  27. package/components/theme-arknights.css +301 -0
  28. package/components/theme-neo-brutalism.css +84 -0
  29. package/components/theme.tsx +58 -0
  30. package/components/timeline.css +23 -0
  31. package/components/tokens.css +61 -56
  32. package/components/typography.css +31 -31
  33. package/docs/DESIGN_SYSTEM.md +24 -13
  34. package/docs/DESIGN_SYSTEM_AUDIT.md +4 -4
  35. package/docs/INTERACTION_PATTERNS.md +129 -0
  36. package/docs/REFERENCE_RESEARCH.md +36 -0
  37. package/docs/THEME_NEO_BRUTALISM.md +37 -0
  38. package/docs/THEMING.md +104 -0
  39. package/package.json +5 -1
  40. package/preview/CommonGallery.tsx +8 -8
  41. package/preview/GalleryShell.tsx +106 -0
  42. package/preview/LineHeightGallery.tsx +27 -0
  43. package/preview/MotionGallery.tsx +9 -5
  44. package/preview/PatternGallery.tsx +52 -0
  45. package/preview/SpacingGallery.tsx +32 -0
  46. package/preview/StartupGallery.tsx +1 -1
  47. package/preview/SubscriptionGallery.tsx +84 -0
  48. package/preview/brand-assembly.css +8 -8
  49. package/preview/line-height.css +2 -0
  50. package/preview/main.tsx +39 -25
  51. package/preview/motion.css +14 -14
  52. package/preview/patterns.css +7 -0
  53. package/preview/preview.css +15 -21
  54. package/preview/shell.css +35 -0
  55. package/preview/spacing.css +2 -0
  56. package/preview/startup.css +15 -15
  57. package/preview/subscriptions.css +27 -0
  58. package/preview/theme-arknights.css +234 -0
  59. package/preview/theme-neo-brutalism.css +11 -0
  60. package/scripts/check-build.mjs +1 -1
  61. package/skills/rhine-design/SKILL.md +6 -4
  62. package/skills/rhine-design/references/API_MAP.md +7 -3
  63. package/skills/rhine-design/references/TASK_MAP.md +4 -1
  64. package/skills/rhine-design/references/integration.md +6 -4
  65. package/tests/CommonComponents.test.tsx +1 -1
  66. package/tests/GalleryShell.test.tsx +98 -0
  67. package/tests/Patterns.test.tsx +75 -0
  68. package/tests/StartupGallery.test.tsx +3 -3
  69. package/tests/StatusTimeline.test.tsx +15 -0
  70. package/tests/Theme.test.tsx +112 -0
@@ -0,0 +1,301 @@
1
+ /* Component theme. Imported automatically by @linhey/rhine-design/theme, or after styles.css for CSS-only usage. */
2
+ .rhine-theme[data-rhine-theme="arknights"] {
3
+ /* ---- 色彩:暗舱底 + 信号黄 + 警戒橙 ---- */
4
+ --rhine-bg: #0b0d10;
5
+ --rhine-surface: #14161b;
6
+ --rhine-ink: #eef0ec;
7
+ --rhine-muted: #878f96;
8
+ --rhine-line: #272b31;
9
+ --rhine-control: #454c54;
10
+ --rhine-selected: #1c2026;
11
+ --rhine-green: #ffd400;
12
+ --rhine-signal: #ff6a1a;
13
+ --rhine-warning: #ffb020;
14
+ --rhine-error: #ff5449;
15
+ --rhine-warning-bg: #2a2113;
16
+ --rhine-error-bg: #2b1715;
17
+
18
+ /* ---- 形态:圆角归零 ---- */
19
+ --rhine-radius-card: 0px;
20
+ --rhine-radius-control: 0px;
21
+
22
+ /* ---- 主题私有变量 ---- */
23
+ --ak-accent: #ffd400;
24
+ --ak-accent-ink: #0b0d10; /* 压在黄底上的深色 */
25
+ --ak-gridline: rgba(238, 240, 236, .04);
26
+ --ak-panel: #14161b;
27
+ --ak-panel-hi: #1a1d23;
28
+ --ak-cut: 14px;
29
+ --ak-cut-sm: 8px;
30
+ --ak-hazard: repeating-linear-gradient(-45deg, var(--ak-accent) 0 8px, transparent 8px 16px);
31
+
32
+ color-scheme: dark;
33
+ }
34
+
35
+ /* 滚动条:细轨道 + 黄 thumb */
36
+ .rhine-theme[data-rhine-theme="arknights"] * { scrollbar-color: var(--rhine-control) transparent; }
37
+ .rhine-theme[data-rhine-theme="arknights"] ::-webkit-scrollbar { width: 8px; height: 8px; }
38
+ .rhine-theme[data-rhine-theme="arknights"] ::-webkit-scrollbar-thumb { background: var(--rhine-control); }
39
+ .rhine-theme[data-rhine-theme="arknights"] ::-webkit-scrollbar-thumb:hover { background: var(--ak-accent); }
40
+ .rhine-theme[data-rhine-theme="arknights"] ::-webkit-scrollbar-track { background: transparent; }
41
+
42
+ /* 选中文字 */
43
+ .rhine-theme[data-rhine-theme="arknights"] ::selection { background: var(--ak-accent); color: var(--ak-accent-ink); }
44
+
45
+ /* ================= 字体性格 ================= */
46
+ /* 标签、编号、说明全部等宽化,正文保持无衬线可读性 */
47
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-key-value dt,
48
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-field__hint,
49
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-progress__label {
50
+ font-family: var(--rhine-mono);
51
+ letter-spacing: .04em;
52
+ }
53
+ /* 面包屑分隔符换成终端风格 // */
54
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-breadcrumbs li { font-family: var(--rhine-mono); letter-spacing: .05em; }
55
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-breadcrumbs a { color: var(--ak-accent); }
56
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-breadcrumbs [aria-current=page] { color: var(--rhine-ink); }
57
+
58
+ /* 导航:等宽标签 + 当前项黄块左条 */
59
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-side-nav__group>p {
60
+ font-family: var(--rhine-mono);
61
+ letter-spacing: .14em;
62
+ color: var(--rhine-control);
63
+ }
64
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-side-nav a {
65
+ border-inline-start-width: 3px;
66
+ position: relative;
67
+ }
68
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-side-nav a:hover { background: var(--ak-panel-hi); }
69
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-side-nav a[aria-current=page] {
70
+ background: linear-gradient(90deg, rgba(255, 212, 0, .14), transparent 75%);
71
+ border-color: var(--ak-accent);
72
+ color: var(--ak-accent);
73
+ }
74
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-side-nav a[aria-current=page] .rhine-icon { color: var(--ak-accent); }
75
+
76
+ /* ================= 面板与容器:斜切 + 角标框架 ================= */
77
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-surface,
78
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-empty,
79
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-fieldset {
80
+ background: var(--ak-panel);
81
+ clip-path: polygon(0 0, calc(100% - var(--ak-cut)) 0, 100% var(--ak-cut), 100% 100%, 0 100%);
82
+ }
83
+ /* 左下角小角标点缀 */
84
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-surface { position: relative; }
85
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-surface::after {
86
+ content: '';
87
+ position: absolute;
88
+ left: 0;
89
+ bottom: 0;
90
+ width: 18px;
91
+ height: 18px;
92
+ border-left: 2px solid var(--ak-accent);
93
+ border-bottom: 2px solid var(--ak-accent);
94
+ opacity: .55;
95
+ pointer-events: none;
96
+ }
97
+
98
+ /* ================= 按钮:平行四边形 ================= */
99
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-button {
100
+ clip-path: polygon(var(--ak-cut-sm) 0, 100% 0, calc(100% - var(--ak-cut-sm)) 100%, 0 100%);
101
+ letter-spacing: .06em;
102
+ font-weight: 600;
103
+ }
104
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-button:not(.rhine-button--secondary):not(.rhine-button--quiet):not(.rhine-button--danger) {
105
+ background: var(--ak-accent);
106
+ border-color: var(--ak-accent);
107
+ color: var(--ak-accent-ink);
108
+ }
109
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-button:hover:not(:disabled):not([aria-disabled=true]) {
110
+ background: #ffe14d;
111
+ border-color: #ffe14d;
112
+ color: var(--ak-accent-ink);
113
+ }
114
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-button--secondary { border-color: var(--rhine-control); }
115
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-button--secondary:hover:not(:disabled):not([aria-disabled=true]),
116
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-button--quiet:hover:not(:disabled):not([aria-disabled=true]) {
117
+ background: var(--ak-panel-hi);
118
+ color: var(--ak-accent);
119
+ border-color: var(--ak-accent);
120
+ }
121
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-button--quiet { color: var(--ak-accent); }
122
+ /* clip-path 会裁掉外 outline,焦点改内描边 */
123
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-button:focus-visible {
124
+ outline: none;
125
+ box-shadow: inset 0 0 0 2px var(--rhine-ink);
126
+ }
127
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-button--danger { background: var(--rhine-error); border-color: var(--rhine-error); color: var(--rhine-ink); }
128
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-button--danger:hover:not(:disabled):not([aria-disabled=true]) { background: #c93a32; border-color: #c93a32; }
129
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-button:active:not(:disabled):not([aria-disabled=true]) { transform:none; }
130
+
131
+ /* 图标按钮保持方形小切角 */
132
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-icon-button {
133
+ clip-path: polygon(0 0, calc(100% - var(--ak-cut-sm)) 0, 100% var(--ak-cut-sm), 100% 100%, 0 100%);
134
+ }
135
+
136
+ /* ================= 链接 / 徽标 ================= */
137
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-link { color: var(--ak-accent); }
138
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-badge {
139
+ font: 600 11px/20px var(--rhine-mono);
140
+ letter-spacing: .1em;
141
+ padding: 2px 10px;
142
+ clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
143
+ }
144
+
145
+ /* ================= 表单 ================= */
146
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-field>label,
147
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-radio-group legend {
148
+ font-family: var(--rhine-mono);
149
+ font-size: 12px;
150
+ letter-spacing: .1em;
151
+ color: var(--rhine-muted);
152
+ }
153
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-field input,
154
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-field textarea {
155
+ background: #101216;
156
+ border-color: var(--rhine-control);
157
+ }
158
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-field input:focus,
159
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-field textarea:focus {
160
+ border-color: var(--ak-accent);
161
+ box-shadow: inset 3px 0 0 var(--ak-accent);
162
+ }
163
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-check input,
164
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-radio-group input { accent-color: var(--ak-accent); }
165
+
166
+ /* 开关:方轨道方块 */
167
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-switch__track { border-radius: 0; }
168
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-switch__track>span { border-radius: 0; }
169
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-switch input:checked+.rhine-switch__track { background: var(--ak-accent); border-color: var(--ak-accent); }
170
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-switch input:checked+.rhine-switch__track>span { background: var(--ak-accent-ink); }
171
+
172
+ /* 下拉浮层 */
173
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-combobox__list,
174
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-popover,
175
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-menu {
176
+ background: var(--ak-panel-hi);
177
+ border-color: var(--rhine-control);
178
+ border-radius: 0;
179
+ box-shadow: 0 12px 32px rgba(0, 0, 0, .55);
180
+ }
181
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-combobox__list [role=option][data-active=true],
182
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-combobox__list [role=option][aria-selected=true],
183
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-menu__item[data-highlighted] {
184
+ background: rgba(255, 212, 0, .12);
185
+ box-shadow: inset 3px 0 0 var(--ak-accent);
186
+ }
187
+
188
+ /* ================= 选择卡 ================= */
189
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-selection {
190
+ background: var(--ak-panel);
191
+ clip-path: polygon(0 0, calc(100% - var(--ak-cut)) 0, 100% var(--ak-cut), 100% 100%, 0 100%);
192
+ }
193
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-selection:hover:not([data-disabled=true]) {
194
+ background: var(--ak-panel-hi);
195
+ border-color: var(--ak-accent);
196
+ }
197
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-selection[data-selected=true] {
198
+ border-color: var(--ak-accent);
199
+ background: var(--rhine-selected);
200
+ box-shadow: inset 0 0 0 1px var(--ak-accent), inset 4px 0 0 var(--ak-accent);
201
+ }
202
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-selection input { accent-color: var(--ak-accent); }
203
+
204
+ /* ================= Tabs / Segmented ================= */
205
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-tabs__list button { letter-spacing: .05em; }
206
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-tabs__list button[aria-selected=true] { color: var(--ak-accent); }
207
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-tabs__list button::after {
208
+ background: var(--ak-accent);
209
+ height: 3px;
210
+ clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
211
+ }
212
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-segmented { border-color: var(--rhine-control); background: #101216; }
213
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-segmented input:checked+span {
214
+ background: var(--ak-accent);
215
+ color: var(--ak-accent-ink);
216
+ font-weight: 600;
217
+ clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%);
218
+ }
219
+
220
+ /* ================= 数据组件 ================= */
221
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-table th {
222
+ font-family: var(--rhine-mono);
223
+ letter-spacing: .08em;
224
+ border-bottom: 2px solid var(--ak-accent);
225
+ }
226
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-table tbody tr:hover { background: rgba(255, 212, 0, .06); }
227
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-metric { font-variant-numeric: tabular-nums; }
228
+
229
+ /* ================= 反馈 ================= */
230
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-progress__track { height: 8px; background: #1e2126; }
231
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-progress__track>span {
232
+ background: linear-gradient(90deg, var(--ak-accent), var(--rhine-signal));
233
+ }
234
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-notice,
235
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-toast {
236
+ border-left-width: 4px;
237
+ clip-path: polygon(0 0, calc(100% - var(--ak-cut-sm)) 0, 100% var(--ak-cut-sm), 100% 100%, 0 100%);
238
+ }
239
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-skeleton>span[aria-hidden] { background: #22262c; }
240
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-disclosure summary>span { color: var(--ak-accent); }
241
+
242
+ /* ================= 浮层 / 对话框 ================= */
243
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-overlay { background: rgba(4, 5, 7, .72); }
244
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-dialog {
245
+ background: var(--ak-panel);
246
+ border-color: var(--rhine-control);
247
+ border-radius: 0;
248
+ box-shadow: 0 24px 64px rgba(0, 0, 0, .6);
249
+ clip-path: polygon(0 0, calc(100% - var(--ak-cut)) 0, 100% var(--ak-cut), 100% 100%, 0 100%);
250
+ }
251
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-tooltip {
252
+ background: var(--ak-accent);
253
+ color: var(--ak-accent-ink);
254
+ border-radius: 0;
255
+ font-family: var(--rhine-mono);
256
+ letter-spacing: .04em;
257
+ }
258
+
259
+ /* ================= 步骤条 ================= */
260
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-steps__number { color: var(--ak-accent); }
261
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-steps li[data-state=current]>div {
262
+ background: rgba(255, 212, 0, .08);
263
+ color: var(--ak-accent);
264
+ }
265
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-steps li[data-state=current],
266
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-steps li[data-state=complete] { border-color: var(--ak-accent); }
267
+
268
+ /* 按钮扫光(滑入的高光层) */
269
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-button {
270
+ background-image: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .28) 50%, transparent 70%);
271
+ background-repeat: no-repeat;
272
+ background-size: 220% 100%;
273
+ background-position: 130% 0;
274
+ transition:
275
+ background-color var(--rhine-duration-hover) var(--rhine-ease-standard),
276
+ border-color var(--rhine-duration-hover) var(--rhine-ease-standard),
277
+ transform var(--rhine-duration-press) var(--rhine-ease-standard),
278
+ background-position 320ms var(--rhine-ease-standard);
279
+ }
280
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-button:hover:not(:disabled):not([aria-disabled=true]) {
281
+ background-position: -80% 0;
282
+ }
283
+
284
+ /* 侧栏导航加序号 */
285
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-side-nav ul { counter-reset: ak-nav; }
286
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-side-nav a { counter-increment: ak-nav; }
287
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-side-nav a::before {
288
+ content: counter(ak-nav, decimal-leading-zero);
289
+ font: 10px/1 var(--rhine-mono);
290
+ color: var(--rhine-control);
291
+ flex: none;
292
+ }
293
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-side-nav a[aria-current=page]::before { color: var(--ak-accent); }
294
+
295
+ /* 面板悬停:角标点亮 */
296
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-surface { transition: border-color var(--rhine-duration-hover) var(--rhine-ease-standard); }
297
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-surface:hover { border-color: var(--rhine-control); }
298
+ .rhine-theme[data-rhine-theme="arknights"] .rhine-surface:hover::after { opacity: 1; }
299
+ .rhine-theme[data-rhine-theme="arknights"][data-rhine-motion=reduced] .rhine-button {
300
+ transition: none;
301
+ }
@@ -0,0 +1,84 @@
1
+ /* Component theme. Imported automatically by @linhey/rhine-design/theme, or after styles.css for CSS-only usage. */
2
+ .rhine-theme[data-rhine-theme="neo-brutalism"] {
3
+ color-scheme: light;
4
+ --rhine-bg: #eaf0f4;
5
+ --rhine-surface: #fffdf5;
6
+ --rhine-ink: #202323;
7
+ --rhine-muted: #59616a;
8
+ --rhine-line: #b9c1c7;
9
+ --rhine-control: #202323;
10
+ --rhine-selected: #fce4cc;
11
+ --rhine-green: #286043;
12
+ --rhine-signal: #ff8b3d;
13
+ --rhine-warning: #854216;
14
+ --rhine-warning-bg: #fce4cc;
15
+ --rhine-error: #a02e36;
16
+ --rhine-error-bg: #fbe1df;
17
+ --rhine-radius-card: 22px;
18
+ --rhine-radius-control: 12px;
19
+ --rhine-weight-heading: 750;
20
+ --rhine-weight-label: 600;
21
+ --rhine-text-metric: 36px;
22
+ --rhine-leading-metric: 44px;
23
+ --rhine-hard-shadow: 5px 5px 0 var(--rhine-ink);
24
+ --rhine-tag-green: #dcebd7;
25
+ --rhine-tag-orange: #fce0c4;
26
+ --rhine-tag-violet: #e3e0f7;
27
+ background: radial-gradient(circle, #b7c2cc .8px, transparent .9px) 0 0 / 14px 14px, var(--rhine-bg);
28
+ }
29
+
30
+ .rhine-theme[data-rhine-theme="neo-brutalism"] :is(.rhine-surface, .rhine-selection, .rhine-empty, .rhine-fieldset) {
31
+ border: 2px solid var(--rhine-ink);
32
+ border-radius: var(--rhine-radius-card);
33
+ box-shadow: var(--rhine-hard-shadow);
34
+ }
35
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-button {
36
+ border: 2px solid var(--rhine-ink);
37
+ background: var(--rhine-signal);
38
+ color: var(--rhine-ink);
39
+ box-shadow: 3px 3px 0 var(--rhine-ink);
40
+ font-weight: 700;
41
+ transition: background-color 120ms, transform 80ms, box-shadow 80ms;
42
+ }
43
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-button--secondary { background: #fff; }
44
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-button--quiet { background: transparent; border-color: transparent; box-shadow: none; }
45
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-button--danger { background: var(--rhine-error); color: #fff; }
46
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-button:hover:not(:disabled):not([aria-disabled=true]) { background: #ffb16e; border-color: var(--rhine-ink); }
47
+ .rhine-theme[data-rhine-theme="neo-brutalism"] :is(.rhine-button--secondary, .rhine-button--quiet):hover:not(:disabled):not([aria-disabled=true]) { background: var(--rhine-selected); }
48
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-button--danger:hover:not(:disabled):not([aria-disabled=true]) { background: #81262d; }
49
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-button:active:not(:disabled):not([aria-disabled=true]) { transform: translate(3px, 3px); box-shadow: none; }
50
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-button:disabled { background: #e1e5e8; color: var(--rhine-muted); border-color: #89929a; box-shadow: none; }
51
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-button[aria-busy=true] { box-shadow: none; }
52
+ .rhine-theme[data-rhine-theme="neo-brutalism"] :is(button, input, select, textarea, summary, a, [tabindex]):focus-visible { outline: 3px solid var(--rhine-ink); outline-offset: 4px; }
53
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-tone-success { --rhine-tone-bg: var(--rhine-tag-green); }
54
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-tone-neutral { --rhine-tone-bg: #e7ebee; }
55
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-badge { border: 1px solid currentColor; border-radius: 8px; padding: 3px 9px; font-weight: 600; }
56
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-type-tag { display: inline-flex; padding: 4px 10px; border: 1.5px solid var(--rhine-ink); border-radius: 8px; color: var(--rhine-ink); font-size: 12px; line-height: 20px; font-weight: 700; }
57
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-type-tag[data-color=green] { background: var(--rhine-tag-green); }
58
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-type-tag[data-color=orange] { background: var(--rhine-tag-orange); }
59
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-type-tag[data-color=violet] { background: var(--rhine-tag-violet); }
60
+ .rhine-theme[data-rhine-theme="neo-brutalism"] :is(.rhine-field input, .rhine-field textarea, .rhine-select select, .rhine-segmented) { border-width: 2px; background: #fff; }
61
+ .rhine-theme[data-rhine-theme="neo-brutalism"] :is(.rhine-field input, .rhine-field textarea, .rhine-select select):disabled { background: #e1e5e8; border-color: #89929a; }
62
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-segmented__option span { border-radius: 8px; }
63
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-segmented input:checked+span { background: var(--rhine-selected); color: var(--rhine-ink); box-shadow: inset 0 0 0 1px var(--rhine-ink); }
64
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-selection:hover:not([data-disabled=true]) { background: #fff4e8; border-color: var(--rhine-ink); }
65
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-selection[data-selected=true] { background: var(--rhine-selected); border-color: var(--rhine-ink); }
66
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-selection[data-disabled=true] { box-shadow: none; }
67
+ .rhine-theme[data-rhine-theme="neo-brutalism"] :is(.rhine-dialog, .rhine-popover, .rhine-menu, .rhine-combobox__list) { border: 2px solid var(--rhine-ink); border-radius: 18px; box-shadow: var(--rhine-hard-shadow); }
68
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-dialog { border-radius: 24px; box-shadow: 8px 8px 0 var(--rhine-ink); }
69
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-drawer { border-radius: 24px 0 0 24px; box-shadow: -5px 0 0 var(--rhine-ink); }
70
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-overlay { background: #20232360; backdrop-filter: none; }
71
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-menu__item { border-radius: 10px; }
72
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-menu__item[data-highlighted] { box-shadow: inset 0 0 0 2px var(--rhine-ink); }
73
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-tooltip { border-radius: 8px; }
74
+ .rhine-theme[data-rhine-theme="neo-brutalism"] :is(.rhine-notice, .rhine-toast, .rhine-error-summary) { border: 2px solid var(--rhine-tone, var(--rhine-error)); border-radius: 14px; }
75
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-table th { color: var(--rhine-ink); background: #edf0e9; font-weight: 700; border-bottom: 2px solid var(--rhine-ink); }
76
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-table :is(th, td) { padding: 16px 12px; }
77
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-table td { font-size: 14px; }
78
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-progress__track { height: 10px; border: 1.5px solid var(--rhine-ink); border-radius: 6px; background: #e7ebee; }
79
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-progress__track>span { background: var(--rhine-signal); }
80
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-side-nav a[aria-current=page] { color: var(--rhine-ink); border: 2px solid var(--rhine-ink); background: var(--rhine-selected); font-weight: 700; }
81
+ @media(prefers-reduced-motion:reduce) {
82
+ .rhine-theme[data-rhine-theme="neo-brutalism"] .rhine-button:active:not(:disabled):not([aria-disabled=true]) { transform: none; }
83
+ }
84
+ .rhine-theme[data-rhine-theme="neo-brutalism"][data-rhine-motion=reduced] .rhine-button:active:not(:disabled):not([aria-disabled=true]) { transform: none; }
@@ -0,0 +1,58 @@
1
+ import { createContext, useCallback, useContext, useMemo, useState, type HTMLAttributes } from 'react';
2
+ import './styles.css';
3
+ import './theme-arknights.css';
4
+ import './theme-neo-brutalism.css';
5
+
6
+ export const themes = [
7
+ { name: 'rhine', label: '莱茵 · 纸面' },
8
+ { name: 'arknights', label: '明日方舟 · 战术终端' },
9
+ { name: 'neo-brutalism', label: '橙趣 · 粗描边' },
10
+ ] as const;
11
+
12
+ export type ThemeName = typeof themes[number]['name'];
13
+
14
+ export interface ThemeProviderProps extends HTMLAttributes<HTMLDivElement> {
15
+ defaultTheme?: ThemeName;
16
+ theme?: ThemeName;
17
+ onThemeChange?: (theme: ThemeName) => void;
18
+ }
19
+
20
+ interface ThemeContextValue {
21
+ theme: ThemeName;
22
+ setTheme: (theme: ThemeName) => void;
23
+ }
24
+
25
+ const ThemeContext = createContext<ThemeContextValue | null>(null);
26
+
27
+ function assertTheme(theme: ThemeName) {
28
+ if (!themes.some(item => item.name === theme)) {
29
+ throw new Error(`Unknown Rhine theme: ${String(theme)}. Use a name from themes.`);
30
+ }
31
+ }
32
+
33
+ export function ThemeProvider({ theme: controlledTheme, defaultTheme = 'rhine', onThemeChange, className, children, ...rootProps }: ThemeProviderProps) {
34
+ const parent = useContext(ThemeContext);
35
+ const [internalTheme, setInternalTheme] = useState(defaultTheme);
36
+ const theme = controlledTheme ?? internalTheme;
37
+ const setTheme = useCallback((next: ThemeName) => {
38
+ assertTheme(next);
39
+ if (next === theme) return;
40
+ if (controlledTheme === undefined) setInternalTheme(next);
41
+ onThemeChange?.(next);
42
+ }, [controlledTheme, onThemeChange, theme]);
43
+ const value = useMemo(() => ({ theme, setTheme }), [theme, setTheme]);
44
+
45
+ // Descendant CSS selectors cannot isolate nested theme roots yet.
46
+ if (parent) throw new Error('Nested Rhine ThemeProvider is not supported. Use sibling providers instead.');
47
+ assertTheme(theme);
48
+
49
+ return <ThemeContext.Provider value={value}>
50
+ <div {...rootProps} className={['rhine-theme', className].filter(Boolean).join(' ')} data-rhine-theme={theme}>{children}</div>
51
+ </ThemeContext.Provider>;
52
+ }
53
+
54
+ export function useTheme(): ThemeContextValue {
55
+ const context = useContext(ThemeContext);
56
+ if (!context) throw new Error('useTheme must be used within a Rhine ThemeProvider.');
57
+ return context;
58
+ }
@@ -0,0 +1,23 @@
1
+ .rhine-timeline { display:grid; gap:var(--rhine-space-1); min-width:0; }
2
+ .rhine-timeline__track { position:relative; height:44px; }
3
+ .rhine-timeline__bars { height:100%; display:flex; gap:1px; align-items:center; }
4
+ .rhine-timeline__bars span { flex:1; min-width:0; height:20px; background:var(--rhine-line); }
5
+ .rhine-timeline [data-status=healthy],.rhine-timeline__legend [data-status=healthy] { background:var(--rhine-health-healthy); }
6
+ .rhine-timeline [data-status=recovered],.rhine-timeline__legend [data-status=recovered] { background:repeating-linear-gradient(135deg,var(--rhine-health-recovered) 0 2px,var(--rhine-surface) 2px 4px); }
7
+ .rhine-timeline [data-status=degraded],.rhine-timeline__legend [data-status=degraded] { background:var(--rhine-health-degraded); }
8
+ .rhine-timeline [data-status=failed],.rhine-timeline__legend [data-status=failed] { background:var(--rhine-health-failed); }
9
+ .rhine-timeline [data-status=unknown],.rhine-timeline__legend [data-status=unknown] { background:var(--rhine-health-unknown); }
10
+ .rhine-timeline__bars [data-selected=true] { height:28px; outline:1px solid var(--rhine-ink); outline-offset:1px; }
11
+ .rhine-timeline__track input { appearance:none; position:absolute; inset:0; margin:0; width:100%; height:44px; background:transparent; cursor:crosshair; color:transparent; }
12
+ .rhine-timeline__track input::-webkit-slider-thumb { appearance:none; width:1px; height:44px; background:transparent; }
13
+ .rhine-timeline__track input::-moz-range-thumb { border:0; width:1px; height:44px; background:transparent; }
14
+ .rhine-timeline__range { display:flex; justify-content:space-between; gap:var(--rhine-space-2); }
15
+ .rhine-timeline__legend { display:flex; flex-wrap:wrap; gap:var(--rhine-space-2) var(--rhine-space-3); margin:0; padding:0; list-style:none; font-size:var(--rhine-text-caption); line-height:var(--rhine-leading-caption); color:var(--rhine-muted); }
16
+ .rhine-timeline__legend li { display:flex; align-items:center; gap:var(--rhine-space-1); }
17
+ .rhine-timeline__legend span { width:8px; height:12px; background:var(--rhine-line); }
18
+ .rhine-timeline--compact { position:relative; gap:0; }
19
+ .rhine-timeline--compact .rhine-timeline__track { height:20px; }
20
+ .rhine-timeline--compact .rhine-timeline__track input { top:-12px; bottom:auto; }
21
+ .rhine-timeline--compact .rhine-timeline__detail { position:absolute; z-index:2; top:100%; inset-inline:0; padding:4px 8px; border:1px solid var(--rhine-line); background:var(--rhine-surface); box-shadow:0 4px 12px #242b2814; pointer-events:none; visibility:hidden; }
22
+ .rhine-timeline--compact:hover .rhine-timeline__detail,.rhine-timeline--compact:focus-within .rhine-timeline__detail { visibility:visible; }
23
+ .rhine-timeline--compact:not(:hover):not(:focus-within) .rhine-timeline__bars [data-selected=true] { height:20px; outline:none; }
@@ -1,58 +1,63 @@
1
1
  /* Canonical tokens for the component library and design previews. */
2
- :root {
3
- --tod-bg: #f2f1e9;
4
- --tod-surface: #fcfcf8;
5
- --tod-ink: #242b28;
6
- --tod-muted: #59645d;
7
- --tod-line: #c5ccc1;
8
- --tod-control: #78857b;
9
- --tod-selected: #e5ece3;
10
- --tod-green: #425c4b;
11
- --tod-signal: #c65c34;
12
- --tod-warning: #8a472c;
13
- --tod-error: #a13e35;
14
- --tod-warning-bg: #f4e8dc;
15
- --tod-error-bg: #f6e9e4;
16
- --tod-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
17
- --tod-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
18
- --tod-text-title: 30px;
19
- --tod-leading-title: 38px;
20
- --tod-text-section: 18px;
21
- --tod-leading-section: 26px;
22
- --tod-text-heading: 16px;
23
- --tod-leading-heading: 24px;
24
- --tod-text-body: 14px;
25
- --tod-leading-body: 22px;
26
- --tod-text-caption: 12px;
27
- --tod-leading-caption: 18px;
28
- --tod-text-metric: 26px;
29
- --tod-leading-metric: 32px;
30
- --tod-text-metric-compact: 20px;
31
- --tod-leading-metric-compact: 26px;
32
- --tod-text-code: 12px;
33
- --tod-leading-code: 20px;
34
- --tod-weight-regular: 400;
35
- --tod-weight-label: 500;
36
- --tod-weight-heading: 600;
37
- --tod-space-1: 4px;
38
- --tod-space-2: 8px;
39
- --tod-space-3: 12px;
40
- --tod-space-4: 16px;
41
- --tod-space-6: 24px;
42
- --tod-space-8: 32px;
43
- --tod-space-12: 48px;
44
- --tod-radius-card: 4px;
45
- --tod-radius-control: 3px;
46
- --tod-duration-hover: 120ms;
47
- --tod-duration-press: 80ms;
48
- --tod-duration-panel: 180ms;
49
- --tod-duration-notice: 200ms;
50
- --tod-duration-progress: 240ms;
51
- --tod-duration-brand: 240ms;
52
- --tod-duration-overlay: 160ms;
53
- --tod-duration-loading: 1000ms;
54
- --tod-duration-skeleton: 1400ms;
55
- --tod-ease-standard: cubic-bezier(.2, 0, 0, 1);
56
- --tod-ease-exit: cubic-bezier(.4, 0, 1, 1);
57
- --tod-motion-distance: 3px;
2
+ :root, :where(.rhine-theme[data-rhine-theme]) {
3
+ --rhine-bg: #f2f1e9;
4
+ --rhine-surface: #fcfcf8;
5
+ --rhine-ink: #242b28;
6
+ --rhine-muted: #59645d;
7
+ --rhine-line: #c5ccc1;
8
+ --rhine-control: #78857b;
9
+ --rhine-selected: #e5ece3;
10
+ --rhine-green: #425c4b;
11
+ --rhine-signal: #c65c34;
12
+ --rhine-warning: #8a472c;
13
+ --rhine-error: #a13e35;
14
+ --rhine-health-healthy: #19b88a;
15
+ --rhine-health-recovered: #42b8c8;
16
+ --rhine-health-degraded: #efa629;
17
+ --rhine-health-failed: #ef6464;
18
+ --rhine-health-unknown: #c5ccd3;
19
+ --rhine-warning-bg: #f4e8dc;
20
+ --rhine-error-bg: #f6e9e4;
21
+ --rhine-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
22
+ --rhine-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
23
+ --rhine-text-title: 30px;
24
+ --rhine-leading-title: 38px;
25
+ --rhine-text-section: 18px;
26
+ --rhine-leading-section: 26px;
27
+ --rhine-text-heading: 16px;
28
+ --rhine-leading-heading: 24px;
29
+ --rhine-text-body: 14px;
30
+ --rhine-leading-body: 22px;
31
+ --rhine-text-caption: 12px;
32
+ --rhine-leading-caption: 18px;
33
+ --rhine-text-metric: 26px;
34
+ --rhine-leading-metric: 32px;
35
+ --rhine-text-metric-compact: 20px;
36
+ --rhine-leading-metric-compact: 26px;
37
+ --rhine-text-code: 12px;
38
+ --rhine-leading-code: 20px;
39
+ --rhine-weight-regular: 400;
40
+ --rhine-weight-label: 500;
41
+ --rhine-weight-heading: 600;
42
+ --rhine-space-1: 4px;
43
+ --rhine-space-2: 8px;
44
+ --rhine-space-3: 12px;
45
+ --rhine-space-4: 16px;
46
+ --rhine-space-6: 24px;
47
+ --rhine-space-8: 32px;
48
+ --rhine-space-12: 48px;
49
+ --rhine-radius-card: 4px;
50
+ --rhine-radius-control: 3px;
51
+ --rhine-duration-hover: 120ms;
52
+ --rhine-duration-press: 80ms;
53
+ --rhine-duration-panel: 180ms;
54
+ --rhine-duration-notice: 200ms;
55
+ --rhine-duration-progress: 240ms;
56
+ --rhine-duration-brand: 240ms;
57
+ --rhine-duration-overlay: 160ms;
58
+ --rhine-duration-loading: 1000ms;
59
+ --rhine-duration-skeleton: 1400ms;
60
+ --rhine-ease-standard: cubic-bezier(.2, 0, 0, 1);
61
+ --rhine-ease-exit: cubic-bezier(.4, 0, 1, 1);
62
+ --rhine-motion-distance: 3px;
58
63
  }