@unif/react-native-chat-markdown 0.1.0 → 0.1.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.
Files changed (52) hide show
  1. package/README.md +103 -0
  2. package/lib/commonjs/index.js +41 -0
  3. package/lib/commonjs/index.js.map +1 -0
  4. package/lib/commonjs/markdown-bubble/MarkdownBubble.js +90 -0
  5. package/lib/commonjs/markdown-bubble/MarkdownBubble.js.map +1 -0
  6. package/lib/commonjs/markdown-bubble/index.md +61 -0
  7. package/lib/commonjs/package.json +1 -0
  8. package/lib/commonjs/streaming-bubble/StreamingBubble.js +64 -0
  9. package/lib/commonjs/streaming-bubble/StreamingBubble.js.map +1 -0
  10. package/lib/commonjs/streaming-bubble/index.md +47 -0
  11. package/lib/commonjs/think-block/ThinkBlock.js +92 -0
  12. package/lib/commonjs/think-block/ThinkBlock.js.map +1 -0
  13. package/lib/commonjs/think-block/index.md +57 -0
  14. package/lib/commonjs/utils/thinkTagParser.js +42 -0
  15. package/lib/commonjs/utils/thinkTagParser.js.map +1 -0
  16. package/lib/module/index.js +12 -0
  17. package/lib/module/index.js.map +1 -0
  18. package/lib/module/markdown-bubble/MarkdownBubble.js +84 -0
  19. package/lib/module/markdown-bubble/MarkdownBubble.js.map +1 -0
  20. package/lib/module/markdown-bubble/index.md +61 -0
  21. package/lib/module/package.json +1 -0
  22. package/lib/module/streaming-bubble/StreamingBubble.js +59 -0
  23. package/lib/module/streaming-bubble/StreamingBubble.js.map +1 -0
  24. package/lib/module/streaming-bubble/index.md +47 -0
  25. package/lib/module/think-block/ThinkBlock.js +87 -0
  26. package/lib/module/think-block/ThinkBlock.js.map +1 -0
  27. package/lib/module/think-block/index.md +57 -0
  28. package/lib/module/utils/thinkTagParser.js +37 -0
  29. package/lib/module/utils/thinkTagParser.js.map +1 -0
  30. package/lib/typescript/commonjs/index.d.ts +13 -0
  31. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  32. package/lib/typescript/commonjs/markdown-bubble/MarkdownBubble.d.ts +15 -0
  33. package/lib/typescript/commonjs/markdown-bubble/MarkdownBubble.d.ts.map +1 -0
  34. package/lib/typescript/commonjs/package.json +1 -0
  35. package/lib/typescript/commonjs/streaming-bubble/StreamingBubble.d.ts +16 -0
  36. package/lib/typescript/commonjs/streaming-bubble/StreamingBubble.d.ts.map +1 -0
  37. package/lib/typescript/commonjs/think-block/ThinkBlock.d.ts +24 -0
  38. package/lib/typescript/commonjs/think-block/ThinkBlock.d.ts.map +1 -0
  39. package/lib/typescript/commonjs/utils/thinkTagParser.d.ts +20 -0
  40. package/lib/typescript/commonjs/utils/thinkTagParser.d.ts.map +1 -0
  41. package/lib/typescript/module/index.d.ts +13 -0
  42. package/lib/typescript/module/index.d.ts.map +1 -0
  43. package/lib/typescript/module/markdown-bubble/MarkdownBubble.d.ts +15 -0
  44. package/lib/typescript/module/markdown-bubble/MarkdownBubble.d.ts.map +1 -0
  45. package/lib/typescript/module/package.json +1 -0
  46. package/lib/typescript/module/streaming-bubble/StreamingBubble.d.ts +16 -0
  47. package/lib/typescript/module/streaming-bubble/StreamingBubble.d.ts.map +1 -0
  48. package/lib/typescript/module/think-block/ThinkBlock.d.ts +24 -0
  49. package/lib/typescript/module/think-block/ThinkBlock.d.ts.map +1 -0
  50. package/lib/typescript/module/utils/thinkTagParser.d.ts +20 -0
  51. package/lib/typescript/module/utils/thinkTagParser.d.ts.map +1 -0
  52. package/package.json +41 -10
