@scribdown/ui-handdrawn 0.3.1 → 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 +1 -1
- package/src/styles/mermaid.css +72 -96
package/package.json
CHANGED
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;
|
|
@@ -74,22 +75,22 @@
|
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
/* 全屏按钮沿用工具按钮尺寸,图标跟随 currentColor。 */
|
|
77
|
-
.scribdown-markdown .scribdown-mermaid__fullscreen {
|
|
78
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__fullscreen {
|
|
78
79
|
opacity: 0.82;
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
.scribdown-markdown .scribdown-mermaid__fullscreen svg {
|
|
82
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__fullscreen svg {
|
|
82
83
|
display: block;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
.scribdown-markdown .scribdown-mermaid__canvas {
|
|
86
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__canvas {
|
|
86
87
|
display: block;
|
|
87
88
|
flex: 0 0 auto;
|
|
88
89
|
user-select: text;
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
/* SVG 尺寸由运行时 canvas 统一控制,选择模式下保留文本选择能力。 */
|
|
92
|
-
.scribdown-markdown .scribdown-mermaid__canvas svg {
|
|
93
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__canvas svg {
|
|
93
94
|
display: block;
|
|
94
95
|
width: 100%;
|
|
95
96
|
height: 100%;
|
|
@@ -97,22 +98,36 @@
|
|
|
97
98
|
max-height: none;
|
|
98
99
|
}
|
|
99
100
|
|
|
100
|
-
.scribdown-markdown .scribdown-mermaid
|
|
101
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer)
|
|
102
|
+
.scribdown-mermaid--drag-mode
|
|
103
|
+
.scribdown-mermaid__body {
|
|
101
104
|
cursor: grab;
|
|
102
105
|
touch-action: none;
|
|
103
106
|
user-select: none;
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
.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 {
|
|
107
118
|
cursor: grabbing;
|
|
108
119
|
}
|
|
109
120
|
|
|
110
|
-
.scribdown-markdown .scribdown-mermaid
|
|
121
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer)
|
|
122
|
+
.scribdown-mermaid--dragging
|
|
123
|
+
.scribdown-mermaid__canvas {
|
|
111
124
|
pointer-events: none;
|
|
112
125
|
}
|
|
113
126
|
|
|
114
127
|
/* Loading 态:画布尚未填充 SVG 时的占位脉冲。 */
|
|
115
|
-
.scribdown-markdown .scribdown-mermaid
|
|
128
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer)
|
|
129
|
+
.scribdown-mermaid--loading
|
|
130
|
+
.scribdown-mermaid__canvas {
|
|
116
131
|
width: 100%;
|
|
117
132
|
min-height: 180px;
|
|
118
133
|
border-radius: 6px;
|
|
@@ -137,13 +152,15 @@
|
|
|
137
152
|
}
|
|
138
153
|
|
|
139
154
|
/* 失败态:替换 canvas 为错误说明 + 源码块。 */
|
|
140
|
-
.scribdown-markdown .scribdown-mermaid
|
|
155
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer)
|
|
156
|
+
.scribdown-mermaid--failed
|
|
157
|
+
.scribdown-mermaid__body {
|
|
141
158
|
background:
|
|
142
159
|
radial-gradient(circle at 18px 20px, var(--scribdown-paper-grain) 0 1px, transparent 1.6px),
|
|
143
160
|
color-mix(in srgb, var(--scribdown-color-surface) 88%, transparent);
|
|
144
161
|
}
|
|
145
162
|
|
|
146
|
-
.scribdown-markdown .scribdown-mermaid__fallback {
|
|
163
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__fallback {
|
|
147
164
|
display: flex;
|
|
148
165
|
flex-direction: column;
|
|
149
166
|
align-items: center;
|
|
@@ -154,7 +171,7 @@
|
|
|
154
171
|
}
|
|
155
172
|
|
|
156
173
|
/* 失败态图标:手绘风方框 + 中心叉号。 */
|
|
157
|
-
.scribdown-markdown .scribdown-mermaid__fallback-icon {
|
|
174
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__fallback-icon {
|
|
158
175
|
position: relative;
|
|
159
176
|
display: block;
|
|
160
177
|
box-sizing: border-box;
|
|
@@ -169,8 +186,8 @@
|
|
|
169
186
|
transform: rotate(-2deg);
|
|
170
187
|
}
|
|
171
188
|
|
|
172
|
-
.scribdown-markdown .scribdown-mermaid__fallback-icon::before,
|
|
173
|
-
.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 {
|
|
174
191
|
content: "";
|
|
175
192
|
position: absolute;
|
|
176
193
|
left: 50%;
|
|
@@ -181,15 +198,15 @@
|
|
|
181
198
|
transform-origin: center;
|
|
182
199
|
}
|
|
183
200
|
|
|
184
|
-
.scribdown-markdown .scribdown-mermaid__fallback-icon::before {
|
|
201
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__fallback-icon::before {
|
|
185
202
|
transform: translate(-50%, -50%) rotate(45deg);
|
|
186
203
|
}
|
|
187
204
|
|
|
188
|
-
.scribdown-markdown .scribdown-mermaid__fallback-icon::after {
|
|
205
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__fallback-icon::after {
|
|
189
206
|
transform: translate(-50%, -50%) rotate(-45deg);
|
|
190
207
|
}
|
|
191
208
|
|
|
192
|
-
.scribdown-markdown .scribdown-mermaid__fallback-text {
|
|
209
|
+
:is(.scribdown-markdown, .scribdown-mermaid-viewer) .scribdown-mermaid__fallback-text {
|
|
193
210
|
margin: 0;
|
|
194
211
|
font-family: var(--scribdown-font-heading);
|
|
195
212
|
font-size: 18px;
|
|
@@ -197,8 +214,8 @@
|
|
|
197
214
|
line-height: 1.3;
|
|
198
215
|
}
|
|
199
216
|
|
|
200
|
-
.scribdown-markdown pre.scribdown-mermaid__fallback-source,
|
|
201
|
-
.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 {
|
|
202
219
|
width: 100%;
|
|
203
220
|
max-width: 100%;
|
|
204
221
|
margin: 0;
|
|
@@ -249,8 +266,7 @@
|
|
|
249
266
|
}
|
|
250
267
|
|
|
251
268
|
.scribdown-mermaid-viewer[open] {
|
|
252
|
-
display:
|
|
253
|
-
grid-template-rows: auto minmax(0, 1fr);
|
|
269
|
+
display: block;
|
|
254
270
|
}
|
|
255
271
|
|
|
256
272
|
.scribdown-mermaid-viewer::backdrop {
|
|
@@ -258,99 +274,59 @@
|
|
|
258
274
|
backdrop-filter: blur(2px);
|
|
259
275
|
}
|
|
260
276
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
z-index: 2;
|
|
277
|
+
/* 同一图表组件的全屏布局:只覆盖容器尺寸和视觉,不定义另一套交互状态。 */
|
|
278
|
+
.scribdown-mermaid-viewer > .scribdown-mermaid {
|
|
264
279
|
display: grid;
|
|
265
|
-
grid-template-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
background:
|
|
270
|
-
radial-gradient(circle at 18px 16px, var(--scribdown-paper-grain) 0 1px, transparent 1.6px),
|
|
271
|
-
color-mix(in srgb, var(--scribdown-color-surface) 94%, transparent);
|
|
272
|
-
background-size:
|
|
273
|
-
32px 29px,
|
|
274
|
-
auto;
|
|
275
|
-
box-shadow: 0 4px 0 color-mix(in srgb, var(--scribdown-color-text-primary) 14%, transparent);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
.scribdown-mermaid-viewer__caption {
|
|
279
|
-
min-width: 0;
|
|
280
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
281
|
+
width: 100%;
|
|
282
|
+
height: 100%;
|
|
283
|
+
max-width: none;
|
|
280
284
|
margin: 0;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
line-height: 1.25;
|
|
287
|
-
text-overflow: ellipsis;
|
|
288
|
-
white-space: nowrap;
|
|
285
|
+
border: 0;
|
|
286
|
+
border-radius: 0;
|
|
287
|
+
box-shadow: none;
|
|
288
|
+
transform: none;
|
|
289
|
+
background: transparent;
|
|
289
290
|
}
|
|
290
291
|
|
|
291
|
-
.scribdown-mermaid-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
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);
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
-
.scribdown-mermaid-
|
|
298
|
-
|
|
299
|
-
in srgb,
|
|
300
|
-
var(--scribdown-color-surface) 82%,
|
|
301
|
-
var(--scribdown-color-danger) 18%
|
|
302
|
-
);
|
|
297
|
+
.scribdown-mermaid-viewer .scribdown-mermaid__label {
|
|
298
|
+
font-size: 22px;
|
|
303
299
|
}
|
|
304
300
|
|
|
305
|
-
.scribdown-mermaid-
|
|
306
|
-
|
|
301
|
+
.scribdown-mermaid-viewer .scribdown-mermaid__body {
|
|
302
|
+
height: auto;
|
|
307
303
|
min-height: 0;
|
|
308
|
-
display: flex;
|
|
309
|
-
align-items: safe center;
|
|
310
|
-
justify-content: safe center;
|
|
311
304
|
padding: var(--scribdown-space-5);
|
|
312
|
-
|
|
305
|
+
background: transparent;
|
|
313
306
|
overscroll-behavior: contain;
|
|
314
|
-
scrollbar-gutter: stable both-edges;
|
|
315
|
-
touch-action: auto;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
.scribdown-mermaid-viewer--drag-mode .scribdown-mermaid-viewer__viewport {
|
|
319
|
-
cursor: grab;
|
|
320
|
-
touch-action: none;
|
|
321
|
-
user-select: none;
|
|
322
307
|
}
|
|
323
308
|
|
|
324
|
-
.scribdown-mermaid-viewer
|
|
325
|
-
.scribdown-mermaid-viewer__viewport {
|
|
326
|
-
cursor: grabbing;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
.scribdown-mermaid-viewer__canvas {
|
|
330
|
-
flex: 0 0 auto;
|
|
331
|
-
display: block;
|
|
309
|
+
.scribdown-mermaid-viewer .scribdown-mermaid__canvas {
|
|
332
310
|
background: var(--scribdown-color-surface);
|
|
333
311
|
border-radius: 6px 7px 5px 6px;
|
|
334
312
|
box-shadow: 6px 8px 0 color-mix(in srgb, var(--scribdown-color-text-primary) 26%, transparent);
|
|
335
|
-
user-select: text;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
.scribdown-mermaid-viewer--drag-mode .scribdown-mermaid-viewer__canvas {
|
|
339
|
-
user-select: none;
|
|
340
313
|
}
|
|
341
314
|
|
|
342
|
-
.scribdown-mermaid-
|
|
343
|
-
|
|
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
|
+
);
|
|
344
321
|
}
|
|
345
322
|
|
|
346
323
|
@media (max-width: 640px) {
|
|
347
|
-
.scribdown-mermaid-
|
|
348
|
-
|
|
349
|
-
gap: var(--scribdown-space-2);
|
|
324
|
+
.scribdown-mermaid-viewer .scribdown-mermaid__chrome {
|
|
325
|
+
flex-wrap: wrap;
|
|
350
326
|
padding: var(--scribdown-space-3);
|
|
351
327
|
}
|
|
352
328
|
|
|
353
|
-
.scribdown-mermaid-
|
|
329
|
+
.scribdown-mermaid-viewer .scribdown-mermaid__controls {
|
|
354
330
|
justify-content: space-between;
|
|
355
331
|
width: 100%;
|
|
356
332
|
}
|
|
@@ -359,7 +335,7 @@
|
|
|
359
335
|
--scribdown-viewer-control-size: 34px;
|
|
360
336
|
}
|
|
361
337
|
|
|
362
|
-
.scribdown-mermaid-
|
|
338
|
+
.scribdown-mermaid-viewer .scribdown-mermaid__body {
|
|
363
339
|
padding: var(--scribdown-space-3);
|
|
364
340
|
}
|
|
365
341
|
}
|