starlight-theme-nova 0.0.4 → 0.0.6

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/lib/shiki.css CHANGED
@@ -1,4 +1,4 @@
1
- @import '@shikijs/twoslash/style-rich.css';
1
+ @import 'shiki-twoslash-renderer/style.css';
2
2
 
3
3
  .sl-markdown-content .astro-code {
4
4
  padding: 0;
@@ -59,7 +59,7 @@
59
59
  background-color: var(--shiki-light-bg);
60
60
  }
61
61
 
62
- html.dark .astro-code {
62
+ html[data-theme='dark'] .astro-code {
63
63
  --twoslash-popup-bg: var(--shiki-dark-bg);
64
64
  background-color: var(--shiki-dark-bg);
65
65
  }
@@ -72,14 +72,14 @@ html.dark .astro-code {
72
72
  text-decoration: var(--shiki-light-text-decoration);
73
73
  }
74
74
 
75
- html.dark .astro-code,
76
- html.dark .astro-code span {
75
+ html[data-theme='dark'] .astro-code,
76
+ html[data-theme='dark'] .astro-code span {
77
77
  color: var(--shiki-dark);
78
78
  font-style: var(--shiki-dark-font-style);
79
79
  font-weight: var(--shiki-dark-font-weight);
80
80
  text-decoration: var(--shiki-dark-text-decoration);
81
81
  }
82
-
82
+ /*
83
83
  .astro-code.twoslash .twoslash-popup-container {
84
84
  transform: translateY(1.8em);
85
85
  }
@@ -90,4 +90,4 @@ html.dark .astro-code span {
90
90
 
91
91
  .astro-code.twoslash .twoslash-query-line .twoslash-popup-container {
92
92
  transform: translateY(1.3em);
93
- }
93
+ } */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "starlight-theme-nova",
3
3
  "type": "module",
4
- "version": "0.0.4",
4
+ "version": "0.0.6",
5
5
  "description": "",
6
6
  "author": "ocavue <ocavue@gmail.com>",
7
7
  "license": "MIT",
@@ -26,10 +26,12 @@
26
26
  "src"
27
27
  ],
28
28
  "dependencies": {
29
- "@shikijs/transformers": "^1.29.2",
30
- "@shikijs/twoslash": "^1.29.2",
29
+ "@shikijs/transformers": "^3.2.1",
30
+ "@shikijs/twoslash": "^3.2.1",
31
+ "@shikijs/types": "^3.2.1",
31
32
  "astro-theme-toggle": "^0.5.1",
32
- "hast-util-is-element": "^3.0.0"
33
+ "hast-util-is-element": "^3.0.0",
34
+ "shiki-twoslash-renderer": "0.0.2"
33
35
  },
34
36
  "devDependencies": {
35
37
  "@astrojs/starlight": "^0.32.2",
@@ -14,3 +14,7 @@ import CodeCopy from './CodeCopy.astro'
14
14
  </style>
15
15
 
16
16
  <CodeCopy />
17
+ <script>
18
+ import { register } from 'shiki-twoslash-renderer/elements'
19
+ register()
20
+ </script>
@@ -4,23 +4,33 @@ import {
4
4
  transformerNotationHighlight,
5
5
  } from '@shikijs/transformers'
6
6
  import { transformerTwoslash } from '@shikijs/twoslash'
7
+ import type { ShikiTransformer } from '@shikijs/types'
7
8
  import type { ShikiConfig } from 'astro'
9
+ import { createRenderer } from 'shiki-twoslash-renderer'
8
10
 
9
11
  import { transformerCopyButton } from './shiki-transformer-copy-button'
10
12
 
11
13
  export function createShikiConfig(options: { twoslash: boolean }): ShikiConfig {
14
+ const transformers: ShikiTransformer[] = [
15
+ transformerNotationDiff(),
16
+ transformerNotationHighlight(),
17
+ transformerMetaHighlight(),
18
+ transformerCopyButton(),
19
+ options.twoslash
20
+ ? transformerTwoslash({
21
+ renderer: createRenderer(),
22
+ explicitTrigger: true,
23
+ })
24
+ : undefined,
25
+ ].filter((x) => !!x)
26
+
12
27
  return {
13
28
  themes: {
14
29
  light: 'one-light',
15
30
  dark: 'github-dark-dimmed',
16
31
  },
17
32
  defaultColor: false,
18
- transformers: [
19
- transformerNotationDiff(),
20
- transformerNotationHighlight(),
21
- transformerMetaHighlight(),
22
- transformerCopyButton(),
23
- options.twoslash ? transformerTwoslash() : undefined,
24
- ].filter((x) => !!x),
33
+ // @ts-expect-error: Astro is using outdated Shiki v1
34
+ transformers: transformers,
25
35
  }
26
36
  }
@@ -1,8 +1,6 @@
1
- import type { ShikiConfig } from 'astro'
1
+ import type { ShikiTransformer } from '@shikijs/types'
2
2
  import { isElement } from 'hast-util-is-element'
3
3
 
4
- type ShikiTransformer = NonNullable<ShikiConfig['transformers']>[number]
5
-
6
4
  const name = 'starlight-theme-nova-shiki-transformer-copy-button'
7
5
 
8
6
  /**