mnfst 0.5.81 → 0.5.83

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/LICENSE CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ---
4
4
 
5
- Copyright © 2025 Andrew Matlock
5
+ Copyright © 2026 Andrew Matlock
6
6
 
7
7
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
8
 
@@ -29,7 +29,7 @@
29
29
  align-items: center;
30
30
  padding: var(--spacing-field-padding, 0.625rem) 0;
31
31
  font-weight: bold;
32
- color: var(--color-content-stark, oklch(16.6% 0.026 267));
32
+ color: var(--color-content-stark, darkslategray);
33
33
  user-select: none;
34
34
  cursor: pointer;
35
35
  transition: var(--transition, all .05s ease-in-out);
@@ -42,11 +42,11 @@
42
42
  }
43
43
 
44
44
  &:hover {
45
- color: color-mix(in oklch, var(--color-surface-1, oklch(98.17% 0.0005 95.87)) 40%, var(--color-content-stark, oklch(16.6% 0.026 267)))
45
+ color: color-mix(in oklch, var(--color-surface-1, whitesmoke) 40%, var(--color-content-stark, darkslategray))
46
46
  }
47
47
 
48
48
  &:active {
49
- color: color-mix(in oklch, var(--color-surface-1, oklch(98.17% 0.0005 95.87)) 50%, var(--color-content-stark, oklch(16.6% 0.026 267)))
49
+ color: color-mix(in oklch, var(--color-surface-1, whitesmoke) 50%, var(--color-content-stark, darkslategray))
50
50
  }
51
51
 
52
52
  /* Add custom icon */
@@ -55,7 +55,7 @@
55
55
  order: 1;
56
56
  width: 1rem;
57
57
  height: 1rem;
58
- background-color: color-mix(in oklch, var(--color-field-surface, oklch(91.79% 0.0029 264.26)) 50%, var(--color-field-inverse, oklch(16.6% 0.026 267)));
58
+ background-color: color-mix(in oklch, var(--color-field-surface, color-mix(darkslategray 10%, transparent)) 50%, var(--color-field-inverse, darkslategray));
59
59
  -webkit-mask-image: var(--icon-accordion, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1em' height='1em' viewBox='0 0 256 256'%3E%3Cpath fill='%23000' d='m184.49 136.49l-80 80a12 12 0 0 1-17-17L159 128L87.51 56.49a12 12 0 1 1 17-17l80 80a12 12 0 0 1-.02 17'/%3E%3C/svg%3E"));
60
60
  mask-image: var(--icon-accordion, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1em' height='1em' viewBox='0 0 256 256'%3E%3Cpath fill='%23000' d='m184.49 136.49l-80 80a12 12 0 0 1-17-17L159 128L87.51 56.49a12 12 0 1 1 17-17l80 80a12 12 0 0 1-.02 17'/%3E%3C/svg%3E"));
61
61
  -webkit-mask-repeat: no-repeat;
@@ -14,8 +14,8 @@
14
14
  font-weight: bold;
15
15
  text-align: center;
16
16
  text-transform: uppercase;
17
- color: var(--color-field-inverse, oklch(16.6% 0.026 267));
18
- background-color: var(--color-field-surface, oklch(91.79% 0.0029 264.26));
17
+ color: var(--color-field-inverse, darkslategray);
18
+ background-color: var(--color-field-surface, color-mix(darkslategray 10%, transparent));
19
19
  background-clip: content-box;
20
20
  background-size: cover;
21
21
  background-position: center;
@@ -23,7 +23,7 @@
23
23
 
24
24
  /* Icon */
25
25
  &[x-icon] {
26
- color: var(--color-content-subtle, oklch(67.4% 0.0318 251.27))
26
+ color: var(--color-content-subtle, darkgray)
27
27
  }
28
28
 
29
29
  /* Profile pic */
@@ -47,8 +47,8 @@
47
47
  width: 9px;
48
48
  height: 9px;
49
49
  z-index: 1;
50
- background-color: var(--color-field-surface, oklch(91.79% 0.0029 264.26));
51
- border: 1px solid var(--color-page, oklch(100% 0 0));
50
+ background-color: var(--color-field-surface, color-mix(darkslategray 10%, transparent));
51
+ border: 1px solid var(--color-page, white);
52
52
  border-radius: 50%
53
53
  }
54
54
  }
