@assistant-ui/react-markdown 0.10.0 → 0.10.1

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.
@@ -0,0 +1,5 @@
1
+ export { MarkdownTextPrimitive, type MarkdownTextPrimitiveProps, } from "./primitives/MarkdownText";
2
+ export type { CodeHeaderProps, SyntaxHighlighterProps, } from "./overrides/types";
3
+ export { useIsMarkdownCodeBlock } from "./overrides/PreOverride";
4
+ export { memoizeMarkdownComponents as unstable_memoizeMarkdownComponents } from "./memoization";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EACV,eAAe,EACf,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,yBAAyB,IAAI,kCAAkC,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { Element } from "hast";
2
+ import { ComponentProps, ComponentType, ElementType } from "react";
3
+ import { CodeHeaderProps, SyntaxHighlighterProps } from "./overrides/types";
4
+ type Components = {
5
+ [Key in Extract<ElementType, string>]?: ComponentType<ComponentProps<Key>>;
6
+ } & {
7
+ SyntaxHighlighter?: ComponentType<Omit<SyntaxHighlighterProps, "node">> | undefined;
8
+ CodeHeader?: ComponentType<Omit<CodeHeaderProps, "node">> | undefined;
9
+ };
10
+ export declare const areNodesEqual: (prev: Element | undefined, next: Element | undefined) => boolean;
11
+ export declare const memoCompareNodes: (prev: {
12
+ node?: Element | undefined;
13
+ }, next: {
14
+ node?: Element | undefined;
15
+ }) => boolean;
16
+ export declare const memoizeMarkdownComponents: (components?: Components) => {
17
+ [k: string]: import("react").MemoExoticComponent<({ node, ...props }: {
18
+ node?: Element;
19
+ }) => import("react/jsx-runtime").JSX.Element> | undefined;
20
+ };
21
+ export {};
22
+ //# sourceMappingURL=memoization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memoization.d.ts","sourceRoot":"","sources":["../src/memoization.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAQ,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE5E,KAAK,UAAU,GAAG;KACf,GAAG,IAAI,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;CAC3E,GAAG;IACF,iBAAiB,CAAC,EACd,aAAa,CAAC,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC,GACnD,SAAS,CAAC;IACd,UAAU,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;CACvE,CAAC;AAOF,eAAO,MAAM,aAAa,GACxB,MAAM,OAAO,GAAG,SAAS,EACzB,MAAM,OAAO,GAAG,SAAS,YAQ1B,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,MAAM;IAAE,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,EACpC,MAAM;IAAE,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,YAGrC,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,aAAY,UAAe;0EAMtB;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE;CAMhE,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { ComponentType, FC } from "react";
2
+ import { CodeComponent, CodeHeaderProps, PreComponent, SyntaxHighlighterProps } from "./types";
3
+ import { Element } from "hast";
4
+ export type CodeBlockProps = {
5
+ node: Element | undefined;
6
+ language: string;
7
+ code: string;
8
+ components: {
9
+ Pre: PreComponent;
10
+ Code: CodeComponent;
11
+ CodeHeader: ComponentType<CodeHeaderProps>;
12
+ SyntaxHighlighter: ComponentType<SyntaxHighlighterProps>;
13
+ };
14
+ };
15
+ export declare const DefaultCodeBlock: FC<CodeBlockProps>;
16
+ //# sourceMappingURL=CodeBlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeBlock.d.ts","sourceRoot":"","sources":["../../src/overrides/CodeBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,EAAE,EAAW,MAAM,OAAO,CAAC;AAEnD,OAAO,EACL,aAAa,EACb,eAAe,EACf,YAAY,EACZ,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE;QACV,GAAG,EAAE,YAAY,CAAC;QAClB,IAAI,EAAE,aAAa,CAAC;QACpB,UAAU,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;QAC3C,iBAAiB,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;KAC1D,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,cAAc,CAqB/C,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { ComponentPropsWithoutRef, ComponentType } from "react";
2
+ import { CodeComponent, CodeHeaderProps, PreComponent, SyntaxHighlighterProps } from "./types";
3
+ export type CodeOverrideProps = ComponentPropsWithoutRef<CodeComponent> & {
4
+ components: {
5
+ Pre: PreComponent;
6
+ Code: CodeComponent;
7
+ CodeHeader: ComponentType<CodeHeaderProps>;
8
+ SyntaxHighlighter: ComponentType<SyntaxHighlighterProps>;
9
+ };
10
+ componentsByLanguage?: Record<string, {
11
+ CodeHeader?: ComponentType<CodeHeaderProps>;
12
+ SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps>;
13
+ }> | undefined;
14
+ };
15
+ export declare const CodeOverride: import("react").NamedExoticComponent<CodeOverrideProps>;
16
+ //# sourceMappingURL=CodeOverride.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeOverride.d.ts","sourceRoot":"","sources":["../../src/overrides/CodeOverride.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,aAAa,EAId,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,aAAa,EACb,eAAe,EACf,YAAY,EACZ,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAiEjB,MAAM,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,aAAa,CAAC,GAAG;IACxE,UAAU,EAAE;QACV,GAAG,EAAE,YAAY,CAAC;QAClB,IAAI,EAAE,aAAa,CAAC;QACpB,UAAU,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;QAC3C,iBAAiB,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;KAC1D,CAAC;IACF,oBAAoB,CAAC,EACjB,MAAM,CACJ,MAAM,EACN;QACE,UAAU,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;QAC5C,iBAAiB,CAAC,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;KAC3D,CACF,GACD,SAAS,CAAC;CACf,CAAC;AAoBF,eAAO,MAAM,YAAY,yDAMvB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const PreContext: import("react").Context<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLPreElement>, HTMLPreElement>, "ref"> & {
2
+ node?: import("hast").Element | undefined;
3
+ }, "children"> | null>;
4
+ export declare const useIsMarkdownCodeBlock: () => boolean;
5
+ export declare const PreOverride: import("react").NamedExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLPreElement>, HTMLPreElement>, "ref"> & {
6
+ node?: import("hast").Element | undefined;
7
+ }>;
8
+ //# sourceMappingURL=PreOverride.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreOverride.d.ts","sourceRoot":"","sources":["../../src/overrides/PreOverride.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,UAAU;;sBAGR,CAAC;AAEhB,eAAO,MAAM,sBAAsB,eAElC,CAAC;AAMF,eAAO,MAAM,WAAW;;EAA0C,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { ComponentType, ReactNode } from "react";
2
+ import { PreComponent, CodeComponent, CodeHeaderProps } from "./types";
3
+ import { Element } from "hast";
4
+ export declare const DefaultPre: PreComponent;
5
+ export declare const DefaultCode: CodeComponent;
6
+ export declare const DefaultCodeBlockContent: ComponentType<{
7
+ node: Element | undefined;
8
+ components: {
9
+ Pre: PreComponent;
10
+ Code: CodeComponent;
11
+ };
12
+ code: string | ReactNode | undefined;
13
+ }>;
14
+ export declare const DefaultCodeHeader: ComponentType<CodeHeaderProps>;
15
+ //# sourceMappingURL=defaultComponents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultComponents.d.ts","sourceRoot":"","sources":["../../src/overrides/defaultComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,eAAO,MAAM,UAAU,EAAE,YAExB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,aAEzB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,aAAa,CAAC;IAClD,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,UAAU,EAAE;QAAE,GAAG,EAAE,YAAY,CAAC;QAAC,IAAI,EAAE,aAAa,CAAA;KAAE,CAAC;IACvD,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;CACtC,CAIA,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,aAAa,CAAC,eAAe,CAAc,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { Element } from "hast";
2
+ import { ComponentPropsWithoutRef, ComponentType } from "react";
3
+ export type PreComponent = ComponentType<ComponentPropsWithoutRef<"pre"> & {
4
+ node?: Element | undefined;
5
+ }>;
6
+ export type CodeComponent = ComponentType<ComponentPropsWithoutRef<"code"> & {
7
+ node?: Element | undefined;
8
+ }>;
9
+ export type CodeHeaderProps = {
10
+ node?: Element | undefined;
11
+ language: string | undefined;
12
+ code: string;
13
+ };
14
+ export type SyntaxHighlighterProps = {
15
+ node?: Element | undefined;
16
+ components: {
17
+ Pre: PreComponent;
18
+ Code: CodeComponent;
19
+ };
20
+ language: string;
21
+ code: string;
22
+ };
23
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/overrides/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEhE,MAAM,MAAM,YAAY,GAAG,aAAa,CACtC,wBAAwB,CAAC,KAAK,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,CACjE,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,aAAa,CACvC,wBAAwB,CAAC,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,CAClE,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,UAAU,EAAE;QACV,GAAG,EAAE,YAAY,CAAC;QAClB,IAAI,EAAE,aAAa,CAAC;KACrB,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const withDefaultProps: <TProps extends {
2
+ className?: string | undefined;
3
+ }>({ className, ...defaultProps }: Partial<TProps>) => ({ className: classNameProp, ...props }: TProps) => TProps;
4
+ //# sourceMappingURL=withDefaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withDefaults.d.ts","sourceRoot":"","sources":["../../src/overrides/withDefaults.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,GAC1B,MAAM,SAAS;IAAE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,EAAE,gCAGjD,OAAO,CAAC,MAAM,CAAC,MACjB,wCAAwC,MAAM,KAKxC,MACN,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { ElementType, ForwardRefExoticComponent, RefAttributes, type ComponentPropsWithoutRef, type ComponentType } from "react";
2
+ import { type Options } from "react-markdown";
3
+ import { SyntaxHighlighterProps, CodeHeaderProps } from "../overrides/types";
4
+ import { Primitive } from "@radix-ui/react-primitive";
5
+ type PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;
6
+ export type MarkdownTextPrimitiveProps = Omit<Options, "components" | "children"> & {
7
+ className?: string | undefined;
8
+ containerProps?: Omit<PrimitiveDivProps, "children" | "asChild"> | undefined;
9
+ containerComponent?: ElementType | undefined;
10
+ components?: (NonNullable<Options["components"]> & {
11
+ SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps> | undefined;
12
+ CodeHeader?: ComponentType<CodeHeaderProps> | undefined;
13
+ }) | undefined;
14
+ componentsByLanguage?: Record<string, {
15
+ CodeHeader?: ComponentType<CodeHeaderProps> | undefined;
16
+ SyntaxHighlighter?: ComponentType<SyntaxHighlighterProps> | undefined;
17
+ }> | undefined;
18
+ smooth?: boolean | undefined;
19
+ };
20
+ export declare const MarkdownTextPrimitive: ForwardRefExoticComponent<MarkdownTextPrimitiveProps> & RefAttributes<HTMLDivElement>;
21
+ export {};
22
+ //# sourceMappingURL=MarkdownText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkdownText.d.ts","sourceRoot":"","sources":["../../src/primitives/MarkdownText.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,WAAW,EAGX,yBAAyB,EACzB,aAAa,EAEb,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EACnB,MAAM,OAAO,CAAC;AACf,OAAsB,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAU7E,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAMtD,KAAK,iBAAiB,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;AAExE,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C,OAAO,EACP,YAAY,GAAG,UAAU,CAC1B,GAAG;IACF,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,cAAc,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;IAC7E,kBAAkB,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC7C,UAAU,CAAC,EACP,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,GAAG;QACpC,iBAAiB,CAAC,EAAE,aAAa,CAAC,sBAAsB,CAAC,GAAG,SAAS,CAAC;QACtE,UAAU,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC;KACzD,CAAC,GACF,SAAS,CAAC;IACd,oBAAoB,CAAC,EACjB,MAAM,CACJ,MAAM,EACN;QACE,UAAU,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC;QACxD,iBAAiB,CAAC,EAAE,aAAa,CAAC,sBAAsB,CAAC,GAAG,SAAS,CAAC;KACvE,CACF,GACD,SAAS,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9B,CAAC;AAoFF,eAAO,MAAM,qBAAqB,uFAEjC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assistant-ui/react-markdown",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -30,7 +30,7 @@
30
30
  "react-markdown": "^10.1.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "@assistant-ui/react": "^0.10.0",
