@assistant-ui/react-markdown 0.0.1 → 0.0.3
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.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { Options } from 'react-markdown';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type MarkdownTextPrimitiveProps = Omit<Options, "children">;
|
|
5
|
+
declare const MarkdownTextPrimitive: FC<MarkdownTextPrimitiveProps>;
|
|
5
6
|
|
|
6
|
-
export { MarkdownTextPrimitive };
|
|
7
|
+
export { MarkdownTextPrimitive, type MarkdownTextPrimitiveProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { Options } from 'react-markdown';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type MarkdownTextPrimitiveProps = Omit<Options, "children">;
|
|
5
|
+
declare const MarkdownTextPrimitive: FC<MarkdownTextPrimitiveProps>;
|
|
5
6
|
|
|
6
|
-
export { MarkdownTextPrimitive };
|
|
7
|
+
export { MarkdownTextPrimitive, type MarkdownTextPrimitiveProps };
|
package/dist/index.js
CHANGED
|
@@ -36,11 +36,10 @@ module.exports = __toCommonJS(src_exports);
|
|
|
36
36
|
|
|
37
37
|
// src/MarkdownText.tsx
|
|
38
38
|
var import_react = require("@assistant-ui/react");
|
|
39
|
-
var import_react2 = require("@assistant-ui/react");
|
|
40
39
|
var import_react_markdown = __toESM(require("react-markdown"));
|
|
41
40
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
41
|
var MarkdownTextPrimitive = (options) => {
|
|
43
|
-
const { useContentPart } = (0,
|
|
42
|
+
const { useContentPart } = (0, import_react.useContentPartContext)();
|
|
44
43
|
const text = useContentPart((c) => {
|
|
45
44
|
if (c.part.type !== "text")
|
|
46
45
|
throw new Error(
|
|
@@ -48,10 +47,7 @@ var MarkdownTextPrimitive = (options) => {
|
|
|
48
47
|
);
|
|
49
48
|
return c.part.text;
|
|
50
49
|
});
|
|
51
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
52
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_markdown.default, { ...options, children: text }),
|
|
53
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.ContentPartPrimitive.InProgressIndicator, {})
|
|
54
|
-
] });
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_markdown.default, { ...options, children: text });
|
|
55
51
|
};
|
|
56
52
|
// Annotate the CommonJS export names for ESM import in node:
|
|
57
53
|
0 && (module.exports = {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/MarkdownText.tsx"],"sourcesContent":["export {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/MarkdownText.tsx"],"sourcesContent":["export {\n MarkdownTextPrimitive,\n type MarkdownTextPrimitiveProps,\n} from \"./MarkdownText\";\n","import { useContentPartContext } from \"@assistant-ui/react\";\nimport type { FC } from \"react\";\nimport ReactMarkdown, { type Options } from \"react-markdown\";\n\nexport type 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}</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,gBAAK;AAC3C;","names":["ReactMarkdown"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// src/MarkdownText.tsx
|
|
2
|
-
import { ContentPartPrimitive } from "@assistant-ui/react";
|
|
3
2
|
import { useContentPartContext } from "@assistant-ui/react";
|
|
4
3
|
import ReactMarkdown from "react-markdown";
|
|
5
|
-
import {
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
5
|
var MarkdownTextPrimitive = (options) => {
|
|
7
6
|
const { useContentPart } = useContentPartContext();
|
|
8
7
|
const text = useContentPart((c) => {
|
|
@@ -12,10 +11,7 @@ var MarkdownTextPrimitive = (options) => {
|
|
|
12
11
|
);
|
|
13
12
|
return c.part.text;
|
|
14
13
|
});
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */ jsx(ReactMarkdown, { ...options, children: text }),
|
|
17
|
-
/* @__PURE__ */ jsx(ContentPartPrimitive.InProgressIndicator, {})
|
|
18
|
-
] });
|
|
14
|
+
return /* @__PURE__ */ jsx(ReactMarkdown, { ...options, children: text });
|
|
19
15
|
};
|
|
20
16
|
export {
|
|
21
17
|
MarkdownTextPrimitive
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/MarkdownText.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"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\nexport type 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}</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,gBAAK;AAC3C;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assistant-ui/react-markdown",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"zod": "^3.23.8"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@assistant-ui/react": "^0.
|
|
31
|
+
"@assistant-ui/react": "^0.3.0",
|
|
32
32
|
"@types/react": "*",
|
|
33
33
|
"react": "^18"
|
|
34
34
|
},
|