@unif/react-native-chat 0.1.1 → 0.2.0

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 (97) hide show
  1. package/lib/commonjs/bubble/Bubble.js +131 -0
  2. package/lib/commonjs/bubble/Bubble.js.map +1 -0
  3. package/lib/commonjs/bubble/BubbleList.js +73 -0
  4. package/lib/commonjs/bubble/BubbleList.js.map +1 -0
  5. package/lib/commonjs/bubble/index.md +111 -0
  6. package/lib/commonjs/card-wrapper/CardWrapper.js +65 -0
  7. package/lib/commonjs/card-wrapper/CardWrapper.js.map +1 -0
  8. package/lib/commonjs/card-wrapper/index.md +78 -0
  9. package/lib/commonjs/conversations/Conversations.js +184 -0
  10. package/lib/commonjs/conversations/Conversations.js.map +1 -0
  11. package/lib/commonjs/conversations/index.md +90 -0
  12. package/lib/commonjs/index.js +69 -0
  13. package/lib/commonjs/index.js.map +1 -0
  14. package/lib/commonjs/package.json +1 -0
  15. package/lib/commonjs/prompts/Prompts.js +87 -0
  16. package/lib/commonjs/prompts/Prompts.js.map +1 -0
  17. package/lib/commonjs/prompts/index.md +81 -0
  18. package/lib/commonjs/sender/Sender.js +352 -0
  19. package/lib/commonjs/sender/Sender.js.map +1 -0
  20. package/lib/commonjs/sender/index.md +131 -0
  21. package/lib/commonjs/theme/tokens.js +77 -0
  22. package/lib/commonjs/theme/tokens.js.map +1 -0
  23. package/lib/commonjs/types/react-native-vector-icons.d.js +2 -0
  24. package/lib/commonjs/types/react-native-vector-icons.d.js.map +1 -0
  25. package/lib/commonjs/welcome/Welcome.js +152 -0
  26. package/lib/commonjs/welcome/Welcome.js.map +1 -0
  27. package/lib/commonjs/welcome/index.md +95 -0
  28. package/lib/module/bubble/Bubble.js +126 -0
  29. package/lib/module/bubble/Bubble.js.map +1 -0
  30. package/lib/module/bubble/BubbleList.js +68 -0
  31. package/lib/module/bubble/BubbleList.js.map +1 -0
  32. package/lib/module/bubble/index.md +111 -0
  33. package/lib/module/card-wrapper/CardWrapper.js +60 -0
  34. package/lib/module/card-wrapper/CardWrapper.js.map +1 -0
  35. package/lib/module/card-wrapper/index.md +78 -0
  36. package/lib/module/conversations/Conversations.js +179 -0
  37. package/lib/module/conversations/Conversations.js.map +1 -0
  38. package/lib/module/conversations/index.md +90 -0
  39. package/lib/module/index.js +23 -0
  40. package/lib/module/index.js.map +1 -0
  41. package/lib/module/package.json +1 -0
  42. package/lib/module/prompts/Prompts.js +82 -0
  43. package/lib/module/prompts/Prompts.js.map +1 -0
  44. package/lib/module/prompts/index.md +81 -0
  45. package/lib/module/sender/Sender.js +346 -0
  46. package/lib/module/sender/Sender.js.map +1 -0
  47. package/lib/module/sender/index.md +131 -0
  48. package/lib/module/theme/tokens.js +72 -0
  49. package/lib/module/theme/tokens.js.map +1 -0
  50. package/lib/module/types/react-native-vector-icons.d.js +2 -0
  51. package/lib/module/types/react-native-vector-icons.d.js.map +1 -0
  52. package/lib/module/welcome/Welcome.js +147 -0
  53. package/lib/module/welcome/Welcome.js.map +1 -0
  54. package/lib/module/welcome/index.md +95 -0
  55. package/lib/typescript/commonjs/bubble/Bubble.d.ts +29 -0
  56. package/lib/typescript/commonjs/bubble/Bubble.d.ts.map +1 -0
  57. package/lib/typescript/commonjs/bubble/BubbleList.d.ts +20 -0
  58. package/lib/typescript/commonjs/bubble/BubbleList.d.ts.map +1 -0
  59. package/lib/typescript/commonjs/card-wrapper/CardWrapper.d.ts +22 -0
  60. package/lib/typescript/commonjs/card-wrapper/CardWrapper.d.ts.map +1 -0
  61. package/lib/typescript/commonjs/conversations/Conversations.d.ts +37 -0
  62. package/lib/typescript/commonjs/conversations/Conversations.d.ts.map +1 -0
  63. package/lib/typescript/commonjs/index.d.ts +20 -0
  64. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  65. package/lib/typescript/commonjs/package.json +1 -0
  66. package/lib/typescript/commonjs/prompts/Prompts.d.ts +27 -0
  67. package/lib/typescript/commonjs/prompts/Prompts.d.ts.map +1 -0
  68. package/lib/typescript/commonjs/sender/Sender.d.ts +58 -0
  69. package/lib/typescript/commonjs/sender/Sender.d.ts.map +1 -0
  70. package/lib/typescript/commonjs/theme/tokens.d.ts +57 -0
  71. package/lib/typescript/commonjs/theme/tokens.d.ts.map +1 -0
  72. package/lib/typescript/commonjs/welcome/Welcome.d.ts +39 -0
  73. package/lib/typescript/commonjs/welcome/Welcome.d.ts.map +1 -0
  74. package/lib/typescript/module/bubble/Bubble.d.ts +29 -0
  75. package/lib/typescript/module/bubble/Bubble.d.ts.map +1 -0
  76. package/lib/typescript/module/bubble/BubbleList.d.ts +20 -0
  77. package/lib/typescript/module/bubble/BubbleList.d.ts.map +1 -0
  78. package/lib/typescript/module/card-wrapper/CardWrapper.d.ts +22 -0
  79. package/lib/typescript/module/card-wrapper/CardWrapper.d.ts.map +1 -0
  80. package/lib/typescript/module/conversations/Conversations.d.ts +37 -0
  81. package/lib/typescript/module/conversations/Conversations.d.ts.map +1 -0
  82. package/lib/typescript/module/index.d.ts +20 -0
  83. package/lib/typescript/module/index.d.ts.map +1 -0
  84. package/lib/typescript/module/package.json +1 -0
  85. package/lib/typescript/module/prompts/Prompts.d.ts +27 -0
  86. package/lib/typescript/module/prompts/Prompts.d.ts.map +1 -0
  87. package/lib/typescript/module/sender/Sender.d.ts +58 -0
  88. package/lib/typescript/module/sender/Sender.d.ts.map +1 -0
  89. package/lib/typescript/module/theme/tokens.d.ts +57 -0
  90. package/lib/typescript/module/theme/tokens.d.ts.map +1 -0
  91. package/lib/typescript/module/welcome/Welcome.d.ts +39 -0
  92. package/lib/typescript/module/welcome/Welcome.d.ts.map +1 -0
  93. package/package.json +41 -9
  94. package/src/index.tsx +24 -13
  95. package/src/sender/Sender.tsx +46 -38
  96. package/src/theme/tokens.ts +14 -2
  97. package/src/types/react-native-vector-icons.d.ts +12 -0
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Bubble.List — 消息列表
3
+ * 封装 inverted FlatList,自动滚动到底部
4
+ */
5
+ import React from 'react';
6
+ import { type ViewStyle } from 'react-native';
7
+ export interface BubbleListProps<T = unknown> {
8
+ items: T[];
9
+ renderBubble: (item: T) => React.ReactNode;
10
+ keyExtractor?: (item: T) => string;
11
+ onEndReached?: () => void;
12
+ header?: React.ReactNode;
13
+ footer?: React.ReactNode;
14
+ style?: ViewStyle;
15
+ testID?: string;
16
+ }
17
+ declare function BubbleListInner<T>(props: BubbleListProps<T>): import("react/jsx-runtime").JSX.Element;
18
+ declare const BubbleList: typeof BubbleListInner;
19
+ export default BubbleList;
20
+ //# sourceMappingURL=BubbleList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BubbleList.d.ts","sourceRoot":"","sources":["../../../../src/bubble/BubbleList.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAA6B,KAAK,SAAS,EAAC,MAAM,cAAc,CAAC;AAExE,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO;IAC1C,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IAC3C,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,iBAAS,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,2CAiDpD;AAcD,QAAA,MAAM,UAAU,EAAkC,OAAO,eAAe,CAAC;AACzE,eAAe,UAAU,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * CardWrapper — 通用卡片路由容器
3
+ * registry 通过 props 注入(而非全局 import),更灵活
4
+ */
5
+ import React from 'react';
6
+ import { type ViewStyle } from 'react-native';
7
+ export type CardComponentType = React.ComponentType<{
8
+ data: Record<string, unknown>;
9
+ actions: string[];
10
+ }>;
11
+ export interface CardWrapperProps {
12
+ cardType: string;
13
+ data: Record<string, unknown>;
14
+ actions: string[];
15
+ registry?: Record<string, CardComponentType>;
16
+ fallback?: React.ReactNode;
17
+ style?: ViewStyle;
18
+ testID?: string;
19
+ }
20
+ declare const _default: React.NamedExoticComponent<CardWrapperProps>;
21
+ export default _default;
22
+ //# sourceMappingURL=CardWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CardWrapper.d.ts","sourceRoot":"","sources":["../../../../src/card-wrapper/CardWrapper.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAyB,KAAK,SAAS,EAAC,MAAM,cAAc,CAAC;AAGpE,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAC;IAClD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC7C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;AAqDD,wBAAuC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Conversations — 会话列表
3
+ *
4
+ * SectionList + 日期分组(今天/昨天/更早)
5
+ * 基于 ListItem 模式渲染
6
+ */
7
+ import React from 'react';
8
+ import { type ViewStyle, type TextStyle } from 'react-native';
9
+ export interface ConversationItem {
10
+ id: string;
11
+ title: string;
12
+ lastMessage?: string;
13
+ timestamp: number;
14
+ messageCount?: number;
15
+ }
16
+ export interface ConversationsSemanticStyles {
17
+ root?: ViewStyle;
18
+ newButton?: ViewStyle;
19
+ sectionHeader?: TextStyle;
20
+ item?: ViewStyle;
21
+ itemActive?: ViewStyle;
22
+ }
23
+ export interface ConversationsProps {
24
+ items: ConversationItem[];
25
+ activeId?: string;
26
+ onSelect: (id: string) => void;
27
+ onDelete?: (id: string) => void;
28
+ onNew?: () => void;
29
+ groupByDate?: boolean;
30
+ header?: React.ReactNode;
31
+ style?: ViewStyle;
32
+ styles?: Partial<ConversationsSemanticStyles>;
33
+ testID?: string;
34
+ }
35
+ declare const _default: React.NamedExoticComponent<ConversationsProps>;
36
+ export default _default;
37
+ //# sourceMappingURL=Conversations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Conversations.d.ts","sourceRoot":"","sources":["../../../../src/conversations/Conversations.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAA6B,MAAM,OAAO,CAAC;AAClD,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;AA4LD,wBAAyC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @unif/react-native-chat
3
+ * AI 聊天 UI 组件库 — Bubble、Sender、Conversations、Prompts、Welcome、CardWrapper
4
+ */
5
+ export { default as Bubble } from './bubble/Bubble';
6
+ export type { BubbleProps, BubbleSemanticStyles } from './bubble/Bubble';
7
+ export { default as BubbleList } from './bubble/BubbleList';
8
+ export type { BubbleListProps } from './bubble/BubbleList';
9
+ export { default as Sender } from './sender/Sender';
10
+ export type { SenderProps, SenderSemanticStyles, ActionSheetOption, } from './sender/Sender';
11
+ export { default as Conversations } from './conversations/Conversations';
12
+ export type { ConversationsProps, ConversationsSemanticStyles, ConversationItem, } from './conversations/Conversations';
13
+ export { default as Prompts } from './prompts/Prompts';
14
+ export type { PromptsProps, PromptsSemanticStyles, PromptItem, } from './prompts/Prompts';
15
+ export { default as Welcome } from './welcome/Welcome';
16
+ export type { WelcomeProps, WelcomeSemanticStyles, WelcomeQuickStart, } from './welcome/Welcome';
17
+ export { default as CardWrapper } from './card-wrapper/CardWrapper';
18
+ export type { CardWrapperProps, CardComponentType, } from './card-wrapper/CardWrapper';
19
+ export { chatTokens, configure } from './theme/tokens';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG3D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EACV,WAAW,EACX,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACzE,YAAY,EACV,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACvD,YAAY,EACV,YAAY,EACZ,qBAAqB,EACrB,UAAU,GACX,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACvD,YAAY,EACV,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACpE,YAAY,EACV,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Prompts — 建议提示
3
+ * 水平 ScrollView + Chip 列表
4
+ */
5
+ import React from 'react';
6
+ import { type ViewStyle, type TextStyle } from 'react-native';
7
+ export interface PromptItem {
8
+ id: string;
9
+ label: string;
10
+ }
11
+ export interface PromptsSemanticStyles {
12
+ root?: ViewStyle;
13
+ chip?: ViewStyle;
14
+ chipText?: TextStyle;
15
+ }
16
+ export interface PromptsProps {
17
+ items: PromptItem[];
18
+ onSelect: (item: PromptItem) => void;
19
+ disabled?: boolean;
20
+ wrap?: boolean;
21
+ style?: ViewStyle;
22
+ styles?: Partial<PromptsSemanticStyles>;
23
+ testID?: string;
24
+ }
25
+ declare const _default: React.NamedExoticComponent<PromptsProps>;
26
+ export default _default;
27
+ //# sourceMappingURL=Prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Prompts.d.ts","sourceRoot":"","sources":["../../../../src/prompts/Prompts.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAML,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;AAsFD,wBAAmC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Sender — 输入发送器
3
+ *
4
+ * 完整状态机:collapsed → expanded → recording
5
+ * 基于 UI 库 Input + ActionSheet + WaveAnimation + Button 构建
6
+ */
7
+ import React from 'react';
8
+ import { type ViewStyle } from 'react-native';
9
+ export interface ActionSheetOption {
10
+ key: string;
11
+ label: string;
12
+ icon?: React.ReactNode;
13
+ }
14
+ export interface SenderSemanticStyles {
15
+ root?: ViewStyle;
16
+ collapsed?: ViewStyle;
17
+ expanded?: ViewStyle;
18
+ recording?: ViewStyle;
19
+ toolbar?: ViewStyle;
20
+ }
21
+ export interface SenderProps {
22
+ onSend: (text: string) => void;
23
+ onStop?: () => void;
24
+ onVoiceSend?: (audioUri: string) => void;
25
+ isRequesting?: boolean;
26
+ placeholder?: string;
27
+ maxLength?: number;
28
+ voiceEnabled?: boolean;
29
+ actionsEnabled?: boolean;
30
+ actions?: ActionSheetOption[];
31
+ onActionSelect?: (key: string) => void;
32
+ disabled?: boolean;
33
+ style?: ViewStyle;
34
+ styles?: Partial<SenderSemanticStyles>;
35
+ testID?: string;
36
+ renderInput?: (props: {
37
+ value: string;
38
+ onChangeText: (text: string) => void;
39
+ onSubmitEditing: () => void;
40
+ onBlur: () => void;
41
+ toolbar: React.ReactNode;
42
+ autoFocus: boolean;
43
+ maxLength: number;
44
+ }) => React.ReactNode;
45
+ renderActionSheet?: (props: {
46
+ visible: boolean;
47
+ onClose: () => void;
48
+ options: ActionSheetOption[];
49
+ onSelect: (key: string) => void;
50
+ }) => React.ReactNode;
51
+ renderWaveAnimation?: (props: {
52
+ active: boolean;
53
+ color: string;
54
+ }) => React.ReactNode;
55
+ }
56
+ declare const _default: React.NamedExoticComponent<SenderProps>;
57
+ export default _default;
58
+ //# sourceMappingURL=Sender.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sender.d.ts","sourceRoot":"","sources":["../../../../src/sender/Sender.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAwC,MAAM,OAAO,CAAC;AAC7D,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAItB,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC9B,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QACrC,eAAe,EAAE,MAAM,IAAI,CAAC;QAC5B,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;QACzB,SAAS,EAAE,OAAO,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;KACnB,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC1B,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,MAAM,IAAI,CAAC;QACpB,OAAO,EAAE,iBAAiB,EAAE,CAAC;QAC7B,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;KACjC,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC5B,MAAM,EAAE,OAAO,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,KAAK,CAAC,SAAS,CAAC;CACvB;;AAqXD,wBAAkC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Chat 专属 Design Tokens
3
+ * 仅定义 Chat 特有的 token,通用 token 从 @unif/react-native-ui 引用
4
+ */
5
+ interface ChatThemeConfig {
6
+ primaryColor?: string;
7
+ }
8
+ export declare function configure(options: ChatThemeConfig): void;
9
+ export declare const chatTokens: {
10
+ colorBgUserMsg: string;
11
+ colorBgAssistantMsg: string;
12
+ colorBgWelcomeStart: string;
13
+ colorBgWelcomeMid: string;
14
+ colorBgWelcomeEnd: string;
15
+ colorRecording: string;
16
+ readonly colorPrimary: string;
17
+ colorError: string;
18
+ colorText: string;
19
+ colorTextSecondary: string;
20
+ colorTextPlaceholder: string;
21
+ colorBgElevated: string;
22
+ colorBorder: string;
23
+ colorLink: string;
24
+ spaceXs: number;
25
+ spaceSm: number;
26
+ space: number;
27
+ spaceMd: number;
28
+ fontSize: number;
29
+ fontSizeSm: number;
30
+ lineHeight: number;
31
+ radiusSm: number;
32
+ radiusMd: number;
33
+ radiusXl: number;
34
+ radiusFull: number;
35
+ shadow: {
36
+ shadowColor: string;
37
+ shadowOffset: {
38
+ width: number;
39
+ height: number;
40
+ };
41
+ shadowOpacity: number;
42
+ shadowRadius: number;
43
+ elevation: number;
44
+ };
45
+ shadowSm: {
46
+ shadowColor: string;
47
+ shadowOffset: {
48
+ width: number;
49
+ height: number;
50
+ };
51
+ shadowOpacity: number;
52
+ shadowRadius: number;
53
+ elevation: number;
54
+ };
55
+ };
56
+ export {};
57
+ //# sourceMappingURL=tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../../src/theme/tokens.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,UAAU,eAAe;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAID,wBAAgB,SAAS,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAExD;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDtB,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Welcome — 欢迎页
3
+ * 渐变背景 + 装饰性光晕 + 2x2 快捷入口卡片网格
4
+ */
5
+ import React from 'react';
6
+ import { type ViewStyle, type TextStyle } from 'react-native';
7
+ export interface WelcomeQuickStart {
8
+ key: string;
9
+ icon: string;
10
+ title: string;
11
+ description: string;
12
+ }
13
+ export interface WelcomeSemanticStyles {
14
+ root?: ViewStyle;
15
+ title?: TextStyle;
16
+ subtitle?: TextStyle;
17
+ card?: ViewStyle;
18
+ cardTitle?: TextStyle;
19
+ cardDescription?: TextStyle;
20
+ }
21
+ export interface WelcomeProps {
22
+ title?: string;
23
+ subtitle?: string;
24
+ quickStarts?: WelcomeQuickStart[];
25
+ onQuickStart?: (key: string) => void;
26
+ gradientColors?: string[];
27
+ style?: ViewStyle;
28
+ styles?: Partial<WelcomeSemanticStyles>;
29
+ testID?: string;
30
+ renderIcon?: (name: string, size: number, color: string) => React.ReactNode;
31
+ renderGradient?: (props: {
32
+ colors: string[];
33
+ children: React.ReactNode;
34
+ style: ViewStyle;
35
+ }) => React.ReactNode;
36
+ }
37
+ declare const _default: React.NamedExoticComponent<WelcomeProps>;
38
+ export default _default;
39
+ //# sourceMappingURL=Welcome.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Welcome.d.ts","sourceRoot":"","sources":["../../../../src/welcome/Welcome.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,eAAe,CAAC,EAAE,SAAS,CAAC;CAC7B;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAClC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IAC5E,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE;QACvB,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,KAAK,EAAE,SAAS,CAAC;KAClB,KAAK,KAAK,CAAC,SAAS,CAAC;CACvB;;AAgKD,wBAAmC"}
package/package.json CHANGED
@@ -1,14 +1,24 @@
1
1
  {
2
2
  "name": "@unif/react-native-chat",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "UNIF React Native Chat — AI 聊天 UI 组件(Bubble、Sender、Conversations 等)",
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,24 +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", "ui", "bubble", "sender"],
38
+ "keywords": [
39
+ "react-native",
40
+ "chat",
41
+ "ui",
42
+ "bubble",
43
+ "sender"
44
+ ],
28
45
  "author": "qq382724935 <liulijun@pec.com.cn>",
29
46
  "license": "MIT",
30
47
  "publishConfig": {
31
48
  "registry": "https://registry.npmjs.org/"
32
49
  },
50
+ "devDependencies": {
51
+ "typescript": "^5.9.2"
52
+ },
33
53
  "peerDependencies": {
34
54
  "react": "*",
35
- "react-native": "*"
55
+ "react-native": "*",
56
+ "react-native-vector-icons": "*"
36
57
  },
37
58
  "react-native-builder-bob": {
38
59
  "source": "src",
39
60
  "output": "lib",
40
61
  "targets": [
41
- ["module", { "esm": true }],
42
- ["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
+ ]
43
75
  ]
44
76
  }
45
77
  }
