@assistant-ui/react-markdown 0.2.24 → 0.2.26
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/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -4
- package/dist/index.mjs.map +1 -1
- package/dist/overrides/CodeBlock.js +5 -3
- package/dist/overrides/CodeBlock.js.map +1 -1
- package/dist/overrides/CodeBlock.mjs +4 -3
- package/dist/overrides/CodeBlock.mjs.map +1 -1
- package/dist/overrides/CodeOverride.js +9 -7
- package/dist/overrides/CodeOverride.js.map +1 -1
- package/dist/overrides/CodeOverride.mjs +8 -7
- package/dist/overrides/CodeOverride.mjs.map +1 -1
- package/dist/overrides/PreOverride.js +6 -4
- package/dist/overrides/PreOverride.js.map +1 -1
- package/dist/overrides/PreOverride.mjs +5 -4
- package/dist/overrides/PreOverride.mjs.map +1 -1
- package/dist/overrides/defaultComponents.js +6 -4
- package/dist/overrides/defaultComponents.js.map +1 -1
- package/dist/overrides/defaultComponents.mjs +5 -4
- package/dist/overrides/defaultComponents.mjs.map +1 -1
- package/dist/overrides/types.js +2 -0
- package/dist/overrides/types.js.map +1 -1
- package/dist/overrides/withDefaults.js +3 -1
- package/dist/overrides/withDefaults.js.map +1 -1
- package/dist/overrides/withDefaults.mjs +2 -1
- package/dist/overrides/withDefaults.mjs.map +1 -1
- package/dist/primitives/MarkdownText.js +8 -6
- package/dist/primitives/MarkdownText.js.map +1 -1
- package/dist/primitives/MarkdownText.mjs +8 -6
- package/dist/primitives/MarkdownText.mjs.map +1 -1
- package/dist/styles/tailwindcss/markdown.css.json +68 -0
- package/dist/tailwindcss/index.d.ts.map +1 -1
- package/dist/tailwindcss/index.js +4 -2
- package/dist/tailwindcss/index.js.map +1 -1
- package/dist/tailwindcss/index.mjs +3 -2
- package/dist/tailwindcss/index.mjs.map +1 -1
- package/dist/ui/code-header.js +8 -6
- package/dist/ui/code-header.js.map +1 -1
- package/dist/ui/code-header.mjs +5 -4
- package/dist/ui/code-header.mjs.map +1 -1
- package/dist/ui/markdown-text.js +9 -7
- package/dist/ui/markdown-text.js.map +1 -1
- package/dist/ui/markdown-text.mjs +8 -7
- package/dist/ui/markdown-text.mjs.map +1 -1
- package/dist/ui/useCopyToClipboard.js +3 -1
- package/dist/ui/useCopyToClipboard.js.map +1 -1
- package/dist/ui/useCopyToClipboard.mjs +2 -1
- package/dist/ui/useCopyToClipboard.mjs.map +1 -1
- package/package.json +10 -9
- package/src/tailwindcss/index.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
19
21
|
var src_exports = {};
|
|
20
22
|
__export(src_exports, {
|
|
21
23
|
CodeHeader: () => import_code_header.CodeHeader,
|
|
@@ -24,10 +26,10 @@ __export(src_exports, {
|
|
|
24
26
|
useIsMarkdownCodeBlock: () => import_PreOverride.useIsMarkdownCodeBlock
|
|
25
27
|
});
|
|
26
28
|
module.exports = __toCommonJS(src_exports);
|
|
27
|
-
var import_MarkdownText = require("./primitives/MarkdownText");
|
|
28
|
-
var import_PreOverride = require("./overrides/PreOverride");
|
|
29
|
-
var import_markdown_text = require("./ui/markdown-text");
|
|
30
|
-
var import_code_header = require("./ui/code-header");
|
|
29
|
+
var import_MarkdownText = require("./primitives/MarkdownText.cjs");
|
|
30
|
+
var import_PreOverride = require("./overrides/PreOverride.cjs");
|
|
31
|
+
var import_markdown_text = require("./ui/markdown-text.cjs");
|
|
32
|
+
var import_code_header = require("./ui/code-header.cjs");
|
|
31
33
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
34
|
0 && (module.exports = {
|
|
33
35
|
CodeHeader,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n MarkdownTextPrimitive,\n type MarkdownTextPrimitiveProps,\n} from \"./primitives/MarkdownText\";\n\nexport type {\n CodeHeaderProps,\n SyntaxHighlighterProps,\n} from \"./overrides/types\";\n\nexport { useIsMarkdownCodeBlock } from \"./overrides/PreOverride\";\n\nexport {\n makeMarkdownText,\n type MakeMarkdownTextProps,\n} from \"./ui/markdown-text\";\n\nexport { CodeHeader } from \"./ui/code-header\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n MarkdownTextPrimitive,\n type MarkdownTextPrimitiveProps,\n} from \"./primitives/MarkdownText\";\n\nexport type {\n CodeHeaderProps,\n SyntaxHighlighterProps,\n} from \"./overrides/types\";\n\nexport { useIsMarkdownCodeBlock } from \"./overrides/PreOverride\";\n\nexport {\n makeMarkdownText,\n type MakeMarkdownTextProps,\n} from \"./ui/markdown-text\";\n\nexport { CodeHeader } from \"./ui/code-header\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAGO;AAOP,yBAAuC;AAEvC,2BAGO;AAEP,yBAA2B;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
// src/index.ts
|
|
1
2
|
import {
|
|
2
3
|
MarkdownTextPrimitive
|
|
3
|
-
} from "./primitives/MarkdownText";
|
|
4
|
-
import { useIsMarkdownCodeBlock } from "./overrides/PreOverride";
|
|
4
|
+
} from "./primitives/MarkdownText.mjs";
|
|
5
|
+
import { useIsMarkdownCodeBlock } from "./overrides/PreOverride.mjs";
|
|
5
6
|
import {
|
|
6
7
|
makeMarkdownText
|
|
7
|
-
} from "./ui/markdown-text";
|
|
8
|
-
import { CodeHeader } from "./ui/code-header";
|
|
8
|
+
} from "./ui/markdown-text.mjs";
|
|
9
|
+
import { CodeHeader } from "./ui/code-header.mjs";
|
|
9
10
|
export {
|
|
10
11
|
CodeHeader,
|
|
11
12
|
MarkdownTextPrimitive,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n MarkdownTextPrimitive,\n type MarkdownTextPrimitiveProps,\n} from \"./primitives/MarkdownText\";\n\nexport type {\n CodeHeaderProps,\n SyntaxHighlighterProps,\n} from \"./overrides/types\";\n\nexport { useIsMarkdownCodeBlock } from \"./overrides/PreOverride\";\n\nexport {\n makeMarkdownText,\n type MakeMarkdownTextProps,\n} from \"./ui/markdown-text\";\n\nexport { CodeHeader } from \"./ui/code-header\";\n"],"mappings":"AAAA;AAAA,EACE;AAAA,OAEK;AAOP,SAAS,8BAA8B;AAEvC;AAAA,EACE;AAAA,OAEK;AAEP,SAAS,kBAAkB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n MarkdownTextPrimitive,\n type MarkdownTextPrimitiveProps,\n} from \"./primitives/MarkdownText\";\n\nexport type {\n CodeHeaderProps,\n SyntaxHighlighterProps,\n} from \"./overrides/types\";\n\nexport { useIsMarkdownCodeBlock } from \"./overrides/PreOverride\";\n\nexport {\n makeMarkdownText,\n type MakeMarkdownTextProps,\n} from \"./ui/markdown-text\";\n\nexport { CodeHeader } from \"./ui/code-header\";\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAEK;AAOP,SAAS,8BAA8B;AAEvC;AAAA,EACE;AAAA,OAEK;AAEP,SAAS,kBAAkB;","names":[]}
|
|
@@ -16,15 +16,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/overrides/CodeBlock.tsx
|
|
19
21
|
var CodeBlock_exports = {};
|
|
20
22
|
__export(CodeBlock_exports, {
|
|
21
23
|
DefaultCodeBlock: () => DefaultCodeBlock
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(CodeBlock_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
26
|
var import_react = require("react");
|
|
26
|
-
var import_defaultComponents = require("./defaultComponents");
|
|
27
|
-
|
|
27
|
+
var import_defaultComponents = require("./defaultComponents.cjs");
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
var DefaultCodeBlock = ({
|
|
28
30
|
components: { Pre, Code, SyntaxHighlighter, CodeHeader },
|
|
29
31
|
language,
|
|
30
32
|
code
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overrides/CodeBlock.tsx"],"sourcesContent":["import { ComponentType, FC, useMemo } from \"react\";\n\nimport {\n CodeComponent,\n CodeHeaderProps,\n PreComponent,\n SyntaxHighlighterProps,\n} from \"./types\";\nimport { DefaultCodeBlockContent } from \"./defaultComponents\";\n\nexport type CodeBlockProps = {\n language: string;\n code: string;\n components: {\n Pre: PreComponent;\n Code: CodeComponent;\n CodeHeader: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter: ComponentType<SyntaxHighlighterProps>;\n };\n};\n\nexport const DefaultCodeBlock: FC<CodeBlockProps> = ({\n components: { Pre, Code, SyntaxHighlighter, CodeHeader },\n language,\n code,\n}) => {\n const components = useMemo(() => ({ Pre, Code }), [Pre, Code]);\n\n const SH = !!language ? SyntaxHighlighter : DefaultCodeBlockContent;\n\n return (\n <>\n <CodeHeader language={language} code={code} />\n <SH\n components={components}\n language={language ?? \"unknown\"}\n code={code}\n />\n </>\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/overrides/CodeBlock.tsx"],"sourcesContent":["import { ComponentType, FC, useMemo } from \"react\";\n\nimport {\n CodeComponent,\n CodeHeaderProps,\n PreComponent,\n SyntaxHighlighterProps,\n} from \"./types\";\nimport { DefaultCodeBlockContent } from \"./defaultComponents\";\n\nexport type CodeBlockProps = {\n language: string;\n code: string;\n components: {\n Pre: PreComponent;\n Code: CodeComponent;\n CodeHeader: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter: ComponentType<SyntaxHighlighterProps>;\n };\n};\n\nexport const DefaultCodeBlock: FC<CodeBlockProps> = ({\n components: { Pre, Code, SyntaxHighlighter, CodeHeader },\n language,\n code,\n}) => {\n const components = useMemo(() => ({ Pre, Code }), [Pre, Code]);\n\n const SH = !!language ? SyntaxHighlighter : DefaultCodeBlockContent;\n\n return (\n <>\n <CodeHeader language={language} code={code} />\n <SH\n components={components}\n language={language ?? \"unknown\"}\n code={code}\n />\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2C;AAQ3C,+BAAwC;AAuBpC;AAVG,IAAM,mBAAuC,CAAC;AAAA,EACnD,YAAY,EAAE,KAAK,MAAM,mBAAmB,WAAW;AAAA,EACvD;AAAA,EACA;AACF,MAAM;AACJ,QAAM,iBAAa,sBAAQ,OAAO,EAAE,KAAK,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC;AAE7D,QAAM,KAAK,CAAC,CAAC,WAAW,oBAAoB;AAE5C,SACE,4EACE;AAAA,gDAAC,cAAW,UAAoB,MAAY;AAAA,IAC5C;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,UAAU,YAAY;AAAA,QACtB;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// src/overrides/CodeBlock.tsx
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
-
import { DefaultCodeBlockContent } from "./defaultComponents";
|
|
4
|
-
|
|
3
|
+
import { DefaultCodeBlockContent } from "./defaultComponents.mjs";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
var DefaultCodeBlock = ({
|
|
5
6
|
components: { Pre, Code, SyntaxHighlighter, CodeHeader },
|
|
6
7
|
language,
|
|
7
8
|
code
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overrides/CodeBlock.tsx"],"sourcesContent":["import { ComponentType, FC, useMemo } from \"react\";\n\nimport {\n CodeComponent,\n CodeHeaderProps,\n PreComponent,\n SyntaxHighlighterProps,\n} from \"./types\";\nimport { DefaultCodeBlockContent } from \"./defaultComponents\";\n\nexport type CodeBlockProps = {\n language: string;\n code: string;\n components: {\n Pre: PreComponent;\n Code: CodeComponent;\n CodeHeader: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter: ComponentType<SyntaxHighlighterProps>;\n };\n};\n\nexport const DefaultCodeBlock: FC<CodeBlockProps> = ({\n components: { Pre, Code, SyntaxHighlighter, CodeHeader },\n language,\n code,\n}) => {\n const components = useMemo(() => ({ Pre, Code }), [Pre, Code]);\n\n const SH = !!language ? SyntaxHighlighter : DefaultCodeBlockContent;\n\n return (\n <>\n <CodeHeader language={language} code={code} />\n <SH\n components={components}\n language={language ?? \"unknown\"}\n code={code}\n />\n </>\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/overrides/CodeBlock.tsx"],"sourcesContent":["import { ComponentType, FC, useMemo } from \"react\";\n\nimport {\n CodeComponent,\n CodeHeaderProps,\n PreComponent,\n SyntaxHighlighterProps,\n} from \"./types\";\nimport { DefaultCodeBlockContent } from \"./defaultComponents\";\n\nexport type CodeBlockProps = {\n language: string;\n code: string;\n components: {\n Pre: PreComponent;\n Code: CodeComponent;\n CodeHeader: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter: ComponentType<SyntaxHighlighterProps>;\n };\n};\n\nexport const DefaultCodeBlock: FC<CodeBlockProps> = ({\n components: { Pre, Code, SyntaxHighlighter, CodeHeader },\n language,\n code,\n}) => {\n const components = useMemo(() => ({ Pre, Code }), [Pre, Code]);\n\n const SH = !!language ? SyntaxHighlighter : DefaultCodeBlockContent;\n\n return (\n <>\n <CodeHeader language={language} code={code} />\n <SH\n components={components}\n language={language ?? \"unknown\"}\n code={code}\n />\n </>\n );\n};\n"],"mappings":";AAAA,SAA4B,eAAe;AAQ3C,SAAS,+BAA+B;AAuBpC,mBACE,KADF;AAVG,IAAM,mBAAuC,CAAC;AAAA,EACnD,YAAY,EAAE,KAAK,MAAM,mBAAmB,WAAW;AAAA,EACvD;AAAA,EACA;AACF,MAAM;AACJ,QAAM,aAAa,QAAQ,OAAO,EAAE,KAAK,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC;AAE7D,QAAM,KAAK,CAAC,CAAC,WAAW,oBAAoB;AAE5C,SACE,iCACE;AAAA,wBAAC,cAAW,UAAoB,MAAY;AAAA,IAC5C;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,UAAU,YAAY;AAAA,QACtB;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -16,19 +16,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/overrides/CodeOverride.tsx
|
|
19
21
|
var CodeOverride_exports = {};
|
|
20
22
|
__export(CodeOverride_exports, {
|
|
21
23
|
CodeOverride: () => CodeOverride
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(CodeOverride_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
26
|
var import_react = require("react");
|
|
26
|
-
var import_PreOverride = require("./PreOverride");
|
|
27
|
-
var import_CodeBlock = require("./CodeBlock");
|
|
27
|
+
var import_PreOverride = require("./PreOverride.cjs");
|
|
28
|
+
var import_CodeBlock = require("./CodeBlock.cjs");
|
|
28
29
|
var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref");
|
|
29
|
-
var import_withDefaults = require("./withDefaults");
|
|
30
|
-
var import_defaultComponents = require("./defaultComponents");
|
|
31
|
-
|
|
30
|
+
var import_withDefaults = require("./withDefaults.cjs");
|
|
31
|
+
var import_defaultComponents = require("./defaultComponents.cjs");
|
|
32
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
+
var CodeBlockOverride = ({
|
|
32
34
|
components: {
|
|
33
35
|
Pre,
|
|
34
36
|
Code,
|
|
@@ -70,7 +72,7 @@ const CodeBlockOverride = ({
|
|
|
70
72
|
}
|
|
71
73
|
);
|
|
72
74
|
};
|
|
73
|
-
|
|
75
|
+
var CodeOverride = ({
|
|
74
76
|
components,
|
|
75
77
|
...props
|
|
76
78
|
}) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overrides/CodeOverride.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, ComponentType, FC, useContext } from \"react\";\nimport { PreContext } from \"./PreOverride\";\nimport {\n CodeComponent,\n CodeHeaderProps,\n PreComponent,\n SyntaxHighlighterProps,\n} from \"./types\";\nimport { DefaultCodeBlock } from \"./CodeBlock\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { withDefaultProps } from \"./withDefaults\";\nimport { DefaultCodeBlockContent } from \"./defaultComponents\";\n\nconst CodeBlockOverride: FC<CodeOverrideProps> = ({\n components: {\n Pre,\n Code,\n SyntaxHighlighter: FallbackSyntaxHighlighter,\n CodeHeader: FallbackCodeHeader,\n by_language = {},\n },\n children,\n ...codeProps\n}) => {\n const preProps = useContext(PreContext)!;\n const getPreProps = withDefaultProps<any>(preProps);\n const WrappedPre: PreComponent = useCallbackRef((props) => (\n <Pre {...getPreProps(props)} />\n ));\n\n const getCodeProps = withDefaultProps<any>(codeProps);\n const WrappedCode: CodeComponent = useCallbackRef((props) => (\n <Code {...getCodeProps(props)} />\n ));\n\n const language = /language-(\\w+)/.exec(codeProps.className || \"\")?.[1] ?? \"\";\n\n // if the code content is not string (due to rehype plugins), return a default code block\n if (typeof children !== \"string\") {\n return (\n <DefaultCodeBlockContent\n components={{ Pre: WrappedPre, Code: WrappedCode }}\n code={children}\n />\n );\n }\n\n const SyntaxHighlighter: ComponentType<SyntaxHighlighterProps> =\n by_language[language]?.SyntaxHighlighter ?? FallbackSyntaxHighlighter;\n\n const CodeHeader: ComponentType<CodeHeaderProps> =\n by_language[language]?.CodeHeader ?? FallbackCodeHeader;\n\n return (\n <DefaultCodeBlock\n components={{\n Pre: WrappedPre,\n Code: WrappedCode,\n SyntaxHighlighter,\n CodeHeader,\n }}\n language={language || \"unknown\"}\n code={children}\n />\n );\n};\n\nexport type CodeOverrideProps = ComponentPropsWithoutRef<CodeComponent> & {\n components: {\n Pre: PreComponent;\n Code: CodeComponent;\n CodeHeader: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter: ComponentType<SyntaxHighlighterProps>;\n by_language?: Record<\n string,\n {\n CodeHeader?: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps>;\n }\n >;\n };\n};\n\nexport const CodeOverride: FC<CodeOverrideProps> = ({\n components,\n ...props\n}) => {\n const preProps = useContext(PreContext);\n if (!preProps) return <components.Code {...(props as any)} />;\n return <CodeBlockOverride components={components} {...props} />;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/overrides/CodeOverride.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, ComponentType, FC, useContext } from \"react\";\nimport { PreContext } from \"./PreOverride\";\nimport {\n CodeComponent,\n CodeHeaderProps,\n PreComponent,\n SyntaxHighlighterProps,\n} from \"./types\";\nimport { DefaultCodeBlock } from \"./CodeBlock\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { withDefaultProps } from \"./withDefaults\";\nimport { DefaultCodeBlockContent } from \"./defaultComponents\";\n\nconst CodeBlockOverride: FC<CodeOverrideProps> = ({\n components: {\n Pre,\n Code,\n SyntaxHighlighter: FallbackSyntaxHighlighter,\n CodeHeader: FallbackCodeHeader,\n by_language = {},\n },\n children,\n ...codeProps\n}) => {\n const preProps = useContext(PreContext)!;\n const getPreProps = withDefaultProps<any>(preProps);\n const WrappedPre: PreComponent = useCallbackRef((props) => (\n <Pre {...getPreProps(props)} />\n ));\n\n const getCodeProps = withDefaultProps<any>(codeProps);\n const WrappedCode: CodeComponent = useCallbackRef((props) => (\n <Code {...getCodeProps(props)} />\n ));\n\n const language = /language-(\\w+)/.exec(codeProps.className || \"\")?.[1] ?? \"\";\n\n // if the code content is not string (due to rehype plugins), return a default code block\n if (typeof children !== \"string\") {\n return (\n <DefaultCodeBlockContent\n components={{ Pre: WrappedPre, Code: WrappedCode }}\n code={children}\n />\n );\n }\n\n const SyntaxHighlighter: ComponentType<SyntaxHighlighterProps> =\n by_language[language]?.SyntaxHighlighter ?? FallbackSyntaxHighlighter;\n\n const CodeHeader: ComponentType<CodeHeaderProps> =\n by_language[language]?.CodeHeader ?? FallbackCodeHeader;\n\n return (\n <DefaultCodeBlock\n components={{\n Pre: WrappedPre,\n Code: WrappedCode,\n SyntaxHighlighter,\n CodeHeader,\n }}\n language={language || \"unknown\"}\n code={children}\n />\n );\n};\n\nexport type CodeOverrideProps = ComponentPropsWithoutRef<CodeComponent> & {\n components: {\n Pre: PreComponent;\n Code: CodeComponent;\n CodeHeader: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter: ComponentType<SyntaxHighlighterProps>;\n by_language?: Record<\n string,\n {\n CodeHeader?: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps>;\n }\n >;\n };\n};\n\nexport const CodeOverride: FC<CodeOverrideProps> = ({\n components,\n ...props\n}) => {\n const preProps = useContext(PreContext);\n if (!preProps) return <components.Code {...(props as any)} />;\n return <CodeBlockOverride components={components} {...props} />;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwE;AACxE,yBAA2B;AAO3B,uBAAiC;AACjC,oCAA+B;AAC/B,0BAAiC;AACjC,+BAAwC;AAgBpC;AAdJ,IAAM,oBAA2C,CAAC;AAAA,EAChD,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,IACnB,YAAY;AAAA,IACZ,cAAc,CAAC;AAAA,EACjB;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,eAAW,yBAAW,6BAAU;AACtC,QAAM,kBAAc,sCAAsB,QAAQ;AAClD,QAAM,iBAA2B,8CAAe,CAAC,UAC/C,4CAAC,OAAK,GAAG,YAAY,KAAK,GAAG,CAC9B;AAED,QAAM,mBAAe,sCAAsB,SAAS;AACpD,QAAM,kBAA6B,8CAAe,CAAC,UACjD,4CAAC,QAAM,GAAG,aAAa,KAAK,GAAG,CAChC;AAED,QAAM,WAAW,iBAAiB,KAAK,UAAU,aAAa,EAAE,IAAI,CAAC,KAAK;AAG1E,MAAI,OAAO,aAAa,UAAU;AAChC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,YAAY,EAAE,KAAK,YAAY,MAAM,YAAY;AAAA,QACjD,MAAM;AAAA;AAAA,IACR;AAAA,EAEJ;AAEA,QAAM,oBACJ,YAAY,QAAQ,GAAG,qBAAqB;AAE9C,QAAM,aACJ,YAAY,QAAQ,GAAG,cAAc;AAEvC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,YAAY;AAAA,QACV,KAAK;AAAA,QACL,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACF;AAAA,MACA,UAAU,YAAY;AAAA,MACtB,MAAM;AAAA;AAAA,EACR;AAEJ;AAkBO,IAAM,eAAsC,CAAC;AAAA,EAClD;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,eAAW,yBAAW,6BAAU;AACtC,MAAI,CAAC,SAAU,QAAO,4CAAC,WAAW,MAAX,EAAiB,GAAI,OAAe;AAC3D,SAAO,4CAAC,qBAAkB,YAAyB,GAAG,OAAO;AAC/D;","names":[]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
// src/overrides/CodeOverride.tsx
|
|
2
2
|
import { useContext } from "react";
|
|
3
|
-
import { PreContext } from "./PreOverride";
|
|
4
|
-
import { DefaultCodeBlock } from "./CodeBlock";
|
|
3
|
+
import { PreContext } from "./PreOverride.mjs";
|
|
4
|
+
import { DefaultCodeBlock } from "./CodeBlock.mjs";
|
|
5
5
|
import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
|
|
6
|
-
import { withDefaultProps } from "./withDefaults";
|
|
7
|
-
import { DefaultCodeBlockContent } from "./defaultComponents";
|
|
8
|
-
|
|
6
|
+
import { withDefaultProps } from "./withDefaults.mjs";
|
|
7
|
+
import { DefaultCodeBlockContent } from "./defaultComponents.mjs";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
var CodeBlockOverride = ({
|
|
9
10
|
components: {
|
|
10
11
|
Pre,
|
|
11
12
|
Code,
|
|
@@ -47,7 +48,7 @@ const CodeBlockOverride = ({
|
|
|
47
48
|
}
|
|
48
49
|
);
|
|
49
50
|
};
|
|
50
|
-
|
|
51
|
+
var CodeOverride = ({
|
|
51
52
|
components,
|
|
52
53
|
...props
|
|
53
54
|
}) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overrides/CodeOverride.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, ComponentType, FC, useContext } from \"react\";\nimport { PreContext } from \"./PreOverride\";\nimport {\n CodeComponent,\n CodeHeaderProps,\n PreComponent,\n SyntaxHighlighterProps,\n} from \"./types\";\nimport { DefaultCodeBlock } from \"./CodeBlock\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { withDefaultProps } from \"./withDefaults\";\nimport { DefaultCodeBlockContent } from \"./defaultComponents\";\n\nconst CodeBlockOverride: FC<CodeOverrideProps> = ({\n components: {\n Pre,\n Code,\n SyntaxHighlighter: FallbackSyntaxHighlighter,\n CodeHeader: FallbackCodeHeader,\n by_language = {},\n },\n children,\n ...codeProps\n}) => {\n const preProps = useContext(PreContext)!;\n const getPreProps = withDefaultProps<any>(preProps);\n const WrappedPre: PreComponent = useCallbackRef((props) => (\n <Pre {...getPreProps(props)} />\n ));\n\n const getCodeProps = withDefaultProps<any>(codeProps);\n const WrappedCode: CodeComponent = useCallbackRef((props) => (\n <Code {...getCodeProps(props)} />\n ));\n\n const language = /language-(\\w+)/.exec(codeProps.className || \"\")?.[1] ?? \"\";\n\n // if the code content is not string (due to rehype plugins), return a default code block\n if (typeof children !== \"string\") {\n return (\n <DefaultCodeBlockContent\n components={{ Pre: WrappedPre, Code: WrappedCode }}\n code={children}\n />\n );\n }\n\n const SyntaxHighlighter: ComponentType<SyntaxHighlighterProps> =\n by_language[language]?.SyntaxHighlighter ?? FallbackSyntaxHighlighter;\n\n const CodeHeader: ComponentType<CodeHeaderProps> =\n by_language[language]?.CodeHeader ?? FallbackCodeHeader;\n\n return (\n <DefaultCodeBlock\n components={{\n Pre: WrappedPre,\n Code: WrappedCode,\n SyntaxHighlighter,\n CodeHeader,\n }}\n language={language || \"unknown\"}\n code={children}\n />\n );\n};\n\nexport type CodeOverrideProps = ComponentPropsWithoutRef<CodeComponent> & {\n components: {\n Pre: PreComponent;\n Code: CodeComponent;\n CodeHeader: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter: ComponentType<SyntaxHighlighterProps>;\n by_language?: Record<\n string,\n {\n CodeHeader?: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps>;\n }\n >;\n };\n};\n\nexport const CodeOverride: FC<CodeOverrideProps> = ({\n components,\n ...props\n}) => {\n const preProps = useContext(PreContext);\n if (!preProps) return <components.Code {...(props as any)} />;\n return <CodeBlockOverride components={components} {...props} />;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/overrides/CodeOverride.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, ComponentType, FC, useContext } from \"react\";\nimport { PreContext } from \"./PreOverride\";\nimport {\n CodeComponent,\n CodeHeaderProps,\n PreComponent,\n SyntaxHighlighterProps,\n} from \"./types\";\nimport { DefaultCodeBlock } from \"./CodeBlock\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { withDefaultProps } from \"./withDefaults\";\nimport { DefaultCodeBlockContent } from \"./defaultComponents\";\n\nconst CodeBlockOverride: FC<CodeOverrideProps> = ({\n components: {\n Pre,\n Code,\n SyntaxHighlighter: FallbackSyntaxHighlighter,\n CodeHeader: FallbackCodeHeader,\n by_language = {},\n },\n children,\n ...codeProps\n}) => {\n const preProps = useContext(PreContext)!;\n const getPreProps = withDefaultProps<any>(preProps);\n const WrappedPre: PreComponent = useCallbackRef((props) => (\n <Pre {...getPreProps(props)} />\n ));\n\n const getCodeProps = withDefaultProps<any>(codeProps);\n const WrappedCode: CodeComponent = useCallbackRef((props) => (\n <Code {...getCodeProps(props)} />\n ));\n\n const language = /language-(\\w+)/.exec(codeProps.className || \"\")?.[1] ?? \"\";\n\n // if the code content is not string (due to rehype plugins), return a default code block\n if (typeof children !== \"string\") {\n return (\n <DefaultCodeBlockContent\n components={{ Pre: WrappedPre, Code: WrappedCode }}\n code={children}\n />\n );\n }\n\n const SyntaxHighlighter: ComponentType<SyntaxHighlighterProps> =\n by_language[language]?.SyntaxHighlighter ?? FallbackSyntaxHighlighter;\n\n const CodeHeader: ComponentType<CodeHeaderProps> =\n by_language[language]?.CodeHeader ?? FallbackCodeHeader;\n\n return (\n <DefaultCodeBlock\n components={{\n Pre: WrappedPre,\n Code: WrappedCode,\n SyntaxHighlighter,\n CodeHeader,\n }}\n language={language || \"unknown\"}\n code={children}\n />\n );\n};\n\nexport type CodeOverrideProps = ComponentPropsWithoutRef<CodeComponent> & {\n components: {\n Pre: PreComponent;\n Code: CodeComponent;\n CodeHeader: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter: ComponentType<SyntaxHighlighterProps>;\n by_language?: Record<\n string,\n {\n CodeHeader?: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps>;\n }\n >;\n };\n};\n\nexport const CodeOverride: FC<CodeOverrideProps> = ({\n components,\n ...props\n}) => {\n const preProps = useContext(PreContext);\n if (!preProps) return <components.Code {...(props as any)} />;\n return <CodeBlockOverride components={components} {...props} />;\n};\n"],"mappings":";AAAA,SAAsD,kBAAkB;AACxE,SAAS,kBAAkB;AAO3B,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,+BAA+B;AAgBpC;AAdJ,IAAM,oBAA2C,CAAC;AAAA,EAChD,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,IACnB,YAAY;AAAA,IACZ,cAAc,CAAC;AAAA,EACjB;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,WAAW,WAAW,UAAU;AACtC,QAAM,cAAc,iBAAsB,QAAQ;AAClD,QAAM,aAA2B,eAAe,CAAC,UAC/C,oBAAC,OAAK,GAAG,YAAY,KAAK,GAAG,CAC9B;AAED,QAAM,eAAe,iBAAsB,SAAS;AACpD,QAAM,cAA6B,eAAe,CAAC,UACjD,oBAAC,QAAM,GAAG,aAAa,KAAK,GAAG,CAChC;AAED,QAAM,WAAW,iBAAiB,KAAK,UAAU,aAAa,EAAE,IAAI,CAAC,KAAK;AAG1E,MAAI,OAAO,aAAa,UAAU;AAChC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,YAAY,EAAE,KAAK,YAAY,MAAM,YAAY;AAAA,QACjD,MAAM;AAAA;AAAA,IACR;AAAA,EAEJ;AAEA,QAAM,oBACJ,YAAY,QAAQ,GAAG,qBAAqB;AAE9C,QAAM,aACJ,YAAY,QAAQ,GAAG,cAAc;AAEvC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,YAAY;AAAA,QACV,KAAK;AAAA,QACL,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACF;AAAA,MACA,UAAU,YAAY;AAAA,MACtB,MAAM;AAAA;AAAA,EACR;AAEJ;AAkBO,IAAM,eAAsC,CAAC;AAAA,EAClD;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,WAAW,WAAW,UAAU;AACtC,MAAI,CAAC,SAAU,QAAO,oBAAC,WAAW,MAAX,EAAiB,GAAI,OAAe;AAC3D,SAAO,oBAAC,qBAAkB,YAAyB,GAAG,OAAO;AAC/D;","names":[]}
|
|
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/overrides/PreOverride.tsx
|
|
19
21
|
var PreOverride_exports = {};
|
|
20
22
|
__export(PreOverride_exports, {
|
|
21
23
|
PreContext: () => PreContext,
|
|
@@ -23,13 +25,13 @@ __export(PreOverride_exports, {
|
|
|
23
25
|
useIsMarkdownCodeBlock: () => useIsMarkdownCodeBlock
|
|
24
26
|
});
|
|
25
27
|
module.exports = __toCommonJS(PreOverride_exports);
|
|
26
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
28
|
var import_react = require("react");
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
var PreContext = (0, import_react.createContext)(null);
|
|
31
|
+
var useIsMarkdownCodeBlock = () => {
|
|
30
32
|
return (0, import_react.useContext)(PreContext) !== null;
|
|
31
33
|
};
|
|
32
|
-
|
|
34
|
+
var PreOverride = ({ children, ...rest }) => {
|
|
33
35
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PreContext.Provider, { value: rest, children });
|
|
34
36
|
};
|
|
35
37
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overrides/PreOverride.tsx"],"sourcesContent":["import { createContext, ComponentPropsWithoutRef, useContext } from \"react\";\nimport { PreComponent } from \"./types\";\n\nexport const PreContext = createContext<Omit<\n ComponentPropsWithoutRef<PreComponent>,\n \"children\"\n> | null>(null);\n\nexport const useIsMarkdownCodeBlock = () => {\n return useContext(PreContext) !== null;\n};\n\nexport const PreOverride: PreComponent = ({ children, ...rest }) => {\n return <PreContext.Provider value={rest}>{children}</PreContext.Provider>;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/overrides/PreOverride.tsx"],"sourcesContent":["import { createContext, ComponentPropsWithoutRef, useContext } from \"react\";\nimport { PreComponent } from \"./types\";\n\nexport const PreContext = createContext<Omit<\n ComponentPropsWithoutRef<PreComponent>,\n \"children\"\n> | null>(null);\n\nexport const useIsMarkdownCodeBlock = () => {\n return useContext(PreContext) !== null;\n};\n\nexport const PreOverride: PreComponent = ({ children, ...rest }) => {\n return <PreContext.Provider value={rest}>{children}</PreContext.Provider>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoE;AAa3D;AAVF,IAAM,iBAAa,4BAGhB,IAAI;AAEP,IAAM,yBAAyB,MAAM;AAC1C,aAAO,yBAAW,UAAU,MAAM;AACpC;AAEO,IAAM,cAA4B,CAAC,EAAE,UAAU,GAAG,KAAK,MAAM;AAClE,SAAO,4CAAC,WAAW,UAAX,EAAoB,OAAO,MAAO,UAAS;AACrD;","names":[]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
// src/overrides/PreOverride.tsx
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var PreContext = createContext(null);
|
|
5
|
+
var useIsMarkdownCodeBlock = () => {
|
|
5
6
|
return useContext(PreContext) !== null;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
+
var PreOverride = ({ children, ...rest }) => {
|
|
8
9
|
return /* @__PURE__ */ jsx(PreContext.Provider, { value: rest, children });
|
|
9
10
|
};
|
|
10
11
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overrides/PreOverride.tsx"],"sourcesContent":["import { createContext, ComponentPropsWithoutRef, useContext } from \"react\";\nimport { PreComponent } from \"./types\";\n\nexport const PreContext = createContext<Omit<\n ComponentPropsWithoutRef<PreComponent>,\n \"children\"\n> | null>(null);\n\nexport const useIsMarkdownCodeBlock = () => {\n return useContext(PreContext) !== null;\n};\n\nexport const PreOverride: PreComponent = ({ children, ...rest }) => {\n return <PreContext.Provider value={rest}>{children}</PreContext.Provider>;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/overrides/PreOverride.tsx"],"sourcesContent":["import { createContext, ComponentPropsWithoutRef, useContext } from \"react\";\nimport { PreComponent } from \"./types\";\n\nexport const PreContext = createContext<Omit<\n ComponentPropsWithoutRef<PreComponent>,\n \"children\"\n> | null>(null);\n\nexport const useIsMarkdownCodeBlock = () => {\n return useContext(PreContext) !== null;\n};\n\nexport const PreOverride: PreComponent = ({ children, ...rest }) => {\n return <PreContext.Provider value={rest}>{children}</PreContext.Provider>;\n};\n"],"mappings":";AAAA,SAAS,eAAyC,kBAAkB;AAa3D;AAVF,IAAM,aAAa,cAGhB,IAAI;AAEP,IAAM,yBAAyB,MAAM;AAC1C,SAAO,WAAW,UAAU,MAAM;AACpC;AAEO,IAAM,cAA4B,CAAC,EAAE,UAAU,GAAG,KAAK,MAAM;AAClE,SAAO,oBAAC,WAAW,UAAX,EAAoB,OAAO,MAAO,UAAS;AACrD;","names":[]}
|
|
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/overrides/defaultComponents.tsx
|
|
19
21
|
var defaultComponents_exports = {};
|
|
20
22
|
__export(defaultComponents_exports, {
|
|
21
23
|
DefaultCode: () => DefaultCode,
|
|
@@ -25,10 +27,10 @@ __export(defaultComponents_exports, {
|
|
|
25
27
|
});
|
|
26
28
|
module.exports = __toCommonJS(defaultComponents_exports);
|
|
27
29
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
var DefaultPre = ({ node, ...rest }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { ...rest });
|
|
31
|
+
var DefaultCode = ({ node, ...rest }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { ...rest });
|
|
32
|
+
var DefaultCodeBlockContent = ({ components: { Pre, Code }, code }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pre, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Code, { children: code }) });
|
|
33
|
+
var DefaultCodeHeader = () => null;
|
|
32
34
|
// Annotate the CommonJS export names for ESM import in node:
|
|
33
35
|
0 && (module.exports = {
|
|
34
36
|
DefaultCode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overrides/defaultComponents.tsx"],"sourcesContent":["import type { ComponentType, ReactNode } from \"react\";\nimport { PreComponent, CodeComponent, CodeHeaderProps } from \"./types\";\n\nexport const DefaultPre: PreComponent = ({ node, ...rest }) => (\n <pre {...rest} />\n);\n\nexport const DefaultCode: CodeComponent = ({ node, ...rest }) => (\n <code {...rest} />\n);\n\nexport const DefaultCodeBlockContent: ComponentType<{\n components: { Pre: PreComponent; Code: CodeComponent };\n code: string | ReactNode | undefined;\n}> = ({ components: { Pre, Code }, code }) => (\n <Pre>\n <Code>{code}</Code>\n </Pre>\n);\n\nexport const DefaultCodeHeader: ComponentType<CodeHeaderProps> = () => null;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/overrides/defaultComponents.tsx"],"sourcesContent":["import type { ComponentType, ReactNode } from \"react\";\nimport { PreComponent, CodeComponent, CodeHeaderProps } from \"./types\";\n\nexport const DefaultPre: PreComponent = ({ node, ...rest }) => (\n <pre {...rest} />\n);\n\nexport const DefaultCode: CodeComponent = ({ node, ...rest }) => (\n <code {...rest} />\n);\n\nexport const DefaultCodeBlockContent: ComponentType<{\n components: { Pre: PreComponent; Code: CodeComponent };\n code: string | ReactNode | undefined;\n}> = ({ components: { Pre, Code }, code }) => (\n <Pre>\n <Code>{code}</Code>\n </Pre>\n);\n\nexport const DefaultCodeHeader: ComponentType<CodeHeaderProps> = () => null;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIE;AADK,IAAM,aAA2B,CAAC,EAAE,MAAM,GAAG,KAAK,MACvD,4CAAC,SAAK,GAAG,MAAM;AAGV,IAAM,cAA6B,CAAC,EAAE,MAAM,GAAG,KAAK,MACzD,4CAAC,UAAM,GAAG,MAAM;AAGX,IAAM,0BAGR,CAAC,EAAE,YAAY,EAAE,KAAK,KAAK,GAAG,KAAK,MACtC,4CAAC,OACC,sDAAC,QAAM,gBAAK,GACd;AAGK,IAAM,oBAAoD,MAAM;","names":[]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
// src/overrides/defaultComponents.tsx
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
var DefaultPre = ({ node, ...rest }) => /* @__PURE__ */ jsx("pre", { ...rest });
|
|
4
|
+
var DefaultCode = ({ node, ...rest }) => /* @__PURE__ */ jsx("code", { ...rest });
|
|
5
|
+
var DefaultCodeBlockContent = ({ components: { Pre, Code }, code }) => /* @__PURE__ */ jsx(Pre, { children: /* @__PURE__ */ jsx(Code, { children: code }) });
|
|
6
|
+
var DefaultCodeHeader = () => null;
|
|
6
7
|
export {
|
|
7
8
|
DefaultCode,
|
|
8
9
|
DefaultCodeBlockContent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overrides/defaultComponents.tsx"],"sourcesContent":["import type { ComponentType, ReactNode } from \"react\";\nimport { PreComponent, CodeComponent, CodeHeaderProps } from \"./types\";\n\nexport const DefaultPre: PreComponent = ({ node, ...rest }) => (\n <pre {...rest} />\n);\n\nexport const DefaultCode: CodeComponent = ({ node, ...rest }) => (\n <code {...rest} />\n);\n\nexport const DefaultCodeBlockContent: ComponentType<{\n components: { Pre: PreComponent; Code: CodeComponent };\n code: string | ReactNode | undefined;\n}> = ({ components: { Pre, Code }, code }) => (\n <Pre>\n <Code>{code}</Code>\n </Pre>\n);\n\nexport const DefaultCodeHeader: ComponentType<CodeHeaderProps> = () => null;\n"],"mappings":"AAIE;AADK,
|
|
1
|
+
{"version":3,"sources":["../../src/overrides/defaultComponents.tsx"],"sourcesContent":["import type { ComponentType, ReactNode } from \"react\";\nimport { PreComponent, CodeComponent, CodeHeaderProps } from \"./types\";\n\nexport const DefaultPre: PreComponent = ({ node, ...rest }) => (\n <pre {...rest} />\n);\n\nexport const DefaultCode: CodeComponent = ({ node, ...rest }) => (\n <code {...rest} />\n);\n\nexport const DefaultCodeBlockContent: ComponentType<{\n components: { Pre: PreComponent; Code: CodeComponent };\n code: string | ReactNode | undefined;\n}> = ({ components: { Pre, Code }, code }) => (\n <Pre>\n <Code>{code}</Code>\n </Pre>\n);\n\nexport const DefaultCodeHeader: ComponentType<CodeHeaderProps> = () => null;\n"],"mappings":";AAIE;AADK,IAAM,aAA2B,CAAC,EAAE,MAAM,GAAG,KAAK,MACvD,oBAAC,SAAK,GAAG,MAAM;AAGV,IAAM,cAA6B,CAAC,EAAE,MAAM,GAAG,KAAK,MACzD,oBAAC,UAAM,GAAG,MAAM;AAGX,IAAM,0BAGR,CAAC,EAAE,YAAY,EAAE,KAAK,KAAK,GAAG,KAAK,MACtC,oBAAC,OACC,8BAAC,QAAM,gBAAK,GACd;AAGK,IAAM,oBAAoD,MAAM;","names":[]}
|
package/dist/overrides/types.js
CHANGED
|
@@ -12,6 +12,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
12
12
|
return to;
|
|
13
13
|
};
|
|
14
14
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/overrides/types.ts
|
|
15
17
|
var types_exports = {};
|
|
16
18
|
module.exports = __toCommonJS(types_exports);
|
|
17
19
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overrides/types.ts"],"sourcesContent":["import { Options } from \"react-markdown\";\n\nexport type PreComponent = NonNullable<\n NonNullable<Options[\"components\"]>[\"pre\"]\n>;\nexport type CodeComponent = NonNullable<\n NonNullable<Options[\"components\"]>[\"code\"]\n>;\n\nexport type CodeHeaderProps = {\n language: string | undefined;\n code: string;\n};\n\nexport type SyntaxHighlighterProps = {\n components: {\n Pre: PreComponent;\n Code: CodeComponent;\n };\n language: string;\n code: string;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/overrides/types.ts"],"sourcesContent":["import { Options } from \"react-markdown\";\n\nexport type PreComponent = NonNullable<\n NonNullable<Options[\"components\"]>[\"pre\"]\n>;\nexport type CodeComponent = NonNullable<\n NonNullable<Options[\"components\"]>[\"code\"]\n>;\n\nexport type CodeHeaderProps = {\n language: string | undefined;\n code: string;\n};\n\nexport type SyntaxHighlighterProps = {\n components: {\n Pre: PreComponent;\n Code: CodeComponent;\n };\n language: string;\n code: string;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -26,13 +26,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/overrides/withDefaults.tsx
|
|
29
31
|
var withDefaults_exports = {};
|
|
30
32
|
__export(withDefaults_exports, {
|
|
31
33
|
withDefaultProps: () => withDefaultProps
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(withDefaults_exports);
|
|
34
36
|
var import_classnames = __toESM(require("classnames"));
|
|
35
|
-
|
|
37
|
+
var withDefaultProps = ({
|
|
36
38
|
className,
|
|
37
39
|
...defaultProps
|
|
38
40
|
}) => ({ className: classNameProp, ...props }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overrides/withDefaults.tsx"],"sourcesContent":["import classNames from \"classnames\";\n\nexport const withDefaultProps =\n <TProps extends { className?: string | undefined }>({\n className,\n ...defaultProps\n }: Partial<TProps>) =>\n ({ className: classNameProp, ...props }: TProps) => {\n return {\n className: classNames(className, classNameProp),\n ...defaultProps,\n ...props,\n } as TProps;\n };\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/overrides/withDefaults.tsx"],"sourcesContent":["import classNames from \"classnames\";\n\nexport const withDefaultProps =\n <TProps extends { className?: string | undefined }>({\n className,\n ...defaultProps\n }: Partial<TProps>) =>\n ({ className: classNameProp, ...props }: TProps) => {\n return {\n className: classNames(className, classNameProp),\n ...defaultProps,\n ...props,\n } as TProps;\n };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAuB;AAEhB,IAAM,mBACX,CAAoD;AAAA,EAClD;AAAA,EACA,GAAG;AACL,MACA,CAAC,EAAE,WAAW,eAAe,GAAG,MAAM,MAAc;AAClD,SAAO;AAAA,IACL,eAAW,kBAAAA,SAAW,WAAW,aAAa;AAAA,IAC9C,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;","names":["classNames"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/overrides/withDefaults.tsx"],"sourcesContent":["import classNames from \"classnames\";\n\nexport const withDefaultProps =\n <TProps extends { className?: string | undefined }>({\n className,\n ...defaultProps\n }: Partial<TProps>) =>\n ({ className: classNameProp, ...props }: TProps) => {\n return {\n className: classNames(className, classNameProp),\n ...defaultProps,\n ...props,\n } as TProps;\n };\n"],"mappings":"AAAA,OAAO,gBAAgB;AAEhB,
|
|
1
|
+
{"version":3,"sources":["../../src/overrides/withDefaults.tsx"],"sourcesContent":["import classNames from \"classnames\";\n\nexport const withDefaultProps =\n <TProps extends { className?: string | undefined }>({\n className,\n ...defaultProps\n }: Partial<TProps>) =>\n ({ className: classNameProp, ...props }: TProps) => {\n return {\n className: classNames(className, classNameProp),\n ...defaultProps,\n ...props,\n } as TProps;\n };\n"],"mappings":";AAAA,OAAO,gBAAgB;AAEhB,IAAM,mBACX,CAAoD;AAAA,EAClD;AAAA,EACA,GAAG;AACL,MACA,CAAC,EAAE,WAAW,eAAe,GAAG,MAAM,MAAc;AAClD,SAAO;AAAA,IACL,WAAW,WAAW,WAAW,aAAa;AAAA,IAC9C,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;","names":[]}
|
|
@@ -27,22 +27,24 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
mod
|
|
28
28
|
));
|
|
29
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/primitives/MarkdownText.tsx
|
|
30
32
|
var MarkdownText_exports = {};
|
|
31
33
|
__export(MarkdownText_exports, {
|
|
32
34
|
MarkdownTextPrimitive: () => MarkdownTextPrimitive
|
|
33
35
|
});
|
|
34
36
|
module.exports = __toCommonJS(MarkdownText_exports);
|
|
35
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
37
|
var import_react = require("@assistant-ui/react");
|
|
37
38
|
var import_react2 = require("react");
|
|
38
39
|
var import_react_markdown = __toESM(require("react-markdown"));
|
|
39
|
-
var import_PreOverride = require("../overrides/PreOverride");
|
|
40
|
-
var import_defaultComponents = require("../overrides/defaultComponents");
|
|
40
|
+
var import_PreOverride = require("../overrides/PreOverride.cjs");
|
|
41
|
+
var import_defaultComponents = require("../overrides/defaultComponents.cjs");
|
|
41
42
|
var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref");
|
|
42
|
-
var import_CodeOverride = require("../overrides/CodeOverride");
|
|
43
|
+
var import_CodeOverride = require("../overrides/CodeOverride.cjs");
|
|
43
44
|
var import_classnames = __toESM(require("classnames"));
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
46
|
+
var { useSmooth } = import_react.INTERNAL;
|
|
47
|
+
var MarkdownTextPrimitive = (0, import_react2.forwardRef)(
|
|
46
48
|
({
|
|
47
49
|
components: userComponents,
|
|
48
50
|
className,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/primitives/MarkdownText.tsx"],"sourcesContent":["\"use client\";\n\nimport { INTERNAL, useContentPartText } from \"@assistant-ui/react\";\nimport {\n ElementRef,\n ElementType,\n forwardRef,\n ForwardRefExoticComponent,\n RefAttributes,\n type ComponentPropsWithoutRef,\n type ComponentType,\n} from \"react\";\nimport ReactMarkdown, { type Options } from \"react-markdown\";\nimport { SyntaxHighlighterProps, CodeHeaderProps } from \"../overrides/types\";\nimport { PreOverride } from \"../overrides/PreOverride\";\nimport {\n DefaultPre,\n DefaultCode,\n DefaultCodeBlockContent,\n DefaultCodeHeader,\n} from \"../overrides/defaultComponents\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { CodeOverride } from \"../overrides/CodeOverride\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport classNames from \"classnames\";\n\nconst { useSmooth } = INTERNAL;\n\ntype MarkdownTextPrimitiveElement = ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;\n\nexport type MarkdownTextPrimitiveProps = Omit<\n Options,\n \"components\" | \"children\"\n> & {\n containerProps?: Omit<PrimitiveDivProps, \"children\" | \"asChild\">;\n containerComponent?: ElementType;\n components?: NonNullable<Options[\"components\"]> & {\n SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps>;\n CodeHeader?: ComponentType<CodeHeaderProps>;\n by_language?: Record<\n string,\n {\n CodeHeader?: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps>;\n }\n >;\n };\n smooth?: boolean;\n};\n\nexport const MarkdownTextPrimitive: ForwardRefExoticComponent<MarkdownTextPrimitiveProps> &\n RefAttributes<MarkdownTextPrimitiveElement> = forwardRef<\n MarkdownTextPrimitiveElement,\n MarkdownTextPrimitiveProps\n>(\n (\n {\n components: userComponents,\n className,\n containerProps,\n containerComponent: Container = \"div\",\n ...rest\n },\n forwardedRef,\n smooth = true,\n ) => {\n const { text, status } = useSmooth(useContentPartText(), smooth);\n\n const {\n pre = DefaultPre,\n code = DefaultCode,\n SyntaxHighlighter = DefaultCodeBlockContent,\n CodeHeader = DefaultCodeHeader,\n by_language,\n ...componentsRest\n } = userComponents ?? {};\n const components: typeof userComponents = {\n ...componentsRest,\n pre: PreOverride,\n code: useCallbackRef((props) => (\n <CodeOverride\n components={{\n Pre: pre,\n Code: code,\n SyntaxHighlighter,\n CodeHeader,\n by_language,\n }}\n {...props}\n />\n )),\n };\n\n return (\n <Container\n data-status={status.type}\n {...containerProps}\n className={classNames(className, containerProps?.className)}\n ref={forwardedRef}\n >\n <ReactMarkdown components={components} {...rest}>\n {text}\n </ReactMarkdown>\n </Container>\n );\n },\n);\n\nMarkdownTextPrimitive.displayName = \"MarkdownTextPrimitive\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/primitives/MarkdownText.tsx"],"sourcesContent":["\"use client\";\n\nimport { INTERNAL, useContentPartText } from \"@assistant-ui/react\";\nimport {\n ElementRef,\n ElementType,\n forwardRef,\n ForwardRefExoticComponent,\n RefAttributes,\n type ComponentPropsWithoutRef,\n type ComponentType,\n} from \"react\";\nimport ReactMarkdown, { type Options } from \"react-markdown\";\nimport { SyntaxHighlighterProps, CodeHeaderProps } from \"../overrides/types\";\nimport { PreOverride } from \"../overrides/PreOverride\";\nimport {\n DefaultPre,\n DefaultCode,\n DefaultCodeBlockContent,\n DefaultCodeHeader,\n} from \"../overrides/defaultComponents\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { CodeOverride } from \"../overrides/CodeOverride\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport classNames from \"classnames\";\n\nconst { useSmooth } = INTERNAL;\n\ntype MarkdownTextPrimitiveElement = ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;\n\nexport type MarkdownTextPrimitiveProps = Omit<\n Options,\n \"components\" | \"children\"\n> & {\n containerProps?: Omit<PrimitiveDivProps, \"children\" | \"asChild\">;\n containerComponent?: ElementType;\n components?: NonNullable<Options[\"components\"]> & {\n SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps>;\n CodeHeader?: ComponentType<CodeHeaderProps>;\n by_language?: Record<\n string,\n {\n CodeHeader?: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps>;\n }\n >;\n };\n smooth?: boolean;\n};\n\nexport const MarkdownTextPrimitive: ForwardRefExoticComponent<MarkdownTextPrimitiveProps> &\n RefAttributes<MarkdownTextPrimitiveElement> = forwardRef<\n MarkdownTextPrimitiveElement,\n MarkdownTextPrimitiveProps\n>(\n (\n {\n components: userComponents,\n className,\n containerProps,\n containerComponent: Container = \"div\",\n ...rest\n },\n forwardedRef,\n smooth = true,\n ) => {\n const { text, status } = useSmooth(useContentPartText(), smooth);\n\n const {\n pre = DefaultPre,\n code = DefaultCode,\n SyntaxHighlighter = DefaultCodeBlockContent,\n CodeHeader = DefaultCodeHeader,\n by_language,\n ...componentsRest\n } = userComponents ?? {};\n const components: typeof userComponents = {\n ...componentsRest,\n pre: PreOverride,\n code: useCallbackRef((props) => (\n <CodeOverride\n components={{\n Pre: pre,\n Code: code,\n SyntaxHighlighter,\n CodeHeader,\n by_language,\n }}\n {...props}\n />\n )),\n };\n\n return (\n <Container\n data-status={status.type}\n {...containerProps}\n className={classNames(className, containerProps?.className)}\n ref={forwardedRef}\n >\n <ReactMarkdown components={components} {...rest}>\n {text}\n </ReactMarkdown>\n </Container>\n );\n },\n);\n\nMarkdownTextPrimitive.displayName = \"MarkdownTextPrimitive\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA6C;AAC7C,IAAAA,gBAQO;AACP,4BAA4C;AAE5C,yBAA4B;AAC5B,+BAKO;AACP,oCAA+B;AAC/B,0BAA6B;AAE7B,wBAAuB;AAyDf;AAvDR,IAAM,EAAE,UAAU,IAAI;AAyBf,IAAM,4BACmC;AAAA,EAI9C,CACE;AAAA,IACE,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA,oBAAoB,YAAY;AAAA,IAChC,GAAG;AAAA,EACL,GACA,cACA,SAAS,SACN;AACH,UAAM,EAAE,MAAM,OAAO,IAAI,cAAU,iCAAmB,GAAG,MAAM;AAE/D,UAAM;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,MACP,oBAAoB;AAAA,MACpB,aAAa;AAAA,MACb;AAAA,MACA,GAAG;AAAA,IACL,IAAI,kBAAkB,CAAC;AACvB,UAAM,aAAoC;AAAA,MACxC,GAAG;AAAA,MACH,KAAK;AAAA,MACL,UAAM,8CAAe,CAAC,UACpB;AAAA,QAAC;AAAA;AAAA,UACC,YAAY;AAAA,YACV,KAAK;AAAA,YACL,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACC,GAAG;AAAA;AAAA,MACN,CACD;AAAA,IACH;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAa,OAAO;AAAA,QACnB,GAAG;AAAA,QACJ,eAAW,kBAAAC,SAAW,WAAW,gBAAgB,SAAS;AAAA,QAC1D,KAAK;AAAA,QAEL,sDAAC,sBAAAC,SAAA,EAAc,YAAyB,GAAG,MACxC,gBACH;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,sBAAsB,cAAc;","names":["import_react","classNames","ReactMarkdown"]}
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
// src/primitives/MarkdownText.tsx
|
|
3
4
|
import { INTERNAL, useContentPartText } from "@assistant-ui/react";
|
|
4
5
|
import {
|
|
5
6
|
forwardRef
|
|
6
7
|
} from "react";
|
|
7
8
|
import ReactMarkdown from "react-markdown";
|
|
8
|
-
import { PreOverride } from "../overrides/PreOverride";
|
|
9
|
+
import { PreOverride } from "../overrides/PreOverride.mjs";
|
|
9
10
|
import {
|
|
10
11
|
DefaultPre,
|
|
11
12
|
DefaultCode,
|
|
12
13
|
DefaultCodeBlockContent,
|
|
13
14
|
DefaultCodeHeader
|
|
14
|
-
} from "../overrides/defaultComponents";
|
|
15
|
+
} from "../overrides/defaultComponents.mjs";
|
|
15
16
|
import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
|
|
16
|
-
import { CodeOverride } from "../overrides/CodeOverride";
|
|
17
|
+
import { CodeOverride } from "../overrides/CodeOverride.mjs";
|
|
17
18
|
import classNames from "classnames";
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
import { jsx } from "react/jsx-runtime";
|
|
20
|
+
var { useSmooth } = INTERNAL;
|
|
21
|
+
var MarkdownTextPrimitive = forwardRef(
|
|
20
22
|
({
|
|
21
23
|
components: userComponents,
|
|
22
24
|
className,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/primitives/MarkdownText.tsx"],"sourcesContent":["\"use client\";\n\nimport { INTERNAL, useContentPartText } from \"@assistant-ui/react\";\nimport {\n ElementRef,\n ElementType,\n forwardRef,\n ForwardRefExoticComponent,\n RefAttributes,\n type ComponentPropsWithoutRef,\n type ComponentType,\n} from \"react\";\nimport ReactMarkdown, { type Options } from \"react-markdown\";\nimport { SyntaxHighlighterProps, CodeHeaderProps } from \"../overrides/types\";\nimport { PreOverride } from \"../overrides/PreOverride\";\nimport {\n DefaultPre,\n DefaultCode,\n DefaultCodeBlockContent,\n DefaultCodeHeader,\n} from \"../overrides/defaultComponents\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { CodeOverride } from \"../overrides/CodeOverride\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport classNames from \"classnames\";\n\nconst { useSmooth } = INTERNAL;\n\ntype MarkdownTextPrimitiveElement = ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;\n\nexport type MarkdownTextPrimitiveProps = Omit<\n Options,\n \"components\" | \"children\"\n> & {\n containerProps?: Omit<PrimitiveDivProps, \"children\" | \"asChild\">;\n containerComponent?: ElementType;\n components?: NonNullable<Options[\"components\"]> & {\n SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps>;\n CodeHeader?: ComponentType<CodeHeaderProps>;\n by_language?: Record<\n string,\n {\n CodeHeader?: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps>;\n }\n >;\n };\n smooth?: boolean;\n};\n\nexport const MarkdownTextPrimitive: ForwardRefExoticComponent<MarkdownTextPrimitiveProps> &\n RefAttributes<MarkdownTextPrimitiveElement> = forwardRef<\n MarkdownTextPrimitiveElement,\n MarkdownTextPrimitiveProps\n>(\n (\n {\n components: userComponents,\n className,\n containerProps,\n containerComponent: Container = \"div\",\n ...rest\n },\n forwardedRef,\n smooth = true,\n ) => {\n const { text, status } = useSmooth(useContentPartText(), smooth);\n\n const {\n pre = DefaultPre,\n code = DefaultCode,\n SyntaxHighlighter = DefaultCodeBlockContent,\n CodeHeader = DefaultCodeHeader,\n by_language,\n ...componentsRest\n } = userComponents ?? {};\n const components: typeof userComponents = {\n ...componentsRest,\n pre: PreOverride,\n code: useCallbackRef((props) => (\n <CodeOverride\n components={{\n Pre: pre,\n Code: code,\n SyntaxHighlighter,\n CodeHeader,\n by_language,\n }}\n {...props}\n />\n )),\n };\n\n return (\n <Container\n data-status={status.type}\n {...containerProps}\n className={classNames(className, containerProps?.className)}\n ref={forwardedRef}\n >\n <ReactMarkdown components={components} {...rest}>\n {text}\n </ReactMarkdown>\n </Container>\n );\n },\n);\n\nMarkdownTextPrimitive.displayName = \"MarkdownTextPrimitive\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/primitives/MarkdownText.tsx"],"sourcesContent":["\"use client\";\n\nimport { INTERNAL, useContentPartText } from \"@assistant-ui/react\";\nimport {\n ElementRef,\n ElementType,\n forwardRef,\n ForwardRefExoticComponent,\n RefAttributes,\n type ComponentPropsWithoutRef,\n type ComponentType,\n} from \"react\";\nimport ReactMarkdown, { type Options } from \"react-markdown\";\nimport { SyntaxHighlighterProps, CodeHeaderProps } from \"../overrides/types\";\nimport { PreOverride } from \"../overrides/PreOverride\";\nimport {\n DefaultPre,\n DefaultCode,\n DefaultCodeBlockContent,\n DefaultCodeHeader,\n} from \"../overrides/defaultComponents\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { CodeOverride } from \"../overrides/CodeOverride\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport classNames from \"classnames\";\n\nconst { useSmooth } = INTERNAL;\n\ntype MarkdownTextPrimitiveElement = ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;\n\nexport type MarkdownTextPrimitiveProps = Omit<\n Options,\n \"components\" | \"children\"\n> & {\n containerProps?: Omit<PrimitiveDivProps, \"children\" | \"asChild\">;\n containerComponent?: ElementType;\n components?: NonNullable<Options[\"components\"]> & {\n SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps>;\n CodeHeader?: ComponentType<CodeHeaderProps>;\n by_language?: Record<\n string,\n {\n CodeHeader?: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps>;\n }\n >;\n };\n smooth?: boolean;\n};\n\nexport const MarkdownTextPrimitive: ForwardRefExoticComponent<MarkdownTextPrimitiveProps> &\n RefAttributes<MarkdownTextPrimitiveElement> = forwardRef<\n MarkdownTextPrimitiveElement,\n MarkdownTextPrimitiveProps\n>(\n (\n {\n components: userComponents,\n className,\n containerProps,\n containerComponent: Container = \"div\",\n ...rest\n },\n forwardedRef,\n smooth = true,\n ) => {\n const { text, status } = useSmooth(useContentPartText(), smooth);\n\n const {\n pre = DefaultPre,\n code = DefaultCode,\n SyntaxHighlighter = DefaultCodeBlockContent,\n CodeHeader = DefaultCodeHeader,\n by_language,\n ...componentsRest\n } = userComponents ?? {};\n const components: typeof userComponents = {\n ...componentsRest,\n pre: PreOverride,\n code: useCallbackRef((props) => (\n <CodeOverride\n components={{\n Pre: pre,\n Code: code,\n SyntaxHighlighter,\n CodeHeader,\n by_language,\n }}\n {...props}\n />\n )),\n };\n\n return (\n <Container\n data-status={status.type}\n {...containerProps}\n className={classNames(className, containerProps?.className)}\n ref={forwardedRef}\n >\n <ReactMarkdown components={components} {...rest}>\n {text}\n </ReactMarkdown>\n </Container>\n );\n },\n);\n\nMarkdownTextPrimitive.displayName = \"MarkdownTextPrimitive\";\n"],"mappings":";;;AAEA,SAAS,UAAU,0BAA0B;AAC7C;AAAA,EAGE;AAAA,OAKK;AACP,OAAO,mBAAqC;AAE5C,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAE7B,OAAO,gBAAgB;AAyDf;AAvDR,IAAM,EAAE,UAAU,IAAI;AAyBf,IAAM,wBACmC;AAAA,EAI9C,CACE;AAAA,IACE,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA,oBAAoB,YAAY;AAAA,IAChC,GAAG;AAAA,EACL,GACA,cACA,SAAS,SACN;AACH,UAAM,EAAE,MAAM,OAAO,IAAI,UAAU,mBAAmB,GAAG,MAAM;AAE/D,UAAM;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,MACP,oBAAoB;AAAA,MACpB,aAAa;AAAA,MACb;AAAA,MACA,GAAG;AAAA,IACL,IAAI,kBAAkB,CAAC;AACvB,UAAM,aAAoC;AAAA,MACxC,GAAG;AAAA,MACH,KAAK;AAAA,MACL,MAAM,eAAe,CAAC,UACpB;AAAA,QAAC;AAAA;AAAA,UACC,YAAY;AAAA,YACV,KAAK;AAAA,YACL,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACC,GAAG;AAAA;AAAA,MACN,CACD;AAAA,IACH;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAa,OAAO;AAAA,QACnB,GAAG;AAAA,QACJ,WAAW,WAAW,WAAW,gBAAgB,SAAS;AAAA,QAC1D,KAAK;AAAA,QAEL,8BAAC,iBAAc,YAAyB,GAAG,MACxC,gBACH;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,sBAAsB,cAAc;","names":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
":where(.aui-md-running):empty::after,\n:where(.aui-md-running) > :where(:not(ol):not(ul):not(pre)):last-child::after,\n:where(.aui-md-running) > pre:last-child code::after,\n:where(.aui-md-running)\n > :where(:is(ol, ul):last-child)\n > :where(li:last-child:not(:has(* > li)))::after,\n:where(.aui-md-running)\n > :where(:is(ol, ul):last-child)\n > :where(li:last-child)\n > :where(:is(ol, ul):last-child)\n > :where(li:last-child:not(:has(* > li)))::after,\n:where(.aui-md-running)\n > :where(:is(ol, ul):last-child)\n > :where(li:last-child)\n > :where(:is(ol, ul):last-child)\n > :where(li:last-child)\n > :where(:is(ol, ul):last-child)\n > :where(li:last-child)::after": {
|
|
3
|
+
"@apply animate-pulse font-sans content-['\\25CF'] ltr:ml-1 rtl:mr-1": {}
|
|
4
|
+
},
|
|
5
|
+
".aui-md-h1": {
|
|
6
|
+
"@apply mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0": {}
|
|
7
|
+
},
|
|
8
|
+
".aui-md-h2": {
|
|
9
|
+
"@apply mb-4 mt-8 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0": {}
|
|
10
|
+
},
|
|
11
|
+
".aui-md-h3": {
|
|
12
|
+
"@apply mb-4 mt-6 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0": {}
|
|
13
|
+
},
|
|
14
|
+
".aui-md-h4": {
|
|
15
|
+
"@apply mb-4 mt-6 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0": {}
|
|
16
|
+
},
|
|
17
|
+
".aui-md-h5": {
|
|
18
|
+
"@apply my-4 text-lg font-semibold first:mt-0 last:mb-0": {}
|
|
19
|
+
},
|
|
20
|
+
".aui-md-h6": {
|
|
21
|
+
"@apply my-4 font-semibold first:mt-0 last:mb-0": {}
|
|
22
|
+
},
|
|
23
|
+
".aui-md-p": {
|
|
24
|
+
"@apply mb-5 mt-5 leading-7 first:mt-0 last:mb-0": {}
|
|
25
|
+
},
|
|
26
|
+
".aui-md-a": {
|
|
27
|
+
"@apply text-aui-primary font-medium underline underline-offset-4": {}
|
|
28
|
+
},
|
|
29
|
+
".aui-md-blockquote": {
|
|
30
|
+
"@apply border-l-2 pl-6 italic": {}
|
|
31
|
+
},
|
|
32
|
+
".aui-md-ul": {
|
|
33
|
+
"@apply my-5 ml-6 list-disc [&>li]:mt-2": {}
|
|
34
|
+
},
|
|
35
|
+
".aui-md-ol": {
|
|
36
|
+
"@apply my-5 ml-6 list-decimal [&>li]:mt-2": {}
|
|
37
|
+
},
|
|
38
|
+
".aui-md-hr": {
|
|
39
|
+
"@apply my-5 border-b": {}
|
|
40
|
+
},
|
|
41
|
+
".aui-md-table": {
|
|
42
|
+
"@apply my-5 w-full border-separate border-spacing-0 overflow-y-auto": {}
|
|
43
|
+
},
|
|
44
|
+
".aui-md-th": {
|
|
45
|
+
"@apply bg-aui-muted px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [&[align=center]]:text-center [&[align=right]]:text-right": {}
|
|
46
|
+
},
|
|
47
|
+
".aui-md-td": {
|
|
48
|
+
"@apply border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right": {}
|
|
49
|
+
},
|
|
50
|
+
".aui-md-tr": {
|
|
51
|
+
"@apply m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg": {}
|
|
52
|
+
},
|
|
53
|
+
".aui-md-sup": {
|
|
54
|
+
"@apply [&>a]:text-xs [&>a]:no-underline": {}
|
|
55
|
+
},
|
|
56
|
+
".aui-md-pre": {
|
|
57
|
+
"@apply overflow-x-auto rounded-b-lg bg-black p-4 text-white": {}
|
|
58
|
+
},
|
|
59
|
+
".aui-md-inline-code": {
|
|
60
|
+
"@apply bg-aui-muted rounded border font-semibold": {}
|
|
61
|
+
},
|
|
62
|
+
".aui-code-header-root": {
|
|
63
|
+
"@apply flex items-center justify-between gap-4 rounded-t-lg bg-zinc-900 px-4 py-2 text-sm font-semibold text-white": {}
|
|
64
|
+
},
|
|
65
|
+
".aui-code-header-language": {
|
|
66
|
+
"@apply lowercase [&>span]:text-xs": {}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tailwindcss/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,SAAS;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tailwindcss/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,SAAS;;;cAIP,CAAC;;;CAFP,CAAC;AAEH,eAAe,SAAS,CAAC"}
|
|
@@ -26,14 +26,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/tailwindcss/index.ts
|
|
29
31
|
var tailwindcss_exports = {};
|
|
30
32
|
__export(tailwindcss_exports, {
|
|
31
33
|
default: () => tailwindcss_default
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(tailwindcss_exports);
|
|
34
36
|
var import_plugin = __toESM(require("tailwindcss/plugin.js"));
|
|
35
|
-
var import_markdown_css = __toESM(require("../../
|
|
36
|
-
|
|
37
|
+
var import_markdown_css = __toESM(require("../../dist/styles/tailwindcss/markdown.css.json"));
|
|
38
|
+
var auiPlugin = import_plugin.default.withOptions(() => ({ addComponents }) => {
|
|
37
39
|
addComponents(import_markdown_css.default);
|
|
38
40
|
});
|
|
39
41
|
var tailwindcss_default = auiPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/tailwindcss/index.ts"],"sourcesContent":["import plugin from \"tailwindcss/plugin.js\";\nimport markdownCSS from \"../../
|
|
1
|
+
{"version":3,"sources":["../../src/tailwindcss/index.ts"],"sourcesContent":["import plugin from \"tailwindcss/plugin.js\";\nimport markdownCSS from \"../../dist/styles/tailwindcss/markdown.css.json\";\n\nconst auiPlugin = plugin.withOptions<{}>(() => ({ addComponents }) => {\n addComponents(markdownCSS);\n});\n\nexport default auiPlugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AACnB,0BAAwB;AAExB,IAAM,YAAY,cAAAA,QAAO,YAAgB,MAAM,CAAC,EAAE,cAAc,MAAM;AACpE,gBAAc,oBAAAC,OAAW;AAC3B,CAAC;AAED,IAAO,sBAAQ;","names":["plugin","markdownCSS"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
// src/tailwindcss/index.ts
|
|
1
2
|
import plugin from "tailwindcss/plugin.js";
|
|
2
|
-
import markdownCSS from "../../
|
|
3
|
-
|
|
3
|
+
import markdownCSS from "../../dist/styles/tailwindcss/markdown.css.json";
|
|
4
|
+
var auiPlugin = plugin.withOptions(() => ({ addComponents }) => {
|
|
4
5
|
addComponents(markdownCSS);
|
|
5
6
|
});
|
|
6
7
|
var tailwindcss_default = auiPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/tailwindcss/index.ts"],"sourcesContent":["import plugin from \"tailwindcss/plugin.js\";\nimport markdownCSS from \"../../
|
|
1
|
+
{"version":3,"sources":["../../src/tailwindcss/index.ts"],"sourcesContent":["import plugin from \"tailwindcss/plugin.js\";\nimport markdownCSS from \"../../dist/styles/tailwindcss/markdown.css.json\";\n\nconst auiPlugin = plugin.withOptions<{}>(() => ({ addComponents }) => {\n addComponents(markdownCSS);\n});\n\nexport default auiPlugin;\n"],"mappings":";AAAA,OAAO,YAAY;AACnB,OAAO,iBAAiB;AAExB,IAAM,YAAY,OAAO,YAAgB,MAAM,CAAC,EAAE,cAAc,MAAM;AACpE,gBAAc,WAAW;AAC3B,CAAC;AAED,IAAO,sBAAQ;","names":[]}
|
package/dist/ui/code-header.js
CHANGED
|
@@ -16,22 +16,24 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/ui/code-header.tsx
|
|
19
21
|
var code_header_exports = {};
|
|
20
22
|
__export(code_header_exports, {
|
|
21
23
|
CodeHeader: () => CodeHeader
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(code_header_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
26
|
var import_lucide_react = require("lucide-react");
|
|
26
|
-
var
|
|
27
|
-
var import_useCopyToClipboard = require("./useCopyToClipboard");
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
var import_react = require("@assistant-ui/react");
|
|
28
|
+
var import_useCopyToClipboard = require("./useCopyToClipboard.cjs");
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
var { TooltipIconButton } = import_react.INTERNAL;
|
|
31
|
+
var CodeHeader = ({ language, code }) => {
|
|
30
32
|
const {
|
|
31
33
|
strings: {
|
|
32
34
|
code: { header: { copy: { tooltip = "Copy" } = {} } = {} } = {}
|
|
33
35
|
} = {}
|
|
34
|
-
} = (0,
|
|
36
|
+
} = (0, import_react.useThreadConfig)();
|
|
35
37
|
const { isCopied, copyToClipboard } = (0, import_useCopyToClipboard.useCopyToClipboard)();
|
|
36
38
|
const onCopy = () => {
|
|
37
39
|
if (!code || isCopied) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ui/code-header.tsx"],"sourcesContent":["import { FC } from \"react\";\nimport { CheckIcon, CopyIcon } from \"lucide-react\";\nimport { INTERNAL, useThreadConfig } from \"@assistant-ui/react\";\n\nimport { CodeHeaderProps } from \"../overrides/types\";\nimport { useCopyToClipboard } from \"./useCopyToClipboard\";\n\nconst { TooltipIconButton } = INTERNAL;\n\nexport const CodeHeader: FC<CodeHeaderProps> = ({ language, code }) => {\n const {\n strings: {\n code: { header: { copy: { tooltip = \"Copy\" } = {} } = {} } = {},\n } = {},\n } = useThreadConfig();\n\n const { isCopied, copyToClipboard } = useCopyToClipboard();\n const onCopy = () => {\n if (!code || isCopied) return;\n copyToClipboard(code);\n };\n\n return (\n <div className=\"aui-code-header-root\">\n <span className=\"aui-code-header-language\">{language}</span>\n <TooltipIconButton tooltip={tooltip} onClick={onCopy}>\n {!isCopied && <CopyIcon />}\n {isCopied && <CheckIcon />}\n </TooltipIconButton>\n </div>\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/ui/code-header.tsx"],"sourcesContent":["import { FC } from \"react\";\nimport { CheckIcon, CopyIcon } from \"lucide-react\";\nimport { INTERNAL, useThreadConfig } from \"@assistant-ui/react\";\n\nimport { CodeHeaderProps } from \"../overrides/types\";\nimport { useCopyToClipboard } from \"./useCopyToClipboard\";\n\nconst { TooltipIconButton } = INTERNAL;\n\nexport const CodeHeader: FC<CodeHeaderProps> = ({ language, code }) => {\n const {\n strings: {\n code: { header: { copy: { tooltip = \"Copy\" } = {} } = {} } = {},\n } = {},\n } = useThreadConfig();\n\n const { isCopied, copyToClipboard } = useCopyToClipboard();\n const onCopy = () => {\n if (!code || isCopied) return;\n copyToClipboard(code);\n };\n\n return (\n <div className=\"aui-code-header-root\">\n <span className=\"aui-code-header-language\">{language}</span>\n <TooltipIconButton tooltip={tooltip} onClick={onCopy}>\n {!isCopied && <CopyIcon />}\n {isCopied && <CheckIcon />}\n </TooltipIconButton>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAoC;AACpC,mBAA0C;AAG1C,gCAAmC;AAmB7B;AAjBN,IAAM,EAAE,kBAAkB,IAAI;AAEvB,IAAM,aAAkC,CAAC,EAAE,UAAU,KAAK,MAAM;AACrE,QAAM;AAAA,IACJ,SAAS;AAAA,MACP,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,OAAO,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,IAChE,IAAI,CAAC;AAAA,EACP,QAAI,8BAAgB;AAEpB,QAAM,EAAE,UAAU,gBAAgB,QAAI,8CAAmB;AACzD,QAAM,SAAS,MAAM;AACnB,QAAI,CAAC,QAAQ,SAAU;AACvB,oBAAgB,IAAI;AAAA,EACtB;AAEA,SACE,6CAAC,SAAI,WAAU,wBACb;AAAA,gDAAC,UAAK,WAAU,4BAA4B,oBAAS;AAAA,IACrD,6CAAC,qBAAkB,SAAkB,SAAS,QAC3C;AAAA,OAAC,YAAY,4CAAC,gCAAS;AAAA,MACvB,YAAY,4CAAC,iCAAU;AAAA,OAC1B;AAAA,KACF;AAEJ;","names":[]}
|
package/dist/ui/code-header.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
// src/ui/code-header.tsx
|
|
2
2
|
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
3
3
|
import { INTERNAL, useThreadConfig } from "@assistant-ui/react";
|
|
4
|
-
import { useCopyToClipboard } from "./useCopyToClipboard";
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { useCopyToClipboard } from "./useCopyToClipboard.mjs";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var { TooltipIconButton } = INTERNAL;
|
|
7
|
+
var CodeHeader = ({ language, code }) => {
|
|
7
8
|
const {
|
|
8
9
|
strings: {
|
|
9
10
|
code: { header: { copy: { tooltip = "Copy" } = {} } = {} } = {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ui/code-header.tsx"],"sourcesContent":["import { FC } from \"react\";\nimport { CheckIcon, CopyIcon } from \"lucide-react\";\nimport { INTERNAL, useThreadConfig } from \"@assistant-ui/react\";\n\nimport { CodeHeaderProps } from \"../overrides/types\";\nimport { useCopyToClipboard } from \"./useCopyToClipboard\";\n\nconst { TooltipIconButton } = INTERNAL;\n\nexport const CodeHeader: FC<CodeHeaderProps> = ({ language, code }) => {\n const {\n strings: {\n code: { header: { copy: { tooltip = \"Copy\" } = {} } = {} } = {},\n } = {},\n } = useThreadConfig();\n\n const { isCopied, copyToClipboard } = useCopyToClipboard();\n const onCopy = () => {\n if (!code || isCopied) return;\n copyToClipboard(code);\n };\n\n return (\n <div className=\"aui-code-header-root\">\n <span className=\"aui-code-header-language\">{language}</span>\n <TooltipIconButton tooltip={tooltip} onClick={onCopy}>\n {!isCopied && <CopyIcon />}\n {isCopied && <CheckIcon />}\n </TooltipIconButton>\n </div>\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/ui/code-header.tsx"],"sourcesContent":["import { FC } from \"react\";\nimport { CheckIcon, CopyIcon } from \"lucide-react\";\nimport { INTERNAL, useThreadConfig } from \"@assistant-ui/react\";\n\nimport { CodeHeaderProps } from \"../overrides/types\";\nimport { useCopyToClipboard } from \"./useCopyToClipboard\";\n\nconst { TooltipIconButton } = INTERNAL;\n\nexport const CodeHeader: FC<CodeHeaderProps> = ({ language, code }) => {\n const {\n strings: {\n code: { header: { copy: { tooltip = \"Copy\" } = {} } = {} } = {},\n } = {},\n } = useThreadConfig();\n\n const { isCopied, copyToClipboard } = useCopyToClipboard();\n const onCopy = () => {\n if (!code || isCopied) return;\n copyToClipboard(code);\n };\n\n return (\n <div className=\"aui-code-header-root\">\n <span className=\"aui-code-header-language\">{language}</span>\n <TooltipIconButton tooltip={tooltip} onClick={onCopy}>\n {!isCopied && <CopyIcon />}\n {isCopied && <CheckIcon />}\n </TooltipIconButton>\n </div>\n );\n};\n"],"mappings":";AACA,SAAS,WAAW,gBAAgB;AACpC,SAAS,UAAU,uBAAuB;AAG1C,SAAS,0BAA0B;AAmB7B,cACA,YADA;AAjBN,IAAM,EAAE,kBAAkB,IAAI;AAEvB,IAAM,aAAkC,CAAC,EAAE,UAAU,KAAK,MAAM;AACrE,QAAM;AAAA,IACJ,SAAS;AAAA,MACP,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,OAAO,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,IAChE,IAAI,CAAC;AAAA,EACP,IAAI,gBAAgB;AAEpB,QAAM,EAAE,UAAU,gBAAgB,IAAI,mBAAmB;AACzD,QAAM,SAAS,MAAM;AACnB,QAAI,CAAC,QAAQ,SAAU;AACvB,oBAAgB,IAAI;AAAA,EACtB;AAEA,SACE,qBAAC,SAAI,WAAU,wBACb;AAAA,wBAAC,UAAK,WAAU,4BAA4B,oBAAS;AAAA,IACrD,qBAAC,qBAAkB,SAAkB,SAAS,QAC3C;AAAA,OAAC,YAAY,oBAAC,YAAS;AAAA,MACvB,YAAY,oBAAC,aAAU;AAAA,OAC1B;AAAA,KACF;AAEJ;","names":[]}
|
package/dist/ui/markdown-text.js
CHANGED
|
@@ -26,20 +26,22 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/ui/markdown-text.tsx
|
|
29
31
|
var markdown_text_exports = {};
|
|
30
32
|
__export(markdown_text_exports, {
|
|
31
33
|
makeMarkdownText: () => makeMarkdownText
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(markdown_text_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
36
|
var import_react = require("react");
|
|
36
|
-
var import_code_header = require("./code-header");
|
|
37
|
+
var import_code_header = require("./code-header.cjs");
|
|
37
38
|
var import_classnames = __toESM(require("classnames"));
|
|
38
|
-
var import_MarkdownText = require("../primitives/MarkdownText");
|
|
39
|
+
var import_MarkdownText = require("../primitives/MarkdownText.cjs");
|
|
39
40
|
var import_react2 = require("@assistant-ui/react");
|
|
40
|
-
var import_PreOverride = require("../overrides/PreOverride");
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
var import_PreOverride = require("../overrides/PreOverride.cjs");
|
|
42
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
+
var { withSmoothContextProvider, useSmoothStatus } = import_react2.INTERNAL;
|
|
44
|
+
var defaultComponents = {
|
|
43
45
|
h1: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: (0, import_classnames.default)("aui-md-h1", className), ...props }),
|
|
44
46
|
h2: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: (0, import_classnames.default)("aui-md-h2", className), ...props }),
|
|
45
47
|
h3: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: (0, import_classnames.default)("aui-md-h3", className), ...props }),
|
|
@@ -76,7 +78,7 @@ const defaultComponents = {
|
|
|
76
78
|
},
|
|
77
79
|
CodeHeader: import_code_header.CodeHeader
|
|
78
80
|
};
|
|
79
|
-
|
|
81
|
+
var makeMarkdownText = ({
|
|
80
82
|
className,
|
|
81
83
|
components: userComponents,
|
|
82
84
|
...rest
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ui/markdown-text.tsx"],"sourcesContent":["import { FC, memo } from \"react\";\nimport { CodeHeader } from \"./code-header\";\nimport classNames from \"classnames\";\nimport {\n MarkdownTextPrimitive,\n MarkdownTextPrimitiveProps,\n} from \"../primitives/MarkdownText\";\nimport { INTERNAL } from \"@assistant-ui/react\";\nimport { useIsMarkdownCodeBlock } from \"../overrides/PreOverride\";\n\nconst { withSmoothContextProvider, useSmoothStatus } = INTERNAL;\n\nexport type MakeMarkdownTextProps = MarkdownTextPrimitiveProps;\n\nconst defaultComponents: MakeMarkdownTextProps[\"components\"] = {\n h1: ({ node, className, ...props }) => (\n <h1 className={classNames(\"aui-md-h1\", className)} {...props} />\n ),\n h2: ({ node, className, ...props }) => (\n <h2 className={classNames(\"aui-md-h2\", className)} {...props} />\n ),\n h3: ({ node, className, ...props }) => (\n <h3 className={classNames(\"aui-md-h3\", className)} {...props} />\n ),\n h4: ({ node, className, ...props }) => (\n <h4 className={classNames(\"aui-md-h4\", className)} {...props} />\n ),\n h5: ({ node, className, ...props }) => (\n <h5 className={classNames(\"aui-md-h5\", className)} {...props} />\n ),\n h6: ({ node, className, ...props }) => (\n <h6 className={classNames(\"aui-md-h6\", className)} {...props} />\n ),\n p: ({ node, className, ...props }) => (\n <p className={classNames(\"aui-md-p\", className)} {...props} />\n ),\n a: ({ node, className, ...props }) => (\n <a className={classNames(\"aui-md-a\", className)} {...props} />\n ),\n blockquote: ({ node, className, ...props }) => (\n <blockquote\n className={classNames(\"aui-md-blockquote\", className)}\n {...props}\n />\n ),\n ul: ({ node, className, ...props }) => (\n <ul className={classNames(\"aui-md-ul\", className)} {...props} />\n ),\n ol: ({ node, className, ...props }) => (\n <ol className={classNames(\"aui-md-ol\", className)} {...props} />\n ),\n hr: ({ node, className, ...props }) => (\n <hr className={classNames(\"aui-md-hr\", className)} {...props} />\n ),\n table: ({ node, className, ...props }) => (\n <table className={classNames(\"aui-md-table\", className)} {...props} />\n ),\n th: ({ node, className, ...props }) => (\n <th className={classNames(\"aui-md-th\", className)} {...props} />\n ),\n td: ({ node, className, ...props }) => (\n <td className={classNames(\"aui-md-td\", className)} {...props} />\n ),\n tr: ({ node, className, ...props }) => (\n <tr className={classNames(\"aui-md-tr\", className)} {...props} />\n ),\n sup: ({ node, className, ...props }) => (\n <sup className={classNames(\"aui-md-sup\", className)} {...props} />\n ),\n pre: ({ node, className, ...props }) => (\n <pre className={classNames(\"aui-md-pre\", className)} {...props} />\n ),\n code: ({ node, className, ...props }) => {\n const isCodeBlock = useIsMarkdownCodeBlock();\n return (\n <code\n className={classNames(!isCodeBlock && \"aui-md-inline-code\", className)}\n {...props}\n />\n );\n },\n CodeHeader,\n};\n\nexport const makeMarkdownText = ({\n className,\n components: userComponents,\n ...rest\n}: MakeMarkdownTextProps = {}) => {\n const components = {\n ...defaultComponents,\n ...Object.fromEntries(\n // ignore undefined values, so undefined values do not override default components\n Object.entries(userComponents ?? {}).filter(([_, v]) => v !== undefined),\n ),\n };\n\n const MarkdownTextImpl: FC = () => {\n const status = useSmoothStatus();\n return (\n <MarkdownTextPrimitive\n components={components}\n {...rest}\n className={classNames(\n status.type === \"running\" && \"aui-md-running\",\n className,\n )}\n />\n );\n };\n MarkdownTextImpl.displayName = \"MarkdownText\";\n\n return memo(withSmoothContextProvider(MarkdownTextImpl), () => true);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/ui/markdown-text.tsx"],"sourcesContent":["import { FC, memo } from \"react\";\nimport { CodeHeader } from \"./code-header\";\nimport classNames from \"classnames\";\nimport {\n MarkdownTextPrimitive,\n MarkdownTextPrimitiveProps,\n} from \"../primitives/MarkdownText\";\nimport { INTERNAL } from \"@assistant-ui/react\";\nimport { useIsMarkdownCodeBlock } from \"../overrides/PreOverride\";\n\nconst { withSmoothContextProvider, useSmoothStatus } = INTERNAL;\n\nexport type MakeMarkdownTextProps = MarkdownTextPrimitiveProps;\n\nconst defaultComponents: MakeMarkdownTextProps[\"components\"] = {\n h1: ({ node, className, ...props }) => (\n <h1 className={classNames(\"aui-md-h1\", className)} {...props} />\n ),\n h2: ({ node, className, ...props }) => (\n <h2 className={classNames(\"aui-md-h2\", className)} {...props} />\n ),\n h3: ({ node, className, ...props }) => (\n <h3 className={classNames(\"aui-md-h3\", className)} {...props} />\n ),\n h4: ({ node, className, ...props }) => (\n <h4 className={classNames(\"aui-md-h4\", className)} {...props} />\n ),\n h5: ({ node, className, ...props }) => (\n <h5 className={classNames(\"aui-md-h5\", className)} {...props} />\n ),\n h6: ({ node, className, ...props }) => (\n <h6 className={classNames(\"aui-md-h6\", className)} {...props} />\n ),\n p: ({ node, className, ...props }) => (\n <p className={classNames(\"aui-md-p\", className)} {...props} />\n ),\n a: ({ node, className, ...props }) => (\n <a className={classNames(\"aui-md-a\", className)} {...props} />\n ),\n blockquote: ({ node, className, ...props }) => (\n <blockquote\n className={classNames(\"aui-md-blockquote\", className)}\n {...props}\n />\n ),\n ul: ({ node, className, ...props }) => (\n <ul className={classNames(\"aui-md-ul\", className)} {...props} />\n ),\n ol: ({ node, className, ...props }) => (\n <ol className={classNames(\"aui-md-ol\", className)} {...props} />\n ),\n hr: ({ node, className, ...props }) => (\n <hr className={classNames(\"aui-md-hr\", className)} {...props} />\n ),\n table: ({ node, className, ...props }) => (\n <table className={classNames(\"aui-md-table\", className)} {...props} />\n ),\n th: ({ node, className, ...props }) => (\n <th className={classNames(\"aui-md-th\", className)} {...props} />\n ),\n td: ({ node, className, ...props }) => (\n <td className={classNames(\"aui-md-td\", className)} {...props} />\n ),\n tr: ({ node, className, ...props }) => (\n <tr className={classNames(\"aui-md-tr\", className)} {...props} />\n ),\n sup: ({ node, className, ...props }) => (\n <sup className={classNames(\"aui-md-sup\", className)} {...props} />\n ),\n pre: ({ node, className, ...props }) => (\n <pre className={classNames(\"aui-md-pre\", className)} {...props} />\n ),\n code: ({ node, className, ...props }) => {\n const isCodeBlock = useIsMarkdownCodeBlock();\n return (\n <code\n className={classNames(!isCodeBlock && \"aui-md-inline-code\", className)}\n {...props}\n />\n );\n },\n CodeHeader,\n};\n\nexport const makeMarkdownText = ({\n className,\n components: userComponents,\n ...rest\n}: MakeMarkdownTextProps = {}) => {\n const components = {\n ...defaultComponents,\n ...Object.fromEntries(\n // ignore undefined values, so undefined values do not override default components\n Object.entries(userComponents ?? {}).filter(([_, v]) => v !== undefined),\n ),\n };\n\n const MarkdownTextImpl: FC = () => {\n const status = useSmoothStatus();\n return (\n <MarkdownTextPrimitive\n components={components}\n {...rest}\n className={classNames(\n status.type === \"running\" && \"aui-md-running\",\n className,\n )}\n />\n );\n };\n MarkdownTextImpl.displayName = \"MarkdownText\";\n\n return memo(withSmoothContextProvider(MarkdownTextImpl), () => true);\n};\n"],"mappings":"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","names":["import_react","classNames"]}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
// src/ui/markdown-text.tsx
|
|
2
2
|
import { memo } from "react";
|
|
3
|
-
import { CodeHeader } from "./code-header";
|
|
3
|
+
import { CodeHeader } from "./code-header.mjs";
|
|
4
4
|
import classNames from "classnames";
|
|
5
5
|
import {
|
|
6
6
|
MarkdownTextPrimitive
|
|
7
|
-
} from "../primitives/MarkdownText";
|
|
7
|
+
} from "../primitives/MarkdownText.mjs";
|
|
8
8
|
import { INTERNAL } from "@assistant-ui/react";
|
|
9
|
-
import { useIsMarkdownCodeBlock } from "../overrides/PreOverride";
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
import { useIsMarkdownCodeBlock } from "../overrides/PreOverride.mjs";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
var { withSmoothContextProvider, useSmoothStatus } = INTERNAL;
|
|
12
|
+
var defaultComponents = {
|
|
12
13
|
h1: ({ node, className, ...props }) => /* @__PURE__ */ jsx("h1", { className: classNames("aui-md-h1", className), ...props }),
|
|
13
14
|
h2: ({ node, className, ...props }) => /* @__PURE__ */ jsx("h2", { className: classNames("aui-md-h2", className), ...props }),
|
|
14
15
|
h3: ({ node, className, ...props }) => /* @__PURE__ */ jsx("h3", { className: classNames("aui-md-h3", className), ...props }),
|
|
@@ -45,7 +46,7 @@ const defaultComponents = {
|
|
|
45
46
|
},
|
|
46
47
|
CodeHeader
|
|
47
48
|
};
|
|
48
|
-
|
|
49
|
+
var makeMarkdownText = ({
|
|
49
50
|
className,
|
|
50
51
|
components: userComponents,
|
|
51
52
|
...rest
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ui/markdown-text.tsx"],"sourcesContent":["import { FC, memo } from \"react\";\nimport { CodeHeader } from \"./code-header\";\nimport classNames from \"classnames\";\nimport {\n MarkdownTextPrimitive,\n MarkdownTextPrimitiveProps,\n} from \"../primitives/MarkdownText\";\nimport { INTERNAL } from \"@assistant-ui/react\";\nimport { useIsMarkdownCodeBlock } from \"../overrides/PreOverride\";\n\nconst { withSmoothContextProvider, useSmoothStatus } = INTERNAL;\n\nexport type MakeMarkdownTextProps = MarkdownTextPrimitiveProps;\n\nconst defaultComponents: MakeMarkdownTextProps[\"components\"] = {\n h1: ({ node, className, ...props }) => (\n <h1 className={classNames(\"aui-md-h1\", className)} {...props} />\n ),\n h2: ({ node, className, ...props }) => (\n <h2 className={classNames(\"aui-md-h2\", className)} {...props} />\n ),\n h3: ({ node, className, ...props }) => (\n <h3 className={classNames(\"aui-md-h3\", className)} {...props} />\n ),\n h4: ({ node, className, ...props }) => (\n <h4 className={classNames(\"aui-md-h4\", className)} {...props} />\n ),\n h5: ({ node, className, ...props }) => (\n <h5 className={classNames(\"aui-md-h5\", className)} {...props} />\n ),\n h6: ({ node, className, ...props }) => (\n <h6 className={classNames(\"aui-md-h6\", className)} {...props} />\n ),\n p: ({ node, className, ...props }) => (\n <p className={classNames(\"aui-md-p\", className)} {...props} />\n ),\n a: ({ node, className, ...props }) => (\n <a className={classNames(\"aui-md-a\", className)} {...props} />\n ),\n blockquote: ({ node, className, ...props }) => (\n <blockquote\n className={classNames(\"aui-md-blockquote\", className)}\n {...props}\n />\n ),\n ul: ({ node, className, ...props }) => (\n <ul className={classNames(\"aui-md-ul\", className)} {...props} />\n ),\n ol: ({ node, className, ...props }) => (\n <ol className={classNames(\"aui-md-ol\", className)} {...props} />\n ),\n hr: ({ node, className, ...props }) => (\n <hr className={classNames(\"aui-md-hr\", className)} {...props} />\n ),\n table: ({ node, className, ...props }) => (\n <table className={classNames(\"aui-md-table\", className)} {...props} />\n ),\n th: ({ node, className, ...props }) => (\n <th className={classNames(\"aui-md-th\", className)} {...props} />\n ),\n td: ({ node, className, ...props }) => (\n <td className={classNames(\"aui-md-td\", className)} {...props} />\n ),\n tr: ({ node, className, ...props }) => (\n <tr className={classNames(\"aui-md-tr\", className)} {...props} />\n ),\n sup: ({ node, className, ...props }) => (\n <sup className={classNames(\"aui-md-sup\", className)} {...props} />\n ),\n pre: ({ node, className, ...props }) => (\n <pre className={classNames(\"aui-md-pre\", className)} {...props} />\n ),\n code: ({ node, className, ...props }) => {\n const isCodeBlock = useIsMarkdownCodeBlock();\n return (\n <code\n className={classNames(!isCodeBlock && \"aui-md-inline-code\", className)}\n {...props}\n />\n );\n },\n CodeHeader,\n};\n\nexport const makeMarkdownText = ({\n className,\n components: userComponents,\n ...rest\n}: MakeMarkdownTextProps = {}) => {\n const components = {\n ...defaultComponents,\n ...Object.fromEntries(\n // ignore undefined values, so undefined values do not override default components\n Object.entries(userComponents ?? {}).filter(([_, v]) => v !== undefined),\n ),\n };\n\n const MarkdownTextImpl: FC = () => {\n const status = useSmoothStatus();\n return (\n <MarkdownTextPrimitive\n components={components}\n {...rest}\n className={classNames(\n status.type === \"running\" && \"aui-md-running\",\n className,\n )}\n />\n );\n };\n MarkdownTextImpl.displayName = \"MarkdownText\";\n\n return memo(withSmoothContextProvider(MarkdownTextImpl), () => true);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/ui/markdown-text.tsx"],"sourcesContent":["import { FC, memo } from \"react\";\nimport { CodeHeader } from \"./code-header\";\nimport classNames from \"classnames\";\nimport {\n MarkdownTextPrimitive,\n MarkdownTextPrimitiveProps,\n} from \"../primitives/MarkdownText\";\nimport { INTERNAL } from \"@assistant-ui/react\";\nimport { useIsMarkdownCodeBlock } from \"../overrides/PreOverride\";\n\nconst { withSmoothContextProvider, useSmoothStatus } = INTERNAL;\n\nexport type MakeMarkdownTextProps = MarkdownTextPrimitiveProps;\n\nconst defaultComponents: MakeMarkdownTextProps[\"components\"] = {\n h1: ({ node, className, ...props }) => (\n <h1 className={classNames(\"aui-md-h1\", className)} {...props} />\n ),\n h2: ({ node, className, ...props }) => (\n <h2 className={classNames(\"aui-md-h2\", className)} {...props} />\n ),\n h3: ({ node, className, ...props }) => (\n <h3 className={classNames(\"aui-md-h3\", className)} {...props} />\n ),\n h4: ({ node, className, ...props }) => (\n <h4 className={classNames(\"aui-md-h4\", className)} {...props} />\n ),\n h5: ({ node, className, ...props }) => (\n <h5 className={classNames(\"aui-md-h5\", className)} {...props} />\n ),\n h6: ({ node, className, ...props }) => (\n <h6 className={classNames(\"aui-md-h6\", className)} {...props} />\n ),\n p: ({ node, className, ...props }) => (\n <p className={classNames(\"aui-md-p\", className)} {...props} />\n ),\n a: ({ node, className, ...props }) => (\n <a className={classNames(\"aui-md-a\", className)} {...props} />\n ),\n blockquote: ({ node, className, ...props }) => (\n <blockquote\n className={classNames(\"aui-md-blockquote\", className)}\n {...props}\n />\n ),\n ul: ({ node, className, ...props }) => (\n <ul className={classNames(\"aui-md-ul\", className)} {...props} />\n ),\n ol: ({ node, className, ...props }) => (\n <ol className={classNames(\"aui-md-ol\", className)} {...props} />\n ),\n hr: ({ node, className, ...props }) => (\n <hr className={classNames(\"aui-md-hr\", className)} {...props} />\n ),\n table: ({ node, className, ...props }) => (\n <table className={classNames(\"aui-md-table\", className)} {...props} />\n ),\n th: ({ node, className, ...props }) => (\n <th className={classNames(\"aui-md-th\", className)} {...props} />\n ),\n td: ({ node, className, ...props }) => (\n <td className={classNames(\"aui-md-td\", className)} {...props} />\n ),\n tr: ({ node, className, ...props }) => (\n <tr className={classNames(\"aui-md-tr\", className)} {...props} />\n ),\n sup: ({ node, className, ...props }) => (\n <sup className={classNames(\"aui-md-sup\", className)} {...props} />\n ),\n pre: ({ node, className, ...props }) => (\n <pre className={classNames(\"aui-md-pre\", className)} {...props} />\n ),\n code: ({ node, className, ...props }) => {\n const isCodeBlock = useIsMarkdownCodeBlock();\n return (\n <code\n className={classNames(!isCodeBlock && \"aui-md-inline-code\", className)}\n {...props}\n />\n );\n },\n CodeHeader,\n};\n\nexport const makeMarkdownText = ({\n className,\n components: userComponents,\n ...rest\n}: MakeMarkdownTextProps = {}) => {\n const components = {\n ...defaultComponents,\n ...Object.fromEntries(\n // ignore undefined values, so undefined values do not override default components\n Object.entries(userComponents ?? {}).filter(([_, v]) => v !== undefined),\n ),\n };\n\n const MarkdownTextImpl: FC = () => {\n const status = useSmoothStatus();\n return (\n <MarkdownTextPrimitive\n components={components}\n {...rest}\n className={classNames(\n status.type === \"running\" && \"aui-md-running\",\n className,\n )}\n />\n );\n };\n MarkdownTextImpl.displayName = \"MarkdownText\";\n\n return memo(withSmoothContextProvider(MarkdownTextImpl), () => true);\n};\n"],"mappings":"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","names":[]}
|
|
@@ -16,13 +16,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/ui/useCopyToClipboard.tsx
|
|
19
21
|
var useCopyToClipboard_exports = {};
|
|
20
22
|
__export(useCopyToClipboard_exports, {
|
|
21
23
|
useCopyToClipboard: () => useCopyToClipboard
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(useCopyToClipboard_exports);
|
|
24
26
|
var import_react = require("react");
|
|
25
|
-
|
|
27
|
+
var useCopyToClipboard = ({
|
|
26
28
|
copiedDuration = 3e3
|
|
27
29
|
} = {}) => {
|
|
28
30
|
const [isCopied, setIsCopied] = (0, import_react.useState)(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ui/useCopyToClipboard.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { UseActionBarCopyProps } from \"@assistant-ui/react\";\n\nexport type useCopyToClipboardProps = UseActionBarCopyProps;\n\nexport const useCopyToClipboard = ({\n copiedDuration = 3000,\n}: useCopyToClipboardProps = {}) => {\n const [isCopied, setIsCopied] = useState<boolean>(false);\n\n const copyToClipboard = (value: string) => {\n if (!value) return;\n\n navigator.clipboard.writeText(value).then(() => {\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), copiedDuration);\n });\n };\n\n return { isCopied, copyToClipboard };\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/ui/useCopyToClipboard.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { UseActionBarCopyProps } from \"@assistant-ui/react\";\n\nexport type useCopyToClipboardProps = UseActionBarCopyProps;\n\nexport const useCopyToClipboard = ({\n copiedDuration = 3000,\n}: useCopyToClipboardProps = {}) => {\n const [isCopied, setIsCopied] = useState<boolean>(false);\n\n const copyToClipboard = (value: string) => {\n if (!value) return;\n\n navigator.clipboard.writeText(value).then(() => {\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), copiedDuration);\n });\n };\n\n return { isCopied, copyToClipboard };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAyB;AAKlB,IAAM,qBAAqB,CAAC;AAAA,EACjC,iBAAiB;AACnB,IAA6B,CAAC,MAAM;AAClC,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAkB,KAAK;AAEvD,QAAM,kBAAkB,CAAC,UAAkB;AACzC,QAAI,CAAC,MAAO;AAEZ,cAAU,UAAU,UAAU,KAAK,EAAE,KAAK,MAAM;AAC9C,kBAAY,IAAI;AAChB,iBAAW,MAAM,YAAY,KAAK,GAAG,cAAc;AAAA,IACrD,CAAC;AAAA,EACH;AAEA,SAAO,EAAE,UAAU,gBAAgB;AACrC;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ui/useCopyToClipboard.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { UseActionBarCopyProps } from \"@assistant-ui/react\";\n\nexport type useCopyToClipboardProps = UseActionBarCopyProps;\n\nexport const useCopyToClipboard = ({\n copiedDuration = 3000,\n}: useCopyToClipboardProps = {}) => {\n const [isCopied, setIsCopied] = useState<boolean>(false);\n\n const copyToClipboard = (value: string) => {\n if (!value) return;\n\n navigator.clipboard.writeText(value).then(() => {\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), copiedDuration);\n });\n };\n\n return { isCopied, copyToClipboard };\n};\n"],"mappings":"AAAA,SAAS,gBAAgB;AAKlB,
|
|
1
|
+
{"version":3,"sources":["../../src/ui/useCopyToClipboard.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { UseActionBarCopyProps } from \"@assistant-ui/react\";\n\nexport type useCopyToClipboardProps = UseActionBarCopyProps;\n\nexport const useCopyToClipboard = ({\n copiedDuration = 3000,\n}: useCopyToClipboardProps = {}) => {\n const [isCopied, setIsCopied] = useState<boolean>(false);\n\n const copyToClipboard = (value: string) => {\n if (!value) return;\n\n navigator.clipboard.writeText(value).then(() => {\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), copiedDuration);\n });\n };\n\n return { isCopied, copyToClipboard };\n};\n"],"mappings":";AAAA,SAAS,gBAAgB;AAKlB,IAAM,qBAAqB,CAAC;AAAA,EACjC,iBAAiB;AACnB,IAA6B,CAAC,MAAM;AAClC,QAAM,CAAC,UAAU,WAAW,IAAI,SAAkB,KAAK;AAEvD,QAAM,kBAAkB,CAAC,UAAkB;AACzC,QAAI,CAAC,MAAO;AAEZ,cAAU,UAAU,UAAU,KAAK,EAAE,KAAK,MAAM;AAC9C,kBAAY,IAAI;AAChB,iBAAW,MAAM,YAAY,KAAK,GAAG,cAAc;AAAA,IACrD,CAAC;AAAA,EACH;AAEA,SAAO,EAAE,UAAU,gBAAgB;AACrC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assistant-ui/react-markdown",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.26",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"types": "./dist/index.d.ts",
|
|
24
24
|
"files": [
|
|
25
25
|
"dist",
|
|
26
|
+
"generated",
|
|
26
27
|
"tailwindcss",
|
|
27
28
|
"src",
|
|
28
29
|
"README.md"
|
|
@@ -36,7 +37,7 @@
|
|
|
36
37
|
"react-markdown": "^9.0.1"
|
|
37
38
|
},
|
|
38
39
|
"peerDependencies": {
|
|
39
|
-
"@assistant-ui/react": "^0.5.
|
|
40
|
+
"@assistant-ui/react": "^0.5.98",
|
|
40
41
|
"@types/react": "*",
|
|
41
42
|
"react": "^18 || ^19",
|
|
42
43
|
"tailwindcss": "^3.4.4"
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
}
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
|
-
"@types/node": "^22.
|
|
54
|
+
"@types/node": "^22.8.1",
|
|
54
55
|
"autoprefixer": "^10.4.20",
|
|
55
56
|
"eslint": "^9",
|
|
56
57
|
"eslint-config-next": "15.0.1",
|
|
@@ -60,11 +61,12 @@
|
|
|
60
61
|
"react-dom": "19.0.0-rc-69d4b800-20241021",
|
|
61
62
|
"tailwindcss": "^3.4.14",
|
|
62
63
|
"tailwindcss-animate": "^1.0.7",
|
|
63
|
-
"tsup": "8.3.
|
|
64
|
+
"tsup": "8.3.5",
|
|
64
65
|
"tsx": "^4.19.1",
|
|
65
|
-
"@assistant-ui/react": "0.5.
|
|
66
|
-
"@assistant-ui/
|
|
67
|
-
"@assistant-ui/
|
|
66
|
+
"@assistant-ui/react": "0.5.98",
|
|
67
|
+
"@assistant-ui/tailwindcss-transformer": "0.1.0",
|
|
68
|
+
"@assistant-ui/tsbuildutils": "^0.0.0",
|
|
69
|
+
"@assistant-ui/tsconfig": "0.0.0"
|
|
68
70
|
},
|
|
69
71
|
"publishConfig": {
|
|
70
72
|
"access": "public",
|
|
@@ -79,7 +81,6 @@
|
|
|
79
81
|
"url": "https://github.com/Yonom/assistant-ui/issues"
|
|
80
82
|
},
|
|
81
83
|
"scripts": {
|
|
82
|
-
"build": "tsx scripts/build.mts
|
|
83
|
-
"build:declarations": "tsc -p tsconfig.declarations.json"
|
|
84
|
+
"build": "tsx scripts/build.mts"
|
|
84
85
|
}
|
|
85
86
|
}
|
package/src/tailwindcss/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import plugin from "tailwindcss/plugin.js";
|
|
2
|
-
import markdownCSS from "../../
|
|
2
|
+
import markdownCSS from "../../dist/styles/tailwindcss/markdown.css.json";
|
|
3
3
|
|
|
4
4
|
const auiPlugin = plugin.withOptions<{}>(() => ({ addComponents }) => {
|
|
5
5
|
addComponents(markdownCSS);
|