@assistant-ui/react 0.7.63 → 0.7.65

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. package/dist/primitives/thread/useThreadViewportAutoScroll.d.ts +1 -2
  2. package/dist/primitives/thread/useThreadViewportAutoScroll.d.ts.map +1 -1
  3. package/dist/primitives/thread/useThreadViewportAutoScroll.js +4 -6
  4. package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
  5. package/dist/primitives/thread/useThreadViewportAutoScroll.mjs +4 -6
  6. package/dist/primitives/thread/useThreadViewportAutoScroll.mjs.map +1 -1
  7. package/dist/runtimes/external-store/createMessageConverter.d.ts +3 -0
  8. package/dist/runtimes/external-store/createMessageConverter.d.ts.map +1 -0
  9. package/dist/runtimes/external-store/createMessageConverter.js +72 -0
  10. package/dist/runtimes/external-store/createMessageConverter.js.map +1 -0
  11. package/dist/runtimes/external-store/createMessageConverter.mjs +51 -0
  12. package/dist/runtimes/external-store/createMessageConverter.mjs.map +1 -0
  13. package/dist/runtimes/external-store/external-message-converter.d.ts.map +1 -1
  14. package/dist/runtimes/external-store/external-message-converter.js +3 -1
  15. package/dist/runtimes/external-store/external-message-converter.js.map +1 -1
  16. package/dist/runtimes/external-store/external-message-converter.mjs +3 -1
  17. package/dist/runtimes/external-store/external-message-converter.mjs.map +1 -1
  18. package/dist/runtimes/external-store/getExternalStoreMessage.d.ts +3 -8
  19. package/dist/runtimes/external-store/getExternalStoreMessage.d.ts.map +1 -1
  20. package/dist/runtimes/external-store/getExternalStoreMessage.js +11 -6
  21. package/dist/runtimes/external-store/getExternalStoreMessage.js.map +1 -1
  22. package/dist/runtimes/external-store/getExternalStoreMessage.mjs +11 -6
  23. package/dist/runtimes/external-store/getExternalStoreMessage.mjs.map +1 -1
  24. package/dist/runtimes/external-store/index.d.ts +1 -0
  25. package/dist/runtimes/external-store/index.d.ts.map +1 -1
  26. package/dist/runtimes/external-store/index.js +3 -0
  27. package/dist/runtimes/external-store/index.js.map +1 -1
  28. package/dist/runtimes/external-store/index.mjs +2 -0
  29. package/dist/runtimes/external-store/index.mjs.map +1 -1
  30. package/dist/ui/index.d.ts +60 -1
  31. package/dist/ui/index.d.ts.map +1 -1
  32. package/dist/ui/index.js +2 -1
  33. package/dist/ui/index.js.map +1 -1
  34. package/dist/ui/index.mjs +2 -4
  35. package/dist/ui/index.mjs.map +1 -1
  36. package/dist/utils/hooks/useOnResizeContent.d.ts.map +1 -1
  37. package/dist/utils/hooks/useOnResizeContent.js +7 -17
  38. package/dist/utils/hooks/useOnResizeContent.js.map +1 -1
  39. package/dist/utils/hooks/useOnResizeContent.mjs +7 -17
  40. package/dist/utils/hooks/useOnResizeContent.mjs.map +1 -1
  41. package/package.json +1 -1
  42. package/src/primitives/thread/useThreadViewportAutoScroll.tsx +3 -8
  43. package/src/runtimes/external-store/createMessageConverter.tsx +55 -0
  44. package/src/runtimes/external-store/external-message-converter.tsx +7 -1
  45. package/src/runtimes/external-store/getExternalStoreMessage.tsx +19 -14
  46. package/src/runtimes/external-store/index.ts +1 -0
  47. package/src/ui/index.ts +68 -11
  48. package/src/utils/hooks/useOnResizeContent.tsx +7 -21
@@ -23,6 +23,7 @@ __export(external_store_exports, {
23
23
  getExternalStoreMessage: () => import_getExternalStoreMessage.getExternalStoreMessage,
24
24
  getExternalStoreMessages: () => import_getExternalStoreMessage.getExternalStoreMessages,
25
25
  unstable_convertExternalMessages: () => import_external_message_converter.convertExternalMessages,
26
+ unstable_createMessageConverter: () => import_createMessageConverter.createMessageConverter,
26
27
  useExternalMessageConverter: () => import_external_message_converter.useExternalMessageConverter,
27
28
  useExternalStoreRuntime: () => import_useExternalStoreRuntime.useExternalStoreRuntime
28
29
  });
@@ -30,11 +31,13 @@ module.exports = __toCommonJS(external_store_exports);
30
31
  var import_useExternalStoreRuntime = require("./useExternalStoreRuntime.js");
31
32
  var import_getExternalStoreMessage = require("./getExternalStoreMessage.js");
32
33
  var import_external_message_converter = require("./external-message-converter.js");
34
+ var import_createMessageConverter = require("./createMessageConverter.js");
33
35
  // Annotate the CommonJS export names for ESM import in node:
