@byline/cli 6.0.3 → 6.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.
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
.root,
|
|
2
|
+
:global(.light) .root,
|
|
3
|
+
:global([data-theme="light"]) .root {
|
|
4
|
+
/* Prism One Light palette. */
|
|
5
|
+
--code-background: hsl(230, 1%, 98%);
|
|
6
|
+
--code-text: hsl(230, 8%, 24%);
|
|
7
|
+
--code-comment: hsl(230, 4%, 64%);
|
|
8
|
+
--code-literal: hsl(35, 99%, 36%);
|
|
9
|
+
--code-keyword: hsl(301, 63%, 40%);
|
|
10
|
+
--code-property: hsl(5, 74%, 59%);
|
|
11
|
+
--code-string: hsl(119, 34%, 47%);
|
|
12
|
+
--code-function: hsl(221, 87%, 60%);
|
|
13
|
+
--code-url: hsl(198, 99%, 37%);
|
|
14
|
+
--code-punctuation: var(--code-string);
|
|
15
|
+
--code-maybe-class: var(--code-text);
|
|
16
|
+
--code-scroll-thumb: color-mix(in srgb, var(--theme-400) 40%, white);
|
|
17
|
+
--code-scroll-hover: color-mix(in srgb, var(--theme-400) 55%, white);
|
|
18
|
+
--code-scroll-track: color-mix(in srgb, var(--theme-400) 8%, white);
|
|
19
|
+
--code-border: color-mix(in srgb, var(--theme-400) 20%, white);
|
|
20
|
+
--code-copy-background: var(--gray-50);
|
|
21
|
+
--code-copy-hover: var(--gray-100);
|
|
22
|
+
--code-copy-icon: var(--gray-700);
|
|
23
|
+
--code-copy-border: color-mix(in srgb, var(--theme-400) 35%, white);
|
|
24
|
+
border-color: var(--code-border);
|
|
25
|
+
color-scheme: light;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:global(.dark) .root,
|
|
29
|
+
:global([data-theme="dark"]) .root {
|
|
30
|
+
/* Prism One Dark syntax colors, with the existing dark code surface. */
|
|
31
|
+
--code-background: color-mix(in srgb, var(--gray-950) 80%, transparent);
|
|
32
|
+
--code-text: hsl(220, 14%, 71%);
|
|
33
|
+
--code-comment: hsl(220, 10%, 40%);
|
|
34
|
+
--code-literal: hsl(29, 54%, 61%);
|
|
35
|
+
--code-keyword: hsl(286, 60%, 67%);
|
|
36
|
+
--code-property: hsl(355, 65%, 65%);
|
|
37
|
+
--code-string: hsl(95, 38%, 62%);
|
|
38
|
+
--code-function: hsl(207, 82%, 66%);
|
|
39
|
+
--code-url: hsl(187, 47%, 55%);
|
|
40
|
+
--code-punctuation: var(--code-text);
|
|
41
|
+
--code-maybe-class: var(--code-literal);
|
|
42
|
+
--code-scroll-thumb: var(--theme-400);
|
|
43
|
+
--code-scroll-hover: var(--theme-300);
|
|
44
|
+
--code-scroll-track: var(--theme-900);
|
|
45
|
+
--code-border: var(--theme-600);
|
|
46
|
+
--code-copy-background: var(--gray-900);
|
|
47
|
+
--code-copy-hover: color-mix(in srgb, var(--gray-800) 50%, transparent);
|
|
48
|
+
--code-copy-icon: var(--gray-200);
|
|
49
|
+
--code-copy-border: initial;
|
|
50
|
+
color-scheme: dark;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.copyButton {
|
|
54
|
+
background-color: var(--code-copy-background);
|
|
55
|
+
border-color: var(--code-copy-border, var(--button-variant-outlined-border));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.copyButton:hover {
|
|
59
|
+
background-color: var(--code-copy-hover);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.copyButton:focus,
|
|
63
|
+
.copyButton:active {
|
|
64
|
+
--ring-color: var(--code-copy-border, var(--button-ring-color));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.copyIcon {
|
|
68
|
+
fill: var(--code-copy-icon);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.scroller {
|
|
72
|
+
overflow-x: auto;
|
|
73
|
+
/* Let the explicit WebKit scrollbar render instead of the inherited
|
|
74
|
+
scrollbar-color selecting an auto-hiding native scrollbar on macOS. */
|
|
75
|
+
scrollbar-color: auto;
|
|
76
|
+
scrollbar-width: auto;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.scroller::-webkit-scrollbar {
|
|
80
|
+
height: 0.625rem;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.scroller::-webkit-scrollbar-thumb {
|
|
84
|
+
background: var(--code-scroll-thumb);
|
|
85
|
+
border-radius: 0.3125rem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.scroller::-webkit-scrollbar-thumb:hover {
|
|
89
|
+
background: var(--code-scroll-hover);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.scroller::-webkit-scrollbar-track {
|
|
93
|
+
background: var(--code-scroll-track);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@supports not selector(::-webkit-scrollbar) {
|
|
97
|
+
.scroller {
|
|
98
|
+
scrollbar-color: var(--code-scroll-thumb) var(--code-scroll-track);
|
|
99
|
+
scrollbar-width: thin;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
import { CopyButton } from '@byline/ui/react'
|
|
4
4
|
/* eslint-disable no-param-reassign */
|
|
5
5
|
import cx from 'clsx'
|
|
6
|
-
import { Highlight
|
|
6
|
+
import { Highlight } from 'prism-react-renderer'
|
|
7
|
+
|
|
8
|
+
import styles from './code.module.css'
|
|
9
|
+
import { codeTheme } from './theme'
|
|
7
10
|
|
|
8
11
|
type CodeIntrinsicProps = React.JSX.IntrinsicElements['pre']
|
|
9
12
|
interface CodeProps extends CodeIntrinsicProps {
|
|
@@ -17,19 +20,25 @@ export function Code({ code, className, language }: CodeProps): React.JSX.Elemen
|
|
|
17
20
|
// Prism calls `.toLowerCase()` on this value, so null and empty legacy values need a fallback.
|
|
18
21
|
const resolvedLanguage = language != null && language.length > 0 ? language : 'typescript'
|
|
19
22
|
return (
|
|
20
|
-
<Highlight theme={
|
|
21
|
-
{({ tokens, getLineProps, getTokenProps }) => (
|
|
22
|
-
<div
|
|
23
|
+
<Highlight theme={codeTheme} code={code} language={resolvedLanguage}>
|
|
24
|
+
{({ style, tokens, getLineProps, getTokenProps }) => (
|
|
25
|
+
<div
|
|
26
|
+
className={cx(
|
|
27
|
+
styles.root,
|
|
28
|
+
'code group min-w-0 overflow-hidden rounded border relative mb-4'
|
|
29
|
+
)}
|
|
30
|
+
>
|
|
23
31
|
<CopyButton
|
|
24
32
|
variant="outlined"
|
|
25
33
|
intent="primary"
|
|
26
|
-
className=
|
|
27
|
-
containerClassName="
|
|
28
|
-
svgClassName=
|
|
34
|
+
className={styles.copyButton}
|
|
35
|
+
containerClassName="absolute top-2 right-2 invisible group-hover:visible group-focus-within:visible"
|
|
36
|
+
svgClassName={styles.copyIcon}
|
|
29
37
|
text={code}
|
|
30
38
|
/>
|
|
31
39
|
<pre
|
|
32
|
-
|
|
40
|
+
style={style}
|
|
41
|
+
className={cx(styles.scroller, 'm-0 py-5 px-4 rounded-none', className)}
|
|
33
42
|
>
|
|
34
43
|
<code className="not-prose">
|
|
35
44
|
{tokens.map((line, i) => {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PrismTheme } from 'prism-react-renderer'
|
|
2
|
+
|
|
3
|
+
// Stable on the server and client. CSS selects the One Light / One Dark
|
|
4
|
+
// palette using the document class set by the existing early theme detector.
|
|
5
|
+
export const codeTheme: PrismTheme = {
|
|
6
|
+
plain: {
|
|
7
|
+
color: 'var(--code-text)',
|
|
8
|
+
backgroundColor: 'var(--code-background)',
|
|
9
|
+
},
|
|
10
|
+
styles: [
|
|
11
|
+
{ types: ['comment', 'prolog', 'cdata'], style: { color: 'var(--code-comment)' } },
|
|
12
|
+
{ types: ['doctype', 'entity'], style: { color: 'var(--code-text)' } },
|
|
13
|
+
{ types: ['punctuation'], style: { color: 'var(--code-punctuation)' } },
|
|
14
|
+
{
|
|
15
|
+
types: ['attr-name', 'class-name', 'boolean', 'constant', 'number', 'atrule'],
|
|
16
|
+
style: { color: 'var(--code-literal)' },
|
|
17
|
+
},
|
|
18
|
+
{ types: ['maybe-class-name'], style: { color: 'var(--code-maybe-class)' } },
|
|
19
|
+
{ types: ['keyword'], style: { color: 'var(--code-keyword)' } },
|
|
20
|
+
{ types: ['property', 'tag', 'symbol', 'deleted'], style: { color: 'var(--code-property)' } },
|
|
21
|
+
{
|
|
22
|
+
types: ['selector', 'string', 'char', 'builtin', 'inserted', 'regex', 'attr-value'],
|
|
23
|
+
style: { color: 'var(--code-string)' },
|
|
24
|
+
},
|
|
25
|
+
{ types: ['variable', 'operator', 'function'], style: { color: 'var(--code-function)' } },
|
|
26
|
+
{ types: ['url'], style: { color: 'var(--code-url)' } },
|
|
27
|
+
{ types: ['deleted'], style: { textDecorationLine: 'line-through' } },
|
|
28
|
+
{ types: ['inserted'], style: { textDecorationLine: 'underline' } },
|
|
29
|
+
{ types: ['italic'], style: { fontStyle: 'italic' } },
|
|
30
|
+
{ types: ['important', 'bold'], style: { fontWeight: 'bold' } },
|
|
31
|
+
{ types: ['important'], style: { color: 'var(--code-text)' } },
|
|
32
|
+
],
|
|
33
|
+
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@byline/cli",
|
|
3
3
|
"private": false,
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
|
-
"version": "6.0
|
|
5
|
+
"version": "6.2.0",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=20.9.0"
|
|
8
8
|
},
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"typescript": "^7.0.2",
|
|
62
62
|
"unified": "^11.0.5",
|
|
63
63
|
"vitest": "^5.0.0",
|
|
64
|
-
"@byline/core": "6.0
|
|
64
|
+
"@byline/core": "6.2.0"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public",
|