@buildkitgg/shadcn-baseui-sera 0.0.0-stage → 0.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.
Files changed (148) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +21 -0
  3. package/README.md +19 -2
  4. package/dist/hooks/use-highlighted-code.d.ts +2 -0
  5. package/dist/hooks/use-highlighted-code.js +49 -0
  6. package/dist/hooks/use-mobile.d.ts +1 -0
  7. package/dist/hooks/use-mobile.js +15 -0
  8. package/dist/index.d.ts +68 -0
  9. package/dist/index.js +69 -0
  10. package/dist/lib/highlighter.d.ts +9 -0
  11. package/dist/lib/highlighter.js +90 -0
  12. package/dist/lib/utils.d.ts +1 -0
  13. package/dist/lib/utils.js +1 -0
  14. package/dist/styles-no-reset.css +2 -0
  15. package/dist/styles.css +2 -0
  16. package/dist/styles.d.ts +1 -0
  17. package/dist/styles.js +1 -0
  18. package/dist/tokens.json +575 -0
  19. package/dist/ui/accordion.d.ts +6 -0
  20. package/dist/ui/accordion.js +17 -0
  21. package/dist/ui/alert-dialog.d.ts +18 -0
  22. package/dist/ui/alert-dialog.js +42 -0
  23. package/dist/ui/alert.d.ts +10 -0
  24. package/dist/ui/alert.js +27 -0
  25. package/dist/ui/aspect-ratio.d.ts +4 -0
  26. package/dist/ui/aspect-ratio.js +8 -0
  27. package/dist/ui/attachment.d.ts +23 -0
  28. package/dist/ui/attachment.js +68 -0
  29. package/dist/ui/avatar.d.ts +11 -0
  30. package/dist/ui/avatar.js +23 -0
  31. package/dist/ui/badge.d.ts +7 -0
  32. package/dist/ui/badge.js +33 -0
  33. package/dist/ui/breadcrumb.d.ts +10 -0
  34. package/dist/ui/breadcrumb.js +36 -0
  35. package/dist/ui/bubble.d.ts +16 -0
  36. package/dist/ui/bubble.js +59 -0
  37. package/dist/ui/button-group.d.ts +10 -0
  38. package/dist/ui/button-group.js +36 -0
  39. package/dist/ui/button.d.ts +8 -0
  40. package/dist/ui/button.js +34 -0
  41. package/dist/ui/calendar.d.ts +10 -0
  42. package/dist/ui/calendar.js +76 -0
  43. package/dist/ui/card.d.ts +11 -0
  44. package/dist/ui/card.js +24 -0
  45. package/dist/ui/carousel.d.ts +28 -0
  46. package/dist/ui/carousel.js +91 -0
  47. package/dist/ui/chart.d.ts +44 -0
  48. package/dist/ui/chart.js +132 -0
  49. package/dist/ui/checkbox.d.ts +3 -0
  50. package/dist/ui/checkbox.js +9 -0
  51. package/dist/ui/code-block.d.ts +26 -0
  52. package/dist/ui/code-block.js +80 -0
  53. package/dist/ui/collapsible.d.ts +5 -0
  54. package/dist/ui/collapsible.js +13 -0
  55. package/dist/ui/combobox.d.ts +24 -0
  56. package/dist/ui/combobox.js +58 -0
  57. package/dist/ui/command.d.ts +19 -0
  58. package/dist/ui/command.js +35 -0
  59. package/dist/ui/context-menu.d.ts +29 -0
  60. package/dist/ui/context-menu.js +51 -0
  61. package/dist/ui/dialog.d.ts +17 -0
  62. package/dist/ui/dialog.js +37 -0
  63. package/dist/ui/direction.d.ts +1 -0
  64. package/dist/ui/direction.js +2 -0
  65. package/dist/ui/drawer.d.ts +16 -0
  66. package/dist/ui/drawer.js +75 -0
  67. package/dist/ui/dropdown-menu.d.ts +29 -0
  68. package/dist/ui/dropdown-menu.js +51 -0
  69. package/dist/ui/empty.d.ts +11 -0
  70. package/dist/ui/empty.js +33 -0
  71. package/dist/ui/field.d.ts +24 -0
  72. package/dist/ui/field.js +68 -0
  73. package/dist/ui/hover-card.d.ts +5 -0
  74. package/dist/ui/hover-card.js +14 -0
  75. package/dist/ui/input-group.d.ts +18 -0
  76. package/dist/ui/input-group.js +57 -0
  77. package/dist/ui/input-otp.d.ts +11 -0
  78. package/dist/ui/input-otp.js +21 -0
  79. package/dist/ui/input.d.ts +3 -0
  80. package/dist/ui/input.js +7 -0
  81. package/dist/ui/item.d.ts +22 -0
  82. package/dist/ui/item.js +78 -0
  83. package/dist/ui/kbd.d.ts +3 -0
  84. package/dist/ui/kbd.js +9 -0
  85. package/dist/ui/label.d.ts +3 -0
  86. package/dist/ui/label.js +7 -0
  87. package/dist/ui/marker.d.ts +10 -0
  88. package/dist/ui/marker.js +34 -0
  89. package/dist/ui/menubar.d.ts +29 -0
  90. package/dist/ui/menubar.js +56 -0
  91. package/dist/ui/message-scroller.d.ts +10 -0
  92. package/dist/ui/message-scroller.js +25 -0
  93. package/dist/ui/message.d.ts +10 -0
  94. package/dist/ui/message.js +21 -0
  95. package/dist/ui/native-select.d.ts +8 -0
  96. package/dist/ui/native-select.js +13 -0
  97. package/dist/ui/navigation-menu.d.ts +11 -0
  98. package/dist/ui/navigation-menu.js +31 -0
  99. package/dist/ui/pagination.d.ts +17 -0
  100. package/dist/ui/pagination.js +26 -0
  101. package/dist/ui/popover.d.ts +9 -0
  102. package/dist/ui/popover.js +23 -0
  103. package/dist/ui/progress.d.ts +7 -0
  104. package/dist/ui/progress.js +20 -0
  105. package/dist/ui/questionnaire.d.ts +19 -0
  106. package/dist/ui/questionnaire.js +52 -0
  107. package/dist/ui/radio-group.d.ts +5 -0
  108. package/dist/ui/radio-group.js +12 -0
  109. package/dist/ui/resizable.d.ts +7 -0
  110. package/dist/ui/resizable.js +14 -0
  111. package/dist/ui/scroll-area.d.ts +5 -0
  112. package/dist/ui/scroll-area.js +11 -0
  113. package/dist/ui/select.d.ts +15 -0
  114. package/dist/ui/select.js +34 -0
  115. package/dist/ui/separator.d.ts +3 -0
  116. package/dist/ui/separator.js +8 -0
  117. package/dist/ui/sheet.d.ts +14 -0
  118. package/dist/ui/sheet.js +37 -0
  119. package/dist/ui/sidebar.d.ts +63 -0
  120. package/dist/ui/sidebar.js +256 -0
  121. package/dist/ui/skeleton.d.ts +2 -0
  122. package/dist/ui/skeleton.js +6 -0
  123. package/dist/ui/slider.d.ts +3 -0
  124. package/dist/ui/slider.js +12 -0
  125. package/dist/ui/sonner.d.ts +3 -0
  126. package/dist/ui/sonner.js +25 -0
  127. package/dist/ui/spinner.d.ts +2 -0
  128. package/dist/ui/spinner.js +7 -0
  129. package/dist/ui/switch.d.ts +5 -0
  130. package/dist/ui/switch.js +8 -0
  131. package/dist/ui/table.d.ts +10 -0
  132. package/dist/ui/table.js +28 -0
  133. package/dist/ui/tabs.d.ts +10 -0
  134. package/dist/ui/tabs.js +29 -0
  135. package/dist/ui/textarea.d.ts +3 -0
  136. package/dist/ui/textarea.js +6 -0
  137. package/dist/ui/toast.d.ts +16 -0
  138. package/dist/ui/toast.js +66 -0
  139. package/dist/ui/toggle-group.d.ts +11 -0
  140. package/dist/ui/toggle-group.js +24 -0
  141. package/dist/ui/toggle.d.ts +8 -0
  142. package/dist/ui/toggle.js +26 -0
  143. package/dist/ui/tooltip.d.ts +6 -0
  144. package/dist/ui/tooltip.js +17 -0
  145. package/dist/ui/trace.d.ts +18 -0
  146. package/dist/ui/trace.js +29 -0
  147. package/package.json +74 -3
  148. package/upstream.json +72 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # Change Log - @buildkitgg/shadcn-baseui-sera
