rn-shiki 0.0.37-3 → 0.0.37-30
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/commonjs/components/syntax/SyntaxHighlighter.js +100 -60
- package/lib/commonjs/components/syntax/SyntaxHighlighter.js.map +1 -1
- package/lib/commonjs/hooks/useSyntaxHighlighter.js +18 -10
- package/lib/commonjs/hooks/useSyntaxHighlighter.js.map +1 -1
- package/lib/commonjs/index.js +0 -23
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/syntax/{highlighter/index.js → highlighter.js} +20 -10
- package/lib/commonjs/syntax/highlighter.js.map +1 -0
- package/lib/commonjs/utils/style-transformer.js +103 -0
- package/lib/commonjs/utils/style-transformer.js.map +1 -0
- package/lib/module/components/syntax/SyntaxHighlighter.js +100 -61
- package/lib/module/components/syntax/SyntaxHighlighter.js.map +1 -1
- package/lib/module/hooks/useSyntaxHighlighter.js +17 -9
- package/lib/module/hooks/useSyntaxHighlighter.js.map +1 -1
- package/lib/module/index.js +1 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/syntax/highlighter.js +44 -0
- package/lib/module/syntax/highlighter.js.map +1 -0
- package/lib/module/utils/style-transformer.js +98 -0
- package/lib/module/utils/style-transformer.js.map +1 -0
- package/lib/typescript/components/syntax/SyntaxHighlighter.d.ts +2 -10
- package/lib/typescript/components/syntax/SyntaxHighlighter.d.ts.map +1 -1
- package/lib/typescript/hooks/useSyntaxHighlighter.d.ts +3 -2
- package/lib/typescript/hooks/useSyntaxHighlighter.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -3
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/syntax/{highlighter/index.d.ts → highlighter.d.ts} +3 -4
- package/lib/typescript/syntax/highlighter.d.ts.map +1 -0
- package/lib/typescript/types/shiki.d.ts +10 -8
- package/lib/typescript/types/shiki.d.ts.map +1 -1
- package/lib/typescript/utils/string.d.ts +1 -1
- package/lib/typescript/utils/string.d.ts.map +1 -1
- package/lib/typescript/utils/style-transformer.d.ts +9 -0
- package/lib/typescript/utils/style-transformer.d.ts.map +1 -0
- package/package.json +2 -6
- package/src/components/syntax/SyntaxHighlighter.tsx +79 -36
- package/src/hooks/useSyntaxHighlighter.ts +13 -4
- package/src/index.ts +1 -4
- package/src/syntax/{highlighter/index.ts → highlighter.ts} +22 -10
- package/src/types/shiki.ts +7 -8
- package/src/utils/string.ts +1 -1
- package/src/utils/style-transformer.ts +50 -94
- package/lib/commonjs/components/syntax/SyntaxLine.js +0 -36
- package/lib/commonjs/components/syntax/SyntaxLine.js.map +0 -1
- package/lib/commonjs/components/syntax/index.js +0 -21
- package/lib/commonjs/components/syntax/index.js.map +0 -1
- package/lib/commonjs/syntax/highlighter/index.js.map +0 -1
- package/lib/commonjs/syntax/index.js +0 -19
- package/lib/commonjs/syntax/index.js.map +0 -1
- package/lib/commonjs/types/index.js +0 -2
- package/lib/commonjs/types/index.js.map +0 -1
- package/lib/commonjs/types/shiki.d.js +0 -6
- package/lib/commonjs/types/shiki.d.js.map +0 -1
- package/lib/commonjs/utils/index.js +0 -17
- package/lib/commonjs/utils/index.js.map +0 -1
- package/lib/module/components/syntax/SyntaxLine.js +0 -31
- package/lib/module/components/syntax/SyntaxLine.js.map +0 -1
- package/lib/module/components/syntax/index.js +0 -5
- package/lib/module/components/syntax/index.js.map +0 -1
- package/lib/module/syntax/highlighter/index.js +0 -34
- package/lib/module/syntax/highlighter/index.js.map +0 -1
- package/lib/module/syntax/index.js +0 -4
- package/lib/module/syntax/index.js.map +0 -1
- package/lib/module/types/index.js +0 -2
- package/lib/module/types/index.js.map +0 -1
- package/lib/module/types/shiki.d.js +0 -4
- package/lib/module/types/shiki.d.js.map +0 -1
- package/lib/module/utils/index.js +0 -4
- package/lib/module/utils/index.js.map +0 -1
- package/lib/typescript/components/syntax/SyntaxLine.d.ts +0 -9
- package/lib/typescript/components/syntax/SyntaxLine.d.ts.map +0 -1
- package/lib/typescript/components/syntax/index.d.ts +0 -3
- package/lib/typescript/components/syntax/index.d.ts.map +0 -1
- package/lib/typescript/syntax/highlighter/index.d.ts.map +0 -1
- package/lib/typescript/syntax/index.d.ts +0 -2
- package/lib/typescript/syntax/index.d.ts.map +0 -1
- package/lib/typescript/types/index.d.ts +0 -7
- package/lib/typescript/types/index.d.ts.map +0 -1
- package/lib/typescript/utils/index.d.ts +0 -2
- package/lib/typescript/utils/index.d.ts.map +0 -1
- package/src/components/syntax/SyntaxLine.tsx +0 -81
- package/src/components/syntax/index.ts +0 -2
- package/src/syntax/index.ts +0 -1
- package/src/types/index.ts +0 -6
- package/src/utils/index.ts +0 -1
@@ -4,76 +4,116 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
var _react =
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
8
8
|
var _reactNative = require("react-native");
|
9
|
-
var _typescript = _interopRequireDefault(require("shiki/langs/typescript.mjs"));
|
10
|
-
var _githubDark = _interopRequireDefault(require("shiki/themes/github-dark.mjs"));
|
11
9
|
var _useSyntaxHighlighter = require("../../hooks/useSyntaxHighlighter");
|
10
|
+
var _styleTransformer = require("../../utils/style-transformer");
|
12
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
13
|
-
function
|
14
|
-
function
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
14
|
+
const monospaceFont = _reactNative.Platform.select({
|
15
|
+
ios: 'Menlo',
|
16
|
+
android: 'monospace',
|
17
|
+
default: 'monospace'
|
18
|
+
});
|
19
|
+
// Helper function to extract theme registration from Shiki theme input
|
20
|
+
function getThemeRegistration(theme) {
|
21
|
+
if ('default' in theme) {
|
22
|
+
return theme.default;
|
23
|
+
}
|
24
|
+
return theme;
|
25
|
+
}
|
26
|
+
const baseStyles = _reactNative.StyleSheet.create({
|
27
|
+
scrollView: {
|
28
|
+
flex: 1,
|
29
|
+
minHeight: 20
|
30
|
+
},
|
31
|
+
lineContainer: {
|
32
|
+
flexDirection: 'row',
|
33
|
+
flexWrap: 'wrap',
|
34
|
+
paddingHorizontal: 16,
|
35
|
+
paddingVertical: 8
|
36
|
+
},
|
37
|
+
token: {
|
38
|
+
fontFamily: monospaceFont,
|
39
|
+
fontSize: 14
|
40
|
+
},
|
41
|
+
container: {
|
42
|
+
flex: 1
|
43
|
+
}
|
44
|
+
});
|
45
|
+
const SyntaxHighlighter = ({
|
15
46
|
text,
|
16
|
-
|
17
|
-
|
18
|
-
theme
|
19
|
-
|
20
|
-
|
21
|
-
|
47
|
+
language,
|
48
|
+
languageId,
|
49
|
+
theme,
|
50
|
+
fontSize = 14
|
51
|
+
}) => {
|
52
|
+
const stylesheet = (0, _react.useMemo)(() => {
|
53
|
+
const themeRegistration = getThemeRegistration(theme);
|
54
|
+
const styles = (0, _styleTransformer.getRNStylesFromShikiStyle)(themeRegistration);
|
55
|
+
return _reactNative.StyleSheet.create({
|
56
|
+
...styles,
|
57
|
+
editor: {
|
58
|
+
backgroundColor: themeRegistration.colors?.['editor.background'] || '#1e1e1e'
|
59
|
+
},
|
60
|
+
token: {
|
61
|
+
...baseStyles.token,
|
62
|
+
fontSize,
|
63
|
+
color: themeRegistration.colors?.['editor.foreground'] || '#d4d4d4'
|
64
|
+
}
|
65
|
+
});
|
66
|
+
}, [theme, fontSize]);
|
22
67
|
const {
|
23
|
-
tokens
|
24
|
-
error,
|
25
|
-
isLoading
|
68
|
+
tokens
|
26
69
|
} = (0, _useSyntaxHighlighter.useSyntaxHighlighter)({
|
27
70
|
text,
|
28
|
-
|
29
|
-
|
30
|
-
theme
|
31
|
-
themeName
|
71
|
+
language,
|
72
|
+
languageId,
|
73
|
+
theme
|
32
74
|
});
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
75
|
+
const renderToken = (token, index, lineIndex) => {
|
76
|
+
const styles = [stylesheet.token];
|
77
|
+
|
78
|
+
// Add token-specific styles from stylesheet based on scope
|
79
|
+
const tokenScopes = Array.isArray(token.scope) ? token.scope : [token.scope];
|
80
|
+
tokenScopes.forEach(scope => {
|
81
|
+
if (stylesheet[scope]) {
|
82
|
+
styles.push(stylesheet[scope]);
|
83
|
+
}
|
41
84
|
});
|
42
|
-
|
43
|
-
|
85
|
+
|
86
|
+
// Add token-specific styles from the token itself
|
87
|
+
const tokenStyles = {};
|
88
|
+
if (token.color) {
|
89
|
+
tokenStyles.color = token.color;
|
90
|
+
}
|
91
|
+
if (token.fontStyle === 'italic') {
|
92
|
+
tokenStyles.fontStyle = 'italic';
|
93
|
+
}
|
94
|
+
if (token.fontWeight === 'bold') {
|
95
|
+
tokenStyles.fontWeight = 'bold';
|
96
|
+
}
|
97
|
+
if (Object.keys(tokenStyles).length > 0) {
|
98
|
+
styles.push(tokenStyles);
|
99
|
+
}
|
100
|
+
const finalStyle = _reactNative.StyleSheet.flatten(styles);
|
44
101
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
45
|
-
style:
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
}
|
53
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
children: [line.map((token, tokenIndex) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
60
|
-
style: {
|
61
|
-
color: token.color || '#FFFFFF',
|
62
|
-
fontFamily: 'monospace',
|
63
|
-
fontSize,
|
64
|
-
fontStyle: token.fontStyle
|
65
|
-
},
|
66
|
-
children: token.content.replace(/ /g, '\u00A0')
|
67
|
-
}, `${lineIndex}-${tokenIndex}`)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
68
|
-
style: {
|
69
|
-
color: '#FFFFFF',
|
70
|
-
fontFamily: 'monospace',
|
71
|
-
fontSize
|
72
|
-
},
|
73
|
-
children: '\n'
|
74
|
-
})]
|
75
|
-
}, `line-${lineIndex}`))
|
102
|
+
style: finalStyle,
|
103
|
+
children: token.content.replace(/ /g, '\u00A0')
|
104
|
+
}, `${lineIndex}-${index}`);
|
105
|
+
};
|
106
|
+
const renderLine = (line, lineIndex) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
107
|
+
style: baseStyles.lineContainer,
|
108
|
+
children: line.map((token, tokenIndex) => renderToken(token, tokenIndex, lineIndex))
|
109
|
+
}, lineIndex);
|
110
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
111
|
+
horizontal: true,
|
112
|
+
showsHorizontalScrollIndicator: _reactNative.Platform.OS !== 'web',
|
113
|
+
style: [baseStyles.scrollView, stylesheet.editor],
|
114
|
+
contentContainerStyle: baseStyles.container,
|
115
|
+
children: tokens.map((line, index) => renderLine(line, index))
|
76
116
|
});
|
77
|
-
}
|
117
|
+
};
|
78
118
|
var _default = exports.default = SyntaxHighlighter;
|
79
119
|
//# sourceMappingURL=SyntaxHighlighter.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_useSyntaxHighlighter","_styleTransformer","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","monospaceFont","Platform","select","ios","android","getThemeRegistration","theme","baseStyles","StyleSheet","create","scrollView","flex","minHeight","lineContainer","flexDirection","flexWrap","paddingHorizontal","paddingVertical","token","fontFamily","fontSize","container","SyntaxHighlighter","text","language","languageId","stylesheet","useMemo","themeRegistration","styles","getRNStylesFromShikiStyle","editor","backgroundColor","colors","color","tokens","useSyntaxHighlighter","renderToken","index","lineIndex","tokenScopes","Array","isArray","scope","forEach","push","tokenStyles","fontStyle","fontWeight","keys","length","finalStyle","flatten","jsx","Text","style","children","content","replace","renderLine","line","View","map","tokenIndex","ScrollView","horizontal","showsHorizontalScrollIndicator","OS","contentContainerStyle","_default","exports"],"sourceRoot":"../../../../src","sources":["components/syntax/SyntaxHighlighter.tsx"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAAyE,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,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AAM;IAACZ,KAAK,EAAE,CAAChD,UAAU,CAACG,UAAU,EAAEgB,UAAU,CAACK,MAAM,CAAE;IAACqC,qBAAqB,EAAE7D,UAAU,CAACc,SAAU;IAAAmC,QAAA,EAC1KrB,MAAM,CAAC2B,GAAG,CAAC,CAACF,IAAI,EAAEtB,KAAK,KAAKqB,UAAU,CAACC,IAAI,EAAEtB,KAAK,CAAC;EAAC,CAC3C,CAAC;AAEjB,CAAC;AAAA,IAAA+B,QAAA,GAAAC,OAAA,CAAApF,OAAA,GAEcoC,iBAAiB","ignoreList":[]}
|
@@ -5,13 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.useSyntaxHighlighter = useSyntaxHighlighter;
|
7
7
|
var _react = require("react");
|
8
|
-
var
|
8
|
+
var _highlighter = require("../syntax/highlighter");
|
9
9
|
function useSyntaxHighlighter({
|
10
10
|
text,
|
11
|
-
|
12
|
-
|
13
|
-
theme
|
14
|
-
themeName
|
11
|
+
language,
|
12
|
+
languageId,
|
13
|
+
theme
|
15
14
|
}) {
|
16
15
|
const [tokens, setTokens] = (0, _react.useState)([]);
|
17
16
|
const [error, setError] = (0, _react.useState)();
|
@@ -26,13 +25,22 @@ function useSyntaxHighlighter({
|
|
26
25
|
return;
|
27
26
|
}
|
28
27
|
try {
|
29
|
-
|
30
|
-
|
28
|
+
// First create the highlighter
|
29
|
+
const highlighter = await (0, _highlighter.createHighlighter)({
|
30
|
+
langs: [language],
|
31
31
|
themes: [theme]
|
32
32
|
});
|
33
|
+
|
34
|
+
// Get resolved theme name
|
35
|
+
const themeResolved = highlighter.getLoadedThemes()?.[0];
|
36
|
+
if (!themeResolved) {
|
37
|
+
throw new Error('Failed to resolve theme');
|
38
|
+
}
|
39
|
+
|
40
|
+
// Use resolved theme for tokenization
|
33
41
|
const result = highlighter.codeToTokens(text, {
|
34
|
-
lang:
|
35
|
-
theme:
|
42
|
+
lang: languageId,
|
43
|
+
theme: themeResolved
|
36
44
|
});
|
37
45
|
if (mounted && result.tokens) {
|
38
46
|
setTokens(result.tokens);
|
@@ -54,7 +62,7 @@ function useSyntaxHighlighter({
|
|
54
62
|
return () => {
|
55
63
|
mounted = false;
|
56
64
|
};
|
57
|
-
}, [text,
|
65
|
+
}, [text, language, languageId, theme]);
|
58
66
|
return {
|
59
67
|
tokens,
|
60
68
|
error,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","require","
|
1
|
+
{"version":3,"names":["_react","require","_highlighter","useSyntaxHighlighter","text","language","languageId","theme","tokens","setTokens","useState","error","setError","isLoading","setIsLoading","useEffect","mounted","highlight","highlighter","createHighlighter","langs","themes","themeResolved","getLoadedThemes","Error","result","codeToTokens","lang","undefined","err","console","message"],"sourceRoot":"../../../src","sources":["hooks/useSyntaxHighlighter.ts"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEO,SAASE,oBAAoBA,CAAC;EAAEC,IAAI;EAAEC,QAAQ;EAAEC,UAAU;EAAEC;AAA8B,CAAC,EAAE;EAClG,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAG,IAAAC,eAAQ,EAAkB,EAAE,CAAC;EACzD,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAF,eAAQ,EAAS,CAAC;EAC5C,MAAM,CAACG,SAAS,EAAEC,YAAY,CAAC,GAAG,IAAAJ,eAAQ,EAAC,IAAI,CAAC;EAEhD,IAAAK,gBAAS,EAAC,MAAM;IACd,IAAIC,OAAO,GAAG,IAAI;IAClBF,YAAY,CAAC,IAAI,CAAC;IAElB,eAAeG,SAASA,CAAA,EAAG;MACzB,IAAI,CAACb,IAAI,EAAE;QACTU,YAAY,CAAC,KAAK,CAAC;QACnBL,SAAS,CAAC,EAAE,CAAC;QACb;MACF;MAEA,IAAI;QACF;QACA,MAAMS,WAAW,GAAG,MAAM,IAAAC,8BAAiB,EAAC;UAC1CC,KAAK,EAAE,CAACf,QAAQ,CAAC;UACjBgB,MAAM,EAAE,CAACd,KAAK;QAChB,CAAC,CAAC;;QAEF;QACA,MAAMe,aAAa,GAAGJ,WAAW,CAACK,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC;QACxD,IAAI,CAACD,aAAa,EAAE;UAClB,MAAM,IAAIE,KAAK,CAAC,yBAAyB,CAAC;QAC5C;;QAEA;QACA,MAAMC,MAAM,GAAGP,WAAW,CAACQ,YAAY,CAACtB,IAAI,EAAE;UAC5CuB,IAAI,EAAErB,UAAU;UAChBC,KAAK,EAAEe;QACT,CAAC,CAAiB;QAElB,IAAIN,OAAO,IAAIS,MAAM,CAACjB,MAAM,EAAE;UAC5BC,SAAS,CAACgB,MAAM,CAACjB,MAAM,CAAC;UACxBI,QAAQ,CAACgB,SAAS,CAAC;QACrB;MACF,CAAC,CACD,OAAOC,GAAG,EAAE;QACVC,OAAO,CAACnB,KAAK,CAAC,qBAAqB,EAAEkB,GAAG,CAAC;QACzC,IAAIb,OAAO,EAAE;UACXJ,QAAQ,CAACiB,GAAG,YAAYL,KAAK,GAAGK,GAAG,CAACE,OAAO,GAAG,4BAA4B,CAAC;UAC3EtB,SAAS,CAAC,EAAE,CAAC;QACf;MACF,CAAC,SACO;QACN,IAAIO,OAAO,EAAE;UACXF,YAAY,CAAC,KAAK,CAAC;QACrB;MACF;IACF;IAEAG,SAAS,CAAC,CAAC;IACX,OAAO,MAAM;MACXD,OAAO,GAAG,KAAK;IACjB,CAAC;EACH,CAAC,EAAE,CAACZ,IAAI,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,KAAK,CAAC,CAAC;EAEvC,OAAO;IAAEC,MAAM;IAAEG,KAAK;IAAEE;EAAU,CAAC;AACrC","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
@@ -3,35 +3,12 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
var _exportNames = {
|
7
|
-
SyntaxHighlighter: true,
|
8
|
-
SyntaxLine: true
|
9
|
-
};
|
10
6
|
Object.defineProperty(exports, "SyntaxHighlighter", {
|
11
7
|
enumerable: true,
|
12
8
|
get: function () {
|
13
9
|
return _SyntaxHighlighter.default;
|
14
10
|
}
|
15
11
|
});
|
16
|
-
Object.defineProperty(exports, "SyntaxLine", {
|
17
|
-
enumerable: true,
|
18
|
-
get: function () {
|
19
|
-
return _SyntaxLine.default;
|
20
|
-
}
|
21
|
-
});
|
22
12
|
var _SyntaxHighlighter = _interopRequireDefault(require("./components/syntax/SyntaxHighlighter"));
|
23
|
-
var _SyntaxLine = _interopRequireDefault(require("./components/syntax/SyntaxLine"));
|
24
|
-
var _shiki = require("./types/shiki");
|
25
|
-
Object.keys(_shiki).forEach(function (key) {
|
26
|
-
if (key === "default" || key === "__esModule") return;
|
27
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
28
|
-
if (key in exports && exports[key] === _shiki[key]) return;
|
29
|
-
Object.defineProperty(exports, key, {
|
30
|
-
enumerable: true,
|
31
|
-
get: function () {
|
32
|
-
return _shiki[key];
|
33
|
-
}
|
34
|
-
});
|
35
|
-
});
|
36
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
37
14
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_SyntaxHighlighter","_interopRequireDefault","require","
|
1
|
+
{"version":3,"names":["_SyntaxHighlighter","_interopRequireDefault","require","e","__esModule","default"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAqE,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
@@ -5,21 +5,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.createHighlighter = createHighlighter;
|
7
7
|
exports.processTokens = processTokens;
|
8
|
-
var _core = require("shiki/core");
|
9
|
-
var
|
8
|
+
var _core = require("shiki/dist/core.mjs");
|
9
|
+
var _engineJavascript = require("shiki/dist/engine-javascript.mjs");
|
10
|
+
const engine = (0, _engineJavascript.createJavaScriptRegexEngine)({
|
11
|
+
forgiving: true,
|
12
|
+
simulation: true,
|
13
|
+
cache: new Map()
|
14
|
+
});
|
10
15
|
async function initializeHighlighter(langs, themes) {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
+
try {
|
17
|
+
return await (0, _core.createHighlighterCore)({
|
18
|
+
langs,
|
19
|
+
themes,
|
20
|
+
engine // Pass the configured engine
|
21
|
+
});
|
22
|
+
} catch (err) {
|
23
|
+
console.error('Error initializing highlighter:', err);
|
24
|
+
throw err;
|
25
|
+
}
|
16
26
|
}
|
17
27
|
async function createHighlighter({
|
18
28
|
langs,
|
19
29
|
themes
|
20
30
|
}) {
|
21
|
-
if (!langs?.length
|
22
|
-
throw new Error('Please provide
|
31
|
+
if (!langs?.length) {
|
32
|
+
throw new Error('Please provide languages when creating a highlighter.');
|
23
33
|
}
|
24
34
|
try {
|
25
35
|
const highlighter = await initializeHighlighter(langs, themes);
|
@@ -36,4 +46,4 @@ function processTokens(tokens) {
|
|
36
46
|
fontStyle: token.fontStyle?.toString()
|
37
47
|
}));
|
38
48
|
}
|
39
|
-
//# sourceMappingURL=
|
49
|
+
//# sourceMappingURL=highlighter.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_core","require","_engineJavascript","engine","createJavaScriptRegexEngine","forgiving","simulation","cache","Map","initializeHighlighter","langs","themes","createHighlighterCore","err","console","error","createHighlighter","length","Error","highlighter","processTokens","tokens","map","token","content","color","fontStyle","toString"],"sourceRoot":"../../../src","sources":["syntax/highlighter.ts"],"mappings":";;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAA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
|
6
|
+
exports.convertTokenColorsToReactStyle = convertTokenColorsToReactStyle;
|
7
|
+
exports.getRNStylesFromShikiStyle = getRNStylesFromShikiStyle;
|
8
|
+
function hexToRgb(hex) {
|
9
|
+
// Remove # if present
|
10
|
+
hex = hex.replace(/^#/, '');
|
11
|
+
|
12
|
+
// Handle both 3 and 6 digit hex
|
13
|
+
if (hex.length === 3) {
|
14
|
+
hex = `${hex[0]}${hex[0]}${hex[1]}${hex[1]}${hex[2]}${hex[2]}`;
|
15
|
+
}
|
16
|
+
const result = /^([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
17
|
+
return result ? {
|
18
|
+
r: Number.parseInt(result[1], 16),
|
19
|
+
g: Number.parseInt(result[2], 16),
|
20
|
+
b: Number.parseInt(result[3], 16)
|
21
|
+
} : null;
|
22
|
+
}
|
23
|
+
function normalizeColor(color) {
|
24
|
+
if (!color) return 'transparent';
|
25
|
+
|
26
|
+
// Handle hex colors
|
27
|
+
if (color.startsWith('#')) {
|
28
|
+
const rgb = hexToRgb(color);
|
29
|
+
if (rgb) {
|
30
|
+
return `rgb(${rgb.r}, ${rgb.g}, ${rgb.b})`;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
return color;
|
34
|
+
}
|
35
|
+
function convertTokenColorsToReactStyle(tokenColors) {
|
36
|
+
if (!tokenColors) return {};
|
37
|
+
const styleMap = {};
|
38
|
+
tokenColors.forEach(token => {
|
39
|
+
if (!token.settings) return;
|
40
|
+
|
41
|
+
// Handle global theme settings
|
42
|
+
if (!token.scope) {
|
43
|
+
styleMap.default = {
|
44
|
+
color: normalizeColor(token.settings.foreground),
|
45
|
+
backgroundColor: normalizeColor(token.settings.background)
|
46
|
+
};
|
47
|
+
return;
|
48
|
+
}
|
49
|
+
const scopes = Array.isArray(token.scope) ? token.scope : [token.scope];
|
50
|
+
const style = {};
|
51
|
+
if (token.settings.foreground) {
|
52
|
+
style.color = normalizeColor(token.settings.foreground);
|
53
|
+
}
|
54
|
+
if (token.settings.background) {
|
55
|
+
style.backgroundColor = normalizeColor(token.settings.background);
|
56
|
+
}
|
57
|
+
if (token.settings.fontStyle) {
|
58
|
+
if (token.settings.fontStyle.includes('italic')) {
|
59
|
+
style.fontStyle = 'italic';
|
60
|
+
}
|
61
|
+
if (token.settings.fontStyle.includes('bold')) {
|
62
|
+
style.fontWeight = 'bold';
|
63
|
+
}
|
64
|
+
}
|
65
|
+
scopes.forEach(scope => {
|
66
|
+
styleMap[scope] = {
|
67
|
+
...(styleMap[scope] || {}),
|
68
|
+
...style
|
69
|
+
};
|
70
|
+
});
|
71
|
+
});
|
72
|
+
return styleMap;
|
73
|
+
}
|
74
|
+
function getRNStylesFromShikiStyle(theme) {
|
75
|
+
if (!theme) return {};
|
76
|
+
try {
|
77
|
+
const styles = {
|
78
|
+
editor: {
|
79
|
+
backgroundColor: normalizeColor(theme.colors?.['editor.background'])
|
80
|
+
},
|
81
|
+
base: {
|
82
|
+
color: normalizeColor(theme.colors?.['editor.foreground'])
|
83
|
+
}
|
84
|
+
};
|
85
|
+
|
86
|
+
// Process token colors
|
87
|
+
if (theme.tokenColors) {
|
88
|
+
const tokenStyles = convertTokenColorsToReactStyle(theme.tokenColors);
|
89
|
+
Object.assign(styles, tokenStyles);
|
90
|
+
}
|
91
|
+
return styles;
|
92
|
+
} catch {
|
93
|
+
return {
|
94
|
+
editor: {
|
95
|
+
backgroundColor: '#1e1e1e'
|
96
|
+
},
|
97
|
+
base: {
|
98
|
+
color: '#d4d4d4'
|
99
|
+
}
|
100
|
+
};
|
101
|
+
}
|
102
|
+
}
|
103
|
+
//# sourceMappingURL=style-transformer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["hexToRgb","hex","replace","length","result","exec","r","Number","parseInt","g","b","normalizeColor","color","startsWith","rgb","convertTokenColorsToReactStyle","tokenColors","styleMap","forEach","token","settings","scope","default","foreground","backgroundColor","background","scopes","Array","isArray","style","fontStyle","includes","fontWeight","getRNStylesFromShikiStyle","theme","styles","editor","colors","base","tokenStyles","Object","assign"],"sourceRoot":"../../../src","sources":["utils/style-transformer.ts"],"mappings":";;;;;;;AASA,SAASA,QAAQA,CAACC,GAAW,EAA8C;EACzE;EACAA,GAAG,GAAGA,GAAG,CAACC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;;EAE3B;EACA,IAAID,GAAG,CAACE,MAAM,KAAK,CAAC,EAAE;IACpBF,GAAG,GAAG,GAAGA,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG,CAAC,CAAC,CAAC,EAAE;EAChE;EAEA,MAAMG,MAAM,GAAG,yCAAyC,CAACC,IAAI,CAACJ,GAAG,CAAC;EAClE,OAAOG,MAAM,GACT;IACEE,CAAC,EAAEC,MAAM,CAACC,QAAQ,CAACJ,MAAM,CAAC,CAAC,CAAC,EAAG,EAAE,CAAC;IAClCK,CAAC,EAAEF,MAAM,CAACC,QAAQ,CAACJ,MAAM,CAAC,CAAC,CAAC,EAAG,EAAE,CAAC;IAClCM,CAAC,EAAEH,MAAM,CAACC,QAAQ,CAACJ,MAAM,CAAC,CAAC,CAAC,EAAG,EAAE;EACnC,CAAC,GACD,IAAI;AACV;AAEA,SAASO,cAAcA,CAACC,KAAyB,EAAU;EACzD,IAAI,CAACA,KAAK,EACR,OAAO,aAAa;;EAEtB;EACA,IAAIA,KAAK,CAACC,UAAU,CAAC,GAAG,CAAC,EAAE;IACzB,MAAMC,GAAG,GAAGd,QAAQ,CAACY,KAAK,CAAC;IAC3B,IAAIE,GAAG,EAAE;MACP,OAAO,OAAOA,GAAG,CAACR,CAAC,KAAKQ,GAAG,CAACL,CAAC,KAAKK,GAAG,CAACJ,CAAC,GAAG;IAC5C;EACF;EAEA,OAAOE,KAAK;AACd;AAEO,SAASG,8BAA8BA,CAAC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