@assistant-ui/react-markdown
Advanced tools
+2
-1
| import { FC } from 'react'; | ||
| import { Options } from 'react-markdown'; | ||
| declare const MarkdownTextPrimitive: FC<Omit<Options, "children">>; | ||
| type MarkdownTextPrimitiveProps = Omit<Options, "children">; | ||
| declare const MarkdownTextPrimitive: FC<MarkdownTextPrimitiveProps>; | ||
| export { MarkdownTextPrimitive }; |
+2
-1
| import { FC } from 'react'; | ||
| import { Options } from 'react-markdown'; | ||
| declare const MarkdownTextPrimitive: FC<Omit<Options, "children">>; | ||
| type MarkdownTextPrimitiveProps = Omit<Options, "children">; | ||
| declare const MarkdownTextPrimitive: FC<MarkdownTextPrimitiveProps>; | ||
| export { MarkdownTextPrimitive }; |
+2
-6
@@ -39,7 +39,6 @@ "use strict"; | ||
| var import_react = require("@assistant-ui/react"); | ||
| var import_react2 = require("@assistant-ui/react"); | ||
| var import_react_markdown = __toESM(require("react-markdown")); | ||
| var import_jsx_runtime = require("react/jsx-runtime"); | ||
| var MarkdownTextPrimitive = (options) => { | ||
| const { useContentPart } = (0, import_react2.useContentPartContext)(); | ||
| const { useContentPart } = (0, import_react.useContentPartContext)(); | ||
| const text = useContentPart((c) => { | ||
@@ -52,6 +51,3 @@ if (c.part.type !== "text") | ||
| }); | ||
| return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ | ||
| /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_markdown.default, { ...options, children: text }), | ||
| /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.ContentPartPrimitive.InProgressIndicator, {}) | ||
| ] }); | ||
| return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_markdown.default, { ...options, children: text || "\xA0" }); | ||
| }; | ||
@@ -58,0 +54,0 @@ // Annotate the CommonJS export names for ESM import in node: |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../src/index.ts","../src/MarkdownText.tsx"],"sourcesContent":["export { MarkdownTextPrimitive } from \"./MarkdownText\";\n","import { ContentPartPrimitive } from \"@assistant-ui/react\";\nimport { useContentPartContext } from \"@assistant-ui/react\";\nimport type { FC } from \"react\";\nimport ReactMarkdown, { type Options } from \"react-markdown\";\n\nexport const MarkdownTextPrimitive: FC<Omit<Options, \"children\">> = (\n options,\n) => {\n const { useContentPart } = useContentPartContext();\n const text = useContentPart((c) => {\n if (c.part.type !== \"text\")\n throw new Error(\n \"This component can only be used inside text content parts.\",\n );\n\n return c.part.text;\n });\n return (\n <>\n <ReactMarkdown {...options}>{text}</ReactMarkdown>\n <ContentPartPrimitive.InProgressIndicator />\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAqC;AACrC,IAAAA,gBAAsC;AAEtC,4BAA4C;AAexC;AAbG,IAAM,wBAAuD,CAClE,YACG;AACH,QAAM,EAAE,eAAe,QAAI,qCAAsB;AACjD,QAAM,OAAO,eAAe,CAAC,MAAM;AACjC,QAAI,EAAE,KAAK,SAAS;AAClB,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAEF,WAAO,EAAE,KAAK;AAAA,EAChB,CAAC;AACD,SACE,4EACE;AAAA,gDAAC,sBAAAC,SAAA,EAAe,GAAG,SAAU,gBAAK;AAAA,IAClC,4CAAC,kCAAqB,qBAArB,EAAyC;AAAA,KAC5C;AAEJ;","names":["import_react","ReactMarkdown"]} | ||
| {"version":3,"sources":["../src/index.ts","../src/MarkdownText.tsx"],"sourcesContent":["export { MarkdownTextPrimitive } from \"./MarkdownText\";\n","import { useContentPartContext } from \"@assistant-ui/react\";\nimport type { FC } from \"react\";\nimport ReactMarkdown, { type Options } from \"react-markdown\";\n\ntype MarkdownTextPrimitiveProps = Omit<Options, \"children\">;\n\nexport const MarkdownTextPrimitive: FC<MarkdownTextPrimitiveProps> = (\n options,\n) => {\n const { useContentPart } = useContentPartContext();\n const text = useContentPart((c) => {\n if (c.part.type !== \"text\")\n throw new Error(\n \"This component can only be used inside text content parts.\",\n );\n\n return c.part.text;\n });\n return <ReactMarkdown {...options}>{text || \"\\u00A0\"}</ReactMarkdown>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAsC;AAEtC,4BAA4C;AAgBnC;AAZF,IAAM,wBAAwD,CACnE,YACG;AACH,QAAM,EAAE,eAAe,QAAI,oCAAsB;AACjD,QAAM,OAAO,eAAe,CAAC,MAAM;AACjC,QAAI,EAAE,KAAK,SAAS;AAClB,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAEF,WAAO,EAAE,KAAK;AAAA,EAChB,CAAC;AACD,SAAO,4CAAC,sBAAAA,SAAA,EAAe,GAAG,SAAU,kBAAQ,QAAS;AACvD;","names":["ReactMarkdown"]} |
+2
-6
| // src/MarkdownText.tsx | ||
| import { ContentPartPrimitive } from "@assistant-ui/react"; | ||
| import { useContentPartContext } from "@assistant-ui/react"; | ||
| import ReactMarkdown from "react-markdown"; | ||
| import { Fragment, jsx, jsxs } from "react/jsx-runtime"; | ||
| import { jsx } from "react/jsx-runtime"; | ||
| var MarkdownTextPrimitive = (options) => { | ||
@@ -15,6 +14,3 @@ const { useContentPart } = useContentPartContext(); | ||
| }); | ||
| return /* @__PURE__ */ jsxs(Fragment, { children: [ | ||
| /* @__PURE__ */ jsx(ReactMarkdown, { ...options, children: text }), | ||
| /* @__PURE__ */ jsx(ContentPartPrimitive.InProgressIndicator, {}) | ||
| ] }); | ||
| return /* @__PURE__ */ jsx(ReactMarkdown, { ...options, children: text || "\xA0" }); | ||
| }; | ||
@@ -21,0 +17,0 @@ export { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../src/MarkdownText.tsx"],"sourcesContent":["import { ContentPartPrimitive } from \"@assistant-ui/react\";\nimport { useContentPartContext } from \"@assistant-ui/react\";\nimport type { FC } from \"react\";\nimport ReactMarkdown, { type Options } from \"react-markdown\";\n\nexport const MarkdownTextPrimitive: FC<Omit<Options, \"children\">> = (\n options,\n) => {\n const { useContentPart } = useContentPartContext();\n const text = useContentPart((c) => {\n if (c.part.type !== \"text\")\n throw new Error(\n \"This component can only be used inside text content parts.\",\n );\n\n return c.part.text;\n });\n return (\n <>\n <ReactMarkdown {...options}>{text}</ReactMarkdown>\n <ContentPartPrimitive.InProgressIndicator />\n </>\n );\n};\n"],"mappings":";AAAA,SAAS,4BAA4B;AACrC,SAAS,6BAA6B;AAEtC,OAAO,mBAAqC;AAexC,mBACE,KADF;AAbG,IAAM,wBAAuD,CAClE,YACG;AACH,QAAM,EAAE,eAAe,IAAI,sBAAsB;AACjD,QAAM,OAAO,eAAe,CAAC,MAAM;AACjC,QAAI,EAAE,KAAK,SAAS;AAClB,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAEF,WAAO,EAAE,KAAK;AAAA,EAChB,CAAC;AACD,SACE,iCACE;AAAA,wBAAC,iBAAe,GAAG,SAAU,gBAAK;AAAA,IAClC,oBAAC,qBAAqB,qBAArB,EAAyC;AAAA,KAC5C;AAEJ;","names":[]} | ||
| {"version":3,"sources":["../src/MarkdownText.tsx"],"sourcesContent":["import { useContentPartContext } from \"@assistant-ui/react\";\nimport type { FC } from \"react\";\nimport ReactMarkdown, { type Options } from \"react-markdown\";\n\ntype MarkdownTextPrimitiveProps = Omit<Options, \"children\">;\n\nexport const MarkdownTextPrimitive: FC<MarkdownTextPrimitiveProps> = (\n options,\n) => {\n const { useContentPart } = useContentPartContext();\n const text = useContentPart((c) => {\n if (c.part.type !== \"text\")\n throw new Error(\n \"This component can only be used inside text content parts.\",\n );\n\n return c.part.text;\n });\n return <ReactMarkdown {...options}>{text || \"\\u00A0\"}</ReactMarkdown>;\n};\n"],"mappings":";AAAA,SAAS,6BAA6B;AAEtC,OAAO,mBAAqC;AAgBnC;AAZF,IAAM,wBAAwD,CACnE,YACG;AACH,QAAM,EAAE,eAAe,IAAI,sBAAsB;AACjD,QAAM,OAAO,eAAe,CAAC,MAAM;AACjC,QAAI,EAAE,KAAK,SAAS;AAClB,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAEF,WAAO,EAAE,KAAK;AAAA,EAChB,CAAC;AACD,SAAO,oBAAC,iBAAe,GAAG,SAAU,kBAAQ,QAAS;AACvD;","names":[]} |
+2
-2
| { | ||
| "name": "@assistant-ui/react-markdown", | ||
| "version": "0.0.1", | ||
| "version": "0.0.2", | ||
| "license": "MIT", | ||
@@ -31,3 +31,3 @@ "exports": { | ||
| "peerDependencies": { | ||
| "@assistant-ui/react": "^0.2.0", | ||
| "@assistant-ui/react": "^0.3.0", | ||
| "@types/react": "*", | ||
@@ -34,0 +34,0 @@ "react": "^18" |
8168
-7.03%76
-8.43%