2
+
3
+ <!-- This log was last generated on Thu, 22 Oct 2026 20:48:38 GMT and should not be manually modified. -->
4
+
5
+ <!-- Start content -->
6
+
7
+ ## 0.2.0
8
+
9
+ Thu, 22 Oct 2026 20:48:38 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - Generate upstream Base UI style packages with a shared public API, dependency alias support, and derived token
14
+ metadata. (41898282+github-actions[bot]@users.noreply.github.com)
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 shadcn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,20 @@
1
- # Temporary Holding Version
1
+ # @buildkitgg/shadcn-baseui-sera
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Generated from the pinned upstream shadcn Base UI catalog. Do not edit generated components.
4
+
5
+ Select this style once using a dependency alias:
6
+
7
+ ```sh
8
+ pnpm add @buildkitgg/shadcn-baseui-kit@npm:@buildkitgg/shadcn-baseui-sera
9
+ ```
10
+
11
+ ```tsx
12
+ import { Button } from "@buildkitgg/shadcn-baseui-kit"
13
+ import "@buildkitgg/shadcn-baseui-kit/styles.css"
14
+ ```
15
+
16
+ Buildkit's shadcn managers use the same peer dependency and inherit this selection. Import styles once at the app entry.
17
+ Use `styles-no-reset.css` when the app already supplies Tailwind's reset. Colors and light/dark mode remain customizable
18
+ through CSS variables. Style selection is installation-time, not runtime.
19
+
20
+ [Setup, maintenance, and release checks](https://github.com/AndrewCraswell/buildkit/blob/main/docs/shadcn/styles.md).
@@ -0,0 +1,2 @@
1
+ import * as React from "react";
2
+ export declare function useHighlightedCode(value: string, language: string): (string | number | bigint | boolean | React.JSX.Element[] | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | Iterable<React.ReactNode> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | null | undefined> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null | undefined)[];
@@ -0,0 +1,49 @@
1
+ import * as React from "react";
2
+ import { loadHighlighter } from "../lib/highlighter.js";
3
+ export function useHighlightedCode(value, language) {
4
+ // A trailing newline would render as an extra empty line.
5
+ const code = value.endsWith("\n") ? value.slice(0, -1) : value;
6
+ const [loaded, setLoaded] = React.useState(null);
7
+ const highlighter = loaded?.language === language ? loaded.highlighter : null;
8
+ React.useEffect(() => {
9
+ let cancelled = false;
10
+ loadHighlighter(language)
11
+ .then((next) => {
12
+ if (!cancelled) {
13
+ setLoaded({ language, highlighter: next });
14
+ }
15
+ })
16
+ .catch(() => { });
17
+ return () => {
18
+ cancelled = true;
19
+ };
20
+ }, [language]);
21
+ // The complete lines, highlighted. While the code streams, only the new
22
+ // lines are tokenized, starting from the grammar state of the last one.
23
+ const [done, setDone] = React.useState({ highlighter: null, text: "", lines: [] });
24
+ let next = done;
25
+ if (next.highlighter !== highlighter || !code.startsWith(next.text)) {
26
+ next = { highlighter, text: "", lines: [] };
27
+ }
28
+ const end = code.lastIndexOf("\n") + 1;
29
+ if (highlighter && end > next.text.length) {
30
+ const result = highlighter.highlight(code.slice(next.text.length, end - 1), next.state);
31
+ next = {
32
+ highlighter,
33
+ text: code.slice(0, end),
34
+ lines: [...next.lines, ...result.lines],
35
+ state: result.state,
36
+ };
37
+ }
38
+ if (next !== done) {
39
+ setDone(next);
40
+ }
41
+ // The last line is still being written, so it is tokenized on every render.
42
+ const tail = code.slice(end);
43
+ return React.useMemo(() => {
44
+ if (!highlighter) {
45
+ return code.split("\n");
46
+ }
47
+ return [...next.lines, highlighter.highlight(tail, next.state).lines[0]];
48
+ }, [code, highlighter, next, tail]);
49
+ }
@@ -0,0 +1 @@
1
+ export declare function useIsMobile(): boolean;
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+ const MOBILE_BREAKPOINT = 768;
3
+ export function useIsMobile() {
4
+ const [isMobile, setIsMobile] = React.useState(undefined);
5
+ React.useEffect(() => {
6
+ const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
7
+ const onChange = () => {
8
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
9
+ };
10
+ mql.addEventListener("change", onChange);
11
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
12
+ return () => mql.removeEventListener("change", onChange);
13
+ }, []);
14
+ return !!isMobile;
15
+ }
@@ -0,0 +1,68 @@
1
+ export * from "./hooks/use-highlighted-code.js";
2
+ export * from "./hooks/use-mobile.js";
3
+ export * from "./lib/highlighter.js";
4
+ export * from "./lib/utils.js";
5
+ export * from "./ui/accordion.js";
6
+ export * from "./ui/alert-dialog.js";
7
+ export * from "./ui/alert.js";
8
+ export * from "./ui/aspect-ratio.js";
9
+ export * from "./ui/attachment.js";
10
+ export * from "./ui/avatar.js";
11
+ export * from "./ui/badge.js";
12
+ export * from "./ui/breadcrumb.js";
13
+ export * from "./ui/bubble.js";
14
+ export * from "./ui/button-group.js";
15
+ export * from "./ui/button.js";
16
+ export * from "./ui/calendar.js";
17
+ export * from "./ui/card.js";
18
+ export * from "./ui/carousel.js";
19
+ export * from "./ui/chart.js";
20
+ export * from "./ui/checkbox.js";
21
+ export * from "./ui/code-block.js";
22
+ export * from "./ui/collapsible.js";
23
+ export * from "./ui/combobox.js";
24
+ export * from "./ui/command.js";
25
+ export * from "./ui/context-menu.js";
26
+ export * from "./ui/dialog.js";
27
+ export * from "./ui/direction.js";
28
+ export * from "./ui/drawer.js";
29
+ export * from "./ui/dropdown-menu.js";
30
+ export * from "./ui/empty.js";
31
+ export * from "./ui/field.js";
32
+ export * from "./ui/hover-card.js";
33
+ export * from "./ui/input-group.js";
34
+ export * from "./ui/input-otp.js";
35
+ export * from "./ui/input.js";
36
+ export * from "./ui/item.js";
37
+ export * from "./ui/kbd.js";
38
+ export * from "./ui/label.js";
39
+ export * from "./ui/marker.js";
40
+ export * from "./ui/menubar.js";
41
+ export * from "./ui/message-scroller.js";
42
+ export * from "./ui/message.js";
43
+ export * from "./ui/native-select.js";
44
+ export * from "./ui/navigation-menu.js";
45
+ export * from "./ui/pagination.js";
46
+ export * from "./ui/popover.js";
47
+ export * from "./ui/progress.js";
48
+ export * from "./ui/questionnaire.js";
49
+ export * from "./ui/radio-group.js";
50
+ export * from "./ui/resizable.js";
51
+ export * from "./ui/scroll-area.js";
52
+ export * from "./ui/select.js";
53
+ export * from "./ui/separator.js";
54
+ export * from "./ui/sheet.js";
55
+ export * from "./ui/sidebar.js";
56
+ export * from "./ui/skeleton.js";
57
+ export * from "./ui/slider.js";
58
+ export { Toaster as SonnerToaster } from "./ui/sonner.js";
59
+ export * from "./ui/spinner.js";
60
+ export * from "./ui/switch.js";
61
+ export * from "./ui/table.js";
62
+ export * from "./ui/tabs.js";
63
+ export * from "./ui/textarea.js";
64
+ export * from "./ui/toast.js";
65
+ export * from "./ui/toggle-group.js";
66
+ export * from "./ui/toggle.js";
67
+ export * from "./ui/tooltip.js";
68
+ export * from "./ui/trace.js";
package/dist/index.js ADDED
@@ -0,0 +1,69 @@
1
+ "use client";
2
+ export * from "./hooks/use-highlighted-code.js";
3
+ export * from "./hooks/use-mobile.js";
4
+ export * from "./lib/highlighter.js";
5
+ export * from "./lib/utils.js";
6
+ export * from "./ui/accordion.js";
7
+ export * from "./ui/alert-dialog.js";
8
+ export * from "./ui/alert.js";
9
+ export * from "./ui/aspect-ratio.js";
10
+ export * from "./ui/attachment.js";
11
+ export * from "./ui/avatar.js";
12
+ export * from "./ui/badge.js";
13
+ export * from "./ui/breadcrumb.js";
14
+ export * from "./ui/bubble.js";
15
+ export * from "./ui/button-group.js";
16
+ export * from "./ui/button.js";
17
+ export * from "./ui/calendar.js";
18
+ export * from "./ui/card.js";
19
+ export * from "./ui/carousel.js";
20
+ export * from "./ui/chart.js";
21
+ export * from "./ui/checkbox.js";
22
+ export * from "./ui/code-block.js";
23
+ export * from "./ui/collapsible.js";
24
+ export * from "./ui/combobox.js";
25
+ export * from "./ui/command.js";
26
+ export * from "./ui/context-menu.js";
27
+ export * from "./ui/dialog.js";
28
+ export * from "./ui/direction.js";
29
+ export * from "./ui/drawer.js";
30
+ export * from "./ui/dropdown-menu.js";
31
+ export * from "./ui/empty.js";
32
+ export * from "./ui/field.js";
33
+ export * from "./ui/hover-card.js";
34
+ export * from "./ui/input-group.js";
35
+ export * from "./ui/input-otp.js";
36
+ export * from "./ui/input.js";
37
+ export * from "./ui/item.js";
38
+ export * from "./ui/kbd.js";
39
+ export * from "./ui/label.js";
40
+ export * from "./ui/marker.js";
41
+ export * from "./ui/menubar.js";
42
+ export * from "./ui/message-scroller.js";
43
+ export * from "./ui/message.js";
44
+ export * from "./ui/native-select.js";
45
+ export * from "./ui/navigation-menu.js";
46
+ export * from "./ui/pagination.js";
47
+ export * from "./ui/popover.js";
48
+ export * from "./ui/progress.js";
49
+ export * from "./ui/questionnaire.js";
50
+ export * from "./ui/radio-group.js";
51
+ export * from "./ui/resizable.js";
52
+ export * from "./ui/scroll-area.js";
53
+ export * from "./ui/select.js";
54
+ export * from "./ui/separator.js";
55
+ export * from "./ui/sheet.js";
56
+ export * from "./ui/sidebar.js";
57
+ export * from "./ui/skeleton.js";
58
+ export * from "./ui/slider.js";
59
+ export { Toaster as SonnerToaster } from "./ui/sonner.js";
60
+ export * from "./ui/spinner.js";
61
+ export * from "./ui/switch.js";
62
+ export * from "./ui/table.js";
63
+ export * from "./ui/tabs.js";
64
+ export * from "./ui/textarea.js";
65
+ export * from "./ui/toast.js";
66
+ export * from "./ui/toggle-group.js";
67
+ export * from "./ui/toggle.js";
68
+ export * from "./ui/tooltip.js";
69
+ export * from "./ui/trace.js";
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ import { type GrammarState } from "shiki/core";
3
+ export declare function loadHighlighter(language: string): Promise<{
4
+ highlight(code: string, state?: GrammarState): {
5
+ lines: React.JSX.Element[][];
6
+ state: GrammarState | undefined;
7
+ };
8
+ } | null>;
9
+ export declare function highlightCode(code: string, language: string): Promise<React.JSX.Element[][] | null>;
@@ -0,0 +1,90 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createHighlighterCore, } from "shiki/core";
3
+ import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
4
+ // Add the languages you need. Each one loads the first time it is used.
5
+ const languages = {
6
+ bash: () => import("shiki/langs/shellscript.mjs"),
7
+ css: () => import("shiki/langs/css.mjs"),
8
+ diff: () => import("shiki/langs/diff.mjs"),
9
+ html: () => import("shiki/langs/html.mjs"),
10
+ javascript: () => import("shiki/langs/javascript.mjs"),
11
+ json: () => import("shiki/langs/json.mjs"),
12
+ jsx: () => import("shiki/langs/jsx.mjs"),
13
+ markdown: () => import("shiki/langs/markdown.mjs"),
14
+ python: () => import("shiki/langs/python.mjs"),
15
+ sql: () => import("shiki/langs/sql.mjs"),
16
+ tsx: () => import("shiki/langs/tsx.mjs"),
17
+ typescript: () => import("shiki/langs/typescript.mjs"),
18
+ yaml: () => import("shiki/langs/yaml.mjs"),
19
+ };
20
+ const aliases = {
21
+ js: "javascript",
22
+ md: "markdown",
23
+ py: "python",
24
+ sh: "bash",
25
+ shell: "bash",
26
+ shellscript: "bash",
27
+ ts: "typescript",
28
+ yml: "yaml",
29
+ zsh: "bash",
30
+ };
31
+ let highlighter;
32
+ function getHighlighter() {
33
+ highlighter ??= createHighlighterCore({
34
+ themes: [
35
+ import("shiki/themes/github-light.mjs"),
36
+ import("shiki/themes/github-dark.mjs"),
37
+ ],
38
+ langs: [],
39
+ engine: createJavaScriptRegexEngine({ forgiving: true }),
40
+ });
41
+ return highlighter;
42
+ }
43
+ function getLanguage(language) {
44
+ const name = language.toLowerCase();
45
+ if (name === "ansi") {
46
+ return name;
47
+ }
48
+ if (name in languages) {
49
+ return name;
50
+ }
51
+ return aliases[name] ?? null;
52
+ }
53
+ // Loads a language and returns a highlighter for it, or null for a language
54
+ // that is not listed.
55
+ export async function loadHighlighter(language) {
56
+ const lang = getLanguage(language);
57
+ if (!lang) {
58
+ return null;
59
+ }
60
+ const shiki = await getHighlighter();
61
+ if (lang !== "ansi" && !shiki.getLoadedLanguages().includes(lang)) {
62
+ await shiki.loadLanguage(languages[lang]);
63
+ }
64
+ return {
65
+ // Returns one React node per line, and the grammar state after the last
66
+ // line. Pass that state back to continue where the code left off.
67
+ highlight(code, state) {
68
+ const tokenize = (text) => shiki.codeToTokens(text, {
69
+ lang,
70
+ themes: { light: "github-light", dark: "github-dark" },
71
+ defaultColor: false,
72
+ grammarState: state,
73
+ }).tokens;
74
+ // ANSI has no grammar state, so each line is tokenized on its own and
75
+ // gets the same colors whether it arrives in one piece or streams.
76
+ const tokens = lang === "ansi"
77
+ ? code.split("\n").flatMap((line) => tokenize(line))
78
+ : tokenize(code);
79
+ return {
80
+ lines: tokens.map((line) => line.map((token, index) => (_jsx("span", { style: token.htmlStyle, className: "text-(--shiki-light) dark:text-(--shiki-dark)", children: token.content }, index)))),
81
+ state: shiki.getLastGrammarState(tokens),
82
+ };
83
+ },
84
+ };
85
+ }
86
+ // Returns one React node per line, or null for a language that is not listed.
87
+ export async function highlightCode(code, language) {
88
+ const highlighter = await loadHighlighter(language);
89
+ return highlighter ? highlighter.highlight(code).lines : null;
90
+ }
@@ -0,0 +1 @@
1
+ export { cn } from "cn";
@@ -0,0 +1 @@
1
+ export { cn } from "cn";