@assistant-ui/react 0.7.68 → 0.7.69

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,4 +11,5 @@ export * as ThreadListItemPrimitive from "./threadListItem";
11
11
  export { useContentPartDisplay } from "./contentPart/useContentPartDisplay";
12
12
  export { useContentPartImage } from "./contentPart/useContentPartImage";
13
13
  export { useContentPartText } from "./contentPart/useContentPartText";
14
+ export { useThreadViewportAutoScroll } from "./thread/useThreadViewportAutoScroll";
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,uBAAuB,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,mBAAmB,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,qBAAqB,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,iBAAiB,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,oBAAoB,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,gBAAgB,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,eAAe,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,mBAAmB,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,uBAAuB,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,uBAAuB,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,mBAAmB,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,qBAAqB,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,iBAAiB,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,oBAAoB,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,gBAAgB,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,eAAe,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,mBAAmB,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,uBAAuB,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC"}
@@ -42,7 +42,8 @@ __export(primitives_exports, {
42
42
  ThreadPrimitive: () => ThreadPrimitive,
43
43
  useContentPartDisplay: () => import_useContentPartDisplay.useContentPartDisplay,
44
44
  useContentPartImage: () => import_useContentPartImage.useContentPartImage,
45
- useContentPartText: () => import_useContentPartText.useContentPartText
45
+ useContentPartText: () => import_useContentPartText.useContentPartText,
46
+ useThreadViewportAutoScroll: () => import_useThreadViewportAutoScroll.useThreadViewportAutoScroll
46
47
  });
47
48
  module.exports = __toCommonJS(primitives_exports);
48
49
  var ActionBarPrimitive = __toESM(require("./actionBar/index.js"));
@@ -58,6 +59,7 @@ var ThreadListItemPrimitive = __toESM(require("./threadListItem/index.js"));
58
59
  var import_useContentPartDisplay = require("./contentPart/useContentPartDisplay.js");
59
60
  var import_useContentPartImage = require("./contentPart/useContentPartImage.js");
60
61
  var import_useContentPartText = require("./contentPart/useContentPartText.js");
62
+ var import_useThreadViewportAutoScroll = require("./thread/useThreadViewportAutoScroll.js");
61
63
  // Annotate the CommonJS export names for ESM import in node:
62
64
  0 && (module.exports = {
63
65
  ActionBarPrimitive,
@@ -72,6 +74,7 @@ var import_useContentPartText = require("./contentPart/useContentPartText.js");
72
74
  ThreadPrimitive,
73
75
  useContentPartDisplay,
74
76
  useContentPartImage,
75
- useContentPartText
77
+ useContentPartText,
78
+ useThreadViewportAutoScroll
76
79
  });
