svelte-readme 4.1.0 → 4.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/README.md +30 -0
- package/dist/highlight/shared.d.ts +1 -0
- package/dist/index.js +111 -35
- package/dist/layout.css +79 -6
- package/dist/shared.css +21 -0
- package/dist/style.css +235 -86
- package/dist/svelte.css +14 -0
- package/dist/typescript.css +13 -0
- package/dist/utils/purgeCss.d.ts +1 -1
- package/dist/yaml.css +4 -0
- package/package.json +1 -1
package/dist/layout.css
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
.code-fence {
|
|
2
|
-
padding: 1.5rem
|
|
2
|
+
padding: 1.5rem var(--sr-box-padding);
|
|
3
|
+
margin-right: calc(var(--sr-box-padding) * -1);
|
|
4
|
+
margin-left: calc(var(--sr-box-padding) * -1);
|
|
3
5
|
border: 1px solid var(--sr-color-border-muted);
|
|
4
6
|
border-bottom: 0;
|
|
5
7
|
overflow-x: auto;
|
|
@@ -8,7 +10,7 @@
|
|
|
8
10
|
.sr-layout {
|
|
9
11
|
display: grid;
|
|
10
12
|
grid-template-columns: 11.25rem minmax(0, 60rem) 11.25rem;
|
|
11
|
-
column-gap:
|
|
13
|
+
column-gap: 3.125rem;
|
|
12
14
|
max-width: 87.5rem;
|
|
13
15
|
margin: 0 auto;
|
|
14
16
|
padding: 2.8125rem;
|
|
@@ -25,7 +27,7 @@ main.markdown-body {
|
|
|
25
27
|
(mobile) — only one of the two is ever visible at a given viewport width. */
|
|
26
28
|
.sr-toc {
|
|
27
29
|
font-family: var(--sr-font-sans);
|
|
28
|
-
font-size:
|
|
30
|
+
font-size: var(--sr-text-xs);
|
|
29
31
|
color: var(--sr-color-fg-muted);
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -53,11 +55,48 @@ main.markdown-body {
|
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
.sr-toc a.sr-toc-active {
|
|
56
|
-
color: var(--sr-color-
|
|
57
|
-
font-weight: 600;
|
|
58
|
+
color: var(--sr-color-link);
|
|
58
59
|
text-decoration: underline;
|
|
59
60
|
}
|
|
60
61
|
|
|
62
|
+
/* Rendered as the first child of both `.sr-toc` variants (sidebar and inline),
|
|
63
|
+
so it always sits directly above whichever TOC copy is visible at the current
|
|
64
|
+
viewport width. */
|
|
65
|
+
.sr-theme-toggle {
|
|
66
|
+
display: inline-flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
width: 1.75rem;
|
|
70
|
+
height: 1.75rem;
|
|
71
|
+
margin-bottom: 0.75rem;
|
|
72
|
+
padding: 0;
|
|
73
|
+
color: var(--sr-color-fg-muted);
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
appearance: none;
|
|
76
|
+
background-color: var(--sr-color-canvas);
|
|
77
|
+
border: 1px solid var(--sr-color-border);
|
|
78
|
+
border-radius: 0.375rem;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.sr-theme-toggle:hover {
|
|
82
|
+
color: var(--sr-color-fg);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Same specificity trick as `.sr-copy-icon`/`.sr-copy-check` in `style.css`: one
|
|
86
|
+
class each, so source order (not selector specificity) decides which icon shows
|
|
87
|
+
before `data-sr-theme` flips it. */
|
|
88
|
+
.sr-theme-icon-moon {
|
|
89
|
+
display: none;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
:root[data-sr-theme="dark"] .sr-theme-icon-sun {
|
|
93
|
+
display: none;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
:root[data-sr-theme="dark"] .sr-theme-icon-moon {
|
|
97
|
+
display: block;
|
|
98
|
+
}
|
|
99
|
+
|
|
61
100
|
.sr-toc-sidebar {
|
|
62
101
|
grid-column: 3;
|
|
63
102
|
min-width: 0;
|
|
@@ -66,7 +105,7 @@ main.markdown-body {
|
|
|
66
105
|
top: 0;
|
|
67
106
|
align-self: stretch;
|
|
68
107
|
max-height: 100vh;
|
|
69
|
-
padding:
|
|
108
|
+
padding: 1.5rem 0 2rem;
|
|
70
109
|
overflow-y: auto;
|
|
71
110
|
}
|
|
72
111
|
|
|
@@ -78,6 +117,10 @@ main.markdown-body p {
|
|
|
78
117
|
max-width: 52ch;
|
|
79
118
|
}
|
|
80
119
|
|
|
120
|
+
main.markdown-body blockquote p {
|
|
121
|
+
max-width: none;
|
|
122
|
+
}
|
|
123
|
+
|
|
81
124
|
/* Between the mobile breakpoint and the full desktop width, the fixed-width empty
|
|
82
125
|
spacer column wastes space and pushes content off-center for no reason — drop it
|
|
83
126
|
and let content use the freed-up width, keeping only the sticky TOC column.
|
|
@@ -99,6 +142,15 @@ main.markdown-body p {
|
|
|
99
142
|
}
|
|
100
143
|
|
|
101
144
|
@media (max-width: 900px) {
|
|
145
|
+
/* The desktop scale's upper steps (tuned for a wide text column) read as
|
|
146
|
+
oversized against a narrow mobile viewport — h1 in particular dwarfs the
|
|
147
|
+
content below it — so the top of the scale is compressed here. */
|
|
148
|
+
:root {
|
|
149
|
+
--sr-text-xl: 1.25rem;
|
|
150
|
+
--sr-text-2xl: 1.5rem;
|
|
151
|
+
--sr-text-3xl: 1.875rem;
|
|
152
|
+
}
|
|
153
|
+
|
|
102
154
|
.sr-layout {
|
|
103
155
|
grid-template-columns: 1fr;
|
|
104
156
|
padding: 0.9375rem;
|
|
@@ -116,4 +168,25 @@ main.markdown-body p {
|
|
|
116
168
|
display: block;
|
|
117
169
|
margin-bottom: var(--sr-spacing-lg);
|
|
118
170
|
}
|
|
171
|
+
|
|
172
|
+
/* The desktop bleed (negative margin equal to the box's own padding) assumes
|
|
173
|
+
room in the gutter outside the text column to bleed into. On mobile there's
|
|
174
|
+
no gutter — the layout padding above is already tight — so bleeding here would
|
|
175
|
+
just push these boxes past the viewport edge instead of aligning them. */
|
|
176
|
+
main.markdown-body table,
|
|
177
|
+
main.markdown-body pre,
|
|
178
|
+
main.markdown-body .sr-code-block,
|
|
179
|
+
main.markdown-body .code-fence,
|
|
180
|
+
main.markdown-body details {
|
|
181
|
+
margin-right: 0;
|
|
182
|
+
margin-left: 0;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* `table`'s desktop `width: fit-content` can still exceed the viewport here if a
|
|
186
|
+
cell's content can't wrap below some minimum width (e.g. a long unbroken
|
|
187
|
+
string) — cap it so the table's own horizontal scrollbar handles the overflow
|
|
188
|
+
instead of the page growing wider than the viewport. */
|
|
189
|
+
main.markdown-body table {
|
|
190
|
+
max-width: 100%;
|
|
191
|
+
}
|
|
119
192
|
}
|
package/dist/shared.css
CHANGED
|
@@ -22,3 +22,24 @@
|
|
|
22
22
|
.token.boolean {
|
|
23
23
|
color: #005cc5;
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
:root[data-sr-theme="dark"] .token.keyword,
|
|
27
|
+
:root[data-sr-theme="dark"] .token.operator {
|
|
28
|
+
color: #ff7b72;
|
|
29
|
+
}
|
|
30
|
+
:root[data-sr-theme="dark"] .token.punctuation {
|
|
31
|
+
color: #c9d1d9;
|
|
32
|
+
}
|
|
33
|
+
:root[data-sr-theme="dark"] .token.comment {
|
|
34
|
+
color: #8b949e;
|
|
35
|
+
}
|
|
36
|
+
:root[data-sr-theme="dark"] .token.function {
|
|
37
|
+
color: #d2a8ff;
|
|
38
|
+
}
|
|
39
|
+
:root[data-sr-theme="dark"] .token.string {
|
|
40
|
+
color: #a5d6ff;
|
|
41
|
+
}
|
|
42
|
+
:root[data-sr-theme="dark"] .token.number,
|
|
43
|
+
:root[data-sr-theme="dark"] .token.boolean {
|
|
44
|
+
color: #79c0ff;
|
|
45
|
+
}
|
package/dist/style.css
CHANGED
|
@@ -36,8 +36,63 @@
|
|
|
36
36
|
--sr-color-border-table: #d4d4d8;
|
|
37
37
|
--sr-color-hr: #e4e4e7;
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
/* Glossy top-edge highlight on the code-fence/copy button and `summary`'s bevel
|
|
40
|
+
(see `.code-fence button`/`summary` below) — a fixed white reads as a subtle sheen
|
|
41
|
+
on the light canvas but as a harsh glowing line once the surface behind it goes
|
|
42
|
+
dark, so it's a variable rather than a literal `rgba(255, 255, 255, 0.6)`. */
|
|
43
|
+
--sr-color-bevel-highlight: rgba(255, 255, 255, 0.6);
|
|
44
|
+
|
|
45
|
+
--sr-spacing: 1.5rem;
|
|
46
|
+
--sr-spacing-lg: 2.5rem;
|
|
47
|
+
--sr-spacing-xl: 4rem;
|
|
48
|
+
--sr-box-padding: 1rem;
|
|
49
|
+
|
|
50
|
+
--sr-text-2xs: 0.6875rem;
|
|
51
|
+
--sr-text-xs: 0.75rem;
|
|
52
|
+
--sr-text-sm: 0.8125rem;
|
|
53
|
+
--sr-text-base: 0.875rem;
|
|
54
|
+
--sr-text-lg: 1.125rem;
|
|
55
|
+
--sr-text-xl: 1.375rem;
|
|
56
|
+
--sr-text-2xl: 1.75rem;
|
|
57
|
+
--sr-text-3xl: 2.5rem;
|
|
58
|
+
|
|
59
|
+
/* Declared here (rather than on `body`) so `purgeUnusedCss` — which only checks
|
|
60
|
+
tags/classes/attrs actually present in the server-rendered markup — has no reason
|
|
61
|
+
to strip it: `:root` has no selector to verify and is always kept, while `body`
|
|
62
|
+
never literally appears in Svelte's SSR output (which renders only what's inside
|
|
63
|
+
it). `<html>`'s background still paints the full viewport per the CSS spec's
|
|
64
|
+
canvas-background propagation, same as if this were set on `body`. */
|
|
65
|
+
background-color: var(--sr-color-canvas);
|
|
66
|
+
|
|
67
|
+
/* Tells the browser which palette this page actually uses, so native chrome that
|
|
68
|
+
isn't styled by the rules below — form controls, the scrollbar, `<select>`
|
|
69
|
+
dropdowns — switches to match instead of rendering a light widget on a dark page. */
|
|
70
|
+
color-scheme: light;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Set on `<html>` before first paint by the inline script in the HTML template
|
|
74
|
+
(see `THEME_INIT_SCRIPT` in `svelteReadme.ts`), so this never flashes the light
|
|
75
|
+
palette before switching to dark. */
|
|
76
|
+
:root[data-sr-theme="dark"] {
|
|
77
|
+
--sr-color-fg: #e4e4e7;
|
|
78
|
+
--sr-color-fg-muted: #a1a1aa;
|
|
79
|
+
--sr-color-fg-subtle: #d4d4d8;
|
|
80
|
+
--sr-color-link: #a5b4fc;
|
|
81
|
+
|
|
82
|
+
--sr-color-canvas: #18181b;
|
|
83
|
+
--sr-color-canvas-subtle: #27272a;
|
|
84
|
+
--sr-color-kbd-bg: #26262b;
|
|
85
|
+
--sr-color-code-bg: rgba(255, 255, 255, 0.08);
|
|
86
|
+
|
|
87
|
+
--sr-color-border: #3f3f46;
|
|
88
|
+
--sr-color-border-muted: #313136;
|
|
89
|
+
--sr-color-border-kbd: #52525b;
|
|
90
|
+
--sr-color-border-table: #52525b;
|
|
91
|
+
--sr-color-hr: #3f3f46;
|
|
92
|
+
|
|
93
|
+
--sr-color-bevel-highlight: rgba(255, 255, 255, 0.06);
|
|
94
|
+
|
|
95
|
+
color-scheme: dark;
|
|
41
96
|
}
|
|
42
97
|
|
|
43
98
|
.anchor {
|
|
@@ -66,7 +121,7 @@ main {
|
|
|
66
121
|
line-height: 1.5;
|
|
67
122
|
color: var(--sr-color-fg);
|
|
68
123
|
font-family: var(--sr-font-sans);
|
|
69
|
-
font-size:
|
|
124
|
+
font-size: var(--sr-text-base);
|
|
70
125
|
word-wrap: break-word;
|
|
71
126
|
}
|
|
72
127
|
|
|
@@ -91,11 +146,6 @@ strong {
|
|
|
91
146
|
font-weight: bolder;
|
|
92
147
|
}
|
|
93
148
|
|
|
94
|
-
h1 {
|
|
95
|
-
font-size: 2em;
|
|
96
|
-
margin: 0.67em 0;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
149
|
img {
|
|
100
150
|
border-style: none;
|
|
101
151
|
}
|
|
@@ -186,7 +236,7 @@ details summary {
|
|
|
186
236
|
kbd {
|
|
187
237
|
display: inline-block;
|
|
188
238
|
padding: 0.1875rem 0.3125rem;
|
|
189
|
-
font:
|
|
239
|
+
font: var(--sr-text-2xs) var(--sr-font-mono);
|
|
190
240
|
line-height: 0.625rem;
|
|
191
241
|
color: var(--sr-color-fg-subtle);
|
|
192
242
|
vertical-align: middle;
|
|
@@ -196,55 +246,6 @@ kbd {
|
|
|
196
246
|
box-shadow: inset 0 -1px 0 var(--sr-color-border-kbd);
|
|
197
247
|
}
|
|
198
248
|
|
|
199
|
-
h1,
|
|
200
|
-
h2,
|
|
201
|
-
h3,
|
|
202
|
-
h4,
|
|
203
|
-
h5,
|
|
204
|
-
h6 {
|
|
205
|
-
margin-top: 0;
|
|
206
|
-
margin-bottom: 0;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
h1 {
|
|
210
|
-
font-size: 2rem;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
h1,
|
|
214
|
-
h2 {
|
|
215
|
-
font-weight: 600;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
h2 {
|
|
219
|
-
font-size: 1.5rem;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
h3 {
|
|
223
|
-
font-size: 1.25rem;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
h3,
|
|
227
|
-
h4 {
|
|
228
|
-
font-weight: 600;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
h4 {
|
|
232
|
-
font-size: 1rem;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
h5 {
|
|
236
|
-
font-size: 0.875rem;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
h5,
|
|
240
|
-
h6 {
|
|
241
|
-
font-weight: 600;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
h6 {
|
|
245
|
-
font-size: 0.75rem;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
249
|
p {
|
|
249
250
|
margin-top: 0;
|
|
250
251
|
margin-bottom: 0.625rem;
|
|
@@ -280,7 +281,6 @@ dd {
|
|
|
280
281
|
code,
|
|
281
282
|
pre {
|
|
282
283
|
font-family: var(--sr-font-mono);
|
|
283
|
-
font-size: 0.75rem;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
pre {
|
|
@@ -377,33 +377,28 @@ h6 {
|
|
|
377
377
|
}
|
|
378
378
|
|
|
379
379
|
h1 {
|
|
380
|
-
font-size:
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
h1,
|
|
384
|
-
h2 {
|
|
385
|
-
padding-bottom: 0.3em;
|
|
386
|
-
border-bottom: 1px solid var(--sr-color-border-muted);
|
|
380
|
+
font-size: var(--sr-text-3xl);
|
|
387
381
|
}
|
|
388
382
|
|
|
389
383
|
h2 {
|
|
390
|
-
|
|
384
|
+
margin-top: var(--sr-spacing-xl);
|
|
385
|
+
font-size: var(--sr-text-2xl);
|
|
391
386
|
}
|
|
392
387
|
|
|
393
388
|
h3 {
|
|
394
|
-
font-size:
|
|
389
|
+
font-size: var(--sr-text-xl);
|
|
395
390
|
}
|
|
396
391
|
|
|
397
392
|
h4 {
|
|
398
|
-
font-size:
|
|
393
|
+
font-size: var(--sr-text-lg);
|
|
399
394
|
}
|
|
400
395
|
|
|
401
396
|
h5 {
|
|
402
|
-
font-size:
|
|
397
|
+
font-size: var(--sr-text-sm);
|
|
403
398
|
}
|
|
404
399
|
|
|
405
400
|
h6 {
|
|
406
|
-
font-size:
|
|
401
|
+
font-size: var(--sr-text-xs);
|
|
407
402
|
color: var(--sr-color-fg-muted);
|
|
408
403
|
}
|
|
409
404
|
|
|
@@ -413,11 +408,18 @@ ul {
|
|
|
413
408
|
}
|
|
414
409
|
|
|
415
410
|
ol ol,
|
|
416
|
-
ol ul
|
|
411
|
+
ol ul {
|
|
412
|
+
margin-top: 0;
|
|
413
|
+
margin-bottom: 0;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/* A numbered sub-list (above) reads as a continuation of its parent's sequence —
|
|
417
|
+
tight to its own numbering flow. A bulleted sub-list is a categorical grouping,
|
|
418
|
+
so it gets the extra bottom margin to set it apart from the next category. */
|
|
417
419
|
ul ol,
|
|
418
420
|
ul ul {
|
|
419
421
|
margin-top: 0;
|
|
420
|
-
margin-bottom:
|
|
422
|
+
margin-bottom: var(--sr-spacing);
|
|
421
423
|
}
|
|
422
424
|
|
|
423
425
|
li {
|
|
@@ -451,8 +453,11 @@ dl dd {
|
|
|
451
453
|
|
|
452
454
|
table {
|
|
453
455
|
display: block;
|
|
454
|
-
width:
|
|
456
|
+
width: fit-content;
|
|
457
|
+
margin-right: -0.8125rem;
|
|
458
|
+
margin-left: -0.8125rem;
|
|
455
459
|
overflow: auto;
|
|
460
|
+
font-size: var(--sr-text-sm);
|
|
456
461
|
}
|
|
457
462
|
|
|
458
463
|
table th {
|
|
@@ -470,10 +475,6 @@ table tr {
|
|
|
470
475
|
border-top: 1px solid var(--sr-color-border-table);
|
|
471
476
|
}
|
|
472
477
|
|
|
473
|
-
table tr:nth-child(2n) {
|
|
474
|
-
background-color: var(--sr-color-canvas-subtle);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
478
|
img {
|
|
478
479
|
max-width: 100%;
|
|
479
480
|
box-sizing: initial;
|
|
@@ -493,7 +494,6 @@ code {
|
|
|
493
494
|
margin: 0;
|
|
494
495
|
font-size: 85%;
|
|
495
496
|
background-color: var(--sr-color-code-bg);
|
|
496
|
-
border-radius: 0.1875rem;
|
|
497
497
|
}
|
|
498
498
|
|
|
499
499
|
pre {
|
|
@@ -521,12 +521,13 @@ pre > code {
|
|
|
521
521
|
|
|
522
522
|
.highlight pre,
|
|
523
523
|
pre {
|
|
524
|
-
padding: var(--sr-
|
|
524
|
+
padding: var(--sr-box-padding);
|
|
525
|
+
margin-right: calc(var(--sr-box-padding) * -1);
|
|
526
|
+
margin-left: calc(var(--sr-box-padding) * -1);
|
|
525
527
|
overflow: auto;
|
|
526
|
-
font-size:
|
|
527
|
-
line-height: 1.
|
|
528
|
+
font-size: var(--sr-text-xs);
|
|
529
|
+
line-height: 1.4;
|
|
528
530
|
background-color: var(--sr-color-canvas-subtle);
|
|
529
|
-
border-radius: 0.1875rem;
|
|
530
531
|
}
|
|
531
532
|
|
|
532
533
|
pre code {
|
|
@@ -547,7 +548,7 @@ p {
|
|
|
547
548
|
min-height: 1.75rem;
|
|
548
549
|
}
|
|
549
550
|
pre {
|
|
550
|
-
margin-bottom:
|
|
551
|
+
margin-bottom: var(--sr-spacing-xl);
|
|
551
552
|
}
|
|
552
553
|
|
|
553
554
|
/* Default code-fence button styling (formerly `button.css`). */
|
|
@@ -558,7 +559,7 @@ pre {
|
|
|
558
559
|
position: relative;
|
|
559
560
|
display: inline-block;
|
|
560
561
|
padding: 0.1875rem 0.625rem;
|
|
561
|
-
font-size:
|
|
562
|
+
font-size: var(--sr-text-xs);
|
|
562
563
|
font-weight: 500;
|
|
563
564
|
line-height: 1rem;
|
|
564
565
|
white-space: nowrap;
|
|
@@ -576,7 +577,7 @@ pre {
|
|
|
576
577
|
);
|
|
577
578
|
box-shadow:
|
|
578
579
|
0 1px 0 rgba(24, 24, 27, 0.04),
|
|
579
|
-
inset 0 1px 0
|
|
580
|
+
inset 0 1px 0 var(--sr-color-bevel-highlight);
|
|
580
581
|
transition:
|
|
581
582
|
background 0.2s cubic-bezier(0.3, 0, 0.5, 1),
|
|
582
583
|
box-shadow 0.15s;
|
|
@@ -594,3 +595,151 @@ pre {
|
|
|
594
595
|
background: var(--sr-color-canvas-subtle);
|
|
595
596
|
box-shadow: inset 0 1px 2px rgba(24, 24, 27, 0.08);
|
|
596
597
|
}
|
|
598
|
+
|
|
599
|
+
/* Copy-to-clipboard button rendered as the last child of each code snippet's `<pre>`
|
|
600
|
+
(see `COPY_BUTTON_MARKUP` in `preprocessReadme.ts`) and overlaid on its corner via
|
|
601
|
+
`position: absolute`. Anchored against `.sr-code-block` (a non-scrolling wrapper
|
|
602
|
+
`preprocessReadme.ts` adds around every highlighted `<pre>`) rather than `<pre>`
|
|
603
|
+
itself — `<pre>` has its own `overflow: auto` for long lines, and a `right`-anchored
|
|
604
|
+
absolute child of a scrolling box drifts with that box's horizontal scroll.
|
|
605
|
+
|
|
606
|
+
The bleed (negative margin equal to `pre`'s own padding, same technique as the
|
|
607
|
+
table/details bleed above) moves from `pre` to `.sr-code-block` here, with `pre`'s
|
|
608
|
+
own margin canceled below — otherwise `.sr-code-block`'s box (what the button is
|
|
609
|
+
positioned against) would stop short of `pre`'s bled edge, leaving the button
|
|
610
|
+
inset from the visible corner by the full bleed amount. */
|
|
611
|
+
|
|
612
|
+
.sr-code-block {
|
|
613
|
+
position: relative;
|
|
614
|
+
margin-right: calc(var(--sr-box-padding) * -1);
|
|
615
|
+
margin-left: calc(var(--sr-box-padding) * -1);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
.sr-code-block pre {
|
|
619
|
+
margin-right: 0;
|
|
620
|
+
margin-left: 0;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
.sr-copy-button {
|
|
624
|
+
position: absolute;
|
|
625
|
+
top: 0.5rem;
|
|
626
|
+
right: 0.5rem;
|
|
627
|
+
display: flex;
|
|
628
|
+
align-items: center;
|
|
629
|
+
justify-content: center;
|
|
630
|
+
padding: 0.25rem;
|
|
631
|
+
color: var(--sr-color-fg-muted);
|
|
632
|
+
cursor: pointer;
|
|
633
|
+
appearance: none;
|
|
634
|
+
background-color: var(--sr-color-canvas);
|
|
635
|
+
border: 1px solid var(--sr-color-border);
|
|
636
|
+
border-radius: 0.375rem;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/* Hidden until hover/focus so it doesn't clutter every code block at rest — but
|
|
640
|
+
only on devices that actually have a hover affordance. On touch-only devices
|
|
641
|
+
`(hover: none)` there's no hover to reveal it, so it stays visible instead. */
|
|
642
|
+
@media (hover: hover) {
|
|
643
|
+
.sr-copy-button {
|
|
644
|
+
opacity: 0;
|
|
645
|
+
transition: opacity 0.15s;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
.sr-code-block:hover .sr-copy-button,
|
|
649
|
+
.sr-copy-button:focus-visible,
|
|
650
|
+
.sr-copy-button.sr-copy-copied {
|
|
651
|
+
opacity: 1;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/* Same specificity as `.sr-copy-check` below (one class each) so source order
|
|
656
|
+
decides the default state — a `.sr-copy-button svg` selector here would win on
|
|
657
|
+
specificity regardless of order and defeat that rule's `display: none`. */
|
|
658
|
+
.sr-copy-icon,
|
|
659
|
+
.sr-copy-check {
|
|
660
|
+
display: block;
|
|
661
|
+
fill: currentColor;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/* `.sr-copy-copied` is toggled client-side by the copy-button script for 2s of
|
|
665
|
+
feedback after a successful copy — never present in server-rendered markup. */
|
|
666
|
+
.sr-copy-check {
|
|
667
|
+
display: none;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
.sr-copy-button.sr-copy-copied .sr-copy-icon {
|
|
671
|
+
display: none;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
.sr-copy-button.sr-copy-copied .sr-copy-check {
|
|
675
|
+
display: block;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/* `details`/`summary`, styled with the same clickable material as the code-fence
|
|
679
|
+
button above. `summary` bleeds out to the `details` border via a negative
|
|
680
|
+
margin (same technique as the table/pre bleed) so its background spans the
|
|
681
|
+
full box edge-to-edge, rather than sitting inset with the revealed content. */
|
|
682
|
+
|
|
683
|
+
details {
|
|
684
|
+
padding: 0 var(--sr-box-padding);
|
|
685
|
+
margin-right: calc(var(--sr-box-padding) * -1);
|
|
686
|
+
margin-left: calc(var(--sr-box-padding) * -1);
|
|
687
|
+
border: 1px solid var(--sr-color-border-muted);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
/* Bottom padding only applies once there's revealed content to pad — otherwise
|
|
691
|
+
(closed, just the summary bar) it'd reserve empty space below the summary,
|
|
692
|
+
showing as a hollow gap before the box's own bottom border. */
|
|
693
|
+
details[open] {
|
|
694
|
+
padding-bottom: var(--sr-spacing);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
summary {
|
|
698
|
+
padding: 0.75rem var(--sr-box-padding);
|
|
699
|
+
margin: 0 calc(var(--sr-box-padding) * -1);
|
|
700
|
+
font-weight: 500;
|
|
701
|
+
color: var(--sr-color-fg);
|
|
702
|
+
background: linear-gradient(
|
|
703
|
+
180deg,
|
|
704
|
+
var(--sr-color-kbd-bg),
|
|
705
|
+
var(--sr-color-canvas-subtle)
|
|
706
|
+
);
|
|
707
|
+
box-shadow:
|
|
708
|
+
0 1px 0 rgba(24, 24, 27, 0.04),
|
|
709
|
+
inset 0 1px 0 var(--sr-color-bevel-highlight);
|
|
710
|
+
transition:
|
|
711
|
+
background 0.2s cubic-bezier(0.3, 0, 0.5, 1),
|
|
712
|
+
box-shadow 0.15s;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
summary:hover {
|
|
716
|
+
background: linear-gradient(
|
|
717
|
+
180deg,
|
|
718
|
+
var(--sr-color-canvas-subtle),
|
|
719
|
+
var(--sr-color-border)
|
|
720
|
+
);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
summary:active {
|
|
724
|
+
background: var(--sr-color-canvas-subtle);
|
|
725
|
+
box-shadow: inset 0 1px 2px rgba(24, 24, 27, 0.08);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
details[open] > summary {
|
|
729
|
+
border-bottom: 1px solid var(--sr-color-border-muted);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
summary + * {
|
|
733
|
+
margin-top: var(--sr-spacing);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/* Adjacent `details` conjoin into a single accordion: no gap and no doubled
|
|
737
|
+
border at the seam between them. */
|
|
738
|
+
details + details {
|
|
739
|
+
margin-top: 0;
|
|
740
|
+
border-top: 0;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
details:has(+ details) {
|
|
744
|
+
margin-bottom: 0;
|
|
745
|
+
}
|
package/dist/svelte.css
CHANGED
|
@@ -13,3 +13,17 @@
|
|
|
13
13
|
.language-svelte .property {
|
|
14
14
|
color: #005cc5;
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
:root[data-sr-theme="dark"] .language-svelte .tag,
|
|
18
|
+
:root[data-sr-theme="dark"] .language-svelte .selector {
|
|
19
|
+
color: #7ee787;
|
|
20
|
+
}
|
|
21
|
+
:root[data-sr-theme="dark"] .language-svelte .attr-name {
|
|
22
|
+
color: #d2a8ff;
|
|
23
|
+
}
|
|
24
|
+
:root[data-sr-theme="dark"] .language-svelte .attr-value {
|
|
25
|
+
color: #a5d6ff;
|
|
26
|
+
}
|
|
27
|
+
:root[data-sr-theme="dark"] .language-svelte .property {
|
|
28
|
+
color: #79c0ff;
|
|
29
|
+
}
|
package/dist/typescript.css
CHANGED
|
@@ -10,3 +10,16 @@
|
|
|
10
10
|
.language-javascript .class-name {
|
|
11
11
|
color: #24292f;
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
:root[data-sr-theme="dark"] .language-typescript,
|
|
15
|
+
:root[data-sr-theme="dark"] .language-javascript {
|
|
16
|
+
color: #79c0ff;
|
|
17
|
+
}
|
|
18
|
+
:root[data-sr-theme="dark"] .language-typescript .string,
|
|
19
|
+
:root[data-sr-theme="dark"] .language-javascript .string {
|
|
20
|
+
color: #a5d6ff;
|
|
21
|
+
}
|
|
22
|
+
:root[data-sr-theme="dark"] .language-typescript .class-name,
|
|
23
|
+
:root[data-sr-theme="dark"] .language-javascript .class-name {
|
|
24
|
+
color: #c9d1d9;
|
|
25
|
+
}
|
package/dist/utils/purgeCss.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function purgeUnusedCss(rawCss: string, html: string,
|
|
1
|
+
export declare function purgeUnusedCss(rawCss: string, html: string, alwaysKeepTokens?: string[]): string;
|
package/dist/yaml.css
CHANGED