package/src/index.tsx CHANGED
@@ -4,17 +4,21 @@
4
4
  */
5
5
 
6
6
  // Bubble
7
- export {default as Bubble} from './bubble/Bubble';
8
- export type {BubbleProps, BubbleSemanticStyles} from './bubble/Bubble';
9
- export {default as BubbleList} from './bubble/BubbleList';
10
- export type {BubbleListProps} from './bubble/BubbleList';
7
+ export { default as Bubble } from './bubble/Bubble';
8
+ export type { BubbleProps, BubbleSemanticStyles } from './bubble/Bubble';
9
+ export { default as BubbleList } from './bubble/BubbleList';
10
+ export type { BubbleListProps } from './bubble/BubbleList';
11
11
 
12
12
  // Sender
13
- export {default as Sender} from './sender/Sender';
14
- export type {SenderProps, SenderSemanticStyles, ActionSheetOption} from './sender/Sender';
13
+ export { default as Sender } from './sender/Sender';
14
+ export type {
15
+ SenderProps,
16
+ SenderSemanticStyles,
17
+ ActionSheetOption,
18
+ } from './sender/Sender';
15
19
 
16
20
  // Conversations
17
- export {default as Conversations} from './conversations/Conversations';
21
+ export { default as Conversations } from './conversations/Conversations';
18
22
  export type {
19
23
  ConversationsProps,
20
24
  ConversationsSemanticStyles,
@@ -22,11 +26,15 @@ export type {
22
26
  } from './conversations/Conversations';
23
27
 
24
28
  // Prompts
25
- export {default as Prompts} from './prompts/Prompts';
26
- export type {PromptsProps, PromptsSemanticStyles, PromptItem} from './prompts/Prompts';
29
+ export { default as Prompts } from './prompts/Prompts';
30
+ export type {
31
+ PromptsProps,
32
+ PromptsSemanticStyles,
33
+ PromptItem,
34
+ } from './prompts/Prompts';
27
35
 
28
36
  // Welcome
29
- export {default as Welcome} from './welcome/Welcome';
37
+ export { default as Welcome } from './welcome/Welcome';
30
38
  export type {
31
39
  WelcomeProps,
32
40
  WelcomeSemanticStyles,
@@ -34,8 +42,11 @@ export type {
34
42
  } from './welcome/Welcome';
35
43
 
36
44
  // CardWrapper
37
- export {default as CardWrapper} from './card-wrapper/CardWrapper';
38
- export type {CardWrapperProps, CardComponentType} from './card-wrapper/CardWrapper';
45
+ export { default as CardWrapper } from './card-wrapper/CardWrapper';
46
+ export type {
47
+ CardWrapperProps,
48
+ CardComponentType,
49
+ } from './card-wrapper/CardWrapper';
39
50
 
40
51
  // Theme
41
- export {chatTokens} from './theme/tokens';
52
+ export { chatTokens, configure } from './theme/tokens';