77
80
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/primitives/index.ts"],"sourcesContent":["export * as ActionBarPrimitive from \"./actionBar\";\nexport * as AssistantModalPrimitive from \"./assistantModal\";\nexport * as AttachmentPrimitive from \"./attachment\";\nexport * as BranchPickerPrimitive from \"./branchPicker\";\nexport * as ComposerPrimitive from \"./composer\";\nexport * as ContentPartPrimitive from \"./contentPart\";\nexport * as MessagePrimitive from \"./message\";\nexport * as ThreadPrimitive from \"./thread\";\nexport * as ThreadListPrimitive from \"./threadList\";\nexport * as ThreadListItemPrimitive from \"./threadListItem\";\n\nexport { useContentPartDisplay } from \"./contentPart/useContentPartDisplay\";\nexport { useContentPartImage } from \"./contentPart/useContentPartImage\";\nexport { useContentPartText } from \"./contentPart/useContentPartText\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAoC;AACpC,8BAAyC;AACzC,0BAAqC;AACrC,4BAAuC;AACvC,wBAAmC;AACnC,2BAAsC;AACtC,uBAAkC;AAClC,sBAAiC;AACjC,0BAAqC;AACrC,8BAAyC;AAEzC,mCAAsC;AACtC,iCAAoC;AACpC,gCAAmC;","names":[]}
1
+ {"version":3,"sources":["../../src/primitives/index.ts"],"sourcesContent":["export * as ActionBarPrimitive from \"./actionBar\";\nexport * as AssistantModalPrimitive from \"./assistantModal\";\nexport * as AttachmentPrimitive from \"./attachment\";\nexport * as BranchPickerPrimitive from \"./branchPicker\";\nexport * as ComposerPrimitive from \"./composer\";\nexport * as ContentPartPrimitive from \"./contentPart\";\nexport * as MessagePrimitive from \"./message\";\nexport * as ThreadPrimitive from \"./thread\";\nexport * as ThreadListPrimitive from \"./threadList\";\nexport * as ThreadListItemPrimitive from \"./threadListItem\";\n\nexport { useContentPartDisplay } from \"./contentPart/useContentPartDisplay\";\nexport { useContentPartImage } from \"./contentPart/useContentPartImage\";\nexport { useContentPartText } from \"./contentPart/useContentPartText\";\nexport { useThreadViewportAutoScroll } from \"./thread/useThreadViewportAutoScroll\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAoC;AACpC,8BAAyC;AACzC,0BAAqC;AACrC,4BAAuC;AACvC,wBAAmC;AACnC,2BAAsC;AACtC,uBAAkC;AAClC,sBAAiC;AACjC,0BAAqC;AACrC,8BAAyC;AAEzC,mCAAsC;AACtC,iCAAoC;AACpC,gCAAmC;AACnC,yCAA4C;","names":[]}
@@ -12,6 +12,7 @@ import * as ThreadListItemPrimitive from "./threadListItem/index.mjs";
12
12
  import { useContentPartDisplay } from "./contentPart/useContentPartDisplay.mjs";
13
13
  import { useContentPartImage } from "./contentPart/useContentPartImage.mjs";
14
14
  import { useContentPartText } from "./contentPart/useContentPartText.mjs";
15
+ import { useThreadViewportAutoScroll } from "./thread/useThreadViewportAutoScroll.mjs";
15
16
  export {
16
17
  ActionBarPrimitive,
17
18
  AssistantModalPrimitive,
@@ -25,6 +26,7 @@ export {
25
26
  ThreadPrimitive,
26
27
  useContentPartDisplay,
27
28
  useContentPartImage,
28
- useContentPartText
29
+ useContentPartText,
30
+ useThreadViewportAutoScroll
29
31
  };
30
32
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/primitives/index.ts"],"sourcesContent":["export * as ActionBarPrimitive from \"./actionBar\";\nexport * as AssistantModalPrimitive from \"./assistantModal\";\nexport * as AttachmentPrimitive from \"./attachment\";\nexport * as BranchPickerPrimitive from \"./branchPicker\";\nexport * as ComposerPrimitive from \"./composer\";\nexport * as ContentPartPrimitive from \"./contentPart\";\nexport * as MessagePrimitive from \"./message\";\nexport * as ThreadPrimitive from \"./thread\";\nexport * as ThreadListPrimitive from \"./threadList\";\nexport * as ThreadListItemPrimitive from \"./threadListItem\";\n\nexport { useContentPartDisplay } from \"./contentPart/useContentPartDisplay\";\nexport { useContentPartImage } from \"./contentPart/useContentPartImage\";\nexport { useContentPartText } from \"./contentPart/useContentPartText\";\n"],"mappings":";AAAA,YAAY,wBAAwB;AACpC,YAAY,6BAA6B;AACzC,YAAY,yBAAyB;AACrC,YAAY,2BAA2B;AACvC,YAAY,uBAAuB;AACnC,YAAY,0BAA0B;AACtC,YAAY,sBAAsB;AAClC,YAAY,qBAAqB;AACjC,YAAY,yBAAyB;AACrC,YAAY,6BAA6B;AAEzC,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;","names":[]}
1
+ {"version":3,"sources":["../../src/primitives/index.ts"],"sourcesContent":["export * as ActionBarPrimitive from \"./actionBar\";\nexport * as AssistantModalPrimitive from \"./assistantModal\";\nexport * as AttachmentPrimitive from \"./attachment\";\nexport * as BranchPickerPrimitive from \"./branchPicker\";\nexport * as ComposerPrimitive from \"./composer\";\nexport * as ContentPartPrimitive from \"./contentPart\";\nexport * as MessagePrimitive from \"./message\";\nexport * as ThreadPrimitive from \"./thread\";\nexport * as ThreadListPrimitive from \"./threadList\";\nexport * as ThreadListItemPrimitive from \"./threadListItem\";\n\nexport { useContentPartDisplay } from \"./contentPart/useContentPartDisplay\";\nexport { useContentPartImage } from \"./contentPart/useContentPartImage\";\nexport { useContentPartText } from \"./contentPart/useContentPartText\";\nexport { useThreadViewportAutoScroll } from \"./thread/useThreadViewportAutoScroll\";\n"],"mappings":";AAAA,YAAY,wBAAwB;AACpC,YAAY,6BAA6B;AACzC,YAAY,yBAAyB;AACrC,YAAY,2BAA2B;AACvC,YAAY,uBAAuB;AACnC,YAAY,0BAA0B;AACtC,YAAY,sBAAsB;AAClC,YAAY,qBAAqB;AACjC,YAAY,yBAAyB;AACrC,YAAY,6BAA6B;AAEzC,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,mCAAmC;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import { ActionButtonElement, ActionButtonProps } from "../../utils/createActionButton";
2
2
  declare const useThreadSuggestion: ({ prompt, autoSend, }: {
3
3
  prompt: string;
4
- method: "replace";
4
+ method?: "replace";
5
5
  autoSend?: boolean | undefined;
6
6
  }) => (() => void) | null;
7
7
  export declare namespace ThreadPrimitiveSuggestion {
@@ -12,7 +12,7 @@ export declare const ThreadPrimitiveSuggestion: import("react").ForwardRefExotic
12
12
  asChild?: boolean;
13
13
  }, "ref"> & {
14
14
  prompt: string;
15
- method: "replace";
15
+ method?: "replace";
16
16
  autoSend?: boolean | undefined;
17
17
  } & import("react").RefAttributes<HTMLButtonElement>>;
18
18
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadSuggestion.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadSuggestion.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAKxC,QAAA,MAAM,mBAAmB,0BAGtB;IACD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC,wBAeA,CAAC;AAEF,yBAAiB,yBAAyB,CAAC;IACzC,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACnE;AAED,eAAO,MAAM,yBAAyB;;;YAzB5B,MAAM;YACN,SAAS;eACN,OAAO,GAAG,SAAS;qDA2B/B,CAAC"}
1
+ {"version":3,"file":"ThreadSuggestion.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadSuggestion.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAKxC,QAAA,MAAM,mBAAmB,0BAGtB;IACD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC,wBAcA,CAAC;AAEF,yBAAiB,yBAAyB,CAAC;IACzC,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACnE;AAED,eAAO,MAAM,yBAAyB;;;YAxB5B,MAAM;aACL,SAAS;eACP,OAAO,GAAG,SAAS;qDA0B/B,CAAC"}
@@ -37,7 +37,6 @@ var useThreadSuggestion = ({
37
37
  const callback = (0, import_react.useCallback)(() => {
38
38
  if (autoSend && !threadRuntime.getState().isRunning) {
39
39
  threadRuntime.append(prompt);
40
- threadRuntime.composer.setText("");
41
40
  } else {
42
41
  threadRuntime.composer.setText(prompt);
43
42
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/thread/ThreadSuggestion.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useThread } from \"../../context\";\nimport { useThreadRuntime } from \"../../context/react/ThreadContext\";\n\nconst useThreadSuggestion = ({\n prompt,\n autoSend,\n}: {\n prompt: string;\n method: \"replace\";\n autoSend?: boolean | undefined;\n}) => {\n const threadRuntime = useThreadRuntime();\n\n const disabled = useThread((t) => t.isDisabled);\n const callback = useCallback(() => {\n if (autoSend && !threadRuntime.getState().isRunning) {\n threadRuntime.append(prompt);\n threadRuntime.composer.setText(\"\");\n } else {\n threadRuntime.composer.setText(prompt);\n }\n }, [threadRuntime, autoSend, prompt]);\n\n if (disabled) return null;\n return callback;\n};\n\nexport namespace ThreadPrimitiveSuggestion {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadSuggestion>;\n}\n\nexport const ThreadPrimitiveSuggestion = createActionButton(\n \"ThreadPrimitive.Suggestion\",\n useThreadSuggestion,\n [\"prompt\", \"autoSend\", \"method\"],\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,gCAIO;AACP,mBAA4B;AAC5B,qBAA0B;AAC1B,2BAAiC;AAEjC,IAAM,sBAAsB,CAAC;AAAA,EAC3B;AAAA,EACA;AACF,MAIM;AACJ,QAAM,oBAAgB,uCAAiB;AAEvC,QAAM,eAAW,0BAAU,CAAC,MAAM,EAAE,UAAU;AAC9C,QAAM,eAAW,0BAAY,MAAM;AACjC,QAAI,YAAY,CAAC,cAAc,SAAS,EAAE,WAAW;AACnD,oBAAc,OAAO,MAAM;AAC3B,oBAAc,SAAS,QAAQ,EAAE;AAAA,IACnC,OAAO;AACL,oBAAc,SAAS,QAAQ,MAAM;AAAA,IACvC;AAAA,EACF,GAAG,CAAC,eAAe,UAAU,MAAM,CAAC;AAEpC,MAAI,SAAU,QAAO;AACrB,SAAO;AACT;AAOO,IAAM,gCAA4B;AAAA,EACvC;AAAA,EACA;AAAA,EACA,CAAC,UAAU,YAAY,QAAQ;AACjC;","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/thread/ThreadSuggestion.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useThread } from \"../../context\";\nimport { useThreadRuntime } from \"../../context/react/ThreadContext\";\n\nconst useThreadSuggestion = ({\n prompt,\n autoSend,\n}: {\n prompt: string;\n method?: \"replace\";\n autoSend?: boolean | undefined;\n}) => {\n const threadRuntime = useThreadRuntime();\n\n const disabled = useThread((t) => t.isDisabled);\n const callback = useCallback(() => {\n if (autoSend && !threadRuntime.getState().isRunning) {\n threadRuntime.append(prompt);\n } else {\n threadRuntime.composer.setText(prompt);\n }\n }, [threadRuntime, autoSend, prompt]);\n\n if (disabled) return null;\n return callback;\n};\n\nexport namespace ThreadPrimitiveSuggestion {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadSuggestion>;\n}\n\nexport const ThreadPrimitiveSuggestion = createActionButton(\n \"ThreadPrimitive.Suggestion\",\n useThreadSuggestion,\n [\"prompt\", \"autoSend\", \"method\"],\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,gCAIO;AACP,mBAA4B;AAC5B,qBAA0B;AAC1B,2BAAiC;AAEjC,IAAM,sBAAsB,CAAC;AAAA,EAC3B;AAAA,EACA;AACF,MAIM;AACJ,QAAM,oBAAgB,uCAAiB;AAEvC,QAAM,eAAW,0BAAU,CAAC,MAAM,EAAE,UAAU;AAC9C,QAAM,eAAW,0BAAY,MAAM;AACjC,QAAI,YAAY,CAAC,cAAc,SAAS,EAAE,WAAW;AACnD,oBAAc,OAAO,MAAM;AAAA,IAC7B,OAAO;AACL,oBAAc,SAAS,QAAQ,MAAM;AAAA,IACvC;AAAA,EACF,GAAG,CAAC,eAAe,UAAU,MAAM,CAAC;AAEpC,MAAI,SAAU,QAAO;AACrB,SAAO;AACT;AAOO,IAAM,gCAA4B;AAAA,EACvC;AAAA,EACA;AAAA,EACA,CAAC,UAAU,YAAY,QAAQ;AACjC;","names":[]}
@@ -16,7 +16,6 @@ var useThreadSuggestion = ({
16
16
  const callback = useCallback(() => {
17
17
  if (autoSend && !threadRuntime.getState().isRunning) {
18
18
  threadRuntime.append(prompt);
19
- threadRuntime.composer.setText("");
20
19
  } else {
21
20
  threadRuntime.composer.setText(prompt);
22
21
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/thread/ThreadSuggestion.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useThread } from \"../../context\";\nimport { useThreadRuntime } from \"../../context/react/ThreadContext\";\n\nconst useThreadSuggestion = ({\n prompt,\n autoSend,\n}: {\n prompt: string;\n method: \"replace\";\n autoSend?: boolean | undefined;\n}) => {\n const threadRuntime = useThreadRuntime();\n\n const disabled = useThread((t) => t.isDisabled);\n const callback = useCallback(() => {\n if (autoSend && !threadRuntime.getState().isRunning) {\n threadRuntime.append(prompt);\n threadRuntime.composer.setText(\"\");\n } else {\n threadRuntime.composer.setText(prompt);\n }\n }, [threadRuntime, autoSend, prompt]);\n\n if (disabled) return null;\n return callback;\n};\n\nexport namespace ThreadPrimitiveSuggestion {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadSuggestion>;\n}\n\nexport const ThreadPrimitiveSuggestion = createActionButton(\n \"ThreadPrimitive.Suggestion\",\n useThreadSuggestion,\n [\"prompt\", \"autoSend\", \"method\"],\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;AAEjC,IAAM,sBAAsB,CAAC;AAAA,EAC3B;AAAA,EACA;AACF,MAIM;AACJ,QAAM,gBAAgB,iBAAiB;AAEvC,QAAM,WAAW,UAAU,CAAC,MAAM,EAAE,UAAU;AAC9C,QAAM,WAAW,YAAY,MAAM;AACjC,QAAI,YAAY,CAAC,cAAc,SAAS,EAAE,WAAW;AACnD,oBAAc,OAAO,MAAM;AAC3B,oBAAc,SAAS,QAAQ,EAAE;AAAA,IACnC,OAAO;AACL,oBAAc,SAAS,QAAQ,MAAM;AAAA,IACvC;AAAA,EACF,GAAG,CAAC,eAAe,UAAU,MAAM,CAAC;AAEpC,MAAI,SAAU,QAAO;AACrB,SAAO;AACT;AAOO,IAAM,4BAA4B;AAAA,EACvC;AAAA,EACA;AAAA,EACA,CAAC,UAAU,YAAY,QAAQ;AACjC;","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/thread/ThreadSuggestion.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useThread } from \"../../context\";\nimport { useThreadRuntime } from \"../../context/react/ThreadContext\";\n\nconst useThreadSuggestion = ({\n prompt,\n autoSend,\n}: {\n prompt: string;\n method?: \"replace\";\n autoSend?: boolean | undefined;\n}) => {\n const threadRuntime = useThreadRuntime();\n\n const disabled = useThread((t) => t.isDisabled);\n const callback = useCallback(() => {\n if (autoSend && !threadRuntime.getState().isRunning) {\n threadRuntime.append(prompt);\n } else {\n threadRuntime.composer.setText(prompt);\n }\n }, [threadRuntime, autoSend, prompt]);\n\n if (disabled) return null;\n return callback;\n};\n\nexport namespace ThreadPrimitiveSuggestion {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadSuggestion>;\n}\n\nexport const ThreadPrimitiveSuggestion = createActionButton(\n \"ThreadPrimitive.Suggestion\",\n useThreadSuggestion,\n [\"prompt\", \"autoSend\", \"method\"],\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;AAEjC,IAAM,sBAAsB,CAAC;AAAA,EAC3B;AAAA,EACA;AACF,MAIM;AACJ,QAAM,gBAAgB,iBAAiB;AAEvC,QAAM,WAAW,UAAU,CAAC,MAAM,EAAE,UAAU;AAC9C,QAAM,WAAW,YAAY,MAAM;AACjC,QAAI,YAAY,CAAC,cAAc,SAAS,EAAE,WAAW;AACnD,oBAAc,OAAO,MAAM;AAAA,IAC7B,OAAO;AACL,oBAAc,SAAS,QAAQ,MAAM;AAAA,IACvC;AAAA,EACF,GAAG,CAAC,eAAe,UAAU,MAAM,CAAC;AAEpC,MAAI,SAAU,QAAO;AACrB,SAAO;AACT;AAOO,IAAM,4BAA4B;AAAA,EACvC;AAAA,EACA;AAAA,EACA,CAAC,UAAU,YAAY,QAAQ;AACjC;","names":[]}
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  .aui-thread-viewport-footer {
12
- @apply max-w-aui-thread sticky bottom-0 mt-3 flex w-full flex-col items-center justify-end rounded-t-lg bg-inherit pb-4;
12
+ @apply max-w-[var(--aui-thread-max-width)] sticky bottom-0 mt-3 flex w-full flex-col items-center justify-end rounded-t-lg bg-inherit pb-4;
13
13
  }
14
14
 
15
15
  .aui-thread-scroll-to-bottom {
@@ -27,7 +27,7 @@
27
27
  /* thread welcome */
28
28
 
29
29
  .aui-thread-welcome-root {
30
- @apply max-w-aui-thread flex w-full flex-grow flex-col;
30
+ @apply max-w-[var(--aui-thread-max-width)] flex w-full flex-grow flex-col;
31
31
  }
32
32
 
33
33
  .aui-thread-welcome-center {
@@ -108,7 +108,7 @@
108
108
 
109
109
  .aui-user-message-root {
110
110
  @apply grid auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] gap-y-2 [&>*]:col-start-2;
111
- @apply max-w-aui-thread w-full py-4;
111
+ @apply max-w-[var(--aui-thread-max-width)] w-full py-4;
112
112
  }
113
113
 
114
114
  :where(.aui-user-message-root) > .aui-user-action-bar-root {
@@ -146,7 +146,7 @@
146
146
  /* edit composer */
147
147
 
148
148
  .aui-edit-composer-root {
149
- @apply bg-aui-muted max-w-aui-thread my-4 flex w-full flex-col gap-2 rounded-xl;
149
+ @apply bg-aui-muted max-w-[var(--aui-thread-max-width)] my-4 flex w-full flex-col gap-2 rounded-xl;
150
150
  }
151
151
 
152
152
  .aui-edit-composer-input {
@@ -161,7 +161,7 @@
161
161
 
162
162
  .aui-assistant-message-root {
163
163
  @apply grid grid-cols-[auto_auto_1fr] grid-rows-[auto_1fr];
164
- @apply max-w-aui-thread relative w-full py-4;
164
+ @apply max-w-[var(--aui-thread-max-width)] relative w-full py-4;
165
165
  }
166
166
 
167
167
  :where(.aui-assistant-message-root) > .aui-avatar-root {
@@ -7,7 +7,7 @@
7
7
  "@apply bg-aui-background flex h-full flex-col items-center overflow-y-scroll scroll-smooth px-4 pt-8": {}
8
8
  },
9
9
  ".aui-thread-viewport-footer": {
10
- "@apply max-w-aui-thread sticky bottom-0 mt-3 flex w-full flex-col items-center justify-end rounded-t-lg bg-inherit pb-4": {}
10
+ "@apply max-w-[var(--aui-thread-max-width)] sticky bottom-0 mt-3 flex w-full flex-col items-center justify-end rounded-t-lg bg-inherit pb-4": {}
11
11
  },
12
12
  ".aui-thread-scroll-to-bottom": {
13
13
  "@apply absolute -top-8 rounded-full disabled:invisible": {}
@@ -19,7 +19,7 @@
19
19
  "@apply bg-aui-background hover:bg-aui-muted/80 rounded-full border px-3 py-1 text-sm transition-colors ease-in": {}
20
20
  },
21
21
  ".aui-thread-welcome-root": {
22
- "@apply max-w-aui-thread flex w-full flex-grow flex-col": {}
22
+ "@apply max-w-[var(--aui-thread-max-width)] flex w-full flex-grow flex-col": {}
23
23
  },
24
24
  ".aui-thread-welcome-center": {
25
25
  "@apply flex w-full flex-grow flex-col items-center justify-center": {}
@@ -74,7 +74,7 @@
74
74
  },
75
75
  ".aui-user-message-root": {
76
76
  "@apply grid auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] gap-y-2 [&>*]:col-start-2": {},
77
- "@apply max-w-aui-thread w-full py-4": {}
77
+ "@apply max-w-[var(--aui-thread-max-width)] w-full py-4": {}
78
78
  },
79
79
  ":where(.aui-user-message-root) > .aui-user-action-bar-root": {
80
80
  "@apply col-start-1 row-start-2 mr-3 mt-2.5": {}
@@ -100,7 +100,7 @@
100
100
  "@apply flex flex-col items-end": {}
101
101
  },
102
102
  ".aui-edit-composer-root": {
103
- "@apply bg-aui-muted max-w-aui-thread my-4 flex w-full flex-col gap-2 rounded-xl": {}
103
+ "@apply bg-aui-muted max-w-[var(--aui-thread-max-width)] my-4 flex w-full flex-col gap-2 rounded-xl": {}
104
104
  },
105
105
  ".aui-edit-composer-input": {
106
106
  "@apply text-aui-foreground flex h-8 w-full resize-none bg-transparent p-4 pb-0 outline-none": {}
@@ -110,7 +110,7 @@
110
110
  },
111
111
  ".aui-assistant-message-root": {
112
112
  "@apply grid grid-cols-[auto_auto_1fr] grid-rows-[auto_1fr]": {},
113
- "@apply max-w-aui-thread relative w-full py-4": {}
113
+ "@apply max-w-[var(--aui-thread-max-width)] relative w-full py-4": {}
114
114
  },
115
115
  ":where(.aui-assistant-message-root) > .aui-avatar-root": {
116
116
  "@apply col-start-1 row-span-full row-start-1 mr-4": {}
package/package.json CHANGED
@@ -29,7 +29,7 @@
29
29
  "conversational-ui",
30
30
  "conversational-ai"
31
31
  ],
32
- "version": "0.7.68",
32
+ "version": "0.7.69",
33
33
  "license": "MIT",
34
34
  "exports": {
35
35
  ".": {
@@ -12,3 +12,4 @@ export * as ThreadListItemPrimitive from "./threadListItem";
12
12
  export { useContentPartDisplay } from "./contentPart/useContentPartDisplay";
13
13
  export { useContentPartImage } from "./contentPart/useContentPartImage";
14
14
  export { useContentPartText } from "./contentPart/useContentPartText";
15
+ export { useThreadViewportAutoScroll } from "./thread/useThreadViewportAutoScroll";
@@ -14,7 +14,7 @@ const useThreadSuggestion = ({
14
14
  autoSend,
15
15
  }: {
16
16
  prompt: string;
17
- method: "replace";
17
+ method?: "replace";
18
18
  autoSend?: boolean | undefined;
19
19
  }) => {
20
20
  const threadRuntime = useThreadRuntime();
@@ -23,7 +23,6 @@ const useThreadSuggestion = ({
23
23
  const callback = useCallback(() => {
24
24
  if (autoSend && !threadRuntime.getState().isRunning) {
25
25
  threadRuntime.append(prompt);
26
- threadRuntime.composer.setText("");
27
26
  } else {
28
27
  threadRuntime.composer.setText(prompt);
29
28
  }
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  .aui-thread-viewport-footer {
12
- @apply max-w-aui-thread sticky bottom-0 mt-3 flex w-full flex-col items-center justify-end rounded-t-lg bg-inherit pb-4;
12
+ @apply max-w-[var(--aui-thread-max-width)] sticky bottom-0 mt-3 flex w-full flex-col items-center justify-end rounded-t-lg bg-inherit pb-4;
13
13
  }
14
14
 
15
15
  .aui-thread-scroll-to-bottom {
@@ -27,7 +27,7 @@
27
27
  /* thread welcome */
28
28
 
29
29
  .aui-thread-welcome-root {
30
- @apply max-w-aui-thread flex w-full flex-grow flex-col;
30
+ @apply max-w-[var(--aui-thread-max-width)] flex w-full flex-grow flex-col;
31
31
  }
32
32
 
33
33
  .aui-thread-welcome-center {
@@ -108,7 +108,7 @@
108
108
 
109
109
  .aui-user-message-root {
110
110
  @apply grid auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] gap-y-2 [&>*]:col-start-2;
111
- @apply max-w-aui-thread w-full py-4;
111
+ @apply max-w-[var(--aui-thread-max-width)] w-full py-4;
112
112
  }
113
113
 
114
114
  :where(.aui-user-message-root) > .aui-user-action-bar-root {
@@ -146,7 +146,7 @@
146
146
  /* edit composer */
147
147
 
148
148
  .aui-edit-composer-root {
149
- @apply bg-aui-muted max-w-aui-thread my-4 flex w-full flex-col gap-2 rounded-xl;
149
+ @apply bg-aui-muted max-w-[var(--aui-thread-max-width)] my-4 flex w-full flex-col gap-2 rounded-xl;
150
150
  }
151
151
 
152
152
  .aui-edit-composer-input {
@@ -161,7 +161,7 @@
161
161
 
162
162
  .aui-assistant-message-root {
163
163
  @apply grid grid-cols-[auto_auto_1fr] grid-rows-[auto_1fr];
164
- @apply max-w-aui-thread relative w-full py-4;
164
+ @apply max-w-[var(--aui-thread-max-width)] relative w-full py-4;
165
165
  }
166
166
 
167
167
  :where(.aui-assistant-message-root) > .aui-avatar-root {