@assistant-ui/react 0.7.68 → 0.7.70
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/api/MessageRuntime.d.ts +2 -1
- package/dist/api/MessageRuntime.d.ts.map +1 -1
- package/dist/api/MessageRuntime.js +9 -2
- package/dist/api/MessageRuntime.js.map +1 -1
- package/dist/api/MessageRuntime.mjs +9 -2
- package/dist/api/MessageRuntime.mjs.map +1 -1
- package/dist/context/providers/ThreadRuntimeProvider.d.ts.map +1 -1
- package/dist/context/providers/ThreadRuntimeProvider.js +3 -5
- package/dist/context/providers/ThreadRuntimeProvider.js.map +1 -1
- package/dist/context/providers/ThreadRuntimeProvider.mjs +3 -5
- package/dist/context/providers/ThreadRuntimeProvider.mjs.map +1 -1
- package/dist/context/providers/ThreadViewportProvider.d.ts +3 -0
- package/dist/context/providers/ThreadViewportProvider.d.ts.map +1 -0
- package/dist/context/providers/ThreadViewportProvider.js +63 -0
- package/dist/context/providers/ThreadViewportProvider.js.map +1 -0
- package/dist/context/providers/ThreadViewportProvider.mjs +42 -0
- package/dist/context/providers/ThreadViewportProvider.mjs.map +1 -0
- package/dist/context/react/ThreadContext.d.ts +0 -18
- package/dist/context/react/ThreadContext.d.ts.map +1 -1
- package/dist/context/react/ThreadContext.js +2 -11
- package/dist/context/react/ThreadContext.js.map +1 -1
- package/dist/context/react/ThreadContext.mjs +1 -8
- package/dist/context/react/ThreadContext.mjs.map +1 -1
- package/dist/context/react/ThreadViewportContext.d.ts +24 -0
- package/dist/context/react/ThreadViewportContext.d.ts.map +1 -0
- package/dist/context/react/ThreadViewportContext.js +44 -0
- package/dist/context/react/ThreadViewportContext.js.map +1 -0
- package/dist/context/react/ThreadViewportContext.mjs +18 -0
- package/dist/context/react/ThreadViewportContext.mjs.map +1 -0
- package/dist/context/react/index.d.ts +2 -1
- package/dist/context/react/index.d.ts.map +1 -1
- package/dist/context/react/index.js +3 -2
- package/dist/context/react/index.js.map +1 -1
- package/dist/context/react/index.mjs +4 -2
- package/dist/context/react/index.mjs.map +1 -1
- package/dist/context/stores/ThreadViewport.d.ts.map +1 -1
- package/dist/context/stores/ThreadViewport.js +1 -0
- package/dist/context/stores/ThreadViewport.js.map +1 -1
- package/dist/context/stores/ThreadViewport.mjs +2 -0
- package/dist/context/stores/ThreadViewport.mjs.map +1 -1
- package/dist/model-context/ModelContextTypes.d.ts +3 -0
- package/dist/model-context/ModelContextTypes.d.ts.map +1 -1
- package/dist/model-context/ModelContextTypes.js.map +1 -1
- package/dist/model-context/ModelContextTypes.mjs.map +1 -1
- package/dist/primitives/index.d.ts +1 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +5 -2
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/index.mjs +3 -1
- package/dist/primitives/index.mjs.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.js +3 -4
- package/dist/primitives/thread/ThreadScrollToBottom.js.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.mjs +1 -2
- package/dist/primitives/thread/ThreadScrollToBottom.mjs.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.d.ts +2 -2
- package/dist/primitives/thread/ThreadSuggestion.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.js +0 -1
- package/dist/primitives/thread/ThreadSuggestion.js.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.mjs +0 -1
- package/dist/primitives/thread/ThreadSuggestion.mjs.map +1 -1
- package/dist/primitives/thread/ThreadViewport.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadViewport.js +5 -1
- package/dist/primitives/thread/ThreadViewport.js.map +1 -1
- package/dist/primitives/thread/ThreadViewport.mjs +5 -1
- package/dist/primitives/thread/ThreadViewport.mjs.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.d.ts.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.js +2 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.mjs +2 -4
- package/dist/primitives/thread/useThreadViewportAutoScroll.mjs.map +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.d.ts +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js +1 -0
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.mjs +1 -0
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.d.ts.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.js +13 -15
- package/dist/runtimes/edge/streams/toolResultStream.js.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.mjs +13 -15
- package/dist/runtimes/edge/streams/toolResultStream.mjs.map +1 -1
- package/dist/styles/tailwindcss/thread.css +5 -5
- package/dist/styles/tailwindcss/thread.css.json +5 -5
- package/dist/utils/hooks/useOnScrollToBottom.js +2 -2
- package/dist/utils/hooks/useOnScrollToBottom.js.map +1 -1
- package/dist/utils/hooks/useOnScrollToBottom.mjs +1 -1
- package/dist/utils/hooks/useOnScrollToBottom.mjs.map +1 -1
- package/package.json +3 -3
- package/src/api/MessageRuntime.ts +14 -5
- package/src/context/providers/ThreadRuntimeProvider.tsx +4 -5
- package/src/context/providers/ThreadViewportProvider.tsx +49 -0
- package/src/context/react/ThreadContext.ts +0 -8
- package/src/context/react/ThreadViewportContext.ts +23 -0
- package/src/context/react/index.ts +4 -1
- package/src/context/stores/ThreadViewport.tsx +2 -0
- package/src/model-context/ModelContextTypes.ts +7 -0
- package/src/primitives/index.ts +1 -0
- package/src/primitives/thread/ThreadScrollToBottom.tsx +1 -2
- package/src/primitives/thread/ThreadSuggestion.tsx +1 -2
- package/src/primitives/thread/ThreadViewport.tsx +13 -1
- package/src/primitives/thread/useThreadViewportAutoScroll.tsx +2 -4
- package/src/runtimes/composer/DefaultEditComposerRuntimeCore.tsx +4 -1
- package/src/runtimes/edge/streams/toolResultStream.ts +20 -18
- package/src/styles/tailwindcss/thread.css +5 -5
- package/src/utils/hooks/useOnScrollToBottom.tsx +1 -1
@@ -0,0 +1,24 @@
|
|
1
|
+
import { ReadonlyStore } from "../ReadonlyStore";
|
2
|
+
import { UseBoundStore } from "zustand";
|
3
|
+
import { ThreadViewportState } from "../stores";
|
4
|
+
export type ThreadViewportContextValue = {
|
5
|
+
useThreadViewport: UseBoundStore<ReadonlyStore<ThreadViewportState>>;
|
6
|
+
};
|
7
|
+
export declare const ThreadViewportContext: import("react").Context<ThreadViewportContextValue | null>;
|
8
|
+
export declare const useThreadViewport: {
|
9
|
+
(): ThreadViewportState;
|
10
|
+
<TSelected>(selector: (state: ThreadViewportState) => TSelected): TSelected;
|
11
|
+
(options: {
|
12
|
+
optional: true;
|
13
|
+
}): ThreadViewportState | null;
|
14
|
+
<TSelected>(options: {
|
15
|
+
optional: true;
|
16
|
+
selector?: (state: ThreadViewportState) => TSelected;
|
17
|
+
}): TSelected | null;
|
18
|
+
}, useThreadViewportStore: {
|
19
|
+
(): ReadonlyStore<ThreadViewportState>;
|
20
|
+
(options: {
|
21
|
+
optional: true;
|
22
|
+
}): ReadonlyStore<ThreadViewportState> | null;
|
23
|
+
};
|
24
|
+
//# sourceMappingURL=ThreadViewportContext.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ThreadViewportContext.d.ts","sourceRoot":"","sources":["../../../src/context/react/ThreadViewportContext.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,MAAM,0BAA0B,GAAG;IACvC,iBAAiB,EAAE,aAAa,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC;CACtE,CAAC;AAEF,eAAO,MAAM,qBAAqB,4DACsB,CAAC;AAOzD,eAAO,MAAQ,iBAAiB;;;;;;;;;;GAAE,sBAAsB;;;;;CACe,CAAC"}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
"use strict";
|
2
|
+
"use client";
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __export = (target, all) => {
|
8
|
+
for (var name in all)
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
+
};
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
+
for (let key of __getOwnPropNames(from))
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
+
}
|
17
|
+
return to;
|
18
|
+
};
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
20
|
+
|
21
|
+
// src/context/react/ThreadViewportContext.ts
|
22
|
+
var ThreadViewportContext_exports = {};
|
23
|
+
__export(ThreadViewportContext_exports, {
|
24
|
+
ThreadViewportContext: () => ThreadViewportContext,
|
25
|
+
useThreadViewport: () => useThreadViewport,
|
26
|
+
useThreadViewportStore: () => useThreadViewportStore
|
27
|
+
});
|
28
|
+
module.exports = __toCommonJS(ThreadViewportContext_exports);
|
29
|
+
var import_react = require("react");
|
30
|
+
var import_createContextHook = require("./utils/createContextHook.js");
|
31
|
+
var import_createContextStoreHook = require("./utils/createContextStoreHook.js");
|
32
|
+
var ThreadViewportContext = (0, import_react.createContext)(null);
|
33
|
+
var useThreadViewportContext = (0, import_createContextHook.createContextHook)(
|
34
|
+
ThreadViewportContext,
|
35
|
+
"ThreadPrimitive.Viewport"
|
36
|
+
);
|
37
|
+
var { useThreadViewport, useThreadViewportStore } = (0, import_createContextStoreHook.createContextStoreHook)(useThreadViewportContext, "useThreadViewport");
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
39
|
+
0 && (module.exports = {
|
40
|
+
ThreadViewportContext,
|
41
|
+
useThreadViewport,
|
42
|
+
useThreadViewportStore
|
43
|
+
});
|
44
|
+
//# sourceMappingURL=ThreadViewportContext.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/context/react/ThreadViewportContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { UseBoundStore } from \"zustand\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { createContextStoreHook } from \"./utils/createContextStoreHook\";\nimport { ThreadViewportState } from \"../stores\";\n\nexport type ThreadViewportContextValue = {\n useThreadViewport: UseBoundStore<ReadonlyStore<ThreadViewportState>>;\n};\n\nexport const ThreadViewportContext =\n createContext<ThreadViewportContextValue | null>(null);\n\nconst useThreadViewportContext = createContextHook(\n ThreadViewportContext,\n \"ThreadPrimitive.Viewport\",\n);\n\nexport const { useThreadViewport, useThreadViewportStore } =\n createContextStoreHook(useThreadViewportContext, \"useThreadViewport\");\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA8B;AAG9B,+BAAkC;AAClC,oCAAuC;AAOhC,IAAM,4BACX,4BAAiD,IAAI;AAEvD,IAAM,+BAA2B;AAAA,EAC/B;AAAA,EACA;AACF;AAEO,IAAM,EAAE,mBAAmB,uBAAuB,QACvD,sDAAuB,0BAA0B,mBAAmB;","names":[]}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use client";
|
2
|
+
|
3
|
+
// src/context/react/ThreadViewportContext.ts
|
4
|
+
import { createContext } from "react";
|
5
|
+
import { createContextHook } from "./utils/createContextHook.mjs";
|
6
|
+
import { createContextStoreHook } from "./utils/createContextStoreHook.mjs";
|
7
|
+
var ThreadViewportContext = createContext(null);
|
8
|
+
var useThreadViewportContext = createContextHook(
|
9
|
+
ThreadViewportContext,
|
10
|
+
"ThreadPrimitive.Viewport"
|
11
|
+
);
|
12
|
+
var { useThreadViewport, useThreadViewportStore } = createContextStoreHook(useThreadViewportContext, "useThreadViewport");
|
13
|
+
export {
|
14
|
+
ThreadViewportContext,
|
15
|
+
useThreadViewport,
|
16
|
+
useThreadViewportStore
|
17
|
+
};
|
18
|
+
//# sourceMappingURL=ThreadViewportContext.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/context/react/ThreadViewportContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { UseBoundStore } from \"zustand\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { createContextStoreHook } from \"./utils/createContextStoreHook\";\nimport { ThreadViewportState } from \"../stores\";\n\nexport type ThreadViewportContextValue = {\n useThreadViewport: UseBoundStore<ReadonlyStore<ThreadViewportState>>;\n};\n\nexport const ThreadViewportContext =\n createContext<ThreadViewportContextValue | null>(null);\n\nconst useThreadViewportContext = createContextHook(\n ThreadViewportContext,\n \"ThreadPrimitive.Viewport\",\n);\n\nexport const { useThreadViewport, useThreadViewportStore } =\n createContextStoreHook(useThreadViewportContext, \"useThreadViewport\");\n"],"mappings":";;;AAEA,SAAS,qBAAqB;AAG9B,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AAOhC,IAAM,wBACX,cAAiD,IAAI;AAEvD,IAAM,2BAA2B;AAAA,EAC/B;AAAA,EACA;AACF;AAEO,IAAM,EAAE,mBAAmB,uBAAuB,IACvD,uBAAuB,0BAA0B,mBAAmB;","names":[]}
|
@@ -3,7 +3,8 @@ export { useThreadRuntime, useThread, useThreadComposer, useThreadModelContext,
|
|
3
3
|
/**
|
4
4
|
* @deprecated This method was renamed to `useThreadModelContext`.
|
5
5
|
*/
|
6
|
-
useThreadModelContext as useThreadModelConfig,
|
6
|
+
useThreadModelContext as useThreadModelConfig, } from "./ThreadContext";
|
7
|
+
export { useThreadViewport, useThreadViewportStore, } from "./ThreadViewportContext";
|
7
8
|
export { useThreadListItemRuntime, useThreadListItem, } from "./ThreadListItemContext";
|
8
9
|
export { useMessageRuntime, useMessage, useEditComposer, useMessageUtils, useMessageUtilsStore, } from "./MessageContext";
|
9
10
|
export { useContentPartRuntime, useContentPart } from "./ContentPartContext";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/context/react/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,qBAAqB;AACrB;;GAEG;AACH,qBAAqB,IAAI,oBAAoB,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/context/react/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,qBAAqB;AACrB;;GAEG;AACH,qBAAqB,IAAI,oBAAoB,GAC9C,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,eAAe,EACf,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,EACL,aAAa,EACb,oBAAoB,GASrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC"}
|
@@ -42,14 +42,15 @@ __export(react_exports, {
|
|
42
42
|
useThreadModelConfig: () => import_ThreadContext.useThreadModelContext,
|
43
43
|
useThreadModelContext: () => import_ThreadContext.useThreadModelContext,
|
44
44
|
useThreadRuntime: () => import_ThreadContext.useThreadRuntime,
|
45
|
-
useThreadViewport: () =>
|
46
|
-
useThreadViewportStore: () =>
|
45
|
+
useThreadViewport: () => import_ThreadViewportContext.useThreadViewport,
|
46
|
+
useThreadViewportStore: () => import_ThreadViewportContext.useThreadViewportStore,
|
47
47
|
useToolUIs: () => import_AssistantContext.useToolUIs,
|
48
48
|
useToolUIsStore: () => import_AssistantContext.useToolUIsStore
|
49
49
|
});
|
50
50
|
module.exports = __toCommonJS(react_exports);
|
51
51
|
var import_AssistantContext = require("./AssistantContext.js");
|
52
52
|
var import_ThreadContext = require("./ThreadContext.js");
|
53
|
+
var import_ThreadViewportContext = require("./ThreadViewportContext.js");
|
53
54
|
var import_ThreadListItemContext = require("./ThreadListItemContext.js");
|
54
55
|
var import_MessageContext = require("./MessageContext.js");
|
55
56
|
var import_ContentPartContext = require("./ContentPartContext.js");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/context/react/index.ts"],"sourcesContent":["\"use client\";\n// TODO createContextStoreHook does not work well with server-side nextjs bundler\n// use client necessary here for now\n\nexport {\n useAssistantRuntime,\n useThreadList,\n useToolUIs,\n useToolUIsStore,\n} from \"./AssistantContext\";\n\nexport {\n useThreadRuntime,\n useThread,\n useThreadComposer,\n useThreadModelContext,\n /**\n * @deprecated This method was renamed to `useThreadModelContext`.\n */\n useThreadModelContext as useThreadModelConfig,\n useThreadViewport,\n useThreadViewportStore,\n} from \"./
|
1
|
+
{"version":3,"sources":["../../../src/context/react/index.ts"],"sourcesContent":["\"use client\";\n// TODO createContextStoreHook does not work well with server-side nextjs bundler\n// use client necessary here for now\n\nexport {\n useAssistantRuntime,\n useThreadList,\n useToolUIs,\n useToolUIsStore,\n} from \"./AssistantContext\";\n\nexport {\n useThreadRuntime,\n useThread,\n useThreadComposer,\n useThreadModelContext,\n /**\n * @deprecated This method was renamed to `useThreadModelContext`.\n */\n useThreadModelContext as useThreadModelConfig,\n} from \"./ThreadContext\";\n\nexport {\n useThreadViewport,\n useThreadViewportStore,\n} from \"./ThreadViewportContext\";\n\nexport {\n useThreadListItemRuntime,\n useThreadListItem,\n} from \"./ThreadListItemContext\";\n\nexport {\n useMessageRuntime,\n useMessage,\n useEditComposer,\n useMessageUtils,\n useMessageUtilsStore,\n} from \"./MessageContext\";\nexport { useContentPartRuntime, useContentPart } from \"./ContentPartContext\";\nexport { useComposerRuntime, useComposer } from \"./ComposerContext\";\n\nexport {\n useAttachment,\n useAttachmentRuntime,\n\n // TODO decide if we want to export/drop these?\n // useEditComposerAttachment,\n // useEditComposerAttachmentRuntime,\n // useMessageAttachment,\n // useMessageAttachmentRuntime,\n // useThreadComposerAttachment,\n // useThreadComposerAttachmentRuntime,\n} from \"./AttachmentContext\";\n\nexport { useRuntimeState } from \"./utils/useRuntimeState\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,8BAKO;AAEP,2BASO;AAEP,mCAGO;AAEP,mCAGO;AAEP,4BAMO;AACP,gCAAsD;AACtD,6BAAgD;AAEhD,+BAWO;AAEP,6BAAgC;","names":[]}
|
@@ -12,10 +12,12 @@ import {
|
|
12
12
|
useThread,
|
13
13
|
useThreadComposer,
|
14
14
|
useThreadModelContext,
|
15
|
-
useThreadModelContext as useThreadModelContext2
|
15
|
+
useThreadModelContext as useThreadModelContext2
|
16
|
+
} from "./ThreadContext.mjs";
|
17
|
+
import {
|
16
18
|
useThreadViewport,
|
17
19
|
useThreadViewportStore
|
18
|
-
} from "./
|
20
|
+
} from "./ThreadViewportContext.mjs";
|
19
21
|
import {
|
20
22
|
useThreadListItemRuntime,
|
21
23
|
useThreadListItem
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/context/react/index.ts"],"sourcesContent":["\"use client\";\n// TODO createContextStoreHook does not work well with server-side nextjs bundler\n// use client necessary here for now\n\nexport {\n useAssistantRuntime,\n useThreadList,\n useToolUIs,\n useToolUIsStore,\n} from \"./AssistantContext\";\n\nexport {\n useThreadRuntime,\n useThread,\n useThreadComposer,\n useThreadModelContext,\n /**\n * @deprecated This method was renamed to `useThreadModelContext`.\n */\n useThreadModelContext as useThreadModelConfig,\n useThreadViewport,\n useThreadViewportStore,\n} from \"./
|
1
|
+
{"version":3,"sources":["../../../src/context/react/index.ts"],"sourcesContent":["\"use client\";\n// TODO createContextStoreHook does not work well with server-side nextjs bundler\n// use client necessary here for now\n\nexport {\n useAssistantRuntime,\n useThreadList,\n useToolUIs,\n useToolUIsStore,\n} from \"./AssistantContext\";\n\nexport {\n useThreadRuntime,\n useThread,\n useThreadComposer,\n useThreadModelContext,\n /**\n * @deprecated This method was renamed to `useThreadModelContext`.\n */\n useThreadModelContext as useThreadModelConfig,\n} from \"./ThreadContext\";\n\nexport {\n useThreadViewport,\n useThreadViewportStore,\n} from \"./ThreadViewportContext\";\n\nexport {\n useThreadListItemRuntime,\n useThreadListItem,\n} from \"./ThreadListItemContext\";\n\nexport {\n useMessageRuntime,\n useMessage,\n useEditComposer,\n useMessageUtils,\n useMessageUtilsStore,\n} from \"./MessageContext\";\nexport { useContentPartRuntime, useContentPart } from \"./ContentPartContext\";\nexport { useComposerRuntime, useComposer } from \"./ComposerContext\";\n\nexport {\n useAttachment,\n useAttachmentRuntime,\n\n // TODO decide if we want to export/drop these?\n // useEditComposerAttachment,\n // useEditComposerAttachmentRuntime,\n // useMessageAttachment,\n // useMessageAttachmentRuntime,\n // useThreadComposerAttachment,\n // useThreadComposerAttachmentRuntime,\n} from \"./AttachmentContext\";\n\nexport { useRuntimeState } from \"./utils/useRuntimeState\";\n"],"mappings":";;;AAIA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAIyB,yBAAzBA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB,sBAAsB;AACtD,SAAS,oBAAoB,mBAAmB;AAEhD;AAAA,EACE;AAAA,EACA;AAAA,OASK;AAEP,SAAS,uBAAuB;","names":["useThreadModelContext"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadViewport.d.ts","sourceRoot":"","sources":["../../../src/context/stores/ThreadViewport.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"ThreadViewport.d.ts","sourceRoot":"","sources":["../../../src/context/stores/ThreadViewport.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,cAAc,EAAE,MAAM,IAAI,CAAC;IACpC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,WAAW,CAAC;CAClE,CAAC;AAEF,eAAO,MAAM,uBAAuB,wFAiBnC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/context/stores/ThreadViewport.tsx"],"sourcesContent":["
|
1
|
+
{"version":3,"sources":["../../../src/context/stores/ThreadViewport.tsx"],"sourcesContent":["\"use client\";\n\nimport { create } from \"zustand\";\nimport type { Unsubscribe } from \"../../types/Unsubscribe\";\n\nexport type ThreadViewportState = {\n readonly isAtBottom: boolean;\n readonly scrollToBottom: () => void;\n readonly onScrollToBottom: (callback: () => void) => Unsubscribe;\n};\n\nexport const makeThreadViewportStore = () => {\n const scrollToBottomListeners = new Set<() => void>();\n\n return create<ThreadViewportState>(() => ({\n isAtBottom: true,\n scrollToBottom: () => {\n for (const listener of scrollToBottomListeners) {\n listener();\n }\n },\n onScrollToBottom: (callback) => {\n scrollToBottomListeners.add(callback);\n return () => {\n scrollToBottomListeners.delete(callback);\n };\n },\n }));\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,qBAAuB;AAShB,IAAM,0BAA0B,MAAM;AAC3C,QAAM,0BAA0B,oBAAI,IAAgB;AAEpD,aAAO,uBAA4B,OAAO;AAAA,IACxC,YAAY;AAAA,IACZ,gBAAgB,MAAM;AACpB,iBAAW,YAAY,yBAAyB;AAC9C,iBAAS;AAAA,MACX;AAAA,IACF;AAAA,IACA,kBAAkB,CAAC,aAAa;AAC9B,8BAAwB,IAAI,QAAQ;AACpC,aAAO,MAAM;AACX,gCAAwB,OAAO,QAAQ;AAAA,MACzC;AAAA,IACF;AAAA,EACF,EAAE;AACJ;","names":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/context/stores/ThreadViewport.tsx"],"sourcesContent":["
|
1
|
+
{"version":3,"sources":["../../../src/context/stores/ThreadViewport.tsx"],"sourcesContent":["\"use client\";\n\nimport { create } from \"zustand\";\nimport type { Unsubscribe } from \"../../types/Unsubscribe\";\n\nexport type ThreadViewportState = {\n readonly isAtBottom: boolean;\n readonly scrollToBottom: () => void;\n readonly onScrollToBottom: (callback: () => void) => Unsubscribe;\n};\n\nexport const makeThreadViewportStore = () => {\n const scrollToBottomListeners = new Set<() => void>();\n\n return create<ThreadViewportState>(() => ({\n isAtBottom: true,\n scrollToBottom: () => {\n for (const listener of scrollToBottomListeners) {\n listener();\n }\n },\n onScrollToBottom: (callback) => {\n scrollToBottomListeners.add(callback);\n return () => {\n scrollToBottomListeners.delete(callback);\n };\n },\n }));\n};\n"],"mappings":";;;AAEA,SAAS,cAAc;AAShB,IAAM,0BAA0B,MAAM;AAC3C,QAAM,0BAA0B,oBAAI,IAAgB;AAEpD,SAAO,OAA4B,OAAO;AAAA,IACxC,YAAY;AAAA,IACZ,gBAAgB,MAAM;AACpB,iBAAW,YAAY,yBAAyB;AAC9C,iBAAS;AAAA,MACX;AAAA,IACF;AAAA,IACA,kBAAkB,CAAC,aAAa;AAC9B,8BAAwB,IAAI,QAAQ;AACpC,aAAO,MAAM;AACX,gCAAwB,OAAO,QAAQ;AAAA,MACzC;AAAA,IACF;AAAA,EACF,EAAE;AACJ;","names":[]}
|
@@ -42,12 +42,15 @@ export declare const LanguageModelConfigSchema: z.ZodObject<{
|
|
42
42
|
}>;
|
43
43
|
export type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;
|
44
44
|
type ToolExecuteFunction<TArgs, TResult> = (args: TArgs, context: {
|
45
|
+
toolCallId: string;
|
45
46
|
abortSignal: AbortSignal;
|
46
47
|
}) => TResult | Promise<TResult>;
|
48
|
+
type OnSchemaValidationErrorFunction<TResult> = ToolExecuteFunction<unknown, TResult>;
|
47
49
|
export type Tool<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = {
|
48
50
|
description?: string | undefined;
|
49
51
|
parameters: z.ZodSchema<TArgs> | JSONSchema7;
|
50
52
|
execute?: ToolExecuteFunction<TArgs, TResult>;
|
53
|
+
experimental_onSchemaValidationError?: OnSchemaValidationErrorFunction<TResult>;
|
51
54
|
};
|
52
55
|
export type ModelContext = {
|
53
56
|
priority?: number | undefined;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ModelContextTypes.d.ts","sourceRoot":"","sources":["../../src/model-context/ModelContextTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;EAQ5C,CAAC;AAEH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,iCAAiC,CACzC,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;EAIpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,KAAK,mBAAmB,CAAC,KAAK,EAAE,OAAO,IAAI,CACzC,IAAI,EAAE,KAAK,EACX,OAAO,EAAE;IACP,WAAW,EAAE,WAAW,CAAC;CAC1B,KACE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEhC,MAAM,MAAM,IAAI,CACd,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EACxE,OAAO,GAAG,OAAO,IACf;IACF,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,EAAE,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC;IAC7C,OAAO,CAAC,EAAE,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"ModelContextTypes.d.ts","sourceRoot":"","sources":["../../src/model-context/ModelContextTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;EAQ5C,CAAC;AAEH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,iCAAiC,CACzC,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;EAIpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,KAAK,mBAAmB,CAAC,KAAK,EAAE,OAAO,IAAI,CACzC,IAAI,EAAE,KAAK,EACX,OAAO,EAAE;IACP,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,WAAW,CAAC;CAC1B,KACE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEhC,KAAK,+BAA+B,CAAC,OAAO,IAAI,mBAAmB,CACjE,OAAO,EACP,OAAO,CACR,CAAC;AAEF,MAAM,MAAM,IAAI,CACd,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EACxE,OAAO,GAAG,OAAO,IACf;IACF,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,EAAE,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC;IAC7C,OAAO,CAAC,EAAE,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC9C,oCAAoC,CAAC,EAAE,+BAA+B,CAAC,OAAO,CAAC,CAAC;CACjF,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;IACnD,YAAY,CAAC,EAAE,2BAA2B,GAAG,SAAS,CAAC;IACvD,MAAM,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,eAAe,EAAE,MAAM,YAAY,CAAC;IACpC,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,WAAW,CAAC;CACnD,CAAC;AAEF,eAAO,MAAM,kBAAkB,cAClB,GAAG,CAAC,oBAAoB,CAAC,KACnC,YAuCF,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/model-context/ModelContextTypes.ts"],"sourcesContent":["import { z } from \"zod\";\nimport type { JSONSchema7 } from \"json-schema\";\nimport { Unsubscribe } from \"../types/Unsubscribe\";\n\nexport const LanguageModelV1CallSettingsSchema = z.object({\n maxTokens: z.number().int().positive().optional(),\n temperature: z.number().optional(),\n topP: z.number().optional(),\n presencePenalty: z.number().optional(),\n frequencyPenalty: z.number().optional(),\n seed: z.number().int().optional(),\n headers: z.record(z.string().optional()).optional(),\n});\n\nexport type LanguageModelV1CallSettings = z.infer<\n typeof LanguageModelV1CallSettingsSchema\n>;\n\nexport const LanguageModelConfigSchema = z.object({\n apiKey: z.string().optional(),\n baseUrl: z.string().optional(),\n modelName: z.string().optional(),\n});\n\nexport type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;\n\ntype ToolExecuteFunction<TArgs, TResult> = (\n args: TArgs,\n context: {\n abortSignal: AbortSignal;\n },\n) => TResult | Promise<TResult>;\n\nexport type Tool<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = {\n description?: string | undefined;\n parameters: z.ZodSchema<TArgs> | JSONSchema7;\n execute?: ToolExecuteFunction<TArgs, TResult>;\n};\n\nexport type ModelContext = {\n priority?: number | undefined;\n system?: string | undefined;\n tools?: Record<string, Tool<any, any>> | undefined;\n callSettings?: LanguageModelV1CallSettings | undefined;\n config?: LanguageModelConfig | undefined;\n};\n\nexport type ModelContextProvider = {\n getModelContext: () => ModelContext;\n subscribe?: (callback: () => void) => Unsubscribe;\n};\n\nexport const mergeModelContexts = (\n configSet: Set<ModelContextProvider>,\n): ModelContext => {\n const configs = Array.from(configSet)\n .map((c) => c.getModelContext())\n .sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n\n return configs.reduce((acc, config) => {\n if (config.system) {\n if (acc.system) {\n // TODO should the separator be configurable?\n acc.system += `\\n\\n${config.system}`;\n } else {\n acc.system = config.system;\n }\n }\n if (config.tools) {\n for (const [name, tool] of Object.entries(config.tools)) {\n if (acc.tools?.[name]) {\n throw new Error(\n `You tried to define a tool with the name ${name}, but it already exists.`,\n );\n }\n if (!acc.tools) acc.tools = {};\n acc.tools[name] = tool;\n }\n }\n if (config.config) {\n acc.config = {\n ...acc.config,\n ...config.config,\n };\n }\n if (config.callSettings) {\n acc.callSettings = {\n ...acc.callSettings,\n ...config.callSettings,\n };\n }\n return acc;\n }, {} as ModelContext);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkB;AAIX,IAAM,oCAAoC,aAAE,OAAO;AAAA,EACxD,WAAW,aAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EAChD,aAAa,aAAE,OAAO,EAAE,SAAS;AAAA,EACjC,MAAM,aAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,iBAAiB,aAAE,OAAO,EAAE,SAAS;AAAA,EACrC,kBAAkB,aAAE,OAAO,EAAE,SAAS;AAAA,EACtC,MAAM,aAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EAChC,SAAS,aAAE,OAAO,aAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS;AACpD,CAAC;AAMM,IAAM,4BAA4B,aAAE,OAAO;AAAA,EAChD,QAAQ,aAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,SAAS,aAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,WAAW,aAAE,OAAO,EAAE,SAAS;AACjC,CAAC;
|
1
|
+
{"version":3,"sources":["../../src/model-context/ModelContextTypes.ts"],"sourcesContent":["import { z } from \"zod\";\nimport type { JSONSchema7 } from \"json-schema\";\nimport { Unsubscribe } from \"../types/Unsubscribe\";\n\nexport const LanguageModelV1CallSettingsSchema = z.object({\n maxTokens: z.number().int().positive().optional(),\n temperature: z.number().optional(),\n topP: z.number().optional(),\n presencePenalty: z.number().optional(),\n frequencyPenalty: z.number().optional(),\n seed: z.number().int().optional(),\n headers: z.record(z.string().optional()).optional(),\n});\n\nexport type LanguageModelV1CallSettings = z.infer<\n typeof LanguageModelV1CallSettingsSchema\n>;\n\nexport const LanguageModelConfigSchema = z.object({\n apiKey: z.string().optional(),\n baseUrl: z.string().optional(),\n modelName: z.string().optional(),\n});\n\nexport type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;\n\ntype ToolExecuteFunction<TArgs, TResult> = (\n args: TArgs,\n context: {\n toolCallId: string;\n abortSignal: AbortSignal;\n },\n) => TResult | Promise<TResult>;\n\ntype OnSchemaValidationErrorFunction<TResult> = ToolExecuteFunction<\n unknown,\n TResult\n>;\n\nexport type Tool<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = {\n description?: string | undefined;\n parameters: z.ZodSchema<TArgs> | JSONSchema7;\n execute?: ToolExecuteFunction<TArgs, TResult>;\n experimental_onSchemaValidationError?: OnSchemaValidationErrorFunction<TResult>;\n};\n\nexport type ModelContext = {\n priority?: number | undefined;\n system?: string | undefined;\n tools?: Record<string, Tool<any, any>> | undefined;\n callSettings?: LanguageModelV1CallSettings | undefined;\n config?: LanguageModelConfig | undefined;\n};\n\nexport type ModelContextProvider = {\n getModelContext: () => ModelContext;\n subscribe?: (callback: () => void) => Unsubscribe;\n};\n\nexport const mergeModelContexts = (\n configSet: Set<ModelContextProvider>,\n): ModelContext => {\n const configs = Array.from(configSet)\n .map((c) => c.getModelContext())\n .sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n\n return configs.reduce((acc, config) => {\n if (config.system) {\n if (acc.system) {\n // TODO should the separator be configurable?\n acc.system += `\\n\\n${config.system}`;\n } else {\n acc.system = config.system;\n }\n }\n if (config.tools) {\n for (const [name, tool] of Object.entries(config.tools)) {\n if (acc.tools?.[name]) {\n throw new Error(\n `You tried to define a tool with the name ${name}, but it already exists.`,\n );\n }\n if (!acc.tools) acc.tools = {};\n acc.tools[name] = tool;\n }\n }\n if (config.config) {\n acc.config = {\n ...acc.config,\n ...config.config,\n };\n }\n if (config.callSettings) {\n acc.callSettings = {\n ...acc.callSettings,\n ...config.callSettings,\n };\n }\n return acc;\n }, {} as ModelContext);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkB;AAIX,IAAM,oCAAoC,aAAE,OAAO;AAAA,EACxD,WAAW,aAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EAChD,aAAa,aAAE,OAAO,EAAE,SAAS;AAAA,EACjC,MAAM,aAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,iBAAiB,aAAE,OAAO,EAAE,SAAS;AAAA,EACrC,kBAAkB,aAAE,OAAO,EAAE,SAAS;AAAA,EACtC,MAAM,aAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EAChC,SAAS,aAAE,OAAO,aAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS;AACpD,CAAC;AAMM,IAAM,4BAA4B,aAAE,OAAO;AAAA,EAChD,QAAQ,aAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,SAAS,aAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,WAAW,aAAE,OAAO,EAAE,SAAS;AACjC,CAAC;AAwCM,IAAM,qBAAqB,CAChC,cACiB;AACjB,QAAM,UAAU,MAAM,KAAK,SAAS,EACjC,IAAI,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAC9B,KAAK,CAAC,GAAG,OAAO,EAAE,YAAY,MAAM,EAAE,YAAY,EAAE;AAEvD,SAAO,QAAQ,OAAO,CAAC,KAAK,WAAW;AACrC,QAAI,OAAO,QAAQ;AACjB,UAAI,IAAI,QAAQ;AAEd,YAAI,UAAU;AAAA;AAAA,EAAO,OAAO,MAAM;AAAA,MACpC,OAAO;AACL,YAAI,SAAS,OAAO;AAAA,MACtB;AAAA,IACF;AACA,QAAI,OAAO,OAAO;AAChB,iBAAW,CAAC,MAAM,IAAI,KAAK,OAAO,QAAQ,OAAO,KAAK,GAAG;AACvD,YAAI,IAAI,QAAQ,IAAI,GAAG;AACrB,gBAAM,IAAI;AAAA,YACR,4CAA4C,IAAI;AAAA,UAClD;AAAA,QACF;AACA,YAAI,CAAC,IAAI,MAAO,KAAI,QAAQ,CAAC;AAC7B,YAAI,MAAM,IAAI,IAAI;AAAA,MACpB;AAAA,IACF;AACA,QAAI,OAAO,QAAQ;AACjB,UAAI,SAAS;AAAA,QACX,GAAG,IAAI;AAAA,QACP,GAAG,OAAO;AAAA,MACZ;AAAA,IACF;AACA,QAAI,OAAO,cAAc;AACvB,UAAI,eAAe;AAAA,QACjB,GAAG,IAAI;AAAA,QACP,GAAG,OAAO;AAAA,MACZ;AAAA,IACF;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAiB;AACvB;","names":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/model-context/ModelContextTypes.ts"],"sourcesContent":["import { z } from \"zod\";\nimport type { JSONSchema7 } from \"json-schema\";\nimport { Unsubscribe } from \"../types/Unsubscribe\";\n\nexport const LanguageModelV1CallSettingsSchema = z.object({\n maxTokens: z.number().int().positive().optional(),\n temperature: z.number().optional(),\n topP: z.number().optional(),\n presencePenalty: z.number().optional(),\n frequencyPenalty: z.number().optional(),\n seed: z.number().int().optional(),\n headers: z.record(z.string().optional()).optional(),\n});\n\nexport type LanguageModelV1CallSettings = z.infer<\n typeof LanguageModelV1CallSettingsSchema\n>;\n\nexport const LanguageModelConfigSchema = z.object({\n apiKey: z.string().optional(),\n baseUrl: z.string().optional(),\n modelName: z.string().optional(),\n});\n\nexport type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;\n\ntype ToolExecuteFunction<TArgs, TResult> = (\n args: TArgs,\n context: {\n abortSignal: AbortSignal;\n },\n) => TResult | Promise<TResult>;\n\nexport type Tool<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = {\n description?: string | undefined;\n parameters: z.ZodSchema<TArgs> | JSONSchema7;\n execute?: ToolExecuteFunction<TArgs, TResult>;\n};\n\nexport type ModelContext = {\n priority?: number | undefined;\n system?: string | undefined;\n tools?: Record<string, Tool<any, any>> | undefined;\n callSettings?: LanguageModelV1CallSettings | undefined;\n config?: LanguageModelConfig | undefined;\n};\n\nexport type ModelContextProvider = {\n getModelContext: () => ModelContext;\n subscribe?: (callback: () => void) => Unsubscribe;\n};\n\nexport const mergeModelContexts = (\n configSet: Set<ModelContextProvider>,\n): ModelContext => {\n const configs = Array.from(configSet)\n .map((c) => c.getModelContext())\n .sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n\n return configs.reduce((acc, config) => {\n if (config.system) {\n if (acc.system) {\n // TODO should the separator be configurable?\n acc.system += `\\n\\n${config.system}`;\n } else {\n acc.system = config.system;\n }\n }\n if (config.tools) {\n for (const [name, tool] of Object.entries(config.tools)) {\n if (acc.tools?.[name]) {\n throw new Error(\n `You tried to define a tool with the name ${name}, but it already exists.`,\n );\n }\n if (!acc.tools) acc.tools = {};\n acc.tools[name] = tool;\n }\n }\n if (config.config) {\n acc.config = {\n ...acc.config,\n ...config.config,\n };\n }\n if (config.callSettings) {\n acc.callSettings = {\n ...acc.callSettings,\n ...config.callSettings,\n };\n }\n return acc;\n }, {} as ModelContext);\n};\n"],"mappings":";AAAA,SAAS,SAAS;AAIX,IAAM,oCAAoC,EAAE,OAAO;AAAA,EACxD,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EAChD,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,iBAAiB,EAAE,OAAO,EAAE,SAAS;AAAA,EACrC,kBAAkB,EAAE,OAAO,EAAE,SAAS;AAAA,EACtC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EAChC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS;AACpD,CAAC;AAMM,IAAM,4BAA4B,EAAE,OAAO;AAAA,EAChD,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,WAAW,EAAE,OAAO,EAAE,SAAS;AACjC,CAAC;
|
1
|
+
{"version":3,"sources":["../../src/model-context/ModelContextTypes.ts"],"sourcesContent":["import { z } from \"zod\";\nimport type { JSONSchema7 } from \"json-schema\";\nimport { Unsubscribe } from \"../types/Unsubscribe\";\n\nexport const LanguageModelV1CallSettingsSchema = z.object({\n maxTokens: z.number().int().positive().optional(),\n temperature: z.number().optional(),\n topP: z.number().optional(),\n presencePenalty: z.number().optional(),\n frequencyPenalty: z.number().optional(),\n seed: z.number().int().optional(),\n headers: z.record(z.string().optional()).optional(),\n});\n\nexport type LanguageModelV1CallSettings = z.infer<\n typeof LanguageModelV1CallSettingsSchema\n>;\n\nexport const LanguageModelConfigSchema = z.object({\n apiKey: z.string().optional(),\n baseUrl: z.string().optional(),\n modelName: z.string().optional(),\n});\n\nexport type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;\n\ntype ToolExecuteFunction<TArgs, TResult> = (\n args: TArgs,\n context: {\n toolCallId: string;\n abortSignal: AbortSignal;\n },\n) => TResult | Promise<TResult>;\n\ntype OnSchemaValidationErrorFunction<TResult> = ToolExecuteFunction<\n unknown,\n TResult\n>;\n\nexport type Tool<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = {\n description?: string | undefined;\n parameters: z.ZodSchema<TArgs> | JSONSchema7;\n execute?: ToolExecuteFunction<TArgs, TResult>;\n experimental_onSchemaValidationError?: OnSchemaValidationErrorFunction<TResult>;\n};\n\nexport type ModelContext = {\n priority?: number | undefined;\n system?: string | undefined;\n tools?: Record<string, Tool<any, any>> | undefined;\n callSettings?: LanguageModelV1CallSettings | undefined;\n config?: LanguageModelConfig | undefined;\n};\n\nexport type ModelContextProvider = {\n getModelContext: () => ModelContext;\n subscribe?: (callback: () => void) => Unsubscribe;\n};\n\nexport const mergeModelContexts = (\n configSet: Set<ModelContextProvider>,\n): ModelContext => {\n const configs = Array.from(configSet)\n .map((c) => c.getModelContext())\n .sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n\n return configs.reduce((acc, config) => {\n if (config.system) {\n if (acc.system) {\n // TODO should the separator be configurable?\n acc.system += `\\n\\n${config.system}`;\n } else {\n acc.system = config.system;\n }\n }\n if (config.tools) {\n for (const [name, tool] of Object.entries(config.tools)) {\n if (acc.tools?.[name]) {\n throw new Error(\n `You tried to define a tool with the name ${name}, but it already exists.`,\n );\n }\n if (!acc.tools) acc.tools = {};\n acc.tools[name] = tool;\n }\n }\n if (config.config) {\n acc.config = {\n ...acc.config,\n ...config.config,\n };\n }\n if (config.callSettings) {\n acc.callSettings = {\n ...acc.callSettings,\n ...config.callSettings,\n };\n }\n return acc;\n }, {} as ModelContext);\n};\n"],"mappings":";AAAA,SAAS,SAAS;AAIX,IAAM,oCAAoC,EAAE,OAAO;AAAA,EACxD,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EAChD,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,iBAAiB,EAAE,OAAO,EAAE,SAAS;AAAA,EACrC,kBAAkB,EAAE,OAAO,EAAE,SAAS;AAAA,EACtC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EAChC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS;AACpD,CAAC;AAMM,IAAM,4BAA4B,EAAE,OAAO;AAAA,EAChD,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,WAAW,EAAE,OAAO,EAAE,SAAS;AACjC,CAAC;AAwCM,IAAM,qBAAqB,CAChC,cACiB;AACjB,QAAM,UAAU,MAAM,KAAK,SAAS,EACjC,IAAI,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAC9B,KAAK,CAAC,GAAG,OAAO,EAAE,YAAY,MAAM,EAAE,YAAY,EAAE;AAEvD,SAAO,QAAQ,OAAO,CAAC,KAAK,WAAW;AACrC,QAAI,OAAO,QAAQ;AACjB,UAAI,IAAI,QAAQ;AAEd,YAAI,UAAU;AAAA;AAAA,EAAO,OAAO,MAAM;AAAA,MACpC,OAAO;AACL,YAAI,SAAS,OAAO;AAAA,MACtB;AAAA,IACF;AACA,QAAI,OAAO,OAAO;AAChB,iBAAW,CAAC,MAAM,IAAI,KAAK,OAAO,QAAQ,OAAO,KAAK,GAAG;AACvD,YAAI,IAAI,QAAQ,IAAI,GAAG;AACrB,gBAAM,IAAI;AAAA,YACR,4CAA4C,IAAI;AAAA,UAClD;AAAA,QACF;AACA,YAAI,CAAC,IAAI,MAAO,KAAI,QAAQ,CAAC;AAC7B,YAAI,MAAM,IAAI,IAAI;AAAA,MACpB;AAAA,IACF;AACA,QAAI,OAAO,QAAQ;AACjB,UAAI,SAAS;AAAA,QACX,GAAG,IAAI;AAAA,QACP,GAAG,OAAO;AAAA,MACZ;AAAA,IACF;AACA,QAAI,OAAO,cAAc;AACvB,UAAI,eAAe;AAAA,QACjB,GAAG,IAAI;AAAA,QACP,GAAG,OAAO;AAAA,MACZ;AAAA,IACF;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAiB;AACvB;","names":[]}
|
@@ -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"}
|
package/dist/primitives/index.js
CHANGED
@@ -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 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadScrollToBottom.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;
|
1
|
+
{"version":3,"file":"ThreadScrollToBottom.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAIxC,QAAA,MAAM,uBAAuB,2BAW5B,CAAC;AAEF,yBAAiB,6BAA6B,CAAC;IAC7C,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,uBAAuB,CAAC,CAAC;CACvE;AAED,eAAO,MAAM,6BAA6B;;6DAGzC,CAAC"}
|
@@ -26,11 +26,10 @@ __export(ThreadScrollToBottom_exports, {
|
|
26
26
|
module.exports = __toCommonJS(ThreadScrollToBottom_exports);
|
27
27
|
var import_createActionButton = require("../../utils/createActionButton.js");
|
28
28
|
var import_react = require("react");
|
29
|
-
var
|
30
|
-
var import_ThreadContext = require("../../context/react/ThreadContext.js");
|
29
|
+
var import_ThreadViewportContext = require("../../context/react/ThreadViewportContext.js");
|
31
30
|
var useThreadScrollToBottom = () => {
|
32
|
-
const isAtBottom = (0,
|
33
|
-
const threadViewportStore = (0,
|
31
|
+
const isAtBottom = (0, import_ThreadViewportContext.useThreadViewport)((s) => s.isAtBottom);
|
32
|
+
const threadViewportStore = (0, import_ThreadViewportContext.useThreadViewportStore)();
|
34
33
|
const handleScrollToBottom = (0, import_react.useCallback)(() => {
|
35
34
|
threadViewportStore.getState().scrollToBottom();
|
36
35
|
}, [threadViewportStore]);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useThreadViewport
|
1
|
+
{"version":3,"sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useThreadViewport, useThreadViewportStore } from \"../../context/react/ThreadViewportContext\";\n\nconst useThreadScrollToBottom = () => {\n const isAtBottom = useThreadViewport((s) => s.isAtBottom);\n\n const threadViewportStore = useThreadViewportStore();\n\n const handleScrollToBottom = useCallback(() => {\n threadViewportStore.getState().scrollToBottom();\n }, [threadViewportStore]);\n\n if (isAtBottom) return null;\n return handleScrollToBottom;\n};\n\nexport namespace ThreadPrimitiveScrollToBottom {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadScrollToBottom>;\n}\n\nexport const ThreadPrimitiveScrollToBottom = createActionButton(\n \"ThreadPrimitive.ScrollToBottom\",\n useThreadScrollToBottom,\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,gCAIO;AACP,mBAA4B;AAC5B,mCAA0D;AAE1D,IAAM,0BAA0B,MAAM;AACpC,QAAM,iBAAa,gDAAkB,CAAC,MAAM,EAAE,UAAU;AAExD,QAAM,0BAAsB,qDAAuB;AAEnD,QAAM,2BAAuB,0BAAY,MAAM;AAC7C,wBAAoB,SAAS,EAAE,eAAe;AAAA,EAChD,GAAG,CAAC,mBAAmB,CAAC;AAExB,MAAI,WAAY,QAAO;AACvB,SAAO;AACT;AAOO,IAAM,oCAAgC;AAAA,EAC3C;AAAA,EACA;AACF;","names":[]}
|
@@ -5,8 +5,7 @@ import {
|
|
5
5
|
createActionButton
|
6
6
|
} from "../../utils/createActionButton.mjs";
|
7
7
|
import { useCallback } from "react";
|
8
|
-
import { useThreadViewport } from "../../context/
|
9
|
-
import { useThreadViewportStore } from "../../context/react/ThreadContext.mjs";
|
8
|
+
import { useThreadViewport, useThreadViewportStore } from "../../context/react/ThreadViewportContext.mjs";
|
10
9
|
var useThreadScrollToBottom = () => {
|
11
10
|
const isAtBottom = useThreadViewport((s) => s.isAtBottom);
|
12
11
|
const threadViewportStore = useThreadViewportStore();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useThreadViewport
|
1
|
+
{"version":3,"sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useThreadViewport, useThreadViewportStore } from \"../../context/react/ThreadViewportContext\";\n\nconst useThreadScrollToBottom = () => {\n const isAtBottom = useThreadViewport((s) => s.isAtBottom);\n\n const threadViewportStore = useThreadViewportStore();\n\n const handleScrollToBottom = useCallback(() => {\n threadViewportStore.getState().scrollToBottom();\n }, [threadViewportStore]);\n\n if (isAtBottom) return null;\n return handleScrollToBottom;\n};\n\nexport namespace ThreadPrimitiveScrollToBottom {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadScrollToBottom>;\n}\n\nexport const ThreadPrimitiveScrollToBottom = createActionButton(\n \"ThreadPrimitive.ScrollToBottom\",\n useThreadScrollToBottom,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB,8BAA8B;AAE1D,IAAM,0BAA0B,MAAM;AACpC,QAAM,aAAa,kBAAkB,CAAC,MAAM,EAAE,UAAU;AAExD,QAAM,sBAAsB,uBAAuB;AAEnD,QAAM,uBAAuB,YAAY,MAAM;AAC7C,wBAAoB,SAAS,EAAE,eAAe;AAAA,EAChD,GAAG,CAAC,mBAAmB,CAAC;AAExB,MAAI,WAAY,QAAO;AACvB,SAAO;AACT;AAOO,IAAM,gCAAgC;AAAA,EAC3C;AAAA,EACA;AACF;","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
|
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
|
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;
|
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
|
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":[]}
|
@@ -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
|
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":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadViewport.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,YAAY,EAAc,wBAAwB,EAAE,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"ThreadViewport.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,YAAY,EAAc,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAIhF,yBAAiB,uBAAuB,CAAC;IACvC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG;QACnE,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KAClC,CAAC;CACH;AAmBD,eAAO,MAAM,uBAAuB;;;iBArBnB,OAAO,GAAG,SAAS;kDA8BlC,CAAC"}
|
@@ -28,14 +28,18 @@ var import_react_compose_refs = require("@radix-ui/react-compose-refs");
|
|
28
28
|
var import_react_primitive = require("@radix-ui/react-primitive");
|
29
29
|
var import_react = require("react");
|
30
30
|
var import_useThreadViewportAutoScroll = require("./useThreadViewportAutoScroll.js");
|
31
|
+
var import_ThreadViewportProvider = require("../../context/providers/ThreadViewportProvider.js");
|
31
32
|
var import_jsx_runtime = require("react/jsx-runtime");
|
32
|
-
var
|
33
|
+
var ThreadPrimitiveViewportScrollable = (0, import_react.forwardRef)(({ autoScroll, children, ...rest }, forwardedRef) => {
|
33
34
|
const autoScrollRef = (0, import_useThreadViewportAutoScroll.useThreadViewportAutoScroll)({
|
34
35
|
autoScroll
|
35
36
|
});
|
36
37
|
const ref = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, autoScrollRef);
|
37
38
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { ...rest, ref, children });
|
38
39
|
});
|
40
|
+
var ThreadPrimitiveViewport = (0, import_react.forwardRef)((props, ref) => {
|
41
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThreadViewportProvider.ThreadViewportProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThreadPrimitiveViewportScrollable, { ...props, ref }) });
|
42
|
+
});
|
39
43
|
ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
|
40
44
|
// Annotate the CommonJS export names for ESM import in node:
|
41
45
|
0 && (module.exports = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"sourcesContent":["\"use client\";\n\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { type ComponentRef, forwardRef, ComponentPropsWithoutRef } from \"react\";\nimport { useThreadViewportAutoScroll } from \"./useThreadViewportAutoScroll\";\n\nexport namespace ThreadPrimitiveViewport {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div> & {\n autoScroll?: boolean | undefined;\n };\n}\n\
|
1
|
+
{"version":3,"sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"sourcesContent":["\"use client\";\n\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { type ComponentRef, forwardRef, ComponentPropsWithoutRef } from \"react\";\nimport { useThreadViewportAutoScroll } from \"./useThreadViewportAutoScroll\";\nimport { ThreadViewportProvider } from \"../../context/providers/ThreadViewportProvider\";\n\nexport namespace ThreadPrimitiveViewport {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div> & {\n autoScroll?: boolean | undefined;\n };\n}\n\nconst ThreadPrimitiveViewportScrollable = forwardRef<\n ThreadPrimitiveViewport.Element,\n ThreadPrimitiveViewport.Props\n>(({ autoScroll, children, ...rest }, forwardedRef) => {\n const autoScrollRef = useThreadViewportAutoScroll<HTMLDivElement>({\n autoScroll,\n });\n\n const ref = useComposedRefs(forwardedRef, autoScrollRef);\n\n return (\n <Primitive.div {...rest} ref={ref}>\n {children}\n </Primitive.div>\n );\n});\n\nexport const ThreadPrimitiveViewport = forwardRef<\n ThreadPrimitiveViewport.Element,\n ThreadPrimitiveViewport.Props\n>((props, ref) => {\n return (\n <ThreadViewportProvider>\n <ThreadPrimitiveViewportScrollable {...props} ref={ref} />\n </ThreadViewportProvider>\n );\n});\n\nThreadPrimitiveViewport.displayName = \"ThreadPrimitive.Viewport\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,gCAAgC;AAChC,6BAA0B;AAC1B,mBAAwE;AACxE,yCAA4C;AAC5C,oCAAuC;AAoBnC;AAXJ,IAAM,wCAAoC,yBAGxC,CAAC,EAAE,YAAY,UAAU,GAAG,KAAK,GAAG,iBAAiB;AACrD,QAAM,oBAAgB,gEAA4C;AAAA,IAChE;AAAA,EACF,CAAC;AAED,QAAM,UAAM,2CAAgB,cAAc,aAAa;AAEvD,SACE,4CAAC,iCAAU,KAAV,EAAe,GAAG,MAAM,KACtB,UACH;AAEJ,CAAC;AAEM,IAAM,8BAA0B,yBAGrC,CAAC,OAAO,QAAQ;AAChB,SACE,4CAAC,wDACC,sDAAC,qCAAmC,GAAG,OAAO,KAAU,GAC1D;AAEJ,CAAC;AAED,wBAAwB,cAAc;","names":[]}
|
@@ -5,14 +5,18 @@ import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
5
5
|
import { Primitive } from "@radix-ui/react-primitive";
|
6
6
|
import { forwardRef } from "react";
|
7
7
|
import { useThreadViewportAutoScroll } from "./useThreadViewportAutoScroll.mjs";
|
8
|
+
import { ThreadViewportProvider } from "../../context/providers/ThreadViewportProvider.mjs";
|
8
9
|
import { jsx } from "react/jsx-runtime";
|
9
|
-
var
|
10
|
+
var ThreadPrimitiveViewportScrollable = forwardRef(({ autoScroll, children, ...rest }, forwardedRef) => {
|
10
11
|
const autoScrollRef = useThreadViewportAutoScroll({
|
11
12
|
autoScroll
|
12
13
|
});
|
13
14
|
const ref = useComposedRefs(forwardedRef, autoScrollRef);
|
14
15
|
return /* @__PURE__ */ jsx(Primitive.div, { ...rest, ref, children });
|
15
16
|
});
|
17
|
+
var ThreadPrimitiveViewport = forwardRef((props, ref) => {
|
18
|
+
return /* @__PURE__ */ jsx(ThreadViewportProvider, { children: /* @__PURE__ */ jsx(ThreadPrimitiveViewportScrollable, { ...props, ref }) });
|
19
|
+
});
|
16
20
|
ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
|
17
21
|
export {
|
18
22
|
ThreadPrimitiveViewport
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"sourcesContent":["\"use client\";\n\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { type ComponentRef, forwardRef, ComponentPropsWithoutRef } from \"react\";\nimport { useThreadViewportAutoScroll } from \"./useThreadViewportAutoScroll\";\n\nexport namespace ThreadPrimitiveViewport {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div> & {\n autoScroll?: boolean | undefined;\n };\n}\n\
|
1
|
+
{"version":3,"sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"sourcesContent":["\"use client\";\n\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { type ComponentRef, forwardRef, ComponentPropsWithoutRef } from \"react\";\nimport { useThreadViewportAutoScroll } from \"./useThreadViewportAutoScroll\";\nimport { ThreadViewportProvider } from \"../../context/providers/ThreadViewportProvider\";\n\nexport namespace ThreadPrimitiveViewport {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div> & {\n autoScroll?: boolean | undefined;\n };\n}\n\nconst ThreadPrimitiveViewportScrollable = forwardRef<\n ThreadPrimitiveViewport.Element,\n ThreadPrimitiveViewport.Props\n>(({ autoScroll, children, ...rest }, forwardedRef) => {\n const autoScrollRef = useThreadViewportAutoScroll<HTMLDivElement>({\n autoScroll,\n });\n\n const ref = useComposedRefs(forwardedRef, autoScrollRef);\n\n return (\n <Primitive.div {...rest} ref={ref}>\n {children}\n </Primitive.div>\n );\n});\n\nexport const ThreadPrimitiveViewport = forwardRef<\n ThreadPrimitiveViewport.Element,\n ThreadPrimitiveViewport.Props\n>((props, ref) => {\n return (\n <ThreadViewportProvider>\n <ThreadPrimitiveViewportScrollable {...props} ref={ref} />\n </ThreadViewportProvider>\n );\n});\n\nThreadPrimitiveViewport.displayName = \"ThreadPrimitive.Viewport\";\n"],"mappings":";;;AAEA,SAAS,uBAAuB;AAChC,SAAS,iBAAiB;AAC1B,SAA4B,kBAA4C;AACxE,SAAS,mCAAmC;AAC5C,SAAS,8BAA8B;AAoBnC;AAXJ,IAAM,oCAAoC,WAGxC,CAAC,EAAE,YAAY,UAAU,GAAG,KAAK,GAAG,iBAAiB;AACrD,QAAM,gBAAgB,4BAA4C;AAAA,IAChE;AAAA,EACF,CAAC;AAED,QAAM,MAAM,gBAAgB,cAAc,aAAa;AAEvD,SACE,oBAAC,UAAU,KAAV,EAAe,GAAG,MAAM,KACtB,UACH;AAEJ,CAAC;AAEM,IAAM,0BAA0B,WAGrC,CAAC,OAAO,QAAQ;AAChB,SACE,oBAAC,0BACC,8BAAC,qCAAmC,GAAG,OAAO,KAAU,GAC1D;AAEJ,CAAC;AAED,wBAAwB,cAAc;","names":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useThreadViewportAutoScroll.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/useThreadViewportAutoScroll.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAqB,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"useThreadViewportAutoScroll.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/useThreadViewportAutoScroll.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAqB,MAAM,OAAO,CAAC;AAQvD,yBAAiB,2BAA2B,CAAC;IAC3C,KAAY,OAAO,GAAG;QACpB,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KAClC,CAAC;CACH;AAED,eAAO,MAAM,2BAA2B,GAAI,QAAQ,SAAS,WAAW,mBAErE,2BAA2B,CAAC,OAAO,KAAG,WAAW,CAAC,QAAQ,CA0E5D,CAAC"}
|