@assistant-ui/react-markdown 0.2.21 → 0.2.22
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 +42 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -3
- package/dist/index.mjs.map +1 -1
- package/dist/styles/markdown.css +44 -45
- package/dist/styles/tailwindcss/markdown.css +20 -21
- package/dist/tailwindcss/index.js +20 -20
- package/dist/tailwindcss/index.js.map +1 -1
- package/dist/tailwindcss/index.mjs +20 -20
- package/dist/tailwindcss/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -261,14 +261,54 @@ var import_classnames3 = __toESM(require("classnames"));
|
|
|
261
261
|
var import_react9 = require("@assistant-ui/react");
|
|
262
262
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
263
263
|
var { withSmoothContextProvider, useSmoothStatus } = import_react9.INTERNAL;
|
|
264
|
+
var defaultComponents = {
|
|
265
|
+
h1: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h1", { className: (0, import_classnames3.default)("aui-md-h1", className), ...props }),
|
|
266
|
+
h2: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { className: (0, import_classnames3.default)("aui-md-h2", className), ...props }),
|
|
267
|
+
h3: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { className: (0, import_classnames3.default)("aui-md-h3", className), ...props }),
|
|
268
|
+
h4: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h4", { className: (0, import_classnames3.default)("aui-md-h4", className), ...props }),
|
|
269
|
+
h5: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h5", { className: (0, import_classnames3.default)("aui-md-h5", className), ...props }),
|
|
270
|
+
h6: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h6", { className: (0, import_classnames3.default)("aui-md-h6", className), ...props }),
|
|
271
|
+
p: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: (0, import_classnames3.default)("aui-md-p", className), ...props }),
|
|
272
|
+
a: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("a", { className: (0, import_classnames3.default)("aui-md-a", className), ...props }),
|
|
273
|
+
blockquote: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
274
|
+
"blockquote",
|
|
275
|
+
{
|
|
276
|
+
className: (0, import_classnames3.default)("aui-md-blockquote", className),
|
|
277
|
+
...props
|
|
278
|
+
}
|
|
279
|
+
),
|
|
280
|
+
ul: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: (0, import_classnames3.default)("aui-md-ul", className), ...props }),
|
|
281
|
+
ol: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ol", { className: (0, import_classnames3.default)("aui-md-ol", className), ...props }),
|
|
282
|
+
hr: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("hr", { className: (0, import_classnames3.default)("aui-md-hr", className), ...props }),
|
|
283
|
+
table: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("table", { className: (0, import_classnames3.default)("aui-md-table", className), ...props }),
|
|
284
|
+
th: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("th", { className: (0, import_classnames3.default)("aui-md-th", className), ...props }),
|
|
285
|
+
td: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("td", { className: (0, import_classnames3.default)("aui-md-td", className), ...props }),
|
|
286
|
+
tr: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("tr", { className: (0, import_classnames3.default)("aui-md-tr", className), ...props }),
|
|
287
|
+
sup: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("sup", { className: (0, import_classnames3.default)("aui-md-sup", className), ...props }),
|
|
288
|
+
pre: ({ node, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("pre", { className: (0, import_classnames3.default)("aui-md-pre", className), ...props }),
|
|
289
|
+
code: ({ node, className, ...props }) => {
|
|
290
|
+
const isCodeBlock = useIsMarkdownCodeBlock();
|
|
291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
292
|
+
"code",
|
|
293
|
+
{
|
|
294
|
+
className: (0, import_classnames3.default)(!isCodeBlock && "aui-md-inline-code", className),
|
|
295
|
+
...props
|
|
296
|
+
}
|
|
297
|
+
);
|
|
298
|
+
},
|
|
299
|
+
CodeHeader
|
|
300
|
+
};
|
|
264
301
|
var makeMarkdownText = ({
|
|
265
302
|
className,
|
|
266
303
|
components: userComponents,
|
|
267
304
|
...rest
|
|
268
305
|
} = {}) => {
|
|
269
306
|
const components = {
|
|
270
|
-
...
|
|
271
|
-
|
|
307
|
+
...defaultComponents,
|
|
308
|
+
...Object.fromEntries(
|
|
309
|
+
// ignore undefined values, so undefined values do not override default components
|
|
310
|
+
Object.entries(userComponents ?? {}).filter(([_, v]) => v !== void 0)
|
|
311
|
+
)
|
|
272
312
|
};
|
|
273
313
|
const MarkdownTextImpl = () => {
|
|
274
314
|
const status = useSmoothStatus();
|
|
@@ -278,7 +318,6 @@ var makeMarkdownText = ({
|
|
|
278
318
|
components,
|
|
279
319
|
...rest,
|
|
280
320
|
className: (0, import_classnames3.default)(
|
|
281
|
-
"aui-md-root",
|
|
282
321
|
status.type === "running" && "aui-md-running",
|
|
283
322
|
className
|
|
284
323
|
)
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/primitives/MarkdownText.tsx","../src/overrides/PreOverride.tsx","../src/overrides/defaultComponents.tsx","../src/overrides/CodeOverride.tsx","../src/overrides/CodeBlock.tsx","../src/overrides/withDefaults.tsx","../src/ui/markdown-text.tsx","../src/ui/code-header.tsx","../src/ui/useCopyToClipboard.tsx"],"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","\"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","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","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","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","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","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","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\";\n\nconst { withSmoothContextProvider, useSmoothStatus } = INTERNAL;\n\nexport type MakeMarkdownTextProps = MarkdownTextPrimitiveProps;\n\nexport const makeMarkdownText = ({\n className,\n components: userComponents,\n ...rest\n}: MakeMarkdownTextProps = {}) => {\n const components = {\n ...userComponents,\n CodeHeader: userComponents?.CodeHeader ?? CodeHeader,\n };\n\n const MarkdownTextImpl: FC = () => {\n const status = useSmoothStatus();\n return (\n <MarkdownTextPrimitive\n components={components}\n {...rest}\n className={classNames(\n \"aui-md-root\",\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","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","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;AAAA;AAAA;;;ACEA,IAAAA,gBAA6C;AAC7C,IAAAA,gBAQO;AACP,4BAA4C;;;ACZ5C,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;;;ACVE,IAAAC,sBAAA;AADK,IAAM,aAA2B,CAAC,EAAE,MAAM,GAAG,KAAK,MACvD,6CAAC,SAAK,GAAG,MAAM;AAGV,IAAM,cAA6B,CAAC,EAAE,MAAM,GAAG,KAAK,MACzD,6CAAC,UAAM,GAAG,MAAM;AAGX,IAAM,0BAGR,CAAC,EAAE,YAAY,EAAE,KAAK,KAAK,GAAG,KAAK,MACtC,6CAAC,OACC,uDAAC,QAAM,gBAAK,GACd;AAGK,IAAM,oBAAoD,MAAM;;;AFCvE,IAAAC,iCAA+B;;;AGrB/B,IAAAC,gBAAwE;;;ACAxE,IAAAC,gBAA2C;AA+BvC,IAAAC,sBAAA;AAVG,IAAM,mBAAuC,CAAC;AAAA,EACnD,YAAY,EAAE,KAAK,MAAM,mBAAmB,YAAAC,YAAW;AAAA,EACvD;AAAA,EACA;AACF,MAAM;AACJ,QAAM,iBAAa,uBAAQ,OAAO,EAA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,gCAAS;AAAA,MACvB,YAAY,6CAAC,iCAAU;AAAA,OAC1B;AAAA,KACF;AAEJ;;;AD7BA,IAAAC,qBAAuB;AAKvB,IAAAC,gBAAyB;AAmBnB,IAAAC,sBAAA;AAjBN,IAAM,EAAE,2BAA2B,gBAAgB,IAAI;AAIhD,IAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA,YAAY;AAAA,EACZ,GAAG;AACL,IAA2B,CAAC,MAAM;AAChC,QAAM,aAAa;AAAA,IACjB,GAAG;AAAA,IACH,YAAY,gBAAgB,cAAc;AAAA,EAC5C;AAEA,QAAM,mBAAuB,MAAM;AACjC,UAAM,SAAS,gBAAgB;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACC,GAAG;AAAA,QACJ,eAAW,mBAAAC;AAAA,UACT;AAAA,UACA,OAAO,SAAS,aAAa;AAAA,UAC7B;AAAA,QACF;AAAA;AAAA,IACF;AAAA,EAEJ;AACA,mBAAiB,cAAc;AAE/B,aAAO,oBAAK,0BAA0B,gBAAgB,GAAG,MAAM,IAAI;AACrE;","names":["import_react","import_jsx_runtime","import_react_use_callback_ref","import_react","import_react","import_jsx_runtime","CodeHeader","classNames","import_jsx_runtime","CodeHeader","import_classnames","import_jsx_runtime","CodeHeader","classNames","ReactMarkdown","import_react","import_react","import_react","import_jsx_runtime","import_classnames","import_react","import_jsx_runtime","classNames"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/primitives/MarkdownText.tsx","../src/overrides/PreOverride.tsx","../src/overrides/defaultComponents.tsx","../src/overrides/CodeOverride.tsx","../src/overrides/CodeBlock.tsx","../src/overrides/withDefaults.tsx","../src/ui/markdown-text.tsx","../src/ui/code-header.tsx","../src/ui/useCopyToClipboard.tsx"],"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","\"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","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","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","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","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","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","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","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","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;AAAA;AAAA;;;ACEA,IAAAA,gBAA6C;AAC7C,IAAAA,gBAQO;AACP,4BAA4C;;;ACZ5C,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;;;ACVE,IAAAC,sBAAA;AADK,IAAM,aAA2B,CAAC,EAAE,MAAM,GAAG,KAAK,MACvD,6CAAC,SAAK,GAAG,MAAM;AAGV,IAAM,cAA6B,CAAC,EAAE,MAAM,GAAG,KAAK,MACzD,6CAAC,UAAM,GAAG,MAAM;AAGX,IAAM,0BAGR,CAAC,EAAE,YAAY,EAAE,KAAK,KAAK,GAAG,KAAK,MACtC,6CAAC,OACC,uDAAC,QAAM,gBAAK,GACd;AAGK,IAAM,oBAAoD,MAAM;;;AFCvE,IAAAC,iCAA+B;;;AGrB/B,IAAAC,gBAAwE;;;ACAxE,IAAAC,gBAA2C;AA+BvC,IAAAC,sBAAA;AAVG,IAAM,mBAAuC,CAAC;AAAA,EACnD,YAAY,EAAE,KAAK,MAAM,mBAAmB,YAAAC,YAAW;AAAA,EACvD;AAAA,EACA;AACF,MAAM;AACJ,QAAM,iBAAa,uBAAQ,OAAO,EAAE,KAAK,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC;AAE7D,QAA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MAAM,CAAC,EAAE,MAAM,WAAW,GAAG,MAAM,MAAM;AACvC,UAAM,cAAc,uBAAuB;AAC3C,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW,mBAAAA,SAAW,CAAC,eAAe,sBAAsB,SAAS;AAAA,QACpE,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AAAA,EACA;AACF;AAEO,IAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA,YAAY;AAAA,EACZ,GAAG;AACL,IAA2B,CAAC,MAAM;AAChC,QAAM,aAAa;AAAA,IACjB,GAAG;AAAA,IACH,GAAG,OAAO;AAAA;AAAA,MAER,OAAO,QAAQ,kBAAkB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,MAAM,MAAM,MAAS;AAAA,IACzE;AAAA,EACF;AAEA,QAAM,mBAAuB,MAAM;AACjC,UAAM,SAAS,gBAAgB;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACC,GAAG;AAAA,QACJ,eAAW,mBAAAA;AAAA,UACT,OAAO,SAAS,aAAa;AAAA,UAC7B;AAAA,QACF;AAAA;AAAA,IACF;AAAA,EAEJ;AACA,mBAAiB,cAAc;AAE/B,aAAO,oBAAK,0BAA0B,gBAAgB,GAAG,MAAM,IAAI;AACrE;","names":["import_react","import_jsx_runtime","import_react_use_callback_ref","import_react","import_react","import_jsx_runtime","CodeHeader","classNames","import_jsx_runtime","CodeHeader","import_classnames","import_jsx_runtime","CodeHeader","classNames","ReactMarkdown","import_react","import_react","import_react","import_jsx_runtime","import_classnames","import_react","import_jsx_runtime","classNames"]}
|
package/dist/index.mjs
CHANGED
|
@@ -226,14 +226,54 @@ import classNames3 from "classnames";
|
|
|
226
226
|
import { INTERNAL as INTERNAL3 } from "@assistant-ui/react";
|
|
227
227
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
228
228
|
var { withSmoothContextProvider, useSmoothStatus } = INTERNAL3;
|
|
229
|
+
var defaultComponents = {
|
|
230
|
+
h1: ({ node, className, ...props }) => /* @__PURE__ */ jsx7("h1", { className: classNames3("aui-md-h1", className), ...props }),
|
|
231
|
+
h2: ({ node, className, ...props }) => /* @__PURE__ */ jsx7("h2", { className: classNames3("aui-md-h2", className), ...props }),
|
|
232
|
+
h3: ({ node, className, ...props }) => /* @__PURE__ */ jsx7("h3", { className: classNames3("aui-md-h3", className), ...props }),
|
|
233
|
+
h4: ({ node, className, ...props }) => /* @__PURE__ */ jsx7("h4", { className: classNames3("aui-md-h4", className), ...props }),
|
|
234
|
+
h5: ({ node, className, ...props }) => /* @__PURE__ */ jsx7("h5", { className: classNames3("aui-md-h5", className), ...props }),
|
|
235
|
+
h6: ({ node, className, ...props }) => /* @__PURE__ */ jsx7("h6", { className: classNames3("aui-md-h6", className), ...props }),
|
|
236
|
+
p: ({ node, className, ...props }) => /* @__PURE__ */ jsx7("p", { className: classNames3("aui-md-p", className), ...props }),
|
|
237
|
+
a: ({ node, className, ...props }) => /* @__PURE__ */ jsx7("a", { className: classNames3("aui-md-a", className), ...props }),
|
|
238
|
+
blockquote: ({ node, className, ...props }) => /* @__PURE__ */ jsx7(
|
|
239
|
+
"blockquote",
|
|
240
|
+
{
|
|
241
|
+
className: classNames3("aui-md-blockquote", className),
|
|
242
|
+
...props
|
|
243
|
+
}
|
|
244
|
+
),
|
|
245
|
+
ul: ({ node, className, ...props }) => /* @__PURE__ */ jsx7("ul", { className: classNames3("aui-md-ul", className), ...props }),
|
|
246
|
+
ol: ({ node, className, ...props }) => /* @__PURE__ */ jsx7("ol", { className: classNames3("aui-md-ol", className), ...props }),
|
|
247
|
+
hr: ({ node, className, ...props }) => /* @__PURE__ */ jsx7("hr", { className: classNames3("aui-md-hr", className), ...props }),
|
|
248
|
+
table: ({ node, className, ...props }) => /* @__PURE__ */ jsx7("table", { className: classNames3("aui-md-table", className), ...props }),
|
|
249
|
+
th: ({ node, className, ...props }) => /* @__PURE__ */ jsx7("th", { className: classNames3("aui-md-th", className), ...props }),
|
|
250
|
+
td: ({ node, className, ...props }) => /* @__PURE__ */ jsx7("td", { className: classNames3("aui-md-td", className), ...props }),
|
|
251
|
+
tr: ({ node, className, ...props }) => /* @__PURE__ */ jsx7("tr", { className: classNames3("aui-md-tr", className), ...props }),
|
|
252
|
+
sup: ({ node, className, ...props }) => /* @__PURE__ */ jsx7("sup", { className: classNames3("aui-md-sup", className), ...props }),
|
|
253
|
+
pre: ({ node, className, ...props }) => /* @__PURE__ */ jsx7("pre", { className: classNames3("aui-md-pre", className), ...props }),
|
|
254
|
+
code: ({ node, className, ...props }) => {
|
|
255
|
+
const isCodeBlock = useIsMarkdownCodeBlock();
|
|
256
|
+
return /* @__PURE__ */ jsx7(
|
|
257
|
+
"code",
|
|
258
|
+
{
|
|
259
|
+
className: classNames3(!isCodeBlock && "aui-md-inline-code", className),
|
|
260
|
+
...props
|
|
261
|
+
}
|
|
262
|
+
);
|
|
263
|
+
},
|
|
264
|
+
CodeHeader
|
|
265
|
+
};
|
|
229
266
|
var makeMarkdownText = ({
|
|
230
267
|
className,
|
|
231
268
|
components: userComponents,
|
|
232
269
|
...rest
|
|
233
270
|
} = {}) => {
|
|
234
271
|
const components = {
|
|
235
|
-
...
|
|
236
|
-
|
|
272
|
+
...defaultComponents,
|
|
273
|
+
...Object.fromEntries(
|
|
274
|
+
// ignore undefined values, so undefined values do not override default components
|
|
275
|
+
Object.entries(userComponents ?? {}).filter(([_, v]) => v !== void 0)
|
|
276
|
+
)
|
|
237
277
|
};
|
|
238
278
|
const MarkdownTextImpl = () => {
|
|
239
279
|
const status = useSmoothStatus();
|
|
@@ -243,7 +283,6 @@ var makeMarkdownText = ({
|
|
|
243
283
|
components,
|
|
244
284
|
...rest,
|
|
245
285
|
className: classNames3(
|
|
246
|
-
"aui-md-root",
|
|
247
286
|
status.type === "running" && "aui-md-running",
|
|
248
287
|
className
|
|
249
288
|
)
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/primitives/MarkdownText.tsx","../src/overrides/PreOverride.tsx","../src/overrides/defaultComponents.tsx","../src/overrides/CodeOverride.tsx","../src/overrides/CodeBlock.tsx","../src/overrides/withDefaults.tsx","../src/ui/markdown-text.tsx","../src/ui/code-header.tsx","../src/ui/useCopyToClipboard.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","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","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","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","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","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","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\";\n\nconst { withSmoothContextProvider, useSmoothStatus } = INTERNAL;\n\nexport type MakeMarkdownTextProps = MarkdownTextPrimitiveProps;\n\nexport const makeMarkdownText = ({\n className,\n components: userComponents,\n ...rest\n}: MakeMarkdownTextProps = {}) => {\n const components = {\n ...userComponents,\n CodeHeader: userComponents?.CodeHeader ?? CodeHeader,\n };\n\n const MarkdownTextImpl: FC = () => {\n const status = useSmoothStatus();\n return (\n <MarkdownTextPrimitive\n components={components}\n {...rest}\n className={classNames(\n \"aui-md-root\",\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","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","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":";;;AAEA,SAAS,UAAU,0BAA0B;AAC7C;AAAA,EAGE;AAAA,OAKK;AACP,OAAO,mBAAqC;;;ACZ5C,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;;;ACVE,gBAAAA,YAAA;AADK,IAAM,aAA2B,CAAC,EAAE,MAAM,GAAG,KAAK,MACvD,gBAAAA,KAAC,SAAK,GAAG,MAAM;AAGV,IAAM,cAA6B,CAAC,EAAE,MAAM,GAAG,KAAK,MACzD,gBAAAA,KAAC,UAAM,GAAG,MAAM;AAGX,IAAM,0BAGR,CAAC,EAAE,YAAY,EAAE,KAAK,KAAK,GAAG,KAAK,MACtC,gBAAAA,KAAC,OACC,0BAAAA,KAAC,QAAM,gBAAK,GACd;AAGK,IAAM,oBAAoD,MAAM;;;AFCvE,SAAS,kBAAAC,uBAAsB;;;AGrB/B,SAAsD,cAAAC,mBAAkB;;;ACAxE,SAA4B,eAAe;AA+BvC,mBACE,OAAAC,MADF;AAVG,IAAM,mBAAuC,CAAC;AAAA,EACnD,YAAY,EAAE,KAAK,MAAM,mBAAmB,YAAAC,YAAW;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,oBAAAD,KAACC,aAAA,EAAW,UAAoB,MAAY;AAAA,IAC5C,gBAAAD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OAC1B;AAAA,KACF;AAEJ;;;AD7BA,OAAOG,iBAAgB;AAKvB,SAAS,YAAAC,iBAAgB;AAmBnB,gBAAAC,YAAA;AAjBN,IAAM,EAAE,2BAA2B,gBAAgB,IAAID;AAIhD,IAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA,YAAY;AAAA,EACZ,GAAG;AACL,IAA2B,CAAC,MAAM;AAChC,QAAM,aAAa;AAAA,IACjB,GAAG;AAAA,IACH,YAAY,gBAAgB,cAAc;AAAA,EAC5C;AAEA,QAAM,mBAAuB,MAAM;AACjC,UAAM,SAAS,gBAAgB;AAC/B,WACE,gBAAAC;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACC,GAAG;AAAA,QACJ,WAAWC;AAAA,UACT;AAAA,UACA,OAAO,SAAS,aAAa;AAAA,UAC7B;AAAA,QACF;AAAA;AAAA,IACF;AAAA,EAEJ;AACA,mBAAiB,cAAc;AAE/B,SAAO,KAAK,0BAA0B,gBAAgB,GAAG,MAAM,IAAI;AACrE;","names":["jsx","useCallbackRef","useContext","jsx","CodeHeader","jsx","useContext","CodeHeader","classNames","jsx","CodeHeader","useCallbackRef","INTERNAL","jsx","jsxs","INTERNAL","classNames","INTERNAL","jsx","classNames"]}
|
|
1
|
+
{"version":3,"sources":["../src/primitives/MarkdownText.tsx","../src/overrides/PreOverride.tsx","../src/overrides/defaultComponents.tsx","../src/overrides/CodeOverride.tsx","../src/overrides/CodeBlock.tsx","../src/overrides/withDefaults.tsx","../src/ui/markdown-text.tsx","../src/ui/code-header.tsx","../src/ui/useCopyToClipboard.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","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","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","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","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","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","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","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","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":";;;AAEA,SAAS,UAAU,0BAA0B;AAC7C;AAAA,EAGE;AAAA,OAKK;AACP,OAAO,mBAAqC;;;ACZ5C,SAAS,eAAyC,kBAAkB;AAa3D;AAVF,IAAM,aAAa,cAGhB,IAAI;AAEP,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CAAC;AAAA,EAC/B;AAAA,EACA,YAAY;AAAA,EACZ,GAAG;AACL,IAA2B,CAAC,MAAM;AAChC,QAAM,aAAa;AAAA,IACjB,GAAG;AAAA,IACH,GAAG,OAAO;AAAA;AAAA,MAER,OAAO,QAAQ,kBAAkB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,MAAM,MAAM,MAAS;AAAA,IACzE;AAAA,EACF;AAEA,QAAM,mBAAuB,MAAM;AACjC,UAAM,SAAS,gBAAgB;AAC/B,WACE,gBAAAF;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACC,GAAG;AAAA,QACJ,WAAWE;AAAA,UACT,OAAO,SAAS,aAAa;AAAA,UAC7B;AAAA,QACF;AAAA;AAAA,IACF;AAAA,EAEJ;AACA,mBAAiB,cAAc;AAE/B,SAAO,KAAK,0BAA0B,gBAAgB,GAAG,MAAM,IAAI;AACrE;","names":["jsx","useCallbackRef","useContext","jsx","CodeHeader","jsx","useContext","CodeHeader","classNames","jsx","CodeHeader","useCallbackRef","INTERNAL","jsx","jsxs","INTERNAL","classNames","INTERNAL","jsx","INTERNAL","classNames"]}
|
package/dist/styles/markdown.css
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
:where(.aui-md-running) > :where(:is(ol, ul):last-child) > :where(li:last-child) > :where(:is(ol, ul):last-child) > :where(li:last-child) > :where(:is(ol, ul):last-child) > :where(li:last-child):where([dir=rtl], [dir=rtl] *)::after {
|
|
39
39
|
margin-right: 0.25rem;
|
|
40
40
|
}
|
|
41
|
-
.aui-md-
|
|
41
|
+
.aui-md-h1 {
|
|
42
42
|
margin-bottom: 2rem;
|
|
43
43
|
scroll-margin: 5rem;
|
|
44
44
|
font-size: 2.25rem;
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
font-weight: 800;
|
|
47
47
|
letter-spacing: -0.025em;
|
|
48
48
|
}
|
|
49
|
-
.aui-md-
|
|
49
|
+
.aui-md-h1:last-child {
|
|
50
50
|
margin-bottom: 0px;
|
|
51
51
|
}
|
|
52
|
-
.aui-md-
|
|
52
|
+
.aui-md-h2 {
|
|
53
53
|
margin-bottom: 1rem;
|
|
54
54
|
margin-top: 2rem;
|
|
55
55
|
scroll-margin: 5rem;
|
|
@@ -58,13 +58,13 @@
|
|
|
58
58
|
font-weight: 600;
|
|
59
59
|
letter-spacing: -0.025em;
|
|
60
60
|
}
|
|
61
|
-
.aui-md-
|
|
61
|
+
.aui-md-h2:first-child {
|
|
62
62
|
margin-top: 0px;
|
|
63
63
|
}
|
|
64
|
-
.aui-md-
|
|
64
|
+
.aui-md-h2:last-child {
|
|
65
65
|
margin-bottom: 0px;
|
|
66
66
|
}
|
|
67
|
-
.aui-md-
|
|
67
|
+
.aui-md-h3 {
|
|
68
68
|
margin-bottom: 1rem;
|
|
69
69
|
margin-top: 1.5rem;
|
|
70
70
|
scroll-margin: 5rem;
|
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
font-weight: 600;
|
|
74
74
|
letter-spacing: -0.025em;
|
|
75
75
|
}
|
|
76
|
-
.aui-md-
|
|
76
|
+
.aui-md-h3:first-child {
|
|
77
77
|
margin-top: 0px;
|
|
78
78
|
}
|
|
79
|
-
.aui-md-
|
|
79
|
+
.aui-md-h3:last-child {
|
|
80
80
|
margin-bottom: 0px;
|
|
81
81
|
}
|
|
82
|
-
.aui-md-
|
|
82
|
+
.aui-md-h4 {
|
|
83
83
|
margin-bottom: 1rem;
|
|
84
84
|
margin-top: 1.5rem;
|
|
85
85
|
scroll-margin: 5rem;
|
|
@@ -88,82 +88,82 @@
|
|
|
88
88
|
font-weight: 600;
|
|
89
89
|
letter-spacing: -0.025em;
|
|
90
90
|
}
|
|
91
|
-
.aui-md-
|
|
91
|
+
.aui-md-h4:first-child {
|
|
92
92
|
margin-top: 0px;
|
|
93
93
|
}
|
|
94
|
-
.aui-md-
|
|
94
|
+
.aui-md-h4:last-child {
|
|
95
95
|
margin-bottom: 0px;
|
|
96
96
|
}
|
|
97
|
-
.aui-md-
|
|
97
|
+
.aui-md-h5 {
|
|
98
98
|
margin-top: 1rem;
|
|
99
99
|
margin-bottom: 1rem;
|
|
100
100
|
font-size: 1.125rem;
|
|
101
101
|
line-height: 1.75rem;
|
|
102
102
|
font-weight: 600;
|
|
103
103
|
}
|
|
104
|
-
.aui-md-
|
|
104
|
+
.aui-md-h5:first-child {
|
|
105
105
|
margin-top: 0px;
|
|
106
106
|
}
|
|
107
|
-
.aui-md-
|
|
107
|
+
.aui-md-h5:last-child {
|
|
108
108
|
margin-bottom: 0px;
|
|
109
109
|
}
|
|
110
|
-
.aui-md-
|
|
110
|
+
.aui-md-h6 {
|
|
111
111
|
margin-top: 1rem;
|
|
112
112
|
margin-bottom: 1rem;
|
|
113
113
|
font-weight: 600;
|
|
114
114
|
}
|
|
115
|
-
.aui-md-
|
|
115
|
+
.aui-md-h6:first-child {
|
|
116
116
|
margin-top: 0px;
|
|
117
117
|
}
|
|
118
|
-
.aui-md-
|
|
118
|
+
.aui-md-h6:last-child {
|
|
119
119
|
margin-bottom: 0px;
|
|
120
120
|
}
|
|
121
|
-
.aui-md-
|
|
121
|
+
.aui-md-p {
|
|
122
122
|
margin-bottom: 1.25rem;
|
|
123
123
|
margin-top: 1.25rem;
|
|
124
124
|
line-height: 1.75rem;
|
|
125
125
|
}
|
|
126
|
-
.aui-md-
|
|
126
|
+
.aui-md-p:first-child {
|
|
127
127
|
margin-top: 0px;
|
|
128
128
|
}
|
|
129
|
-
.aui-md-
|
|
129
|
+
.aui-md-p:last-child {
|
|
130
130
|
margin-bottom: 0px;
|
|
131
131
|
}
|
|
132
|
-
.aui-md-
|
|
132
|
+
.aui-md-a {
|
|
133
133
|
font-weight: 500;
|
|
134
134
|
color: hsl(var(--aui-primary));
|
|
135
135
|
text-decoration-line: underline;
|
|
136
136
|
text-underline-offset: 4px;
|
|
137
137
|
}
|
|
138
|
-
.aui-md-
|
|
138
|
+
.aui-md-blockquote {
|
|
139
139
|
border-left-width: 2px;
|
|
140
140
|
padding-left: 1.5rem;
|
|
141
141
|
font-style: italic;
|
|
142
142
|
}
|
|
143
|
-
.aui-md-
|
|
143
|
+
.aui-md-ul {
|
|
144
144
|
margin-top: 1.25rem;
|
|
145
145
|
margin-bottom: 1.25rem;
|
|
146
146
|
margin-left: 1.5rem;
|
|
147
147
|
list-style-type: disc;
|
|
148
148
|
}
|
|
149
|
-
.aui-md-
|
|
149
|
+
.aui-md-ul > li {
|
|
150
150
|
margin-top: 0.5rem;
|
|
151
151
|
}
|
|
152
|
-
.aui-md-
|
|
152
|
+
.aui-md-ol {
|
|
153
153
|
margin-top: 1.25rem;
|
|
154
154
|
margin-bottom: 1.25rem;
|
|
155
155
|
margin-left: 1.5rem;
|
|
156
156
|
list-style-type: decimal;
|
|
157
157
|
}
|
|
158
|
-
.aui-md-
|
|
158
|
+
.aui-md-ol > li {
|
|
159
159
|
margin-top: 0.5rem;
|
|
160
160
|
}
|
|
161
|
-
.aui-md-
|
|
161
|
+
.aui-md-hr {
|
|
162
162
|
margin-top: 1.25rem;
|
|
163
163
|
margin-bottom: 1.25rem;
|
|
164
164
|
border-bottom-width: 1px;
|
|
165
165
|
}
|
|
166
|
-
.aui-md-
|
|
166
|
+
.aui-md-table {
|
|
167
167
|
margin-top: 1.25rem;
|
|
168
168
|
margin-bottom: 1.25rem;
|
|
169
169
|
width: 100%;
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
border-spacing: var(--aui-border-spacing-x) var(--aui-border-spacing-y);
|
|
174
174
|
overflow-y: auto;
|
|
175
175
|
}
|
|
176
|
-
.aui-md-
|
|
176
|
+
.aui-md-th {
|
|
177
177
|
background-color: hsl(var(--aui-muted));
|
|
178
178
|
padding-left: 1rem;
|
|
179
179
|
padding-right: 1rem;
|
|
@@ -182,19 +182,19 @@
|
|
|
182
182
|
text-align: left;
|
|
183
183
|
font-weight: 700;
|
|
184
184
|
}
|
|
185
|
-
.aui-md-
|
|
185
|
+
.aui-md-th:first-child {
|
|
186
186
|
border-top-left-radius: var(--aui-radius);
|
|
187
187
|
}
|
|
188
|
-
.aui-md-
|
|
188
|
+
.aui-md-th:last-child {
|
|
189
189
|
border-top-right-radius: var(--aui-radius);
|
|
190
190
|
}
|
|
191
|
-
.aui-md-
|
|
191
|
+
.aui-md-th[align=center] {
|
|
192
192
|
text-align: center;
|
|
193
193
|
}
|
|
194
|
-
.aui-md-
|
|
194
|
+
.aui-md-th[align=right] {
|
|
195
195
|
text-align: right;
|
|
196
196
|
}
|
|
197
|
-
.aui-md-
|
|
197
|
+
.aui-md-td {
|
|
198
198
|
border-bottom-width: 1px;
|
|
199
199
|
border-left-width: 1px;
|
|
200
200
|
padding-left: 1rem;
|
|
@@ -203,35 +203,35 @@
|
|
|
203
203
|
padding-bottom: 0.5rem;
|
|
204
204
|
text-align: left;
|
|
205
205
|
}
|
|
206
|
-
.aui-md-
|
|
206
|
+
.aui-md-td:last-child {
|
|
207
207
|
border-right-width: 1px;
|
|
208
208
|
}
|
|
209
|
-
.aui-md-
|
|
209
|
+
.aui-md-td[align=center] {
|
|
210
210
|
text-align: center;
|
|
211
211
|
}
|
|
212
|
-
.aui-md-
|
|
212
|
+
.aui-md-td[align=right] {
|
|
213
213
|
text-align: right;
|
|
214
214
|
}
|
|
215
|
-
.aui-md-
|
|
215
|
+
.aui-md-tr {
|
|
216
216
|
margin: 0px;
|
|
217
217
|
border-bottom-width: 1px;
|
|
218
218
|
padding: 0px;
|
|
219
219
|
}
|
|
220
|
-
.aui-md-
|
|
220
|
+
.aui-md-tr:first-child {
|
|
221
221
|
border-top-width: 1px;
|
|
222
222
|
}
|
|
223
|
-
.aui-md-
|
|
223
|
+
.aui-md-tr:last-child > td:first-child {
|
|
224
224
|
border-bottom-left-radius: var(--aui-radius);
|
|
225
225
|
}
|
|
226
|
-
.aui-md-
|
|
226
|
+
.aui-md-tr:last-child > td:last-child {
|
|
227
227
|
border-bottom-right-radius: var(--aui-radius);
|
|
228
228
|
}
|
|
229
|
-
.aui-md-
|
|
229
|
+
.aui-md-sup > a {
|
|
230
230
|
font-size: 0.75rem;
|
|
231
231
|
line-height: 1rem;
|
|
232
232
|
text-decoration-line: none;
|
|
233
233
|
}
|
|
234
|
-
.aui-md-
|
|
234
|
+
.aui-md-pre {
|
|
235
235
|
overflow-x: auto;
|
|
236
236
|
border-bottom-right-radius: var(--aui-radius);
|
|
237
237
|
border-bottom-left-radius: var(--aui-radius);
|
|
@@ -240,8 +240,7 @@
|
|
|
240
240
|
--aui-text-opacity: 1;
|
|
241
241
|
color: rgb(255 255 255 / var(--aui-text-opacity));
|
|
242
242
|
}
|
|
243
|
-
.aui-md-
|
|
244
|
-
.aui-md-root :not(:where(pre)) code {
|
|
243
|
+
.aui-md-inline-code {
|
|
245
244
|
border-radius: 0.25rem;
|
|
246
245
|
border-width: 1px;
|
|
247
246
|
background-color: hsl(var(--aui-muted));
|
|
@@ -19,82 +19,81 @@
|
|
|
19
19
|
> :where(li:last-child)::after {
|
|
20
20
|
@apply animate-pulse font-sans content-['\25CF'] ltr:ml-1 rtl:mr-1;
|
|
21
21
|
}
|
|
22
|
-
/* typography */
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
/* typography */
|
|
24
|
+
.aui-md-h1 {
|
|
25
25
|
@apply mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.aui-md-
|
|
28
|
+
.aui-md-h2 {
|
|
29
29
|
@apply mb-4 mt-8 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
.aui-md-
|
|
32
|
+
.aui-md-h3 {
|
|
33
33
|
@apply mb-4 mt-6 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
.aui-md-
|
|
36
|
+
.aui-md-h4 {
|
|
37
37
|
@apply mb-4 mt-6 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
.aui-md-
|
|
40
|
+
.aui-md-h5 {
|
|
41
41
|
@apply my-4 text-lg font-semibold first:mt-0 last:mb-0;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
.aui-md-
|
|
44
|
+
.aui-md-h6 {
|
|
45
45
|
@apply my-4 font-semibold first:mt-0 last:mb-0;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
.aui-md-
|
|
48
|
+
.aui-md-p {
|
|
49
49
|
@apply mb-5 mt-5 leading-7 first:mt-0 last:mb-0;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
.aui-md-
|
|
52
|
+
.aui-md-a {
|
|
53
53
|
@apply text-aui-primary font-medium underline underline-offset-4;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
.aui-md-
|
|
56
|
+
.aui-md-blockquote {
|
|
57
57
|
@apply border-l-2 pl-6 italic;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
.aui-md-
|
|
60
|
+
.aui-md-ul {
|
|
61
61
|
@apply my-5 ml-6 list-disc [&>li]:mt-2;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
.aui-md-
|
|
64
|
+
.aui-md-ol {
|
|
65
65
|
@apply my-5 ml-6 list-decimal [&>li]:mt-2;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
.aui-md-
|
|
68
|
+
.aui-md-hr {
|
|
69
69
|
@apply my-5 border-b;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
.aui-md-
|
|
72
|
+
.aui-md-table {
|
|
73
73
|
@apply my-5 w-full border-separate border-spacing-0 overflow-y-auto;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
.aui-md-
|
|
76
|
+
.aui-md-th {
|
|
77
77
|
@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;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
.aui-md-
|
|
80
|
+
.aui-md-td {
|
|
81
81
|
@apply border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
.aui-md-
|
|
84
|
+
.aui-md-tr {
|
|
85
85
|
@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;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
.aui-md-
|
|
88
|
+
.aui-md-sup {
|
|
89
89
|
@apply [&>a]:text-xs [&>a]:no-underline;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
.aui-md-
|
|
92
|
+
.aui-md-pre {
|
|
93
93
|
@apply overflow-x-auto rounded-b-lg bg-black p-4 text-white;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
.aui-md-
|
|
97
|
-
.aui-md-root :not(:where(pre)) code {
|
|
96
|
+
.aui-md-inline-code {
|
|
98
97
|
@apply bg-aui-muted rounded border font-semibold;
|
|
99
98
|
}
|
|
100
99
|
|
|
@@ -35,66 +35,66 @@ __export(tailwindcss_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(tailwindcss_exports);
|
|
36
36
|
var import_plugin = __toESM(require("tailwindcss/plugin.js"));
|
|
37
37
|
|
|
38
|
-
//
|
|
38
|
+
// generated/markdown.css.json
|
|
39
39
|
var markdown_css_default = {
|
|
40
40
|
":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": {
|
|
41
41
|
"@apply animate-pulse font-sans content-['\\25CF'] ltr:ml-1 rtl:mr-1": {}
|
|
42
42
|
},
|
|
43
|
-
".aui-md-
|
|
43
|
+
".aui-md-h1": {
|
|
44
44
|
"@apply mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0": {}
|
|
45
45
|
},
|
|
46
|
-
".aui-md-
|
|
46
|
+
".aui-md-h2": {
|
|
47
47
|
"@apply mb-4 mt-8 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0": {}
|
|
48
48
|
},
|
|
49
|
-
".aui-md-
|
|
49
|
+
".aui-md-h3": {
|
|
50
50
|
"@apply mb-4 mt-6 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0": {}
|
|
51
51
|
},
|
|
52
|
-
".aui-md-
|
|
52
|
+
".aui-md-h4": {
|
|
53
53
|
"@apply mb-4 mt-6 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0": {}
|
|
54
54
|
},
|
|
55
|
-
".aui-md-
|
|
55
|
+
".aui-md-h5": {
|
|
56
56
|
"@apply my-4 text-lg font-semibold first:mt-0 last:mb-0": {}
|
|
57
57
|
},
|
|
58
|
-
".aui-md-
|
|
58
|
+
".aui-md-h6": {
|
|
59
59
|
"@apply my-4 font-semibold first:mt-0 last:mb-0": {}
|
|
60
60
|
},
|
|
61
|
-
".aui-md-
|
|
61
|
+
".aui-md-p": {
|
|
62
62
|
"@apply mb-5 mt-5 leading-7 first:mt-0 last:mb-0": {}
|
|
63
63
|
},
|
|
64
|
-
".aui-md-
|
|
64
|
+
".aui-md-a": {
|
|
65
65
|
"@apply text-aui-primary font-medium underline underline-offset-4": {}
|
|
66
66
|
},
|
|
67
|
-
".aui-md-
|
|
67
|
+
".aui-md-blockquote": {
|
|
68
68
|
"@apply border-l-2 pl-6 italic": {}
|
|
69
69
|
},
|
|
70
|
-
".aui-md-
|
|
70
|
+
".aui-md-ul": {
|
|
71
71
|
"@apply my-5 ml-6 list-disc [&>li]:mt-2": {}
|
|
72
72
|
},
|
|
73
|
-
".aui-md-
|
|
73
|
+
".aui-md-ol": {
|
|
74
74
|
"@apply my-5 ml-6 list-decimal [&>li]:mt-2": {}
|
|
75
75
|
},
|
|
76
|
-
".aui-md-
|
|
76
|
+
".aui-md-hr": {
|
|
77
77
|
"@apply my-5 border-b": {}
|
|
78
78
|
},
|
|
79
|
-
".aui-md-
|
|
79
|
+
".aui-md-table": {
|
|
80
80
|
"@apply my-5 w-full border-separate border-spacing-0 overflow-y-auto": {}
|
|
81
81
|
},
|
|
82
|
-
".aui-md-
|
|
82
|
+
".aui-md-th": {
|
|
83
83
|
"@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": {}
|
|
84
84
|
},
|
|
85
|
-
".aui-md-
|
|
85
|
+
".aui-md-td": {
|
|
86
86
|
"@apply border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right": {}
|
|
87
87
|
},
|
|
88
|
-
".aui-md-
|
|
88
|
+
".aui-md-tr": {
|
|
89
89
|
"@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": {}
|
|
90
90
|
},
|
|
91
|
-
".aui-md-
|
|
91
|
+
".aui-md-sup": {
|
|
92
92
|
"@apply [&>a]:text-xs [&>a]:no-underline": {}
|
|
93
93
|
},
|
|
94
|
-
".aui-md-
|
|
94
|
+
".aui-md-pre": {
|
|
95
95
|
"@apply overflow-x-auto rounded-b-lg bg-black p-4 text-white": {}
|
|
96
96
|
},
|
|
97
|
-
".aui-md-
|
|
97
|
+
".aui-md-inline-code": {
|
|
98
98
|
"@apply bg-aui-muted rounded border font-semibold": {}
|
|
99
99
|
},
|
|
100
100
|
".aui-code-header-root": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/tailwindcss/index.ts","../../
|
|
1
|
+
{"version":3,"sources":["../../src/tailwindcss/index.ts","../../generated/markdown.css.json"],"sourcesContent":["import plugin from \"tailwindcss/plugin.js\";\nimport markdownCSS from \"../../generated/markdown.css.json\";\n\nconst auiPlugin = plugin.withOptions<{}>(() => ({ addComponents }) => {\n addComponents(markdownCSS);\n});\n\nexport default auiPlugin;\n","{\n \":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\": {\n \"@apply animate-pulse font-sans content-['\\\\25CF'] ltr:ml-1 rtl:mr-1\": {}\n },\n \".aui-md-h1\": {\n \"@apply mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0\": {}\n },\n \".aui-md-h2\": {\n \"@apply mb-4 mt-8 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0\": {}\n },\n \".aui-md-h3\": {\n \"@apply mb-4 mt-6 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0\": {}\n },\n \".aui-md-h4\": {\n \"@apply mb-4 mt-6 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0\": {}\n },\n \".aui-md-h5\": {\n \"@apply my-4 text-lg font-semibold first:mt-0 last:mb-0\": {}\n },\n \".aui-md-h6\": {\n \"@apply my-4 font-semibold first:mt-0 last:mb-0\": {}\n },\n \".aui-md-p\": {\n \"@apply mb-5 mt-5 leading-7 first:mt-0 last:mb-0\": {}\n },\n \".aui-md-a\": {\n \"@apply text-aui-primary font-medium underline underline-offset-4\": {}\n },\n \".aui-md-blockquote\": {\n \"@apply border-l-2 pl-6 italic\": {}\n },\n \".aui-md-ul\": {\n \"@apply my-5 ml-6 list-disc [&>li]:mt-2\": {}\n },\n \".aui-md-ol\": {\n \"@apply my-5 ml-6 list-decimal [&>li]:mt-2\": {}\n },\n \".aui-md-hr\": {\n \"@apply my-5 border-b\": {}\n },\n \".aui-md-table\": {\n \"@apply my-5 w-full border-separate border-spacing-0 overflow-y-auto\": {}\n },\n \".aui-md-th\": {\n \"@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\": {}\n },\n \".aui-md-td\": {\n \"@apply border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right\": {}\n },\n \".aui-md-tr\": {\n \"@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\": {}\n },\n \".aui-md-sup\": {\n \"@apply [&>a]:text-xs [&>a]:no-underline\": {}\n },\n \".aui-md-pre\": {\n \"@apply overflow-x-auto rounded-b-lg bg-black p-4 text-white\": {}\n },\n \".aui-md-inline-code\": {\n \"@apply bg-aui-muted rounded border font-semibold\": {}\n },\n \".aui-code-header-root\": {\n \"@apply flex items-center justify-between gap-4 rounded-t-lg bg-zinc-900 px-4 py-2 text-sm font-semibold text-white\": {}\n },\n \".aui-code-header-language\": {\n \"@apply lowercase [&>span]:text-xs\": {}\n }\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;;;ACAnB;AAAA,EACE,grBAAgrB;AAAA,IAC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AAM,YAAY,cAAAA,QAAO,YAAgB,MAAM,CAAC,EAAE,cAAc,MAAM;AACpE,gBAAc,oBAAW;AAC3B,CAAC;AAED,IAAO,sBAAQ;","names":["plugin"]}
|
|
@@ -1,66 +1,66 @@
|
|
|
1
1
|
// src/tailwindcss/index.ts
|
|
2
2
|
import plugin from "tailwindcss/plugin.js";
|
|
3
3
|
|
|
4
|
-
//
|
|
4
|
+
// generated/markdown.css.json
|
|
5
5
|
var markdown_css_default = {
|
|
6
6
|
":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": {
|
|
7
7
|
"@apply animate-pulse font-sans content-['\\25CF'] ltr:ml-1 rtl:mr-1": {}
|
|
8
8
|
},
|
|
9
|
-
".aui-md-
|
|
9
|
+
".aui-md-h1": {
|
|
10
10
|
"@apply mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0": {}
|
|
11
11
|
},
|
|
12
|
-
".aui-md-
|
|
12
|
+
".aui-md-h2": {
|
|
13
13
|
"@apply mb-4 mt-8 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0": {}
|
|
14
14
|
},
|
|
15
|
-
".aui-md-
|
|
15
|
+
".aui-md-h3": {
|
|
16
16
|
"@apply mb-4 mt-6 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0": {}
|
|
17
17
|
},
|
|
18
|
-
".aui-md-
|
|
18
|
+
".aui-md-h4": {
|
|
19
19
|
"@apply mb-4 mt-6 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0": {}
|
|
20
20
|
},
|
|
21
|
-
".aui-md-
|
|
21
|
+
".aui-md-h5": {
|
|
22
22
|
"@apply my-4 text-lg font-semibold first:mt-0 last:mb-0": {}
|
|
23
23
|
},
|
|
24
|
-
".aui-md-
|
|
24
|
+
".aui-md-h6": {
|
|
25
25
|
"@apply my-4 font-semibold first:mt-0 last:mb-0": {}
|
|
26
26
|
},
|
|
27
|
-
".aui-md-
|
|
27
|
+
".aui-md-p": {
|
|
28
28
|
"@apply mb-5 mt-5 leading-7 first:mt-0 last:mb-0": {}
|
|
29
29
|
},
|
|
30
|
-
".aui-md-
|
|
30
|
+
".aui-md-a": {
|
|
31
31
|
"@apply text-aui-primary font-medium underline underline-offset-4": {}
|
|
32
32
|
},
|
|
33
|
-
".aui-md-
|
|
33
|
+
".aui-md-blockquote": {
|
|
34
34
|
"@apply border-l-2 pl-6 italic": {}
|
|
35
35
|
},
|
|
36
|
-
".aui-md-
|
|
36
|
+
".aui-md-ul": {
|
|
37
37
|
"@apply my-5 ml-6 list-disc [&>li]:mt-2": {}
|
|
38
38
|
},
|
|
39
|
-
".aui-md-
|
|
39
|
+
".aui-md-ol": {
|
|
40
40
|
"@apply my-5 ml-6 list-decimal [&>li]:mt-2": {}
|
|
41
41
|
},
|
|
42
|
-
".aui-md-
|
|
42
|
+
".aui-md-hr": {
|
|
43
43
|
"@apply my-5 border-b": {}
|
|
44
44
|
},
|
|
45
|
-
".aui-md-
|
|
45
|
+
".aui-md-table": {
|
|
46
46
|
"@apply my-5 w-full border-separate border-spacing-0 overflow-y-auto": {}
|
|
47
47
|
},
|
|
48
|
-
".aui-md-
|
|
48
|
+
".aui-md-th": {
|
|
49
49
|
"@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": {}
|
|
50
50
|
},
|
|
51
|
-
".aui-md-
|
|
51
|
+
".aui-md-td": {
|
|
52
52
|
"@apply border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right": {}
|
|
53
53
|
},
|
|
54
|
-
".aui-md-
|
|
54
|
+
".aui-md-tr": {
|
|
55
55
|
"@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": {}
|
|
56
56
|
},
|
|
57
|
-
".aui-md-
|
|
57
|
+
".aui-md-sup": {
|
|
58
58
|
"@apply [&>a]:text-xs [&>a]:no-underline": {}
|
|
59
59
|
},
|
|
60
|
-
".aui-md-
|
|
60
|
+
".aui-md-pre": {
|
|
61
61
|
"@apply overflow-x-auto rounded-b-lg bg-black p-4 text-white": {}
|
|
62
62
|
},
|
|
63
|
-
".aui-md-
|
|
63
|
+
".aui-md-inline-code": {
|
|
64
64
|
"@apply bg-aui-muted rounded border font-semibold": {}
|
|
65
65
|
},
|
|
66
66
|
".aui-code-header-root": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/tailwindcss/index.ts","../../
|
|
1
|
+
{"version":3,"sources":["../../src/tailwindcss/index.ts","../../generated/markdown.css.json"],"sourcesContent":["import plugin from \"tailwindcss/plugin.js\";\nimport markdownCSS from \"../../generated/markdown.css.json\";\n\nconst auiPlugin = plugin.withOptions<{}>(() => ({ addComponents }) => {\n addComponents(markdownCSS);\n});\n\nexport default auiPlugin;\n","{\n \":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\": {\n \"@apply animate-pulse font-sans content-['\\\\25CF'] ltr:ml-1 rtl:mr-1\": {}\n },\n \".aui-md-h1\": {\n \"@apply mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0\": {}\n },\n \".aui-md-h2\": {\n \"@apply mb-4 mt-8 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0\": {}\n },\n \".aui-md-h3\": {\n \"@apply mb-4 mt-6 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0\": {}\n },\n \".aui-md-h4\": {\n \"@apply mb-4 mt-6 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0\": {}\n },\n \".aui-md-h5\": {\n \"@apply my-4 text-lg font-semibold first:mt-0 last:mb-0\": {}\n },\n \".aui-md-h6\": {\n \"@apply my-4 font-semibold first:mt-0 last:mb-0\": {}\n },\n \".aui-md-p\": {\n \"@apply mb-5 mt-5 leading-7 first:mt-0 last:mb-0\": {}\n },\n \".aui-md-a\": {\n \"@apply text-aui-primary font-medium underline underline-offset-4\": {}\n },\n \".aui-md-blockquote\": {\n \"@apply border-l-2 pl-6 italic\": {}\n },\n \".aui-md-ul\": {\n \"@apply my-5 ml-6 list-disc [&>li]:mt-2\": {}\n },\n \".aui-md-ol\": {\n \"@apply my-5 ml-6 list-decimal [&>li]:mt-2\": {}\n },\n \".aui-md-hr\": {\n \"@apply my-5 border-b\": {}\n },\n \".aui-md-table\": {\n \"@apply my-5 w-full border-separate border-spacing-0 overflow-y-auto\": {}\n },\n \".aui-md-th\": {\n \"@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\": {}\n },\n \".aui-md-td\": {\n \"@apply border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right\": {}\n },\n \".aui-md-tr\": {\n \"@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\": {}\n },\n \".aui-md-sup\": {\n \"@apply [&>a]:text-xs [&>a]:no-underline\": {}\n },\n \".aui-md-pre\": {\n \"@apply overflow-x-auto rounded-b-lg bg-black p-4 text-white\": {}\n },\n \".aui-md-inline-code\": {\n \"@apply bg-aui-muted rounded border font-semibold\": {}\n },\n \".aui-code-header-root\": {\n \"@apply flex items-center justify-between gap-4 rounded-t-lg bg-zinc-900 px-4 py-2 text-sm font-semibold text-white\": {}\n },\n \".aui-code-header-language\": {\n \"@apply lowercase [&>span]:text-xs\": {}\n }\n}"],"mappings":";AAAA,OAAO,YAAY;;;ACAnB;AAAA,EACE,grBAAgrB;AAAA,IAC9qB,uEAAuE,CAAC;AAAA,EAC1E;AAAA,EACA,cAAc;AAAA,IACZ,4EAA4E,CAAC;AAAA,EAC/E;AAAA,EACA,cAAc;AAAA,IACZ,2FAA2F,CAAC;AAAA,EAC9F;AAAA,EACA,cAAc;AAAA,IACZ,2FAA2F,CAAC;AAAA,EAC9F;AAAA,EACA,cAAc;AAAA,IACZ,0FAA0F,CAAC;AAAA,EAC7F;AAAA,EACA,cAAc;AAAA,IACZ,0DAA0D,CAAC;AAAA,EAC7D;AAAA,EACA,cAAc;AAAA,IACZ,kDAAkD,CAAC;AAAA,EACrD;AAAA,EACA,aAAa;AAAA,IACX,mDAAmD,CAAC;AAAA,EACtD;AAAA,EACA,aAAa;AAAA,IACX,oEAAoE,CAAC;AAAA,EACvE;AAAA,EACA,sBAAsB;AAAA,IACpB,iCAAiC,CAAC;AAAA,EACpC;AAAA,EACA,cAAc;AAAA,IACZ,0CAA0C,CAAC;AAAA,EAC7C;AAAA,EACA,cAAc;AAAA,IACZ,6CAA6C,CAAC;AAAA,EAChD;AAAA,EACA,cAAc;AAAA,IACZ,wBAAwB,CAAC;AAAA,EAC3B;AAAA,EACA,iBAAiB;AAAA,IACf,uEAAuE,CAAC;AAAA,EAC1E;AAAA,EACA,cAAc;AAAA,IACZ,sJAAsJ,CAAC;AAAA,EACzJ;AAAA,EACA,cAAc;AAAA,IACZ,wHAAwH,CAAC;AAAA,EAC3H;AAAA,EACA,cAAc;AAAA,IACZ,iIAAiI,CAAC;AAAA,EACpI;AAAA,EACA,eAAe;AAAA,IACb,2CAA2C,CAAC;AAAA,EAC9C;AAAA,EACA,eAAe;AAAA,IACb,+DAA+D,CAAC;AAAA,EAClE;AAAA,EACA,uBAAuB;AAAA,IACrB,oDAAoD,CAAC;AAAA,EACvD;AAAA,EACA,yBAAyB;AAAA,IACvB,sHAAsH,CAAC;AAAA,EACzH;AAAA,EACA,6BAA6B;AAAA,IAC3B,qCAAqC,CAAC;AAAA,EACxC;AACF;;;ADhEA,IAAM,YAAY,OAAO,YAAgB,MAAM,CAAC,EAAE,cAAc,MAAM;AACpE,gBAAc,oBAAW;AAC3B,CAAC;AAED,IAAO,sBAAQ;","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.22",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -58,14 +58,14 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@types/node": "^22.7.
|
|
61
|
+
"@types/node": "^22.7.9",
|
|
62
62
|
"autoprefixer": "^10.4.20",
|
|
63
63
|
"eslint": "^9",
|
|
64
|
-
"eslint-config-next": "15.0.
|
|
64
|
+
"eslint-config-next": "15.0.1",
|
|
65
65
|
"postcss": "^8.4.47",
|
|
66
66
|
"postcss-js": "^4.0.1",
|
|
67
|
-
"react": "19.0.0-rc-
|
|
68
|
-
"react-dom": "19.0.0-rc-
|
|
67
|
+
"react": "19.0.0-rc-69d4b800-20241021",
|
|
68
|
+
"react-dom": "19.0.0-rc-69d4b800-20241021",
|
|
69
69
|
"tailwindcss": "^3.4.14",
|
|
70
70
|
"tailwindcss-animate": "^1.0.7",
|
|
71
71
|
"tsup": "8.3.0",
|