@wallarm-org/design-system 4.3.3-rc-fix-WDS-192.1 → 4.3.4
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/dist/components/CodeSnippet/adapters/createShikiHighlighter.d.ts +1 -0
- package/dist/components/CodeSnippet/adapters/createShikiHighlighter.js +52 -0
- package/dist/components/CodeSnippet/adapters/index.d.ts +3 -18
- package/dist/components/CodeSnippet/adapters/index.js +3 -13
- package/dist/components/CodeSnippet/adapters/loadHighlightJsAdapter.d.ts +2 -0
- package/dist/components/CodeSnippet/adapters/loadHighlightJsAdapter.js +5 -0
- package/dist/components/CodeSnippet/adapters/loadPrismAdapter.d.ts +2 -0
- package/dist/components/CodeSnippet/adapters/loadPrismAdapter.js +5 -0
- package/dist/components/CodeSnippet/adapters/loadShikiAdapter.d.ts +2 -0
- package/dist/components/CodeSnippet/adapters/loadShikiAdapter.js +5 -0
- package/dist/components/CodeSnippet/adapters/shiki.js +1 -8
- package/dist/metadata/components.json +5 -5
- package/package.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createShikiHighlighter: () => Promise<import("@shikijs/types").HighlighterCore>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createHighlighterCore } from "shiki/core";
|
|
2
|
+
import { createOnigurumaEngine } from "shiki/engine/oniguruma";
|
|
3
|
+
import bash from "shiki/langs/bash.mjs";
|
|
4
|
+
import c from "shiki/langs/c.mjs";
|
|
5
|
+
import cpp from "shiki/langs/cpp.mjs";
|
|
6
|
+
import css from "shiki/langs/css.mjs";
|
|
7
|
+
import go from "shiki/langs/go.mjs";
|
|
8
|
+
import html from "shiki/langs/html.mjs";
|
|
9
|
+
import http from "shiki/langs/http.mjs";
|
|
10
|
+
import java from "shiki/langs/java.mjs";
|
|
11
|
+
import javascript from "shiki/langs/javascript.mjs";
|
|
12
|
+
import json from "shiki/langs/json.mjs";
|
|
13
|
+
import jsx from "shiki/langs/jsx.mjs";
|
|
14
|
+
import lua from "shiki/langs/lua.mjs";
|
|
15
|
+
import markdown from "shiki/langs/markdown.mjs";
|
|
16
|
+
import python from "shiki/langs/python.mjs";
|
|
17
|
+
import rust from "shiki/langs/rust.mjs";
|
|
18
|
+
import sql from "shiki/langs/sql.mjs";
|
|
19
|
+
import tsx from "shiki/langs/tsx.mjs";
|
|
20
|
+
import typescript from "shiki/langs/typescript.mjs";
|
|
21
|
+
import xml from "shiki/langs/xml.mjs";
|
|
22
|
+
import yaml from "shiki/langs/yaml.mjs";
|
|
23
|
+
import github_light from "shiki/themes/github-light.mjs";
|
|
24
|
+
const createShikiHighlighter = ()=>createHighlighterCore({
|
|
25
|
+
themes: [
|
|
26
|
+
github_light
|
|
27
|
+
],
|
|
28
|
+
langs: [
|
|
29
|
+
javascript,
|
|
30
|
+
typescript,
|
|
31
|
+
jsx,
|
|
32
|
+
tsx,
|
|
33
|
+
bash,
|
|
34
|
+
json,
|
|
35
|
+
html,
|
|
36
|
+
xml,
|
|
37
|
+
css,
|
|
38
|
+
python,
|
|
39
|
+
go,
|
|
40
|
+
sql,
|
|
41
|
+
yaml,
|
|
42
|
+
markdown,
|
|
43
|
+
lua,
|
|
44
|
+
rust,
|
|
45
|
+
java,
|
|
46
|
+
c,
|
|
47
|
+
cpp,
|
|
48
|
+
http
|
|
49
|
+
],
|
|
50
|
+
engine: createOnigurumaEngine(import("shiki/wasm"))
|
|
51
|
+
});
|
|
52
|
+
export { createShikiHighlighter };
|
|
@@ -1,20 +1,5 @@
|
|
|
1
|
+
export { loadHighlightJsAdapter } from './loadHighlightJsAdapter.js';
|
|
2
|
+
export { loadPrismAdapter } from './loadPrismAdapter.js';
|
|
3
|
+
export { loadShikiAdapter } from './loadShikiAdapter.js';
|
|
1
4
|
export { plainAdapter } from './plain.js';
|
|
2
5
|
export type { HighlightJsLanguage, HighlightResult, PlainLanguage, PrismLanguage, ShikiLanguage, SyntaxAdapter, Token, TokenType, } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Lazily load the Prism adapter for syntax highlighting.
|
|
5
|
-
* Lightweight, good for most use cases.
|
|
6
|
-
* Bundle size: ~15KB gzipped
|
|
7
|
-
*/
|
|
8
|
-
export declare const loadPrismAdapter: () => Promise<import("./types.js").SyntaxAdapter<import("./types.js").PrismLanguage>>;
|
|
9
|
-
/**
|
|
10
|
-
* Lazily load the Shiki adapter for syntax highlighting.
|
|
11
|
-
* High-quality highlighting with VS Code themes, supports more languages.
|
|
12
|
-
* Bundle size: ~200KB+ gzipped (includes WASM)
|
|
13
|
-
*/
|
|
14
|
-
export declare const loadShikiAdapter: () => Promise<import("./types.js").SyntaxAdapter<import("./types.js").ShikiLanguage>>;
|
|
15
|
-
/**
|
|
16
|
-
* Lazily load the highlight.js adapter for syntax highlighting.
|
|
17
|
-
* Well-established library, good language support.
|
|
18
|
-
* Bundle size: ~30KB gzipped (core + common languages)
|
|
19
|
-
*/
|
|
20
|
-
export declare const loadHighlightJsAdapter: () => Promise<import("./types.js").SyntaxAdapter<import("./types.js").HighlightJsLanguage>>;
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
const loadShikiAdapter = async ()=>{
|
|
6
|
-
const { shikiAdapter } = await import("./shiki.js");
|
|
7
|
-
return shikiAdapter;
|
|
8
|
-
};
|
|
9
|
-
const loadHighlightJsAdapter = async ()=>{
|
|
10
|
-
const { highlightJsAdapter } = await import("./highlightjs.js");
|
|
11
|
-
return highlightJsAdapter;
|
|
12
|
-
};
|
|
1
|
+
export { loadHighlightJsAdapter } from "./loadHighlightJsAdapter.js";
|
|
2
|
+
export { loadPrismAdapter } from "./loadPrismAdapter.js";
|
|
3
|
+
export { loadShikiAdapter } from "./loadShikiAdapter.js";
|
|
13
4
|
export { plainAdapter } from "./plain.js";
|
|
14
|
-
export { loadHighlightJsAdapter, loadPrismAdapter, loadShikiAdapter };
|
|
@@ -44,14 +44,7 @@ function mapScopeToTokenType(scopes) {
|
|
|
44
44
|
return 'plain';
|
|
45
45
|
}
|
|
46
46
|
async function getHighlighter() {
|
|
47
|
-
if (!highlighterPromise) highlighterPromise = import("
|
|
48
|
-
themes: [
|
|
49
|
-
'github-light'
|
|
50
|
-
],
|
|
51
|
-
langs: [
|
|
52
|
-
...SUPPORTED_LANGUAGES
|
|
53
|
-
]
|
|
54
|
-
}));
|
|
47
|
+
if (!highlighterPromise) highlighterPromise = import("./createShikiHighlighter.js").then(({ createShikiHighlighter })=>createShikiHighlighter());
|
|
55
48
|
return highlighterPromise;
|
|
56
49
|
}
|
|
57
50
|
const shikiAdapter = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.3.
|
|
3
|
-
"generatedAt": "2026-10-
|
|
2
|
+
"version": "4.3.3",
|
|
3
|
+
"generatedAt": "2026-10-29T18:31:23.304Z",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
6
6
|
"name": "Accordion",
|
|
@@ -35770,14 +35770,14 @@
|
|
|
35770
35770
|
"code": "import { loadShikiAdapter, CodeSnippetAdapterProvider, CodeSnippetCode, CodeSnippetContent, CodeSnippetLineNumbers, CodeSnippetRoot } from '@wallarm-org/design-system/CodeSnippet';\n\nexport const JSONWithShiki = () => (\n <CodeSnippetAdapterProvider adapter={loadShikiAdapter}>\n <CodeSnippetRoot code={jsonCode} language='json'>\n <CodeSnippetContent>\n <CodeSnippetLineNumbers />\n <CodeSnippetCode />\n </CodeSnippetContent>\n </CodeSnippetRoot>\n </CodeSnippetAdapterProvider>\n);",
|
|
35771
35771
|
"storyFile": "CodeSnippet/CodeSnippet.stories.tsx",
|
|
35772
35772
|
"storyTitle": "Data Display/CodeSnippet/CodeSnippet",
|
|
35773
|
-
"description": "Shiki, supplied through `CodeSnippetAdapterProvider
|
|
35773
|
+
"description": "Shiki, supplied through `CodeSnippetAdapterProvider`, uses VS Code-style grammars.\nThe adapter lazily initializes its supported languages and github-light theme with\nthe Oniguruma WASM engine on the first highlight call."
|
|
35774
35774
|
},
|
|
35775
35775
|
{
|
|
35776
35776
|
"name": "TypescriptWithPrism",
|
|
35777
35777
|
"code": "import { loadPrismAdapter, CodeSnippetAdapterProvider, CodeSnippetCode, CodeSnippetContent, CodeSnippetLineNumbers, CodeSnippetRoot } from '@wallarm-org/design-system/CodeSnippet';\n\nexport const TypescriptWithPrism = () => (\n <CodeSnippetAdapterProvider adapter={loadPrismAdapter}>\n <CodeSnippetRoot code={typescriptCode} language='typescript'>\n <CodeSnippetContent>\n <CodeSnippetLineNumbers />\n <CodeSnippetCode />\n </CodeSnippetContent>\n </CodeSnippetRoot>\n </CodeSnippetAdapterProvider>\n);",
|
|
35778
35778
|
"storyFile": "CodeSnippet/CodeSnippet.stories.tsx",
|
|
35779
35779
|
"storyTitle": "Data Display/CodeSnippet/CodeSnippet",
|
|
35780
|
-
"description": "Prism
|
|
35780
|
+
"description": "TypeScript highlighted with Prism. Its loader emits only the Prism adapter's\ndependencies; unused Shiki and highlight.js loaders are discarded by the consumer."
|
|
35781
35781
|
},
|
|
35782
35782
|
{
|
|
35783
35783
|
"name": "BashWithPrism",
|
|
@@ -35791,7 +35791,7 @@
|
|
|
35791
35791
|
"code": "import { loadHighlightJsAdapter, CodeSnippetAdapterProvider, CodeSnippetCode, CodeSnippetContent, CodeSnippetLineNumbers, CodeSnippetRoot } from '@wallarm-org/design-system/CodeSnippet';\n\nexport const HTMLWithHighlightJs = () => (\n <CodeSnippetAdapterProvider adapter={loadHighlightJsAdapter}>\n <CodeSnippetRoot code={htmlCode} language='html'>\n <CodeSnippetContent>\n <CodeSnippetLineNumbers />\n <CodeSnippetCode />\n </CodeSnippetContent>\n </CodeSnippetRoot>\n </CodeSnippetAdapterProvider>\n);",
|
|
35792
35792
|
"storyFile": "CodeSnippet/CodeSnippet.stories.tsx",
|
|
35793
35793
|
"storyTitle": "Data Display/CodeSnippet/CodeSnippet",
|
|
35794
|
-
"description": "highlight.js
|
|
35794
|
+
"description": "HTML highlighted with highlight.js. The adapter loads the library lazily and\nexposes the languages listed by its getSupportedLanguages() method."
|
|
35795
35795
|
},
|
|
35796
35796
|
{
|
|
35797
35797
|
"name": "HTTPRequestWithPrism",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wallarm-org/design-system",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.4",
|
|
4
4
|
"description": "Core design system library with React components and Storybook documentation",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"test": "rstest watch",
|
|
75
75
|
"test:coverage": "rstest run --coverage",
|
|
76
76
|
"test:run": "rstest run",
|
|
77
|
+
"test:bundles": "tsx scripts/check-code-snippet-bundles.ts",
|
|
77
78
|
"storybook": "storybook dev --no-open -p 6006",
|
|
78
79
|
"build-storybook": "storybook build",
|
|
79
80
|
"e2e": "playwright test",
|