@assistant-ui/react-native 0.1.23 → 0.1.24
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/index.d.ts +2 -2
- package/dist/primitives/actionBar/ActionBarCopy.js +57 -11
- package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.js +33 -7
- package/dist/primitives/actionBar/ActionBarEdit.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js +34 -6
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js +34 -6
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.js +33 -7
- package/dist/primitives/actionBar/ActionBarReload.js.map +1 -1
- package/dist/primitives/actionBar.js.map +1 -1
- package/dist/primitives/attachment/AttachmentName.js +17 -5
- package/dist/primitives/attachment/AttachmentName.js.map +1 -1
- package/dist/primitives/attachment/AttachmentRemove.js +35 -8
- package/dist/primitives/attachment/AttachmentRemove.js.map +1 -1
- package/dist/primitives/attachment/AttachmentRoot.js +25 -5
- package/dist/primitives/attachment/AttachmentRoot.js.map +1 -1
- package/dist/primitives/attachment/AttachmentThumb.js +18 -8
- package/dist/primitives/attachment/AttachmentThumb.js.map +1 -1
- package/dist/primitives/attachment.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerCount.js +17 -5
- package/dist/primitives/branchPicker/BranchPickerCount.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.js +33 -7
- package/dist/primitives/branchPicker/BranchPickerNext.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNumber.js +17 -5
- package/dist/primitives/branchPicker/BranchPickerNumber.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.js +33 -7
- package/dist/primitives/branchPicker/BranchPickerPrevious.js.map +1 -1
- package/dist/primitives/branchPicker.js.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js +40 -9
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtRoot.js +25 -5
- package/dist/primitives/chainOfThought/ChainOfThoughtRoot.js.map +1 -1
- package/dist/primitives/chainOfThought.js.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.js +31 -6
- package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.js.map +1 -1
- package/dist/primitives/composer/ComposerCancel.js +33 -7
- package/dist/primitives/composer/ComposerCancel.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +83 -23
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerRoot.js +25 -5
- package/dist/primitives/composer/ComposerRoot.js.map +1 -1
- package/dist/primitives/composer/ComposerSend.js +39 -7
- package/dist/primitives/composer/ComposerSend.js.map +1 -1
- package/dist/primitives/composer.js.map +1 -1
- package/dist/primitives/error/ErrorMessage.js +26 -5
- package/dist/primitives/error/ErrorMessage.js.map +1 -1
- package/dist/primitives/error/ErrorRoot.js +25 -5
- package/dist/primitives/error/ErrorRoot.js.map +1 -1
- package/dist/primitives/error/index.js.map +1 -1
- package/dist/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/primitives/message/MessageContent.js +188 -76
- package/dist/primitives/message/MessageContent.js.map +1 -1
- package/dist/primitives/message/MessageIf.js +15 -3
- package/dist/primitives/message/MessageIf.js.map +1 -1
- package/dist/primitives/message/MessageParts.js +41 -7
- package/dist/primitives/message/MessageParts.js.map +1 -1
- package/dist/primitives/message/MessageRoot.js +25 -5
- package/dist/primitives/message/MessageRoot.js.map +1 -1
- package/dist/primitives/message.js.map +1 -1
- package/dist/primitives/suggestion/SuggestionDescription.js +30 -6
- package/dist/primitives/suggestion/SuggestionDescription.js.map +1 -1
- package/dist/primitives/suggestion/SuggestionTitle.js +30 -6
- package/dist/primitives/suggestion/SuggestionTitle.js.map +1 -1
- package/dist/primitives/suggestion/SuggestionTrigger.js +57 -12
- package/dist/primitives/suggestion/SuggestionTrigger.js.map +1 -1
- package/dist/primitives/suggestion.js.map +1 -1
- package/dist/primitives/thread/ThreadEmpty.js +11 -2
- package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
- package/dist/primitives/thread/ThreadIf.js +15 -3
- package/dist/primitives/thread/ThreadIf.js.map +1 -1
- package/dist/primitives/thread/ThreadMessages.js +98 -16
- package/dist/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/primitives/thread/ThreadRoot.js +25 -5
- package/dist/primitives/thread/ThreadRoot.js.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.js +56 -12
- package/dist/primitives/thread/ThreadSuggestion.js.map +1 -1
- package/dist/primitives/thread.js.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.js +46 -9
- package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/primitives/threadList/ThreadListNew.js +27 -6
- package/dist/primitives/threadList/ThreadListNew.js.map +1 -1
- package/dist/primitives/threadList/ThreadListRoot.js +25 -5
- package/dist/primitives/threadList/ThreadListRoot.js.map +1 -1
- package/dist/primitives/threadList.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.js +27 -6
- package/dist/primitives/threadListItem/ThreadListItemArchive.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemDelete.js +27 -6
- package/dist/primitives/threadListItem/ThreadListItemDelete.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.js +25 -5
- package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js +27 -6
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js +27 -6
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js.map +1 -1
- package/dist/primitives/threadListItem.js.map +1 -1
- package/package.json +6 -6
- package/src/index.ts +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComposerRoot.js","names":[],"sources":["../../../src/primitives/composer/ComposerRoot.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { View, type ViewProps } from \"react-native\";\n\nexport type ComposerRootProps = ViewProps & {\n children: ReactNode;\n};\n\nexport const ComposerRoot = ({ children, ...viewProps }: ComposerRootProps) => {\n return <View {...viewProps}>{children}</View>;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ComposerRoot.js","names":["ReactNode","View","ViewProps","ComposerRootProps","children","ComposerRoot","t0","$","_c","viewProps","t1"],"sources":["../../../src/primitives/composer/ComposerRoot.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { View, type ViewProps } from \"react-native\";\n\nexport type ComposerRootProps = ViewProps & {\n children: ReactNode;\n};\n\nexport const ComposerRoot = ({ children, ...viewProps }: ComposerRootProps) => {\n return <View {...viewProps}>{children}</View>;\n};\n"],"mappings":";;;;AAOA,MAAaK,gBAAeC,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAA,IAAAJ;CAAA,IAAAK;CAAA,IAAAF,EAAA,OAAAD,IAAA;EAAC,CAAA,CAAAF,aAAAK,aAAAH;EAA6CC,EAAA,KAAAD;EAAAC,EAAA,KAAAH;EAAAG,EAAA,KAAAE;CAAA,OAAA;EAAAL,WAAAG,EAAA;EAAAE,YAAAF,EAAA;CAAA;CAAA,IAAAG;CAAA,IAAAH,EAAA,OAAAH,YAAAG,EAAA,OAAAE,WAAA;EACjEC,KAAA,oBAAC,MAAD;GAAK,GAAKD;GAAYL;EAAjB,CAAA;EAAiCG,EAAA,KAAAH;EAAAG,EAAA,KAAAE;EAAAF,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,OAAtCG;AAAsC"}
|
|
@@ -1,15 +1,47 @@
|
|
|
1
1
|
import { useComposerSend } from "@assistant-ui/core/react";
|
|
2
|
+
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
2
3
|
import { Pressable } from "react-native";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
//#region src/primitives/composer/ComposerSend.tsx
|
|
5
|
-
const ComposerSend = (
|
|
6
|
+
const ComposerSend = (t0) => {
|
|
7
|
+
const $ = c(11);
|
|
8
|
+
let children;
|
|
9
|
+
let disabled;
|
|
10
|
+
let pressableProps;
|
|
11
|
+
if ($[0] !== t0) {
|
|
12
|
+
({children, disabled, ...pressableProps} = t0);
|
|
13
|
+
$[0] = t0;
|
|
14
|
+
$[1] = children;
|
|
15
|
+
$[2] = disabled;
|
|
16
|
+
$[3] = pressableProps;
|
|
17
|
+
} else {
|
|
18
|
+
children = $[1];
|
|
19
|
+
disabled = $[2];
|
|
20
|
+
pressableProps = $[3];
|
|
21
|
+
}
|
|
6
22
|
const { send, disabled: hookDisabled } = useComposerSend();
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
23
|
+
let t1;
|
|
24
|
+
if ($[4] !== send) {
|
|
25
|
+
t1 = () => send();
|
|
26
|
+
$[4] = send;
|
|
27
|
+
$[5] = t1;
|
|
28
|
+
} else t1 = $[5];
|
|
29
|
+
const t2 = disabled ?? hookDisabled;
|
|
30
|
+
let t3;
|
|
31
|
+
if ($[6] !== children || $[7] !== pressableProps || $[8] !== t1 || $[9] !== t2) {
|
|
32
|
+
t3 = /* @__PURE__ */ jsx(Pressable, {
|
|
33
|
+
onPress: t1,
|
|
34
|
+
disabled: t2,
|
|
35
|
+
...pressableProps,
|
|
36
|
+
children
|
|
37
|
+
});
|
|
38
|
+
$[6] = children;
|
|
39
|
+
$[7] = pressableProps;
|
|
40
|
+
$[8] = t1;
|
|
41
|
+
$[9] = t2;
|
|
42
|
+
$[10] = t3;
|
|
43
|
+
} else t3 = $[10];
|
|
44
|
+
return t3;
|
|
13
45
|
};
|
|
14
46
|
//#endregion
|
|
15
47
|
export { ComposerSend };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComposerSend.js","names":[],"sources":["../../../src/primitives/composer/ComposerSend.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Pressable, type PressableProps } from \"react-native\";\nimport { useComposerSend } from \"@assistant-ui/core/react\";\n\nexport type ComposerSendProps = Omit<PressableProps, \"onPress\"> & {\n children: ReactNode;\n};\n\nexport const ComposerSend = ({\n children,\n disabled,\n ...pressableProps\n}: ComposerSendProps) => {\n const { send, disabled: hookDisabled } = useComposerSend();\n\n return (\n <Pressable\n onPress={() => send()}\n disabled={disabled ?? hookDisabled}\n {...pressableProps}\n >\n {children}\n </Pressable>\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ComposerSend.js","names":["ReactNode","Pressable","PressableProps","useComposerSend","ComposerSendProps","Omit","children","ComposerSend","t0","$","_c","disabled","pressableProps","send","hookDisabled","t1","t2","t3"],"sources":["../../../src/primitives/composer/ComposerSend.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Pressable, type PressableProps } from \"react-native\";\nimport { useComposerSend } from \"@assistant-ui/core/react\";\n\nexport type ComposerSendProps = Omit<PressableProps, \"onPress\"> & {\n children: ReactNode;\n};\n\nexport const ComposerSend = ({\n children,\n disabled,\n ...pressableProps\n}: ComposerSendProps) => {\n const { send, disabled: hookDisabled } = useComposerSend();\n\n return (\n <Pressable\n onPress={() => send()}\n disabled={disabled ?? hookDisabled}\n {...pressableProps}\n >\n {children}\n </Pressable>\n );\n};\n"],"mappings":";;;;;AAQA,MAAaO,gBAAeC,OAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAJ;CAAA,IAAAK;CAAA,IAAAC;CAAA,IAAAH,EAAA,OAAAD,IAAA;EAAC,CAAA,CAAAF,UAAAK,aAAAC,kBAAAJ;EAITC,EAAA,KAAAD;EAAAC,EAAA,KAAAH;EAAAG,EAAA,KAAAE;EAAAF,EAAA,KAAAG;CAAA,OAAA;EAAAN,WAAAG,EAAA;EAAAE,WAAAF,EAAA;EAAAG,iBAAAH,EAAA;CAAA;CAClB,MAAA,EAAAI,MAAAF,UAAAG,iBAAyCX,gBAAgB;CAAE,IAAAY;CAAA,IAAAN,EAAA,OAAAI,MAAA;EAI9CE,WAAMF,KAAK;EAACJ,EAAA,KAAAI;EAAAJ,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CACX,MAAAO,KAAAL,YAAAG;CAAwB,IAAAG;CAAA,IAAAR,EAAA,OAAAH,YAAAG,EAAA,OAAAG,kBAAAH,EAAA,OAAAM,MAAAN,EAAA,OAAAO,IAAA;EAFpCC,KAAA,oBAAC,WAAD;GACW,SAAAF;GACC,UAAAC;GAAwB,GAC9BJ;GAEHN;EALO,CAAA;EAMEG,EAAA,KAAAH;EAAAG,EAAA,KAAAG;EAAAH,EAAA,KAAAM;EAAAN,EAAA,KAAAO;EAAAP,EAAA,MAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OANZQ;AAMY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composer.js","names":[],"sources":["../../src/primitives/composer.ts"],"sourcesContent":["export {\n ComposerRoot as Root,\n type ComposerRootProps as RootProps,\n} from \"./composer/ComposerRoot\";\nexport {\n ComposerAttachments as Attachments,\n ComposerAttachmentByIndex as AttachmentByIndex,\n} from \"./composer/ComposerAttachments\";\nexport {\n ComposerInput as Input,\n type ComposerInputProps as InputProps,\n} from \"./composer/ComposerInput\";\nexport {\n ComposerSend as Send,\n type ComposerSendProps as SendProps,\n} from \"./composer/ComposerSend\";\nexport {\n ComposerCancel as Cancel,\n type ComposerCancelProps as CancelProps,\n} from \"./composer/ComposerCancel\";\nexport {\n ComposerAddAttachment as AddAttachment,\n type ComposerAddAttachmentProps as AddAttachmentProps,\n} from \"./composer/ComposerAddAttachment\";\nexport { ComposerIf as If } from \"./composer/ComposerIf\";\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"composer.js","names":["ComposerRoot","Root","ComposerRootProps","RootProps","ComposerAttachments","Attachments","ComposerAttachmentByIndex","AttachmentByIndex","ComposerInput","Input","ComposerInputProps","InputProps","ComposerSend","Send","ComposerSendProps","SendProps","ComposerCancel","Cancel","ComposerCancelProps","CancelProps","ComposerAddAttachment","AddAttachment","ComposerAddAttachmentProps","AddAttachmentProps","ComposerIf","If"],"sources":["../../src/primitives/composer.ts"],"sourcesContent":["export {\n ComposerRoot as Root,\n type ComposerRootProps as RootProps,\n} from \"./composer/ComposerRoot\";\nexport {\n ComposerAttachments as Attachments,\n ComposerAttachmentByIndex as AttachmentByIndex,\n} from \"./composer/ComposerAttachments\";\nexport {\n ComposerInput as Input,\n type ComposerInputProps as InputProps,\n} from \"./composer/ComposerInput\";\nexport {\n ComposerSend as Send,\n type ComposerSendProps as SendProps,\n} from \"./composer/ComposerSend\";\nexport {\n ComposerCancel as Cancel,\n type ComposerCancelProps as CancelProps,\n} from \"./composer/ComposerCancel\";\nexport {\n ComposerAddAttachment as AddAttachment,\n type ComposerAddAttachmentProps as AddAttachmentProps,\n} from \"./composer/ComposerAddAttachment\";\nexport { ComposerIf as If } from \"./composer/ComposerIf\";\n"],"mappings":""}
|
|
@@ -1,14 +1,35 @@
|
|
|
1
1
|
import { useMessageError } from "@assistant-ui/core/react";
|
|
2
|
+
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
2
3
|
import { Text } from "react-native";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
//#region src/primitives/error/ErrorMessage.tsx
|
|
5
|
-
const ErrorMessage = (
|
|
6
|
+
const ErrorMessage = (t0) => {
|
|
7
|
+
const $ = c(6);
|
|
8
|
+
let children;
|
|
9
|
+
let textProps;
|
|
10
|
+
if ($[0] !== t0) {
|
|
11
|
+
({children, ...textProps} = t0);
|
|
12
|
+
$[0] = t0;
|
|
13
|
+
$[1] = children;
|
|
14
|
+
$[2] = textProps;
|
|
15
|
+
} else {
|
|
16
|
+
children = $[1];
|
|
17
|
+
textProps = $[2];
|
|
18
|
+
}
|
|
6
19
|
const error = useMessageError();
|
|
7
20
|
if (error === void 0) return null;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
21
|
+
const t1 = children ?? String(error);
|
|
22
|
+
let t2;
|
|
23
|
+
if ($[3] !== t1 || $[4] !== textProps) {
|
|
24
|
+
t2 = /* @__PURE__ */ jsx(Text, {
|
|
25
|
+
...textProps,
|
|
26
|
+
children: t1
|
|
27
|
+
});
|
|
28
|
+
$[3] = t1;
|
|
29
|
+
$[4] = textProps;
|
|
30
|
+
$[5] = t2;
|
|
31
|
+
} else t2 = $[5];
|
|
32
|
+
return t2;
|
|
12
33
|
};
|
|
13
34
|
ErrorMessage.displayName = "ErrorPrimitive.Message";
|
|
14
35
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorMessage.js","names":[],"sources":["../../../src/primitives/error/ErrorMessage.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Text, type TextProps } from \"react-native\";\nimport { useMessageError } from \"@assistant-ui/core/react\";\n\nexport type ErrorMessageProps = TextProps & {\n children?: ReactNode;\n};\n\nexport const ErrorMessage = ({ children, ...textProps }: ErrorMessageProps) => {\n const error = useMessageError();\n\n if (error === undefined) return null;\n\n return <Text {...textProps}>{children ?? String(error)}</Text>;\n};\n\nErrorMessage.displayName = \"ErrorPrimitive.Message\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ErrorMessage.js","names":["ReactNode","Text","TextProps","useMessageError","ErrorMessageProps","children","ErrorMessage","t0","$","_c","textProps","error","undefined","t1","String","t2","displayName"],"sources":["../../../src/primitives/error/ErrorMessage.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Text, type TextProps } from \"react-native\";\nimport { useMessageError } from \"@assistant-ui/core/react\";\n\nexport type ErrorMessageProps = TextProps & {\n children?: ReactNode;\n};\n\nexport const ErrorMessage = ({ children, ...textProps }: ErrorMessageProps) => {\n const error = useMessageError();\n\n if (error === undefined) return null;\n\n return <Text {...textProps}>{children ?? String(error)}</Text>;\n};\n\nErrorMessage.displayName = \"ErrorPrimitive.Message\";\n"],"mappings":";;;;;AAQA,MAAaM,gBAAeC,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAA,IAAAJ;CAAA,IAAAK;CAAA,IAAAF,EAAA,OAAAD,IAAA;EAAC,CAAA,CAAAF,aAAAK,aAAAH;EAA6CC,EAAA,KAAAD;EAAAC,EAAA,KAAAH;EAAAG,EAAA,KAAAE;CAAA,OAAA;EAAAL,WAAAG,EAAA;EAAAE,YAAAF,EAAA;CAAA;CACxE,MAAAG,QAAcR,gBAAgB;CAE9B,IAAIQ,UAAUC,KAAAA,GAAS,OAAS;CAEH,MAAAC,KAAAR,YAAYS,OAAOH,KAAK;CAAC,IAAAI;CAAA,IAAAP,EAAA,OAAAK,MAAAL,EAAA,OAAAE,WAAA;EAA/CK,KAAA,oBAAC,MAAD;GAAK,GAAKL;aAAYG;EAAjB,CAAA;EAAkDL,EAAA,KAAAK;EAAAL,EAAA,KAAAE;EAAAF,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OAAvDO;AAAuD;AAGhET,aAAaU,cAAc"}
|
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
import { useMessageError } from "@assistant-ui/core/react";
|
|
2
|
+
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
2
3
|
import { View } from "react-native";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
//#region src/primitives/error/ErrorRoot.tsx
|
|
5
|
-
const ErrorRoot = (
|
|
6
|
+
const ErrorRoot = (t0) => {
|
|
7
|
+
const $ = c(6);
|
|
8
|
+
let children;
|
|
9
|
+
let viewProps;
|
|
10
|
+
if ($[0] !== t0) {
|
|
11
|
+
({children, ...viewProps} = t0);
|
|
12
|
+
$[0] = t0;
|
|
13
|
+
$[1] = children;
|
|
14
|
+
$[2] = viewProps;
|
|
15
|
+
} else {
|
|
16
|
+
children = $[1];
|
|
17
|
+
viewProps = $[2];
|
|
18
|
+
}
|
|
6
19
|
if (useMessageError() === void 0) return null;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
20
|
+
let t1;
|
|
21
|
+
if ($[3] !== children || $[4] !== viewProps) {
|
|
22
|
+
t1 = /* @__PURE__ */ jsx(View, {
|
|
23
|
+
...viewProps,
|
|
24
|
+
children
|
|
25
|
+
});
|
|
26
|
+
$[3] = children;
|
|
27
|
+
$[4] = viewProps;
|
|
28
|
+
$[5] = t1;
|
|
29
|
+
} else t1 = $[5];
|
|
30
|
+
return t1;
|
|
11
31
|
};
|
|
12
32
|
ErrorRoot.displayName = "ErrorPrimitive.Root";
|
|
13
33
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorRoot.js","names":[],"sources":["../../../src/primitives/error/ErrorRoot.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { View, type ViewProps } from \"react-native\";\nimport { useMessageError } from \"@assistant-ui/core/react\";\n\nexport type ErrorRootProps = ViewProps & {\n children: ReactNode;\n};\n\nexport const ErrorRoot = ({ children, ...viewProps }: ErrorRootProps) => {\n const error = useMessageError();\n if (error === undefined) return null;\n\n return <View {...viewProps}>{children}</View>;\n};\n\nErrorRoot.displayName = \"ErrorPrimitive.Root\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ErrorRoot.js","names":["ReactNode","View","ViewProps","useMessageError","ErrorRootProps","children","ErrorRoot","t0","$","_c","viewProps","error","undefined","t1","displayName"],"sources":["../../../src/primitives/error/ErrorRoot.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { View, type ViewProps } from \"react-native\";\nimport { useMessageError } from \"@assistant-ui/core/react\";\n\nexport type ErrorRootProps = ViewProps & {\n children: ReactNode;\n};\n\nexport const ErrorRoot = ({ children, ...viewProps }: ErrorRootProps) => {\n const error = useMessageError();\n if (error === undefined) return null;\n\n return <View {...viewProps}>{children}</View>;\n};\n\nErrorRoot.displayName = \"ErrorPrimitive.Root\";\n"],"mappings":";;;;;AAQA,MAAaM,aAAYC,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAA,IAAAJ;CAAA,IAAAK;CAAA,IAAAF,EAAA,OAAAD,IAAA;EAAC,CAAA,CAAAF,aAAAK,aAAAH;EAA0CC,EAAA,KAAAD;EAAAC,EAAA,KAAAH;EAAAG,EAAA,KAAAE;CAAA,OAAA;EAAAL,WAAAG,EAAA;EAAAE,YAAAF,EAAA;CAAA;CAElE,IADcL,gBACVQ,MAAUC,KAAAA,GAAS,OAAS;CAAK,IAAAC;CAAA,IAAAL,EAAA,OAAAH,YAAAG,EAAA,OAAAE,WAAA;EAE9BG,KAAA,oBAAC,MAAD;GAAK,GAAKH;GAAYL;EAAjB,CAAA;EAAiCG,EAAA,KAAAH;EAAAG,EAAA,KAAAE;EAAAF,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAAtCK;AAAsC;AAG/CP,UAAUQ,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/primitives/error/index.ts"],"sourcesContent":["export {\n ErrorRoot as Root,\n type ErrorRootProps as RootProps,\n} from \"./ErrorRoot\";\nexport {\n ErrorMessage as Message,\n type ErrorMessageProps as MessageProps,\n} from \"./ErrorMessage\";\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ErrorRoot","Root","ErrorRootProps","RootProps","ErrorMessage","Message","ErrorMessageProps","MessageProps"],"sources":["../../../src/primitives/error/index.ts"],"sourcesContent":["export {\n ErrorRoot as Root,\n type ErrorRootProps as RootProps,\n} from \"./ErrorRoot\";\nexport {\n ErrorMessage as Message,\n type ErrorMessageProps as MessageProps,\n} from \"./ErrorMessage\";\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageAttachments.js","names":[],"sources":["../../../src/primitives/message/MessageAttachments.tsx"],"sourcesContent":["import {\n MessagePrimitiveAttachments,\n MessagePrimitiveAttachmentByIndex,\n} from \"@assistant-ui/core/react\";\nimport type { AttachmentComponents } from \"../composer/ComposerAttachments\";\n\nexport type MessageAttachmentsProps = {\n components: AttachmentComponents | undefined;\n};\n\nexport type MessageAttachmentByIndexProps = {\n index: number;\n components?: AttachmentComponents | undefined;\n};\n\nexport const MessageAttachmentByIndex = MessagePrimitiveAttachmentByIndex;\n\nexport const MessageAttachments = MessagePrimitiveAttachments;\n"],"mappings":";;AAeA,
|
|
1
|
+
{"version":3,"file":"MessageAttachments.js","names":["MessagePrimitiveAttachments","MessagePrimitiveAttachmentByIndex","AttachmentComponents","MessageAttachmentsProps","components","MessageAttachmentByIndexProps","index","MessageAttachmentByIndex","MessageAttachments"],"sources":["../../../src/primitives/message/MessageAttachments.tsx"],"sourcesContent":["import {\n MessagePrimitiveAttachments,\n MessagePrimitiveAttachmentByIndex,\n} from \"@assistant-ui/core/react\";\nimport type { AttachmentComponents } from \"../composer/ComposerAttachments\";\n\nexport type MessageAttachmentsProps = {\n components: AttachmentComponents | undefined;\n};\n\nexport type MessageAttachmentByIndexProps = {\n index: number;\n components?: AttachmentComponents | undefined;\n};\n\nexport const MessageAttachmentByIndex = MessagePrimitiveAttachmentByIndex;\n\nexport const MessageAttachments = MessagePrimitiveAttachments;\n"],"mappings":";;AAeA,MAAaO,2BAA2BN;AAExC,MAAaO,qBAAqBR"}
|
|
@@ -1,90 +1,202 @@
|
|
|
1
1
|
import { useAui, useAuiState } from "@assistant-ui/store";
|
|
2
|
+
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
2
3
|
import { Text } from "react-native";
|
|
3
4
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
4
|
-
import { Fragment as Fragment$1
|
|
5
|
+
import { Fragment as Fragment$1 } from "@assistant-ui/tap/react-shim";
|
|
5
6
|
//#region src/primitives/message/MessageContent.tsx
|
|
6
|
-
const DefaultTextRenderer = (
|
|
7
|
-
|
|
7
|
+
const DefaultTextRenderer = (t0) => {
|
|
8
|
+
const $ = c(2);
|
|
9
|
+
const { part } = t0;
|
|
10
|
+
let t1;
|
|
11
|
+
if ($[0] !== part.text) {
|
|
12
|
+
t1 = /* @__PURE__ */ jsx(Text, { children: part.text });
|
|
13
|
+
$[0] = part.text;
|
|
14
|
+
$[1] = t1;
|
|
15
|
+
} else t1 = $[1];
|
|
16
|
+
return t1;
|
|
8
17
|
};
|
|
9
|
-
const ToolUIDisplay = (
|
|
18
|
+
const ToolUIDisplay = (t0) => {
|
|
19
|
+
const $ = c(15);
|
|
20
|
+
const { Fallback, part, index } = t0;
|
|
10
21
|
const aui = useAui();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
part
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
22
|
+
let t1;
|
|
23
|
+
if ($[0] !== part.toolName) {
|
|
24
|
+
t1 = (s) => {
|
|
25
|
+
const renders = s.tools.tools[part.toolName];
|
|
26
|
+
if (Array.isArray(renders)) return renders[0];
|
|
27
|
+
return renders;
|
|
28
|
+
};
|
|
29
|
+
$[0] = part.toolName;
|
|
30
|
+
$[1] = t1;
|
|
31
|
+
} else t1 = $[1];
|
|
32
|
+
const Render = useAuiState(t1);
|
|
33
|
+
let t2;
|
|
34
|
+
if ($[2] !== aui || $[3] !== index) {
|
|
35
|
+
t2 = aui.message().part({ index });
|
|
36
|
+
$[2] = aui;
|
|
37
|
+
$[3] = index;
|
|
38
|
+
$[4] = t2;
|
|
39
|
+
} else t2 = $[4];
|
|
40
|
+
const partMethods = t2;
|
|
41
|
+
if (Render) {
|
|
42
|
+
const t3 = part;
|
|
43
|
+
let t4;
|
|
44
|
+
if ($[5] !== Render || $[6] !== partMethods.addToolResult || $[7] !== partMethods.respondToToolApproval || $[8] !== partMethods.resumeToolCall || $[9] !== t3) {
|
|
45
|
+
t4 = /* @__PURE__ */ jsx(Render, {
|
|
46
|
+
...t3,
|
|
47
|
+
addResult: partMethods.addToolResult,
|
|
48
|
+
resume: partMethods.resumeToolCall,
|
|
49
|
+
respondToApproval: partMethods.respondToToolApproval
|
|
50
|
+
});
|
|
51
|
+
$[5] = Render;
|
|
52
|
+
$[6] = partMethods.addToolResult;
|
|
53
|
+
$[7] = partMethods.respondToToolApproval;
|
|
54
|
+
$[8] = partMethods.resumeToolCall;
|
|
55
|
+
$[9] = t3;
|
|
56
|
+
$[10] = t4;
|
|
57
|
+
} else t4 = $[10];
|
|
58
|
+
return t4;
|
|
59
|
+
}
|
|
60
|
+
if (Fallback) {
|
|
61
|
+
let t3;
|
|
62
|
+
if ($[11] !== Fallback || $[12] !== index || $[13] !== part) {
|
|
63
|
+
t3 = /* @__PURE__ */ jsx(Fallback, {
|
|
52
64
|
part,
|
|
53
65
|
index
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
66
|
+
});
|
|
67
|
+
$[11] = Fallback;
|
|
68
|
+
$[12] = index;
|
|
69
|
+
$[13] = part;
|
|
70
|
+
$[14] = t3;
|
|
71
|
+
} else t3 = $[14];
|
|
72
|
+
return t3;
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
};
|
|
76
|
+
const DataUIDisplay = (t0) => {
|
|
77
|
+
const $ = c(9);
|
|
78
|
+
const { Fallback, part, index } = t0;
|
|
79
|
+
let t1;
|
|
80
|
+
if ($[0] !== part.name) {
|
|
81
|
+
t1 = (s) => {
|
|
82
|
+
const renders = s.dataRenderers.renderers[part.name];
|
|
83
|
+
if (Array.isArray(renders)) return renders[0];
|
|
84
|
+
return renders;
|
|
85
|
+
};
|
|
86
|
+
$[0] = part.name;
|
|
87
|
+
$[1] = t1;
|
|
88
|
+
} else t1 = $[1];
|
|
89
|
+
const Render = useAuiState(t1);
|
|
90
|
+
if (Render) {
|
|
91
|
+
const t2 = part;
|
|
92
|
+
let t3;
|
|
93
|
+
if ($[2] !== Render || $[3] !== t2) {
|
|
94
|
+
t3 = /* @__PURE__ */ jsx(Render, { ...t2 });
|
|
95
|
+
$[2] = Render;
|
|
96
|
+
$[3] = t2;
|
|
97
|
+
$[4] = t3;
|
|
98
|
+
} else t3 = $[4];
|
|
99
|
+
return t3;
|
|
100
|
+
}
|
|
101
|
+
if (Fallback) {
|
|
102
|
+
let t2;
|
|
103
|
+
if ($[5] !== Fallback || $[6] !== index || $[7] !== part) {
|
|
104
|
+
t2 = /* @__PURE__ */ jsx(Fallback, {
|
|
81
105
|
part,
|
|
82
106
|
index
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
107
|
+
});
|
|
108
|
+
$[5] = Fallback;
|
|
109
|
+
$[6] = index;
|
|
110
|
+
$[7] = part;
|
|
111
|
+
$[8] = t2;
|
|
112
|
+
} else t2 = $[8];
|
|
113
|
+
return t2;
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
};
|
|
117
|
+
const MessageContent = (t0) => {
|
|
118
|
+
const $ = c(19);
|
|
119
|
+
const { renderText, renderToolCall, renderImage, renderReasoning, renderSource, renderFile, renderData } = t0;
|
|
120
|
+
const content = useAuiState(_temp);
|
|
121
|
+
let t1;
|
|
122
|
+
if ($[0] !== content || $[1] !== renderData || $[2] !== renderFile || $[3] !== renderImage || $[4] !== renderReasoning || $[5] !== renderSource || $[6] !== renderText || $[7] !== renderToolCall) {
|
|
123
|
+
let t2;
|
|
124
|
+
if ($[9] !== renderData || $[10] !== renderFile || $[11] !== renderImage || $[12] !== renderReasoning || $[13] !== renderSource || $[14] !== renderText || $[15] !== renderToolCall) {
|
|
125
|
+
t2 = (part, index) => {
|
|
126
|
+
const key = `${part.type}-${index}`;
|
|
127
|
+
switch (part.type) {
|
|
128
|
+
case "text": return /* @__PURE__ */ jsx(Fragment$1, { children: renderText ? renderText({
|
|
129
|
+
part,
|
|
130
|
+
index
|
|
131
|
+
}) : /* @__PURE__ */ jsx(DefaultTextRenderer, { part }) }, key);
|
|
132
|
+
case "tool-call": return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(ToolUIDisplay, {
|
|
133
|
+
Fallback: renderToolCall,
|
|
134
|
+
part,
|
|
135
|
+
index
|
|
136
|
+
}) }, key);
|
|
137
|
+
case "image":
|
|
138
|
+
if (!renderImage) return null;
|
|
139
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: renderImage({
|
|
140
|
+
part,
|
|
141
|
+
index
|
|
142
|
+
}) }, key);
|
|
143
|
+
case "reasoning":
|
|
144
|
+
if (!renderReasoning) return null;
|
|
145
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: renderReasoning({
|
|
146
|
+
part,
|
|
147
|
+
index
|
|
148
|
+
}) }, key);
|
|
149
|
+
case "source":
|
|
150
|
+
if (!renderSource) return null;
|
|
151
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: renderSource({
|
|
152
|
+
part,
|
|
153
|
+
index
|
|
154
|
+
}) }, key);
|
|
155
|
+
case "file":
|
|
156
|
+
if (!renderFile) return null;
|
|
157
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: renderFile({
|
|
158
|
+
part,
|
|
159
|
+
index
|
|
160
|
+
}) }, key);
|
|
161
|
+
case "data": return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(DataUIDisplay, {
|
|
162
|
+
Fallback: renderData,
|
|
163
|
+
part,
|
|
164
|
+
index
|
|
165
|
+
}) }, key);
|
|
166
|
+
default: return null;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
$[9] = renderData;
|
|
170
|
+
$[10] = renderFile;
|
|
171
|
+
$[11] = renderImage;
|
|
172
|
+
$[12] = renderReasoning;
|
|
173
|
+
$[13] = renderSource;
|
|
174
|
+
$[14] = renderText;
|
|
175
|
+
$[15] = renderToolCall;
|
|
176
|
+
$[16] = t2;
|
|
177
|
+
} else t2 = $[16];
|
|
178
|
+
t1 = content.map(t2);
|
|
179
|
+
$[0] = content;
|
|
180
|
+
$[1] = renderData;
|
|
181
|
+
$[2] = renderFile;
|
|
182
|
+
$[3] = renderImage;
|
|
183
|
+
$[4] = renderReasoning;
|
|
184
|
+
$[5] = renderSource;
|
|
185
|
+
$[6] = renderText;
|
|
186
|
+
$[7] = renderToolCall;
|
|
187
|
+
$[8] = t1;
|
|
188
|
+
} else t1 = $[8];
|
|
189
|
+
let t2;
|
|
190
|
+
if ($[17] !== t1) {
|
|
191
|
+
t2 = /* @__PURE__ */ jsx(Fragment, { children: t1 });
|
|
192
|
+
$[17] = t1;
|
|
193
|
+
$[18] = t2;
|
|
194
|
+
} else t2 = $[18];
|
|
195
|
+
return t2;
|
|
87
196
|
};
|
|
197
|
+
function _temp(s) {
|
|
198
|
+
return s.message.content;
|
|
199
|
+
}
|
|
88
200
|
//#endregion
|
|
89
201
|
export { MessageContent };
|
|
90
202
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageContent.js","names":["Fragment"],"sources":["../../../src/primitives/message/MessageContent.tsx"],"sourcesContent":["import { type ReactElement, Fragment, useMemo } from \"react\";\nimport { Text } from \"react-native\";\nimport type {\n ThreadUserMessagePart,\n ThreadAssistantMessagePart,\n ToolCallMessagePart,\n DataMessagePart,\n} from \"@assistant-ui/core\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport type {\n ToolCallMessagePartProps,\n DataMessagePartProps,\n} from \"@assistant-ui/core/react\";\n\ntype MessageContentPart = ThreadUserMessagePart | ThreadAssistantMessagePart;\n\nexport type MessageContentProps = {\n renderText?: (props: {\n part: Extract<MessageContentPart, { type: \"text\" }>;\n index: number;\n }) => ReactElement;\n renderToolCall?: (props: {\n part: Extract<MessageContentPart, { type: \"tool-call\" }>;\n index: number;\n }) => ReactElement;\n renderImage?: (props: {\n part: Extract<MessageContentPart, { type: \"image\" }>;\n index: number;\n }) => ReactElement;\n renderReasoning?: (props: {\n part: Extract<MessageContentPart, { type: \"reasoning\" }>;\n index: number;\n }) => ReactElement;\n renderSource?: (props: {\n part: Extract<MessageContentPart, { type: \"source\" }>;\n index: number;\n }) => ReactElement;\n renderFile?: (props: {\n part: Extract<MessageContentPart, { type: \"file\" }>;\n index: number;\n }) => ReactElement;\n renderData?: (props: {\n part: Extract<MessageContentPart, { type: \"data\" }>;\n index: number;\n }) => ReactElement;\n};\n\nconst DefaultTextRenderer = ({\n part,\n}: {\n part: Extract<MessageContentPart, { type: \"text\" }>;\n}) => {\n return <Text>{part.text}</Text>;\n};\n\nconst ToolUIDisplay = ({\n Fallback,\n part,\n index,\n}: {\n Fallback:\n | ((props: { part: ToolCallMessagePart; index: number }) => ReactElement)\n | undefined;\n part: ToolCallMessagePart;\n index: number;\n}) => {\n const aui = useAui();\n const Render = useAuiState((s) => {\n const renders = s.tools.tools[part.toolName];\n if (Array.isArray(renders)) return renders[0];\n return renders;\n });\n\n const partMethods = useMemo(\n () => aui.message().part({ index }),\n [aui, index],\n );\n\n if (Render) {\n return (\n <Render\n {...(part as ToolCallMessagePartProps)}\n addResult={partMethods.addToolResult}\n resume={partMethods.resumeToolCall}\n respondToApproval={partMethods.respondToToolApproval}\n />\n );\n }\n if (Fallback) return <Fallback part={part} index={index} />;\n return null;\n};\n\nconst DataUIDisplay = ({\n Fallback,\n part,\n index,\n}: {\n Fallback:\n | ((props: { part: DataMessagePart; index: number }) => ReactElement)\n | undefined;\n part: DataMessagePart;\n index: number;\n}) => {\n const Render = useAuiState((s) => {\n const renders = s.dataRenderers.renderers[part.name];\n if (Array.isArray(renders)) return renders[0];\n return renders;\n });\n if (Render) return <Render {...(part as DataMessagePartProps)} />;\n if (Fallback) return <Fallback part={part} index={index} />;\n return null;\n};\n\nexport const MessageContent = ({\n renderText,\n renderToolCall,\n renderImage,\n renderReasoning,\n renderSource,\n renderFile,\n renderData,\n}: MessageContentProps) => {\n const content = useAuiState((s) => s.message.content);\n\n return (\n <>\n {content.map((part, index) => {\n const key = `${part.type}-${index}`;\n switch (part.type) {\n case \"text\":\n return (\n <Fragment key={key}>\n {renderText ? (\n renderText({ part, index })\n ) : (\n <DefaultTextRenderer part={part} />\n )}\n </Fragment>\n );\n case \"tool-call\":\n return (\n <Fragment key={key}>\n <ToolUIDisplay\n Fallback={renderToolCall}\n part={part}\n index={index}\n />\n </Fragment>\n );\n case \"image\":\n if (!renderImage) return null;\n return (\n <Fragment key={key}>{renderImage({ part, index })}</Fragment>\n );\n case \"reasoning\":\n if (!renderReasoning) return null;\n return (\n <Fragment key={key}>{renderReasoning({ part, index })}</Fragment>\n );\n case \"source\":\n if (!renderSource) return null;\n return (\n <Fragment key={key}>{renderSource({ part, index })}</Fragment>\n );\n case \"file\":\n if (!renderFile) return null;\n return <Fragment key={key}>{renderFile({ part, index })}</Fragment>;\n case \"data\":\n return (\n <Fragment key={key}>\n <DataUIDisplay\n Fallback={renderData}\n part={part}\n index={index}\n />\n </Fragment>\n );\n default:\n return null;\n }\n })}\n </>\n );\n};\n"],"mappings":";;;;;AA+CA,MAAM,uBAAuB,EAC3B,WAGI;CACJ,OAAO,oBAAC,MAAD,EAAA,UAAO,KAAK,KAAW,CAAA;AAChC;AAEA,MAAM,iBAAiB,EACrB,UACA,MACA,YAOI;CACJ,MAAM,MAAM,OAAO;CACnB,MAAM,SAAS,aAAa,MAAM;EAChC,MAAM,UAAU,EAAE,MAAM,MAAM,KAAK;EACnC,IAAI,MAAM,QAAQ,OAAO,GAAG,OAAO,QAAQ;EAC3C,OAAO;CACT,CAAC;CAED,MAAM,cAAc,cACZ,IAAI,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,GAClC,CAAC,KAAK,KAAK,CACb;CAEA,IAAI,QACF,OACE,oBAAC,QAAD;EACE,GAAK;EACL,WAAW,YAAY;EACvB,QAAQ,YAAY;EACpB,mBAAmB,YAAY;CAChC,CAAA;CAGL,IAAI,UAAU,OAAO,oBAAC,UAAD;EAAgB;EAAa;CAAQ,CAAA;CAC1D,OAAO;AACT;AAEA,MAAM,iBAAiB,EACrB,UACA,MACA,YAOI;CACJ,MAAM,SAAS,aAAa,MAAM;EAChC,MAAM,UAAU,EAAE,cAAc,UAAU,KAAK;EAC/C,IAAI,MAAM,QAAQ,OAAO,GAAG,OAAO,QAAQ;EAC3C,OAAO;CACT,CAAC;CACD,IAAI,QAAQ,OAAO,oBAAC,QAAD,EAAQ,GAAK,KAAgC,CAAA;CAChE,IAAI,UAAU,OAAO,oBAAC,UAAD;EAAgB;EAAa;CAAQ,CAAA;CAC1D,OAAO;AACT;AAEA,MAAa,kBAAkB,EAC7B,YACA,gBACA,aACA,iBACA,cACA,YACA,iBACyB;CAGzB,OACE,oBAAA,UAAA,EAAA,UAHc,aAAa,MAAM,EAAE,QAAQ,OAIlC,CAAC,CAAC,KAAK,MAAM,UAAU;EAC5B,MAAM,MAAM,GAAG,KAAK,KAAK,GAAG;EAC5B,QAAQ,KAAK,MAAb;GACE,KAAK,QACH,OACE,oBAACA,YAAD,EAAA,UACG,aACC,WAAW;IAAE;IAAM;GAAM,CAAC,IAE1B,oBAAC,qBAAD,EAA2B,KAAO,CAAA,EAE5B,GANK,GAML;GAEd,KAAK,aACH,OACE,oBAACA,YAAD,EAAA,UACE,oBAAC,eAAD;IACE,UAAU;IACJ;IACC;GACR,CAAA,EACO,GANK,GAML;GAEd,KAAK;IACH,IAAI,CAAC,aAAa,OAAO;IACzB,OACE,oBAACA,YAAD,EAAA,UAAqB,YAAY;KAAE;KAAM;IAAM,CAAC,EAAY,GAA7C,GAA6C;GAEhE,KAAK;IACH,IAAI,CAAC,iBAAiB,OAAO;IAC7B,OACE,oBAACA,YAAD,EAAA,UAAqB,gBAAgB;KAAE;KAAM;IAAM,CAAC,EAAY,GAAjD,GAAiD;GAEpE,KAAK;IACH,IAAI,CAAC,cAAc,OAAO;IAC1B,OACE,oBAACA,YAAD,EAAA,UAAqB,aAAa;KAAE;KAAM;IAAM,CAAC,EAAY,GAA9C,GAA8C;GAEjE,KAAK;IACH,IAAI,CAAC,YAAY,OAAO;IACxB,OAAO,oBAACA,YAAD,EAAA,UAAqB,WAAW;KAAE;KAAM;IAAM,CAAC,EAAY,GAA5C,GAA4C;GACpE,KAAK,QACH,OACE,oBAACA,YAAD,EAAA,UACE,oBAAC,eAAD;IACE,UAAU;IACJ;IACC;GACR,CAAA,EACO,GANK,GAML;GAEd,SACE,OAAO;EACX;CACF,CAAC,EACD,CAAA;AAEN"}
|
|
1
|
+
{"version":3,"file":"MessageContent.js","names":["ReactElement","Fragment","useMemo","Text","ThreadUserMessagePart","ThreadAssistantMessagePart","ToolCallMessagePart","DataMessagePart","useAui","useAuiState","ToolCallMessagePartProps","DataMessagePartProps","MessageContentPart","MessageContentProps","renderText","props","part","Extract","type","index","renderToolCall","renderImage","renderReasoning","renderSource","renderFile","renderData","DefaultTextRenderer","t0","$","_c","t1","text","ToolUIDisplay","Fallback","aui","toolName","s","renders","tools","Array","isArray","Render","t2","message","partMethods","t3","t4","addToolResult","respondToToolApproval","resumeToolCall","DataUIDisplay","name","dataRenderers","renderers","MessageContent","content","_temp","key","map"],"sources":["../../../src/primitives/message/MessageContent.tsx"],"sourcesContent":["import { type ReactElement, Fragment, useMemo } from \"react\";\nimport { Text } from \"react-native\";\nimport type {\n ThreadUserMessagePart,\n ThreadAssistantMessagePart,\n ToolCallMessagePart,\n DataMessagePart,\n} from \"@assistant-ui/core\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport type {\n ToolCallMessagePartProps,\n DataMessagePartProps,\n} from \"@assistant-ui/core/react\";\n\ntype MessageContentPart = ThreadUserMessagePart | ThreadAssistantMessagePart;\n\nexport type MessageContentProps = {\n renderText?: (props: {\n part: Extract<MessageContentPart, { type: \"text\" }>;\n index: number;\n }) => ReactElement;\n renderToolCall?: (props: {\n part: Extract<MessageContentPart, { type: \"tool-call\" }>;\n index: number;\n }) => ReactElement;\n renderImage?: (props: {\n part: Extract<MessageContentPart, { type: \"image\" }>;\n index: number;\n }) => ReactElement;\n renderReasoning?: (props: {\n part: Extract<MessageContentPart, { type: \"reasoning\" }>;\n index: number;\n }) => ReactElement;\n renderSource?: (props: {\n part: Extract<MessageContentPart, { type: \"source\" }>;\n index: number;\n }) => ReactElement;\n renderFile?: (props: {\n part: Extract<MessageContentPart, { type: \"file\" }>;\n index: number;\n }) => ReactElement;\n renderData?: (props: {\n part: Extract<MessageContentPart, { type: \"data\" }>;\n index: number;\n }) => ReactElement;\n};\n\nconst DefaultTextRenderer = ({\n part,\n}: {\n part: Extract<MessageContentPart, { type: \"text\" }>;\n}) => {\n return <Text>{part.text}</Text>;\n};\n\nconst ToolUIDisplay = ({\n Fallback,\n part,\n index,\n}: {\n Fallback:\n | ((props: { part: ToolCallMessagePart; index: number }) => ReactElement)\n | undefined;\n part: ToolCallMessagePart;\n index: number;\n}) => {\n const aui = useAui();\n const Render = useAuiState((s) => {\n const renders = s.tools.tools[part.toolName];\n if (Array.isArray(renders)) return renders[0];\n return renders;\n });\n\n const partMethods = useMemo(\n () => aui.message().part({ index }),\n [aui, index],\n );\n\n if (Render) {\n return (\n <Render\n {...(part as ToolCallMessagePartProps)}\n addResult={partMethods.addToolResult}\n resume={partMethods.resumeToolCall}\n respondToApproval={partMethods.respondToToolApproval}\n />\n );\n }\n if (Fallback) return <Fallback part={part} index={index} />;\n return null;\n};\n\nconst DataUIDisplay = ({\n Fallback,\n part,\n index,\n}: {\n Fallback:\n | ((props: { part: DataMessagePart; index: number }) => ReactElement)\n | undefined;\n part: DataMessagePart;\n index: number;\n}) => {\n const Render = useAuiState((s) => {\n const renders = s.dataRenderers.renderers[part.name];\n if (Array.isArray(renders)) return renders[0];\n return renders;\n });\n if (Render) return <Render {...(part as DataMessagePartProps)} />;\n if (Fallback) return <Fallback part={part} index={index} />;\n return null;\n};\n\nexport const MessageContent = ({\n renderText,\n renderToolCall,\n renderImage,\n renderReasoning,\n renderSource,\n renderFile,\n renderData,\n}: MessageContentProps) => {\n const content = useAuiState((s) => s.message.content);\n\n return (\n <>\n {content.map((part, index) => {\n const key = `${part.type}-${index}`;\n switch (part.type) {\n case \"text\":\n return (\n <Fragment key={key}>\n {renderText ? (\n renderText({ part, index })\n ) : (\n <DefaultTextRenderer part={part} />\n )}\n </Fragment>\n );\n case \"tool-call\":\n return (\n <Fragment key={key}>\n <ToolUIDisplay\n Fallback={renderToolCall}\n part={part}\n index={index}\n />\n </Fragment>\n );\n case \"image\":\n if (!renderImage) return null;\n return (\n <Fragment key={key}>{renderImage({ part, index })}</Fragment>\n );\n case \"reasoning\":\n if (!renderReasoning) return null;\n return (\n <Fragment key={key}>{renderReasoning({ part, index })}</Fragment>\n );\n case \"source\":\n if (!renderSource) return null;\n return (\n <Fragment key={key}>{renderSource({ part, index })}</Fragment>\n );\n case \"file\":\n if (!renderFile) return null;\n return <Fragment key={key}>{renderFile({ part, index })}</Fragment>;\n case \"data\":\n return (\n <Fragment key={key}>\n <DataUIDisplay\n Fallback={renderData}\n part={part}\n index={index}\n />\n </Fragment>\n );\n default:\n return null;\n }\n })}\n </>\n );\n};\n"],"mappings":"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"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { useAuiState } from "@assistant-ui/store";
|
|
2
|
+
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
2
3
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
4
|
//#region src/primitives/message/MessageIf.tsx
|
|
4
|
-
const MessageIf = (
|
|
5
|
-
const
|
|
5
|
+
const MessageIf = (t0) => {
|
|
6
|
+
const $ = c(2);
|
|
7
|
+
const { children, user, assistant, running, last } = t0;
|
|
8
|
+
const message = useAuiState(_temp);
|
|
6
9
|
if (user !== void 0) {
|
|
7
10
|
if (user !== (message.role === "user")) return null;
|
|
8
11
|
}
|
|
@@ -15,8 +18,17 @@ const MessageIf = ({ children, user, assistant, running, last }) => {
|
|
|
15
18
|
if (last !== void 0) {
|
|
16
19
|
if (last !== message.isLast) return null;
|
|
17
20
|
}
|
|
18
|
-
|
|
21
|
+
let t1;
|
|
22
|
+
if ($[0] !== children) {
|
|
23
|
+
t1 = /* @__PURE__ */ jsx(Fragment, { children });
|
|
24
|
+
$[0] = children;
|
|
25
|
+
$[1] = t1;
|
|
26
|
+
} else t1 = $[1];
|
|
27
|
+
return t1;
|
|
19
28
|
};
|
|
29
|
+
function _temp(s) {
|
|
30
|
+
return s.message;
|
|
31
|
+
}
|
|
20
32
|
//#endregion
|
|
21
33
|
export { MessageIf };
|
|
22
34
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageIf.js","names":[],"sources":["../../../src/primitives/message/MessageIf.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport type MessageIfProps = {\n children: ReactNode;\n user?: boolean | undefined;\n assistant?: boolean | undefined;\n running?: boolean | undefined;\n last?: boolean | undefined;\n};\n\nexport const MessageIf = ({\n children,\n user,\n assistant,\n running,\n last,\n}: MessageIfProps) => {\n const message = useAuiState((s) => s.message);\n\n if (user !== undefined) {\n if (user !== (message.role === \"user\")) return null;\n }\n\n if (assistant !== undefined) {\n if (assistant !== (message.role === \"assistant\")) return null;\n }\n\n if (running !== undefined) {\n const isRunning =\n message.role === \"assistant\" && message.status.type === \"running\";\n if (running !== isRunning) return null;\n }\n\n if (last !== undefined) {\n if (last !== message.isLast) return null;\n }\n\n return <>{children}</>;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"MessageIf.js","names":["ReactNode","useAuiState","MessageIfProps","children","user","assistant","running","last","MessageIf","t0","$","_c","message","_temp","undefined","role","isRunning","status","type","isLast","t1","s"],"sources":["../../../src/primitives/message/MessageIf.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport type MessageIfProps = {\n children: ReactNode;\n user?: boolean | undefined;\n assistant?: boolean | undefined;\n running?: boolean | undefined;\n last?: boolean | undefined;\n};\n\nexport const MessageIf = ({\n children,\n user,\n assistant,\n running,\n last,\n}: MessageIfProps) => {\n const message = useAuiState((s) => s.message);\n\n if (user !== undefined) {\n if (user !== (message.role === \"user\")) return null;\n }\n\n if (assistant !== undefined) {\n if (assistant !== (message.role === \"assistant\")) return null;\n }\n\n if (running !== undefined) {\n const isRunning =\n message.role === \"assistant\" && message.status.type === \"running\";\n if (running !== isRunning) return null;\n }\n\n if (last !== undefined) {\n if (last !== message.isLast) return null;\n }\n\n return <>{children}</>;\n};\n"],"mappings":";;;;AAWA,MAAaQ,aAAYC,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAR,UAAAC,MAAAC,WAAAC,SAAAC,SAAAE;CAOxB,MAAAG,UAAgBX,YAAYY,KAAgB;CAE5C,IAAIT,SAASU,KAAAA;MACPV,UAAUQ,QAAOG,SAAU,SAAO,OAAS;CAAA;CAGjD,IAAIV,cAAcS,KAAAA;MACZT,eAAeO,QAAOG,SAAU,cAAY,OAAS;CAAA;CAG3D,IAAIT,YAAYQ,KAAAA;MAGVR,aADFM,QAAOG,SAAU,eAAeH,QAAOK,OAAOC,SAAU,YACjC,OAAS;CAAA;CAGpC,IAAIX,SAASO,KAAAA;MACPP,SAASK,QAAOO,QAAO,OAAS;CAAA;CACrC,IAAAC;CAAA,IAAAV,EAAA,OAAAP,UAAA;EAEMiB,KAAA,oBAAA,UAAA,EAAGjB,SAAQ,CAAA;EAAIO,EAAA,KAAAP;EAAAO,EAAA,KAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,OAAfU;AAAe;AA3BC,SAAAP,MAAAQ,GAAA;CAAA,OAOYA,EAACT;AAAQ"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MessagePartComponent as MessagePartComponentBase, MessagePrimitivePartByIndex as MessagePrimitivePartByIndexBase, MessagePrimitiveParts as MessagePrimitiveParts$1, messagePartsDefaultComponents } from "@assistant-ui/core/react";
|
|
2
|
+
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
2
3
|
import { Text } from "react-native";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
//#region src/primitives/message/MessageParts.tsx
|
|
@@ -10,10 +11,30 @@ const rnDefaultComponents = {
|
|
|
10
11
|
* Renders the parts of a message with React Native-specific default components.
|
|
11
12
|
*/
|
|
12
13
|
const MessagePrimitiveParts = (props) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const $ = c(10);
|
|
15
|
+
if ("children" in props) {
|
|
16
|
+
let t0;
|
|
17
|
+
if ($[0] !== props.children) {
|
|
18
|
+
t0 = /* @__PURE__ */ jsx(MessagePrimitiveParts$1, { children: props.children });
|
|
19
|
+
$[0] = props.children;
|
|
20
|
+
$[1] = t0;
|
|
21
|
+
} else t0 = $[1];
|
|
22
|
+
return t0;
|
|
23
|
+
}
|
|
24
|
+
let components;
|
|
25
|
+
let rest;
|
|
26
|
+
if ($[2] !== props) {
|
|
27
|
+
({components, ...rest} = props);
|
|
28
|
+
$[2] = props;
|
|
29
|
+
$[3] = components;
|
|
30
|
+
$[4] = rest;
|
|
31
|
+
} else {
|
|
32
|
+
components = $[3];
|
|
33
|
+
rest = $[4];
|
|
34
|
+
}
|
|
35
|
+
let t0;
|
|
36
|
+
if ($[5] !== components) {
|
|
37
|
+
t0 = components ? {
|
|
17
38
|
Text: components.Text ?? rnDefaultComponents.Text,
|
|
18
39
|
Image: components.Image ?? messagePartsDefaultComponents.Image,
|
|
19
40
|
Reasoning: components.Reasoning ?? messagePartsDefaultComponents.Reasoning,
|
|
@@ -28,9 +49,22 @@ const MessagePrimitiveParts = (props) => {
|
|
|
28
49
|
},
|
|
29
50
|
Empty: components.Empty,
|
|
30
51
|
Quote: components.Quote
|
|
31
|
-
} : rnDefaultComponents
|
|
32
|
-
|
|
33
|
-
|
|
52
|
+
} : rnDefaultComponents;
|
|
53
|
+
$[5] = components;
|
|
54
|
+
$[6] = t0;
|
|
55
|
+
} else t0 = $[6];
|
|
56
|
+
const t1 = t0;
|
|
57
|
+
let t2;
|
|
58
|
+
if ($[7] !== rest || $[8] !== t1) {
|
|
59
|
+
t2 = /* @__PURE__ */ jsx(MessagePrimitiveParts$1, {
|
|
60
|
+
components: t1,
|
|
61
|
+
...rest
|
|
62
|
+
});
|
|
63
|
+
$[7] = rest;
|
|
64
|
+
$[8] = t1;
|
|
65
|
+
$[9] = t2;
|
|
66
|
+
} else t2 = $[9];
|
|
67
|
+
return t2;
|
|
34
68
|
};
|
|
35
69
|
MessagePrimitiveParts.displayName = "MessagePrimitive.Parts";
|
|
36
70
|
//#endregion
|