react-markdown-typer 0.0.2 → 1.0.0-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 +8 -9
- package/README.zh.md +6 -9
- package/es/Markdown/index.d.ts +5 -0
- package/es/Markdown/index.d.ts.map +1 -0
- package/es/Markdown/index.js +65 -0
- package/es/Markdown/index.js.map +1 -0
- package/es/MarkdownCMD/index.d.ts +4 -0
- package/es/MarkdownCMD/index.d.ts.map +1 -0
- package/es/MarkdownCMD/index.js +162 -0
- package/es/MarkdownCMD/index.js.map +1 -0
- package/es/components/HighReactMarkdown/index.d.ts +9 -0
- package/es/components/HighReactMarkdown/index.d.ts.map +1 -0
- package/es/components/HighReactMarkdown/index.js +7 -0
- package/es/components/HighReactMarkdown/index.js.map +1 -0
- package/es/constant.d.ts +4 -0
- package/es/constant.d.ts.map +1 -0
- package/es/constant.js +4 -0
- package/es/constant.js.map +1 -0
- package/es/defined.d.ts +113 -0
- package/es/defined.d.ts.map +1 -0
- package/es/defined.js +2 -0
- package/es/defined.js.map +1 -0
- package/es/hooks/useTypingTask.d.ts +32 -0
- package/es/hooks/useTypingTask.d.ts.map +1 -0
- package/{dist/esm/index.js → es/hooks/useTypingTask.js} +63 -267
- package/es/hooks/useTypingTask.js.map +1 -0
- package/es/index.d.ts +7 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +5 -0
- package/es/index.js.map +1 -0
- package/es/utils/grapheme.d.ts +2 -0
- package/es/utils/grapheme.d.ts.map +1 -0
- package/es/utils/grapheme.js +4 -0
- package/es/utils/grapheme.js.map +1 -0
- package/package.json +11 -15
- package/dist/cjs/index.d.ts +0 -77
- package/dist/cjs/index.js +0 -570
- package/dist/cjs/index.js.map +0 -1
- package/dist/esm/index.d.ts +0 -77
- package/dist/esm/index.js.map +0 -1
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import ReactMarkdown from 'react-markdown';
|
|
4
|
-
|
|
5
|
-
const __DEV__ = process.env.NODE_ENV === 'development';
|
|
6
|
-
|
|
7
|
-
const useTypingTask = (options) => {
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
export const useTypingTask = (options) => {
|
|
8
3
|
const { timerType = 'setTimeout', interval, charsRef, onEnd, onStart, onBeforeTypedChar, onTypedChar, processCharDisplay, wholeContentRef, disableTyping, triggerUpdate, resetWholeContent, } = options;
|
|
9
4
|
/** 是否卸载 */
|
|
10
5
|
const isUnmountRef = useRef(false);
|
|
@@ -22,6 +17,54 @@ const useTypingTask = (options) => {
|
|
|
22
17
|
disableTypingRef.current = disableTyping;
|
|
23
18
|
const intervalRef = useRef(interval);
|
|
24
19
|
intervalRef.current = interval;
|
|
20
|
+
// 记录本次打字任务的初始/最高剩余字符总量,用于计算剩余占比(流式追加时会增大)
|
|
21
|
+
const initialRemainTotalRef = useRef(0);
|
|
22
|
+
/**
|
|
23
|
+
* 根据剩余字符数与曲线配置,计算当前打字间隔(毫秒)
|
|
24
|
+
*/
|
|
25
|
+
const getCurrentInterval = (remainCharsLength) => {
|
|
26
|
+
const cfg = intervalRef.current;
|
|
27
|
+
if (typeof cfg === 'number')
|
|
28
|
+
return cfg;
|
|
29
|
+
// 动态更新初始参考总量,考虑流式场景新增字符
|
|
30
|
+
if (remainCharsLength > initialRemainTotalRef.current) {
|
|
31
|
+
initialRemainTotalRef.current = remainCharsLength;
|
|
32
|
+
}
|
|
33
|
+
const baseTotal = initialRemainTotalRef.current || remainCharsLength || 1;
|
|
34
|
+
// r: 剩余占比 [0,1],越大表示剩余越多
|
|
35
|
+
const r = Math.max(0, Math.min(1, remainCharsLength / baseTotal));
|
|
36
|
+
// 曲线函数(优先使用自定义)
|
|
37
|
+
const pickCurveFn = () => {
|
|
38
|
+
if (typeof cfg.curveFn === 'function')
|
|
39
|
+
return cfg.curveFn;
|
|
40
|
+
switch (cfg.curve) {
|
|
41
|
+
case 'linear':
|
|
42
|
+
return (x) => x;
|
|
43
|
+
case 'ease-in':
|
|
44
|
+
return (x) => x * x; // 加速慢起
|
|
45
|
+
case 'ease-out':
|
|
46
|
+
return (x) => 1 - (1 - x) * (1 - x); // 减速快止
|
|
47
|
+
case 'ease-in-out':
|
|
48
|
+
return (x) => (x < 0.5 ? 2 * x * x : 1 - Math.pow(-2 * x + 2, 2) / 2);
|
|
49
|
+
case 'step-start':
|
|
50
|
+
return (x) => (x > 0 ? 1 : 0);
|
|
51
|
+
case 'step-end':
|
|
52
|
+
return (x) => (x < 1 ? 0 : 1);
|
|
53
|
+
case 'ease':
|
|
54
|
+
default:
|
|
55
|
+
// 近似通用 ease
|
|
56
|
+
return (x) => 1 - Math.pow(1 - x, 1.6);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const curveFn = pickCurveFn();
|
|
60
|
+
const y = curveFn(r); // y ∈ [0,1],随 r 增大而增大
|
|
61
|
+
// 设计:剩余越多 => 越快(更小的间隔)。
|
|
62
|
+
// interval = min + (max - min) * (1 - y)
|
|
63
|
+
const min = Math.max(0, cfg.min);
|
|
64
|
+
const max = Math.max(min, cfg.max);
|
|
65
|
+
const intervalMs = min + (max - min) * (1 - y);
|
|
66
|
+
return intervalMs;
|
|
67
|
+
};
|
|
25
68
|
const getChars = () => {
|
|
26
69
|
return charsRef.current;
|
|
27
70
|
};
|
|
@@ -29,7 +72,6 @@ const useTypingTask = (options) => {
|
|
|
29
72
|
isUnmountRef.current = false;
|
|
30
73
|
return () => {
|
|
31
74
|
isUnmountRef.current = true;
|
|
32
|
-
clearTimer();
|
|
33
75
|
};
|
|
34
76
|
}, []);
|
|
35
77
|
/**
|
|
@@ -51,12 +93,13 @@ const useTypingTask = (options) => {
|
|
|
51
93
|
* 触发打字结束回调
|
|
52
94
|
*/
|
|
53
95
|
const triggerOnEnd = (data) => {
|
|
96
|
+
var _a;
|
|
54
97
|
if (!onEnd) {
|
|
55
98
|
return;
|
|
56
99
|
}
|
|
57
100
|
onEnd({
|
|
58
101
|
str: wholeContentRef.current.content,
|
|
59
|
-
manual: data
|
|
102
|
+
manual: (_a = data === null || data === void 0 ? void 0 : data.manual) !== null && _a !== void 0 ? _a : false,
|
|
60
103
|
});
|
|
61
104
|
};
|
|
62
105
|
/**
|
|
@@ -130,12 +173,12 @@ const useTypingTask = (options) => {
|
|
|
130
173
|
const chars = getChars();
|
|
131
174
|
const answerCharsStr = chars.map((char) => char.content).join('');
|
|
132
175
|
if (answerCharsStr) {
|
|
133
|
-
await onBeforeTypedChar
|
|
176
|
+
await (onBeforeTypedChar === null || onBeforeTypedChar === void 0 ? void 0 : onBeforeTypedChar({
|
|
134
177
|
currentIndex: wholeContentRef.current.length,
|
|
135
178
|
currentChar: answerCharsStr,
|
|
136
179
|
prevStr: wholeContentRef.current.content,
|
|
137
180
|
percent: 100,
|
|
138
|
-
});
|
|
181
|
+
}));
|
|
139
182
|
}
|
|
140
183
|
wholeContentRef.current.content += answerCharsStr;
|
|
141
184
|
wholeContentRef.current.prevLength = wholeContentRef.current.length;
|
|
@@ -149,20 +192,21 @@ const useTypingTask = (options) => {
|
|
|
149
192
|
const startAnimationFrameMode = () => {
|
|
150
193
|
let lastFrameTime = performance.now();
|
|
151
194
|
const frameLoop = async (currentTime) => {
|
|
195
|
+
if (isUnmountRef.current)
|
|
196
|
+
return;
|
|
152
197
|
// 如果关闭打字机效果,则打完所有字符
|
|
153
198
|
if (disableTypingRef.current) {
|
|
154
199
|
await typingRemainAll();
|
|
155
200
|
return;
|
|
156
201
|
}
|
|
157
202
|
const chars = getChars();
|
|
158
|
-
if (isUnmountRef.current)
|
|
159
|
-
return;
|
|
160
203
|
if (chars.length === 0) {
|
|
161
204
|
stopAnimationFrame();
|
|
162
205
|
return;
|
|
163
206
|
}
|
|
164
207
|
const deltaTime = currentTime - lastFrameTime;
|
|
165
|
-
|
|
208
|
+
const currentInterval = getCurrentInterval(chars.length);
|
|
209
|
+
let needToTypingCharsLength = Math.max(0, Math.floor(deltaTime / currentInterval));
|
|
166
210
|
needToTypingCharsLength = Math.min(needToTypingCharsLength, chars.length);
|
|
167
211
|
if (needToTypingCharsLength > 0) {
|
|
168
212
|
// 处理字符
|
|
@@ -216,17 +260,18 @@ const useTypingTask = (options) => {
|
|
|
216
260
|
stopTimeout();
|
|
217
261
|
return;
|
|
218
262
|
}
|
|
219
|
-
|
|
263
|
+
const currentInterval = getCurrentInterval(chars.length);
|
|
264
|
+
timerRef.current = setTimeout(startTyped, currentInterval);
|
|
220
265
|
};
|
|
221
266
|
const startTyped = async (isStartPoint = false) => {
|
|
267
|
+
if (isUnmountRef.current)
|
|
268
|
+
return;
|
|
222
269
|
// 如果关闭打字机效果,则打完所有字符
|
|
223
270
|
if (disableTypingRef.current) {
|
|
224
271
|
typingRemainAll();
|
|
225
272
|
return;
|
|
226
273
|
}
|
|
227
274
|
const chars = getChars();
|
|
228
|
-
if (isUnmountRef.current)
|
|
229
|
-
return;
|
|
230
275
|
isTypingRef.current = true;
|
|
231
276
|
const char = chars.shift();
|
|
232
277
|
if (char === undefined) {
|
|
@@ -312,253 +357,4 @@ const useTypingTask = (options) => {
|
|
|
312
357
|
typedIsManualStopRef,
|
|
313
358
|
};
|
|
314
359
|
};
|
|
315
|
-
|
|
316
|
-
const replaceMathBracket = (value) => {
|
|
317
|
-
// Extract all block-level formula content, temporarily replace with placeholder, [...]
|
|
318
|
-
const blockMatches = [];
|
|
319
|
-
let replaced = value.replace(/\\*\[([\s\S]+?)\\*\]/g, (_m, p1) => {
|
|
320
|
-
blockMatches.push(p1);
|
|
321
|
-
return `__BLOCK_MATH_${blockMatches.length - 1}__`;
|
|
322
|
-
});
|
|
323
|
-
// Extract all inline formula content, temporarily replace with placeholder, [...]
|
|
324
|
-
replaced = replaced.replace(/\$\$([\s\S]+?)\$\$/g, (_m, p1) => {
|
|
325
|
-
blockMatches.push(p1);
|
|
326
|
-
return `__BLOCK_MATH_${blockMatches.length - 1}__`;
|
|
327
|
-
});
|
|
328
|
-
// Replace ( ... ) outside the block-level formula with $...$
|
|
329
|
-
replaced = replaced.replace(/\\*\(([^)]+?)\\*\)/g, (_m, p1) => {
|
|
330
|
-
return '$' + p1 + '$';
|
|
331
|
-
});
|
|
332
|
-
// Restore block-level formula content, keep the original parentheses inside
|
|
333
|
-
replaced = replaced.replace(/__BLOCK_MATH_(\d+)__/g, (_m, idx) => {
|
|
334
|
-
return '$$' + blockMatches[Number(idx)] + '$$';
|
|
335
|
-
});
|
|
336
|
-
return replaced;
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
const HighReactMarkdown = ({ reactMarkdownProps, children: _children, math }) => {
|
|
340
|
-
const mathSplitSymbol = math?.splitSymbol ?? 'dollar';
|
|
341
|
-
const children = useMemo(() => {
|
|
342
|
-
/** 如果存在数学公式插件,并且数学公式分隔符为括号,则替换成 $ 符号 */
|
|
343
|
-
if (mathSplitSymbol === 'bracket') {
|
|
344
|
-
return replaceMathBracket(_children);
|
|
345
|
-
}
|
|
346
|
-
return _children;
|
|
347
|
-
}, [mathSplitSymbol, _children]);
|
|
348
|
-
return jsx(ReactMarkdown, { ...reactMarkdownProps, children: children });
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
const MarkdownCMD = forwardRef(({ interval = 30, onEnd, onStart, onTypedChar, onBeforeTypedChar, timerType = 'setTimeout', math, reactMarkdownProps, disableTyping = false, autoStartTyping = true }, ref) => {
|
|
352
|
-
/** 是否自动开启打字动画, 后面发生变化将不会生效 */
|
|
353
|
-
const autoStartTypingRef = useRef(autoStartTyping);
|
|
354
|
-
/** 是否打过字 */
|
|
355
|
-
const isStartedTypingRef = useRef(false);
|
|
356
|
-
/** 当前需要打字的内容 */
|
|
357
|
-
const charsRef = useRef([]);
|
|
358
|
-
/**
|
|
359
|
-
* 打字是否已经完全结束
|
|
360
|
-
* 如果打字已经完全结束,则不会再触发打字效果
|
|
361
|
-
*/
|
|
362
|
-
const isWholeTypedEndRef = useRef(false);
|
|
363
|
-
const charIndexRef = useRef(0);
|
|
364
|
-
/** 整个内容引用 */
|
|
365
|
-
const wholeContentRef = useRef({
|
|
366
|
-
content: '',
|
|
367
|
-
length: 0,
|
|
368
|
-
prevLength: 0,
|
|
369
|
-
});
|
|
370
|
-
const [, setUpdate] = useState(0);
|
|
371
|
-
const triggerUpdate = () => {
|
|
372
|
-
setUpdate((prev) => prev + 1);
|
|
373
|
-
};
|
|
374
|
-
/**
|
|
375
|
-
* 处理字符显示逻辑
|
|
376
|
-
*/
|
|
377
|
-
const processCharDisplay = (char) => {
|
|
378
|
-
if (!isStartedTypingRef.current) {
|
|
379
|
-
isStartedTypingRef.current = true;
|
|
380
|
-
}
|
|
381
|
-
wholeContentRef.current.prevLength = wholeContentRef.current.length;
|
|
382
|
-
wholeContentRef.current.content += char.content;
|
|
383
|
-
wholeContentRef.current.length += char.content.length;
|
|
384
|
-
triggerUpdate();
|
|
385
|
-
};
|
|
386
|
-
const resetWholeContent = () => {
|
|
387
|
-
wholeContentRef.current.content = '';
|
|
388
|
-
wholeContentRef.current.length = 0;
|
|
389
|
-
wholeContentRef.current.prevLength = 0;
|
|
390
|
-
};
|
|
391
|
-
// 使用新的打字任务 hook
|
|
392
|
-
const typingTask = useTypingTask({
|
|
393
|
-
timerType,
|
|
394
|
-
interval,
|
|
395
|
-
charsRef,
|
|
396
|
-
onEnd,
|
|
397
|
-
onStart,
|
|
398
|
-
onTypedChar,
|
|
399
|
-
onBeforeTypedChar,
|
|
400
|
-
processCharDisplay,
|
|
401
|
-
wholeContentRef,
|
|
402
|
-
disableTyping,
|
|
403
|
-
triggerUpdate,
|
|
404
|
-
resetWholeContent,
|
|
405
|
-
});
|
|
406
|
-
/**
|
|
407
|
-
* 内部推送处理逻辑
|
|
408
|
-
*/
|
|
409
|
-
const processHasTypingPush = (content) => {
|
|
410
|
-
if (content.length === 0) {
|
|
411
|
-
return;
|
|
412
|
-
}
|
|
413
|
-
charsRef.current.push(...content.split('').map((chatStr) => {
|
|
414
|
-
const index = charIndexRef.current++;
|
|
415
|
-
const charObj = {
|
|
416
|
-
content: chatStr,
|
|
417
|
-
tokenId: 0,
|
|
418
|
-
index,
|
|
419
|
-
};
|
|
420
|
-
return charObj;
|
|
421
|
-
}));
|
|
422
|
-
// 如果关闭了自动打字, 并且没有打过字, 则不开启打字动画
|
|
423
|
-
if (!autoStartTypingRef.current && !isStartedTypingRef.current) {
|
|
424
|
-
return;
|
|
425
|
-
}
|
|
426
|
-
if (!typingTask.isTyping()) {
|
|
427
|
-
typingTask.start();
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
const processNoTypingPush = (content) => {
|
|
431
|
-
wholeContentRef.current.content += content;
|
|
432
|
-
// 记录打字前的长度
|
|
433
|
-
wholeContentRef.current.prevLength = wholeContentRef.current.length;
|
|
434
|
-
wholeContentRef.current.length += content.length;
|
|
435
|
-
triggerUpdate();
|
|
436
|
-
onEnd?.({
|
|
437
|
-
str: content,
|
|
438
|
-
manual: false,
|
|
439
|
-
});
|
|
440
|
-
};
|
|
441
|
-
useImperativeHandle(ref, () => ({
|
|
442
|
-
/**
|
|
443
|
-
* 添加内容
|
|
444
|
-
* @param content 内容 {string}
|
|
445
|
-
* @param answerType 回答类型 {AnswerType}
|
|
446
|
-
*/
|
|
447
|
-
push: (content) => {
|
|
448
|
-
if (disableTyping) {
|
|
449
|
-
processNoTypingPush(content);
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
processHasTypingPush(content);
|
|
453
|
-
},
|
|
454
|
-
/**
|
|
455
|
-
* 清除打字任务
|
|
456
|
-
*/
|
|
457
|
-
clear: () => {
|
|
458
|
-
typingTask.stop();
|
|
459
|
-
typingTask.typedIsManualStopRef.current = false;
|
|
460
|
-
charsRef.current = [];
|
|
461
|
-
resetWholeContent();
|
|
462
|
-
isWholeTypedEndRef.current = false;
|
|
463
|
-
charIndexRef.current = 0;
|
|
464
|
-
isStartedTypingRef.current = false;
|
|
465
|
-
triggerUpdate();
|
|
466
|
-
},
|
|
467
|
-
/** 开启打字,只有在关闭了自动打字才生效 */
|
|
468
|
-
start: () => {
|
|
469
|
-
if (!autoStartTypingRef.current) {
|
|
470
|
-
typingTask.start();
|
|
471
|
-
}
|
|
472
|
-
},
|
|
473
|
-
/** 停止打字任务 */
|
|
474
|
-
stop: () => {
|
|
475
|
-
typingTask.stop();
|
|
476
|
-
},
|
|
477
|
-
/** 重新开始打字任务 */
|
|
478
|
-
resume: () => {
|
|
479
|
-
typingTask.resume();
|
|
480
|
-
},
|
|
481
|
-
/**
|
|
482
|
-
* 主动触发打字结束
|
|
483
|
-
*/
|
|
484
|
-
triggerWholeEnd: () => {
|
|
485
|
-
isWholeTypedEndRef.current = true;
|
|
486
|
-
if (!typingTask.isTyping()) {
|
|
487
|
-
// 这里需要手动触发结束回调,因为 hook 中的 triggerOnEnd 不能直接调用
|
|
488
|
-
onEnd?.({
|
|
489
|
-
str: wholeContentRef.current.content,
|
|
490
|
-
manual: true,
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
},
|
|
494
|
-
/** 重新开始打字任务 */
|
|
495
|
-
restart: () => {
|
|
496
|
-
typingTask.restart();
|
|
497
|
-
},
|
|
498
|
-
}));
|
|
499
|
-
return (jsx(HighReactMarkdown, { reactMarkdownProps: reactMarkdownProps, math: math, children: wholeContentRef.current.content }));
|
|
500
|
-
});
|
|
501
|
-
if (__DEV__) {
|
|
502
|
-
MarkdownCMD.displayName = 'MarkdownCMD';
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
const MarkdownInner = ({ children: _children = '', markdownRef, ...rest }) => {
|
|
506
|
-
const cmdRef = useRef(null);
|
|
507
|
-
const prefixRef = useRef('');
|
|
508
|
-
const content = useMemo(() => {
|
|
509
|
-
if (typeof _children === 'string') {
|
|
510
|
-
return _children;
|
|
511
|
-
}
|
|
512
|
-
if (__DEV__) {
|
|
513
|
-
console.error('Markdown component must have a string child');
|
|
514
|
-
}
|
|
515
|
-
return '';
|
|
516
|
-
}, [_children]);
|
|
517
|
-
useEffect(() => {
|
|
518
|
-
if (prefixRef.current !== content) {
|
|
519
|
-
let newContent = '';
|
|
520
|
-
if (prefixRef.current === '') {
|
|
521
|
-
newContent = content;
|
|
522
|
-
}
|
|
523
|
-
else {
|
|
524
|
-
if (content.startsWith(prefixRef.current)) {
|
|
525
|
-
newContent = content.slice(prefixRef.current.length);
|
|
526
|
-
}
|
|
527
|
-
else {
|
|
528
|
-
newContent = content;
|
|
529
|
-
cmdRef.current.clear();
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
cmdRef.current.push(newContent);
|
|
533
|
-
prefixRef.current = content;
|
|
534
|
-
}
|
|
535
|
-
}, [content]);
|
|
536
|
-
useImperativeHandle(markdownRef, () => ({
|
|
537
|
-
stop: () => {
|
|
538
|
-
cmdRef.current.stop();
|
|
539
|
-
},
|
|
540
|
-
resume: () => {
|
|
541
|
-
cmdRef.current.resume();
|
|
542
|
-
},
|
|
543
|
-
start: () => {
|
|
544
|
-
cmdRef.current.start();
|
|
545
|
-
},
|
|
546
|
-
restart: () => {
|
|
547
|
-
cmdRef.current.restart();
|
|
548
|
-
},
|
|
549
|
-
}));
|
|
550
|
-
return jsx(MarkdownCMD, { ref: cmdRef, ...rest });
|
|
551
|
-
};
|
|
552
|
-
const Markdown = forwardRef((props, ref) => {
|
|
553
|
-
const { children = '' } = props;
|
|
554
|
-
if (__DEV__) {
|
|
555
|
-
if (typeof children !== 'string') {
|
|
556
|
-
throw new Error('Markdown component must have a string child');
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
return jsx(MarkdownInner, { ...props, markdownRef: ref });
|
|
560
|
-
});
|
|
561
|
-
var Markdown$1 = memo(Markdown);
|
|
562
|
-
|
|
563
|
-
export { Markdown$1 as Markdown, MarkdownCMD, Markdown$1 as default };
|
|
564
|
-
//# sourceMappingURL=index.js.map
|
|
360
|
+
//# sourceMappingURL=useTypingTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTypingTask.js","sourceRoot":"","sources":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C,CAAC"}
|
package/es/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import MarkdownCMD from './MarkdownCMD';
|
|
2
|
+
import Markdown from './Markdown';
|
|
3
|
+
import type { MarkdownCMDRef, MarkdownRef, IMarkdownMath, ITypedChar, MarkdownProps, MarkdownCMDProps } from './defined';
|
|
4
|
+
export default Markdown;
|
|
5
|
+
export type { MarkdownCMDRef, MarkdownRef, IMarkdownMath, ITypedChar, MarkdownProps, MarkdownCMDProps };
|
|
6
|
+
export { Markdown, MarkdownCMD };
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEzH,eAAe,QAAQ,CAAC;AACxB,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC;AACxG,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC"}
|
package/es/index.js
ADDED
package/es/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC,eAAe,QAAQ,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grapheme.d.ts","sourceRoot":"","sources":["../../src/utils/grapheme.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAEtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grapheme.js","sourceRoot":"","sources":["../../src/utils/grapheme.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-markdown-typer",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.2",
|
|
5
|
-
"main": "./
|
|
6
|
-
"types": "./
|
|
7
|
-
"module": "./dist/esm/index.js",
|
|
8
|
-
"style": "./dist/style.css",
|
|
4
|
+
"version": "1.0.0-beta.2",
|
|
5
|
+
"main": "./es/index.js",
|
|
6
|
+
"types": "./es/index.d.ts",
|
|
9
7
|
"type": "module",
|
|
10
8
|
"license": "MIT",
|
|
11
9
|
"repository": {
|
|
@@ -17,24 +15,20 @@
|
|
|
17
15
|
},
|
|
18
16
|
"exports": {
|
|
19
17
|
".": {
|
|
20
|
-
"browser": "./dist/esm/index.js",
|
|
21
18
|
"import": {
|
|
22
|
-
"types": "./
|
|
23
|
-
"default": "./
|
|
19
|
+
"types": "./es/index.d.ts",
|
|
20
|
+
"default": "./es/index.js"
|
|
24
21
|
},
|
|
25
|
-
"
|
|
26
|
-
"types": "./dist/cjs/index.d.ts",
|
|
27
|
-
"default": "./dist/cjs/index.js"
|
|
28
|
-
}
|
|
22
|
+
"default": "./es/index.js"
|
|
29
23
|
}
|
|
30
24
|
},
|
|
31
25
|
"files": [
|
|
32
|
-
"
|
|
26
|
+
"es"
|
|
33
27
|
],
|
|
34
28
|
"scripts": {
|
|
35
29
|
"dev": "vite",
|
|
36
30
|
"build:docs": "rimraf docs && vite build",
|
|
37
|
-
"build": "
|
|
31
|
+
"build": "node scripts/build-lib-ts.js",
|
|
38
32
|
"lint": "eslint .",
|
|
39
33
|
"preview": "vite preview",
|
|
40
34
|
"release": "npm run build && node scripts/set-tag.cjs && cross-env RELEASE_MODE=true npm publish",
|
|
@@ -65,6 +59,8 @@
|
|
|
65
59
|
"@types/react-dom": "^19.1.2",
|
|
66
60
|
"@types/react-syntax-highlighter": "^15.5.13",
|
|
67
61
|
"@vitejs/plugin-react": "^4.4.1",
|
|
62
|
+
"fs-extra": "^11.3.0",
|
|
63
|
+
"glob": "^11.0.3",
|
|
68
64
|
"babel-jest": "^29.0.0",
|
|
69
65
|
"cross-env": "^7.0.3",
|
|
70
66
|
"eslint": "^9.25.0",
|
|
@@ -116,6 +112,6 @@
|
|
|
116
112
|
"react-markdown"
|
|
117
113
|
],
|
|
118
114
|
"publishConfig": {
|
|
119
|
-
"tag": "
|
|
115
|
+
"tag": "beta"
|
|
120
116
|
}
|
|
121
117
|
}
|
package/dist/cjs/index.d.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import react__default from 'react';
|
|
3
|
-
import { Options } from 'react-markdown';
|
|
4
|
-
|
|
5
|
-
interface IOnTypedCharData {
|
|
6
|
-
currentIndex: number;
|
|
7
|
-
currentChar: string;
|
|
8
|
-
prevStr: string;
|
|
9
|
-
}
|
|
10
|
-
interface ITypedChar extends IOnTypedCharData {
|
|
11
|
-
percent: number;
|
|
12
|
-
currentStr: string;
|
|
13
|
-
}
|
|
14
|
-
interface IBeforeTypedChar extends IOnTypedCharData {
|
|
15
|
-
percent: number;
|
|
16
|
-
}
|
|
17
|
-
interface MarkdownBaseProps {
|
|
18
|
-
reactMarkdownProps?: Options;
|
|
19
|
-
/** 计时类型: 支持setTimeout和requestAnimationFrame */
|
|
20
|
-
timerType?: 'setTimeout' | 'requestAnimationFrame';
|
|
21
|
-
/** 打字机效果间隔时间 */
|
|
22
|
-
interval: number;
|
|
23
|
-
/** 是否关闭打字机效果 */
|
|
24
|
-
disableTyping?: boolean;
|
|
25
|
-
/** 打字完成后回调, */
|
|
26
|
-
onEnd?: (data?: IEndData) => void;
|
|
27
|
-
/** 开始打字回调 */
|
|
28
|
-
onStart?: (data?: IOnTypedCharData) => void;
|
|
29
|
-
/** 打字前回调 */
|
|
30
|
-
onBeforeTypedChar?: (data?: IBeforeTypedChar) => Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* 打字机打完一个字符回调
|
|
33
|
-
* @param char 字符
|
|
34
|
-
* @param index 字符索引
|
|
35
|
-
*/
|
|
36
|
-
onTypedChar?: (data?: ITypedChar) => void;
|
|
37
|
-
/** 是否自动开启打字动画 */
|
|
38
|
-
autoStartTyping?: boolean;
|
|
39
|
-
math?: IMarkdownMath;
|
|
40
|
-
}
|
|
41
|
-
interface MarkdownProps extends MarkdownBaseProps {
|
|
42
|
-
children: string | undefined;
|
|
43
|
-
}
|
|
44
|
-
/** MarkdownCMD 组件不需要 children */
|
|
45
|
-
interface MarkdownCMDProps extends MarkdownBaseProps {
|
|
46
|
-
children?: undefined;
|
|
47
|
-
}
|
|
48
|
-
interface IMarkdownMath {
|
|
49
|
-
/** 是括号还是$作为分隔符, 默认是$ */
|
|
50
|
-
splitSymbol: 'bracket' | 'dollar';
|
|
51
|
-
}
|
|
52
|
-
interface MarkdownBaseRef {
|
|
53
|
-
stop: () => void;
|
|
54
|
-
resume: () => void;
|
|
55
|
-
start: () => void;
|
|
56
|
-
restart: () => void;
|
|
57
|
-
}
|
|
58
|
-
/** Markdown 组件的ref 类型 */
|
|
59
|
-
type MarkdownRef = MarkdownBaseRef;
|
|
60
|
-
/** MarkdownCMD 组件的 ref 类型 */
|
|
61
|
-
interface MarkdownCMDRef extends MarkdownBaseRef {
|
|
62
|
-
push: (content: string) => void;
|
|
63
|
-
clear: () => void;
|
|
64
|
-
triggerWholeEnd: () => void;
|
|
65
|
-
}
|
|
66
|
-
interface IEndData {
|
|
67
|
-
manual: boolean;
|
|
68
|
-
/** 打字机打过的字符串, 和answerStr 相同 */
|
|
69
|
-
str: string;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
declare const MarkdownCMD: react.ForwardRefExoticComponent<MarkdownCMDProps & react.RefAttributes<MarkdownCMDRef>>;
|
|
73
|
-
|
|
74
|
-
declare const _default: react__default.NamedExoticComponent<MarkdownProps & react__default.RefAttributes<MarkdownBaseRef>>;
|
|
75
|
-
|
|
76
|
-
export { _default as Markdown, MarkdownCMD, _default as default };
|
|
77
|
-
export type { IMarkdownMath, ITypedChar, MarkdownCMDProps, MarkdownCMDRef, MarkdownProps, MarkdownRef };
|