ds-markdown 0.1.10-beta.0 → 0.1.10-beta.2

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/README.md CHANGED
@@ -12,9 +12,13 @@
12
12
  [![React](https://img.shields.io/badge/React-18.0.0+-blue)](https://react.dev)
13
13
  [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue)](https://www.typescriptlang.org/)
14
14
 
15
- [📖 在线演示](https://onshinpei.github.io/ds-markdown/)
16
-
17
- [DEMO:🔧 StackBlitz 体验](https://stackblitz.com/edit/vitejs-vite-ddfw8avb?file=src%2FApp.tsx)
15
+ - [使用文档](https://onshinpei.github.io/ds-markdown/)
16
+ - 使用示例
17
+ - [基本用法](https://stackblitz.com/edit/vitejs-vite-ddfw8avb?file=src%2FApp.tsx)
18
+ - [流式数据用法](https://stackblitz.com/edit/vitejs-vite-2ri8kex3?file=src%2FApp.tsx)
19
+ - [mermaid图表](https://stackblitz.com/edit/vitejs-vite-iqbyta3j?file=index.html)
20
+ - [数学公式demo1](https://stackblitz.com/edit/vitejs-vite-iqbyta3j?file=index.html)
21
+ - [数学公式demo2](https://stackblitz.com/edit/vitejs-vite-xk9lxagc?file=src%2FApp.tsx)
18
22
 
19
23
  如果你想要一个纯净的`react markdown` 打字组件,可以使用[react-markdown-typer](https://github.com/onshinpei/react-markdown-typer)
20
24
 
@@ -441,6 +445,8 @@ markdownRef.current?.restart(); // 重新开始动画
441
445
 
442
446
  #### KaTeX 数学公式插件
443
447
 
448
+ [DEMO](https://stackblitz.com/edit/vitejs-vite-iqbyta3j?file=index.html)
449
+
444
450
  ```tsx
445
451
  import { katexPlugin } from 'ds-markdown/plugins';
446
452
 
@@ -1,15 +1,22 @@
1
1
  declare const enUS: {
2
- readonly codeBlock: {
3
- readonly copy: "Copy";
4
- readonly copied: "Copied";
5
- readonly download: "Download";
2
+ codeBlock: {
3
+ copy: string;
4
+ copied: string;
5
+ download: string;
6
+ downloaded: string;
6
7
  };
7
- readonly mermaid: {
8
- readonly diagram: "Diagram";
9
- readonly code: "Code";
10
- readonly zoomOut: "Zoom Out";
11
- readonly zoomIn: "Zoom In";
12
- readonly download: "Download";
8
+ mermaid: {
9
+ diagram: string;
10
+ code: string;
11
+ zoomOut: string;
12
+ zoomIn: string;
13
+ download: string;
14
+ fullScreen: string;
15
+ exitFullScreen: string;
16
+ downloadImage: string;
17
+ downloadedImage: string;
18
+ copiedImage: string;
19
+ copyImage: string;
13
20
  };
14
21
  };
15
22
  type EnUS = typeof enUS;
@@ -7,6 +7,7 @@ const enUS = {
7
7
  copy: 'Copy',
8
8
  copied: 'Copied',
9
9
  download: 'Download',
10
+ downloaded: 'Downloaded',
10
11
  },
11
12
  mermaid: {
12
13
  diagram: 'Diagram',
@@ -14,6 +15,12 @@ const enUS = {
14
15
  zoomOut: 'Zoom Out',
15
16
  zoomIn: 'Zoom In',
16
17
  download: 'Download',
18
+ fullScreen: 'Full Screen',
19
+ exitFullScreen: 'Exit Full Screen',
20
+ downloadImage: 'Download Image',
21
+ downloadedImage: 'Downloaded',
22
+ copiedImage: 'Copied',
23
+ copyImage: 'Copy Image',
17
24
  },
18
25
  };
19
26
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/i18n/en/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAa,MAAA,IAAI,GAAG;AAClB,IAAA,SAAS,EAAE;AACT,QAAA,IAAI,EAAE,MAAM;AACZ,QAAA,MAAM,EAAE,QAAQ;AAChB,QAAA,QAAQ,EAAE,UAAU;AACrB,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,IAAI,EAAE,MAAM;AACZ,QAAA,OAAO,EAAE,UAAU;AACnB,QAAA,MAAM,EAAE,SAAS;AACjB,QAAA,QAAQ,EAAE,UAAU;AACrB,KAAA;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/i18n/en/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAa,MAAA,IAAI,GAAG;AAClB,IAAA,SAAS,EAAE;AACT,QAAA,IAAI,EAAE,MAAM;AACZ,QAAA,MAAM,EAAE,QAAQ;AAChB,QAAA,QAAQ,EAAE,UAAU;AACpB,QAAA,UAAU,EAAE,YAAY;AACzB,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,IAAI,EAAE,MAAM;AACZ,QAAA,OAAO,EAAE,UAAU;AACnB,QAAA,MAAM,EAAE,SAAS;AACjB,QAAA,QAAQ,EAAE,UAAU;AACpB,QAAA,UAAU,EAAE,aAAa;AACzB,QAAA,cAAc,EAAE,kBAAkB;AAClC,QAAA,aAAa,EAAE,gBAAgB;AAC/B,QAAA,eAAe,EAAE,YAAY;AAC7B,QAAA,WAAW,EAAE,QAAQ;AACrB,QAAA,SAAS,EAAE,YAAY;AACxB,KAAA;;;;;;"}
@@ -1,15 +1,22 @@
1
1
  declare const zhCN: {
2
- readonly codeBlock: {
3
- readonly copy: "复制";
4
- readonly copied: "已复制";
5
- readonly download: "下载";
2
+ codeBlock: {
3
+ copy: string;
4
+ copied: string;
5
+ download: string;
6
+ downloaded: string;
6
7
  };
7
- readonly mermaid: {
8
- readonly diagram: "图表";
9
- readonly code: "代码";
10
- readonly zoomOut: "缩小";
11
- readonly zoomIn: "放大";
12
- readonly download: "下载";
8
+ mermaid: {
9
+ diagram: string;
10
+ code: string;
11
+ zoomOut: string;
12
+ zoomIn: string;
13
+ download: string;
14
+ fullScreen: string;
15
+ exitFullScreen: string;
16
+ downloadImage: string;
17
+ downloadedImage: string;
18
+ copyImage: string;
19
+ copiedImage: string;
13
20
  };
14
21
  };
15
22
  type ZhCN = typeof zhCN;
@@ -7,6 +7,7 @@ const zhCN = {
7
7
  copy: '复制',
8
8
  copied: '已复制',
9
9
  download: '下载',
10
+ downloaded: '已下载',
10
11
  },
11
12
  mermaid: {
12
13
  diagram: '图表',
@@ -14,6 +15,12 @@ const zhCN = {
14
15
  zoomOut: '缩小',
15
16
  zoomIn: '放大',
16
17
  download: '下载',
18
+ fullScreen: '全屏',
19
+ exitFullScreen: '退出全屏',
20
+ downloadImage: '下载图片',
21
+ downloadedImage: '已下载',
22
+ copyImage: '复制图片',
23
+ copiedImage: '已复制',
17
24
  },
18
25
  };
19
26
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/i18n/zh/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAa,MAAA,IAAI,GAAG;AAClB,IAAA,SAAS,EAAE;AACT,QAAA,IAAI,EAAE,IAAI;AACV,QAAA,MAAM,EAAE,KAAK;AACb,QAAA,QAAQ,EAAE,IAAI;AACf,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,IAAI,EAAE,IAAI;AACV,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,MAAM,EAAE,IAAI;AACZ,QAAA,QAAQ,EAAE,IAAI;AACf,KAAA;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/i18n/zh/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAa,MAAA,IAAI,GAAG;AAClB,IAAA,SAAS,EAAE;AACT,QAAA,IAAI,EAAE,IAAI;AACV,QAAA,MAAM,EAAE,KAAK;AACb,QAAA,QAAQ,EAAE,IAAI;AACd,QAAA,UAAU,EAAE,KAAK;AAClB,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,IAAI,EAAE,IAAI;AACV,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,MAAM,EAAE,IAAI;AACZ,QAAA,QAAQ,EAAE,IAAI;AACd,QAAA,UAAU,EAAE,IAAI;AAChB,QAAA,cAAc,EAAE,MAAM;AACtB,QAAA,aAAa,EAAE,MAAM;AACrB,QAAA,eAAe,EAAE,KAAK;AACtB,QAAA,SAAS,EAAE,MAAM;AACjB,QAAA,WAAW,EAAE,KAAK;AACnB,KAAA;;;;;;"}
@@ -85,6 +85,8 @@ interface IMarkdownPlugin {
85
85
  interface IMarkdownMath {
86
86
  /** 是括号还是$作为分隔符, 默认是$ */
87
87
  splitSymbol: 'bracket' | 'dollar';
88
+ /** 数学公式替换函数 */
89
+ replaceMathBracket?: (value: string) => string;
88
90
  }
89
91
  interface MarkdownBaseRef {
90
92
  stop: () => void;
@@ -114,35 +116,22 @@ declare const MarkdownCMD: React$1.ForwardRefExoticComponent<MarkdownCMDProps &
114
116
 
115
117
  declare const _default: React__default.NamedExoticComponent<MarkdownProps & React__default.RefAttributes<MarkdownBaseRef>>;
116
118
 
117
- interface ButtonProps {
119
+ interface ButtonProps$1 {
118
120
  className?: string;
119
121
  children?: React__default.ReactNode;
120
122
  icon?: React__default.ReactNode;
121
123
  onClick?: () => void;
122
124
  style?: React__default.CSSProperties;
125
+ disabled?: boolean;
123
126
  }
124
- declare const Button: React__default.FC<ButtonProps>;
127
+ declare const Button: React__default.FC<ButtonProps$1>;
125
128
 
126
- interface IconButtonProps {
129
+ interface IconButtonProps extends ButtonProps$1 {
127
130
  icon: React__default.ReactNode;
128
- style?: React__default.CSSProperties;
129
131
  className?: string;
130
- onClick?: () => void;
131
132
  }
132
133
  declare const IconButton: React__default.FC<IconButtonProps>;
133
134
 
134
- type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';
135
- interface ToolTipProps {
136
- title: React__default.ReactNode;
137
- children: React__default.ReactElement;
138
- position?: TooltipPosition;
139
- className?: string;
140
- style?: React__default.CSSProperties;
141
- showArrow?: boolean;
142
- delay?: number;
143
- }
144
- declare const ToolTip: React__default.ForwardRefExoticComponent<ToolTipProps & React__default.RefAttributes<HTMLElement>>;
145
-
146
135
  interface SegmentedItem {
147
136
  label: string;
148
137
  value: string;
@@ -154,6 +143,14 @@ interface SegmentedProps {
154
143
  }
155
144
  declare const Segmented: React__default.FC<SegmentedProps>;
156
145
 
146
+ type ButtonProps = React__default.ComponentProps<typeof Button>;
147
+ interface SuccessButtonProps extends Omit<ButtonProps, 'onClick'> {
148
+ children: React__default.ReactNode;
149
+ onClick: () => Promise<boolean>;
150
+ executeText?: string;
151
+ }
152
+ declare const SuccessButton: React__default.FC<SuccessButtonProps>;
153
+
157
154
  interface CopyButtonProps {
158
155
  codeContent?: string;
159
156
  style?: React__default.CSSProperties;
@@ -187,6 +184,39 @@ interface HighlightCodeProps {
187
184
  }
188
185
  declare const HighlightCode: React__default.FC<HighlightCodeProps>;
189
186
 
187
+ declare const CheckMarkIcon: React__default.FC<{
188
+ size: number;
189
+ }>;
190
+ declare const CopyIcon: React__default.FC<{
191
+ size: number;
192
+ }>;
193
+ declare const DownloadIcon: React__default.FC<{
194
+ size: number;
195
+ }>;
196
+
197
+ declare const zhCN: {
198
+ codeBlock: {
199
+ copy: string;
200
+ copied: string;
201
+ download: string;
202
+ downloaded: string;
203
+ };
204
+ mermaid: {
205
+ diagram: string;
206
+ code: string;
207
+ zoomOut: string;
208
+ zoomIn: string;
209
+ download: string;
210
+ fullScreen: string;
211
+ exitFullScreen: string;
212
+ downloadImage: string;
213
+ downloadedImage: string;
214
+ copyImage: string;
215
+ copiedImage: string;
216
+ };
217
+ };
218
+ type ZhCN = typeof zhCN;
219
+
190
220
  declare namespace Mermaid {
191
221
  /**
192
222
  * The font size to use
@@ -1701,12 +1731,24 @@ declare namespace Mermaid {
1701
1731
  }
1702
1732
  }
1703
1733
 
1704
- interface Locale {
1734
+ type Locale = ZhCN;
1735
+ interface ConfigProviderProps {
1736
+ locale?: Locale;
1737
+ mermaidConfig?: Mermaid.MermaidConfig;
1738
+ children: React__default.ReactNode;
1739
+ }
1740
+ interface ConfigContextType {
1741
+ locale: Locale;
1742
+ mermaidConfig?: Mermaid.MermaidConfig;
1743
+ }
1744
+ declare const ConfigProvider: React__default.FC<ConfigProviderProps>;
1745
+ declare const useConfig: () => ConfigContextType;
1746
+ declare const useLocale: () => {
1705
1747
  codeBlock: {
1706
1748
  copy: string;
1707
1749
  copied: string;
1708
1750
  download: string;
1709
- [key: string]: string;
1751
+ downloaded: string;
1710
1752
  };
1711
1753
  mermaid: {
1712
1754
  diagram: string;
@@ -1714,23 +1756,16 @@ interface Locale {
1714
1756
  zoomOut: string;
1715
1757
  zoomIn: string;
1716
1758
  download: string;
1759
+ fullScreen: string;
1760
+ exitFullScreen: string;
1761
+ downloadImage: string;
1762
+ downloadedImage: string;
1763
+ copyImage: string;
1764
+ copiedImage: string;
1717
1765
  };
1718
- [key: string]: unknown;
1719
- }
1720
- interface ConfigProviderProps {
1721
- locale?: Locale;
1722
- mermaidConfig?: Mermaid.MermaidConfig;
1723
- children: React__default.ReactNode;
1724
- }
1725
- interface ConfigContextType {
1726
- locale: Locale;
1727
- mermaidConfig?: Mermaid.MermaidConfig;
1728
- }
1729
- declare const ConfigProvider: React__default.FC<ConfigProviderProps>;
1730
- declare const useConfig: () => ConfigContextType;
1731
- declare const useLocale: () => Locale;
1766
+ };
1732
1767
 
1733
1768
  declare const useThemeState: () => IMarkdownThemeStateProps;
1734
1769
 
1735
- export { Button, CodeBlockActions, CodeBlockWrap, ConfigProvider, CopyButton, DownloadButton, HighlightCode, IconButton, _default as Markdown, MarkdownCMD, Segmented, ToolTip, _default as default, useConfig, useLocale, useThemeState };
1736
- export type { ConfigContextType, ConfigProviderProps, IMarkdownMath, ITypedChar, Locale, MarkdownCMDProps, MarkdownCMDRef, MarkdownProps, MarkdownRef };
1770
+ export { Button, CheckMarkIcon, CodeBlockActions, CodeBlockWrap, ConfigProvider, CopyButton, CopyIcon, DownloadButton, DownloadIcon, HighlightCode, IconButton, _default as Markdown, MarkdownCMD, Segmented, SuccessButton, _default as default, useConfig, useLocale, useThemeState };
1771
+ export type { ConfigContextType, ConfigProviderProps, IMarkdownMath, IMarkdownPlugin, ITypedChar, Locale, MarkdownCMDProps, MarkdownCMDRef, MarkdownProps, MarkdownRef };