34
36
  0 && (module.exports = {
35
37
  getExternalStoreMessage,
36
38
  getExternalStoreMessages,
37
39
  unstable_convertExternalMessages,
40
+ unstable_createMessageConverter,
38
41
  useExternalMessageConverter,
39
42
  useExternalStoreRuntime
40
43
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtimes/external-store/index.ts"],"sourcesContent":["export type {\n ExternalStoreAdapter,\n ExternalStoreMessageConverter,\n} from \"./ExternalStoreAdapter\";\nexport type { ThreadMessageLike } from \"./ThreadMessageLike\";\nexport { useExternalStoreRuntime } from \"./useExternalStoreRuntime\";\nexport {\n getExternalStoreMessage,\n getExternalStoreMessages,\n} from \"./getExternalStoreMessage\";\nexport {\n useExternalMessageConverter,\n convertExternalMessages as unstable_convertExternalMessages,\n} from \"./external-message-converter\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,qCAAwC;AACxC,qCAGO;AACP,wCAGO;","names":[]}
1
+ {"version":3,"sources":["../../../src/runtimes/external-store/index.ts"],"sourcesContent":["export type {\n ExternalStoreAdapter,\n ExternalStoreMessageConverter,\n} from \"./ExternalStoreAdapter\";\nexport type { ThreadMessageLike } from \"./ThreadMessageLike\";\nexport { useExternalStoreRuntime } from \"./useExternalStoreRuntime\";\nexport {\n getExternalStoreMessage,\n getExternalStoreMessages,\n} from \"./getExternalStoreMessage\";\nexport {\n useExternalMessageConverter,\n convertExternalMessages as unstable_convertExternalMessages,\n} from \"./external-message-converter\";\nexport { createMessageConverter as unstable_createMessageConverter } from \"./createMessageConverter\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,qCAAwC;AACxC,qCAGO;AACP,wCAGO;AACP,oCAA0E;","names":[]}
@@ -8,10 +8,12 @@ import {
8
8
  useExternalMessageConverter,
9
9
  convertExternalMessages
10
10
  } from "./external-message-converter.mjs";
11
+ import { createMessageConverter } from "./createMessageConverter.mjs";
11
12
  export {
12
13
  getExternalStoreMessage,
13
14
  getExternalStoreMessages,
14
15
  convertExternalMessages as unstable_convertExternalMessages,
16
+ createMessageConverter as unstable_createMessageConverter,
15
17
  useExternalMessageConverter,
16
18
  useExternalStoreRuntime
17
19
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtimes/external-store/index.ts"],"sourcesContent":["export type {\n ExternalStoreAdapter,\n ExternalStoreMessageConverter,\n} from \"./ExternalStoreAdapter\";\nexport type { ThreadMessageLike } from \"./ThreadMessageLike\";\nexport { useExternalStoreRuntime } from \"./useExternalStoreRuntime\";\nexport {\n getExternalStoreMessage,\n getExternalStoreMessages,\n} from \"./getExternalStoreMessage\";\nexport {\n useExternalMessageConverter,\n convertExternalMessages as unstable_convertExternalMessages,\n} from \"./external-message-converter\";\n"],"mappings":";AAKA,SAAS,+BAA+B;AACxC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EAC2B;AAAA,OACtB;","names":[]}
1
+ {"version":3,"sources":["../../../src/runtimes/external-store/index.ts"],"sourcesContent":["export type {\n ExternalStoreAdapter,\n ExternalStoreMessageConverter,\n} from \"./ExternalStoreAdapter\";\nexport type { ThreadMessageLike } from \"./ThreadMessageLike\";\nexport { useExternalStoreRuntime } from \"./useExternalStoreRuntime\";\nexport {\n getExternalStoreMessage,\n getExternalStoreMessages,\n} from \"./getExternalStoreMessage\";\nexport {\n useExternalMessageConverter,\n convertExternalMessages as unstable_convertExternalMessages,\n} from \"./external-message-converter\";\nexport { createMessageConverter as unstable_createMessageConverter } from \"./createMessageConverter\";\n"],"mappings":";AAKA,SAAS,+BAA+B;AACxC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EAC2B;AAAA,OACtB;AACP,SAAmC,8BAAuC;","names":[]}
@@ -1,16 +1,75 @@
1
- export { ThreadConfigProvider, useThreadConfig, type ThreadConfig, type ThreadWelcomeConfig, type UserMessageConfig, type AssistantMessageConfig, type StringsConfig, type SuggestionConfig, type ThreadConfigProviderProps, } from "./thread-config";
1
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
2
+ export { ThreadConfigProvider } from "./thread-config";
3
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
4
+ export { useThreadConfig } from "./thread-config";
5
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
6
+ export type { ThreadConfig } from "./thread-config";
7
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
8
+ export type { ThreadWelcomeConfig } from "./thread-config";
9
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
10
+ export type { UserMessageConfig } from "./thread-config";
11
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
12
+ export type { AssistantMessageConfig } from "./thread-config";
13
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
14
+ export type { StringsConfig } from "./thread-config";
15
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
16
+ export type { SuggestionConfig } from "./thread-config";
17
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
18
+ export type { ThreadConfigProviderProps } from "./thread-config";
19
+ /**
20
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
21
+ */
2
22
  export { default as AssistantActionBar } from "./assistant-action-bar";
23
+ /**
24
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
25
+ */
3
26
  export { default as AssistantMessage } from "./assistant-message";
27
+ /**
28
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
29
+ */
4
30
  export { default as AssistantModal } from "./assistant-modal";
31
+ /**
32
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
33
+ */
5
34
  export { default as BranchPicker } from "./branch-picker";
35
+ /**
36
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
37
+ */
6
38
  export { default as Composer } from "./composer";
39
+ /**
40
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
41
+ */
7
42
  export { default as ContentPart } from "./content-part";
43
+ /**
44
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
45
+ */
8
46
  export { default as AttachmentUI, } from "./attachment-ui";
47
+ /**
48
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
49
+ */
9
50
  export { default as EditComposer } from "./edit-composer";
51
+ /**
52
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
53
+ */
10
54
  export { default as Thread } from "./thread";
55
+ /**
56
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
57
+ */
11
58
  export { default as ThreadList } from "./thread-list";
59
+ /**
60
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
61
+ */
12
62
  export { default as ThreadListItem } from "./thread-list-item";
63
+ /**
64
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
65
+ */
13
66
  export { default as ThreadWelcome } from "./thread-welcome";
67
+ /**
68
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
69
+ */
14
70
  export { default as UserMessage } from "./user-message";
71
+ /**
72
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
73
+ */
15
74
  export { default as UserActionBar } from "./user-action-bar";
16
75
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,GAC/B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EACL,OAAO,IAAI,YAAY,GACxB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,2JAA2J;AAC3J,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,2JAA2J;AAC3J,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,2JAA2J;AAC3J,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,2JAA2J;AAC3J,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,2JAA2J;AAC3J,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,2JAA2J;AAC3J,YAAY,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE9D,2JAA2J;AAC3J,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,2JAA2J;AAC3J,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,2JAA2J;AAC3J,YAAY,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAEjE;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEvE;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAElE;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE9D;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEjD;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAExD;;GAEG;AACH,OAAO,EACL,OAAO,IAAI,YAAY,GACxB,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAE7C;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE/D;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE5D;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAExD;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/ui/index.js CHANGED
@@ -45,10 +45,11 @@ __export(ui_exports, {
45
45
  ThreadWelcome: () => import_thread_welcome.default,
46
46
  UserActionBar: () => import_user_action_bar.default,
47
47
  UserMessage: () => import_user_message.default,
48
- useThreadConfig: () => import_thread_config.useThreadConfig
48
+ useThreadConfig: () => import_thread_config2.useThreadConfig
49
49
  });
50
50
  module.exports = __toCommonJS(ui_exports);
51
51
  var import_thread_config = require("./thread-config.js");
52
+ var import_thread_config2 = require("./thread-config.js");
52
53
  var import_assistant_action_bar = __toESM(require("./assistant-action-bar.js"));
53
54
  var import_assistant_message = __toESM(require("./assistant-message.js"));
54
55
  var import_assistant_modal = __toESM(require("./assistant-modal.js"));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ui/index.ts"],"sourcesContent":["export {\n ThreadConfigProvider,\n useThreadConfig,\n type ThreadConfig,\n type ThreadWelcomeConfig,\n type UserMessageConfig,\n type AssistantMessageConfig,\n type StringsConfig,\n type SuggestionConfig,\n type ThreadConfigProviderProps,\n} from \"./thread-config\";\n\nexport { default as AssistantActionBar } from \"./assistant-action-bar\";\n\nexport { default as AssistantMessage } from \"./assistant-message\";\n\nexport { default as AssistantModal } from \"./assistant-modal\";\n\nexport { default as BranchPicker } from \"./branch-picker\";\n\nexport { default as Composer } from \"./composer\";\n\nexport { default as ContentPart } from \"./content-part\";\n\nexport {\n default as AttachmentUI, // TODO name collision with Attachment\n} from \"./attachment-ui\";\n\nexport { default as EditComposer } from \"./edit-composer\";\n\nexport { default as Thread } from \"./thread\";\n\nexport { default as ThreadList } from \"./thread-list\";\n\nexport { default as ThreadListItem } from \"./thread-list-item\";\n\nexport { default as ThreadWelcome } from \"./thread-welcome\";\n\nexport { default as UserMessage } from \"./user-message\";\n\nexport { default as UserActionBar } from \"./user-action-bar\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAUO;AAEP,kCAA8C;AAE9C,+BAA4C;AAE5C,6BAA0C;AAE1C,2BAAwC;AAExC,sBAAoC;AAEpC,0BAAuC;AAEvC,2BAEO;AAEP,2BAAwC;AAExC,oBAAkC;AAElC,yBAAsC;AAEtC,8BAA0C;AAE1C,4BAAyC;AAEzC,0BAAuC;AAEvC,6BAAyC;","names":[]}
