@assistant-ui/react-native 0.1.46 → 0.1.47
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 +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.d.ts +2 -2
- package/dist/primitives/actionBar/ActionBarCopy.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.js +2 -1
- package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts +2 -2
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js +2 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts +2 -2
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js +2 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.d.ts +1 -1
- package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +55 -38
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/message/MessageContent.d.ts.map +1 -1
- package/dist/primitives/message/MessageContent.js +13 -10
- package/dist/primitives/message/MessageContent.js.map +1 -1
- package/dist/primitives/message/MessageParts.d.ts +1 -0
- package/dist/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/primitives/message/MessageParts.js +22 -3
- package/dist/primitives/message/MessageParts.js.map +1 -1
- package/dist/primitives/message.js +1 -1
- package/dist/primitives/messagePart.js +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTitle.d.ts +10 -0
- package/dist/primitives/threadListItem/ThreadListItemTitle.d.ts.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemTitle.js +47 -0
- package/dist/primitives/threadListItem/ThreadListItemTitle.js.map +1 -0
- package/dist/primitives/threadListItem.d.ts +1 -1
- package/dist/primitives/threadListItem.d.ts.map +1 -1
- package/dist/primitives/threadListItem.js +3 -3
- package/dist/primitives/threadListItem.js.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +4 -0
- package/src/primitives/actionBar/ActionBar.test.tsx +45 -0
- package/src/primitives/actionBar/ActionBarCopy.tsx +12 -3
- package/src/primitives/actionBar/ActionBarFeedbackNegative.tsx +13 -3
- package/src/primitives/actionBar/ActionBarFeedbackPositive.tsx +13 -3
- package/src/primitives/composer/ComposerInput.test.tsx +64 -4
- package/src/primitives/composer/ComposerInput.tsx +13 -2
- package/src/primitives/message/MessageContent.runtime.test.tsx +35 -0
- package/src/primitives/message/MessageContent.test.tsx +68 -4
- package/src/primitives/message/MessageContent.tsx +19 -9
- package/src/primitives/message/MessageParts.test.tsx +68 -1
- package/src/primitives/message/MessageParts.tsx +17 -1
- package/src/primitives/threadListItem/ThreadListItemTitle.test.tsx +164 -0
- package/src/primitives/threadListItem/ThreadListItemTitle.tsx +23 -0
- package/src/primitives/threadListItem.ts +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,15 @@ export { RuntimeAdapterProvider, useRuntimeAdapters, type RuntimeAdapters, } fro
|
|
|
13
13
|
export { useLocalRuntime, type LocalRuntimeOptions, } from "./runtimes/useLocalRuntime.js";
|
|
14
14
|
export { useRemoteThreadListRuntime } from "./runtimes/useRemoteThreadListRuntime.js";
|
|
15
15
|
export { getExternalStoreMessages, bindExternalStoreMessage, pickExternalStoreSharedOptions, createMessageQueue, MessageNotSentError, isMessageNotSentError, type ExternalStoreAdapter, type ExternalStoreMessageConverter, type ExternalStoreSharedOptions, type ExternalStoreThreadListAdapter, type ExternalStoreThreadData, type ExternalStoreBranchChange, type ExternalThreadQueueAdapter, type ExternalThreadBranchAdapter, type MessageQueueDriver, type MessageQueueController, } from "@assistant-ui/core";
|
|
16
|
-
export { useExternalStoreRuntime, useExternalStoreSharedOptions, useExternalMessageConverter,
|
|
16
|
+
export { useExternalStoreRuntime, useExternalStoreSharedOptions, useExternalMessageConverter,
|
|
17
|
+
/** @deprecated Experimental since 2025-01-26. Not scheduled for removal; the API may change in any release. */
|
|
18
|
+
convertExternalMessages as unstable_convertExternalMessages,
|
|
19
|
+
/** @deprecated Experimental since 2026-09-15. Not scheduled for removal; the API may change in any release. */
|
|
20
|
+
createExternalMessageConversionCache as unstable_createExternalMessageConversionCache,
|
|
21
|
+
/** @deprecated Experimental since 2025-02-02. Not scheduled for removal; the API may change in any release. */
|
|
22
|
+
createMessageConverter as unstable_createMessageConverter,
|
|
23
|
+
/** @deprecated Experimental since 2026-09-15. Not scheduled for removal; the API may change in any release. */
|
|
24
|
+
type ExternalMessageConversionCache as Unstable_ExternalMessageConversionCache, type JoinStrategy, } from "@assistant-ui/core/react";
|
|
17
25
|
export * as ThreadPrimitive from "./primitives/thread.js";
|
|
18
26
|
export * as ComposerPrimitive from "./primitives/composer.js";
|
|
19
27
|
export * as QueueItemPrimitive from "./primitives/queueItem.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,YAAY,EAEV,aAAa,EACb,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,SAAS,EAET,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,4BAA4B,EAC5B,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,qBAAqB,EACr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,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,wBAAwB,EAAE,sCAAmC;AACtE,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,KAAK,eAAe,GACrB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,eAAe,EACf,KAAK,mBAAmB,GACzB,sCAAmC;AACpC,OAAO,EAAE,0BAA0B,EAAE,iDAA8C;AACnF,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,8BAA8B,EAC9B,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,KAAK,8BAA8B,EACnC,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC7B,2BAA2B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,YAAY,EAEV,aAAa,EACb,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,SAAS,EAET,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,4BAA4B,EAC5B,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,qBAAqB,EACrB,0BAA0B,EAE1B,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,qB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BAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,8BAA8B,EAC9B,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,WAAW,EACX,2BAA2B,EAC3B,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,yBAAyB,EACzB,kCAAkC,GACnC,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import { type PressableProps } from "react-native";
|
|
2
|
+
import { type PressableProps, type PressableStateCallbackType } from "react-native";
|
|
3
3
|
import { type UseActionBarCopyOptions } from "@assistant-ui/core/react";
|
|
4
4
|
export type ActionBarCopyProps = Omit<PressableProps, "onPress" | "children"> & UseActionBarCopyOptions & {
|
|
5
|
-
children: ReactNode | ((props: {
|
|
5
|
+
children: ReactNode | ((props: PressableStateCallbackType & {
|
|
6
6
|
isCopied: boolean;
|
|
7
7
|
disabled: boolean;
|
|
8
8
|
}) => ReactNode);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBarCopy.d.ts","sourceRoot":"","sources":["../../../src/primitives/actionBar/ActionBarCopy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"ActionBarCopy.d.ts","sourceRoot":"","sources":["../../../src/primitives/actionBar/ActionBarCopy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAChC,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,0BAA0B,CAAC;AAElC,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,UAAU,CAAC,GAC3E,uBAAuB,GAAG;IACxB,QAAQ,EACJ,SAAS,GACT,CAAC,CACC,KAAK,EAAE,0BAA0B,GAAG;QAClC,QAAQ,EAAE,OAAO,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC;KACnB,KACE,SAAS,CAAC,CAAC;CACrB,CAAC;AAEJ,eAAO,MAAM,aAAa,GAAI,0FAM3B,kBAAkB,gCAmBpB,CAAC"}
|
|
@@ -39,7 +39,8 @@ const ActionBarCopy = (t0) => {
|
|
|
39
39
|
const isDisabled = disabledProp ?? disabled;
|
|
40
40
|
let t2;
|
|
41
41
|
if ($[9] !== children || $[10] !== isCopied || $[11] !== isDisabled) {
|
|
42
|
-
t2 = typeof children === "function" ? children({
|
|
42
|
+
t2 = typeof children === "function" ? (state) => children({
|
|
43
|
+
...state,
|
|
43
44
|
isCopied,
|
|
44
45
|
disabled: isDisabled
|
|
45
46
|
}) : children;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBarCopy.js","names":["ReactNode","Pressable","PressableProps","useActionBarCopy","UseActionBarCopyOptions","ActionBarCopyProps","Omit","children","props","isCopied","disabled","ActionBarCopy","t0","$","_c","copiedDuration","copyToClipboard","disabledProp","pressableProps","t1","copy","isDisabled","t2","t3","_c"],"sources":["../../../src/primitives/actionBar/ActionBarCopy.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"ActionBarCopy.js","names":["ReactNode","Pressable","PressableProps","PressableStateCallbackType","useActionBarCopy","UseActionBarCopyOptions","ActionBarCopyProps","Omit","children","props","isCopied","disabled","ActionBarCopy","t0","$","_c","copiedDuration","copyToClipboard","disabledProp","pressableProps","t1","copy","isDisabled","t2","state","t3","_c"],"sources":["../../../src/primitives/actionBar/ActionBarCopy.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport {\n Pressable,\n type PressableProps,\n type PressableStateCallbackType,\n} from \"react-native\";\nimport {\n useActionBarCopy,\n type UseActionBarCopyOptions,\n} from \"@assistant-ui/core/react\";\n\nexport type ActionBarCopyProps = Omit<PressableProps, \"onPress\" | \"children\"> &\n UseActionBarCopyOptions & {\n children:\n | ReactNode\n | ((\n props: PressableStateCallbackType & {\n isCopied: boolean;\n disabled: boolean;\n },\n ) => ReactNode);\n };\n\nexport const ActionBarCopy = ({\n children,\n disabled: disabledProp,\n copiedDuration,\n copyToClipboard,\n ...pressableProps\n}: ActionBarCopyProps) => {\n const { copy, disabled, isCopied } = useActionBarCopy({\n copiedDuration,\n copyToClipboard,\n });\n const isDisabled = disabledProp ?? disabled;\n\n return (\n <Pressable\n onPress={copy}\n disabled={isDisabled}\n accessibilityRole=\"button\"\n {...pressableProps}\n >\n {typeof children === \"function\"\n ? (state) => children({ ...state, isCopied, disabled: isDisabled })\n : children}\n </Pressable>\n );\n};\n"],"mappings":";;;;;AAuBA,MAAaY,iBAAgBC,OAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAP;CAAA,IAAAQ;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAL,EAAA,OAAAD,IAAA;EAAC,CAAA,CAAAL,UAAAG,UAAAO,cAAAF,gBAAAC,iBAAA,GAAAE,kBAAAN;EAMTC,EAAA,KAAAD;EAAAC,EAAA,KAAAN;EAAAM,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;CAAA,OAAA;EAAAX,WAAAM,EAAA;EAAAE,iBAAAF,EAAA;EAAAG,kBAAAH,EAAA;EAAAI,eAAAJ,EAAA;EAAAK,iBAAAL,EAAA;CAAA;CAAA,IAAAM;CAAA,IAAAN,EAAA,OAAAE,kBAAAF,EAAA,OAAAG,iBAAA;EACmCG,KAAA;GAAAJ;GAAAC;EAGtD;EAACH,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAHD,MAAA,EAAAO,MAAAV,UAAAD,aAAqCN,iBAAiBgB,EAGrD;CACD,MAAAE,aAAmBJ,gBAAAP;CAAyB,IAAAY;CAAA,IAAAT,EAAA,OAAAN,YAAAM,EAAA,QAAAJ,YAAAI,EAAA,QAAAQ,YAAA;EASvCC,KAAA,OAAOf,aAAa,cAApBgB,UACchB,SAAS;GAAA,GAAKgB;GAAKd;GAAAC,UAAsBW;EAAW,CAAC,IADnEd;EAEWM,EAAA,KAAAN;EAAAM,EAAA,MAAAJ;EAAAI,EAAA,MAAAQ;EAAAR,EAAA,MAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,QAAAO,QAAAP,EAAA,QAAAQ,cAAAR,EAAA,QAAAK,kBAAAL,EAAA,QAAAS,IAAA;EARdE,KAAA,oBAAC,WAAD;GACWJ,SAAAA;GACCC,UAAAA;GACQ,mBAAA;GAAQ,GACtBH;GAEHI,UAAAA;EANO,CAAA;EASET,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;EAAAR,EAAA,MAAAK;EAAAL,EAAA,MAAAS;EAAAT,EAAA,MAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,OATZW;AASY"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import { type PressableProps } from "react-native";
|
|
2
|
+
import { type PressableProps, type PressableStateCallbackType } from "react-native";
|
|
3
3
|
export type ActionBarFeedbackNegativeProps = Omit<PressableProps, "onPress" | "children"> & {
|
|
4
|
-
children: ReactNode | ((props: {
|
|
4
|
+
children: ReactNode | ((props: PressableStateCallbackType & {
|
|
5
5
|
isSubmitted: boolean;
|
|
6
6
|
disabled: boolean;
|
|
7
7
|
}) => ReactNode);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBarFeedbackNegative.d.ts","sourceRoot":"","sources":["../../../src/primitives/actionBar/ActionBarFeedbackNegative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"ActionBarFeedbackNegative.d.ts","sourceRoot":"","sources":["../../../src/primitives/actionBar/ActionBarFeedbackNegative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAChC,MAAM,cAAc,CAAC;AAGtB,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAC/C,cAAc,EACd,SAAS,GAAG,UAAU,CACvB,GAAG;IACF,QAAQ,EACJ,SAAS,GACT,CAAC,CACC,KAAK,EAAE,0BAA0B,GAAG;QAClC,WAAW,EAAE,OAAO,CAAC;QACrB,QAAQ,EAAE,OAAO,CAAC;KACnB,KACE,SAAS,CAAC,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,yDAIvC,8BAA8B,gCAmBhC,CAAC"}
|
|
@@ -29,7 +29,8 @@ const ActionBarFeedbackNegative = (t0) => {
|
|
|
29
29
|
} else t1 = $[5];
|
|
30
30
|
let t2;
|
|
31
31
|
if ($[6] !== children || $[7] !== disabled || $[8] !== isSubmitted) {
|
|
32
|
-
t2 = typeof children === "function" ? children({
|
|
32
|
+
t2 = typeof children === "function" ? (state) => children({
|
|
33
|
+
...state,
|
|
33
34
|
isSubmitted,
|
|
34
35
|
disabled
|
|
35
36
|
}) : children;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBarFeedbackNegative.js","names":["ReactNode","Platform","Pressable","PressableProps","useActionBarFeedbackNegative","ActionBarFeedbackNegativeProps","Omit","children","props","isSubmitted","disabled","ActionBarFeedbackNegative","t0","$","_c","disabledProp","pressableProps","submit","t1","OS","t2","t3","_c"],"sources":["../../../src/primitives/actionBar/ActionBarFeedbackNegative.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"ActionBarFeedbackNegative.js","names":["ReactNode","Platform","Pressable","PressableProps","PressableStateCallbackType","useActionBarFeedbackNegative","ActionBarFeedbackNegativeProps","Omit","children","props","isSubmitted","disabled","ActionBarFeedbackNegative","t0","$","_c","disabledProp","pressableProps","submit","t1","OS","t2","state","t3","_c"],"sources":["../../../src/primitives/actionBar/ActionBarFeedbackNegative.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport {\n Platform,\n Pressable,\n type PressableProps,\n type PressableStateCallbackType,\n} from \"react-native\";\nimport { useActionBarFeedbackNegative } from \"@assistant-ui/core/react\";\n\nexport type ActionBarFeedbackNegativeProps = Omit<\n PressableProps,\n \"onPress\" | \"children\"\n> & {\n children:\n | ReactNode\n | ((\n props: PressableStateCallbackType & {\n isSubmitted: boolean;\n disabled: boolean;\n },\n ) => ReactNode);\n};\n\nexport const ActionBarFeedbackNegative = ({\n children,\n disabled: disabledProp,\n ...pressableProps\n}: ActionBarFeedbackNegativeProps) => {\n const { submit, isSubmitted } = useActionBarFeedbackNegative();\n const disabled = disabledProp ?? false;\n\n return (\n <Pressable\n onPress={submit}\n disabled={disabledProp}\n accessibilityRole=\"button\"\n {...(Platform.OS === \"web\"\n ? { \"aria-pressed\": isSubmitted }\n : { \"aria-selected\": isSubmitted })}\n {...pressableProps}\n >\n {typeof children === \"function\"\n ? (state) => children({ ...state, isSubmitted, disabled })\n : children}\n </Pressable>\n );\n};\n"],"mappings":";;;;;AAuBA,MAAaY,6BAA4BC,OAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAP;CAAA,IAAAQ;CAAA,IAAAC;CAAA,IAAAH,EAAA,OAAAD,IAAA;EAAC,CAAA,CAAAL,UAAAG,UAAAK,cAAA,GAAAC,kBAAAJ;EAITC,EAAA,KAAAD;EAAAC,EAAA,KAAAN;EAAAM,EAAA,KAAAE;EAAAF,EAAA,KAAAG;CAAA,OAAA;EAAAT,WAAAM,EAAA;EAAAE,eAAAF,EAAA;EAAAG,iBAAAH,EAAA;CAAA;CAC/B,MAAA,EAAAI,QAAAR,gBAAgCL,6BAA6B;CAC7D,MAAAM,WAAiBK,gBAAA;CAAsB,IAAAG;CAAA,IAAAL,EAAA,OAAAJ,aAAA;EAO9BS,KAAAlB,SAAQmB,OAAQ,QAAhB,EAAA,gBACiBV,YACa,IAF9B,EAAA,iBAEkBA,YAAY;EAACI,EAAA,KAAAJ;EAAAI,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,OAAAN,YAAAM,EAAA,OAAAH,YAAAG,EAAA,OAAAJ,aAAA;EAGnCW,KAAA,OAAOb,aAAa,cAApBc,UACcd,SAAS;GAAA,GAAKc;GAAKZ;GAAAC;EAAwB,CAAC,IAD1DH;EAEWM,EAAA,KAAAN;EAAAM,EAAA,KAAAH;EAAAG,EAAA,KAAAJ;EAAAI,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAS;CAAA,IAAAT,EAAA,QAAAE,gBAAAF,EAAA,QAAAG,kBAAAH,EAAA,QAAAI,UAAAJ,EAAA,QAAAK,MAAAL,EAAA,QAAAO,IAAA;EAXdE,KAAA,oBAAC,WAAD;GACWL,SAAAA;GACCF,UAAAA;GACQ,mBAAA;GAAQ,GACrBG;GAE+B,GAChCF;GAEHI,UAAAA;EATO,CAAA;EAYEP,EAAA,MAAAE;EAAAF,EAAA,MAAAG;EAAAH,EAAA,MAAAI;EAAAJ,EAAA,MAAAK;EAAAL,EAAA,MAAAO;EAAAP,EAAA,MAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,OAZZS;AAYY"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import { type PressableProps } from "react-native";
|
|
2
|
+
import { type PressableProps, type PressableStateCallbackType } from "react-native";
|
|
3
3
|
export type ActionBarFeedbackPositiveProps = Omit<PressableProps, "onPress" | "children"> & {
|
|
4
|
-
children: ReactNode | ((props: {
|
|
4
|
+
children: ReactNode | ((props: PressableStateCallbackType & {
|
|
5
5
|
isSubmitted: boolean;
|
|
6
6
|
disabled: boolean;
|
|
7
7
|
}) => ReactNode);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBarFeedbackPositive.d.ts","sourceRoot":"","sources":["../../../src/primitives/actionBar/ActionBarFeedbackPositive.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"ActionBarFeedbackPositive.d.ts","sourceRoot":"","sources":["../../../src/primitives/actionBar/ActionBarFeedbackPositive.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAChC,MAAM,cAAc,CAAC;AAGtB,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAC/C,cAAc,EACd,SAAS,GAAG,UAAU,CACvB,GAAG;IACF,QAAQ,EACJ,SAAS,GACT,CAAC,CACC,KAAK,EAAE,0BAA0B,GAAG;QAClC,WAAW,EAAE,OAAO,CAAC;QACrB,QAAQ,EAAE,OAAO,CAAC;KACnB,KACE,SAAS,CAAC,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,yDAIvC,8BAA8B,gCAmBhC,CAAC"}
|
|
@@ -29,7 +29,8 @@ const ActionBarFeedbackPositive = (t0) => {
|
|
|
29
29
|
} else t1 = $[5];
|
|
30
30
|
let t2;
|
|
31
31
|
if ($[6] !== children || $[7] !== disabled || $[8] !== isSubmitted) {
|
|
32
|
-
t2 = typeof children === "function" ? children({
|
|
32
|
+
t2 = typeof children === "function" ? (state) => children({
|
|
33
|
+
...state,
|
|
33
34
|
isSubmitted,
|
|
34
35
|
disabled
|
|
35
36
|
}) : children;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBarFeedbackPositive.js","names":["ReactNode","Platform","Pressable","PressableProps","useActionBarFeedbackPositive","ActionBarFeedbackPositiveProps","Omit","children","props","isSubmitted","disabled","ActionBarFeedbackPositive","t0","$","_c","disabledProp","pressableProps","submit","t1","OS","t2","t3","_c"],"sources":["../../../src/primitives/actionBar/ActionBarFeedbackPositive.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"ActionBarFeedbackPositive.js","names":["ReactNode","Platform","Pressable","PressableProps","PressableStateCallbackType","useActionBarFeedbackPositive","ActionBarFeedbackPositiveProps","Omit","children","props","isSubmitted","disabled","ActionBarFeedbackPositive","t0","$","_c","disabledProp","pressableProps","submit","t1","OS","t2","state","t3","_c"],"sources":["../../../src/primitives/actionBar/ActionBarFeedbackPositive.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport {\n Platform,\n Pressable,\n type PressableProps,\n type PressableStateCallbackType,\n} from \"react-native\";\nimport { useActionBarFeedbackPositive } from \"@assistant-ui/core/react\";\n\nexport type ActionBarFeedbackPositiveProps = Omit<\n PressableProps,\n \"onPress\" | \"children\"\n> & {\n children:\n | ReactNode\n | ((\n props: PressableStateCallbackType & {\n isSubmitted: boolean;\n disabled: boolean;\n },\n ) => ReactNode);\n};\n\nexport const ActionBarFeedbackPositive = ({\n children,\n disabled: disabledProp,\n ...pressableProps\n}: ActionBarFeedbackPositiveProps) => {\n const { submit, isSubmitted } = useActionBarFeedbackPositive();\n const disabled = disabledProp ?? false;\n\n return (\n <Pressable\n onPress={submit}\n disabled={disabledProp}\n accessibilityRole=\"button\"\n {...(Platform.OS === \"web\"\n ? { \"aria-pressed\": isSubmitted }\n : { \"aria-selected\": isSubmitted })}\n {...pressableProps}\n >\n {typeof children === \"function\"\n ? (state) => children({ ...state, isSubmitted, disabled })\n : children}\n </Pressable>\n );\n};\n"],"mapp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AH,EAAA,MAAAI;EAAAJ,EAAA,MAAAK;EAAAL,EAAA,MAAAO;EAAAP,EAAA,MAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,OAZZS;AAYY"}
|
|
@@ -8,5 +8,5 @@ export type ComposerInputProps = Omit<TextInputProps, "value" | "onChangeText">
|
|
|
8
8
|
*/
|
|
9
9
|
submitMode?: "enter" | "none";
|
|
10
10
|
};
|
|
11
|
-
export declare const ComposerInput: ({ submitMode, onKeyPress: onKeyPressProp, numberOfLines, style, ...props }: ComposerInputProps) => import("react").JSX.Element;
|
|
11
|
+
export declare const ComposerInput: ({ submitMode, onKeyPress: onKeyPressProp, numberOfLines, style, editable, readOnly, ...props }: ComposerInputProps) => import("react").JSX.Element;
|
|
12
12
|
//# sourceMappingURL=ComposerInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComposerInput.d.ts","sourceRoot":"","sources":["../../../src/primitives/composer/ComposerInput.tsx"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ComposerInput.d.ts","sourceRoot":"","sources":["../../../src/primitives/composer/ComposerInput.tsx"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAUxE,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,cAAc,EACd,OAAO,GAAG,cAAc,CACzB,GAAG;IACF;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC/B,CAAC;AAmCF,eAAO,MAAM,aAAa,GAAI,gGAQ3B,kBAAkB,gCA2EpB,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
|
3
3
|
import { Platform, TextInput } from "react-native";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { useEffect, useRef } from "@assistant-ui/tap/react-shim";
|
|
6
|
+
import { composerInputDisabled } from "@assistant-ui/core/store/internal";
|
|
6
7
|
import { flushTapSync } from "@assistant-ui/tap";
|
|
7
8
|
//#region src/primitives/composer/ComposerInput.tsx
|
|
8
9
|
const getWebTextareaMaxHeight = (el) => {
|
|
@@ -28,34 +29,42 @@ const adjustWebTextareaHeight = (ref) => {
|
|
|
28
29
|
el.style.height = `${nextHeight}px`;
|
|
29
30
|
};
|
|
30
31
|
const ComposerInput = (t0) => {
|
|
31
|
-
const $ = c(
|
|
32
|
+
const $ = c(28);
|
|
33
|
+
let editable;
|
|
32
34
|
let numberOfLines;
|
|
33
35
|
let onKeyPressProp;
|
|
34
36
|
let props;
|
|
37
|
+
let readOnly;
|
|
35
38
|
let style;
|
|
36
39
|
let t1;
|
|
37
40
|
if ($[0] !== t0) {
|
|
38
|
-
({submitMode: t1, onKeyPress: onKeyPressProp, numberOfLines, style, ...props} = t0);
|
|
41
|
+
({submitMode: t1, onKeyPress: onKeyPressProp, numberOfLines, style, editable, readOnly, ...props} = t0);
|
|
39
42
|
$[0] = t0;
|
|
40
|
-
$[1] =
|
|
41
|
-
$[2] =
|
|
42
|
-
$[3] =
|
|
43
|
-
$[4] =
|
|
44
|
-
$[5] =
|
|
43
|
+
$[1] = editable;
|
|
44
|
+
$[2] = numberOfLines;
|
|
45
|
+
$[3] = onKeyPressProp;
|
|
46
|
+
$[4] = props;
|
|
47
|
+
$[5] = readOnly;
|
|
48
|
+
$[6] = style;
|
|
49
|
+
$[7] = t1;
|
|
45
50
|
} else {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
editable = $[1];
|
|
52
|
+
numberOfLines = $[2];
|
|
53
|
+
onKeyPressProp = $[3];
|
|
54
|
+
props = $[4];
|
|
55
|
+
readOnly = $[5];
|
|
56
|
+
style = $[6];
|
|
57
|
+
t1 = $[7];
|
|
51
58
|
}
|
|
52
59
|
const submitMode = t1 === void 0 ? "enter" : t1;
|
|
53
60
|
const aui = useAui();
|
|
54
61
|
const text = useAuiState(_temp);
|
|
62
|
+
const isInputDisabled = useAuiState(composerInputDisabled);
|
|
55
63
|
const inputRef = useRef(null);
|
|
56
64
|
let t2;
|
|
57
|
-
if ($[
|
|
65
|
+
if ($[8] !== aui || $[9] !== isInputDisabled) {
|
|
58
66
|
t2 = (value) => {
|
|
67
|
+
if (isInputDisabled) return;
|
|
59
68
|
if (Platform.OS === "web") {
|
|
60
69
|
flushTapSync(() => {
|
|
61
70
|
aui.composer.setText(value);
|
|
@@ -64,29 +73,31 @@ const ComposerInput = (t0) => {
|
|
|
64
73
|
}
|
|
65
74
|
aui.composer.setText(value);
|
|
66
75
|
};
|
|
67
|
-
$[
|
|
68
|
-
$[
|
|
69
|
-
|
|
76
|
+
$[8] = aui;
|
|
77
|
+
$[9] = isInputDisabled;
|
|
78
|
+
$[10] = t2;
|
|
79
|
+
} else t2 = $[10];
|
|
70
80
|
const onChangeText = t2;
|
|
71
81
|
let t3;
|
|
72
|
-
if ($[
|
|
82
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
73
83
|
t3 = () => {
|
|
74
84
|
adjustWebTextareaHeight(inputRef);
|
|
75
85
|
};
|
|
76
|
-
$[
|
|
77
|
-
} else t3 = $[
|
|
86
|
+
$[11] = t3;
|
|
87
|
+
} else t3 = $[11];
|
|
78
88
|
let t4;
|
|
79
|
-
if ($[
|
|
89
|
+
if ($[12] !== text) {
|
|
80
90
|
t4 = [text];
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
83
|
-
} else t4 = $[
|
|
91
|
+
$[12] = text;
|
|
92
|
+
$[13] = t4;
|
|
93
|
+
} else t4 = $[13];
|
|
84
94
|
useEffect(t3, t4);
|
|
85
95
|
let t5;
|
|
86
|
-
if ($[
|
|
96
|
+
if ($[14] !== aui || $[15] !== isInputDisabled || $[16] !== onKeyPressProp || $[17] !== submitMode) {
|
|
87
97
|
t5 = (e) => {
|
|
88
98
|
onKeyPressProp?.(e);
|
|
89
99
|
if (e.isDefaultPrevented()) return;
|
|
100
|
+
if (isInputDisabled) return;
|
|
90
101
|
if (Platform.OS !== "web") return;
|
|
91
102
|
if (submitMode !== "enter") return;
|
|
92
103
|
const nativeEvent = e.nativeEvent;
|
|
@@ -98,32 +109,38 @@ const ComposerInput = (t0) => {
|
|
|
98
109
|
aui.composer.send();
|
|
99
110
|
}
|
|
100
111
|
};
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
|
|
112
|
+
$[14] = aui;
|
|
113
|
+
$[15] = isInputDisabled;
|
|
114
|
+
$[16] = onKeyPressProp;
|
|
115
|
+
$[17] = submitMode;
|
|
116
|
+
$[18] = t5;
|
|
117
|
+
} else t5 = $[18];
|
|
106
118
|
const onKeyPress = t5;
|
|
119
|
+
const isReadOnly = isInputDisabled || editable === false || readOnly === true;
|
|
107
120
|
const t6 = numberOfLines ?? (Platform.OS === "web" ? 1 : void 0);
|
|
108
121
|
let t7;
|
|
109
|
-
if ($[
|
|
122
|
+
if ($[19] !== editable || $[20] !== isReadOnly || $[21] !== onChangeText || $[22] !== onKeyPress || $[23] !== props || $[24] !== style || $[25] !== t6 || $[26] !== text) {
|
|
110
123
|
t7 = /* @__PURE__ */ jsx(TextInput, {
|
|
111
124
|
ref: inputRef,
|
|
112
125
|
value: text,
|
|
113
126
|
onChangeText,
|
|
114
127
|
onKeyPress,
|
|
115
128
|
numberOfLines: t6,
|
|
129
|
+
editable,
|
|
130
|
+
readOnly: isReadOnly,
|
|
116
131
|
style,
|
|
117
132
|
...props
|
|
118
133
|
});
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
|
|
134
|
+
$[19] = editable;
|
|
135
|
+
$[20] = isReadOnly;
|
|
136
|
+
$[21] = onChangeText;
|
|
137
|
+
$[22] = onKeyPress;
|
|
138
|
+
$[23] = props;
|
|
139
|
+
$[24] = style;
|
|
140
|
+
$[25] = t6;
|
|
141
|
+
$[26] = text;
|
|
142
|
+
$[27] = t7;
|
|
143
|
+
} else t7 = $[27];
|
|
127
144
|
return t7;
|
|
128
145
|
};
|
|
129
146
|
function _temp(s) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComposerInput.js","names":["useCallback","useEffect","useRef","Platform","TextInput","TextInputProps","useAui","useAuiState","flushTapSync","TextInputInstance","React","ComponentRef","TextInputKeyPressEvent","Parameters","NonNullable","ComposerInputProps","Omit","submitMode","getWebTextareaMaxHeight","el","HTMLTextAreaElement","computedMaxHeight","globalThis","getComputedStyle","maxHeight","parsedComputedMaxHeight","Number","parseFloat","isFinite","inlineMaxHeight","style","adjustWebTextareaHeight","ref","RefObject","OS","current","rows","overflowX","overflowY","height","scrollHeight","needsScrollbar","nextHeight","Math","min","ComposerInput","t0","$","_c","numberOfLines","onKeyPressProp","props","t1","onKeyPress","undefined","aui","text","_temp","inputRef","t2","value","composer","setText","onChangeText","t3","Symbol","for","t4","t5","e","isDefaultPrevented","nativeEvent","shiftKey","isComposing","keyCode","key","threadState","thread","getState","isRunning","capabilities","queue","voice","Event","preventDefault","send","t6","t7","s","_c"],"sources":["../../../src/primitives/composer/ComposerInput.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef } from \"react\";\nimport { Platform, TextInput, type TextInputProps } from \"react-native\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport { flushTapSync } from \"@assistant-ui/tap\";\n\ntype TextInputInstance = React.ComponentRef<typeof TextInput>;\ntype TextInputKeyPressEvent = Parameters<\n NonNullable<TextInputProps[\"onKeyPress\"]>\n>[0];\n\nexport type ComposerInputProps = Omit<\n TextInputProps,\n \"value\" | \"onChangeText\"\n> & {\n /**\n * Controls how the Enter key submits messages (web only).\n * - \"enter\": Plain Enter submits (Shift+Enter for newline)\n * - \"none\": Enter inserts newline (no keyboard submission)\n * @default \"enter\"\n */\n submitMode?: \"enter\" | \"none\";\n};\n\nconst getWebTextareaMaxHeight = (el: HTMLTextAreaElement) => {\n const computedMaxHeight = globalThis.getComputedStyle?.(el).maxHeight;\n const parsedComputedMaxHeight = Number.parseFloat(computedMaxHeight ?? \"\");\n if (Number.isFinite(parsedComputedMaxHeight)) return parsedComputedMaxHeight;\n\n const inlineMaxHeight = Number.parseFloat(el.style.maxHeight);\n return Number.isFinite(inlineMaxHeight) ? inlineMaxHeight : null;\n};\n\nconst adjustWebTextareaHeight = (\n ref: React.RefObject<TextInputInstance | null>,\n) => {\n if (Platform.OS !== \"web\") return;\n // On web, the TextInput ref IS the DOM element\n const el = ref.current as unknown as HTMLTextAreaElement | null;\n if (!el) return;\n // Ensure rows=1 so scrollHeight reflects actual content\n if (el.rows !== 1) el.rows = 1;\n\n el.style.overflowX = \"hidden\";\n el.style.overflowY = \"hidden\";\n el.style.height = \"auto\";\n\n const scrollHeight = el.scrollHeight;\n const maxHeight = getWebTextareaMaxHeight(el);\n const needsScrollbar = maxHeight !== null && scrollHeight > maxHeight;\n const nextHeight =\n maxHeight === null ? scrollHeight : Math.min(scrollHeight, maxHeight);\n\n el.style.overflowY = needsScrollbar ? \"auto\" : \"hidden\";\n el.style.height = `${nextHeight}px`;\n};\n\nexport const ComposerInput = ({\n submitMode = \"enter\",\n onKeyPress: onKeyPressProp,\n numberOfLines,\n style,\n ...props\n}: ComposerInputProps) => {\n const aui = useAui();\n const text = useAuiState((s) => s.composer.text);\n const inputRef = useRef<TextInputInstance>(null);\n\n const onChangeText = useCallback(\n (value: string) => {\n if (Platform.OS === \"web\") {\n // Keep the controlled value in sync mid-IME so react-dom does not reset the textarea to a stale value\n flushTapSync(() => {\n aui.composer.setText(value);\n });\n return;\n }\n aui.composer.setText(value);\n },\n [aui],\n );\n\n // Auto-resize textarea on web when text changes\n useEffect(() => {\n void text; // trigger re-run when text changes\n adjustWebTextareaHeight(inputRef);\n }, [text]);\n\n const onKeyPress = useCallback(\n (e: TextInputKeyPressEvent) => {\n onKeyPressProp?.(e);\n if (e.isDefaultPrevented()) return;\n\n if (Platform.OS !== \"web\") return;\n if (submitMode !== \"enter\") return;\n\n const nativeEvent =\n e.nativeEvent as TextInputKeyPressEvent[\"nativeEvent\"] & {\n shiftKey?: boolean;\n isComposing?: boolean;\n keyCode?: number;\n };\n // react-native-web forwards the raw DOM keydown before its own composition guard, so re-check it here (mirrors isEventComposing)\n if (nativeEvent.isComposing || nativeEvent.keyCode === 229) return;\n if (nativeEvent.key === \"Enter\" && !nativeEvent.shiftKey) {\n const threadState = aui.thread.getState();\n if (\n threadState.isRunning &&\n !threadState.capabilities.queue &&\n threadState.voice === undefined\n )\n return;\n (e as unknown as Event).preventDefault?.();\n aui.composer.send();\n }\n },\n [aui, submitMode, onKeyPressProp],\n );\n\n return (\n <TextInput\n ref={inputRef}\n value={text}\n onChangeText={onChangeText}\n onKeyPress={onKeyPress}\n numberOfLines={numberOfLines ?? (Platform.OS === \"web\" ? 1 : undefined)}\n style={style}\n {...props}\n />\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ComposerInput.js","names":["useCallback","useEffect","useRef","Platform","TextInput","TextInputProps","composerInputDisabled","useAui","useAuiState","flushTapSync","TextInputInstance","React","ComponentRef","TextInputKeyPressEvent","Parameters","NonNullable","ComposerInputProps","Omit","submitMode","getWebTextareaMaxHeight","el","HTMLTextAreaElement","computedMaxHeight","globalThis","getComputedStyle","maxHeight","parsedComputedMaxHeight","Number","parseFloat","isFinite","inlineMaxHeight","style","adjustWebTextareaHeight","ref","RefObject","OS","current","rows","overflowX","overflowY","height","scrollHeight","needsScrollbar","nextHeight","Math","min","ComposerInput","t0","$","_c","editable","numberOfLines","onKeyPressProp","props","readOnly","t1","onKeyPress","undefined","aui","text","_temp","isInputDisabled","inputRef","t2","value","composer","setText","onChangeText","t3","Symbol","for","t4","t5","e","isDefaultPrevented","nativeEvent","shiftKey","isComposing","keyCode","key","threadState","thread","getState","isRunning","capabilities","queue","voice","Event","preventDefault","send","isReadOnly","t6","t7","s","_c"],"sources":["../../../src/primitives/composer/ComposerInput.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef } from \"react\";\nimport { Platform, TextInput, type TextInputProps } from \"react-native\";\nimport { composerInputDisabled } from \"@assistant-ui/core/store/internal\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport { flushTapSync } from \"@assistant-ui/tap\";\n\ntype TextInputInstance = React.ComponentRef<typeof TextInput>;\ntype TextInputKeyPressEvent = Parameters<\n NonNullable<TextInputProps[\"onKeyPress\"]>\n>[0];\n\nexport type ComposerInputProps = Omit<\n TextInputProps,\n \"value\" | \"onChangeText\"\n> & {\n /**\n * Controls how the Enter key submits messages (web only).\n * - \"enter\": Plain Enter submits (Shift+Enter for newline)\n * - \"none\": Enter inserts newline (no keyboard submission)\n * @default \"enter\"\n */\n submitMode?: \"enter\" | \"none\";\n};\n\nconst getWebTextareaMaxHeight = (el: HTMLTextAreaElement) => {\n const computedMaxHeight = globalThis.getComputedStyle?.(el).maxHeight;\n const parsedComputedMaxHeight = Number.parseFloat(computedMaxHeight ?? \"\");\n if (Number.isFinite(parsedComputedMaxHeight)) return parsedComputedMaxHeight;\n\n const inlineMaxHeight = Number.parseFloat(el.style.maxHeight);\n return Number.isFinite(inlineMaxHeight) ? inlineMaxHeight : null;\n};\n\nconst adjustWebTextareaHeight = (\n ref: React.RefObject<TextInputInstance | null>,\n) => {\n if (Platform.OS !== \"web\") return;\n // On web, the TextInput ref IS the DOM element\n const el = ref.current as unknown as HTMLTextAreaElement | null;\n if (!el) return;\n // Ensure rows=1 so scrollHeight reflects actual content\n if (el.rows !== 1) el.rows = 1;\n\n el.style.overflowX = \"hidden\";\n el.style.overflowY = \"hidden\";\n el.style.height = \"auto\";\n\n const scrollHeight = el.scrollHeight;\n const maxHeight = getWebTextareaMaxHeight(el);\n const needsScrollbar = maxHeight !== null && scrollHeight > maxHeight;\n const nextHeight =\n maxHeight === null ? scrollHeight : Math.min(scrollHeight, maxHeight);\n\n el.style.overflowY = needsScrollbar ? \"auto\" : \"hidden\";\n el.style.height = `${nextHeight}px`;\n};\n\nexport const ComposerInput = ({\n submitMode = \"enter\",\n onKeyPress: onKeyPressProp,\n numberOfLines,\n style,\n editable,\n readOnly,\n ...props\n}: ComposerInputProps) => {\n const aui = useAui();\n const text = useAuiState((s) => s.composer.text);\n const isInputDisabled = useAuiState(composerInputDisabled);\n const inputRef = useRef<TextInputInstance>(null);\n\n const onChangeText = useCallback(\n (value: string) => {\n if (isInputDisabled) return;\n\n if (Platform.OS === \"web\") {\n // Keep the controlled value in sync mid-IME so react-dom does not reset the textarea to a stale value\n flushTapSync(() => {\n aui.composer.setText(value);\n });\n return;\n }\n aui.composer.setText(value);\n },\n [aui, isInputDisabled],\n );\n\n // Auto-resize textarea on web when text changes\n useEffect(() => {\n void text; // trigger re-run when text changes\n adjustWebTextareaHeight(inputRef);\n }, [text]);\n\n const onKeyPress = useCallback(\n (e: TextInputKeyPressEvent) => {\n onKeyPressProp?.(e);\n if (e.isDefaultPrevented()) return;\n if (isInputDisabled) return;\n\n if (Platform.OS !== \"web\") return;\n if (submitMode !== \"enter\") return;\n\n const nativeEvent =\n e.nativeEvent as TextInputKeyPressEvent[\"nativeEvent\"] & {\n shiftKey?: boolean;\n isComposing?: boolean;\n keyCode?: number;\n };\n // react-native-web forwards the raw DOM keydown before its own composition guard, so re-check it here (mirrors isEventComposing)\n if (nativeEvent.isComposing || nativeEvent.keyCode === 229) return;\n if (nativeEvent.key === \"Enter\" && !nativeEvent.shiftKey) {\n const threadState = aui.thread.getState();\n if (\n threadState.isRunning &&\n !threadState.capabilities.queue &&\n threadState.voice === undefined\n )\n return;\n (e as unknown as Event).preventDefault?.();\n aui.composer.send();\n }\n },\n [aui, isInputDisabled, submitMode, onKeyPressProp],\n );\n\n const isReadOnly = isInputDisabled || editable === false || readOnly === true;\n\n return (\n <TextInput\n ref={inputRef}\n value={text}\n onChangeText={onChangeText}\n onKeyPress={onKeyPress}\n numberOfLines={numberOfLines ?? (Platform.OS === \"web\" ? 1 : undefined)}\n editable={editable}\n readOnly={isReadOnly}\n style={style}\n {...props}\n />\n );\n};\n"],"mappings":";;;;;;;;AAwBA,MAAMmB,2BAA2BC,OAA4B;CAC3D,MAAME,oBAAoBC,WAAWC,mBAAmBJ,EAAE,CAAC,CAACK;CAC5D,MAAMC,0BAA0BC,OAAOC,WAAWN,qBAAqB,EAAE;CACzE,IAAIK,OAAOE,SAASH,uBAAuB,GAAG,OAAOA;CAErD,MAAMI,kBAAkBH,OAAOC,WAAWR,GAAGW,MAAMN,SAAS;CAC5D,OAAOE,OAAOE,SAASC,eAAe,IAAIA,kBAAkB;AAC9D;AAEA,MAAME,2BACJC,QACG;CACH,IAAI9B,SAASgC,OAAO,OAAO;CAE3B,MAAMf,KAAKa,IAAIG;CACf,IAAI,CAAChB,IAAI;CAET,IAAIA,GAAGiB,SAAS,GAAGjB,GAAGiB,OAAO;CAE7BjB,GAAGW,MAAMO,YAAY;CACrBlB,GAAGW,MAAMQ,YAAY;CACrBnB,GAAGW,MAAMS,SAAS;CAElB,MAAMC,eAAerB,GAAGqB;CACxB,MAAMhB,YAAYN,wBAAwBC,EAAE;CAC5C,MAAMsB,iBAAiBjB,cAAc,QAAQgB,eAAehB;CAC5D,MAAMkB,aACJlB,cAAc,OAAOgB,eAAeG,KAAKC,IAAIJ,cAAchB,SAAS;CAEtEL,GAAGW,MAAMQ,YAAYG,iBAAiB,SAAS;CAC/CtB,GAAGW,MAAMS,SAAS,GAAGG,WAAU;AACjC;AAEA,MAAaG,iBAAgBC,OAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAvB;CAAA,IAAAwB;CAAA,IAAAP,EAAA,OAAAD,IAAA;EAAC,CAAA,CAAA7B,YAAAqC,IAAAC,YAAAJ,gBAAA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C;GACAwC,UAAAA;GACH3D;GAAK,GACRsB;EAAK,CAAA;EACTL,EAAA,MAAAE;EAAAF,EAAA,MAAA0C;EAAA1C,EAAA,MAAAmB;EAAAnB,EAAA,MAAAQ;EAAAR,EAAA,MAAAK;EAAAL,EAAA,MAAAjB;EAAAiB,EAAA,MAAA2C;EAAA3C,EAAA,MAAAW;EAAAX,EAAA,MAAA4C;CAAA,OAAAA,KAAA5C,EAAA;CAAA,OAVF4C;AAUE;AAjFuB,SAAAhC,MAAAiC,GAAA;CAAA,OAUKA,EAAC5B,SAASN;AAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageContent.d.ts","sourceRoot":"","sources":["../../../src/primitives/message/MessageContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MessageContent.d.ts","sourceRoot":"","sources":["../../../src/primitives/message/MessageContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,OAAO,CAAC;AAE7D,OAAO,KAAK,EACV,qBAAqB,EACrB,0BAA0B,EAE3B,MAAM,oBAAoB,CAAC;AAa5B,KAAK,kBAAkB,GAAG,qBAAqB,GAAG,0BAA0B,CAAC;AAG7E,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE;QACnB,IAAI,EAAE,OAAO,CAAC,kBAAkB,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACpD,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,YAAY,CAAC;IACnB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE;QACvB,IAAI,EAAE,OAAO,CAAC,kBAAkB,EAAE;YAAE,IAAI,EAAE,WAAW,CAAA;SAAE,CAAC,CAAC;QACzD,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,YAAY,CAAC;IACnB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QACpB,IAAI,EAAE,OAAO,CAAC,kBAAkB,EAAE;YAAE,IAAI,EAAE,OAAO,CAAA;SAAE,CAAC,CAAC;QACrD,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,YAAY,CAAC;IACnB,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE;QACxB,IAAI,EAAE,OAAO,CAAC,kBAAkB,EAAE;YAAE,IAAI,EAAE,WAAW,CAAA;SAAE,CAAC,CAAC;QACzD,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,YAAY,CAAC;IACnB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE;QACrB,IAAI,EAAE,OAAO,CAAC,kBAAkB,EAAE;YAAE,IAAI,EAAE,QAAQ,CAAA;SAAE,CAAC,CAAC;QACtD,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,YAAY,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE;QACnB,IAAI,EAAE,OAAO,CAAC,kBAAkB,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACpD,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,YAAY,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE;QACnB,IAAI,EAAE,OAAO,CAAC,kBAAkB,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACpD,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,YAAY,CAAC;CACpB,CAAC;AAqEF,eAAO,MAAM,cAAc,GAAI,qGAQ5B,mBAAmB,gCAsErB,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { DefaultMessageImage } from "./MessageParts.js";
|
|
2
|
+
import { PartByIndexProvider } from "@assistant-ui/core/react";
|
|
1
3
|
import { useAui, useAuiState } from "@assistant-ui/store";
|
|
2
4
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
3
5
|
import { Text } from "react-native";
|
|
4
6
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
5
7
|
import { Fragment as Fragment$1 } from "@assistant-ui/tap/react-shim";
|
|
6
|
-
import { getMessagePartKeys } from "@assistant-ui/core/internal";
|
|
8
|
+
import { getMessagePartKeys, resolveToolRender } from "@assistant-ui/core/internal";
|
|
7
9
|
//#region src/primitives/message/MessageContent.tsx
|
|
8
10
|
const DefaultTextRenderer = (t0) => {
|
|
9
11
|
const $ = c(2);
|
|
@@ -21,9 +23,9 @@ const ToolUIDisplay = (t0) => {
|
|
|
21
23
|
const { Fallback, part, index } = t0;
|
|
22
24
|
const aui = useAui();
|
|
23
25
|
let t1;
|
|
24
|
-
if ($[0] !== part
|
|
25
|
-
t1 = (s) => s.tools
|
|
26
|
-
$[0] = part
|
|
26
|
+
if ($[0] !== part) {
|
|
27
|
+
t1 = (s) => resolveToolRender(s.tools, part);
|
|
28
|
+
$[0] = part;
|
|
27
29
|
$[1] = t1;
|
|
28
30
|
} else t1 = $[1];
|
|
29
31
|
const Render = useAuiState(t1);
|
|
@@ -144,12 +146,13 @@ const MessageContent = (t0) => {
|
|
|
144
146
|
part,
|
|
145
147
|
index
|
|
146
148
|
}) }, key);
|
|
147
|
-
case "image":
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
case "image": return /* @__PURE__ */ jsx(Fragment$1, { children: renderImage ? renderImage({
|
|
150
|
+
part,
|
|
151
|
+
index
|
|
152
|
+
}) : /* @__PURE__ */ jsx(PartByIndexProvider, {
|
|
153
|
+
index,
|
|
154
|
+
children: /* @__PURE__ */ jsx(DefaultMessageImage, {})
|
|
155
|
+
}) }, key);
|
|
153
156
|
case "reasoning":
|
|
154
157
|
if (!renderReasoning) return null;
|
|
155
158
|
return /* @__PURE__ */ jsx(Fragment$1, { children: renderReasoning({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageContent.js","names":["ReactElement","Fragment","useMemo","Text","getMessagePartKeys","ThreadUserMessagePart","ThreadAssistantMessagePart","MessagePartState","useAui","useAuiState","ToolCallMessagePartProps","DataMessagePartProps","MessageContentPart","MessageContentStatePart","MessageContentProps","renderText","props","part","Extract","type","index","renderToolCall","renderImage","renderReasoning","renderSource","renderFile","renderData","DefaultTextRenderer","t0","$","_c","t1","text","ToolUIDisplay","Fallback","aui","toolName","s","tools","toolUIs","render","Render","t2","message","partMethods","t3","t4","unstable_recordInteraction","t5","addToolResult","respondToToolApproval","resumeToolCall","DataUIDisplay","name","named","dataRenderers","renderers","fallbacks","MessageContent","content","_temp","partKeys","key","map","parts","_c","Fragment"],"sources":["../../../src/primitives/message/MessageContent.tsx"],"sourcesContent":["import { type ReactElement, Fragment, useMemo } from \"react\";\nimport { Text } from \"react-native\";\nimport { getMessagePartKeys } from \"@assistant-ui/core/internal\";\nimport type {\n ThreadUserMessagePart,\n ThreadAssistantMessagePart,\n MessagePartState,\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;\ntype MessageContentStatePart = MessagePartState;\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: {\n part: Extract<MessageContentPart, { type: \"tool-call\" }>;\n index: number;\n }) => ReactElement)\n | undefined;\n part: Extract<MessageContentStatePart, { type: \"tool-call\" }>;\n index: number;\n}) => {\n const aui = useAui();\n const Render = useAuiState(\n (s) => s.tools.toolUIs[part.toolName]?.[0]?.render,\n );\n\n const partMethods = useMemo(() => aui.message.part({ index }), [aui, index]);\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 {...(partMethods.unstable_recordInteraction && {\n unstable_recordInteraction: partMethods.unstable_recordInteraction,\n })}\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: {\n part: Extract<MessageContentPart, { type: \"data\" }>;\n index: number;\n }) => ReactElement)\n | undefined;\n part: Extract<MessageContentStatePart, { type: \"data\" }>;\n index: number;\n}) => {\n const Render = useAuiState((s) => {\n const named = s.dataRenderers.renderers[part.name]?.[0];\n return named ?? s.dataRenderers.fallbacks[0];\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.parts);\n const partKeys = getMessagePartKeys(content);\n\n return (\n <>\n {content.map((part, index) => {\n const key = partKeys[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":";;;;;;;AAgDA,MAAM2B,uBAAsBC,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAb,SAAAW;CAI5B,IAAAG;CAAA,IAAAF,EAAA,OAAAZ,KAAAe,MAAA;EACQD,KAAA,oBAAC,MAAD,EAAA,UAAOd,KAAIe,KAAN,CAAA;EAAmBH,EAAA,KAAAZ,KAAAe;EAAAH,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAAA,OAAxBE;AAAwB;AAGjC,MAAME,iBAAgBL,OAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAC,MAAA,EAAAI,UAAAjB,MAAAG,UAAAQ;CAcrB,MAAAO,MAAY3B,OAAO;CAAE,IAAAuB;CAAA,IAAAF,EAAA,OAAAZ,KAAAmB,UAAA;EAEnBL,MAAAM,MAAOA,EAACC,MAAMC,QAAStB,KAAImB,SAAe,GAAA,EAAQ,EAAAI;EAAAX,EAAA,KAAAZ,KAAAmB;EAAAP,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAD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CAAA,OASOA,EAACM,QAAQqB;AAAM"}
|
|
1
|
+
{"version":3,"file":"MessageContent.js","names":["ReactElement","Fragment","useMemo","Text","ThreadUserMessagePart","ThreadAssistantMessagePart","MessagePartState","useAui","useAuiState","PartByIndexProvider","ToolCallMessagePartProps","DataMessagePartProps","DefaultMessageImage","getMessagePartKeys","resolveToolRender","MessageContentPart","MessageContentStatePart","MessageContentProps","renderText","props","part","Extract","type","index","renderToolCall","renderImage","renderReasoning","renderSource","renderFile","renderData","DefaultTextRenderer","t0","$","_c","t1","text","ToolUIDisplay","Fallback","aui","s","tools","Render","t2","message","partMethods","t3","t4","unstable_recordInteraction","t5","addToolResult","respondToToolApproval","resumeToolCall","DataUIDisplay","name","named","dataRenderers","renderers","fallbacks","MessageContent","content","_temp","partKeys","key","map","parts","_c","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 MessagePartState,\n} from \"@assistant-ui/core\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport {\n PartByIndexProvider,\n type ToolCallMessagePartProps,\n type DataMessagePartProps,\n} from \"@assistant-ui/core/react\";\nimport { DefaultMessageImage } from \"./MessageParts\";\nimport {\n getMessagePartKeys,\n resolveToolRender,\n} from \"@assistant-ui/core/internal\";\n\ntype MessageContentPart = ThreadUserMessagePart | ThreadAssistantMessagePart;\ntype MessageContentStatePart = MessagePartState;\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: {\n part: Extract<MessageContentPart, { type: \"tool-call\" }>;\n index: number;\n }) => ReactElement)\n | undefined;\n part: Extract<MessageContentStatePart, { type: \"tool-call\" }>;\n index: number;\n}) => {\n const aui = useAui();\n const Render = useAuiState((s) => resolveToolRender(s.tools, part));\n\n const partMethods = useMemo(() => aui.message.part({ index }), [aui, index]);\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 {...(partMethods.unstable_recordInteraction && {\n unstable_recordInteraction: partMethods.unstable_recordInteraction,\n })}\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: {\n part: Extract<MessageContentPart, { type: \"data\" }>;\n index: number;\n }) => ReactElement)\n | undefined;\n part: Extract<MessageContentStatePart, { type: \"data\" }>;\n index: number;\n}) => {\n const Render = useAuiState((s) => {\n const named = s.dataRenderers.renderers[part.name]?.[0];\n return named ?? s.dataRenderers.fallbacks[0];\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.parts);\n const partKeys = getMessagePartKeys(content);\n\n return (\n <>\n {content.map((part, index) => {\n const key = partKeys[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 return (\n <Fragment key={key}>\n {renderImage ? (\n renderImage({ part, index })\n ) : (\n <PartByIndexProvider index={index}>\n <DefaultMessageImage />\n </PartByIndexProvider>\n )}\n </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":";;;;;;;;;AAqDA,MAAM8B,uBAAsBC,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAb,SAAAW;CAI5B,IAAAG;CAAA,IAAAF,EAAA,OAAAZ,KAAAe,MAAA;EACQD,KAAA,oBAAC,MAAD,EAAA,UAAOd,KAAIe,KAAN,CAAA;EAAmBH,EAAA,KAAAZ,KAAAe;EAAAH,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAAA,OAAxBE;AAAwB;AAGjC,MAAME,iBAAgBL,OAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAC,MAAA,EAAAI,UAAAjB,MAAAG,UAAAQ;CAcrB,MAAAO,MAAY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EAAA,QAAAU,IAAA;EA9DJG,KAAA,oBAAA,UAAA,EAAA,UACGH,GA6DC,CAAA;EACDV,EAAA,MAAAU;EAAAV,EAAA,MAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,OA/DHa;AA+DG;AA5EuB,SAAAe,MAAArB,GAAA;CAAA,OASOA,EAACI,QAAQqB;AAAM"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FC } from "react";
|
|
2
2
|
import { MessagePrimitiveParts as MessagePrimitivePartsBase, MessagePartComponent as MessagePartComponentBase, MessagePrimitivePartByIndex as MessagePrimitivePartByIndexBase } from "@assistant-ui/core/react";
|
|
3
|
+
export declare const DefaultMessageImage: () => import("react").JSX.Element;
|
|
3
4
|
export declare namespace MessagePrimitiveParts {
|
|
4
5
|
type Props = MessagePrimitivePartsBase.Props;
|
|
5
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageParts.d.ts","sourceRoot":"","sources":["../../../src/primitives/message/MessageParts.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EACL,qBAAqB,IAAI,yBAAyB,EAClD,oBAAoB,IAAI,wBAAwB,EAChD,2BAA2B,IAAI,+BAA+B,EAE/D,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"MessageParts.d.ts","sourceRoot":"","sources":["../../../src/primitives/message/MessageParts.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EACL,qBAAqB,IAAI,yBAAyB,EAClD,oBAAoB,IAAI,wBAAwB,EAChD,2BAA2B,IAAI,+BAA+B,EAE/D,MAAM,0BAA0B,CAAC;AASlC,eAAO,MAAM,mBAAmB,mCAE/B,CAAC;AAQF,yBAAiB,qBAAqB,CAAC;IACrC,KAAY,KAAK,GAAG,yBAAyB,CAAC,KAAK,CAAC;CACrD;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,qBAAqB,CAAC,KAAK,CAmBjE,CAAC;AAIF,OAAO,EACL,wBAAwB,IAAI,oBAAoB,EAChD,+BAA+B,IAAI,2BAA2B,GAC/D,CAAC"}
|
|
@@ -1,11 +1,29 @@
|
|
|
1
|
+
import { MessagePartPrimitiveImage } from "../messagePart/MessagePartImage.js";
|
|
1
2
|
import { MessagePartComponent as MessagePartComponentBase, MessagePrimitivePartByIndex as MessagePrimitivePartByIndexBase, MessagePrimitiveParts as MessagePrimitiveParts$1, messagePartsDefaultComponents } from "@assistant-ui/core/react";
|
|
2
3
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
3
4
|
import { Text } from "react-native";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
//#region src/primitives/message/MessageParts.tsx
|
|
7
|
+
const DEFAULT_IMAGE_STYLE = {
|
|
8
|
+
width: "100%",
|
|
9
|
+
aspectRatio: 1
|
|
10
|
+
};
|
|
11
|
+
const DefaultMessageImage = () => {
|
|
12
|
+
const $ = c(1);
|
|
13
|
+
let t0;
|
|
14
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15
|
+
t0 = /* @__PURE__ */ jsx(MessagePartPrimitiveImage, {
|
|
16
|
+
style: DEFAULT_IMAGE_STYLE,
|
|
17
|
+
resizeMode: "contain"
|
|
18
|
+
});
|
|
19
|
+
$[0] = t0;
|
|
20
|
+
} else t0 = $[0];
|
|
21
|
+
return t0;
|
|
22
|
+
};
|
|
6
23
|
const rnDefaultComponents = {
|
|
7
24
|
...messagePartsDefaultComponents,
|
|
8
|
-
Text: ({ text }) => /* @__PURE__ */ jsx(Text, { children: text })
|
|
25
|
+
Text: ({ text }) => /* @__PURE__ */ jsx(Text, { children: text }),
|
|
26
|
+
Image: DefaultMessageImage
|
|
9
27
|
};
|
|
10
28
|
/**
|
|
11
29
|
* Renders the parts of a message with React Native-specific default components.
|
|
@@ -36,7 +54,8 @@ const MessagePrimitiveParts = (props) => {
|
|
|
36
54
|
if ($[5] !== components) {
|
|
37
55
|
t0 = components ? {
|
|
38
56
|
...components,
|
|
39
|
-
Text: components.Text ?? rnDefaultComponents.Text
|
|
57
|
+
Text: components.Text ?? rnDefaultComponents.Text,
|
|
58
|
+
Image: components.Image ?? rnDefaultComponents.Image
|
|
40
59
|
} : rnDefaultComponents;
|
|
41
60
|
$[5] = components;
|
|
42
61
|
$[6] = t0;
|
|
@@ -56,6 +75,6 @@ const MessagePrimitiveParts = (props) => {
|
|
|
56
75
|
};
|
|
57
76
|
MessagePrimitiveParts.displayName = "MessagePrimitive.Parts";
|
|
58
77
|
//#endregion
|
|
59
|
-
export { MessagePartComponentBase as MessagePartComponent, MessagePrimitivePartByIndexBase as MessagePrimitivePartByIndex, MessagePrimitiveParts };
|
|
78
|
+
export { DefaultMessageImage, MessagePartComponentBase as MessagePartComponent, MessagePrimitivePartByIndexBase as MessagePrimitivePartByIndex, MessagePrimitiveParts };
|
|
60
79
|
|
|
61
80
|
//# sourceMappingURL=MessageParts.js.map
|