@heikeson/md-engine 0.2.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @file Cards 卡片样式
3
+ * @description 两列网格(≥640px),颜色取 --lkes-* 令牌;长标题/正文自动换行。
4
+ * @created 2026-10-27 13:43
5
+ * @updated 2026-10-27 13:49
6
+ */
7
+
8
+ @layer lkes.components {
9
+ .prose-site .cards {
10
+ display: grid;
11
+ gap: 0.75rem;
12
+ margin: 1.25rem 0;
13
+ }
14
+
15
+ @media (min-width: 640px) {
16
+ .prose-site .cards {
17
+ grid-template-columns: repeat(2, minmax(0, 1fr));
18
+ }
19
+ }
20
+
21
+ .prose-site .card {
22
+ display: block;
23
+ padding: 1rem;
24
+ border: 1px solid var(--lkes-border, #e5e7eb);
25
+ border-radius: var(--lkes-radius, 0.5rem);
26
+ transition: border-color 150ms ease, background-color 150ms ease;
27
+ }
28
+
29
+ .prose-site .card-link:hover {
30
+ border-color: var(--lkes-accent, #0f766e);
31
+ background-color: color-mix(in oklab, var(--lkes-fill, #f3f4f6) 50%, transparent);
32
+ }
33
+
34
+ .prose-site .card-title {
35
+ margin-bottom: 0.25rem;
36
+ font-weight: 600;
37
+ overflow-wrap: break-word;
38
+ }
39
+
40
+ /* 卡片图标(短文本 / emoji) */
41
+ .prose-site .card-icon {
42
+ margin-right: 0.375rem;
43
+ }
44
+
45
+ .prose-site .card-body {
46
+ font-size: 0.875rem;
47
+ color: var(--lkes-muted, #6b7280);
48
+ overflow-wrap: break-word;
49
+ }
50
+
51
+ .prose-site .card-body > :first-child {
52
+ margin-top: 0;
53
+ }
54
+ .prose-site .card-body > :last-child {
55
+ margin-bottom: 0;
56
+ }
57
+ }
@@ -0,0 +1,132 @@
1
+ /**
2
+ * @file 编辑器骨架样式(后台,不套 .prose-site)
3
+ * @description 原生 CSS 实现,颜色取 --lkes-* 令牌;CodeMirror 内部的字色/光标在
4
+ * src/editor/codemirror.ts 的 EditorView.theme 中定义,此处只负责外壳布局。
5
+ * @created 2026-10-27 13:43
6
+ * @updated 2026-10-27 13:49
7
+ */
8
+
9
+ @layer lkes.components {
10
+ .md-editor {
11
+ display: flex;
12
+ height: 100%;
13
+ min-height: 0;
14
+ flex-direction: column;
15
+ border: 1px solid var(--lkes-border, #e5e7eb);
16
+ border-radius: var(--lkes-radius, 0.5rem);
17
+ background-color: var(--lkes-bg, #ffffff);
18
+ }
19
+
20
+ .md-editor-toolbar {
21
+ display: flex;
22
+ flex-wrap: wrap;
23
+ align-items: center;
24
+ gap: 0.25rem;
25
+ padding: 0.375rem 0.5rem;
26
+ border-bottom: 1px solid var(--lkes-border, #e5e7eb);
27
+ }
28
+
29
+ .md-editor-toolbar button {
30
+ min-height: 28px;
31
+ margin: 0;
32
+ padding: 0.25rem 0.5rem;
33
+ border: 0;
34
+ border-radius: 0.25rem;
35
+ background: none;
36
+ font-size: 0.8125rem;
37
+ color: var(--lkes-muted, #6b7280);
38
+ cursor: pointer;
39
+ transition: background-color 150ms ease, color 150ms ease;
40
+ }
41
+
42
+ .md-editor-toolbar button:hover {
43
+ background-color: var(--lkes-fill, #f3f4f6);
44
+ color: var(--lkes-fg, #1f2937);
45
+ }
46
+
47
+ .md-editor-toolbar button:disabled {
48
+ cursor: not-allowed;
49
+ opacity: 0.4;
50
+ }
51
+
52
+ .md-editor-sep {
53
+ width: 1px;
54
+ height: 1rem;
55
+ margin: 0 0.25rem;
56
+ background-color: var(--lkes-border, #e5e7eb);
57
+ }
58
+
59
+ /* 工具栏右侧推到底:视图切换与全屏 */
60
+ .md-editor-grow {
61
+ flex: 1;
62
+ }
63
+
64
+ .md-editor-views {
65
+ display: flex;
66
+ align-items: center;
67
+ gap: 0.125rem;
68
+ padding: 0.125rem;
69
+ border-radius: 0.375rem;
70
+ background-color: var(--lkes-fill, #f3f4f6);
71
+ }
72
+
73
+ .md-editor-views button {
74
+ min-height: 24px;
75
+ margin: 0;
76
+ padding: 0.125rem 0.5rem;
77
+ border: 0;
78
+ border-radius: 0.25rem;
79
+ background: none;
80
+ font-size: 0.8125rem;
81
+ color: var(--lkes-muted, #6b7280);
82
+ cursor: pointer;
83
+ transition: background-color 150ms ease, color 150ms ease;
84
+ }
85
+
86
+ .md-editor-views button:hover {
87
+ color: var(--lkes-fg, #1f2937);
88
+ }
89
+
90
+ .md-editor-views button[data-active="true"] {
91
+ background-color: var(--lkes-bg, #ffffff);
92
+ color: var(--lkes-fg, #1f2937);
93
+ box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
94
+ }
95
+
96
+ .md-editor-body {
97
+ display: flex;
98
+ min-height: 0;
99
+ flex: 1;
100
+ }
101
+
102
+ /* 编辑区容器:交给 CodeMirror 自己排版(内边距与字体在其主题里定义) */
103
+ .md-editor-source {
104
+ min-height: 0;
105
+ flex: 1;
106
+ overflow: hidden;
107
+ }
108
+
109
+ /* relative:滚动同步用 el.offsetTop,必须以预览容器作为定位父级 */
110
+ .md-editor-preview {
111
+ position: relative;
112
+ min-height: 0;
113
+ flex: 1;
114
+ overflow-y: auto;
115
+ padding: 1rem;
116
+ border-left: 1px solid var(--lkes-border, #e5e7eb);
117
+ }
118
+
119
+ .md-editor-status {
120
+ display: flex;
121
+ align-items: center;
122
+ gap: 0.75rem;
123
+ padding: 0.25rem 0.75rem;
124
+ border-top: 1px solid var(--lkes-border, #e5e7eb);
125
+ font-size: 0.8125rem;
126
+ color: var(--lkes-muted, #6b7280);
127
+ }
128
+
129
+ .md-editor-status-warn {
130
+ color: color-mix(in oklab, #f59e0b 80%, var(--lkes-fg, #1f2937));
131
+ }
132
+ }
package/styles/engine.css CHANGED
@@ -1,373 +1,9 @@
1
- /**
2
- * @file 内容组件样式(引擎包自带)
3
- * @description 由宿主 `app/globals.css` 以 `@import "@heikeson/md-engine/styles.css"` 引入。
4
- * 作用域挂在宿主正文容器 `.prose-site` 下(该类由宿主传给渲染器,属对外契约的一部分)。
5
- * 颜色一律引用宿主主题变量(`border-border`、`text-muted-foreground` 等),包内不写死色值;
6
- * 换肤只改宿主主题,组件样式随包版本升级。
7
- * @created 2026-10-24 20:31
8
- * @updated 2026-10-26 23:16 目录图标按 details[open] 切换闭合 / 敞口双形态
9
- */
10
-
11
- @layer components {
12
- /* ---------- Callout 提示框 ---------- */
13
- .prose-site .callout {
14
- @apply my-5 rounded-lg border-l-4 px-4 py-3;
15
- }
16
- .prose-site .callout-title {
17
- @apply mb-1 flex items-center gap-2 text-sm font-semibold;
18
- }
19
- .prose-site .callout-icon {
20
- @apply size-4 shrink-0;
21
- }
22
- /* 自定义文本图标(emoji 等):固定 16×16 盒,与 lucide 图标同尺寸,对齐规则一致。
23
- 注意不要在这里设 line-height:下方用 `1lh` 计算首行居中,lh 取的是元素自身行高,
24
- 一旦写成 leading-none,算出来的偏移会变成负数,图标会整体偏上。 */
25
- .prose-site .callout-icon-text {
26
- @apply inline-flex size-4 shrink-0 items-center justify-center text-[15px];
27
- }
28
- /* 无标题形态:图标与正文同一行,正文占满剩余宽度 */
29
- .prose-site .callout-inline {
30
- @apply flex items-start gap-2;
31
- }
32
- .prose-site .callout-inline .callout-icon,
33
- .prose-site .callout-inline .callout-icon-text {
34
- /* 垂直居中于正文首行:用 lh 跟随主题行高(行高变了也不会偏),
35
- 回退值按 1.75rem 行高、16px 图标换算 */
36
- margin-top: 0.375rem;
37
- margin-top: calc((1lh - 1rem) / 2);
38
- }
39
- .prose-site .callout-inline .callout-body {
40
- @apply min-w-0 flex-1;
41
- }
42
- .prose-site .callout-body > :first-child {
43
- @apply mt-0;
44
- }
45
- .prose-site .callout-body > :last-child {
46
- @apply mb-0;
47
- }
48
- .prose-site .callout-note {
49
- @apply border-blue-500 bg-blue-500/10 text-blue-700 dark:text-blue-300;
50
- }
51
- .prose-site .callout-tip {
52
- @apply border-emerald-500 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300;
53
- }
54
- .prose-site .callout-important {
55
- @apply border-violet-500 bg-violet-500/10 text-violet-700 dark:text-violet-300;
56
- }
57
- .prose-site .callout-warning {
58
- @apply border-amber-500 bg-amber-500/10 text-amber-700 dark:text-amber-300;
59
- }
60
- .prose-site .callout-caution {
61
- @apply border-red-500 bg-red-500/10 text-red-700 dark:text-red-300;
62
- }
63
-
64
- /* ---------- Tabs 选项卡 ---------- */
65
- .prose-site .tabs {
66
- @apply my-5 overflow-hidden rounded-lg border border-border;
67
- }
68
- /* 标准下划线形态:无底色、无阴影。
69
- 头部 px-3 与按钮 px-1 叠加,使首个选项文字左边界为 16px,与 .tab-panel 的 p-4 对齐。 */
70
- .prose-site .tabs-header {
71
- @apply flex flex-wrap gap-5 border-b border-border px-3 py-0;
72
- }
73
- .prose-site .tab-btn {
74
- @apply border-b-2 border-transparent px-1 py-2.5 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground;
75
- }
76
- .prose-site .tab-btn.active {
77
- @apply border-primary text-foreground;
78
- }
79
- .prose-site .tab-panel {
80
- @apply p-4;
81
- }
82
- .prose-site .tab-panel[hidden] {
83
- @apply hidden;
84
- }
85
-
86
- /* ---------- Accordion 折叠 ---------- */
87
- .prose-site .accordion {
88
- @apply my-5 overflow-hidden rounded-lg border border-border bg-background;
89
- }
90
- .prose-site .accordion-item {
91
- @apply border-b border-border last:border-b-0;
92
- }
93
- /* 触发区:高度 ≥44px(触摸目标),键盘可达,hover 与展开态分层。
94
- 标题用 semibold + 前景色,与正文(常规字重 + 弱化色)拉开层级。 */
95
- .prose-site .accordion-trigger {
96
- @apply flex w-full items-center justify-between gap-3 px-4 py-3.5 text-left text-sm font-semibold text-foreground transition-colors;
97
- }
98
- .prose-site .accordion-trigger:hover {
99
- @apply bg-muted/60;
100
- }
101
- .prose-site .accordion-trigger:focus-visible {
102
- @apply outline-none ring-2 ring-ring ring-inset;
103
- }
104
- /* 注意:Tailwind 4 的 rotate-180 生成独立属性 `rotate:`,用 transition-transform 不会过渡;
105
- transition 的默认属性表包含 transform/translate/scale/rotate,故此处用 transition。 */
106
- .prose-site .accordion-chevron {
107
- @apply size-4 shrink-0 text-muted-foreground transition duration-200;
108
- }
109
- .prose-site .accordion-item.open .accordion-chevron {
110
- @apply rotate-180 text-foreground;
111
- }
112
- /* 展开项标记:用 inset 阴影画一条贯穿「标题 + 内容」的主色条。
113
- 不用 border-l,因为 border 会挤占 padding 导致该项文字与其它项错位。 */
114
- .prose-site .accordion-item.open {
115
- box-shadow: inset 2px 0 0 var(--color-primary, currentColor);
116
- }
117
- /* 展开动画:grid 0fr → 1fr,无需测量高度 */
118
- .prose-site .accordion-panel {
119
- display: grid;
120
- grid-template-rows: 0fr;
121
- transition: grid-template-rows 220ms cubic-bezier(0.4, 0, 0.2, 1);
122
- }
123
- .prose-site .accordion-panel[data-open="true"] {
124
- grid-template-rows: 1fr;
125
- }
126
- .prose-site .accordion-panel-inner {
127
- overflow: hidden;
128
- min-height: 0;
129
- }
130
- /* 正文与标题的区分:弱化文字色 + 浅底 + 顶部留白。
131
- 收起时 inner 被 grid 压扁并裁剪,padding 不会撑出高度。 */
132
- .prose-site .accordion-content {
133
- @apply bg-muted/30 px-4 pt-3 pb-4 text-sm leading-relaxed text-muted-foreground;
134
- }
135
- .prose-site .accordion-content > :first-child {
136
- @apply mt-0;
137
- }
138
- .prose-site .accordion-content > :last-child {
139
- @apply mb-0;
140
- }
141
- /* 偏好减少动画时直接切换,不做过渡 */
142
- @media (prefers-reduced-motion: reduce) {
143
- .prose-site .accordion-panel,
144
- .prose-site .accordion-chevron {
145
- transition: none;
146
- }
147
- }
148
-
149
- /* ---------- Image 图片(对齐 / 尺寸 / 题注) ---------- */
150
- .prose-site .image {
151
- @apply my-5;
152
- }
153
- .prose-site .image.align-left {
154
- @apply mr-auto;
155
- }
156
- .prose-site .image.align-center {
157
- @apply mx-auto text-center;
158
- }
159
- .prose-site .image.align-right {
160
- @apply ml-auto text-right;
161
- }
162
- .prose-site .image-img {
163
- /* 限制最大宽度:窄屏下宽图不撑破正文容器 */
164
- @apply inline-block max-w-full rounded-lg;
165
- height: auto;
166
- }
167
- .prose-site .image figcaption {
168
- @apply mt-2 text-center text-sm text-muted-foreground;
169
- }
170
- /* 图片放大:点击图片全屏查看,点遮罩或 Esc 关闭 */
171
- .prose-site .image-img-zoomable {
172
- @apply cursor-zoom-in;
173
- }
174
- .prose-site .image-zoom-mask {
175
- @apply fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4;
176
- cursor: zoom-out;
177
- }
178
- .prose-site .image-zoom-img {
179
- @apply max-h-full max-w-full rounded-lg object-contain;
180
- }
181
-
182
- /* ---------- TypeTable 类型表 ---------- */
183
- .prose-site .type-table {
184
- @apply my-5 overflow-hidden rounded-lg border border-border;
185
- }
186
- .prose-site .type-table table {
187
- @apply w-full border-collapse text-sm;
188
- }
189
- .prose-site .type-table thead th {
190
- @apply border-b border-border bg-muted/40 px-3 py-2 text-left font-medium text-foreground;
191
- }
192
- .prose-site .type-table tbody td {
193
- @apply border-b border-border px-3 py-2 align-top;
194
- }
195
- .prose-site .type-table tbody tr:last-child td {
196
- @apply border-b-0;
197
- }
198
- .prose-site .type-table code {
199
- @apply rounded bg-muted px-1.5 py-0.5 text-[13px];
200
- }
201
- .prose-site .type-cell-name code {
202
- @apply font-semibold text-foreground;
203
- }
204
- .prose-site .type-cell-default,
205
- .prose-site .type-cell-desc {
206
- @apply text-muted-foreground;
207
- }
208
- .prose-site .type-required {
209
- @apply ml-2 rounded bg-red-500/10 px-1.5 py-0.5 text-[11px] text-red-600 dark:text-red-400;
210
- }
211
-
212
- /* ---------- Steps 步骤 ---------- */
213
- .prose-site .steps {
214
- @apply my-5;
215
- }
216
- .prose-site .step {
217
- @apply relative flex gap-3 pb-5 last:pb-0;
218
- }
219
- .prose-site .step::before {
220
- content: "";
221
- @apply absolute left-3 top-7 bottom-0 w-px bg-border;
222
- }
223
- .prose-site .step:last-child::before {
224
- @apply hidden;
225
- }
226
- .prose-site .step-marker {
227
- @apply z-10 flex size-6 shrink-0 items-center justify-center rounded-full border border-border bg-background text-xs font-semibold;
228
- }
229
- .prose-site .step-body {
230
- @apply flex-1 min-w-0;
231
- }
232
- .prose-site .step-title {
233
- @apply mb-1 font-semibold;
234
- }
235
- .prose-site .step-content > :first-child {
236
- @apply mt-0;
237
- }
238
- .prose-site .step-content > :last-child {
239
- @apply mb-0;
240
- }
241
-
242
- /* ---------- Cards 卡片 ---------- */
243
- .prose-site .cards {
244
- @apply my-5 grid gap-3 sm:grid-cols-2;
245
- }
246
- .prose-site .card {
247
- @apply block rounded-lg border border-border p-4 transition-colors;
248
- }
249
- .prose-site .card-link {
250
- @apply hover:border-primary hover:bg-muted/50;
251
- }
252
- .prose-site .card-title {
253
- @apply mb-1 font-semibold;
254
- overflow-wrap: break-word;
255
- }
256
- /* 卡片图标(短文本 / emoji) */
257
- .prose-site .card-icon {
258
- @apply mr-1.5;
259
- }
260
- .prose-site .card-body {
261
- @apply text-sm text-muted-foreground;
262
- overflow-wrap: break-word;
263
- }
264
- .prose-site .card-body > :first-child {
265
- @apply mt-0;
266
- }
267
- .prose-site .card-body > :last-child {
268
- @apply mb-0;
269
- }
270
-
271
- /* ---------- Files 文件树(Files / Folder / File,原生 details 折叠) ---------- */
272
- .prose-site .files {
273
- @apply my-5 rounded-lg border border-border bg-muted/20 p-2 text-sm;
274
- }
275
- .prose-site .files-row {
276
- @apply flex items-center gap-2 rounded-md px-2 py-1 text-muted-foreground;
277
- }
278
- .prose-site .files-folder > summary {
279
- @apply cursor-pointer list-none transition-colors hover:bg-muted/60 hover:text-foreground;
280
- }
281
- .prose-site .files-folder > summary::-webkit-details-marker {
282
- display: none;
283
- }
284
- /* Tailwind 4 的 rotate-90 是独立属性,过渡需用 transition 而非 transition-transform */
285
- .prose-site .files-chevron {
286
- @apply inline-flex shrink-0 transition duration-200;
287
- }
288
- .prose-site .files-folder[open] > summary .files-chevron {
289
- @apply rotate-90;
290
- }
291
- /* 目录图标双形态:收起显示闭合、展开显示敞口;靠 details[open] 属性切换,无需 JS */
292
- .prose-site .files-folder > summary .files-shape-open {
293
- display: none;
294
- }
295
- .prose-site .files-folder[open] > summary .files-shape-closed {
296
- display: none;
297
- }
298
- .prose-site .files-folder[open] > summary .files-shape-open {
299
- display: inline;
300
- }
301
- /* 嵌套层级用左侧缩进线表示 */
302
- .prose-site .files-children {
303
- @apply ml-3 border-l border-border/70 pl-2;
304
- }
305
- .prose-site .files-icon {
306
- @apply size-4 shrink-0;
307
- }
308
- .prose-site .files-name {
309
- @apply truncate;
310
- }
311
- .prose-site .files-folder-name {
312
- @apply font-medium text-foreground;
313
- }
314
- .prose-site .files-count {
315
- @apply ml-auto text-[11px] tabular-nums text-muted-foreground;
316
- }
317
- .prose-site .files-file-row {
318
- @apply transition-colors hover:bg-muted/60 hover:text-foreground;
319
- }
320
- /* 文件行无箭头,补等宽占位使其与目录名对齐 */
321
- .prose-site .files-spacer {
322
- @apply inline-block w-[10px] shrink-0;
323
- }
324
-
325
- /* ---------- 编辑器(后台,不套 .prose-site) ---------- */
326
- .md-editor {
327
- @apply flex h-full min-h-0 flex-col rounded-lg border border-border bg-background;
328
- }
329
- .md-editor-toolbar {
330
- @apply flex flex-wrap items-center gap-1 border-b border-border px-2 py-1.5;
331
- }
332
- .md-editor-toolbar button {
333
- @apply rounded px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground;
334
- min-height: 28px;
335
- }
336
- .md-editor-toolbar button:disabled {
337
- @apply cursor-not-allowed opacity-40;
338
- }
339
- .md-editor-sep {
340
- @apply mx-1 h-4 w-px bg-border;
341
- }
342
- /* 工具栏右侧推到底:视图切换与全屏 */
343
- .md-editor-grow {
344
- @apply flex-1;
345
- }
346
- .md-editor-views {
347
- @apply flex items-center gap-0.5 rounded-md bg-muted p-0.5;
348
- }
349
- .md-editor-views button {
350
- @apply rounded px-2 py-0.5 text-xs text-muted-foreground transition-colors hover:text-foreground;
351
- min-height: 24px;
352
- }
353
- .md-editor-views button[data-active="true"] {
354
- @apply bg-background text-foreground shadow-sm;
355
- }
356
- .md-editor-body {
357
- @apply flex min-h-0 flex-1;
358
- }
359
- /* 编辑区容器:交给 CodeMirror 自己排版(内边距与字体在 THEME 里定义) */
360
- .md-editor-source {
361
- @apply min-h-0 flex-1 overflow-hidden;
362
- }
363
- /* relative:滚动同步用 el.offsetTop,必须以预览容器作为定位父级,否则 top 会偏到外层 */
364
- .md-editor-preview {
365
- @apply relative min-h-0 flex-1 overflow-y-auto border-l border-border p-4;
366
- }
367
- .md-editor-status {
368
- @apply flex items-center gap-3 border-t border-border px-3 py-1 text-xs text-muted-foreground;
369
- }
370
- .md-editor-status-warn {
371
- @apply text-amber-600 dark:text-amber-400;
372
- }
373
- }
1
+ /**
2
+ * @file 兼容入口(旧路径转发)
3
+ * @description 早期版本宿主以 `@import "@heikeson/md-engine/styles.css"` 引入,包内指向本文件。
4
+ * 样式现已按组件拆分到同目录并统一由 index.css 汇总,本文件仅做转发,保证旧路径继续可用。
5
+ * @created 2026-10-24 20:31
6
+ * @updated 2026-10-27 13:43 内容迁出,改为转发 index.css
7
+ */
8
+
9
+ @import "./index.css";
@@ -0,0 +1,108 @@
1
+ /**
2
+ * @file Files 文件树样式(Files / Folder / File)
3
+ * @description 原生 details 折叠,零 JS;目录图标双形态靠 details[open] 切换。颜色取 --lkes-* 令牌。
4
+ * @created 2026-10-27 13:43
5
+ * @updated 2026-10-27 13:49
6
+ */
7
+
8
+ @layer lkes.components {
9
+ .prose-site .files {
10
+ margin: 1.25rem 0;
11
+ padding: 0.5rem;
12
+ border: 1px solid var(--lkes-border, #e5e7eb);
13
+ border-radius: var(--lkes-radius, 0.5rem);
14
+ background-color: color-mix(in oklab, var(--lkes-fill, #f3f4f6) 20%, transparent);
15
+ font-size: 0.875rem;
16
+ }
17
+
18
+ .prose-site .files-row {
19
+ display: flex;
20
+ align-items: center;
21
+ gap: 0.5rem;
22
+ padding: 0.25rem 0.5rem;
23
+ border-radius: 0.375rem;
24
+ color: var(--lkes-muted, #6b7280);
25
+ }
26
+
27
+ .prose-site .files-folder > summary {
28
+ cursor: pointer;
29
+ list-style: none;
30
+ transition: background-color 150ms ease, color 150ms ease;
31
+ }
32
+
33
+ .prose-site .files-folder > summary:hover {
34
+ background-color: color-mix(in oklab, var(--lkes-fill, #f3f4f6) 60%, transparent);
35
+ color: var(--lkes-fg, #1f2937);
36
+ }
37
+
38
+ .prose-site .files-folder > summary::-webkit-details-marker {
39
+ display: none;
40
+ }
41
+
42
+ .prose-site .files-chevron {
43
+ display: inline-flex;
44
+ flex-shrink: 0;
45
+ transition: transform 200ms ease;
46
+ }
47
+
48
+ .prose-site .files-folder[open] > summary .files-chevron {
49
+ transform: rotate(90deg);
50
+ }
51
+
52
+ /* 目录图标双形态:收起闭合、展开敞口,纯 CSS 切换 */
53
+ .prose-site .files-folder > summary .files-shape-open {
54
+ display: none;
55
+ }
56
+ .prose-site .files-folder[open] > summary .files-shape-closed {
57
+ display: none;
58
+ }
59
+ .prose-site .files-folder[open] > summary .files-shape-open {
60
+ display: inline;
61
+ }
62
+
63
+ /* 嵌套层级用左侧缩进线表示 */
64
+ .prose-site .files-children {
65
+ margin-left: 0.75rem;
66
+ padding-left: 0.5rem;
67
+ border-left: 1px solid color-mix(in oklab, var(--lkes-border, #e5e7eb) 70%, transparent);
68
+ }
69
+
70
+ .prose-site .files-icon {
71
+ width: 1rem;
72
+ height: 1rem;
73
+ flex-shrink: 0;
74
+ }
75
+
76
+ .prose-site .files-name {
77
+ overflow: hidden;
78
+ text-overflow: ellipsis;
79
+ white-space: nowrap;
80
+ }
81
+
82
+ .prose-site .files-folder-name {
83
+ font-weight: 500;
84
+ color: var(--lkes-fg, #1f2937);
85
+ }
86
+
87
+ .prose-site .files-count {
88
+ margin-left: auto;
89
+ font-size: 11px;
90
+ font-variant-numeric: tabular-nums;
91
+ color: var(--lkes-muted, #6b7280);
92
+ }
93
+
94
+ .prose-site .files-file-row {
95
+ transition: background-color 150ms ease, color 150ms ease;
96
+ }
97
+ .prose-site .files-file-row:hover {
98
+ background-color: color-mix(in oklab, var(--lkes-fill, #f3f4f6) 60%, transparent);
99
+ color: var(--lkes-fg, #1f2937);
100
+ }
101
+
102
+ /* 文件行无箭头,补等宽占位使其与目录名对齐 */
103
+ .prose-site .files-spacer {
104
+ display: inline-block;
105
+ width: 10px;
106
+ flex-shrink: 0;
107
+ }
108
+ }