rn-shiki 0.0.37-26 → 0.0.37-27

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rn-shiki",
3
3
  "type": "module",
4
- "version": "0.0.37-26",
4
+ "version": "0.0.37-27",
5
5
  "description": "Shiki syntax highlighter for React Native.",
6
6
  "author": "Ryan Skinner <hello@ryanskinner.com>",
7
7
  "license": "MIT",
@@ -14,7 +14,7 @@ async function initializeHighlighter(langs: LanguageInput[], themes: ThemeInput[
14
14
  return await createHighlighterCore({
15
15
  langs,
16
16
  themes,
17
- engine,
17
+ engine, // Pass the configured engine
18
18
  })
19
19
  }
20
20
  catch (err) {
@@ -110,26 +110,24 @@ interface Theme {
110
110
  }
111
111
 
112
112
  export function getRNStylesFromShikiStyle(theme: Theme): HighlighterStyleSheet {
113
- if (!theme) {
113
+ if (!theme)
114
114
  return {}
115
- }
116
115
 
117
116
  try {
118
- const styles: HighlighterStyleSheet = {}
119
-
120
- // Convert token colors
121
- if (theme.tokenColors) {
122
- Object.assign(styles, convertTokenColorsToReactStyle(theme.tokenColors))
117
+ // Start with default styles
118
+ const styles: HighlighterStyleSheet = {
119
+ editor: {
120
+ backgroundColor: normalizeColor(theme.colors?.['editor.background']),
121
+ },
122
+ base: {
123
+ color: normalizeColor(theme.colors?.['editor.foreground']),
124
+ },
123
125
  }
124
126
 
125
- // Add theme-specific editor styles
126
- if (theme.colors) {
127
- styles.editor = {
128
- backgroundColor: normalizeColor(theme.colors['editor.background']),
129
- }
130
- styles.base = {
131
- color: normalizeColor(theme.colors['editor.foreground']),
132
- }
127
+ // Process token colors
128
+ if (theme.tokenColors) {
129
+ const tokenStyles = convertTokenColorsToReactStyle(theme.tokenColors)
130
+ Object.assign(styles, tokenStyles)
133
131
  }
134
132
 
135
133
  return styles