@@ -0,0 +1,24 @@
1
+ /**
2
+ * ThinkBlock — 思考折叠块
3
+ * 卡片式,圆角 12px
4
+ * 标题:🧠 已深度思考(展开) ▾
5
+ */
6
+ import React from 'react';
7
+ import { type ViewStyle, type TextStyle } from 'react-native';
8
+ export interface ThinkBlockSemanticStyles {
9
+ root?: ViewStyle;
10
+ header?: ViewStyle;
11
+ label?: TextStyle;
12
+ content?: TextStyle;
13
+ }
14
+ export interface ThinkBlockProps {
15
+ content: string;
16
+ defaultExpanded?: boolean;
17
+ label?: string;
18
+ style?: ViewStyle;
19
+ styles?: Partial<ThinkBlockSemanticStyles>;
20
+ testID?: string;
21
+ }
22
+ declare const _default: React.NamedExoticComponent<ThinkBlockProps>;
23
+ export default _default;
24
+ //# sourceMappingURL=ThinkBlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThinkBlock.d.ts","sourceRoot":"","sources":["../../../../src/think-block/ThinkBlock.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAiB,MAAM,OAAO,CAAC;AACtC,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,wBAAwB;IACvC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;AAgFD,wBAAsC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * <think> 标签解析器
3
+ * 将文本中的 <think>...</think> 提取出来,分离为普通内容和思考内容
4
+ */
5
+ export interface ParsedContent {
6
+ /** 去除 think 标签后的正文 */
7
+ body: string;
8
+ /** think 标签内的内容(可能多段) */
9
+ thinks: string[];
10
+ }
11
+ /**
12
+ * 解析文本中的 <think> 标签
13
+ * 支持多个 <think> 块,返回分离后的正文和思考内容
14
+ */
15
+ export declare function parseThinkTags(text: string): ParsedContent;
16
+ /**
17
+ * 检查文本中是否包含未闭合的 <think> 标签(流式场景)
18
+ */
19
+ export declare function hasUnclosedThink(text: string): boolean;
20
+ //# sourceMappingURL=thinkTagParser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thinkTagParser.d.ts","sourceRoot":"","sources":["../../../../src/utils/thinkTagParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,aAAa;IAC5B,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAID;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAa1D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAItD"}
package/package.json CHANGED
@@ -1,14 +1,24 @@
1
1
  {
2
2
  "name": "@unif/react-native-chat-markdown",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "UNIF React Native Chat Markdown — Markdown 渲染、ThinkBlock、流式气泡",
5
- "main": "./src/index.tsx",
6
- "types": "./src/index.tsx",
5
+ "main": "./lib/commonjs/index.js",
6
+ "module": "./lib/module/index.js",
7
+ "types": "./lib/typescript/commonjs/index.d.ts",
8
+ "react-native": "./src/index.tsx",
9
+ "source": "./src/index.tsx",
7
10
  "exports": {
8
11
  ".": {
9
12
  "source": "./src/index.tsx",
10
- "types": "./src/index.tsx",
11
- "default": "./src/index.tsx"
13
+ "react-native": "./src/index.tsx",
14
+ "import": {
15
+ "types": "./lib/typescript/module/index.d.ts",
16
+ "default": "./lib/module/index.js"
17
+ },
18
+ "require": {
19
+ "types": "./lib/typescript/commonjs/index.d.ts",
20
+ "default": "./lib/commonjs/index.js"
21
+ }
12
22
  },
13
23
  "./package.json": "./package.json"
14
24
  },
@@ -22,25 +32,46 @@
22
32
  "scripts": {
23
33
  "build": "bob build",
24
34
  "clean": "del-cli lib",
35
+ "prepublishOnly": "bob build",
25
36
  "typecheck": "tsc"
26
37
  },
27
- "keywords": ["react-native", "chat", "markdown", "streaming"],
38
+ "keywords": [
39
+ "react-native",
40
+ "chat",
41
+ "markdown",
42
+ "streaming"
43
+ ],
28
44
  "author": "qq382724935 <liulijun@pec.com.cn>",
29
45
  "license": "MIT",
30
46
  "publishConfig": {
31
47
  "registry": "https://registry.npmjs.org/"
32
48
  },
49
+ "devDependencies": {
50
+ "@ronradtke/react-native-markdown-display": "^8.0.0",
51
+ "typescript": "^5.9.2"
52
+ },
33
53
  "peerDependencies": {
54
+ "@ronradtke/react-native-markdown-display": ">=7.0.0",
34
55
  "react": "*",
35
- "react-native": "*",
36
- "@ronradtke/react-native-markdown-display": ">=7.0.0"
56
+ "react-native": "*"
37
57
  },
38
58
  "react-native-builder-bob": {
39
59
  "source": "src",
40
60
  "output": "lib",
41
61
  "targets": [
42
- ["module", { "esm": true }],
43
- ["typescript", { "project": "tsconfig.build.json" }]
62
+ "commonjs",
63
+ [
64
+ "module",
65
+ {
66
+ "esm": true
67
+ }
68
+ ],
69
+ [
70
+ "typescript",
71
+ {
72
+ "project": "tsconfig.build.json"
73
+ }
74
+ ]
44
75
  ]
45
76
  }
46
77
  }