1
+ {"version":3,"sources":["../../src/ui/index.ts"],"sourcesContent":["/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport { ThreadConfigProvider } from \"./thread-config\";\n\n/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport { useThreadConfig } from \"./thread-config\";\n\n/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport type { ThreadConfig } from \"./thread-config\";\n\n/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport type { ThreadWelcomeConfig } from \"./thread-config\";\n\n/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport type { UserMessageConfig } from \"./thread-config\";\n\n/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport type { AssistantMessageConfig } from \"./thread-config\";\n\n/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport type { StringsConfig } from \"./thread-config\";\n\n/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport type { SuggestionConfig } from \"./thread-config\";\n\n/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport type { ThreadConfigProviderProps } from \"./thread-config\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as AssistantActionBar } from \"./assistant-action-bar\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as AssistantMessage } from \"./assistant-message\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as AssistantModal } from \"./assistant-modal\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as BranchPicker } from \"./branch-picker\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as Composer } from \"./composer\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as ContentPart } from \"./content-part\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport {\n default as AttachmentUI, // TODO name collision with Attachment\n} from \"./attachment-ui\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as EditComposer } from \"./edit-composer\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as Thread } from \"./thread\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as ThreadList } from \"./thread-list\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as ThreadListItem } from \"./thread-list-item\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as ThreadWelcome } from \"./thread-welcome\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as UserMessage } from \"./user-message\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as UserActionBar } from \"./user-action-bar\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,2BAAqC;AAGrC,IAAAA,wBAAgC;AA0BhC,kCAA8C;AAK9C,+BAA4C;AAK5C,6BAA0C;AAK1C,2BAAwC;AAKxC,sBAAoC;AAKpC,0BAAuC;AAKvC,2BAEO;AAKP,2BAAwC;AAKxC,oBAAkC;AAKlC,yBAAsC;AAKtC,8BAA0C;AAK1C,4BAAyC;AAKzC,0BAAuC;AAKvC,6BAAyC;","names":["import_thread_config"]}
package/dist/ui/index.mjs CHANGED
@@ -1,8 +1,6 @@
1
1
  // src/ui/index.ts
2
- import {
3
- ThreadConfigProvider,
4
- useThreadConfig
5
- } from "./thread-config.mjs";
2
+ import { ThreadConfigProvider } from "./thread-config.mjs";
3
+ import { useThreadConfig } from "./thread-config.mjs";
6
4
  import { default as default2 } from "./assistant-action-bar.mjs";
7
5
  import { default as default3 } from "./assistant-message.mjs";
8
6
  import { default as default4 } from "./assistant-modal.mjs";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ui/index.ts"],"sourcesContent":["export {\n ThreadConfigProvider,\n useThreadConfig,\n type ThreadConfig,\n type ThreadWelcomeConfig,\n type UserMessageConfig,\n type AssistantMessageConfig,\n type StringsConfig,\n type SuggestionConfig,\n type ThreadConfigProviderProps,\n} from \"./thread-config\";\n\nexport { default as AssistantActionBar } from \"./assistant-action-bar\";\n\nexport { default as AssistantMessage } from \"./assistant-message\";\n\nexport { default as AssistantModal } from \"./assistant-modal\";\n\nexport { default as BranchPicker } from \"./branch-picker\";\n\nexport { default as Composer } from \"./composer\";\n\nexport { default as ContentPart } from \"./content-part\";\n\nexport {\n default as AttachmentUI, // TODO name collision with Attachment\n} from \"./attachment-ui\";\n\nexport { default as EditComposer } from \"./edit-composer\";\n\nexport { default as Thread } from \"./thread\";\n\nexport { default as ThreadList } from \"./thread-list\";\n\nexport { default as ThreadListItem } from \"./thread-list-item\";\n\nexport { default as ThreadWelcome } from \"./thread-welcome\";\n\nexport { default as UserMessage } from \"./user-message\";\n\nexport { default as UserActionBar } from \"./user-action-bar\";\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAQK;AAEP,SAAoB,WAAXA,gBAAqC;AAE9C,SAAoB,WAAXA,gBAAmC;AAE5C,SAAoB,WAAXA,gBAAiC;AAE1C,SAAoB,WAAXA,gBAA+B;AAExC,SAAoB,WAAXA,gBAA2B;AAEpC,SAAoB,WAAXA,gBAA8B;AAEvC;AAAA,EACa,WAAXA;AAAA,OACK;AAEP,SAAoB,WAAXA,gBAA+B;AAExC,SAAoB,WAAXA,iBAAyB;AAElC,SAAoB,WAAXA,iBAA6B;AAEtC,SAAoB,WAAXA,iBAAiC;AAE1C,SAAoB,WAAXA,iBAAgC;AAEzC,SAAoB,WAAXA,iBAA8B;AAEvC,SAAoB,WAAXA,iBAAgC;","names":["default"]}
