@assistant-ui/react-markdown 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,9 @@
1
1
  import { FC } from 'react';
2
2
  import { Options } from 'react-markdown';
3
3
 
4
- type MarkdownTextPrimitiveProps = Omit<Options, "children">;
4
+ type MarkdownTextPrimitiveProps = Omit<Options, "children"> & {
5
+ smooth?: boolean;
6
+ };
5
7
  declare const MarkdownTextPrimitive: FC<MarkdownTextPrimitiveProps>;
6
8
 
7
9
  export { MarkdownTextPrimitive, type MarkdownTextPrimitiveProps };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import { FC } from 'react';
2
2
  import { Options } from 'react-markdown';
3
3
 
4
- type MarkdownTextPrimitiveProps = Omit<Options, "children">;
4
+ type MarkdownTextPrimitiveProps = Omit<Options, "children"> & {
5
+ smooth?: boolean;
6
+ };
5
7
  declare const MarkdownTextPrimitive: FC<MarkdownTextPrimitiveProps>;
6
8
 
7
9
  export { MarkdownTextPrimitive, type MarkdownTextPrimitiveProps };
package/dist/index.js CHANGED
@@ -38,16 +38,13 @@ module.exports = __toCommonJS(src_exports);
38
38
  var import_react = require("@assistant-ui/react");
39
39
  var import_react_markdown = __toESM(require("react-markdown"));
40
40
  var import_jsx_runtime = require("react/jsx-runtime");
41
+ var { useSmooth } = import_react.INTERNAL;
41
42
  var MarkdownTextPrimitive = (options) => {
42
- const { useContentPart } = (0, import_react.useContentPartContext)();
43
- const text = useContentPart((c) => {
44
- if (c.part.type !== "text")
45
- throw new Error(
46
- "This component can only be used inside text content parts."
47
- );
48
- return c.part.text;
49
- });
50
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_markdown.default, { ...options, children: text });
43
+ const {
44
+ part: { text }
45
+ } = (0, import_react.useContentPartText)();
46
+ const smoothText = useSmooth(text, options.smooth);
47
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_markdown.default, { ...options, children: smoothText });
51
48
  };
52
49
  // Annotate the CommonJS export names for ESM import in node:
53
50
  0 && (module.exports = {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
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"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/MarkdownText.tsx"],"sourcesContent":["export {\n MarkdownTextPrimitive,\n type MarkdownTextPrimitiveProps,\n} from \"./MarkdownText\";\n","import { INTERNAL, useContentPartText } from \"@assistant-ui/react\";\nimport type { FC } from \"react\";\nimport ReactMarkdown, { type Options } from \"react-markdown\";\n\nconst { useSmooth } = INTERNAL;\n\nexport type MarkdownTextPrimitiveProps = Omit<Options, \"children\"> & {\n smooth?: boolean;\n};\n\nexport const MarkdownTextPrimitive: FC<MarkdownTextPrimitiveProps> = (\n options,\n) => {\n const {\n part: { text },\n } = useContentPartText();\n const smoothText = useSmooth(text, options.smooth);\n return <ReactMarkdown {...options}>{smoothText}</ReactMarkdown>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA6C;AAE7C,4BAA4C;AAenC;AAbT,IAAM,EAAE,UAAU,IAAI;AAMf,IAAM,wBAAwD,CACnE,YACG;AACH,QAAM;AAAA,IACJ,MAAM,EAAE,KAAK;AAAA,EACf,QAAI,iCAAmB;AACvB,QAAM,aAAa,UAAU,MAAM,QAAQ,MAAM;AACjD,SAAO,4CAAC,sBAAAA,SAAA,EAAe,GAAG,SAAU,sBAAW;AACjD;","names":["ReactMarkdown"]}
package/dist/index.mjs CHANGED
@@ -1,17 +1,14 @@
1
1
  // src/MarkdownText.tsx
2
- import { useContentPartContext } from "@assistant-ui/react";
2
+ import { INTERNAL, useContentPartText } from "@assistant-ui/react";
3
3
  import ReactMarkdown from "react-markdown";
4
4
  import { jsx } from "react/jsx-runtime";
5
+ var { useSmooth } = INTERNAL;
5
6
  var MarkdownTextPrimitive = (options) => {
6
- const { useContentPart } = useContentPartContext();
7
- const text = useContentPart((c) => {
8
- if (c.part.type !== "text")
9
- throw new Error(
10
- "This component can only be used inside text content parts."
11
- );
12
- return c.part.text;
13
- });
14
- return /* @__PURE__ */ jsx(ReactMarkdown, { ...options, children: text });
7
+ const {
8
+ part: { text }
9
+ } = useContentPartText();
10
+ const smoothText = useSmooth(text, options.smooth);
11
+ return /* @__PURE__ */ jsx(ReactMarkdown, { ...options, children: smoothText });
15
12
  };
16
13
  export {
17
14
  MarkdownTextPrimitive
@@ -1 +1 @@
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":[]}
1
+ {"version":3,"sources":["../src/MarkdownText.tsx"],"sourcesContent":["import { INTERNAL, useContentPartText } from \"@assistant-ui/react\";\nimport type { FC } from \"react\";\nimport ReactMarkdown, { type Options } from \"react-markdown\";\n\nconst { useSmooth } = INTERNAL;\n\nexport type MarkdownTextPrimitiveProps = Omit<Options, \"children\"> & {\n smooth?: boolean;\n};\n\nexport const MarkdownTextPrimitive: FC<MarkdownTextPrimitiveProps> = (\n options,\n) => {\n const {\n part: { text },\n } = useContentPartText();\n const smoothText = useSmooth(text, options.smooth);\n return <ReactMarkdown {...options}>{smoothText}</ReactMarkdown>;\n};\n"],"mappings":";AAAA,SAAS,UAAU,0BAA0B;AAE7C,OAAO,mBAAqC;AAenC;AAbT,IAAM,EAAE,UAAU,IAAI;AAMf,IAAM,wBAAwD,CACnE,YACG;AACH,QAAM;AAAA,IACJ,MAAM,EAAE,KAAK;AAAA,EACf,IAAI,mBAAmB;AACvB,QAAM,aAAa,UAAU,MAAM,QAAQ,MAAM;AACjD,SAAO,oBAAC,iBAAe,GAAG,SAAU,sBAAW;AACjD;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assistant-ui/react-markdown",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
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.3.0",
31
+ "@assistant-ui/react": "^0.3.2",
32
32
  "@types/react": "*",
33
33
  "react": "^18"
34
34
  },