@scribdown/ui-handdrawn 0.3.0 → 0.3.2
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/package.json +5 -1
- package/src/styles/fonts.css +3 -0
- package/src/styles/lists.css +1 -2
- package/src/styles/mermaid.css +74 -97
- package/src/styles/tokens.css +3 -2
- package/src/styles.css +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scribdown/ui-handdrawn",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Scribdown 手绘风格视觉组件:设计 Token、样式与 SVG 资产。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
"typescript": "^5.8.3",
|
|
28
28
|
"vitest": "^3.2.4"
|
|
29
29
|
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@fontsource-variable/noto-serif-sc": "5.3.0",
|
|
32
|
+
"lxgw-wenkai-screen-webfont": "1.7.0"
|
|
33
|
+
},
|
|
30
34
|
"scripts": {
|
|
31
35
|
"test": "vitest run --passWithNoTests",
|
|
32
36
|
"lint": "eslint .",
|
package/src/styles/lists.css
CHANGED
|
@@ -39,8 +39,7 @@
|
|
|
39
39
|
left: 0;
|
|
40
40
|
min-width: 26px;
|
|
41
41
|
color: var(--scribdown-color-warning);
|
|
42
|
-
font-family:
|
|
43
|
-
var(--scribdown-font-heading);
|
|
42
|
+
font-family: var(--scribdown-font-heading);
|
|
44
43
|
font-size: 22px;
|
|
45
44
|
font-style: normal;
|
|
46
45
|
font-weight: 700;
|
package/src/styles/mermaid.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* MermaidBlock:复用代码块的手绘外框,承载 SVG 图表 + 失败态。 */
|
|
2
|
-
.scribdown-markdown .scribdown-mermaid {
|
|
2
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid {
|
|
3
3
|
position: relative;
|
|
4
4
|
margin: 32px auto 36px;
|
|
5
5
|
padding: 0;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/* 顶部 chrome:仅放置 Mermaid 类型标签,对齐代码块视觉语言。 */
|
|
17
|
-
.scribdown-markdown .scribdown-mermaid__chrome {
|
|
17
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__chrome {
|
|
18
18
|
display: flex;
|
|
19
19
|
align-items: center;
|
|
20
20
|
justify-content: space-between;
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
border-bottom: 1px dashed color-mix(in srgb, var(--scribdown-color-border) 60%, transparent);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.scribdown-markdown .scribdown-mermaid__label {
|
|
31
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__label {
|
|
32
32
|
font-family: var(--scribdown-font-heading);
|
|
33
33
|
font-size: 13px;
|
|
34
34
|
font-weight: 700;
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
text-transform: uppercase;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
.scribdown-markdown .scribdown-mermaid__controls {
|
|
40
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__controls {
|
|
41
41
|
display: inline-flex;
|
|
42
42
|
align-items: center;
|
|
43
43
|
justify-content: flex-end;
|
|
@@ -47,11 +47,12 @@
|
|
|
47
47
|
scrollbar-width: none;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.scribdown-markdown .scribdown-
|
|
50
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer)
|
|
51
|
+
.scribdown-mermaid__controls::-webkit-scrollbar {
|
|
51
52
|
display: none;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
.scribdown-markdown .scribdown-mermaid__body {
|
|
55
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__body {
|
|
55
56
|
position: relative;
|
|
56
57
|
display: flex;
|
|
57
58
|
align-items: safe center;
|
|
@@ -68,27 +69,28 @@
|
|
|
68
69
|
32px 29px,
|
|
69
70
|
auto;
|
|
70
71
|
overflow: auto;
|
|
71
|
-
|
|
72
|
+
/* 图表无可滚动空间或已经到达边界时,继续把滚轮交给外层正文滚动容器。 */
|
|
73
|
+
overscroll-behavior: auto;
|
|
72
74
|
scrollbar-gutter: stable both-edges;
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
/* 全屏按钮沿用工具按钮尺寸,图标跟随 currentColor。 */
|
|
76
|
-
.scribdown-markdown .scribdown-mermaid__fullscreen {
|
|
78
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__fullscreen {
|
|
77
79
|
opacity: 0.82;
|
|
78
80
|
}
|
|
79
81
|
|
|
80
|
-
.scribdown-markdown .scribdown-mermaid__fullscreen svg {
|
|
82
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__fullscreen svg {
|
|
81
83
|
display: block;
|
|
82
84
|
}
|
|
83
85
|
|
|
84
|
-
.scribdown-markdown .scribdown-mermaid__canvas {
|
|
86
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__canvas {
|
|
85
87
|
display: block;
|
|
86
88
|
flex: 0 0 auto;
|
|
87
89
|
user-select: text;
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
/* SVG 尺寸由运行时 canvas 统一控制,选择模式下保留文本选择能力。 */
|
|
91
|
-
.scribdown-markdown .scribdown-mermaid__canvas svg {
|
|
93
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__canvas svg {
|
|
92
94
|
display: block;
|
|
93
95
|
width: 100%;
|
|
94
96
|
height: 100%;
|
|
@@ -96,22 +98,36 @@
|
|
|
96
98
|
max-height: none;
|
|
97
99
|
}
|
|
98
100
|
|
|
99
|
-
.scribdown-markdown .scribdown-mermaid
|
|
101
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer)
|
|
102
|
+
.scribdown-mermaid--drag-mode
|
|
103
|
+
.scribdown-mermaid__body {
|
|
100
104
|
cursor: grab;
|
|
101
105
|
touch-action: none;
|
|
102
106
|
user-select: none;
|
|
103
107
|
}
|
|
104
108
|
|
|
105
|
-
.scribdown-markdown .scribdown-mermaid
|
|
109
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer)
|
|
110
|
+
.scribdown-mermaid--drag-mode
|
|
111
|
+
.scribdown-mermaid__canvas {
|
|
112
|
+
user-select: none;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer)
|
|
116
|
+
.scribdown-mermaid--dragging
|
|
117
|
+
.scribdown-mermaid__body {
|
|
106
118
|
cursor: grabbing;
|
|
107
119
|
}
|
|
108
120
|
|
|
109
|
-
.scribdown-markdown .scribdown-mermaid
|
|
121
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer)
|
|
122
|
+
.scribdown-mermaid--dragging
|
|
123
|
+
.scribdown-mermaid__canvas {
|
|
110
124
|
pointer-events: none;
|
|
111
125
|
}
|
|
112
126
|
|
|
113
127
|
/* Loading 态:画布尚未填充 SVG 时的占位脉冲。 */
|
|
114
|
-
.scribdown-markdown .scribdown-mermaid
|
|
128
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer)
|
|
129
|
+
.scribdown-mermaid--loading
|
|
130
|
+
.scribdown-mermaid__canvas {
|
|
115
131
|
width: 100%;
|
|
116
132
|
min-height: 180px;
|
|
117
133
|
border-radius: 6px;
|
|
@@ -136,13 +152,15 @@
|
|
|
136
152
|
}
|
|
137
153
|
|
|
138
154
|
/* 失败态:替换 canvas 为错误说明 + 源码块。 */
|
|
139
|
-
.scribdown-markdown .scribdown-mermaid
|
|
155
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer)
|
|
156
|
+
.scribdown-mermaid--failed
|
|
157
|
+
.scribdown-mermaid__body {
|
|
140
158
|
background:
|
|
141
159
|
radial-gradient(circle at 18px 20px, var(--scribdown-paper-grain) 0 1px, transparent 1.6px),
|
|
142
160
|
color-mix(in srgb, var(--scribdown-color-surface) 88%, transparent);
|
|
143
161
|
}
|
|
144
162
|
|
|
145
|
-
.scribdown-markdown .scribdown-mermaid__fallback {
|
|
163
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__fallback {
|
|
146
164
|
display: flex;
|
|
147
165
|
flex-direction: column;
|
|
148
166
|
align-items: center;
|
|
@@ -153,7 +171,7 @@
|
|
|
153
171
|
}
|
|
154
172
|
|
|
155
173
|
/* 失败态图标:手绘风方框 + 中心叉号。 */
|
|
156
|
-
.scribdown-markdown .scribdown-mermaid__fallback-icon {
|
|
174
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__fallback-icon {
|
|
157
175
|
position: relative;
|
|
158
176
|
display: block;
|
|
159
177
|
box-sizing: border-box;
|
|
@@ -168,8 +186,8 @@
|
|
|
168
186
|
transform: rotate(-2deg);
|
|
169
187
|
}
|
|
170
188
|
|
|
171
|
-
.scribdown-markdown .scribdown-mermaid__fallback-icon::before,
|
|
172
|
-
.scribdown-markdown .scribdown-mermaid__fallback-icon::after {
|
|
189
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__fallback-icon::before,
|
|
190
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__fallback-icon::after {
|
|
173
191
|
content: "";
|
|
174
192
|
position: absolute;
|
|
175
193
|
left: 50%;
|
|
@@ -180,15 +198,15 @@
|
|
|
180
198
|
transform-origin: center;
|
|
181
199
|
}
|
|
182
200
|
|
|
183
|
-
.scribdown-markdown .scribdown-mermaid__fallback-icon::before {
|
|
201
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__fallback-icon::before {
|
|
184
202
|
transform: translate(-50%, -50%) rotate(45deg);
|
|
185
203
|
}
|
|
186
204
|
|
|
187
|
-
.scribdown-markdown .scribdown-mermaid__fallback-icon::after {
|
|
205
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__fallback-icon::after {
|
|
188
206
|
transform: translate(-50%, -50%) rotate(-45deg);
|
|
189
207
|
}
|
|
190
208
|
|
|
191
|
-
.scribdown-markdown .scribdown-mermaid__fallback-text {
|
|
209
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__fallback-text {
|
|
192
210
|
margin: 0;
|
|
193
211
|
font-family: var(--scribdown-font-heading);
|
|
194
212
|
font-size: 18px;
|
|
@@ -196,8 +214,8 @@
|
|
|
196
214
|
line-height: 1.3;
|
|
197
215
|
}
|
|
198
216
|
|
|
199
|
-
.scribdown-markdown pre.scribdown-mermaid__fallback-source,
|
|
200
|
-
.scribdown-markdown p.scribdown-mermaid__fallback-source {
|
|
217
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) pre.scribdown-mermaid__fallback-source,
|
|
218
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) p.scribdown-mermaid__fallback-source {
|
|
201
219
|
width: 100%;
|
|
202
220
|
max-width: 100%;
|
|
203
221
|
margin: 0;
|
|
@@ -248,8 +266,7 @@
|
|
|
248
266
|
}
|
|
249
267
|
|
|
250
268
|
.scribdown-mermaid-viewer[open] {
|
|
251
|
-
display:
|
|
252
|
-
grid-template-rows: auto minmax(0, 1fr);
|
|
269
|
+
display: block;
|
|
253
270
|
}
|
|
254
271
|
|
|
255
272
|
.scribdown-mermaid-viewer::backdrop {
|
|
@@ -257,99 +274,59 @@
|
|
|
257
274
|
backdrop-filter: blur(2px);
|
|
258
275
|
}
|
|
259
276
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
z-index: 2;
|
|
277
|
+
/* 同一图表组件的全屏布局:只覆盖容器尺寸和视觉,不定义另一套交互状态。 */
|
|
278
|
+
.scribdown-mermaid-viewer > .scribdown-mermaid {
|
|
263
279
|
display: grid;
|
|
264
|
-
grid-template-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
background:
|
|
269
|
-
radial-gradient(circle at 18px 16px, var(--scribdown-paper-grain) 0 1px, transparent 1.6px),
|
|
270
|
-
color-mix(in srgb, var(--scribdown-color-surface) 94%, transparent);
|
|
271
|
-
background-size:
|
|
272
|
-
32px 29px,
|
|
273
|
-
auto;
|
|
274
|
-
box-shadow: 0 4px 0 color-mix(in srgb, var(--scribdown-color-text-primary) 14%, transparent);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
.scribdown-mermaid-viewer__caption {
|
|
278
|
-
min-width: 0;
|
|
280
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
281
|
+
width: 100%;
|
|
282
|
+
height: 100%;
|
|
283
|
+
max-width: none;
|
|
279
284
|
margin: 0;
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
line-height: 1.25;
|
|
286
|
-
text-overflow: ellipsis;
|
|
287
|
-
white-space: nowrap;
|
|
285
|
+
border: 0;
|
|
286
|
+
border-radius: 0;
|
|
287
|
+
box-shadow: none;
|
|
288
|
+
transform: none;
|
|
289
|
+
background: transparent;
|
|
288
290
|
}
|
|
289
291
|
|
|
290
|
-
.scribdown-mermaid-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
gap: var(--scribdown-space-2);
|
|
292
|
+
.scribdown-mermaid-viewer .scribdown-mermaid__chrome {
|
|
293
|
+
padding: var(--scribdown-space-3) var(--scribdown-space-4);
|
|
294
|
+
background: var(--scribdown-color-surface);
|
|
294
295
|
}
|
|
295
296
|
|
|
296
|
-
.scribdown-mermaid-
|
|
297
|
-
|
|
298
|
-
in srgb,
|
|
299
|
-
var(--scribdown-color-surface) 82%,
|
|
300
|
-
var(--scribdown-color-danger) 18%
|
|
301
|
-
);
|
|
297
|
+
.scribdown-mermaid-viewer .scribdown-mermaid__label {
|
|
298
|
+
font-size: 22px;
|
|
302
299
|
}
|
|
303
300
|
|
|
304
|
-
.scribdown-mermaid-
|
|
305
|
-
|
|
301
|
+
.scribdown-mermaid-viewer .scribdown-mermaid__body {
|
|
302
|
+
height: auto;
|
|
306
303
|
min-height: 0;
|
|
307
|
-
display: flex;
|
|
308
|
-
align-items: safe center;
|
|
309
|
-
justify-content: safe center;
|
|
310
304
|
padding: var(--scribdown-space-5);
|
|
311
|
-
|
|
305
|
+
background: transparent;
|
|
312
306
|
overscroll-behavior: contain;
|
|
313
|
-
scrollbar-gutter: stable both-edges;
|
|
314
|
-
touch-action: auto;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
.scribdown-mermaid-viewer--drag-mode .scribdown-mermaid-viewer__viewport {
|
|
318
|
-
cursor: grab;
|
|
319
|
-
touch-action: none;
|
|
320
|
-
user-select: none;
|
|
321
307
|
}
|
|
322
308
|
|
|
323
|
-
.scribdown-mermaid-viewer
|
|
324
|
-
.scribdown-mermaid-viewer__viewport {
|
|
325
|
-
cursor: grabbing;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
.scribdown-mermaid-viewer__canvas {
|
|
329
|
-
flex: 0 0 auto;
|
|
330
|
-
display: block;
|
|
309
|
+
.scribdown-mermaid-viewer .scribdown-mermaid__canvas {
|
|
331
310
|
background: var(--scribdown-color-surface);
|
|
332
311
|
border-radius: 6px 7px 5px 6px;
|
|
333
312
|
box-shadow: 6px 8px 0 color-mix(in srgb, var(--scribdown-color-text-primary) 26%, transparent);
|
|
334
|
-
user-select: text;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
.scribdown-mermaid-viewer--drag-mode .scribdown-mermaid-viewer__canvas {
|
|
338
|
-
user-select: none;
|
|
339
313
|
}
|
|
340
314
|
|
|
341
|
-
.scribdown-mermaid-
|
|
342
|
-
|
|
315
|
+
.scribdown-mermaid-viewer__button--close {
|
|
316
|
+
background: color-mix(
|
|
317
|
+
in srgb,
|
|
318
|
+
var(--scribdown-color-surface) 82%,
|
|
319
|
+
var(--scribdown-color-danger) 18%
|
|
320
|
+
);
|
|
343
321
|
}
|
|
344
322
|
|
|
345
323
|
@media (max-width: 640px) {
|
|
346
|
-
.scribdown-mermaid-
|
|
347
|
-
|
|
348
|
-
gap: var(--scribdown-space-2);
|
|
324
|
+
.scribdown-mermaid-viewer .scribdown-mermaid__chrome {
|
|
325
|
+
flex-wrap: wrap;
|
|
349
326
|
padding: var(--scribdown-space-3);
|
|
350
327
|
}
|
|
351
328
|
|
|
352
|
-
.scribdown-mermaid-
|
|
329
|
+
.scribdown-mermaid-viewer .scribdown-mermaid__controls {
|
|
353
330
|
justify-content: space-between;
|
|
354
331
|
width: 100%;
|
|
355
332
|
}
|
|
@@ -358,7 +335,7 @@
|
|
|
358
335
|
--scribdown-viewer-control-size: 34px;
|
|
359
336
|
}
|
|
360
337
|
|
|
361
|
-
.scribdown-mermaid-
|
|
338
|
+
.scribdown-mermaid-viewer .scribdown-mermaid__body {
|
|
362
339
|
padding: var(--scribdown-space-3);
|
|
363
340
|
}
|
|
364
341
|
}
|
package/src/styles/tokens.css
CHANGED
|
@@ -120,8 +120,9 @@
|
|
|
120
120
|
|
|
121
121
|
/* ─── 与主题无关的 Token ──────────────────────────────────────────── */
|
|
122
122
|
:root {
|
|
123
|
-
|
|
124
|
-
--scribdown-font-
|
|
123
|
+
/* 字体由 styles.css 本地加载;同一字体覆盖中英文,避免逐字符回退造成视觉基线错位。 */
|
|
124
|
+
--scribdown-font-body: "Noto Serif SC Variable", "Songti SC", serif;
|
|
125
|
+
--scribdown-font-heading: "LXGW WenKai Screen", "Kaiti SC", serif;
|
|
125
126
|
--scribdown-font-code: "JetBrains Mono", "Fira Code", monospace;
|
|
126
127
|
|
|
127
128
|
/* 四角独立写法,呼应手绘感 */
|