@bergetai/ui 0.21.0 → 0.22.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.
- package/dist/components/markdown/Markdown.cjs +169 -0
- package/dist/components/markdown/Markdown.cjs.map +1 -0
- package/dist/components/markdown/Markdown.d.cts +10 -0
- package/dist/components/markdown/Markdown.d.cts.map +1 -0
- package/dist/components/markdown/Markdown.d.mts +10 -0
- package/dist/components/markdown/Markdown.d.mts.map +1 -0
- package/dist/components/markdown/Markdown.mjs +167 -0
- package/dist/components/markdown/Markdown.mjs.map +1 -0
- package/dist/components/markdown/MarkdownCodeBlock.cjs +25 -0
- package/dist/components/markdown/MarkdownCodeBlock.cjs.map +1 -0
- package/dist/components/markdown/MarkdownCodeBlock.d.cts +12 -0
- package/dist/components/markdown/MarkdownCodeBlock.d.cts.map +1 -0
- package/dist/components/markdown/MarkdownCodeBlock.d.mts +12 -0
- package/dist/components/markdown/MarkdownCodeBlock.d.mts.map +1 -0
- package/dist/components/markdown/MarkdownCodeBlock.mjs +25 -0
- package/dist/components/markdown/MarkdownCodeBlock.mjs.map +1 -0
- package/dist/components/markdown/index.d.cts +3 -0
- package/dist/components/markdown/index.d.mts +3 -0
- package/dist/index.cjs +4 -0
- package/dist/index.d.cts +4 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.mjs +3 -1
- package/package.json +2 -1
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_utils = require("../../lib/utils.cjs");
|
|
4
|
+
const require_MarkdownCodeBlock = require("./MarkdownCodeBlock.cjs");
|
|
5
|
+
let react = require("react");
|
|
6
|
+
react = require_runtime.__toESM(react, 1);
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let streamdown = require("streamdown");
|
|
9
|
+
//#region src/components/markdown/Markdown.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Markdown renderer for chat/UI text, built on Streamdown (incomplete-markdown
|
|
12
|
+
* repair during streaming, GFM tables, rehype-sanitize + rehype-harden).
|
|
13
|
+
*
|
|
14
|
+
* Streamdown ships its own Tailwind classes inside its dist files, which
|
|
15
|
+
* consumers' Tailwind builds never scan — so every element is given a full
|
|
16
|
+
* Berget class set here instead of relying on the defaults. Utility classes
|
|
17
|
+
* used below live in this package's own dist, which the shipped `@source`
|
|
18
|
+
* covers for all consumers.
|
|
19
|
+
*
|
|
20
|
+
* Code highlighting reuses the package CodeBlock family and the shared Shiki
|
|
21
|
+
* highlighter (Berget CSS-variable theme). Mermaid/KaTeX are intentionally
|
|
22
|
+
* not enabled.
|
|
23
|
+
*/
|
|
24
|
+
const bergetComponents = {
|
|
25
|
+
h1: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.defaultComponents.h1, {
|
|
26
|
+
...props,
|
|
27
|
+
className: `
|
|
28
|
+
mt-4 mb-2 text-lg font-semibold
|
|
29
|
+
`
|
|
30
|
+
}),
|
|
31
|
+
h2: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.defaultComponents.h2, {
|
|
32
|
+
...props,
|
|
33
|
+
className: `
|
|
34
|
+
mt-4 mb-2 text-base font-semibold
|
|
35
|
+
`
|
|
36
|
+
}),
|
|
37
|
+
h3: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.defaultComponents.h3, {
|
|
38
|
+
...props,
|
|
39
|
+
className: `
|
|
40
|
+
mt-3 mb-1.5 text-sm font-semibold
|
|
41
|
+
`
|
|
42
|
+
}),
|
|
43
|
+
h4: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.defaultComponents.h4, {
|
|
44
|
+
...props,
|
|
45
|
+
className: `
|
|
46
|
+
mt-3 mb-1.5 text-sm font-semibold
|
|
47
|
+
`
|
|
48
|
+
}),
|
|
49
|
+
h5: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.defaultComponents.h5, {
|
|
50
|
+
...props,
|
|
51
|
+
className: `
|
|
52
|
+
mt-3 mb-1.5 text-sm font-semibold
|
|
53
|
+
`
|
|
54
|
+
}),
|
|
55
|
+
h6: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.defaultComponents.h6, {
|
|
56
|
+
...props,
|
|
57
|
+
className: `
|
|
58
|
+
mt-3 mb-1.5 text-sm font-semibold
|
|
59
|
+
`
|
|
60
|
+
}),
|
|
61
|
+
p: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.defaultComponents.p, {
|
|
62
|
+
...props,
|
|
63
|
+
className: `
|
|
64
|
+
my-2
|
|
65
|
+
first:mt-0
|
|
66
|
+
last:mb-0
|
|
67
|
+
`
|
|
68
|
+
}),
|
|
69
|
+
ul: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.defaultComponents.ul, {
|
|
70
|
+
...props,
|
|
71
|
+
className: `
|
|
72
|
+
my-2 ms-5 list-disc space-y-1
|
|
73
|
+
marker:text-berget-muted-foreground
|
|
74
|
+
`
|
|
75
|
+
}),
|
|
76
|
+
ol: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.defaultComponents.ol, {
|
|
77
|
+
...props,
|
|
78
|
+
className: `
|
|
79
|
+
my-2 ms-5 list-decimal space-y-1
|
|
80
|
+
`
|
|
81
|
+
}),
|
|
82
|
+
li: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.defaultComponents.li, {
|
|
83
|
+
...props,
|
|
84
|
+
className: `leading-relaxed`
|
|
85
|
+
}),
|
|
86
|
+
del: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("del", {
|
|
87
|
+
...props,
|
|
88
|
+
className: `line-through`
|
|
89
|
+
}),
|
|
90
|
+
em: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("em", {
|
|
91
|
+
...props,
|
|
92
|
+
className: `italic`
|
|
93
|
+
}),
|
|
94
|
+
blockquote: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.defaultComponents.blockquote, {
|
|
95
|
+
...props,
|
|
96
|
+
className: `
|
|
97
|
+
my-3 border-berget-border ps-3 text-berget-muted-foreground italic
|
|
98
|
+
`
|
|
99
|
+
}),
|
|
100
|
+
hr: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.defaultComponents.hr, {
|
|
101
|
+
...props,
|
|
102
|
+
className: `
|
|
103
|
+
my-4 border-berget-border
|
|
104
|
+
`
|
|
105
|
+
}),
|
|
106
|
+
img: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.defaultComponents.img, {
|
|
107
|
+
...props,
|
|
108
|
+
className: `my-3 max-w-full rounded-berget-xs border-berget-border`
|
|
109
|
+
}),
|
|
110
|
+
a: ({ node: _node, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
111
|
+
...props,
|
|
112
|
+
target: "_blank",
|
|
113
|
+
rel: "noopener noreferrer nofollow",
|
|
114
|
+
className: `text-berget-primary underline underline-offset-2`
|
|
115
|
+
}),
|
|
116
|
+
code: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.defaultComponents.code, {
|
|
117
|
+
...props,
|
|
118
|
+
className: `
|
|
119
|
+
rounded-berget-xs bg-muted px-1.5 py-0.5 font-mono text-[0.85em]
|
|
120
|
+
`
|
|
121
|
+
}),
|
|
122
|
+
pre: ({ children }) => {
|
|
123
|
+
if (react.isValidElement(children)) {
|
|
124
|
+
const { className, children: code } = children.props;
|
|
125
|
+
const language = /language-([\w+-]+)/.exec(className ?? "")?.[1] ?? "text";
|
|
126
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownCodeBlock.MarkdownCodeBlock, {
|
|
127
|
+
code: String(code ?? ""),
|
|
128
|
+
language
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
|
|
132
|
+
},
|
|
133
|
+
table: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
134
|
+
className: `
|
|
135
|
+
my-3 max-w-full overflow-x-auto rounded-berget-xs border-berget-border
|
|
136
|
+
`,
|
|
137
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("table", {
|
|
138
|
+
...props,
|
|
139
|
+
className: `w-full border-collapse text-sm`
|
|
140
|
+
})
|
|
141
|
+
}),
|
|
142
|
+
thead: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.defaultComponents.thead, {
|
|
143
|
+
...props,
|
|
144
|
+
className: `bg-muted/50`
|
|
145
|
+
}),
|
|
146
|
+
th: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.defaultComponents.th, {
|
|
147
|
+
...props,
|
|
148
|
+
className: `border-b-berget-border px-3 py-1.5 text-start font-semibold`
|
|
149
|
+
}),
|
|
150
|
+
td: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.defaultComponents.td, {
|
|
151
|
+
...props,
|
|
152
|
+
className: `
|
|
153
|
+
border-b-berget-border px-3 py-1.5
|
|
154
|
+
`
|
|
155
|
+
})
|
|
156
|
+
};
|
|
157
|
+
function Markdown({ className, ...props }) {
|
|
158
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.Streamdown, {
|
|
159
|
+
...props,
|
|
160
|
+
dir: "ltr",
|
|
161
|
+
components: bergetComponents,
|
|
162
|
+
className: require_utils.cn("text-caption/relaxed text-berget-foreground", className)
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
Markdown.displayName = "Markdown";
|
|
166
|
+
//#endregion
|
|
167
|
+
exports.Markdown = Markdown;
|
|
168
|
+
|
|
169
|
+
//# sourceMappingURL=Markdown.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Markdown.cjs","names":["defaultComponents","React","MarkdownCodeBlock","Streamdown","cn"],"sources":["../../../src/components/markdown/Markdown.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Streamdown, defaultComponents, type Components, type StreamdownProps } from 'streamdown';\nimport { cn } from '../../lib/utils';\nimport { MarkdownCodeBlock } from './MarkdownCodeBlock';\n\n/**\n * Markdown renderer for chat/UI text, built on Streamdown (incomplete-markdown\n * repair during streaming, GFM tables, rehype-sanitize + rehype-harden).\n *\n * Streamdown ships its own Tailwind classes inside its dist files, which\n * consumers' Tailwind builds never scan — so every element is given a full\n * Berget class set here instead of relying on the defaults. Utility classes\n * used below live in this package's own dist, which the shipped `@source`\n * covers for all consumers.\n *\n * Code highlighting reuses the package CodeBlock family and the shared Shiki\n * highlighter (Berget CSS-variable theme). Mermaid/KaTeX are intentionally\n * not enabled.\n */\nconst bergetComponents: Components = {\n h1: (props) => (\n <defaultComponents.h1\n {...props}\n className={`\n mt-4 mb-2 text-lg font-semibold\n `}\n />\n ),\n h2: (props) => (\n <defaultComponents.h2\n {...props}\n className={`\n mt-4 mb-2 text-base font-semibold\n `}\n />\n ),\n h3: (props) => (\n <defaultComponents.h3\n {...props}\n className={`\n mt-3 mb-1.5 text-sm font-semibold\n `}\n />\n ),\n h4: (props) => (\n <defaultComponents.h4\n {...props}\n className={`\n mt-3 mb-1.5 text-sm font-semibold\n `}\n />\n ),\n h5: (props) => (\n <defaultComponents.h5\n {...props}\n className={`\n mt-3 mb-1.5 text-sm font-semibold\n `}\n />\n ),\n h6: (props) => (\n <defaultComponents.h6\n {...props}\n className={`\n mt-3 mb-1.5 text-sm font-semibold\n `}\n />\n ),\n p: (props) => (\n <defaultComponents.p\n {...props}\n className={`\n my-2\n first:mt-0\n last:mb-0\n `}\n />\n ),\n ul: (props) => (\n <defaultComponents.ul\n {...props}\n className={`\n my-2 ms-5 list-disc space-y-1\n marker:text-berget-muted-foreground\n `}\n />\n ),\n ol: (props) => (\n <defaultComponents.ol\n {...props}\n className={`\n my-2 ms-5 list-decimal space-y-1\n `}\n />\n ),\n li: (props) => <defaultComponents.li {...props} className={`leading-relaxed`} />,\n del: (props) => <del {...props} className={`line-through`} />,\n em: (props) => <em {...props} className={`italic`} />,\n blockquote: (props) => (\n <defaultComponents.blockquote\n {...props}\n className={`\n my-3 border-berget-border ps-3 text-berget-muted-foreground italic\n `}\n />\n ),\n hr: (props) => (\n <defaultComponents.hr\n {...props}\n className={`\n my-4 border-berget-border\n `}\n />\n ),\n img: (props) => (\n <defaultComponents.img\n {...props}\n className={`my-3 max-w-full rounded-berget-xs border-berget-border`}\n />\n ),\n // Real anchor, not Streamdown's default <button>: links must keep href\n // semantics (middle-click, new tab). Hardening attrs are added explicitly\n // since rehype-harden can only act on real anchors.\n a: ({ node: _node, ...props }) => (\n <a\n {...props}\n target=\"_blank\"\n rel=\"noopener noreferrer nofollow\"\n className={`text-berget-primary underline underline-offset-2`}\n />\n ),\n // Inline code only — fenced blocks are consumed by the `pre` override below.\n code: (props) => (\n <defaultComponents.code\n {...props}\n className={`\n rounded-berget-xs bg-muted px-1.5 py-0.5 font-mono text-[0.85em]\n `}\n />\n ),\n // Fenced / indented code: derive code + language from the child code\n // element and render with the package CodeBlock (highlighting included).\n pre: ({ children }) => {\n if (React.isValidElement(children)) {\n const { className, children: code } = children.props as {\n className?: string;\n children?: React.ReactNode;\n };\n const language = /language-([\\w+-]+)/.exec(className ?? '')?.[1] ?? 'text';\n return <MarkdownCodeBlock code={String(code ?? '')} language={language} />;\n }\n return <>{children}</>;\n },\n table: (props) => (\n <div\n className={`\n my-3 max-w-full overflow-x-auto rounded-berget-xs border-berget-border\n `}\n >\n <table {...props} className={`w-full border-collapse text-sm`} />\n </div>\n ),\n thead: (props) => <defaultComponents.thead {...props} className={`bg-muted/50`} />,\n th: (props) => (\n <defaultComponents.th\n {...props}\n className={`border-b-berget-border px-3 py-1.5 text-start font-semibold`}\n />\n ),\n td: (props) => (\n <defaultComponents.td\n {...props}\n className={`\n border-b-berget-border px-3 py-1.5\n `}\n />\n ),\n};\n\ntype MarkdownProps = Omit<StreamdownProps, 'components' | 'plugins' | 'dir' | 'prefix'>;\nexport type { MarkdownProps };\n\nexport function Markdown({ className, ...props }: MarkdownProps) {\n return (\n <Streamdown\n {...props}\n dir=\"ltr\"\n components={bergetComponents}\n className={cn('text-caption/relaxed text-berget-foreground', className)}\n />\n );\n}\n\nMarkdown.displayName = 'Markdown';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,mBAA+B;CACnC,KAAK,UACH,iBAAA,GAAA,kBAAA,IAAA,CAACA,WAAAA,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,KAAK,UACH,iBAAA,GAAA,kBAAA,IAAA,CAACA,WAAAA,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,KAAK,UACH,iBAAA,GAAA,kBAAA,IAAA,CAACA,WAAAA,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,KAAK,UACH,iBAAA,GAAA,kBAAA,IAAA,CAACA,WAAAA,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,KAAK,UACH,iBAAA,GAAA,kBAAA,IAAA,CAACA,WAAAA,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,KAAK,UACH,iBAAA,GAAA,kBAAA,IAAA,CAACA,WAAAA,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,IAAI,UACF,iBAAA,GAAA,kBAAA,IAAA,CAACA,WAAAA,kBAAkB,GAAnB;EACE,GAAI;EACJ,WAAW;;;;;CAKZ,CAAA;CAEH,KAAK,UACH,iBAAA,GAAA,kBAAA,IAAA,CAACA,WAAAA,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;;CAIZ,CAAA;CAEH,KAAK,UACH,iBAAA,GAAA,kBAAA,IAAA,CAACA,WAAAA,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,KAAK,UAAU,iBAAA,GAAA,kBAAA,IAAA,CAACA,WAAAA,kBAAkB,IAAnB;EAAsB,GAAI;EAAO,WAAW;CAAoB,CAAA;CAC/E,MAAM,UAAU,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,GAAI;EAAO,WAAW;CAAiB,CAAA;CAC5D,KAAK,UAAU,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;EAAI,GAAI;EAAO,WAAW;CAAW,CAAA;CACpD,aAAa,UACX,iBAAA,GAAA,kBAAA,IAAA,CAACA,WAAAA,kBAAkB,YAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,KAAK,UACH,iBAAA,GAAA,kBAAA,IAAA,CAACA,WAAAA,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,MAAM,UACJ,iBAAA,GAAA,kBAAA,IAAA,CAACA,WAAAA,kBAAkB,KAAnB;EACE,GAAI;EACJ,WAAW;CACZ,CAAA;CAKH,IAAI,EAAE,MAAM,OAAO,GAAG,YACpB,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;EACE,GAAI;EACJ,QAAO;EACP,KAAI;EACJ,WAAW;CACZ,CAAA;CAGH,OAAO,UACL,iBAAA,GAAA,kBAAA,IAAA,CAACA,WAAAA,kBAAkB,MAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAIH,MAAM,EAAE,eAAe;EACrB,IAAIC,MAAM,eAAe,QAAQ,GAAG;GAClC,MAAM,EAAE,WAAW,UAAU,SAAS,SAAS;GAI/C,MAAM,WAAW,qBAAqB,KAAK,aAAa,EAAE,CAAC,GAAG,MAAM;GACpE,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,0BAAAA,mBAAD;IAAmB,MAAM,OAAO,QAAQ,EAAE;IAAa;GAAW,CAAA;EAC3E;EACA,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAA,kBAAA,UAAA,EAAG,SAAW,CAAA;CACvB;CACA,QAAQ,UACN,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,WAAW;;;EAIX,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAD;GAAO,GAAI;GAAO,WAAW;EAAmC,CAAA;CAC7D,CAAA;CAEP,QAAQ,UAAU,iBAAA,GAAA,kBAAA,IAAA,CAACF,WAAAA,kBAAkB,OAAnB;EAAyB,GAAI;EAAO,WAAW;CAAgB,CAAA;CACjF,KAAK,UACH,iBAAA,GAAA,kBAAA,IAAA,CAACA,WAAAA,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;CACZ,CAAA;CAEH,KAAK,UACH,iBAAA,GAAA,kBAAA,IAAA,CAACA,WAAAA,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;AAEL;AAKA,SAAgB,SAAS,EAAE,WAAW,GAAG,SAAwB;CAC/D,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACG,WAAAA,YAAD;EACE,GAAI;EACJ,KAAI;EACJ,YAAY;EACZ,WAAWC,cAAAA,GAAG,+CAA+C,SAAS;CACvE,CAAA;AAEL;AAEA,SAAS,cAAc"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StreamdownProps } from "streamdown";
|
|
2
|
+
//#region src/components/markdown/Markdown.d.ts
|
|
3
|
+
type MarkdownProps = Omit<StreamdownProps, 'components' | 'plugins' | 'dir' | 'prefix'>;
|
|
4
|
+
export declare function Markdown({ className, ...props }: MarkdownProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare namespace Markdown {
|
|
6
|
+
var displayName: string;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export type { MarkdownProps };
|
|
10
|
+
//# sourceMappingURL=Markdown.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Markdown.d.cts","names":[],"sources":["../../../src/components/markdown/Markdown.tsx"],"mappings":";;KAqLK,gBAAgB,KAAK;wBAGV,WAAW,cAAc,SAAS,4CAAa,IAAA;yBAA/C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StreamdownProps } from "streamdown";
|
|
2
|
+
//#region src/components/markdown/Markdown.d.ts
|
|
3
|
+
type MarkdownProps = Omit<StreamdownProps, 'components' | 'plugins' | 'dir' | 'prefix'>;
|
|
4
|
+
export declare function Markdown({ className, ...props }: MarkdownProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare namespace Markdown {
|
|
6
|
+
var displayName: string;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export type { MarkdownProps };
|
|
10
|
+
//# sourceMappingURL=Markdown.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Markdown.d.mts","names":[],"sources":["../../../src/components/markdown/Markdown.tsx"],"mappings":";;KAqLK,gBAAgB,KAAK;wBAGV,WAAW,cAAc,SAAS,4CAAa,IAAA;yBAA/C"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.mjs";
|
|
3
|
+
import { MarkdownCodeBlock } from "./MarkdownCodeBlock.mjs";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Streamdown, defaultComponents } from "streamdown";
|
|
7
|
+
//#region src/components/markdown/Markdown.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Markdown renderer for chat/UI text, built on Streamdown (incomplete-markdown
|
|
10
|
+
* repair during streaming, GFM tables, rehype-sanitize + rehype-harden).
|
|
11
|
+
*
|
|
12
|
+
* Streamdown ships its own Tailwind classes inside its dist files, which
|
|
13
|
+
* consumers' Tailwind builds never scan — so every element is given a full
|
|
14
|
+
* Berget class set here instead of relying on the defaults. Utility classes
|
|
15
|
+
* used below live in this package's own dist, which the shipped `@source`
|
|
16
|
+
* covers for all consumers.
|
|
17
|
+
*
|
|
18
|
+
* Code highlighting reuses the package CodeBlock family and the shared Shiki
|
|
19
|
+
* highlighter (Berget CSS-variable theme). Mermaid/KaTeX are intentionally
|
|
20
|
+
* not enabled.
|
|
21
|
+
*/
|
|
22
|
+
const bergetComponents = {
|
|
23
|
+
h1: (props) => /* @__PURE__ */ jsx(defaultComponents.h1, {
|
|
24
|
+
...props,
|
|
25
|
+
className: `
|
|
26
|
+
mt-4 mb-2 text-lg font-semibold
|
|
27
|
+
`
|
|
28
|
+
}),
|
|
29
|
+
h2: (props) => /* @__PURE__ */ jsx(defaultComponents.h2, {
|
|
30
|
+
...props,
|
|
31
|
+
className: `
|
|
32
|
+
mt-4 mb-2 text-base font-semibold
|
|
33
|
+
`
|
|
34
|
+
}),
|
|
35
|
+
h3: (props) => /* @__PURE__ */ jsx(defaultComponents.h3, {
|
|
36
|
+
...props,
|
|
37
|
+
className: `
|
|
38
|
+
mt-3 mb-1.5 text-sm font-semibold
|
|
39
|
+
`
|
|
40
|
+
}),
|
|
41
|
+
h4: (props) => /* @__PURE__ */ jsx(defaultComponents.h4, {
|
|
42
|
+
...props,
|
|
43
|
+
className: `
|
|
44
|
+
mt-3 mb-1.5 text-sm font-semibold
|
|
45
|
+
`
|
|
46
|
+
}),
|
|
47
|
+
h5: (props) => /* @__PURE__ */ jsx(defaultComponents.h5, {
|
|
48
|
+
...props,
|
|
49
|
+
className: `
|
|
50
|
+
mt-3 mb-1.5 text-sm font-semibold
|
|
51
|
+
`
|
|
52
|
+
}),
|
|
53
|
+
h6: (props) => /* @__PURE__ */ jsx(defaultComponents.h6, {
|
|
54
|
+
...props,
|
|
55
|
+
className: `
|
|
56
|
+
mt-3 mb-1.5 text-sm font-semibold
|
|
57
|
+
`
|
|
58
|
+
}),
|
|
59
|
+
p: (props) => /* @__PURE__ */ jsx(defaultComponents.p, {
|
|
60
|
+
...props,
|
|
61
|
+
className: `
|
|
62
|
+
my-2
|
|
63
|
+
first:mt-0
|
|
64
|
+
last:mb-0
|
|
65
|
+
`
|
|
66
|
+
}),
|
|
67
|
+
ul: (props) => /* @__PURE__ */ jsx(defaultComponents.ul, {
|
|
68
|
+
...props,
|
|
69
|
+
className: `
|
|
70
|
+
my-2 ms-5 list-disc space-y-1
|
|
71
|
+
marker:text-berget-muted-foreground
|
|
72
|
+
`
|
|
73
|
+
}),
|
|
74
|
+
ol: (props) => /* @__PURE__ */ jsx(defaultComponents.ol, {
|
|
75
|
+
...props,
|
|
76
|
+
className: `
|
|
77
|
+
my-2 ms-5 list-decimal space-y-1
|
|
78
|
+
`
|
|
79
|
+
}),
|
|
80
|
+
li: (props) => /* @__PURE__ */ jsx(defaultComponents.li, {
|
|
81
|
+
...props,
|
|
82
|
+
className: `leading-relaxed`
|
|
83
|
+
}),
|
|
84
|
+
del: (props) => /* @__PURE__ */ jsx("del", {
|
|
85
|
+
...props,
|
|
86
|
+
className: `line-through`
|
|
87
|
+
}),
|
|
88
|
+
em: (props) => /* @__PURE__ */ jsx("em", {
|
|
89
|
+
...props,
|
|
90
|
+
className: `italic`
|
|
91
|
+
}),
|
|
92
|
+
blockquote: (props) => /* @__PURE__ */ jsx(defaultComponents.blockquote, {
|
|
93
|
+
...props,
|
|
94
|
+
className: `
|
|
95
|
+
my-3 border-berget-border ps-3 text-berget-muted-foreground italic
|
|
96
|
+
`
|
|
97
|
+
}),
|
|
98
|
+
hr: (props) => /* @__PURE__ */ jsx(defaultComponents.hr, {
|
|
99
|
+
...props,
|
|
100
|
+
className: `
|
|
101
|
+
my-4 border-berget-border
|
|
102
|
+
`
|
|
103
|
+
}),
|
|
104
|
+
img: (props) => /* @__PURE__ */ jsx(defaultComponents.img, {
|
|
105
|
+
...props,
|
|
106
|
+
className: `my-3 max-w-full rounded-berget-xs border-berget-border`
|
|
107
|
+
}),
|
|
108
|
+
a: ({ node: _node, ...props }) => /* @__PURE__ */ jsx("a", {
|
|
109
|
+
...props,
|
|
110
|
+
target: "_blank",
|
|
111
|
+
rel: "noopener noreferrer nofollow",
|
|
112
|
+
className: `text-berget-primary underline underline-offset-2`
|
|
113
|
+
}),
|
|
114
|
+
code: (props) => /* @__PURE__ */ jsx(defaultComponents.code, {
|
|
115
|
+
...props,
|
|
116
|
+
className: `
|
|
117
|
+
rounded-berget-xs bg-muted px-1.5 py-0.5 font-mono text-[0.85em]
|
|
118
|
+
`
|
|
119
|
+
}),
|
|
120
|
+
pre: ({ children }) => {
|
|
121
|
+
if (React.isValidElement(children)) {
|
|
122
|
+
const { className, children: code } = children.props;
|
|
123
|
+
const language = /language-([\w+-]+)/.exec(className ?? "")?.[1] ?? "text";
|
|
124
|
+
return /* @__PURE__ */ jsx(MarkdownCodeBlock, {
|
|
125
|
+
code: String(code ?? ""),
|
|
126
|
+
language
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
130
|
+
},
|
|
131
|
+
table: (props) => /* @__PURE__ */ jsx("div", {
|
|
132
|
+
className: `
|
|
133
|
+
my-3 max-w-full overflow-x-auto rounded-berget-xs border-berget-border
|
|
134
|
+
`,
|
|
135
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
136
|
+
...props,
|
|
137
|
+
className: `w-full border-collapse text-sm`
|
|
138
|
+
})
|
|
139
|
+
}),
|
|
140
|
+
thead: (props) => /* @__PURE__ */ jsx(defaultComponents.thead, {
|
|
141
|
+
...props,
|
|
142
|
+
className: `bg-muted/50`
|
|
143
|
+
}),
|
|
144
|
+
th: (props) => /* @__PURE__ */ jsx(defaultComponents.th, {
|
|
145
|
+
...props,
|
|
146
|
+
className: `border-b-berget-border px-3 py-1.5 text-start font-semibold`
|
|
147
|
+
}),
|
|
148
|
+
td: (props) => /* @__PURE__ */ jsx(defaultComponents.td, {
|
|
149
|
+
...props,
|
|
150
|
+
className: `
|
|
151
|
+
border-b-berget-border px-3 py-1.5
|
|
152
|
+
`
|
|
153
|
+
})
|
|
154
|
+
};
|
|
155
|
+
function Markdown({ className, ...props }) {
|
|
156
|
+
return /* @__PURE__ */ jsx(Streamdown, {
|
|
157
|
+
...props,
|
|
158
|
+
dir: "ltr",
|
|
159
|
+
components: bergetComponents,
|
|
160
|
+
className: cn("text-caption/relaxed text-berget-foreground", className)
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
Markdown.displayName = "Markdown";
|
|
164
|
+
//#endregion
|
|
165
|
+
export { Markdown };
|
|
166
|
+
|
|
167
|
+
//# sourceMappingURL=Markdown.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Markdown.mjs","names":[],"sources":["../../../src/components/markdown/Markdown.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Streamdown, defaultComponents, type Components, type StreamdownProps } from 'streamdown';\nimport { cn } from '../../lib/utils';\nimport { MarkdownCodeBlock } from './MarkdownCodeBlock';\n\n/**\n * Markdown renderer for chat/UI text, built on Streamdown (incomplete-markdown\n * repair during streaming, GFM tables, rehype-sanitize + rehype-harden).\n *\n * Streamdown ships its own Tailwind classes inside its dist files, which\n * consumers' Tailwind builds never scan — so every element is given a full\n * Berget class set here instead of relying on the defaults. Utility classes\n * used below live in this package's own dist, which the shipped `@source`\n * covers for all consumers.\n *\n * Code highlighting reuses the package CodeBlock family and the shared Shiki\n * highlighter (Berget CSS-variable theme). Mermaid/KaTeX are intentionally\n * not enabled.\n */\nconst bergetComponents: Components = {\n h1: (props) => (\n <defaultComponents.h1\n {...props}\n className={`\n mt-4 mb-2 text-lg font-semibold\n `}\n />\n ),\n h2: (props) => (\n <defaultComponents.h2\n {...props}\n className={`\n mt-4 mb-2 text-base font-semibold\n `}\n />\n ),\n h3: (props) => (\n <defaultComponents.h3\n {...props}\n className={`\n mt-3 mb-1.5 text-sm font-semibold\n `}\n />\n ),\n h4: (props) => (\n <defaultComponents.h4\n {...props}\n className={`\n mt-3 mb-1.5 text-sm font-semibold\n `}\n />\n ),\n h5: (props) => (\n <defaultComponents.h5\n {...props}\n className={`\n mt-3 mb-1.5 text-sm font-semibold\n `}\n />\n ),\n h6: (props) => (\n <defaultComponents.h6\n {...props}\n className={`\n mt-3 mb-1.5 text-sm font-semibold\n `}\n />\n ),\n p: (props) => (\n <defaultComponents.p\n {...props}\n className={`\n my-2\n first:mt-0\n last:mb-0\n `}\n />\n ),\n ul: (props) => (\n <defaultComponents.ul\n {...props}\n className={`\n my-2 ms-5 list-disc space-y-1\n marker:text-berget-muted-foreground\n `}\n />\n ),\n ol: (props) => (\n <defaultComponents.ol\n {...props}\n className={`\n my-2 ms-5 list-decimal space-y-1\n `}\n />\n ),\n li: (props) => <defaultComponents.li {...props} className={`leading-relaxed`} />,\n del: (props) => <del {...props} className={`line-through`} />,\n em: (props) => <em {...props} className={`italic`} />,\n blockquote: (props) => (\n <defaultComponents.blockquote\n {...props}\n className={`\n my-3 border-berget-border ps-3 text-berget-muted-foreground italic\n `}\n />\n ),\n hr: (props) => (\n <defaultComponents.hr\n {...props}\n className={`\n my-4 border-berget-border\n `}\n />\n ),\n img: (props) => (\n <defaultComponents.img\n {...props}\n className={`my-3 max-w-full rounded-berget-xs border-berget-border`}\n />\n ),\n // Real anchor, not Streamdown's default <button>: links must keep href\n // semantics (middle-click, new tab). Hardening attrs are added explicitly\n // since rehype-harden can only act on real anchors.\n a: ({ node: _node, ...props }) => (\n <a\n {...props}\n target=\"_blank\"\n rel=\"noopener noreferrer nofollow\"\n className={`text-berget-primary underline underline-offset-2`}\n />\n ),\n // Inline code only — fenced blocks are consumed by the `pre` override below.\n code: (props) => (\n <defaultComponents.code\n {...props}\n className={`\n rounded-berget-xs bg-muted px-1.5 py-0.5 font-mono text-[0.85em]\n `}\n />\n ),\n // Fenced / indented code: derive code + language from the child code\n // element and render with the package CodeBlock (highlighting included).\n pre: ({ children }) => {\n if (React.isValidElement(children)) {\n const { className, children: code } = children.props as {\n className?: string;\n children?: React.ReactNode;\n };\n const language = /language-([\\w+-]+)/.exec(className ?? '')?.[1] ?? 'text';\n return <MarkdownCodeBlock code={String(code ?? '')} language={language} />;\n }\n return <>{children}</>;\n },\n table: (props) => (\n <div\n className={`\n my-3 max-w-full overflow-x-auto rounded-berget-xs border-berget-border\n `}\n >\n <table {...props} className={`w-full border-collapse text-sm`} />\n </div>\n ),\n thead: (props) => <defaultComponents.thead {...props} className={`bg-muted/50`} />,\n th: (props) => (\n <defaultComponents.th\n {...props}\n className={`border-b-berget-border px-3 py-1.5 text-start font-semibold`}\n />\n ),\n td: (props) => (\n <defaultComponents.td\n {...props}\n className={`\n border-b-berget-border px-3 py-1.5\n `}\n />\n ),\n};\n\ntype MarkdownProps = Omit<StreamdownProps, 'components' | 'plugins' | 'dir' | 'prefix'>;\nexport type { MarkdownProps };\n\nexport function Markdown({ className, ...props }: MarkdownProps) {\n return (\n <Streamdown\n {...props}\n dir=\"ltr\"\n components={bergetComponents}\n className={cn('text-caption/relaxed text-berget-foreground', className)}\n />\n );\n}\n\nMarkdown.displayName = 'Markdown';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,mBAA+B;CACnC,KAAK,UACH,oBAAC,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,KAAK,UACH,oBAAC,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,KAAK,UACH,oBAAC,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,KAAK,UACH,oBAAC,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,KAAK,UACH,oBAAC,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,KAAK,UACH,oBAAC,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,IAAI,UACF,oBAAC,kBAAkB,GAAnB;EACE,GAAI;EACJ,WAAW;;;;;CAKZ,CAAA;CAEH,KAAK,UACH,oBAAC,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;;CAIZ,CAAA;CAEH,KAAK,UACH,oBAAC,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,KAAK,UAAU,oBAAC,kBAAkB,IAAnB;EAAsB,GAAI;EAAO,WAAW;CAAoB,CAAA;CAC/E,MAAM,UAAU,oBAAC,OAAD;EAAK,GAAI;EAAO,WAAW;CAAiB,CAAA;CAC5D,KAAK,UAAU,oBAAC,MAAD;EAAI,GAAI;EAAO,WAAW;CAAW,CAAA;CACpD,aAAa,UACX,oBAAC,kBAAkB,YAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,KAAK,UACH,oBAAC,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAEH,MAAM,UACJ,oBAAC,kBAAkB,KAAnB;EACE,GAAI;EACJ,WAAW;CACZ,CAAA;CAKH,IAAI,EAAE,MAAM,OAAO,GAAG,YACpB,oBAAC,KAAD;EACE,GAAI;EACJ,QAAO;EACP,KAAI;EACJ,WAAW;CACZ,CAAA;CAGH,OAAO,UACL,oBAAC,kBAAkB,MAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;CAIH,MAAM,EAAE,eAAe;EACrB,IAAI,MAAM,eAAe,QAAQ,GAAG;GAClC,MAAM,EAAE,WAAW,UAAU,SAAS,SAAS;GAI/C,MAAM,WAAW,qBAAqB,KAAK,aAAa,EAAE,CAAC,GAAG,MAAM;GACpE,OAAO,oBAAC,mBAAD;IAAmB,MAAM,OAAO,QAAQ,EAAE;IAAa;GAAW,CAAA;EAC3E;EACA,OAAO,oBAAA,UAAA,EAAG,SAAW,CAAA;CACvB;CACA,QAAQ,UACN,oBAAC,OAAD;EACE,WAAW;;;EAIX,UAAA,oBAAC,SAAD;GAAO,GAAI;GAAO,WAAW;EAAmC,CAAA;CAC7D,CAAA;CAEP,QAAQ,UAAU,oBAAC,kBAAkB,OAAnB;EAAyB,GAAI;EAAO,WAAW;CAAgB,CAAA;CACjF,KAAK,UACH,oBAAC,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;CACZ,CAAA;CAEH,KAAK,UACH,oBAAC,kBAAkB,IAAnB;EACE,GAAI;EACJ,WAAW;;;CAGZ,CAAA;AAEL;AAKA,SAAgB,SAAS,EAAE,WAAW,GAAG,SAAwB;CAC/D,OACE,oBAAC,YAAD;EACE,GAAI;EACJ,KAAI;EACJ,YAAY;EACZ,WAAW,GAAG,+CAA+C,SAAS;CACvE,CAAA;AAEL;AAEA,SAAS,cAAc"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_code_block = require("../../primitives/code-block.cjs");
|
|
3
|
+
const require_CodeBlock = require("../code-block/CodeBlock.cjs");
|
|
4
|
+
const require_use_highlighted_code = require("../../hooks/use-highlighted-code.cjs");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
//#region src/components/markdown/MarkdownCodeBlock.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Fenced code block inside rendered markdown. Reuses the package CodeBlock
|
|
9
|
+
* composition (Berget tokens) and the shared Shiki highlighter so markdown
|
|
10
|
+
* code highlighting matches the rest of the design system.
|
|
11
|
+
*/
|
|
12
|
+
function MarkdownCodeBlock({ code, language }) {
|
|
13
|
+
const lines = require_use_highlighted_code.useHighlightedCode(code, language);
|
|
14
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_CodeBlock.CodeBlock, {
|
|
15
|
+
className: "my-3",
|
|
16
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_CodeBlock.CodeBlockHeader, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CodeBlock.CodeBlockTitle, { children: language }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_code_block.CodeBlockActions, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_code_block.CodeBlockCopyButton, { value: code }) })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_code_block.CodeBlockContent, {
|
|
17
|
+
lineNumbers: false,
|
|
18
|
+
children: lines.map((line, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_code_block.CodeBlockLine, { children: line }, index))
|
|
19
|
+
})]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.MarkdownCodeBlock = MarkdownCodeBlock;
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=MarkdownCodeBlock.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownCodeBlock.cjs","names":["useHighlightedCode","CodeBlock","CodeBlockHeader","CodeBlockTitle","CodeBlockActions","CodeBlockCopyButton","CodeBlockContent","CodeBlockLine"],"sources":["../../../src/components/markdown/MarkdownCodeBlock.tsx"],"sourcesContent":["'use client';\n\nimport {\n CodeBlock,\n CodeBlockActions,\n CodeBlockContent,\n CodeBlockCopyButton,\n CodeBlockHeader,\n CodeBlockLine,\n CodeBlockTitle,\n} from '../code-block';\nimport { useHighlightedCode } from '../../hooks/use-highlighted-code';\n\n/**\n * Fenced code block inside rendered markdown. Reuses the package CodeBlock\n * composition (Berget tokens) and the shared Shiki highlighter so markdown\n * code highlighting matches the rest of the design system.\n */\nexport function MarkdownCodeBlock({ code, language }: { code: string; language: string }) {\n const lines = useHighlightedCode(code, language);\n\n return (\n <CodeBlock className=\"my-3\">\n <CodeBlockHeader>\n <CodeBlockTitle>{language}</CodeBlockTitle>\n <CodeBlockActions>\n <CodeBlockCopyButton value={code} />\n </CodeBlockActions>\n </CodeBlockHeader>\n <CodeBlockContent lineNumbers={false}>\n {lines.map((line, index) => (\n <CodeBlockLine key={index}>{line}</CodeBlockLine>\n ))}\n </CodeBlockContent>\n </CodeBlock>\n );\n}\n"],"mappings":";;;;;;;;;;;AAkBA,SAAgB,kBAAkB,EAAE,MAAM,YAAgD;CACxF,MAAM,QAAQA,6BAAAA,mBAAmB,MAAM,QAAQ;CAE/C,OACE,iBAAA,GAAA,kBAAA,KAAA,CAACC,kBAAAA,WAAD;EAAW,WAAU;EAArB,UAAA,CACE,iBAAA,GAAA,kBAAA,KAAA,CAACC,kBAAAA,iBAAD,EAAA,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,kBAAAA,gBAAD,EAAA,UAAiB,SAAyB,CAAA,GAC1C,iBAAA,GAAA,kBAAA,IAAA,CAACC,mBAAAA,kBAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,mBAAAA,qBAAD,EAAqB,OAAO,KAAO,CAAA,EACnB,CAAA,CACH,EAAA,CAAA,GACjB,iBAAA,GAAA,kBAAA,IAAA,CAACC,mBAAAA,kBAAD;GAAkB,aAAa;GAC5B,UAAA,MAAM,KAAK,MAAM,UAChB,iBAAA,GAAA,kBAAA,IAAA,CAACC,mBAAAA,eAAD,EAAA,UAA4B,KAAoB,GAA5B,KAA4B,CACjD;EACe,CAAA,CACT;;AAEf"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/components/markdown/MarkdownCodeBlock.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Fenced code block inside rendered markdown. Reuses the package CodeBlock
|
|
4
|
+
* composition (Berget tokens) and the shared Shiki highlighter so markdown
|
|
5
|
+
* code highlighting matches the rest of the design system.
|
|
6
|
+
*/
|
|
7
|
+
export declare function MarkdownCodeBlock({ code, language }: {
|
|
8
|
+
code: string;
|
|
9
|
+
language: string;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//#endregion
|
|
12
|
+
//# sourceMappingURL=MarkdownCodeBlock.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownCodeBlock.d.cts","names":[],"sources":["../../../src/components/markdown/MarkdownCodeBlock.tsx"],"mappings":";;;;;;wBAkBgB,oBAAoB,MAAM;EAAc;EAAc;gCAAkB,IAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/components/markdown/MarkdownCodeBlock.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Fenced code block inside rendered markdown. Reuses the package CodeBlock
|
|
4
|
+
* composition (Berget tokens) and the shared Shiki highlighter so markdown
|
|
5
|
+
* code highlighting matches the rest of the design system.
|
|
6
|
+
*/
|
|
7
|
+
export declare function MarkdownCodeBlock({ code, language }: {
|
|
8
|
+
code: string;
|
|
9
|
+
language: string;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//#endregion
|
|
12
|
+
//# sourceMappingURL=MarkdownCodeBlock.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownCodeBlock.d.mts","names":[],"sources":["../../../src/components/markdown/MarkdownCodeBlock.tsx"],"mappings":";;;;;;wBAkBgB,oBAAoB,MAAM;EAAc;EAAc;gCAAkB,IAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockLine } from "../../primitives/code-block.mjs";
|
|
3
|
+
import { CodeBlock, CodeBlockHeader, CodeBlockTitle } from "../code-block/CodeBlock.mjs";
|
|
4
|
+
import { useHighlightedCode } from "../../hooks/use-highlighted-code.mjs";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/markdown/MarkdownCodeBlock.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Fenced code block inside rendered markdown. Reuses the package CodeBlock
|
|
9
|
+
* composition (Berget tokens) and the shared Shiki highlighter so markdown
|
|
10
|
+
* code highlighting matches the rest of the design system.
|
|
11
|
+
*/
|
|
12
|
+
function MarkdownCodeBlock({ code, language }) {
|
|
13
|
+
const lines = useHighlightedCode(code, language);
|
|
14
|
+
return /* @__PURE__ */ jsxs(CodeBlock, {
|
|
15
|
+
className: "my-3",
|
|
16
|
+
children: [/* @__PURE__ */ jsxs(CodeBlockHeader, { children: [/* @__PURE__ */ jsx(CodeBlockTitle, { children: language }), /* @__PURE__ */ jsx(CodeBlockActions, { children: /* @__PURE__ */ jsx(CodeBlockCopyButton, { value: code }) })] }), /* @__PURE__ */ jsx(CodeBlockContent, {
|
|
17
|
+
lineNumbers: false,
|
|
18
|
+
children: lines.map((line, index) => /* @__PURE__ */ jsx(CodeBlockLine, { children: line }, index))
|
|
19
|
+
})]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { MarkdownCodeBlock };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=MarkdownCodeBlock.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownCodeBlock.mjs","names":[],"sources":["../../../src/components/markdown/MarkdownCodeBlock.tsx"],"sourcesContent":["'use client';\n\nimport {\n CodeBlock,\n CodeBlockActions,\n CodeBlockContent,\n CodeBlockCopyButton,\n CodeBlockHeader,\n CodeBlockLine,\n CodeBlockTitle,\n} from '../code-block';\nimport { useHighlightedCode } from '../../hooks/use-highlighted-code';\n\n/**\n * Fenced code block inside rendered markdown. Reuses the package CodeBlock\n * composition (Berget tokens) and the shared Shiki highlighter so markdown\n * code highlighting matches the rest of the design system.\n */\nexport function MarkdownCodeBlock({ code, language }: { code: string; language: string }) {\n const lines = useHighlightedCode(code, language);\n\n return (\n <CodeBlock className=\"my-3\">\n <CodeBlockHeader>\n <CodeBlockTitle>{language}</CodeBlockTitle>\n <CodeBlockActions>\n <CodeBlockCopyButton value={code} />\n </CodeBlockActions>\n </CodeBlockHeader>\n <CodeBlockContent lineNumbers={false}>\n {lines.map((line, index) => (\n <CodeBlockLine key={index}>{line}</CodeBlockLine>\n ))}\n </CodeBlockContent>\n </CodeBlock>\n );\n}\n"],"mappings":";;;;;;;;;;;AAkBA,SAAgB,kBAAkB,EAAE,MAAM,YAAgD;CACxF,MAAM,QAAQ,mBAAmB,MAAM,QAAQ;CAE/C,OACE,qBAAC,WAAD;EAAW,WAAU;EAArB,UAAA,CACE,qBAAC,iBAAD,EAAA,UAAA,CACE,oBAAC,gBAAD,EAAA,UAAiB,SAAyB,CAAA,GAC1C,oBAAC,kBAAD,EAAA,UACE,oBAAC,qBAAD,EAAqB,OAAO,KAAO,CAAA,EACnB,CAAA,CACH,EAAA,CAAA,GACjB,oBAAC,kBAAD;GAAkB,aAAa;GAC5B,UAAA,MAAM,KAAK,MAAM,UAChB,oBAAC,eAAD,EAAA,UAA4B,KAAoB,GAA5B,KAA4B,CACjD;EACe,CAAA,CACT;;AAEf"}
|
package/dist/index.cjs
CHANGED
|
@@ -66,6 +66,8 @@ const require_code_block = require("./primitives/code-block.cjs");
|
|
|
66
66
|
const require_CodeBlock = require("./components/code-block/CodeBlock.cjs");
|
|
67
67
|
const require_use_highlighted_code = require("./hooks/use-highlighted-code.cjs");
|
|
68
68
|
const require_WindowFrame = require("./components/window-frame/WindowFrame.cjs");
|
|
69
|
+
const require_MarkdownCodeBlock = require("./components/markdown/MarkdownCodeBlock.cjs");
|
|
70
|
+
const require_Markdown = require("./components/markdown/Markdown.cjs");
|
|
69
71
|
const require_FogIllustration = require("./components/fog-illustration/FogIllustration.cjs");
|
|
70
72
|
let _shadcn_react_message_scroller = require("@shadcn/react/message-scroller");
|
|
71
73
|
exports.Alert = require_Alert.Alert;
|
|
@@ -197,6 +199,8 @@ exports.Link = require_Link.Link;
|
|
|
197
199
|
exports.List = require_List.List;
|
|
198
200
|
exports.ListHeader = require_List.ListHeader;
|
|
199
201
|
exports.ListItem = require_List.ListItem;
|
|
202
|
+
exports.Markdown = require_Markdown.Markdown;
|
|
203
|
+
exports.MarkdownCodeBlock = require_MarkdownCodeBlock.MarkdownCodeBlock;
|
|
200
204
|
exports.Message = require_message.Message;
|
|
201
205
|
exports.MessageAvatar = require_message.MessageAvatar;
|
|
202
206
|
exports.MessageContent = require_message.MessageContent;
|
package/dist/index.d.cts
CHANGED
|
@@ -114,5 +114,8 @@ import { TerminalExample } from "./lib/terminal.cjs";
|
|
|
114
114
|
import { cn } from "./lib/utils.cjs";
|
|
115
115
|
import { WindowFrame, WindowFrameProps, WindowTab } from "./components/window-frame/WindowFrame.cjs";
|
|
116
116
|
import "./components/window-frame/index.cjs";
|
|
117
|
+
import { Markdown, MarkdownProps } from "./components/markdown/Markdown.cjs";
|
|
118
|
+
import { MarkdownCodeBlock } from "./components/markdown/MarkdownCodeBlock.cjs";
|
|
119
|
+
import "./components/markdown/index.cjs";
|
|
117
120
|
import { FOG_BRAND_PALETTE, FogIllustration, FogIllustrationProps, FogPalette } from "./components/fog-illustration/FogIllustration.cjs";
|
|
118
|
-
export { Alert, AlertDescription, type AlertDescriptionProps, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, type AlertTitleProps, Anchor, type AnchorProps, type AnchorVariantsProps, Badge, type BadgeProps, BergetLogo, type BergetLogoProps, Box, type BoxProps, type SpacingScale as BoxSpacingScale, Bubble, BubbleContent, BubbleGroup, BubbleReactions, Button, type ButtonProps, COUNTRIES, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Checkbox, type CheckboxProps, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, Combobox, ComboboxClear, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Composer, ComposerActions, type ComposerActionsProps, type ComposerProps, ComposerSubmit, type ComposerSubmitProps, ComposerTextarea, type ComposerTextareaProps, Container, type ContainerProps, type Country, CountrySelect, type CountrySelectProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EU_COUNTRY_CODES, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, type EmptyProps, EmptyTitle, FOG_BRAND_PALETTE, FeatureList, type FeatureListProps, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FogIllustration, type FogIllustrationProps, type FogPalette, Grid, type GridColsScale, type GridProps, type GridRowsScale, type SpacingScale$1 as GridSpacingScale, Icon, type IconProps, Input, InputGroup, InputGroupAddon, type InputGroupAddonProps, InputGroupButton, InputGroupInput, type InputGroupProps, InputGroupText, InputGroupTextarea, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, type ItemProps, ItemSeparator, ItemTitle, Label, LanguageSelect, type LanguageSelectOption, type LanguageSelectProps, Link, type LinkProps, List, ListHeader, type ListHeaderProps, ListItem, type ListItemProps, type ListProps, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, ModelCard, type ModelCardProps, type ModelCategory, type ModelLifecycle, ModelLogo, type ModelLogoProps, type ModelLogoProvider, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPositioner, NavigationMenuTrigger, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, type ProgressProps, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, SearchInput, type SearchInputProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLogo, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPageHeader, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, type SkeletonProps, Slider, type SliderProps, Switch, type SwitchProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TerminalExample, Textarea, type Theme, ThemeProvider, type ThemeProviderProps, ThemeToggle, type ThemeToggleProps, Tooltip, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger, type TooltipTriggerProps, Trace, TraceCollapsible, TraceCollapsibleContent, TraceCollapsibleTrigger, TraceDescription, TraceIcon, TraceLine, TraceTitle, Typography, type TypographyProps, WindowFrame, type WindowFrameProps, type WindowTab, alertVariants, anchorVariants, badgeVariants, boxVariants, buttonVariants, cardVariants, categoryLabels, checkboxVariants, cn, containerVariants, getCountryByCode, getCountryByName, gridVariants, isEUCountry, linkVariants, navigationMenuTriggerStyle, switchRootVariants, switchThumbVariants, tabsListVariants, tabsTriggerVariants, typographyVariants, useHighlightedCode, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility, useSidebar, useTheme };
|
|
121
|
+
export { Alert, AlertDescription, type AlertDescriptionProps, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, type AlertTitleProps, Anchor, type AnchorProps, type AnchorVariantsProps, Badge, type BadgeProps, BergetLogo, type BergetLogoProps, Box, type BoxProps, type SpacingScale as BoxSpacingScale, Bubble, BubbleContent, BubbleGroup, BubbleReactions, Button, type ButtonProps, COUNTRIES, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Checkbox, type CheckboxProps, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, Combobox, ComboboxClear, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Composer, ComposerActions, type ComposerActionsProps, type ComposerProps, ComposerSubmit, type ComposerSubmitProps, ComposerTextarea, type ComposerTextareaProps, Container, type ContainerProps, type Country, CountrySelect, type CountrySelectProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EU_COUNTRY_CODES, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, type EmptyProps, EmptyTitle, FOG_BRAND_PALETTE, FeatureList, type FeatureListProps, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FogIllustration, type FogIllustrationProps, type FogPalette, Grid, type GridColsScale, type GridProps, type GridRowsScale, type SpacingScale$1 as GridSpacingScale, Icon, type IconProps, Input, InputGroup, InputGroupAddon, type InputGroupAddonProps, InputGroupButton, InputGroupInput, type InputGroupProps, InputGroupText, InputGroupTextarea, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, type ItemProps, ItemSeparator, ItemTitle, Label, LanguageSelect, type LanguageSelectOption, type LanguageSelectProps, Link, type LinkProps, List, ListHeader, type ListHeaderProps, ListItem, type ListItemProps, type ListProps, Markdown, MarkdownCodeBlock, type MarkdownProps, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, ModelCard, type ModelCardProps, type ModelCategory, type ModelLifecycle, ModelLogo, type ModelLogoProps, type ModelLogoProvider, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPositioner, NavigationMenuTrigger, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, type ProgressProps, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, SearchInput, type SearchInputProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLogo, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPageHeader, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, type SkeletonProps, Slider, type SliderProps, Switch, type SwitchProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TerminalExample, Textarea, type Theme, ThemeProvider, type ThemeProviderProps, ThemeToggle, type ThemeToggleProps, Tooltip, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger, type TooltipTriggerProps, Trace, TraceCollapsible, TraceCollapsibleContent, TraceCollapsibleTrigger, TraceDescription, TraceIcon, TraceLine, TraceTitle, Typography, type TypographyProps, WindowFrame, type WindowFrameProps, type WindowTab, alertVariants, anchorVariants, badgeVariants, boxVariants, buttonVariants, cardVariants, categoryLabels, checkboxVariants, cn, containerVariants, getCountryByCode, getCountryByName, gridVariants, isEUCountry, linkVariants, navigationMenuTriggerStyle, switchRootVariants, switchThumbVariants, tabsListVariants, tabsTriggerVariants, typographyVariants, useHighlightedCode, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility, useSidebar, useTheme };
|
package/dist/index.d.mts
CHANGED
|
@@ -114,5 +114,8 @@ import { TerminalExample } from "./lib/terminal.mjs";
|
|
|
114
114
|
import { cn } from "./lib/utils.mjs";
|
|
115
115
|
import { WindowFrame, WindowFrameProps, WindowTab } from "./components/window-frame/WindowFrame.mjs";
|
|
116
116
|
import "./components/window-frame/index.mjs";
|
|
117
|
+
import { Markdown, MarkdownProps } from "./components/markdown/Markdown.mjs";
|
|
118
|
+
import { MarkdownCodeBlock } from "./components/markdown/MarkdownCodeBlock.mjs";
|
|
119
|
+
import "./components/markdown/index.mjs";
|
|
117
120
|
import { FOG_BRAND_PALETTE, FogIllustration, FogIllustrationProps, FogPalette } from "./components/fog-illustration/FogIllustration.mjs";
|
|
118
|
-
export { Alert, AlertDescription, type AlertDescriptionProps, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, type AlertTitleProps, Anchor, type AnchorProps, type AnchorVariantsProps, Badge, type BadgeProps, BergetLogo, type BergetLogoProps, Box, type BoxProps, type SpacingScale as BoxSpacingScale, Bubble, BubbleContent, BubbleGroup, BubbleReactions, Button, type ButtonProps, COUNTRIES, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Checkbox, type CheckboxProps, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, Combobox, ComboboxClear, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Composer, ComposerActions, type ComposerActionsProps, type ComposerProps, ComposerSubmit, type ComposerSubmitProps, ComposerTextarea, type ComposerTextareaProps, Container, type ContainerProps, type Country, CountrySelect, type CountrySelectProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EU_COUNTRY_CODES, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, type EmptyProps, EmptyTitle, FOG_BRAND_PALETTE, FeatureList, type FeatureListProps, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FogIllustration, type FogIllustrationProps, type FogPalette, Grid, type GridColsScale, type GridProps, type GridRowsScale, type SpacingScale$1 as GridSpacingScale, Icon, type IconProps, Input, InputGroup, InputGroupAddon, type InputGroupAddonProps, InputGroupButton, InputGroupInput, type InputGroupProps, InputGroupText, InputGroupTextarea, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, type ItemProps, ItemSeparator, ItemTitle, Label, LanguageSelect, type LanguageSelectOption, type LanguageSelectProps, Link, type LinkProps, List, ListHeader, type ListHeaderProps, ListItem, type ListItemProps, type ListProps, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, ModelCard, type ModelCardProps, type ModelCategory, type ModelLifecycle, ModelLogo, type ModelLogoProps, type ModelLogoProvider, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPositioner, NavigationMenuTrigger, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, type ProgressProps, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, SearchInput, type SearchInputProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLogo, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPageHeader, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, type SkeletonProps, Slider, type SliderProps, Switch, type SwitchProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TerminalExample, Textarea, type Theme, ThemeProvider, type ThemeProviderProps, ThemeToggle, type ThemeToggleProps, Tooltip, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger, type TooltipTriggerProps, Trace, TraceCollapsible, TraceCollapsibleContent, TraceCollapsibleTrigger, TraceDescription, TraceIcon, TraceLine, TraceTitle, Typography, type TypographyProps, WindowFrame, type WindowFrameProps, type WindowTab, alertVariants, anchorVariants, badgeVariants, boxVariants, buttonVariants, cardVariants, categoryLabels, checkboxVariants, cn, containerVariants, getCountryByCode, getCountryByName, gridVariants, isEUCountry, linkVariants, navigationMenuTriggerStyle, switchRootVariants, switchThumbVariants, tabsListVariants, tabsTriggerVariants, typographyVariants, useHighlightedCode, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility, useSidebar, useTheme };
|
|
121
|
+
export { Alert, AlertDescription, type AlertDescriptionProps, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, type AlertTitleProps, Anchor, type AnchorProps, type AnchorVariantsProps, Badge, type BadgeProps, BergetLogo, type BergetLogoProps, Box, type BoxProps, type SpacingScale as BoxSpacingScale, Bubble, BubbleContent, BubbleGroup, BubbleReactions, Button, type ButtonProps, COUNTRIES, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Checkbox, type CheckboxProps, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, Combobox, ComboboxClear, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Composer, ComposerActions, type ComposerActionsProps, type ComposerProps, ComposerSubmit, type ComposerSubmitProps, ComposerTextarea, type ComposerTextareaProps, Container, type ContainerProps, type Country, CountrySelect, type CountrySelectProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EU_COUNTRY_CODES, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, type EmptyProps, EmptyTitle, FOG_BRAND_PALETTE, FeatureList, type FeatureListProps, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FogIllustration, type FogIllustrationProps, type FogPalette, Grid, type GridColsScale, type GridProps, type GridRowsScale, type SpacingScale$1 as GridSpacingScale, Icon, type IconProps, Input, InputGroup, InputGroupAddon, type InputGroupAddonProps, InputGroupButton, InputGroupInput, type InputGroupProps, InputGroupText, InputGroupTextarea, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, type ItemProps, ItemSeparator, ItemTitle, Label, LanguageSelect, type LanguageSelectOption, type LanguageSelectProps, Link, type LinkProps, List, ListHeader, type ListHeaderProps, ListItem, type ListItemProps, type ListProps, Markdown, MarkdownCodeBlock, type MarkdownProps, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, ModelCard, type ModelCardProps, type ModelCategory, type ModelLifecycle, ModelLogo, type ModelLogoProps, type ModelLogoProvider, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPositioner, NavigationMenuTrigger, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, type ProgressProps, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, SearchInput, type SearchInputProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLogo, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPageHeader, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, type SkeletonProps, Slider, type SliderProps, Switch, type SwitchProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TerminalExample, Textarea, type Theme, ThemeProvider, type ThemeProviderProps, ThemeToggle, type ThemeToggleProps, Tooltip, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger, type TooltipTriggerProps, Trace, TraceCollapsible, TraceCollapsibleContent, TraceCollapsibleTrigger, TraceDescription, TraceIcon, TraceLine, TraceTitle, Typography, type TypographyProps, WindowFrame, type WindowFrameProps, type WindowTab, alertVariants, anchorVariants, badgeVariants, boxVariants, buttonVariants, cardVariants, categoryLabels, checkboxVariants, cn, containerVariants, getCountryByCode, getCountryByName, gridVariants, isEUCountry, linkVariants, navigationMenuTriggerStyle, switchRootVariants, switchThumbVariants, tabsListVariants, tabsTriggerVariants, typographyVariants, useHighlightedCode, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility, useSidebar, useTheme };
|
package/dist/index.mjs
CHANGED
|
@@ -65,5 +65,7 @@ import { CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFoote
|
|
|
65
65
|
import { CodeBlock, CodeBlockHeader, CodeBlockTitle } from "./components/code-block/CodeBlock.mjs";
|
|
66
66
|
import { useHighlightedCode } from "./hooks/use-highlighted-code.mjs";
|
|
67
67
|
import { WindowFrame } from "./components/window-frame/WindowFrame.mjs";
|
|
68
|
+
import { MarkdownCodeBlock } from "./components/markdown/MarkdownCodeBlock.mjs";
|
|
69
|
+
import { Markdown } from "./components/markdown/Markdown.mjs";
|
|
68
70
|
import { FOG_BRAND_PALETTE, FogIllustration } from "./components/fog-illustration/FogIllustration.mjs";
|
|
69
|
-
export { Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Anchor, Badge, BergetLogo, Box, Bubble, BubbleContent, BubbleGroup, BubbleReactions, Button, COUNTRIES, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, Combobox, ComboboxClear, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Composer, ComposerActions, ComposerSubmit, ComposerTextarea, Container, CountrySelect, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EU_COUNTRY_CODES, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FOG_BRAND_PALETTE, FeatureList, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FogIllustration, Grid, Icon, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Label, LanguageSelect, Link, List, ListHeader, ListItem, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, ModelCard, ModelLogo, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPositioner, NavigationMenuTrigger, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, SearchInput, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLogo, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPageHeader, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, ThemeToggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Trace, TraceCollapsible, TraceCollapsibleContent, TraceCollapsibleTrigger, TraceDescription, TraceIcon, TraceLine, TraceTitle, Typography, WindowFrame, alertVariants, anchorVariants, badgeVariants, boxVariants, buttonVariants, cardVariants, categoryLabels, checkboxVariants, cn, containerVariants, getCountryByCode, getCountryByName, gridVariants, isEUCountry, linkVariants, navigationMenuTriggerStyle, switchRootVariants, switchThumbVariants, tabsListVariants, tabsTriggerVariants, typographyVariants, useHighlightedCode, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility, useSidebar, useTheme };
|
|
71
|
+
export { Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Anchor, Badge, BergetLogo, Box, Bubble, BubbleContent, BubbleGroup, BubbleReactions, Button, COUNTRIES, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, Combobox, ComboboxClear, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Composer, ComposerActions, ComposerSubmit, ComposerTextarea, Container, CountrySelect, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EU_COUNTRY_CODES, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FOG_BRAND_PALETTE, FeatureList, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FogIllustration, Grid, Icon, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Label, LanguageSelect, Link, List, ListHeader, ListItem, Markdown, MarkdownCodeBlock, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, ModelCard, ModelLogo, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPositioner, NavigationMenuTrigger, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, SearchInput, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLogo, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPageHeader, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, ThemeToggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Trace, TraceCollapsible, TraceCollapsibleContent, TraceCollapsibleTrigger, TraceDescription, TraceIcon, TraceLine, TraceTitle, Typography, WindowFrame, alertVariants, anchorVariants, badgeVariants, boxVariants, buttonVariants, cardVariants, categoryLabels, checkboxVariants, cn, containerVariants, getCountryByCode, getCountryByName, gridVariants, isEUCountry, linkVariants, navigationMenuTriggerStyle, switchRootVariants, switchThumbVariants, tabsListVariants, tabsTriggerVariants, typographyVariants, useHighlightedCode, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility, useSidebar, useTheme };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bergetai/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Berget Design System - Scandinavian-inspired design system with console aesthetic",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"cmdk": "^1.1.1",
|
|
54
54
|
"cn": "^0.2.4",
|
|
55
55
|
"shadcn": "^4.22.1",
|
|
56
|
+
"streamdown": "^2.7.1",
|
|
56
57
|
"tailwind-merge": "^3.5.0"
|
|
57
58
|
},
|
|
58
59
|
"peerDependencies": {
|