@@ -59,7 +59,7 @@
59
59
  background-blend-mode: normal;
60
60
 
61
61
  &:hover {
62
- background-color: var(--color-field-surface-hover, oklch(89.24% 0.0024 12.48));
62
+ background-color: var(--color-field-surface-hover, color-mix(darkslategray 15%, transparent));
63
63
  background-blend-mode: multiply;
64
64
 
65
65
  & img {
@@ -94,7 +94,7 @@
94
94
  padding-inline-end: 1.5ch;
95
95
 
96
96
  &:hover .avatar {
97
- background-color: var(--color-field-surface-hover, oklch(89.24% 0.0024 12.48));
97
+ background-color: var(--color-field-surface-hover, color-mix(darkslategray 15%, transparent));
98
98
  transition: var(--transition, all .05s ease-in-out)
99
99
  }
100
100
  }
@@ -107,7 +107,7 @@
107
107
 
108
108
  :where(.avatar) {
109
109
  margin-inline-end: calc(var(--spacing-field-height, 2.25rem) * -0.3);
110
- box-shadow: 0 0 0 3px var(--color-page, oklch(100% 0 0))
110
+ box-shadow: 0 0 0 3px var(--color-page, white)
111
111
  }
112
112
  }
113
113
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  @layer components {
4
4
 
5
- :where(button:not(.link), [role=button], [type=button], [type=reset], [type=submit], select):not(.unstyle) {
5
+ :where(button:not(.link), [role=button], [type=button], [type=reset], [type=submit], select):not(code, .unstyle) {
6
6
  display: inline-flex;
7
7
  flex-flow: row;
8
8
  justify-content: center;
@@ -17,13 +17,13 @@
17
17
  overflow: hidden;
18
18
  white-space: nowrap;
19
19
  text-overflow: ellipsis;
20
- color: var(--color-field-inverse, oklch(16.6% 0.026 267));
21
- background-color: var(--color-field-surface, oklch(91.79% 0.0029 264.26));
20
+ color: var(--color-field-inverse, darkslategray);
21
+ background-color: var(--color-field-surface, color-mix(darkslategray 10%, transparent));
22
22
  border-width: 0;
23
23
  border-style: solid;
24
24
  border-color: transparent;
25
25
  border-radius: var(--radius, 0.5rem);
26
- outline-color: var(--color-line, oklch(48.3% 0.006422 17.4 / 0.15));
26
+ outline-color: var(--color-line, color-mix(darkslategray 10%, transparent));
27
27
  cursor: pointer;
28
28
  transition: var(--transition, all .05s ease-in-out);
29
29
  appearance: button;
@@ -52,15 +52,15 @@
52
52
  }
53
53
 
54
54
  &:hover {
55
- background-color: var(--color-field-surface-hover, oklch(89.24% 0.0024 12.48))
55
+ background-color: var(--color-field-surface-hover, color-mix(darkslategray 15%, transparent))
56
56
  }
57
57
 
58
58
  &:active {
59
- background-color: var(--color-field-surface-hover, oklch(89.24% 0.0024 12.48))
59
+ background-color: var(--color-field-surface-hover, color-mix(darkslategray 15%, transparent))
60
60
  }
61
61
 
62
62
  &:focus-visible {
63
- background-color: var(--color-field-surface, oklch(91.79% 0.0029 264.26))
63
+ background-color: var(--color-field-surface, color-mix(darkslategray 10%, transparent))
64
64
  }
65
65
  }
66
66
 
@@ -16,13 +16,13 @@
16
16
  &:checked {
17
17
 
18
18
  &:hover {
19
- background-color: var(--color-field-surface-hover, oklch(89.24% 0.0024 12.48));
20
- border-color: var(--color-field-surface-hover, oklch(89.24% 0.0024 12.48))
19
+ background-color: var(--color-field-surface-hover, color-mix(darkslategray 15%, transparent));
20
+ border-color: var(--color-field-surface-hover, color-mix(darkslategray 15%, transparent))
21
21
  }
22
22
 
23
23
  &:active {
24
- background-color: var(--color-field-surface-hover, oklch(89.24% 0.0024 12.48));
25
- border-color: var(--color-field-surface-hover, oklch(89.24% 0.0024 12.48))
24
+ background-color: var(--color-field-surface-hover, color-mix(darkslategray 15%, transparent));
25
+ border-color: var(--color-field-surface-hover, color-mix(darkslategray 15%, transparent))
26
26
  }
27
27
  }
28
28
 
@@ -34,7 +34,7 @@
34
34
  left: 50%;
35
35
  width: 60%;
36
36
  height: 60%;
37
- background-color: var(--color-field-inverse, oklch(16.6% 0.026 267));
37
+ background-color: var(--color-field-inverse, darkslategray);
38
38
  -webkit-mask-image: var(--icon-checkbox, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='currentColor' d='m0 11l2-2l5 5L18 3l2 2L7 18z'/%3E%3C/svg%3E"));
39
39
  mask-image: var(--icon-checkbox, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='currentColor' d='m0 11l2-2l5 5L18 3l2 2L7 18z'/%3E%3C/svg%3E"));
40
40
  -webkit-mask-repeat: no-repeat;
@@ -3,13 +3,14 @@
3
3
  /* https://manifestx.dev/styles/code
4
4
  */
5
5
 
6
- @import url('https://fonts.googleapis.com/css2?family=Gabarito:wght@400..900&family=IBM+Plex+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&family=Lexend+Exa&display=swap');
6
+ @import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap');
7
7
 
8
8
  :root {
9
9
 
10
10
  /* Copy code button icons */
11
- --icon-copy-code: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Crect width='14' height='14' x='8' y='8' rx='2' ry='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/g%3E%3C/svg%3E");
12
- --icon-copied-code: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
11
+ --icon-code-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Crect width='14' height='14' x='8' y='8' rx='2' ry='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/g%3E%3C/svg%3E");
12
+ --icon-code-copied: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWNvcHktY2hlY2staWNvbiBsdWNpZGUtY29weS1jaGVjayI+PHBhdGggZD0ibTEyIDE1IDIgMiA0LTQiLz48cmVjdCB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHg9IjgiIHk9IjgiIHJ4PSIyIiByeT0iMiIvPjxwYXRoIGQ9Ik00IDE2Yy0xLjEgMC0yLS45LTItMlY0YzAtMS4xLjktMiAyLTJoMTBjMS4xIDAgMiAuOSAyIDIiLz48L3N2Zz4=");
13
+ --icon-code-expand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
13
14
 
14
15
  /* Syntax highlight colors */
15
16
  --color-code-keyword: #b8860b;
@@ -79,8 +80,6 @@
79
80
 
80
81
  /* Code syntax styles for highlight.js */
81
82
  @layer utilities {
82
-
83
- /* Additional highlight.js specific classes */
84
83
  .hljs-comment {
85
84
  color: var(--color-code-comment) !important
86
85
  }
@@ -214,181 +213,91 @@
214
213
 
215
214
  @layer components {
216
215
 
217
- :where(pre):not(.unstyle) {
218
- display: flex;
219
- flex: 1;
220
- -ms-overflow-style: scrollbar;
221
- overflow-x: auto;
222
- width: auto;
223
- padding: calc(var(--spacing, 0.25rem) * 4);
224
- font-family: "IBM Plex Mono", monospace;
225
- font-size: 0.8125rem;
226
- line-height: 1.5;
227
- text-indent: 0;
228
- color: var(--color-content-neutral, oklch(48.26% 0.0365 255.09));
229
- background-color: var(--color-page, oklch(100% 0 0));
230
- border: 1px solid var(--color-field-surface, oklch(91.79% 0.0029 264.26));
231
- border-radius: calc(var(--radius, 0.5rem) * 2);
232
- tab-size: 4;
233
- white-space: pre;
234
- white-space-collapse: preserve
235
- }
236
-
237
- :where(pre code):not(.unstyle) {
238
- display: block;
239
- width: 100%;
240
- padding: 0;
241
- font-size: inherit;
242
- font-family: inherit;
243
- font-weight: inherit;
244
- line-height: inherit;
245
- color: inherit;
246
- background-color: transparent;
247
- border: 0 none;
248
-
249
- & span {
250
- vertical-align: initial
251
- }
216
+ /* Copyable inline code */
217
+ :where(code[role="button"]) {
218
+ height: fit-content;
219
+ }
220
+
221
+ :where(.code-copied-icon) {
222
+ display: inline-block;
223
+ width: 1em;
224
+ height: 1em;
225
+ background-color: currentColor;
226
+ mask-image: var(--icon-code-copied);
227
+ mask-size: contain;
228
+ mask-repeat: no-repeat;
229
+ mask-position: center
252
230
  }
253
231
 
254
- /* Code block(s) wrapper */
255
- :where(x-code-group, x-code, [x-code]) {
232
+ /* Pre code blocks (individual or tab grouped) */
233
+ :where([x-code], [x-code-group]):not(.unstyle) {
256
234
  position: relative;
257
- display: flex;
258
- flex-flow: row wrap;
259
- font-family: "IBM Plex Mono", monospace;
260
- font-size: 0.8125rem;
261
- line-height: 1.5;
262
- background: color-mix(in oklch, var(--color-field-surface, oklch(91.79% 0.0029 264.26)) 45%, transparent);
263
- border: 1px solid var(--color-field-surface, oklch(91.79% 0.0029 264.26));
264
- border-radius: calc(var(--radius, 0.5rem) * 2);
265
- overflow: hidden;
266
-
267
- &:has(> header) {
268
- padding: 0.125rem
269
- }
270
235
 
271
- /* Title bar */
272
- &>header {
236
+ /* Header */
237
+ :where(header) {
273
238
  display: flex;
239
+ flex-direction: row;
274
240
  align-items: center;
275
- gap: calc(var(--spacing, 0.25rem) * 2);
276
241
  width: 100%;
277
- padding: 0.5rem 4rem 0.5rem 1rem;
278
- font-family: var(--font-sans, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji');
279
- font-size: 0.8125rem;
280
- font-weight: 500;
281
- color: var(--color-content-subtle, oklch(67.4% 0.0318 251.27));
282
- border-bottom: none;
283
- border-radius: 0.8125rem 0.8125rem 0 0;
284
- overflow-x: auto;
285
- -ms-overflow-style: none;
286
- scrollbar-width: none;
287
-
288
- &::-webkit-scrollbar {
289
- display: none
290
- }
242
+ min-height: var(--spacing-field-height, 2.25rem);
243
+ padding-inline-start: calc(var(--spacing, 0.25rem) * 4);
244
+ padding-inline-end: var(--spacing-field-height);
245
+ font-family: var(--font-sans, sans-serif);
246
+ font-size: inherit;
247
+ color: var(--color-content-neutral, gray);
248
+ background-color: color-mix(in oklch, var(--color-content-stark, darkslategray) 8%, transparent);
291
249
 
292
- /* Tab titles */
293
- & button[role=tab] {
294
- flex-shrink: 0;
295
- height: fit-content;
296
- padding: var(--spacing, 0.25rem) calc(var(--spacing, 0.25rem) * 2);
297
- border-radius: var(--radius, 0.5rem);
298
- background: transparent;
299
- color: inherit;
300
- font-family: inherit;
301
- font-size: inherit;
302
- cursor: pointer;
303
- transition: var(--transition, all .05s ease-in-out);
304
-
305
- &:hover {
306
- color: var(--color-content-neutral, oklch(48.26% 0.0365 255.09));
307
- background-color: var(--color-surface-3, oklch(91.79% 0.0029 264.26))
308
- }
250
+ &:has(button[role="tab"]) {
251
+ padding-inline-start: calc(var(--spacing, 0.25rem) * 2)
252
+ }
309
253
 
310
- /* Selected tab */
311
- &.selected {
312
- position: relative;
313
- color: var(--color-brand-content, #de6618);
254
+ /* Tabs wrapper */
255
+ & [role="tablist"] {
256
+ display: flex;
257
+ flex-direction: row;
258
+ overflow-x: auto;
259
+ -ms-overflow-style: none;
260
+ scrollbar-width: none;
261
+
262
+ /* Tab buttons */
263
+ & button[role="tab"] {
264
+ justify-content: start;
265
+ height: fit-content;
266
+ flex-shrink: 0;
267
+ font-family: inherit;
268
+ font-size: inherit;
269
+ color: inherit;
314
270
  background: transparent;
271
+ border: 0 none;
315
272
 
316
273
  &:hover {
317
- background-color: var(--color-surface-3, oklch(91.79% 0.0029 264.26))
274
+ color: var(--color-content-stark, darkslategray);
275
+ background-color: var(--color-field-surface, color-mix(darkslategray 10%, transparent))
318
276
  }
319
277
 
320
- /* Selected tab underline */
321
- &::after {
322
- content: '';
323
- position: absolute;
324
- bottom: -0.5rem;
325
- left: 50%;
326
- transform: translateX(-50%);
327
- width: calc(100% - var(--spacing, 0.25rem) * 4);
328
- height: 2px;
329
- background: color-mix(in oklch, var(--color-brand-content, #de6618) 50%, transparent);
330
- border-radius: 0.5rem
278
+ &[aria-selected="true"] {
279
+ position: relative;
280
+ color: var(--color-brand-content, goldenrod);
281
+ pointer-events: none
331
282
  }
332
283
  }
333
284
  }
334
285
  }
335
286
 
336
- /* Line numbers */
337
- & .lines {
338
- display: flex;
339
- flex-direction: column;
340
- width: fit-content;
341
- min-width: 2.5rem;
342
- padding: calc(var(--spacing, 0.25rem) * 4) 0.5rem calc(var(--spacing, 0.25rem) * 4) 0.5rem;
343
- font-family: inherit;
344
- font-size: inherit;
345
- line-height: inherit;
346
- text-align: right;
347
- color: var(--color-content-subtle, oklch(67.4% 0.0318 251.27));
348
- background: var(--color-page, oklch(100% 0 0));
349
- border: 1px solid var(--color-field-surface, oklch(91.79% 0.0029 264.26));
350
- border-inline-end: 0 none;
351
- pointer-events: none;
352
- user-select: none;
353
- }
354
-
355
- &:has(> header) .lines {
356
- border-start-start-radius: 0.875rem;
357
- border-end-start-radius: 0.875rem
358
- }
359
-
360
- & pre {
361
- margin-top: 0;
362
- border: 0 none
363
- }
364
-
365
- &:has(> header) pre {
366
- border-radius: 0.875rem
367
- }
368
-
369
- &:not(> header) pre {
370
- border: 0 none
371
- }
372
-
373
- &[numbers] pre {
374
- border-inline-start: 0 none;
375
- border-start-start-radius: 0;
376
- border-end-start-radius: 0
377
- }
378
-
379
- /* Copy button */
287
+ /* Copy code button */
380
288
  & button.copy {
289
+ font-size: 75%;
381
290
  position: absolute;
382
- top: 0.3rem;
383
- right: 0.5rem;
384
- width: 1.75rem;
385
- min-width: 0;
386
- height: 1.75rem;
387
- padding: 0;
388
- background: none;
291
+ top: 0;
292
+ inset-inline-end: 0;
293
+ background-color: transparent;
389
294
 
390
295
  &:hover {
391
- background: var(--color-field-surface, silver)
296
+ background-color: transparent;
297
+
298
+ &::after {
299
+ background-color: var(--color-field-inverse, darkslategray)
300
+ }
392
301
  }
393
302
 
394
303
  &::after {
@@ -397,69 +306,106 @@
397
306
  width: 0.8125rem;
398
307
  height: 0.8125rem;
399
308
  background-color: var(--color-content-neutral, gray);
400
- mask-image: var(--icon-copy-code);
401
- mask-size: 1rem;
309
+ mask-image: var(--icon-code-copy);
402
310
  mask-size: contain;
403
- mask-repeat: no-repeat;
311
+ mask-repeat: no-repeat
404
312
  }
405
313
 
406
314
  &.copied::after {
407
- mask-image: var(--icon-copied-code);
315
+ mask-image: var(--icon-code-copied)
408
316
  }
317
+ }
409
318
 
410
- &.copied {
411
- --color-field-surface: var(--color-positive-surface);
412
- --color-field-surface-hover: var(--color-positive-surface-hover);
413
- --color-content-neutral: var(--color-positive-inverse);
414
- }
319
+ :where(header)::-webkit-scrollbar {
320
+ display: none
321
+ }
322
+
323
+ /* Line numbers overlay */
324
+ & .lines {
325
+ position: absolute;
326
+ inset-inline-start: 0;
327
+ display: inline-flex;
328
+ flex-direction: column;
329
+ padding: calc(var(--spacing, 0.25rem) * 4) 0 calc(var(--spacing, 0.25rem) * 4) calc(var(--spacing, 0.25rem) * 4);
330
+ font-family: inherit;
331
+ font-size: inherit;
332
+ line-height: inherit;
333
+ text-align: end;
334
+ color: var(--color-content-subtle, darkgray);
335
+ pointer-events: none;
336
+ user-select: none
337
+ }
338
+
339
+ /* Indent code when line numbers present */
340
+ &:has(.lines) code {
341
+ padding-inline-start: calc(calc(var(--spacing, 0.25rem) * 6) + 2ch)
415
342
  }
416
343
 
417
- :where(x-code) {
344
+ /* Code */
345
+ :where(code) {
346
+ flex: 1 1 100%;
347
+ min-width: 0;
348
+ white-space: pre;
349
+ white-space-collapse: preserve
350
+ }
351
+
352
+ /* Expand / collapse toggle */
353
+ & button.expand {
354
+ order: 99;
355
+ display: flex;
356
+ align-items: center;
357
+ justify-content: center;
418
358
  width: 100%;
419
- margin-top: 0;
359
+ height: var(--spacing-field-height, 2.25rem);
360
+ padding: 0 calc(var(--spacing, 0.25rem) * 2);
361
+ font-family: var(--font-sans, sans-serif);
362
+ font-size: inherit;
363
+ color: var(--color-content-subtle, darkgray);
364
+ background: transparent;
420
365
  border: 0 none;
421
- overflow: visible;
366
+ border-radius: 0;
367
+ cursor: pointer;
368
+ transition: var(--transition, all .05s ease-in-out);
422
369
 
423
- & button.copy {
424
- top: -2.25rem
370
+ &:hover {
371
+ color: var(--color-content-neutral, gray);
372
+ background: color-mix(in oklch, var(--color-content-stark, darkslategray) 8%, transparent);
425
373
  }
426
374
  }
427
- }
428
375
 
429
- /* RTL support */
430
- [dir=rtl] :where(x-code-group, x-code, [x-code]) button.copy {
431
- right: auto;
432
- left: 0.5rem
433
- }
434
- }
435
-
436
- /* Frames to visualize code examples */
437
- @layer utilities {
376
+ &[data-collapsed] code,
377
+ &[data-collapsed] .lines {
378
+ max-height: calc(var(--collapse-lines, 20) * 1.7em + calc(var(--spacing, 0.25rem) * 8));
379
+ overflow: hidden;
380
+ mask-image: linear-gradient(to bottom,
381
+ black 0%,
382
+ black calc(100% - 3em),
383
+ transparent calc(100% - 0.75em),
384
+ transparent 100%);
385
+ }
438
386
 
439
- .prose aside.frame {
440
- display: flex;
441
- gap: calc(var(--spacing, 0.25rem) * 4);
442
- background: color-mix(in oklch, var(--color-field-surface, oklch(91.79% 0.0029 264.26)) 35%, transparent);
443
- border: 1px solid var(--color-field-surface, oklch(91.79% 0.0029 264.26));
444
- border-radius: calc(var(--radius, 0.5rem) * 2)
387
+ /* Preview frames */
388
+ :where(aside.frame) {
389
+ order: 1;
390
+ border: 0 none;
391
+ white-space: normal;
392
+ white-space-collapse: collapse
393
+ }
445
394
  }
446
395
 
447
- /* Followed directly by code block */
448
- .prose aside.frame:has(+ x-code-group, + x-code) {
449
- border-bottom: 0 none;
450
- border-bottom-left-radius: 0;
451
- border-bottom-right-radius: 0
452
- }
396
+ :where([x-code-group]) {
397
+ flex-flow: column;
453
398
 
454
- .prose aside.frame+x-code-group,
455
- .prose aside.frame+x-code {
456
- margin-top: 0;
457
- border-top-left-radius: 0;
458
- border-top-right-radius: 0
399
+ :where([x-code]) {
400
+ border: 0 none;
401
+ border-radius: 0;
402
+ background: transparent
403
+ }
459
404
  }
460
405
 
461
- .prose aside.frame+x-code pre {
462
- border-top-left-radius: 0;
463
- border-top-right-radius: 0
406
+ :where([x-code]):has(>header) {
407
+ & .lines {
408
+ top: var(--spacing-field-height, 2.25rem)
409
+ }
464
410
  }
465
411
  }