33
+ "@assistant-ui/react": "^0.10.1",
34
34
  "@types/react": "*",
35
35
  "react": "^18 || ^19 || ^19.0.0-rc"
36
36
  },
@@ -46,9 +46,9 @@
46
46
  "react": "19.1.0",
47
47
  "react-dom": "19.1.0",
48
48
  "tsx": "^4.19.3",
49
- "@assistant-ui/react": "0.10.0",
50
- "@assistant-ui/tsbuildutils": "0.0.1",
51
- "@assistant-ui/tsconfig": "0.0.0"
49
+ "@assistant-ui/react": "0.10.1",
50
+ "@assistant-ui/tsconfig": "0.0.0",
51
+ "@assistant-ui/tsbuildutils": "0.0.1"
52
52
  },
53
53
  "publishConfig": {
54
54
  "access": "public",
@@ -57,7 +57,7 @@
57
57
  "homepage": "https://www.assistant-ui.com/",
58
58
  "repository": {
59
59
  "type": "git",
60
- "url": "git+https://github.com/assistant-ui/assistant-ui.git"
60
+ "url": "https://github.com/assistant-ui/assistant-ui/tree/main/packages/react-markdown"
61
61
  },
62
62
  "bugs": {
63
63
  "url": "https://github.com/assistant-ui/assistant-ui/issues"