reachat 3.3.0 → 3.4.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.
- package/dist/Chat.d.ts +1 -1
- package/dist/Markdown/Markdown.d.ts +3 -2
- package/dist/Markdown/index.d.ts +1 -0
- package/dist/Markdown/types.d.ts +21 -0
- package/dist/index.css +12 -0
- package/dist/index.js +38 -42
- package/dist/index.js.map +1 -1
- package/dist/stories/Markdown.stories.tsx +92 -0
- package/dist/theme.d.ts +2 -21
- package/package.json +1 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react-vite';
|
|
2
|
+
import {
|
|
3
|
+
Markdown,
|
|
4
|
+
chatTheme,
|
|
5
|
+
commonRedactMatchers,
|
|
6
|
+
remarkCve,
|
|
7
|
+
remarkRedact
|
|
8
|
+
} from 'reachat';
|
|
9
|
+
|
|
10
|
+
const markdownTheme = chatTheme.messages.message.markdown;
|
|
11
|
+
|
|
12
|
+
const showcaseMarkdown = `# Markdown Showcase
|
|
13
|
+
|
|
14
|
+
This is **bold**, *italic*, and \`inline code\`.
|
|
15
|
+
|
|
16
|
+
## Lists
|
|
17
|
+
|
|
18
|
+
- Item one
|
|
19
|
+
- Item two
|
|
20
|
+
- Item three
|
|
21
|
+
|
|
22
|
+
1. First
|
|
23
|
+
2. Second
|
|
24
|
+
3. Third
|
|
25
|
+
|
|
26
|
+
## Table
|
|
27
|
+
|
|
28
|
+
| Name | Value |
|
|
29
|
+
| ---- | ----- |
|
|
30
|
+
| Alpha | 10 |
|
|
31
|
+
| Beta | 20 |
|
|
32
|
+
|
|
33
|
+
## Code
|
|
34
|
+
|
|
35
|
+
\`\`\`ts
|
|
36
|
+
export const sum = (a: number, b: number) => a + b;
|
|
37
|
+
\`\`\`
|
|
38
|
+
|
|
39
|
+
[Read the docs](https://reachat.dev)
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
const cveAndRedactMarkdown = `# Security Findings
|
|
43
|
+
|
|
44
|
+
Potential incidents:
|
|
45
|
+
- CVE-2021-44228
|
|
46
|
+
- CVE-2023-4863
|
|
47
|
+
|
|
48
|
+
Sensitive details:
|
|
49
|
+
- SSN: 123-45-6789
|
|
50
|
+
- Credit card: 4532-1234-5678-9010
|
|
51
|
+
- Email: security@example.com
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
export default {
|
|
55
|
+
title: 'Components/Markdown',
|
|
56
|
+
component: Markdown
|
|
57
|
+
} as Meta<typeof Markdown>;
|
|
58
|
+
|
|
59
|
+
export const Basic = () => (
|
|
60
|
+
<div className="bg-white dark:bg-gray-950 p-6 rounded-md max-w-4xl">
|
|
61
|
+
<Markdown theme={markdownTheme}>{showcaseMarkdown}</Markdown>
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
export const WithPlugins = () => (
|
|
66
|
+
<div className="bg-white dark:bg-gray-950 p-6 rounded-md max-w-4xl">
|
|
67
|
+
<Markdown
|
|
68
|
+
theme={markdownTheme}
|
|
69
|
+
remarkPlugins={[remarkCve, remarkRedact(commonRedactMatchers)]}
|
|
70
|
+
>
|
|
71
|
+
{cveAndRedactMarkdown}
|
|
72
|
+
</Markdown>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
export const CustomComponents = () => (
|
|
77
|
+
<div className="bg-white dark:bg-gray-950 p-6 rounded-md max-w-4xl">
|
|
78
|
+
<Markdown
|
|
79
|
+
theme={markdownTheme}
|
|
80
|
+
customComponents={{
|
|
81
|
+
p: props => <p {...props} className="mb-4 text-indigo-300" />,
|
|
82
|
+
h2: props => <h2 {...props} className="text-2xl mb-3 text-cyan-300" />
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
{`# Overrides
|
|
86
|
+
|
|
87
|
+
## Styled Heading
|
|
88
|
+
|
|
89
|
+
This paragraph is rendered through custom markdown components.`}
|
|
90
|
+
</Markdown>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
package/dist/theme.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DeepPartial } from 'reablocks';
|
|
2
|
+
import { MarkdownTheme } from './Markdown/types';
|
|
2
3
|
export interface ChatTheme {
|
|
3
4
|
base: string;
|
|
4
5
|
console: string;
|
|
@@ -83,27 +84,7 @@ export interface ChatTheme {
|
|
|
83
84
|
url: string;
|
|
84
85
|
};
|
|
85
86
|
};
|
|
86
|
-
markdown:
|
|
87
|
-
hr: string;
|
|
88
|
-
p: string;
|
|
89
|
-
a: string;
|
|
90
|
-
table: string;
|
|
91
|
-
th: string;
|
|
92
|
-
td: string;
|
|
93
|
-
code: string;
|
|
94
|
-
inlineCode: string;
|
|
95
|
-
toolbar: string;
|
|
96
|
-
li: string;
|
|
97
|
-
ul: string;
|
|
98
|
-
ol: string;
|
|
99
|
-
copy: string;
|
|
100
|
-
h1: string;
|
|
101
|
-
h2: string;
|
|
102
|
-
h3: string;
|
|
103
|
-
h4: string;
|
|
104
|
-
h5: string;
|
|
105
|
-
h6: string;
|
|
106
|
-
};
|
|
87
|
+
markdown: MarkdownTheme;
|
|
107
88
|
footer: {
|
|
108
89
|
base: string;
|
|
109
90
|
copy: string;
|