@assistant-ui/react-markdown 0.1.0 → 0.1.2
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.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/styles/markdown.css +249 -47
- package/dist/styles/tailwindcss/markdown.css +40 -37
- package/package.json +7 -2
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/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 {\n makeMarkdownText,\n type MakeMarkdownTextProps,\n} from \"./ui/markdown-text\";\n\nexport { CodeHeader } from \"./ui/code-header\";\n","import { INTERNAL, useContentPartText } from \"@assistant-ui/react\";\nimport type { ComponentType, FC } 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 DefaultSyntaxHighlighter,\n DefaultCodeHeader,\n} from \"../overrides/defaultComponents\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { CodeOverride } from \"../overrides/CodeOverride\";\n\nconst { useSmooth } = INTERNAL;\n\nexport type MarkdownTextPrimitiveProps = Omit<\n Options,\n \"components\" | \"children\"\n> & {\n components?: NonNullable<Options[\"components\"]> & {\n SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps>;\n CodeHeader?: ComponentType<CodeHeaderProps>;\n };\n smooth?: boolean;\n};\nexport const MarkdownTextPrimitive: FC<MarkdownTextPrimitiveProps> = ({\n smooth = true,\n components: userComponents,\n ...rest\n}) => {\n const {\n part: { text },\n } = useContentPartText();\n const smoothText = useSmooth(text, smooth);\n\n const {\n pre = DefaultPre,\n code = DefaultCode,\n SyntaxHighlighter = DefaultSyntaxHighlighter,\n CodeHeader = DefaultCodeHeader,\n ...componentsRest\n } = userComponents ?? {};\n const components: typeof userComponents = {\n ...componentsRest,\n pre: PreOverride,\n code: useCallbackRef((props) => (\n <CodeOverride\n components={{ Pre: pre, Code: code, SyntaxHighlighter, CodeHeader }}\n {...props}\n />\n )),\n };\n\n return (\n <ReactMarkdown components={components} {...rest}>\n {smoothText}\n </ReactMarkdown>\n );\n};\n","import { createContext, ComponentPropsWithoutRef } from \"react\";\nimport { PreComponent } from \"./types\";\n\nexport const PreContext = createContext<Omit<\n ComponentPropsWithoutRef<PreComponent>,\n \"children\"\n> | null>(null);\n\nexport const PreOverride: PreComponent = ({ children, ...rest }) => {\n return <PreContext.Provider value={rest}>{children}</PreContext.Provider>;\n};\n","import type { ComponentType } from \"react\";\nimport {\n PreComponent,\n CodeComponent,\n SyntaxHighlighterProps,\n CodeHeaderProps,\n} from \"./types\";\n\nexport const DefaultPre: PreComponent = ({ node, ...rest }) => (\n <pre {...rest} />\n);\nexport const DefaultCode: CodeComponent = ({ node, ...rest }) => (\n <code {...rest} />\n);\nexport const DefaultSyntaxHighlighter: ComponentType<\n SyntaxHighlighterProps\n> = ({ components: { Pre, Code }, code }) => (\n <Pre>\n <Code>{code}</Code>\n </Pre>\n);\nexport const DefaultCodeHeader: ComponentType<CodeHeaderProps> = () => null;\n","import {\n ComponentPropsWithoutRef,\n ComponentType,\n FC,\n useContext,\n useMemo,\n} from \"react\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { PreContext } from \"./PreOverride\";\nimport {\n CodeComponent,\n CodeHeaderProps,\n PreComponent,\n SyntaxHighlighterProps,\n} from \"./types\";\nimport { DefaultSyntaxHighlighter } from \"./defaultComponents\";\nimport { withDefaultProps } from \"./withDefaults\";\n\ntype CodeOverrideProps = ComponentPropsWithoutRef<CodeComponent> & {\n components: {\n Pre: PreComponent;\n Code: CodeComponent;\n CodeHeader: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter: ComponentType<SyntaxHighlighterProps>;\n };\n};\n\nconst CodeBlockOverride: FC<CodeOverrideProps> = ({\n components: { Pre, Code, SyntaxHighlighter, CodeHeader },\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 components = useMemo(\n () => ({ Pre: WrappedPre, Code: WrappedCode }),\n [WrappedPre, WrappedCode],\n );\n\n const language = /language-(\\w+)/.exec(codeProps.className || \"\")?.[1];\n const code = children as string;\n const SH = language ? SyntaxHighlighter : DefaultSyntaxHighlighter;\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\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 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 { TextContentPartProps } from \"@assistant-ui/react\";\nimport { FC, memo } from \"react\";\nimport { CodeHeader } from \"./code-header\";\nimport classNames from \"classnames\";\nimport {\n MarkdownTextPrimitive,\n MarkdownTextPrimitiveProps,\n} from \"../primitives/MarkdownText\";\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<TextContentPartProps> = ({ status }) => {\n return (\n <div\n className={classNames(\n \"aui-md-root\",\n status.type === \"in_progress\" && \"aui-md-in-progress\",\n className,\n )}\n >\n <MarkdownTextPrimitive components={components} {...rest} />\n </div>\n );\n };\n MarkdownTextImpl.displayName = \"MarkdownText\";\n\n return memo(\n MarkdownTextImpl,\n (prev, next) => prev.status.type === next.status.type,\n );\n};\n","import { FC } from \"react\";\nimport { CheckIcon, CopyIcon } from \"lucide-react\";\nimport { useThreadConfig, INTERNAL } 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;;;ACAA,IAAAA,gBAA6C;AAE7C,4BAA4C;;;ACF5C,mBAAwD;AAS/C;AANF,IAAM,iBAAa,4BAGhB,IAAI;AAEP,IAAM,cAA4B,CAAC,EAAE,UAAU,GAAG,KAAK,MAAM;AAClE,SAAO,4CAAC,WAAW,UAAX,EAAoB,OAAO,MAAO,UAAS;AACrD;;;ACDE,IAAAC,sBAAA;AADK,IAAM,aAA2B,CAAC,EAAE,MAAM,GAAG,KAAK,MACvD,6CAAC,SAAK,GAAG,MAAM;AAEV,IAAM,cAA6B,CAAC,EAAE,MAAM,GAAG,KAAK,MACzD,6CAAC,UAAM,GAAG,MAAM;AAEX,IAAM,2BAET,CAAC,EAAE,YAAY,EAAE,KAAK,KAAK,GAAG,KAAK,MACrC,6CAAC,OACC,uDAAC,QAAM,gBAAK,GACd;AAEK,IAAM,oBAAoD,MAAM;;;AFVvE,IAAAC,iCAA+B;;;AGX/B,IAAAC,gBAMO;AACP,oCAA+B;;;ACP/B,wBAAuB;AAEhB,IAAM,mBACX,CAAoD;AAAA,EAClD;AAAA,EACA,GAAG;AACL,MACA,CAAC,EAAE,WAAW,eAAe,GAAG,MAAM,MAAc;AAClD,SAAO;AAAA,IACL,eAAW,kBAAAC,SAAW,WAAW,aAAa;AAAA,IAC9C,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;;;ADsBE,IAAAC,sBAAA;AARJ,IAAM,oBAA2C,CAAC;AAAA,EAChD,YAAY,EAAE,KAAK,MAAM,mBAAmB,YAAAC,YAAW;AAAA,EACvD;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,eAAW,0BAAW,U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iDAAC,UAAK,WAAU,4BAA4B,oBAAS;AAAA,IACrD,8CAAC,qBAAkB,SAAkB,SAAS,QAC3C;AAAA,OAAC,YAAY,6CAAC,gCAAS;AAAA,MACvB,YAAY,6CAAC,iCAAU;AAAA,OAC1B;AAAA,KACF;AAEJ;;;AD5BA,IAAAC,qBAAuB;AA2Bf,IAAAC,sBAAA;AAnBD,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,mBAA6C,CAAC,EAAE,OAAO,MAAM;AACjE,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW,mBAAAC;AAAA,UACT;AAAA,UACA,OAAO,SAAS,iBAAiB;AAAA,UACjC;AAAA,QACF;AAAA,QAEA,uDAAC,yBAAsB,YAAyB,GAAG,MAAM;AAAA;AAAA,IAC3D;AAAA,EAEJ;AACA,mBAAiB,cAAc;AAE/B,aAAO;AAAA,IACL;AAAA,IACA,CAAC,MAAM,SAAS,KAAK,OAAO,SAAS,KAAK,OAAO;AAAA,EACnD;AACF;","names":["import_react","import_jsx_runtime","import_react_use_callback_ref","import_react","classNames","import_jsx_runtime","CodeHeader","import_jsx_runtime","CodeHeader","ReactMarkdown","import_react","import_react","import_react","import_jsx_runtime","import_classnames","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/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 {\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 type { ComponentType, FC } 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 DefaultSyntaxHighlighter,\n DefaultCodeHeader,\n} from \"../overrides/defaultComponents\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { CodeOverride } from \"../overrides/CodeOverride\";\n\nconst { useSmooth } = INTERNAL;\n\nexport type MarkdownTextPrimitiveProps = Omit<\n Options,\n \"components\" | \"children\"\n> & {\n components?: NonNullable<Options[\"components\"]> & {\n SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps>;\n CodeHeader?: ComponentType<CodeHeaderProps>;\n };\n smooth?: boolean;\n};\nexport const MarkdownTextPrimitive: FC<MarkdownTextPrimitiveProps> = ({\n smooth = true,\n components: userComponents,\n ...rest\n}) => {\n const {\n part: { text },\n } = useContentPartText();\n const smoothText = useSmooth(text, smooth);\n\n const {\n pre = DefaultPre,\n code = DefaultCode,\n SyntaxHighlighter = DefaultSyntaxHighlighter,\n CodeHeader = DefaultCodeHeader,\n ...componentsRest\n } = userComponents ?? {};\n const components: typeof userComponents = {\n ...componentsRest,\n pre: PreOverride,\n code: useCallbackRef((props) => (\n <CodeOverride\n components={{ Pre: pre, Code: code, SyntaxHighlighter, CodeHeader }}\n {...props}\n />\n )),\n };\n\n return (\n <ReactMarkdown components={components} {...rest}>\n {smoothText}\n </ReactMarkdown>\n );\n};\n","import { createContext, ComponentPropsWithoutRef } from \"react\";\nimport { PreComponent } from \"./types\";\n\nexport const PreContext = createContext<Omit<\n ComponentPropsWithoutRef<PreComponent>,\n \"children\"\n> | null>(null);\n\nexport const PreOverride: PreComponent = ({ children, ...rest }) => {\n return <PreContext.Provider value={rest}>{children}</PreContext.Provider>;\n};\n","import type { ComponentType } from \"react\";\nimport {\n PreComponent,\n CodeComponent,\n SyntaxHighlighterProps,\n CodeHeaderProps,\n} from \"./types\";\n\nexport const DefaultPre: PreComponent = ({ node, ...rest }) => (\n <pre {...rest} />\n);\nexport const DefaultCode: CodeComponent = ({ node, ...rest }) => (\n <code {...rest} />\n);\nexport const DefaultSyntaxHighlighter: ComponentType<\n SyntaxHighlighterProps\n> = ({ components: { Pre, Code }, code }) => (\n <Pre>\n <Code>{code}</Code>\n </Pre>\n);\nexport const DefaultCodeHeader: ComponentType<CodeHeaderProps> = () => null;\n","import {\n ComponentPropsWithoutRef,\n ComponentType,\n FC,\n useContext,\n useMemo,\n} from \"react\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { PreContext } from \"./PreOverride\";\nimport {\n CodeComponent,\n CodeHeaderProps,\n PreComponent,\n SyntaxHighlighterProps,\n} from \"./types\";\nimport { DefaultSyntaxHighlighter } from \"./defaultComponents\";\nimport { withDefaultProps } from \"./withDefaults\";\n\ntype CodeOverrideProps = ComponentPropsWithoutRef<CodeComponent> & {\n components: {\n Pre: PreComponent;\n Code: CodeComponent;\n CodeHeader: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter: ComponentType<SyntaxHighlighterProps>;\n };\n};\n\nconst CodeBlockOverride: FC<CodeOverrideProps> = ({\n components: { Pre, Code, SyntaxHighlighter, CodeHeader },\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 components = useMemo(\n () => ({ Pre: WrappedPre, Code: WrappedCode }),\n [WrappedPre, WrappedCode],\n );\n\n const language = /language-(\\w+)/.exec(codeProps.className || \"\")?.[1];\n const code = children as string;\n const SH = language ? SyntaxHighlighter : DefaultSyntaxHighlighter;\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\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 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 { TextContentPartProps } from \"@assistant-ui/react\";\nimport { FC, memo } from \"react\";\nimport { CodeHeader } from \"./code-header\";\nimport classNames from \"classnames\";\nimport {\n MarkdownTextPrimitive,\n MarkdownTextPrimitiveProps,\n} from \"../primitives/MarkdownText\";\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<TextContentPartProps> = ({ status }) => {\n return (\n <div\n className={classNames(\n \"aui-md-root\",\n status.type === \"in_progress\" && \"aui-md-in-progress\",\n className,\n )}\n >\n <MarkdownTextPrimitive components={components} {...rest} />\n </div>\n );\n };\n MarkdownTextImpl.displayName = \"MarkdownText\";\n\n return memo(\n MarkdownTextImpl,\n (prev, next) => prev.status.type === next.status.type,\n );\n};\n","import { FC } from \"react\";\nimport { CheckIcon, CopyIcon } from \"lucide-react\";\nimport { useThreadConfig, INTERNAL } 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;;;ACEA,IAAAA,gBAA6C;AAE7C,4BAA4C;;;ACJ5C,mBAAwD;AAS/C;AANF,IAAM,iBAAa,4BAGhB,IAAI;AAEP,IAAM,cAA4B,CAAC,EAAE,UAAU,GAAG,KAAK,MAAM;AAClE,SAAO,4CAAC,WAAW,UAAX,EAAoB,OAAO,MAAO,UAAS;AACrD;;;ACDE,IAAAC,sBAAA;AADK,IAAM,aAA2B,CAAC,EAAE,MAAM,GAAG,KAAK,MACvD,6CAAC,SAAK,GAAG,MAAM;AAEV,IAAM,cAA6B,C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QACF;AAAA,QAEA,uDAAC,yBAAsB,YAAyB,GAAG,MAAM;AAAA;AAAA,IAC3D;AAAA,EAEJ;AACA,mBAAiB,cAAc;AAE/B,aAAO;AAAA,IACL;AAAA,IACA,CAAC,MAAM,SAAS,KAAK,OAAO,SAAS,KAAK,OAAO;AAAA,EACnD;AACF;","names":["import_react","import_jsx_runtime","import_react_use_callback_ref","import_react","classNames","import_jsx_runtime","CodeHeader","import_jsx_runtime","CodeHeader","ReactMarkdown","import_react","import_react","import_react","import_jsx_runtime","import_classnames","import_jsx_runtime","classNames"]}
|
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/withDefaults.tsx","../src/ui/markdown-text.tsx","../src/ui/code-header.tsx","../src/ui/useCopyToClipboard.tsx"],"sourcesContent":["import { INTERNAL, useContentPartText } from \"@assistant-ui/react\";\nimport type { ComponentType, FC } 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 DefaultSyntaxHighlighter,\n DefaultCodeHeader,\n} from \"../overrides/defaultComponents\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { CodeOverride } from \"../overrides/CodeOverride\";\n\nconst { useSmooth } = INTERNAL;\n\nexport type MarkdownTextPrimitiveProps = Omit<\n Options,\n \"components\" | \"children\"\n> & {\n components?: NonNullable<Options[\"components\"]> & {\n SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps>;\n CodeHeader?: ComponentType<CodeHeaderProps>;\n };\n smooth?: boolean;\n};\nexport const MarkdownTextPrimitive: FC<MarkdownTextPrimitiveProps> = ({\n smooth = true,\n components: userComponents,\n ...rest\n}) => {\n const {\n part: { text },\n } = useContentPartText();\n const smoothText = useSmooth(text, smooth);\n\n const {\n pre = DefaultPre,\n code = DefaultCode,\n SyntaxHighlighter = DefaultSyntaxHighlighter,\n CodeHeader = DefaultCodeHeader,\n ...componentsRest\n } = userComponents ?? {};\n const components: typeof userComponents = {\n ...componentsRest,\n pre: PreOverride,\n code: useCallbackRef((props) => (\n <CodeOverride\n components={{ Pre: pre, Code: code, SyntaxHighlighter, CodeHeader }}\n {...props}\n />\n )),\n };\n\n return (\n <ReactMarkdown components={components} {...rest}>\n {smoothText}\n </ReactMarkdown>\n );\n};\n","import { createContext, ComponentPropsWithoutRef } from \"react\";\nimport { PreComponent } from \"./types\";\n\nexport const PreContext = createContext<Omit<\n ComponentPropsWithoutRef<PreComponent>,\n \"children\"\n> | null>(null);\n\nexport const PreOverride: PreComponent = ({ children, ...rest }) => {\n return <PreContext.Provider value={rest}>{children}</PreContext.Provider>;\n};\n","import type { ComponentType } from \"react\";\nimport {\n PreComponent,\n CodeComponent,\n SyntaxHighlighterProps,\n CodeHeaderProps,\n} from \"./types\";\n\nexport const DefaultPre: PreComponent = ({ node, ...rest }) => (\n <pre {...rest} />\n);\nexport const DefaultCode: CodeComponent = ({ node, ...rest }) => (\n <code {...rest} />\n);\nexport const DefaultSyntaxHighlighter: ComponentType<\n SyntaxHighlighterProps\n> = ({ components: { Pre, Code }, code }) => (\n <Pre>\n <Code>{code}</Code>\n </Pre>\n);\nexport const DefaultCodeHeader: ComponentType<CodeHeaderProps> = () => null;\n","import {\n ComponentPropsWithoutRef,\n ComponentType,\n FC,\n useContext,\n useMemo,\n} from \"react\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { PreContext } from \"./PreOverride\";\nimport {\n CodeComponent,\n CodeHeaderProps,\n PreComponent,\n SyntaxHighlighterProps,\n} from \"./types\";\nimport { DefaultSyntaxHighlighter } from \"./defaultComponents\";\nimport { withDefaultProps } from \"./withDefaults\";\n\ntype CodeOverrideProps = ComponentPropsWithoutRef<CodeComponent> & {\n components: {\n Pre: PreComponent;\n Code: CodeComponent;\n CodeHeader: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter: ComponentType<SyntaxHighlighterProps>;\n };\n};\n\nconst CodeBlockOverride: FC<CodeOverrideProps> = ({\n components: { Pre, Code, SyntaxHighlighter, CodeHeader },\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 components = useMemo(\n () => ({ Pre: WrappedPre, Code: WrappedCode }),\n [WrappedPre, WrappedCode],\n );\n\n const language = /language-(\\w+)/.exec(codeProps.className || \"\")?.[1];\n const code = children as string;\n const SH = language ? SyntaxHighlighter : DefaultSyntaxHighlighter;\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\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 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 { TextContentPartProps } from \"@assistant-ui/react\";\nimport { FC, memo } from \"react\";\nimport { CodeHeader } from \"./code-header\";\nimport classNames from \"classnames\";\nimport {\n MarkdownTextPrimitive,\n MarkdownTextPrimitiveProps,\n} from \"../primitives/MarkdownText\";\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<TextContentPartProps> = ({ status }) => {\n return (\n <div\n className={classNames(\n \"aui-md-root\",\n status.type === \"in_progress\" && \"aui-md-in-progress\",\n className,\n )}\n >\n <MarkdownTextPrimitive components={components} {...rest} />\n </div>\n );\n };\n MarkdownTextImpl.displayName = \"MarkdownText\";\n\n return memo(\n MarkdownTextImpl,\n (prev, next) => prev.status.type === next.status.type,\n );\n};\n","import { FC } from \"react\";\nimport { CheckIcon, CopyIcon } from \"lucide-react\";\nimport { useThreadConfig, INTERNAL } 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), copiedDu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D,KAAC,UAAK,WAAU,4BAA4B,oBAAS;AAAA,IACrD,gBAAAC,MAAC,qBAAkB,SAAkB,SAAS,QAC3C;AAAA,OAAC,YAAY,gBAAAD,KAAC,YAAS;AAAA,MACvB,YAAY,gBAAAA,KAAC,aAAU;AAAA,OAC1B;AAAA,KACF;AAEJ;;;AD5BA,OAAOG,iBAAgB;AA2Bf,gBAAAC,YAAA;AAnBD,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,mBAA6C,CAAC,EAAE,OAAO,MAAM;AACjE,WACE,gBAAAA;AAAA,MAAC;AAAA;AAAA,QACC,WAAWC;AAAA,UACT;AAAA,UACA,OAAO,SAAS,iBAAiB;AAAA,UACjC;AAAA,QACF;AAAA,QAEA,0BAAAD,KAAC,yBAAsB,YAAyB,GAAG,MAAM;AAAA;AAAA,IAC3D;AAAA,EAEJ;AACA,mBAAiB,cAAc;AAE/B,SAAO;AAAA,IACL;AAAA,IACA,CAAC,MAAM,SAAS,KAAK,OAAO,SAAS,KAAK,OAAO;AAAA,EACnD;AACF;","names":["jsx","useCallbackRef","jsx","CodeHeader","jsx","CodeHeader","useCallbackRef","INTERNAL","jsx","jsxs","INTERNAL","classNames","jsx","classNames"]}
|
|
1
|
+
{"version":3,"sources":["../src/primitives/MarkdownText.tsx","../src/overrides/PreOverride.tsx","../src/overrides/defaultComponents.tsx","../src/overrides/CodeOverride.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 type { ComponentType, FC } 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 DefaultSyntaxHighlighter,\n DefaultCodeHeader,\n} from \"../overrides/defaultComponents\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { CodeOverride } from \"../overrides/CodeOverride\";\n\nconst { useSmooth } = INTERNAL;\n\nexport type MarkdownTextPrimitiveProps = Omit<\n Options,\n \"components\" | \"children\"\n> & {\n components?: NonNullable<Options[\"components\"]> & {\n SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps>;\n CodeHeader?: ComponentType<CodeHeaderProps>;\n };\n smooth?: boolean;\n};\nexport const MarkdownTextPrimitive: FC<MarkdownTextPrimitiveProps> = ({\n smooth = true,\n components: userComponents,\n ...rest\n}) => {\n const {\n part: { text },\n } = useContentPartText();\n const smoothText = useSmooth(text, smooth);\n\n const {\n pre = DefaultPre,\n code = DefaultCode,\n SyntaxHighlighter = DefaultSyntaxHighlighter,\n CodeHeader = DefaultCodeHeader,\n ...componentsRest\n } = userComponents ?? {};\n const components: typeof userComponents = {\n ...componentsRest,\n pre: PreOverride,\n code: useCallbackRef((props) => (\n <CodeOverride\n components={{ Pre: pre, Code: code, SyntaxHighlighter, CodeHeader }}\n {...props}\n />\n )),\n };\n\n return (\n <ReactMarkdown components={components} {...rest}>\n {smoothText}\n </ReactMarkdown>\n );\n};\n","import { createContext, ComponentPropsWithoutRef } from \"react\";\nimport { PreComponent } from \"./types\";\n\nexport const PreContext = createContext<Omit<\n ComponentPropsWithoutRef<PreComponent>,\n \"children\"\n> | null>(null);\n\nexport const PreOverride: PreComponent = ({ children, ...rest }) => {\n return <PreContext.Provider value={rest}>{children}</PreContext.Provider>;\n};\n","import type { ComponentType } from \"react\";\nimport {\n PreComponent,\n CodeComponent,\n SyntaxHighlighterProps,\n CodeHeaderProps,\n} from \"./types\";\n\nexport const DefaultPre: PreComponent = ({ node, ...rest }) => (\n <pre {...rest} />\n);\nexport const DefaultCode: CodeComponent = ({ node, ...rest }) => (\n <code {...rest} />\n);\nexport const DefaultSyntaxHighlighter: ComponentType<\n SyntaxHighlighterProps\n> = ({ components: { Pre, Code }, code }) => (\n <Pre>\n <Code>{code}</Code>\n </Pre>\n);\nexport const DefaultCodeHeader: ComponentType<CodeHeaderProps> = () => null;\n","import {\n ComponentPropsWithoutRef,\n ComponentType,\n FC,\n useContext,\n useMemo,\n} from \"react\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { PreContext } from \"./PreOverride\";\nimport {\n CodeComponent,\n CodeHeaderProps,\n PreComponent,\n SyntaxHighlighterProps,\n} from \"./types\";\nimport { DefaultSyntaxHighlighter } from \"./defaultComponents\";\nimport { withDefaultProps } from \"./withDefaults\";\n\ntype CodeOverrideProps = ComponentPropsWithoutRef<CodeComponent> & {\n components: {\n Pre: PreComponent;\n Code: CodeComponent;\n CodeHeader: ComponentType<CodeHeaderProps>;\n SyntaxHighlighter: ComponentType<SyntaxHighlighterProps>;\n };\n};\n\nconst CodeBlockOverride: FC<CodeOverrideProps> = ({\n components: { Pre, Code, SyntaxHighlighter, CodeHeader },\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 components = useMemo(\n () => ({ Pre: WrappedPre, Code: WrappedCode }),\n [WrappedPre, WrappedCode],\n );\n\n const language = /language-(\\w+)/.exec(codeProps.className || \"\")?.[1];\n const code = children as string;\n const SH = language ? SyntaxHighlighter : DefaultSyntaxHighlighter;\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\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 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 { TextContentPartProps } from \"@assistant-ui/react\";\nimport { FC, memo } from \"react\";\nimport { CodeHeader } from \"./code-header\";\nimport classNames from \"classnames\";\nimport {\n MarkdownTextPrimitive,\n MarkdownTextPrimitiveProps,\n} from \"../primitives/MarkdownText\";\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<TextContentPartProps> = ({ status }) => {\n return (\n <div\n className={classNames(\n \"aui-md-root\",\n status.type === \"in_progress\" && \"aui-md-in-progress\",\n className,\n )}\n >\n <MarkdownTextPrimitive components={components} {...rest} />\n </div>\n );\n };\n MarkdownTextImpl.displayName = \"MarkdownText\";\n\n return memo(\n MarkdownTextImpl,\n (prev, next) => prev.status.type === next.status.type,\n );\n};\n","import { FC } from \"react\";\nimport { CheckIcon, CopyIcon } from \"lucide-react\";\nimport { useThreadConfig, INTERNAL } 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;AAE7C,OAAO,mBAAqC;;;ACJ5C,SAAS,qBAA+C;AAS/C;AANF,IAAM,aAAa,cAGhB,IAAI;AAEP,IAAM,cAA4B,CAAC,EAAE,UAAU,GAAG,KAAK,MAAM;AAClE,SAAO,oBAAC,WAAW,UAAX,EAAoB,OAAO,MAAO,UAAS;AACrD;;;ACDE,gBAAAA,YAAA;AADK,IAAM,aAA2B,CAAC,EAAE,MAAM,GAAG,KAAK,MACvD,gBAAAA,KAAC,SAAK,GAAG,MAAM;AAEV,IAAM,cAA6B,CAAC,EAAE,MAAM,GAAG,KAAK,MACzD,gBAAAA,KAAC,UAAM,GAAG,MAAM;AAEX,IAAM,2BAET,CAAC,EAAE,YAAY,EAAE,KAAK,KAAK,GAAG,KAAK,MACrC,gBAAAA,KAAC,OACC,0BAAAA,KAAC,QAAM,gBAAK,GACd;AAEK,IAAM,oBAAoD,MAAM;;;AFRvE,SAAS,kBAAAC,uBAAsB;;;AGb/B;AAAA,EAIE;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAA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,IACL;AAAA,IACA,CAAC,MAAM,SAAS,KAAK,OAAO,SAAS,KAAK,OAAO;AAAA,EACnD;AACF;","names":["jsx","useCallbackRef","jsx","CodeHeader","jsx","CodeHeader","useCallbackRef","INTERNAL","jsx","jsxs","INTERNAL","classNames","jsx","classNames"]}
|
package/dist/styles/markdown.css
CHANGED
|
@@ -1,72 +1,274 @@
|
|
|
1
1
|
/* src/styles/tailwindcss/markdown.css */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
.aui-md-in-progress > :is(ol, ul):last-child > li:last-child > :is(ol, ul):last-child > li:last-child:not(:has(* > li))::after,
|
|
7
|
-
.aui-md-in-progress > :is(ol, ul):last-child > li:last-child > :is(ol, ul):last-child > li:last-child > :is(ol, ul):last-child > li:last-child::after {
|
|
8
|
-
@apply animate-pulse font-sans content-["\25cf"] ltr:ml-1 rtl:mr-1;
|
|
2
|
+
@keyframes aui-pulse {
|
|
3
|
+
50% {
|
|
4
|
+
opacity: .5;
|
|
5
|
+
}
|
|
9
6
|
}
|
|
10
|
-
.aui-md-
|
|
11
|
-
|
|
7
|
+
.aui-md-in-progress:where(:empty)::after,
|
|
8
|
+
.aui-md-in-progress:where(> :not(ol):not(ul):not(pre):last-child)::after,
|
|
9
|
+
.aui-md-in-progress:where(> pre:last-child code)::after,
|
|
10
|
+
.aui-md-in-progress:where(> :is(ol, ul):last-child > li:last-child:not(:has(* > li)))::after,
|
|
11
|
+
.aui-md-in-progress:where(> :is(ol, ul):last-child > li:last-child > :is(ol, ul):last-child > li:last-child:not(:has(* > li)))::after,
|
|
12
|
+
.aui-md-in-progress:where(> :is(ol, ul):last-child > li:last-child > :is(ol, ul):last-child > li:last-child > :is(ol, ul):last-child > li:last-child)::after {
|
|
13
|
+
animation: aui-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
|
14
|
+
font-family:
|
|
15
|
+
ui-sans-serif,
|
|
16
|
+
system-ui,
|
|
17
|
+
sans-serif,
|
|
18
|
+
"Apple Color Emoji",
|
|
19
|
+
"Segoe UI Emoji",
|
|
20
|
+
"Segoe UI Symbol",
|
|
21
|
+
"Noto Color Emoji";
|
|
22
|
+
--aui-content: "\25cf";
|
|
23
|
+
content: var(--aui-content);
|
|
12
24
|
}
|
|
13
|
-
.aui-md-
|
|
14
|
-
|
|
25
|
+
.aui-md-in-progress:where(:empty):where([dir=ltr], [dir=ltr] *)::after,
|
|
26
|
+
.aui-md-in-progress:where(> :not(ol):not(ul):not(pre):last-child):where([dir=ltr], [dir=ltr] *)::after,
|
|
27
|
+
.aui-md-in-progress:where(> pre:last-child code):where([dir=ltr], [dir=ltr] *)::after,
|
|
28
|
+
.aui-md-in-progress:where(> :is(ol, ul):last-child > li:last-child:not(:has(* > li))):where([dir=ltr], [dir=ltr] *)::after,
|
|
29
|
+
.aui-md-in-progress:where(> :is(ol, ul):last-child > li:last-child > :is(ol, ul):last-child > li:last-child:not(:has(* > li))):where([dir=ltr], [dir=ltr] *)::after,
|
|
30
|
+
.aui-md-in-progress:where(> :is(ol, ul):last-child > li:last-child > :is(ol, ul):last-child > li:last-child > :is(ol, ul):last-child > li:last-child):where([dir=ltr], [dir=ltr] *)::after {
|
|
31
|
+
margin-left: 0.25rem;
|
|
15
32
|
}
|
|
16
|
-
.aui-md-
|
|
17
|
-
|
|
33
|
+
.aui-md-in-progress:where(:empty):where([dir=rtl], [dir=rtl] *)::after,
|
|
34
|
+
.aui-md-in-progress:where(> :not(ol):not(ul):not(pre):last-child):where([dir=rtl], [dir=rtl] *)::after,
|
|
35
|
+
.aui-md-in-progress:where(> pre:last-child code):where([dir=rtl], [dir=rtl] *)::after,
|
|
36
|
+
.aui-md-in-progress:where(> :is(ol, ul):last-child > li:last-child:not(:has(* > li))):where([dir=rtl], [dir=rtl] *)::after,
|
|
37
|
+
.aui-md-in-progress:where(> :is(ol, ul):last-child > li:last-child > :is(ol, ul):last-child > li:last-child:not(:has(* > li))):where([dir=rtl], [dir=rtl] *)::after,
|
|
38
|
+
.aui-md-in-progress:where(> :is(ol, ul):last-child > li:last-child > :is(ol, ul):last-child > li:last-child > :is(ol, ul):last-child > li:last-child):where([dir=rtl], [dir=rtl] *)::after {
|
|
39
|
+
margin-right: 0.25rem;
|
|
18
40
|
}
|
|
19
|
-
.aui-md-root
|
|
20
|
-
|
|
41
|
+
:where(.aui-md-root) h1 {
|
|
42
|
+
margin-bottom: 2rem;
|
|
43
|
+
scroll-margin: 5rem;
|
|
44
|
+
font-size: 2.25rem;
|
|
45
|
+
line-height: 2.5rem;
|
|
46
|
+
font-weight: 800;
|
|
47
|
+
letter-spacing: -0.025em;
|
|
21
48
|
}
|
|
22
|
-
.aui-md-root
|
|
23
|
-
|
|
49
|
+
:where(.aui-md-root) h1:last-child {
|
|
50
|
+
margin-bottom: 0px;
|
|
24
51
|
}
|
|
25
|
-
.aui-md-root
|
|
26
|
-
|
|
52
|
+
:where(.aui-md-root) h2 {
|
|
53
|
+
margin-bottom: 1rem;
|
|
54
|
+
margin-top: 2rem;
|
|
55
|
+
scroll-margin: 5rem;
|
|
56
|
+
font-size: 1.875rem;
|
|
57
|
+
line-height: 2.25rem;
|
|
58
|
+
font-weight: 600;
|
|
59
|
+
letter-spacing: -0.025em;
|
|
27
60
|
}
|
|
28
|
-
.aui-md-root
|
|
29
|
-
|
|
61
|
+
:where(.aui-md-root) h2:first-child {
|
|
62
|
+
margin-top: 0px;
|
|
30
63
|
}
|
|
31
|
-
.aui-md-root
|
|
32
|
-
|
|
64
|
+
:where(.aui-md-root) h2:last-child {
|
|
65
|
+
margin-bottom: 0px;
|
|
33
66
|
}
|
|
34
|
-
.aui-md-root
|
|
35
|
-
|
|
67
|
+
:where(.aui-md-root) h3 {
|
|
68
|
+
margin-bottom: 1rem;
|
|
69
|
+
margin-top: 1.5rem;
|
|
70
|
+
scroll-margin: 5rem;
|
|
71
|
+
font-size: 1.5rem;
|
|
72
|
+
line-height: 2rem;
|
|
73
|
+
font-weight: 600;
|
|
74
|
+
letter-spacing: -0.025em;
|
|
36
75
|
}
|
|
37
|
-
.aui-md-root
|
|
38
|
-
|
|
76
|
+
:where(.aui-md-root) h3:first-child {
|
|
77
|
+
margin-top: 0px;
|
|
39
78
|
}
|
|
40
|
-
.aui-md-root
|
|
41
|
-
|
|
79
|
+
:where(.aui-md-root) h3:last-child {
|
|
80
|
+
margin-bottom: 0px;
|
|
42
81
|
}
|
|
43
|
-
.aui-md-root
|
|
44
|
-
|
|
82
|
+
:where(.aui-md-root) h4 {
|
|
83
|
+
margin-bottom: 1rem;
|
|
84
|
+
margin-top: 1.5rem;
|
|
85
|
+
scroll-margin: 5rem;
|
|
86
|
+
font-size: 1.25rem;
|
|
87
|
+
line-height: 1.75rem;
|
|
88
|
+
font-weight: 600;
|
|
89
|
+
letter-spacing: -0.025em;
|
|
45
90
|
}
|
|
46
|
-
.aui-md-root
|
|
47
|
-
|
|
91
|
+
:where(.aui-md-root) h4:first-child {
|
|
92
|
+
margin-top: 0px;
|
|
48
93
|
}
|
|
49
|
-
.aui-md-root
|
|
50
|
-
|
|
94
|
+
:where(.aui-md-root) h4:last-child {
|
|
95
|
+
margin-bottom: 0px;
|
|
51
96
|
}
|
|
52
|
-
.aui-md-root
|
|
53
|
-
|
|
97
|
+
:where(.aui-md-root) h5 {
|
|
98
|
+
margin-top: 1rem;
|
|
99
|
+
margin-bottom: 1rem;
|
|
100
|
+
font-size: 1.125rem;
|
|
101
|
+
line-height: 1.75rem;
|
|
102
|
+
font-weight: 600;
|
|
54
103
|
}
|
|
55
|
-
.aui-md-root
|
|
56
|
-
|
|
104
|
+
:where(.aui-md-root) h5:first-child {
|
|
105
|
+
margin-top: 0px;
|
|
57
106
|
}
|
|
58
|
-
.aui-md-root
|
|
59
|
-
|
|
107
|
+
:where(.aui-md-root) h5:last-child {
|
|
108
|
+
margin-bottom: 0px;
|
|
60
109
|
}
|
|
61
|
-
.aui-md-root
|
|
62
|
-
|
|
110
|
+
:where(.aui-md-root) h6 {
|
|
111
|
+
margin-top: 1rem;
|
|
112
|
+
margin-bottom: 1rem;
|
|
113
|
+
font-weight: 600;
|
|
63
114
|
}
|
|
64
|
-
.aui-md-root :
|
|
65
|
-
|
|
115
|
+
:where(.aui-md-root) h6:first-child {
|
|
116
|
+
margin-top: 0px;
|
|
117
|
+
}
|
|
118
|
+
:where(.aui-md-root) h6:last-child {
|
|
119
|
+
margin-bottom: 0px;
|
|
120
|
+
}
|
|
121
|
+
:where(.aui-md-root) p {
|
|
122
|
+
margin-bottom: 1.25rem;
|
|
123
|
+
margin-top: 1.25rem;
|
|
124
|
+
line-height: 1.75rem;
|
|
125
|
+
}
|
|
126
|
+
:where(.aui-md-root) p:first-child {
|
|
127
|
+
margin-top: 0px;
|
|
128
|
+
}
|
|
129
|
+
:where(.aui-md-root) p:last-child {
|
|
130
|
+
margin-bottom: 0px;
|
|
131
|
+
}
|
|
132
|
+
:where(.aui-md-root) a {
|
|
133
|
+
font-weight: 500;
|
|
134
|
+
color: hsl(var(--aui-primary));
|
|
135
|
+
text-decoration-line: underline;
|
|
136
|
+
text-underline-offset: 4px;
|
|
137
|
+
}
|
|
138
|
+
:where(.aui-md-root) blockquote {
|
|
139
|
+
border-left-width: 2px;
|
|
140
|
+
padding-left: 1.5rem;
|
|
141
|
+
font-style: italic;
|
|
142
|
+
}
|
|
143
|
+
:where(.aui-md-root) ul {
|
|
144
|
+
margin-top: 1.25rem;
|
|
145
|
+
margin-bottom: 1.25rem;
|
|
146
|
+
margin-left: 1.5rem;
|
|
147
|
+
list-style-type: disc;
|
|
148
|
+
}
|
|
149
|
+
:where(.aui-md-root) ul > li {
|
|
150
|
+
margin-top: 0.5rem;
|
|
151
|
+
}
|
|
152
|
+
:where(.aui-md-root) ol {
|
|
153
|
+
margin-top: 1.25rem;
|
|
154
|
+
margin-bottom: 1.25rem;
|
|
155
|
+
margin-left: 1.5rem;
|
|
156
|
+
list-style-type: decimal;
|
|
157
|
+
}
|
|
158
|
+
:where(.aui-md-root) ol > li {
|
|
159
|
+
margin-top: 0.5rem;
|
|
160
|
+
}
|
|
161
|
+
:where(.aui-md-root) hr {
|
|
162
|
+
margin-top: 1.25rem;
|
|
163
|
+
margin-bottom: 1.25rem;
|
|
164
|
+
border-bottom-width: 1px;
|
|
165
|
+
}
|
|
166
|
+
:where(.aui-md-root) table {
|
|
167
|
+
margin-top: 1.25rem;
|
|
168
|
+
margin-bottom: 1.25rem;
|
|
169
|
+
width: 100%;
|
|
170
|
+
border-collapse: separate;
|
|
171
|
+
--aui-border-spacing-x: 0px;
|
|
172
|
+
--aui-border-spacing-y: 0px;
|
|
173
|
+
border-spacing: var(--aui-border-spacing-x) var(--aui-border-spacing-y);
|
|
174
|
+
overflow-y: auto;
|
|
175
|
+
}
|
|
176
|
+
:where(.aui-md-root) th {
|
|
177
|
+
background-color: hsl(var(--aui-muted));
|
|
178
|
+
padding-left: 1rem;
|
|
179
|
+
padding-right: 1rem;
|
|
180
|
+
padding-top: 0.5rem;
|
|
181
|
+
padding-bottom: 0.5rem;
|
|
182
|
+
text-align: left;
|
|
183
|
+
font-weight: 700;
|
|
184
|
+
}
|
|
185
|
+
:where(.aui-md-root) th:first-child {
|
|
186
|
+
border-top-left-radius: var(--aui-radius);
|
|
187
|
+
}
|
|
188
|
+
:where(.aui-md-root) th:last-child {
|
|
189
|
+
border-top-right-radius: var(--aui-radius);
|
|
190
|
+
}
|
|
191
|
+
:where(.aui-md-root) th[align=center] {
|
|
192
|
+
text-align: center;
|
|
193
|
+
}
|
|
194
|
+
:where(.aui-md-root) th[align=right] {
|
|
195
|
+
text-align: right;
|
|
196
|
+
}
|
|
197
|
+
:where(.aui-md-root) td {
|
|
198
|
+
border-bottom-width: 1px;
|
|
199
|
+
border-left-width: 1px;
|
|
200
|
+
padding-left: 1rem;
|
|
201
|
+
padding-right: 1rem;
|
|
202
|
+
padding-top: 0.5rem;
|
|
203
|
+
padding-bottom: 0.5rem;
|
|
204
|
+
text-align: left;
|
|
205
|
+
}
|
|
206
|
+
:where(.aui-md-root) td:last-child {
|
|
207
|
+
border-right-width: 1px;
|
|
208
|
+
}
|
|
209
|
+
:where(.aui-md-root) td[align=center] {
|
|
210
|
+
text-align: center;
|
|
211
|
+
}
|
|
212
|
+
:where(.aui-md-root) td[align=right] {
|
|
213
|
+
text-align: right;
|
|
214
|
+
}
|
|
215
|
+
:where(.aui-md-root) tr {
|
|
216
|
+
margin: 0px;
|
|
217
|
+
border-bottom-width: 1px;
|
|
218
|
+
padding: 0px;
|
|
219
|
+
}
|
|
220
|
+
:where(.aui-md-root) tr:first-child {
|
|
221
|
+
border-top-width: 1px;
|
|
222
|
+
}
|
|
223
|
+
:where(.aui-md-root) tr:last-child > td:first-child {
|
|
224
|
+
border-bottom-left-radius: var(--aui-radius);
|
|
225
|
+
}
|
|
226
|
+
:where(.aui-md-root) tr:last-child > td:last-child {
|
|
227
|
+
border-bottom-right-radius: var(--aui-radius);
|
|
228
|
+
}
|
|
229
|
+
:where(.aui-md-root) sup > a {
|
|
230
|
+
font-size: 0.75rem;
|
|
231
|
+
line-height: 1rem;
|
|
232
|
+
text-decoration-line: none;
|
|
233
|
+
}
|
|
234
|
+
:where(.aui-md-root) pre {
|
|
235
|
+
overflow-x: auto;
|
|
236
|
+
border-bottom-right-radius: var(--aui-radius);
|
|
237
|
+
border-bottom-left-radius: var(--aui-radius);
|
|
238
|
+
background-color: #000;
|
|
239
|
+
padding: 1rem;
|
|
240
|
+
--aui-text-opacity: 1;
|
|
241
|
+
color: rgb(255 255 255 / var(--aui-text-opacity));
|
|
242
|
+
}
|
|
243
|
+
:where(.aui-md-root) > code,
|
|
244
|
+
:where(.aui-md-root) :not(:where(pre)) code {
|
|
245
|
+
border-radius: 0.25rem;
|
|
246
|
+
border-width: 1px;
|
|
247
|
+
background-color: hsl(var(--aui-muted));
|
|
248
|
+
font-weight: 600;
|
|
66
249
|
}
|
|
67
250
|
.aui-code-header-root {
|
|
68
|
-
|
|
251
|
+
display: flex;
|
|
252
|
+
align-items: center;
|
|
253
|
+
justify-content: space-between;
|
|
254
|
+
gap: 1rem;
|
|
255
|
+
border-top-left-radius: var(--aui-radius);
|
|
256
|
+
border-top-right-radius: var(--aui-radius);
|
|
257
|
+
background-color: #18181b;
|
|
258
|
+
padding-left: 1rem;
|
|
259
|
+
padding-right: 1rem;
|
|
260
|
+
padding-top: 0.5rem;
|
|
261
|
+
padding-bottom: 0.5rem;
|
|
262
|
+
font-size: 0.875rem;
|
|
263
|
+
line-height: 1.25rem;
|
|
264
|
+
font-weight: 600;
|
|
265
|
+
--aui-text-opacity: 1;
|
|
266
|
+
color: rgb(255 255 255 / var(--aui-text-opacity));
|
|
69
267
|
}
|
|
70
268
|
.aui-code-header-language {
|
|
71
|
-
|
|
269
|
+
text-transform: lowercase;
|
|
270
|
+
}
|
|
271
|
+
.aui-code-header-language > span {
|
|
272
|
+
font-size: 0.75rem;
|
|
273
|
+
line-height: 1rem;
|
|
72
274
|
}
|
|
@@ -1,100 +1,103 @@
|
|
|
1
1
|
/* in progress indicator */
|
|
2
|
-
.aui-md-in-progress:empty::after,
|
|
3
|
-
.aui-md-in-progress
|
|
4
|
-
.aui-md-in-progress
|
|
5
|
-
.aui-md-in-progress
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
.aui-md-in-progress
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
.aui-md-in-progress:where(:empty)::after,
|
|
3
|
+
.aui-md-in-progress:where(> :not(ol):not(ul):not(pre):last-child)::after,
|
|
4
|
+
.aui-md-in-progress:where(> pre:last-child code)::after,
|
|
5
|
+
.aui-md-in-progress:where(
|
|
6
|
+
> :is(ol, ul):last-child > li:last-child:not(:has(* > li))
|
|
7
|
+
)::after,
|
|
8
|
+
.aui-md-in-progress:where(
|
|
9
|
+
> :is(ol, ul):last-child
|
|
10
|
+
> li:last-child
|
|
11
|
+
> :is(ol, ul):last-child
|
|
12
|
+
> li:last-child:not(:has(* > li))
|
|
13
|
+
)::after,
|
|
14
|
+
.aui-md-in-progress:where(
|
|
15
|
+
> :is(ol, ul):last-child
|
|
16
|
+
> li:last-child
|
|
17
|
+
> :is(ol, ul):last-child
|
|
18
|
+
> li:last-child
|
|
19
|
+
> :is(ol, ul):last-child
|
|
20
|
+
> li:last-child
|
|
21
|
+
)::after {
|
|
20
22
|
@apply animate-pulse font-sans content-['\25CF'] ltr:ml-1 rtl:mr-1;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
/* typography */
|
|
24
26
|
|
|
25
|
-
.aui-md-root h1 {
|
|
27
|
+
:where(.aui-md-root) h1 {
|
|
26
28
|
@apply mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0;
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
.aui-md-root h2 {
|
|
31
|
+
:where(.aui-md-root) h2 {
|
|
30
32
|
@apply mb-4 mt-8 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
.aui-md-root h3 {
|
|
35
|
+
:where(.aui-md-root) h3 {
|
|
34
36
|
@apply mb-4 mt-6 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
.aui-md-root h4 {
|
|
39
|
+
:where(.aui-md-root) h4 {
|
|
38
40
|
@apply mb-4 mt-6 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
.aui-md-root h5 {
|
|
43
|
+
:where(.aui-md-root) h5 {
|
|
42
44
|
@apply my-4 text-lg font-semibold first:mt-0 last:mb-0;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
.aui-md-root h6 {
|
|
47
|
+
:where(.aui-md-root) h6 {
|
|
46
48
|
@apply my-4 font-semibold first:mt-0 last:mb-0;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
.aui-md-root p {
|
|
51
|
+
:where(.aui-md-root) p {
|
|
50
52
|
@apply mb-5 mt-5 leading-7 first:mt-0 last:mb-0;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
.aui-md-root a {
|
|
55
|
+
:where(.aui-md-root) a {
|
|
54
56
|
@apply text-aui-primary font-medium underline underline-offset-4;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
.aui-md-root blockquote {
|
|
59
|
+
:where(.aui-md-root) blockquote {
|
|
58
60
|
@apply border-l-2 pl-6 italic;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
.aui-md-root ul {
|
|
63
|
+
:where(.aui-md-root) ul {
|
|
62
64
|
@apply my-5 ml-6 list-disc [&>li]:mt-2;
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
.aui-md-root ol {
|
|
67
|
+
:where(.aui-md-root) ol {
|
|
66
68
|
@apply my-5 ml-6 list-decimal [&>li]:mt-2;
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
.aui-md-root hr {
|
|
71
|
+
:where(.aui-md-root) hr {
|
|
70
72
|
@apply my-5 border-b;
|
|
71
73
|
}
|
|
72
74
|
|
|
73
|
-
.aui-md-root table {
|
|
75
|
+
:where(.aui-md-root) table {
|
|
74
76
|
@apply my-5 w-full border-separate border-spacing-0 overflow-y-auto;
|
|
75
77
|
}
|
|
76
78
|
|
|
77
|
-
.aui-md-root th {
|
|
79
|
+
:where(.aui-md-root) th {
|
|
78
80
|
@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;
|
|
79
81
|
}
|
|
80
82
|
|
|
81
|
-
.aui-md-root td {
|
|
83
|
+
:where(.aui-md-root) td {
|
|
82
84
|
@apply border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right;
|
|
83
85
|
}
|
|
84
86
|
|
|
85
|
-
.aui-md-root tr {
|
|
87
|
+
:where(.aui-md-root) tr {
|
|
86
88
|
@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;
|
|
87
89
|
}
|
|
88
90
|
|
|
89
|
-
.aui-md-root sup {
|
|
91
|
+
:where(.aui-md-root) sup {
|
|
90
92
|
@apply [&>a]:text-xs [&>a]:no-underline;
|
|
91
93
|
}
|
|
92
94
|
|
|
93
|
-
.aui-md-root pre {
|
|
95
|
+
:where(.aui-md-root) pre {
|
|
94
96
|
@apply overflow-x-auto rounded-b-lg bg-black p-4 text-white;
|
|
95
97
|
}
|
|
96
98
|
|
|
97
|
-
.aui-md-root
|
|
99
|
+
:where(.aui-md-root) > code,
|
|
100
|
+
:where(.aui-md-root) :not(:where(pre)) code {
|
|
98
101
|
@apply bg-aui-muted rounded border font-semibold;
|
|
99
102
|
}
|
|
100
103
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assistant-ui/react-markdown",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"react-markdown": "^9.0.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@assistant-ui/react": "^0.4.
|
|
46
|
+
"@assistant-ui/react": "^0.4.6",
|
|
47
47
|
"@types/react": "*",
|
|
48
48
|
"react": "^18",
|
|
49
49
|
"tailwindcss": "^3.4.4"
|
|
@@ -57,10 +57,15 @@
|
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
+
"@types/node": "^20.14.10",
|
|
61
|
+
"autoprefixer": "^10.4.19",
|
|
60
62
|
"eslint-config-next": "14.2.5",
|
|
63
|
+
"postcss": "^8.4.39",
|
|
61
64
|
"tailwindcss": "^3.4.4",
|
|
65
|
+
"tailwindcss-animate": "^1.0.7",
|
|
62
66
|
"tsup": "^8.1.0",
|
|
63
67
|
"tsx": "^4.16.2",
|
|
68
|
+
"@assistant-ui/tailwindcss-transformer": "^0.1.0",
|
|
64
69
|
"@assistant-ui/tsconfig": "0.0.0"
|
|
65
70
|
},
|
|
66
71
|
"publishConfig": {
|