1
+ {"version":3,"sources":["../../src/ui/index.ts"],"sourcesContent":["/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport { ThreadConfigProvider } from \"./thread-config\";\n\n/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport { useThreadConfig } from \"./thread-config\";\n\n/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport type { ThreadConfig } from \"./thread-config\";\n\n/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport type { ThreadWelcomeConfig } from \"./thread-config\";\n\n/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport type { UserMessageConfig } from \"./thread-config\";\n\n/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport type { AssistantMessageConfig } from \"./thread-config\";\n\n/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport type { StringsConfig } from \"./thread-config\";\n\n/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport type { SuggestionConfig } from \"./thread-config\";\n\n/** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */\nexport type { ThreadConfigProviderProps } from \"./thread-config\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as AssistantActionBar } from \"./assistant-action-bar\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as AssistantMessage } from \"./assistant-message\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as AssistantModal } from \"./assistant-modal\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as BranchPicker } from \"./branch-picker\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as Composer } from \"./composer\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as ContentPart } from \"./content-part\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport {\n default as AttachmentUI, // TODO name collision with Attachment\n} from \"./attachment-ui\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as EditComposer } from \"./edit-composer\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as Thread } from \"./thread\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as ThreadList } from \"./thread-list\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as ThreadListItem } from \"./thread-list-item\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as ThreadWelcome } from \"./thread-welcome\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as UserMessage } from \"./user-message\";\n\n/**\n * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.\n */\nexport { default as UserActionBar } from \"./user-action-bar\";\n"],"mappings":";AACA,SAAS,4BAA4B;AAGrC,SAAS,uBAAuB;AA0BhC,SAAoB,WAAXA,gBAAqC;AAK9C,SAAoB,WAAXA,gBAAmC;AAK5C,SAAoB,WAAXA,gBAAiC;AAK1C,SAAoB,WAAXA,gBAA+B;AAKxC,SAAoB,WAAXA,gBAA2B;AAKpC,SAAoB,WAAXA,gBAA8B;AAKvC;AAAA,EACa,WAAXA;AAAA,OACK;AAKP,SAAoB,WAAXA,gBAA+B;AAKxC,SAAoB,WAAXA,iBAAyB;AAKlC,SAAoB,WAAXA,iBAA6B;AAKtC,SAAoB,WAAXA,iBAAiC;AAK1C,SAAoB,WAAXA,iBAAgC;AAKzC,SAAoB,WAAXA,iBAA8B;AAKvC,SAAoB,WAAXA,iBAAgC;","names":["default"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useOnResizeContent.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useOnResizeContent.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,aAAc,MAAM,IAAI,qCA4CtD,CAAC"}
1
+ {"version":3,"file":"useOnResizeContent.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useOnResizeContent.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,aAAc,MAAM,IAAI,qCA8BtD,CAAC"}
@@ -33,26 +33,16 @@ var useOnResizeContent = (callback) => {
33
33
  const resizeObserver = new ResizeObserver(() => {
34
34
  callbackRef();
35
35
  });
36
- const mutationObserver = new MutationObserver((mutations) => {
37
- for (const mutation of mutations) {
38
- for (const node of mutation.addedNodes) {
39
- if (node instanceof Element) {
40
- resizeObserver.observe(node);
41
- }
42
- }
43
- for (const node of mutation.removedNodes) {
44
- if (node instanceof Element) {
45
- resizeObserver.unobserve(node);
46
- }
47
- }
48
- }
36
+ const mutationObserver = new MutationObserver(() => {
49
37
  callbackRef();
50
38
  });
51
39
  resizeObserver.observe(el);
52
- mutationObserver.observe(el, { childList: true });
53
- for (const child of el.children) {
54
- resizeObserver.observe(child);
55
- }
40
+ mutationObserver.observe(el, {
41
+ childList: true,
42
+ subtree: true,
43
+ attributes: true,
44
+ characterData: true
45
+ });
56
46
  return () => {
57
47
  resizeObserver.disconnect();
58
48
  mutationObserver.disconnect();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/hooks/useOnResizeContent.tsx"],"sourcesContent":["import { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useCallback } from \"react\";\nimport { useManagedRef } from \"./useManagedRef\";\n\nexport const useOnResizeContent = (callback: () => void) => {\n const callbackRef = useCallbackRef(callback);\n\n const refCallback = useCallback(\n (el: HTMLElement) => {\n const resizeObserver = new ResizeObserver(() => {\n callbackRef();\n });\n\n const mutationObserver = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n for (const node of mutation.addedNodes) {\n if (node instanceof Element) {\n resizeObserver.observe(node);\n }\n }\n\n for (const node of mutation.removedNodes) {\n if (node instanceof Element) {\n resizeObserver.unobserve(node);\n }\n }\n }\n\n callbackRef();\n });\n\n resizeObserver.observe(el);\n mutationObserver.observe(el, { childList: true });\n\n // Observe existing children\n for (const child of el.children) {\n resizeObserver.observe(child);\n }\n\n return () => {\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n };\n },\n [callbackRef],\n );\n\n return useManagedRef(refCallback);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAA+B;AAC/B,mBAA4B;AAC5B,2BAA8B;AAEvB,IAAM,qBAAqB,CAAC,aAAyB;AAC1D,QAAM,kBAAc,8CAAe,QAAQ;AAE3C,QAAM,kBAAc;AAAA,IAClB,CAAC,OAAoB;AACnB,YAAM,iBAAiB,IAAI,eAAe,MAAM;AAC9C,oBAAY;AAAA,MACd,CAAC;AAED,YAAM,mBAAmB,IAAI,iBAAiB,CAAC,cAAc;AAC3D,mBAAW,YAAY,WAAW;AAChC,qBAAW,QAAQ,SAAS,YAAY;AACtC,gBAAI,gBAAgB,SAAS;AAC3B,6BAAe,QAAQ,IAAI;AAAA,YAC7B;AAAA,UACF;AAEA,qBAAW,QAAQ,SAAS,cAAc;AACxC,gBAAI,gBAAgB,SAAS;AAC3B,6BAAe,UAAU,IAAI;AAAA,YAC/B;AAAA,UACF;AAAA,QACF;AAEA,oBAAY;AAAA,MACd,CAAC;AAED,qBAAe,QAAQ,EAAE;AACzB,uBAAiB,QAAQ,IAAI,EAAE,WAAW,KAAK,CAAC;AAGhD,iBAAW,SAAS,GAAG,UAAU;AAC/B,uBAAe,QAAQ,KAAK;AAAA,MAC9B;AAEA,aAAO,MAAM;AACX,uBAAe,WAAW;AAC1B,yBAAiB,WAAW;AAAA,MAC9B;AAAA,IACF;AAAA,IACA,CAAC,WAAW;AAAA,EACd;AAEA,aAAO,oCAAc,WAAW;AAClC;","names":[]}
1
+ {"version":3,"sources":["../../../src/utils/hooks/useOnResizeContent.tsx"],"sourcesContent":["import { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useCallback } from \"react\";\nimport { useManagedRef } from \"./useManagedRef\";\n\nexport const useOnResizeContent = (callback: () => void) => {\n const callbackRef = useCallbackRef(callback);\n\n const refCallback = useCallback(\n (el: HTMLElement) => {\n const resizeObserver = new ResizeObserver(() => {\n callbackRef();\n });\n\n const mutationObserver = new MutationObserver(() => {\n callbackRef();\n });\n\n resizeObserver.observe(el);\n mutationObserver.observe(el, {\n childList: true,\n subtree: true,\n attributes: true,\n characterData: true,\n });\n\n return () => {\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n };\n },\n [callbackRef],\n );\n\n return useManagedRef(refCallback);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAA+B;AAC/B,mBAA4B;AAC5B,2BAA8B;AAEvB,IAAM,qBAAqB,CAAC,aAAyB;AAC1D,QAAM,kBAAc,8CAAe,QAAQ;AAE3C,QAAM,kBAAc;AAAA,IAClB,CAAC,OAAoB;AACnB,YAAM,iBAAiB,IAAI,eAAe,MAAM;AAC9C,oBAAY;AAAA,MACd,CAAC;AAED,YAAM,mBAAmB,IAAI,iBAAiB,MAAM;AAClD,oBAAY;AAAA,MACd,CAAC;AAED,qBAAe,QAAQ,EAAE;AACzB,uBAAiB,QAAQ,IAAI;AAAA,QAC3B,WAAW;AAAA,QACX,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,eAAe;AAAA,MACjB,CAAC;AAED,aAAO,MAAM;AACX,uBAAe,WAAW;AAC1B,yBAAiB,WAAW;AAAA,MAC9B;AAAA,IACF;AAAA,IACA,CAAC,WAAW;AAAA,EACd;AAEA,aAAO,oCAAc,WAAW;AAClC;","names":[]}
@@ -9,26 +9,16 @@ var useOnResizeContent = (callback) => {
9
9
  const resizeObserver = new ResizeObserver(() => {
10
10
  callbackRef();
11
11
  });
12
- const mutationObserver = new MutationObserver((mutations) => {
13
- for (const mutation of mutations) {
14
- for (const node of mutation.addedNodes) {
15
- if (node instanceof Element) {
16
- resizeObserver.observe(node);
17
- }
18
- }
19
- for (const node of mutation.removedNodes) {
20
- if (node instanceof Element) {
21
- resizeObserver.unobserve(node);
22
- }
23
- }
24
- }
12
+ const mutationObserver = new MutationObserver(() => {
25
13
  callbackRef();
26
14
  });
27
15
  resizeObserver.observe(el);
28
- mutationObserver.observe(el, { childList: true });
29
- for (const child of el.children) {
30
- resizeObserver.observe(child);
31
- }
16
+ mutationObserver.observe(el, {
17
+ childList: true,
18
+ subtree: true,
19
+ attributes: true,
20
+ characterData: true
21
+ });
32
22
  return () => {
33
23
  resizeObserver.disconnect();
34
24
  mutationObserver.disconnect();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/hooks/useOnResizeContent.tsx"],"sourcesContent":["import { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useCallback } from \"react\";\nimport { useManagedRef } from \"./useManagedRef\";\n\nexport const useOnResizeContent = (callback: () => void) => {\n const callbackRef = useCallbackRef(callback);\n\n const refCallback = useCallback(\n (el: HTMLElement) => {\n const resizeObserver = new ResizeObserver(() => {\n callbackRef();\n });\n\n const mutationObserver = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n for (const node of mutation.addedNodes) {\n if (node instanceof Element) {\n resizeObserver.observe(node);\n }\n }\n\n for (const node of mutation.removedNodes) {\n if (node instanceof Element) {\n resizeObserver.unobserve(node);\n }\n }\n }\n\n callbackRef();\n });\n\n resizeObserver.observe(el);\n mutationObserver.observe(el, { childList: true });\n\n // Observe existing children\n for (const child of el.children) {\n resizeObserver.observe(child);\n }\n\n return () => {\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n };\n },\n [callbackRef],\n );\n\n return useManagedRef(refCallback);\n};\n"],"mappings":";AAAA,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAEvB,IAAM,qBAAqB,CAAC,aAAyB;AAC1D,QAAM,cAAc,eAAe,QAAQ;AAE3C,QAAM,cAAc;AAAA,IAClB,CAAC,OAAoB;AACnB,YAAM,iBAAiB,IAAI,eAAe,MAAM;AAC9C,oBAAY;AAAA,MACd,CAAC;AAED,YAAM,mBAAmB,IAAI,iBAAiB,CAAC,cAAc;AAC3D,mBAAW,YAAY,WAAW;AAChC,qBAAW,QAAQ,SAAS,YAAY;AACtC,gBAAI,gBAAgB,SAAS;AAC3B,6BAAe,QAAQ,IAAI;AAAA,YAC7B;AAAA,UACF;AAEA,qBAAW,QAAQ,SAAS,cAAc;AACxC,gBAAI,gBAAgB,SAAS;AAC3B,6BAAe,UAAU,IAAI;AAAA,YAC/B;AAAA,UACF;AAAA,QACF;AAEA,oBAAY;AAAA,MACd,CAAC;AAED,qBAAe,QAAQ,EAAE;AACzB,uBAAiB,QAAQ,IAAI,EAAE,WAAW,KAAK,CAAC;AAGhD,iBAAW,SAAS,GAAG,UAAU;AAC/B,uBAAe,QAAQ,KAAK;AAAA,MAC9B;AAEA,aAAO,MAAM;AACX,uBAAe,WAAW;AAC1B,yBAAiB,WAAW;AAAA,MAC9B;AAAA,IACF;AAAA,IACA,CAAC,WAAW;AAAA,EACd;AAEA,SAAO,cAAc,WAAW;AAClC;","names":[]}
1
+ {"version":3,"sources":["../../../src/utils/hooks/useOnResizeContent.tsx"],"sourcesContent":["import { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useCallback } from \"react\";\nimport { useManagedRef } from \"./useManagedRef\";\n\nexport const useOnResizeContent = (callback: () => void) => {\n const callbackRef = useCallbackRef(callback);\n\n const refCallback = useCallback(\n (el: HTMLElement) => {\n const resizeObserver = new ResizeObserver(() => {\n callbackRef();\n });\n\n const mutationObserver = new MutationObserver(() => {\n callbackRef();\n });\n\n resizeObserver.observe(el);\n mutationObserver.observe(el, {\n childList: true,\n subtree: true,\n attributes: true,\n characterData: true,\n });\n\n return () => {\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n };\n },\n [callbackRef],\n );\n\n return useManagedRef(refCallback);\n};\n"],"mappings":";AAAA,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAEvB,IAAM,qBAAqB,CAAC,aAAyB;AAC1D,QAAM,cAAc,eAAe,QAAQ;AAE3C,QAAM,cAAc;AAAA,IAClB,CAAC,OAAoB;AACnB,YAAM,iBAAiB,IAAI,eAAe,MAAM;AAC9C,oBAAY;AAAA,MACd,CAAC;AAED,YAAM,mBAAmB,IAAI,iBAAiB,MAAM;AAClD,oBAAY;AAAA,MACd,CAAC;AAED,qBAAe,QAAQ,EAAE;AACzB,uBAAiB,QAAQ,IAAI;AAAA,QAC3B,WAAW;AAAA,QACX,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,eAAe;AAAA,MACjB,CAAC;AAED,aAAO,MAAM;AACX,uBAAe,WAAW;AAC1B,yBAAiB,WAAW;AAAA,MAC9B;AAAA,IACF;AAAA,IACA,CAAC,WAAW;AAAA,EACd;AAEA,SAAO,cAAc,WAAW;AAClC;","names":[]}
package/package.json CHANGED
@@ -29,7 +29,7 @@
29
29
  "conversational-ui",
30
30
  "conversational-ai"
31
31
  ],
32
- "version": "0.7.63",
32
+ "version": "0.7.65",
33
33
  "license": "MIT",
34
34
  "exports": {
35
35
  ".": {
@@ -14,13 +14,11 @@ import { writableStore } from "../../context/ReadonlyStore";
14
14
  export namespace useThreadViewportAutoScroll {
15
15
  export type Options = {
16
16
  autoScroll?: boolean | undefined;
17
- unstable_scrollToBottomOnRunStart?: boolean | undefined;
18
17
  };
19
18
  }
20
19
 
21
20
  export const useThreadViewportAutoScroll = <TElement extends HTMLElement>({
22
21
  autoScroll = true,
23
- unstable_scrollToBottomOnRunStart = true,
24
22
  }: useThreadViewportAutoScroll.Options): RefCallback<TElement> => {
25
23
  const divRef = useRef<TElement>(null);
26
24
 
@@ -83,8 +81,6 @@ export const useThreadViewportAutoScroll = <TElement extends HTMLElement>({
83
81
  };
84
82
  });
85
83
 
86
- const autoScrollRef = useComposedRefs<TElement>(resizeRef, scrollRef, divRef);
87
-
88
84
  useOnScrollToBottom(() => {
89
85
  scrollToBottom("auto");
90
86
  });
@@ -92,10 +88,9 @@ export const useThreadViewportAutoScroll = <TElement extends HTMLElement>({
92
88
  // autoscroll on run start
93
89
  const threadRuntime = useThreadRuntime();
94
90
  useEffect(() => {
95
- if (!unstable_scrollToBottomOnRunStart) return undefined;
96
-
97
- return threadRuntime.unstable_on("run-start", focus);
98
- }, [unstable_scrollToBottomOnRunStart]);
91
+ return threadRuntime.unstable_on("run-start", () => scrollToBottom("auto"));
92
+ }, []);
99
93
 
94
+ const autoScrollRef = useComposedRefs<TElement>(resizeRef, scrollRef, divRef);
100
95
  return autoScrollRef;
101
96
  };
@@ -0,0 +1,55 @@
1
+ "use client";
2
+ import { ThreadState } from "../../api";
3
+ import { useContentPart, useMessage } from "../../context";
4
+ import { ThreadMessage } from "../../types";
5
+ import {
6
+ useExternalMessageConverter,
7
+ convertExternalMessages,
8
+ } from "./external-message-converter";
9
+ import { getExternalStoreMessages } from "./getExternalStoreMessage";
10
+
11
+ export const createMessageConverter = <T extends object>(
12
+ callback: useExternalMessageConverter.Callback<T>,
13
+ ) => {
14
+ const result = {
15
+ useThreadMessages: (messages: T[], isRunning: boolean) => {
16
+ return useExternalMessageConverter<T>({
17
+ callback,
18
+ messages,
19
+ isRunning,
20
+ });
21
+ },
22
+ toThreadMessages: (messages: T[]) => {
23
+ return convertExternalMessages(messages, callback, false); // TODO figure out isRunning
24
+ },
25
+ toOriginalMessages: (
26
+ input: ThreadState | ThreadMessage | ThreadMessage["content"][number],
27
+ ) => {
28
+ const messages = getExternalStoreMessages(input);
29
+ if (messages.length === 0) throw new Error("No original messages found");
30
+ return messages;
31
+ },
32
+ toOriginalMessage: (
33
+ input: ThreadState | ThreadMessage | ThreadMessage["content"][number],
34
+ ) => {
35
+ const messages = result.toOriginalMessages(input);
36
+ return messages[0]!;
37
+ },
38
+ useOriginalMessage: () => {
39
+ const messageMessages = result.useOriginalMessages();
40
+ const first = messageMessages[0]!;
41
+ return first;
42
+ },
43
+ useOriginalMessages: () => {
44
+ const contentPartMessages = useContentPart<T[]>({
45
+ optional: true,
46
+ selector: getExternalStoreMessages,
47
+ });
48
+
49
+ const messageMessages = useMessage<T[]>(getExternalStoreMessages);
50
+ const messages = contentPartMessages ?? messageMessages;
51
+ if (messages.length === 0) throw new Error("No original messages found");
52
+ return messages;
53
+ },
54
+ };
55
+ };
@@ -256,7 +256,7 @@ export const useExternalMessageConverter = <T extends WeakKey>({
256
256
  return m;
257
257
  });
258
258
 
259
- return state.converterCache.convertMessages(
259
+ const threadMessages = state.converterCache.convertMessages(
260
260
  chunks,
261
261
  (cache, message, idx) => {
262
262
  const isLast = idx === chunks.length - 1;
@@ -283,6 +283,12 @@ export const useExternalMessageConverter = <T extends WeakKey>({
283
283
  return newMessage;
284
284
  },
285
285
  );
286
+
287
+ (threadMessages as unknown as { [symbolInnerMessage]: T[] })[
288
+ symbolInnerMessage
289
+ ] = messages;
290
+
291
+ return threadMessages;
286
292
  }, [state, messages, isRunning]);
287
293
  };
288
294
 
@@ -1,32 +1,37 @@
1
+ import { ThreadState } from "../../api";
1
2
  import { ThreadMessage } from "../../types";
2
3
 
3
4
  export const symbolInnerMessage = Symbol("innerMessage");
5
+ const symbolInnerMessages = Symbol("innerMessages");
4
6
 
5
- export type ExternalStoreThreadMessage<T> = ThreadMessage & {
6
- [symbolInnerMessage]?: T;
7
- };
8
-
9
- export type ExternalStoreThreadMessages<T> = ThreadMessage & {
10
- [symbolInnerMessage]?: T[];
7
+ type WithInnerMessages<T> = {
8
+ [symbolInnerMessage]?: T | T[];
9
+ [symbolInnerMessages]?: T[];
11
10
  };
12
11
 
13
12
  /**
14
13
  * @deprecated Use `getExternalStoreMessages` (plural) instead. This function will be removed in 0.8.0.
15
14
  */
16
- export const getExternalStoreMessage = <T,>(
17
- message: ThreadMessage | ThreadMessage["content"],
18
- ) => {
19
- return (message as ExternalStoreThreadMessage<T>)[symbolInnerMessage];
15
+ export const getExternalStoreMessage = <T,>(input: ThreadMessage) => {
16
+ const withInnerMessages = input as WithInnerMessages<T>;
17
+ return withInnerMessages[symbolInnerMessage];
20
18
  };
21
19
 
20
+ const EMPTY_ARRAY: never[] = [];
21
+
22
22
  export const getExternalStoreMessages = <T,>(
23
- message: ThreadMessage | ThreadMessage["content"],
23
+ input: ThreadState | ThreadMessage | ThreadMessage["content"][number],
24
24
  ) => {
25
25
  // TODO temp until 0.8.0 (migrate useExternalStoreRuntime to always set an array)
26
- const value = (message as ExternalStoreThreadMessages<T>)[symbolInnerMessage];
27
- if (!value) return []
26
+
27
+ const container = (
28
+ "messages" in input ? input.messages : input
29
+ ) as WithInnerMessages<T>;
30
+ const value = container[symbolInnerMessages] || container[symbolInnerMessage];
31
+ if (!value) return EMPTY_ARRAY;
28
32
  if (Array.isArray(value)) {
29
33
  return value;
30
34
  }
31
- return [value];
35
+ container[symbolInnerMessages] = [value];
36
+ return container[symbolInnerMessages];
32
37
  };
@@ -12,3 +12,4 @@ export {
12
12
  useExternalMessageConverter,
13
13
  convertExternalMessages as unstable_convertExternalMessages,
14
14
  } from "./external-message-converter";
15
+ export { createMessageConverter as unstable_createMessageConverter } from "./createMessageConverter";
package/src/ui/index.ts CHANGED
@@ -1,41 +1,98 @@
1
- export {
2
- ThreadConfigProvider,
3
- useThreadConfig,
4
- type ThreadConfig,
5
- type ThreadWelcomeConfig,
6
- type UserMessageConfig,
7
- type AssistantMessageConfig,
8
- type StringsConfig,
9
- type SuggestionConfig,
10
- type ThreadConfigProviderProps,
11
- } from "./thread-config";
1
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
2
+ export { ThreadConfigProvider } from "./thread-config";
3
+
4
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
5
+ export { useThreadConfig } from "./thread-config";
6
+
7
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
8
+ export type { ThreadConfig } from "./thread-config";
9
+
10
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
11
+ export type { ThreadWelcomeConfig } from "./thread-config";
12
+
13
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
14
+ export type { UserMessageConfig } from "./thread-config";
15
+
16
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
17
+ export type { AssistantMessageConfig } from "./thread-config";
18
+
19
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
20
+ export type { StringsConfig } from "./thread-config";
21
+
22
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
23
+ export type { SuggestionConfig } from "./thread-config";
24
+
25
+ /** @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`. */
26
+ export type { ThreadConfigProviderProps } from "./thread-config";
12
27
 
28
+ /**
29
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
30
+ */
13
31
  export { default as AssistantActionBar } from "./assistant-action-bar";
14
32
 
33
+ /**
34
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
35
+ */
15
36
  export { default as AssistantMessage } from "./assistant-message";
16
37
 
38
+ /**
39
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
40
+ */
17
41
  export { default as AssistantModal } from "./assistant-modal";
18
42
 
43
+ /**
44
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
45
+ */
19
46
  export { default as BranchPicker } from "./branch-picker";
20
47
 
48
+ /**
49
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
50
+ */
21
51
  export { default as Composer } from "./composer";
22
52
 
53
+ /**
54
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
55
+ */
23
56
  export { default as ContentPart } from "./content-part";
24
57
 
58
+ /**
59
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
60
+ */
25
61
  export {
26
62
  default as AttachmentUI, // TODO name collision with Attachment
27
63
  } from "./attachment-ui";
28
64
 
65
+ /**
66
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
67
+ */
29
68
  export { default as EditComposer } from "./edit-composer";
30
69
 
70
+ /**
71
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
72
+ */
31
73
  export { default as Thread } from "./thread";
32
74
 
75
+ /**
76
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
77
+ */
33
78
  export { default as ThreadList } from "./thread-list";
34
79
 
80
+ /**
81
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
82
+ */
35
83
  export { default as ThreadListItem } from "./thread-list-item";
36
84
 
85
+ /**
86
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
87
+ */
37
88
  export { default as ThreadWelcome } from "./thread-welcome";
38
89
 
90
+ /**
91
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
92
+ */
39
93
  export { default as UserMessage } from "./user-message";
40
94
 
95
+ /**
96
+ * @deprecated This export was moved to `@assistant-ui/react-ui`. Use the migration codemod to update your code, by running `npx assistant-ui upgrade`.
97
+ */
41
98
  export { default as UserActionBar } from "./user-action-bar";