@anvia/react-ui 1.0.10 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +49 -1
- package/dist/attachment/index.js +2 -2
- package/dist/chat/index.js +4 -4
- package/dist/{chunk-MISX4WUT.js → chunk-22EZJUPM.js} +2 -2
- package/dist/{chunk-XC7K4XYM.js → chunk-DLBNFBXQ.js} +2 -2
- package/dist/{chunk-SOG2GVE4.js → chunk-E73S3SOF.js} +102 -55
- package/dist/chunk-E73S3SOF.js.map +1 -0
- package/dist/{chunk-S4XLE2RN.js → chunk-HGOPGZNQ.js} +2 -2
- package/dist/{chunk-UCBAG42A.js → chunk-KHB5CHAU.js} +2 -2
- package/dist/{chunk-647LAYRV.js → chunk-LHABOAOP.js} +2 -2
- package/dist/{chunk-OQE6SHZE.js → chunk-N5XQU36W.js} +2 -2
- package/dist/{chunk-HWJIMLHC.js → chunk-UAPCHIJI.js} +4 -4
- package/dist/{chunk-CRXNFZRW.js → chunk-Y4JLSCT7.js} +3 -3
- package/dist/completion/index.js +2 -2
- package/dist/graph-explorer/index.d.ts +77 -0
- package/dist/graph-explorer/index.js +261 -0
- package/dist/graph-explorer/index.js.map +1 -0
- package/dist/human-input/index.js +2 -2
- package/dist/image/index.js +2 -2
- package/dist/index.js +15 -15
- package/dist/message/index.js +3 -3
- package/dist/selection-toolbar/index.js +2 -2
- package/dist/shared.js +1 -1
- package/dist/thread-list/index.js +2 -2
- package/package.json +18 -8
- package/dist/chunk-SOG2GVE4.js.map +0 -1
- /package/dist/{chunk-MISX4WUT.js.map → chunk-22EZJUPM.js.map} +0 -0
- /package/dist/{chunk-XC7K4XYM.js.map → chunk-DLBNFBXQ.js.map} +0 -0
- /package/dist/{chunk-S4XLE2RN.js.map → chunk-HGOPGZNQ.js.map} +0 -0
- /package/dist/{chunk-UCBAG42A.js.map → chunk-KHB5CHAU.js.map} +0 -0
- /package/dist/{chunk-647LAYRV.js.map → chunk-LHABOAOP.js.map} +0 -0
- /package/dist/{chunk-OQE6SHZE.js.map → chunk-N5XQU36W.js.map} +0 -0
- /package/dist/{chunk-HWJIMLHC.js.map → chunk-UAPCHIJI.js.map} +0 -0
- /package/dist/{chunk-CRXNFZRW.js.map → chunk-Y4JLSCT7.js.map} +0 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @anvia/react-ui
|
|
2
2
|
|
|
3
|
-
Composable React UI primitives for Anvia
|
|
3
|
+
Composable, headless React UI primitives for Anvia applications.
|
|
4
4
|
|
|
5
5
|
```tsx
|
|
6
6
|
import { createHttpClientTransport } from "@anvia/client";
|
|
@@ -93,3 +93,51 @@ For app-owned text state, `StreamMarkdown` is available from `@anvia/react-ui/st
|
|
|
93
93
|
context-free renderer: pass the already displayed text as `content` and set `live` only for its
|
|
94
94
|
growing tail. Style `[data-state="revealing"]` in the owning application; `@anvia/cli` installs this
|
|
95
95
|
animation with its `markdown`, `message`, `thread`, and `chat` items.
|
|
96
|
+
|
|
97
|
+
## Graph explorer
|
|
98
|
+
|
|
99
|
+
`@anvia/react/graph-explorer` owns graph exploration behavior without choosing a layout or rendering
|
|
100
|
+
library. `@anvia/react-ui/graph-explorer` supplies optional headless composition primitives. Provide
|
|
101
|
+
a browser-safe `explore` callback, normally backed by an application HTTP route, then render the
|
|
102
|
+
controller's nodes and relationships with React Flow, Sigma.js, SVG, canvas, or any other renderer:
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
import type { GraphExplorer } from "@anvia/graph";
|
|
106
|
+
import { useGraphExplorer } from "@anvia/react/graph-explorer";
|
|
107
|
+
import {
|
|
108
|
+
GraphExplorerNodePrimitive,
|
|
109
|
+
GraphExplorerPrimitive,
|
|
110
|
+
GraphExplorerProvider,
|
|
111
|
+
} from "@anvia/react-ui/graph-explorer";
|
|
112
|
+
|
|
113
|
+
export function KnowledgeGraph({ explore }: { explore: GraphExplorer["explore"] }) {
|
|
114
|
+
const controller = useGraphExplorer({ explore });
|
|
115
|
+
return (
|
|
116
|
+
<GraphExplorerProvider controller={controller}>
|
|
117
|
+
<GraphExplorerPrimitive.Root>
|
|
118
|
+
<GraphExplorerPrimitive.Search />
|
|
119
|
+
<GraphExplorerPrimitive.Viewport>
|
|
120
|
+
{controller.nodes.map((node) => (
|
|
121
|
+
<GraphExplorerNodePrimitive.Root key={node.id} nodeId={node.id} asChild>
|
|
122
|
+
{/* This can instead be an element supplied to a renderer such as React Flow. */}
|
|
123
|
+
<article>{node.type}</article>
|
|
124
|
+
</GraphExplorerNodePrimitive.Root>
|
|
125
|
+
))}
|
|
126
|
+
</GraphExplorerPrimitive.Viewport>
|
|
127
|
+
<GraphExplorerPrimitive.Empty />
|
|
128
|
+
<GraphExplorerPrimitive.Status />
|
|
129
|
+
</GraphExplorerPrimitive.Root>
|
|
130
|
+
</GraphExplorerProvider>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Call `controller.explore({ mode: "overview" })` to load an initial view. Overview results replace the
|
|
136
|
+
current graph; expansion results merge by opaque node and relationship IDs. Starting a request
|
|
137
|
+
aborts the previous request, while `refresh()` repeats the latest overview with a fresh signal.
|
|
138
|
+
Expansions inherit filters and limits from the latest successful overview unless explicitly
|
|
139
|
+
overridden. `matchedNodeIds` lets renderers dim, hide, or highlight local search results without
|
|
140
|
+
prescribing one visual behavior. Validate data returned by an HTTP route before resolving the
|
|
141
|
+
`explore` callback; the headless controller intentionally trusts its typed boundary. Renderers that
|
|
142
|
+
do not expose React elements for individual nodes can consume the controller directly without the
|
|
143
|
+
node primitives.
|
package/dist/attachment/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AttachmentPrimitive
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-22EZJUPM.js";
|
|
4
4
|
import "../chunk-T3ZFZ3NP.js";
|
|
5
5
|
import {
|
|
6
6
|
useAttachment
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-E73S3SOF.js";
|
|
8
8
|
export {
|
|
9
9
|
AttachmentPrimitive,
|
|
10
10
|
useAttachment
|
package/dist/chat/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ComposerPrimitive,
|
|
3
3
|
ThreadPrimitive
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-UAPCHIJI.js";
|
|
5
|
+
import "../chunk-Y4JLSCT7.js";
|
|
6
6
|
import "../chunk-6XOJFLX4.js";
|
|
7
7
|
import "../chunk-F6AKBUO3.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-22EZJUPM.js";
|
|
9
9
|
import "../chunk-CKA4CE26.js";
|
|
10
10
|
import "../chunk-T3ZFZ3NP.js";
|
|
11
11
|
import {
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
useChatContext,
|
|
14
14
|
useComposer,
|
|
15
15
|
useThread
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-E73S3SOF.js";
|
|
17
17
|
export {
|
|
18
18
|
ChatProvider,
|
|
19
19
|
ComposerPrimitive,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-T3ZFZ3NP.js";
|
|
4
4
|
import {
|
|
5
5
|
useAttachment
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-E73S3SOF.js";
|
|
7
7
|
|
|
8
8
|
// src/attachment/parts.tsx
|
|
9
9
|
import { forwardRef, useCallback } from "react";
|
|
@@ -117,4 +117,4 @@ var AttachmentPrimitive = {
|
|
|
117
117
|
export {
|
|
118
118
|
AttachmentPrimitive
|
|
119
119
|
};
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
120
|
+
//# sourceMappingURL=chunk-22EZJUPM.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
InternalImageProvider,
|
|
7
7
|
useImage,
|
|
8
8
|
useOptionalAttachment
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-E73S3SOF.js";
|
|
10
10
|
|
|
11
11
|
// src/image/parts.tsx
|
|
12
12
|
import {
|
|
@@ -422,4 +422,4 @@ var ImagePrimitive = {
|
|
|
422
422
|
export {
|
|
423
423
|
ImagePrimitive
|
|
424
424
|
};
|
|
425
|
-
//# sourceMappingURL=chunk-
|
|
425
|
+
//# sourceMappingURL=chunk-DLBNFBXQ.js.map
|
|
@@ -73,17 +73,59 @@ function useCompletionContext() {
|
|
|
73
73
|
return value;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
// src/contexts/
|
|
76
|
+
// src/contexts/graph-explorer.tsx
|
|
77
77
|
import { createContext as createContext4, createElement as createElement4, useContext as useContext4 } from "react";
|
|
78
|
-
var
|
|
78
|
+
var GraphExplorerContext = createContext4(void 0);
|
|
79
|
+
var GraphExplorerNodeContext = createContext4(
|
|
80
|
+
void 0
|
|
81
|
+
);
|
|
82
|
+
function GraphExplorerProvider({
|
|
83
|
+
controller,
|
|
84
|
+
children
|
|
85
|
+
}) {
|
|
86
|
+
return createElement4(
|
|
87
|
+
GraphExplorerContext.Provider,
|
|
88
|
+
{ value: controller },
|
|
89
|
+
children
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
function InternalGraphExplorerNodeProvider({
|
|
93
|
+
value,
|
|
94
|
+
children
|
|
95
|
+
}) {
|
|
96
|
+
return createElement4(GraphExplorerNodeContext.Provider, { value }, children);
|
|
97
|
+
}
|
|
98
|
+
function useGraphExplorerContext() {
|
|
99
|
+
const value = useContext4(GraphExplorerContext);
|
|
100
|
+
if (value === void 0) {
|
|
101
|
+
throw new Error("Graph explorer primitives must be used inside GraphExplorerProvider.");
|
|
102
|
+
}
|
|
103
|
+
return value;
|
|
104
|
+
}
|
|
105
|
+
function useGraphExplorerNode() {
|
|
106
|
+
const value = useContext4(GraphExplorerNodeContext);
|
|
107
|
+
if (value === void 0) {
|
|
108
|
+
throw new Error(
|
|
109
|
+
"Graph explorer node primitives must be used inside GraphExplorerNodePrimitive.Root or GraphExplorerPrimitive.Nodes."
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
return value;
|
|
113
|
+
}
|
|
114
|
+
function useOptionalGraphExplorerNode() {
|
|
115
|
+
return useContext4(GraphExplorerNodeContext);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// src/contexts/completion-input.tsx
|
|
119
|
+
import { createContext as createContext5, createElement as createElement5, useContext as useContext5 } from "react";
|
|
120
|
+
var CompletionInputContext = createContext5(void 0);
|
|
79
121
|
function InternalCompletionInputProvider({
|
|
80
122
|
value,
|
|
81
123
|
children
|
|
82
124
|
}) {
|
|
83
|
-
return
|
|
125
|
+
return createElement5(CompletionInputContext.Provider, { value }, children);
|
|
84
126
|
}
|
|
85
127
|
function useCompletionInput() {
|
|
86
|
-
const value =
|
|
128
|
+
const value = useContext5(CompletionInputContext);
|
|
87
129
|
if (value === void 0) {
|
|
88
130
|
throw new Error("Completion input primitives must be used inside CompletionPrimitive.Form.");
|
|
89
131
|
}
|
|
@@ -91,16 +133,16 @@ function useCompletionInput() {
|
|
|
91
133
|
}
|
|
92
134
|
|
|
93
135
|
// src/contexts/composer.tsx
|
|
94
|
-
import { createContext as
|
|
95
|
-
var ComposerContext =
|
|
136
|
+
import { createContext as createContext6, createElement as createElement6, useContext as useContext6 } from "react";
|
|
137
|
+
var ComposerContext = createContext6(void 0);
|
|
96
138
|
function InternalComposerProvider({
|
|
97
139
|
value,
|
|
98
140
|
children
|
|
99
141
|
}) {
|
|
100
|
-
return
|
|
142
|
+
return createElement6(ComposerContext.Provider, { value }, children);
|
|
101
143
|
}
|
|
102
144
|
function useComposer() {
|
|
103
|
-
const value =
|
|
145
|
+
const value = useContext6(ComposerContext);
|
|
104
146
|
if (value === void 0) {
|
|
105
147
|
throw new Error("Composer primitives must be used inside ComposerPrimitive.Root.");
|
|
106
148
|
}
|
|
@@ -109,15 +151,15 @@ function useComposer() {
|
|
|
109
151
|
|
|
110
152
|
// src/contexts/human-input.tsx
|
|
111
153
|
import {
|
|
112
|
-
createContext as
|
|
113
|
-
createElement as
|
|
114
|
-
useContext as
|
|
154
|
+
createContext as createContext7,
|
|
155
|
+
createElement as createElement7,
|
|
156
|
+
useContext as useContext7,
|
|
115
157
|
useMemo,
|
|
116
158
|
useState
|
|
117
159
|
} from "react";
|
|
118
|
-
var ApprovalContext =
|
|
119
|
-
var QuestionContext =
|
|
120
|
-
var QuestionPromptContext =
|
|
160
|
+
var ApprovalContext = createContext7(void 0);
|
|
161
|
+
var QuestionContext = createContext7(void 0);
|
|
162
|
+
var QuestionPromptContext = createContext7(void 0);
|
|
121
163
|
function InternalApprovalProvider({
|
|
122
164
|
approval,
|
|
123
165
|
children
|
|
@@ -127,36 +169,36 @@ function InternalApprovalProvider({
|
|
|
127
169
|
() => ({ approval, reason, setReason }),
|
|
128
170
|
[approval, reason]
|
|
129
171
|
);
|
|
130
|
-
return
|
|
172
|
+
return createElement7(ApprovalContext.Provider, { value }, children);
|
|
131
173
|
}
|
|
132
174
|
function InternalQuestionProvider({
|
|
133
175
|
value,
|
|
134
176
|
children
|
|
135
177
|
}) {
|
|
136
|
-
return
|
|
178
|
+
return createElement7(QuestionContext.Provider, { value }, children);
|
|
137
179
|
}
|
|
138
180
|
function InternalQuestionPromptProvider({
|
|
139
181
|
prompt,
|
|
140
182
|
children
|
|
141
183
|
}) {
|
|
142
|
-
return
|
|
184
|
+
return createElement7(QuestionPromptContext.Provider, { value: { prompt } }, children);
|
|
143
185
|
}
|
|
144
186
|
function useApproval() {
|
|
145
|
-
const value =
|
|
187
|
+
const value = useContext7(ApprovalContext);
|
|
146
188
|
if (value === void 0) {
|
|
147
189
|
throw new Error("Approval primitives must be used inside HumanInputPrimitive.Approval.");
|
|
148
190
|
}
|
|
149
191
|
return value;
|
|
150
192
|
}
|
|
151
193
|
function useQuestion() {
|
|
152
|
-
const value =
|
|
194
|
+
const value = useContext7(QuestionContext);
|
|
153
195
|
if (value === void 0) {
|
|
154
196
|
throw new Error("Question primitives must be used inside HumanInputPrimitive.Question.");
|
|
155
197
|
}
|
|
156
198
|
return value;
|
|
157
199
|
}
|
|
158
200
|
function useQuestionPrompt() {
|
|
159
|
-
const value =
|
|
201
|
+
const value = useContext7(QuestionPromptContext);
|
|
160
202
|
if (value === void 0) {
|
|
161
203
|
throw new Error(
|
|
162
204
|
"Question choice primitives must be used inside HumanInputPrimitive.QuestionPrompt."
|
|
@@ -166,16 +208,16 @@ function useQuestionPrompt() {
|
|
|
166
208
|
}
|
|
167
209
|
|
|
168
210
|
// src/contexts/image.tsx
|
|
169
|
-
import { createContext as
|
|
170
|
-
var ImageContext =
|
|
211
|
+
import { createContext as createContext8, createElement as createElement8, useContext as useContext8 } from "react";
|
|
212
|
+
var ImageContext = createContext8(void 0);
|
|
171
213
|
function InternalImageProvider({
|
|
172
214
|
value,
|
|
173
215
|
children
|
|
174
216
|
}) {
|
|
175
|
-
return
|
|
217
|
+
return createElement8(ImageContext.Provider, { value }, children);
|
|
176
218
|
}
|
|
177
219
|
function useImage() {
|
|
178
|
-
const value =
|
|
220
|
+
const value = useContext8(ImageContext);
|
|
179
221
|
if (value === void 0) {
|
|
180
222
|
throw new Error("Image primitives must be used inside ImagePrimitive.Root.");
|
|
181
223
|
}
|
|
@@ -183,14 +225,14 @@ function useImage() {
|
|
|
183
225
|
}
|
|
184
226
|
|
|
185
227
|
// src/contexts/message.tsx
|
|
186
|
-
import { createContext as
|
|
187
|
-
var MessageContext =
|
|
188
|
-
var MessagePartContext =
|
|
228
|
+
import { createContext as createContext9, createElement as createElement9, useContext as useContext9 } from "react";
|
|
229
|
+
var MessageContext = createContext9(void 0);
|
|
230
|
+
var MessagePartContext = createContext9(void 0);
|
|
189
231
|
function InternalMessageProvider({
|
|
190
232
|
message,
|
|
191
233
|
children
|
|
192
234
|
}) {
|
|
193
|
-
return
|
|
235
|
+
return createElement9(MessageContext.Provider, { value: { message } }, children);
|
|
194
236
|
}
|
|
195
237
|
function InternalMessagePartProvider({
|
|
196
238
|
part,
|
|
@@ -198,14 +240,14 @@ function InternalMessagePartProvider({
|
|
|
198
240
|
streamControlled = false,
|
|
199
241
|
children
|
|
200
242
|
}) {
|
|
201
|
-
return
|
|
243
|
+
return createElement9(
|
|
202
244
|
MessagePartContext.Provider,
|
|
203
245
|
{ value: { isLive, part, streamControlled } },
|
|
204
246
|
children
|
|
205
247
|
);
|
|
206
248
|
}
|
|
207
249
|
function useMessage() {
|
|
208
|
-
const value =
|
|
250
|
+
const value = useContext9(MessageContext);
|
|
209
251
|
if (value === void 0) {
|
|
210
252
|
throw new Error(
|
|
211
253
|
"Message primitives must be used inside MessagePrimitive.Root or ThreadPrimitive.Messages."
|
|
@@ -214,7 +256,7 @@ function useMessage() {
|
|
|
214
256
|
return value;
|
|
215
257
|
}
|
|
216
258
|
function useMessagePart() {
|
|
217
|
-
const value =
|
|
259
|
+
const value = useContext9(MessagePartContext);
|
|
218
260
|
if (value === void 0) {
|
|
219
261
|
throw new Error(
|
|
220
262
|
"Message part primitives must be used inside MessagePrimitive.Parts or MessagePrimitive.Part."
|
|
@@ -223,20 +265,20 @@ function useMessagePart() {
|
|
|
223
265
|
return value;
|
|
224
266
|
}
|
|
225
267
|
function useOptionalMessagePart() {
|
|
226
|
-
return
|
|
268
|
+
return useContext9(MessagePartContext);
|
|
227
269
|
}
|
|
228
270
|
|
|
229
271
|
// src/contexts/selection-toolbar.tsx
|
|
230
|
-
import { createContext as
|
|
231
|
-
var SelectionToolbarContext =
|
|
272
|
+
import { createContext as createContext10, createElement as createElement10, useContext as useContext10 } from "react";
|
|
273
|
+
var SelectionToolbarContext = createContext10(void 0);
|
|
232
274
|
function InternalSelectionToolbarProvider({
|
|
233
275
|
value,
|
|
234
276
|
children
|
|
235
277
|
}) {
|
|
236
|
-
return
|
|
278
|
+
return createElement10(SelectionToolbarContext.Provider, { value }, children);
|
|
237
279
|
}
|
|
238
280
|
function useSelectionToolbar() {
|
|
239
|
-
const value =
|
|
281
|
+
const value = useContext10(SelectionToolbarContext);
|
|
240
282
|
if (value === void 0) {
|
|
241
283
|
throw new Error(
|
|
242
284
|
"SelectionToolbar primitives must be used inside SelectionToolbarPrimitive.Root."
|
|
@@ -247,19 +289,19 @@ function useSelectionToolbar() {
|
|
|
247
289
|
|
|
248
290
|
// src/contexts/thread.tsx
|
|
249
291
|
import {
|
|
250
|
-
createContext as
|
|
251
|
-
createElement as
|
|
252
|
-
useContext as
|
|
292
|
+
createContext as createContext11,
|
|
293
|
+
createElement as createElement11,
|
|
294
|
+
useContext as useContext11
|
|
253
295
|
} from "react";
|
|
254
|
-
var ThreadContext =
|
|
296
|
+
var ThreadContext = createContext11(void 0);
|
|
255
297
|
function InternalThreadProvider({
|
|
256
298
|
value,
|
|
257
299
|
children
|
|
258
300
|
}) {
|
|
259
|
-
return
|
|
301
|
+
return createElement11(ThreadContext.Provider, { value }, children);
|
|
260
302
|
}
|
|
261
303
|
function useThread() {
|
|
262
|
-
const value =
|
|
304
|
+
const value = useContext11(ThreadContext);
|
|
263
305
|
if (value === void 0) {
|
|
264
306
|
throw new Error("Thread primitives must be used inside ThreadPrimitive.Root.");
|
|
265
307
|
}
|
|
@@ -268,49 +310,49 @@ function useThread() {
|
|
|
268
310
|
|
|
269
311
|
// src/contexts/thread-list.tsx
|
|
270
312
|
import {
|
|
271
|
-
createContext as
|
|
272
|
-
createElement as
|
|
273
|
-
useContext as
|
|
313
|
+
createContext as createContext12,
|
|
314
|
+
createElement as createElement12,
|
|
315
|
+
useContext as useContext12
|
|
274
316
|
} from "react";
|
|
275
|
-
var ThreadListContext =
|
|
276
|
-
var ThreadListItemContext =
|
|
277
|
-
var ThreadListRootContext =
|
|
317
|
+
var ThreadListContext = createContext12(void 0);
|
|
318
|
+
var ThreadListItemContext = createContext12(void 0);
|
|
319
|
+
var ThreadListRootContext = createContext12(
|
|
278
320
|
void 0
|
|
279
321
|
);
|
|
280
322
|
function ThreadListProvider({
|
|
281
323
|
controller,
|
|
282
324
|
children
|
|
283
325
|
}) {
|
|
284
|
-
return
|
|
326
|
+
return createElement12(ThreadListContext.Provider, { value: controller }, children);
|
|
285
327
|
}
|
|
286
328
|
function InternalThreadListItemProvider({
|
|
287
329
|
value,
|
|
288
330
|
children
|
|
289
331
|
}) {
|
|
290
|
-
return
|
|
332
|
+
return createElement12(ThreadListItemContext.Provider, { value }, children);
|
|
291
333
|
}
|
|
292
334
|
function InternalThreadListRootProvider({
|
|
293
335
|
value,
|
|
294
336
|
children
|
|
295
337
|
}) {
|
|
296
|
-
return
|
|
338
|
+
return createElement12(ThreadListRootContext.Provider, { value }, children);
|
|
297
339
|
}
|
|
298
340
|
function useThreadList() {
|
|
299
|
-
const value =
|
|
341
|
+
const value = useContext12(ThreadListContext);
|
|
300
342
|
if (value === void 0) {
|
|
301
343
|
throw new Error("ThreadList primitives must be used inside ThreadListProvider.");
|
|
302
344
|
}
|
|
303
345
|
return value;
|
|
304
346
|
}
|
|
305
347
|
function useThreadListItem() {
|
|
306
|
-
const value =
|
|
348
|
+
const value = useContext12(ThreadListItemContext);
|
|
307
349
|
if (value === void 0) {
|
|
308
350
|
throw new Error("ThreadListItem primitives must be used inside ThreadListPrimitive.Items.");
|
|
309
351
|
}
|
|
310
352
|
return value;
|
|
311
353
|
}
|
|
312
354
|
function useInternalThreadListRoot() {
|
|
313
|
-
const value =
|
|
355
|
+
const value = useContext12(ThreadListRootContext);
|
|
314
356
|
if (value === void 0) {
|
|
315
357
|
throw new Error("Thread-list primitives must be used inside ThreadListPrimitive.Root.");
|
|
316
358
|
}
|
|
@@ -326,6 +368,11 @@ export {
|
|
|
326
368
|
useHumanInput,
|
|
327
369
|
CompletionProvider,
|
|
328
370
|
useCompletionContext,
|
|
371
|
+
GraphExplorerProvider,
|
|
372
|
+
InternalGraphExplorerNodeProvider,
|
|
373
|
+
useGraphExplorerContext,
|
|
374
|
+
useGraphExplorerNode,
|
|
375
|
+
useOptionalGraphExplorerNode,
|
|
329
376
|
InternalCompletionInputProvider,
|
|
330
377
|
useCompletionInput,
|
|
331
378
|
InternalComposerProvider,
|
|
@@ -354,4 +401,4 @@ export {
|
|
|
354
401
|
useThreadListItem,
|
|
355
402
|
useInternalThreadListRoot
|
|
356
403
|
};
|
|
357
|
-
//# sourceMappingURL=chunk-
|
|
404
|
+
//# sourceMappingURL=chunk-E73S3SOF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/contexts/attachment.tsx","../src/contexts/chat.tsx","../src/contexts/completion.tsx","../src/contexts/graph-explorer.tsx","../src/contexts/completion-input.tsx","../src/contexts/composer.tsx","../src/contexts/human-input.tsx","../src/contexts/image.tsx","../src/contexts/message.tsx","../src/contexts/selection-toolbar.tsx","../src/contexts/thread.tsx","../src/contexts/thread-list.tsx"],"sourcesContent":["import type { UIAttachment } from \"@anvia/client\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type AttachmentContextValue = {\n attachment: UIAttachment;\n remove?(): void;\n};\n\nconst AttachmentContext = createContext<AttachmentContextValue | undefined>(undefined);\n\nexport function InternalAttachmentProvider({\n value,\n children,\n}: {\n value: AttachmentContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(AttachmentContext.Provider, { value }, children);\n}\n\nexport function useAttachment(): AttachmentContextValue {\n const value = useContext(AttachmentContext);\n if (value === undefined) {\n throw new Error(\"Attachment primitives must be used inside AttachmentPrimitive.Root.\");\n }\n return value;\n}\n\nexport function useOptionalAttachment(): AttachmentContextValue | undefined {\n return useContext(AttachmentContext);\n}\n","import type {\n ClientDataMap,\n ClientMetadata,\n ClientStreamRequest,\n ClientTransport,\n} from \"@anvia/client\";\nimport type {\n AgentToolApprovalRequest,\n AgentToolQuestionRequest,\n} from \"@anvia/core/agent/interactions\";\nimport type { UseChatResult } from \"@anvia/react\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type ChatController<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n> = UseChatResult<ClientTransport<ClientStreamRequest, Data, Metadata>>;\n\nexport type ChatProviderProps<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n> = {\n controller: ChatController<Metadata, Data>;\n children?: ReactNode;\n};\n\nconst ChatContext = createContext<ChatController | undefined>(undefined);\n\nexport function ChatProvider<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n>({ controller, children }: ChatProviderProps<Metadata, Data>): ReactElement {\n return createElement(\n ChatContext.Provider,\n { value: controller as unknown as ChatController },\n children,\n );\n}\n\nexport function useChatContext<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n>(): ChatController<Metadata, Data> {\n const value = useContext(ChatContext);\n if (value === undefined) {\n throw new Error(\"Anvia chat primitives must be used inside ChatProvider.\");\n }\n return value as unknown as ChatController<Metadata, Data>;\n}\n\nexport function useHumanInput() {\n const interactions = useChatContext().interactions;\n const approvals = interactions.all.filter(\n (item): item is typeof item & { request: AgentToolApprovalRequest } =>\n item.request.type === \"tool-approval\",\n );\n const questions = interactions.all.filter(\n (item): item is typeof item & { request: AgentToolQuestionRequest } =>\n item.request.type === \"tool-question\",\n );\n return {\n approvals: {\n all: approvals,\n pending: approvals.filter((item) => item.status === \"pending\"),\n },\n questions: {\n all: questions,\n pending: questions.filter((item) => item.status === \"pending\"),\n },\n };\n}\n","import type { ClientDataMap, ClientMetadata } from \"@anvia/client\";\nimport type { UseCompletionResult } from \"@anvia/react\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type CompletionController<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n> = UseCompletionResult<Metadata, Data>;\n\nexport type CompletionProviderProps<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n> = {\n controller: CompletionController<Metadata, Data>;\n children?: ReactNode;\n};\n\nconst CompletionContext = createContext<CompletionController | undefined>(undefined);\n\nexport function CompletionProvider<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n>({ controller, children }: CompletionProviderProps<Metadata, Data>): ReactElement {\n return createElement(\n CompletionContext.Provider,\n { value: controller as unknown as CompletionController },\n children,\n );\n}\n\nexport function useCompletionContext<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n>(): CompletionController<Metadata, Data> {\n const value = useContext(CompletionContext);\n if (value === undefined) {\n throw new Error(\"Anvia completion primitives must be used inside CompletionProvider.\");\n }\n return value as unknown as CompletionController<Metadata, Data>;\n}\n","import type { GraphExploreNode, GraphSchemaLike } from \"@anvia/graph\";\nimport type {\n GraphExplorerController,\n GraphExplorerExpandNodeOptions,\n GraphExplorerStatus,\n} from \"@anvia/react/graph-explorer\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type { GraphExplorerController, GraphExplorerExpandNodeOptions, GraphExplorerStatus };\n\nexport type GraphExplorerProviderProps<Schema extends GraphSchemaLike = GraphSchemaLike> = {\n controller: GraphExplorerController<Schema>;\n children?: ReactNode;\n};\n\nexport type GraphExplorerNodeContextValue = {\n node: GraphExploreNode;\n selected: boolean;\n matched: boolean;\n};\n\nconst GraphExplorerContext = createContext<GraphExplorerController | undefined>(undefined);\nconst GraphExplorerNodeContext = createContext<GraphExplorerNodeContextValue | undefined>(\n undefined,\n);\n\nexport function GraphExplorerProvider<Schema extends GraphSchemaLike = GraphSchemaLike>({\n controller,\n children,\n}: GraphExplorerProviderProps<Schema>): ReactElement {\n return createElement(\n GraphExplorerContext.Provider,\n { value: controller as unknown as GraphExplorerController },\n children,\n );\n}\n\nexport function InternalGraphExplorerNodeProvider({\n value,\n children,\n}: {\n value: GraphExplorerNodeContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(GraphExplorerNodeContext.Provider, { value }, children);\n}\n\nexport function useGraphExplorerContext<\n Schema extends GraphSchemaLike = GraphSchemaLike,\n>(): GraphExplorerController<Schema> {\n const value = useContext(GraphExplorerContext);\n if (value === undefined) {\n throw new Error(\"Graph explorer primitives must be used inside GraphExplorerProvider.\");\n }\n return value as unknown as GraphExplorerController<Schema>;\n}\n\nexport function useGraphExplorerNode(): GraphExplorerNodeContextValue {\n const value = useContext(GraphExplorerNodeContext);\n if (value === undefined) {\n throw new Error(\n \"Graph explorer node primitives must be used inside GraphExplorerNodePrimitive.Root or GraphExplorerPrimitive.Nodes.\",\n );\n }\n return value;\n}\n\nexport function useOptionalGraphExplorerNode(): GraphExplorerNodeContextValue | undefined {\n return useContext(GraphExplorerNodeContext);\n}\n","import { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nimport type { CompletionController } from \"./completion\";\n\nexport type CompletionInputContextValue = {\n input: string;\n setInput(input: string): void;\n submit(): Promise<void>;\n stop(): void;\n status: CompletionController[\"status\"];\n canSubmit: boolean;\n canStop: boolean;\n};\n\nconst CompletionInputContext = createContext<CompletionInputContextValue | undefined>(undefined);\n\nexport function InternalCompletionInputProvider({\n value,\n children,\n}: {\n value: CompletionInputContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(CompletionInputContext.Provider, { value }, children);\n}\n\nexport function useCompletionInput(): CompletionInputContextValue {\n const value = useContext(CompletionInputContext);\n if (value === undefined) {\n throw new Error(\"Completion input primitives must be used inside CompletionPrimitive.Form.\");\n }\n return value;\n}\n","import type { ClientMetadata, CreateUIAttachment, UIAttachment } from \"@anvia/client\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\nimport type { ChatController } from \"./chat\";\n\nexport type ComposerEntityData =\n | string\n | number\n | boolean\n | null\n | readonly ComposerEntityData[]\n | { [key: string]: ComposerEntityData };\n\nexport type ComposerAttachmentInput = File | CreateUIAttachment;\nexport type ComposerAttachmentsUpdate =\n | UIAttachment[]\n | ((attachments: UIAttachment[]) => UIAttachment[]);\nexport type ComposerEntitiesUpdate =\n | ComposerEntity[]\n | ((entities: ComposerEntity[]) => ComposerEntity[]);\nexport type ComposerQuote = {\n text: string;\n messageId: string;\n};\nexport type ComposerTriggerItem = {\n id: string;\n label: string;\n text?: string | undefined;\n detail?: ReactNode | undefined;\n data?: ComposerEntityData | undefined;\n disabled?: boolean | undefined;\n};\nexport type ComposerTriggerItemsArgs = {\n trigger: ComposerTriggerDefinition;\n query: string;\n input: string;\n entities: ComposerEntity[];\n signal: AbortSignal;\n};\nexport type ComposerTriggerItems =\n | ComposerTriggerItem[]\n | ((args: ComposerTriggerItemsArgs) => ComposerTriggerItem[] | Promise<ComposerTriggerItem[]>);\nexport type ComposerTriggerDefinition = {\n id: string;\n char: string;\n items: ComposerTriggerItems;\n minQueryLength?: number | undefined;\n allowedPrefixes?: string[] | null | undefined;\n startOfLine?: boolean | undefined;\n allowSpaces?: boolean | undefined;\n};\nexport type ComposerEntity = {\n id: string;\n triggerId: string;\n trigger: string;\n label: string;\n text: string;\n range: {\n from: number;\n to: number;\n };\n data?: ComposerEntityData | undefined;\n};\ntype ComposerMessageEntity = ClientMetadata & {\n id: string;\n triggerId: string;\n trigger: string;\n label: string;\n text: string;\n range: ClientMetadata & {\n from: number;\n to: number;\n };\n data?: ComposerEntityData | undefined;\n};\nexport type ComposerMessageMetadata = ClientMetadata & {\n composer: ClientMetadata & {\n entities: readonly ComposerMessageEntity[];\n };\n};\nexport type ComposerTriggerState = {\n trigger: ComposerTriggerDefinition;\n query: string;\n items: ComposerTriggerItem[];\n loading: boolean;\n selectedIndex: number;\n rect?: {\n top: number;\n right: number;\n bottom: number;\n left: number;\n width: number;\n height: number;\n };\n selectItem(item: ComposerTriggerItem): void;\n setSelectedIndex(index: number): void;\n};\nexport type ComposerTriggerStateUpdate =\n | ComposerTriggerState\n | undefined\n | ((state: ComposerTriggerState | undefined) => ComposerTriggerState | undefined);\n\nexport type ComposerContextValue = {\n input: string;\n setInput(input: string): void;\n attachments: UIAttachment[];\n setAttachments(update: ComposerAttachmentsUpdate): void;\n addAttachment(attachment: ComposerAttachmentInput): Promise<void>;\n removeAttachment(id: string): void;\n clearAttachments(): void;\n entities: ComposerEntity[];\n setEntities(update: ComposerEntitiesUpdate): void;\n quote?: ComposerQuote | undefined;\n setQuote(quote: ComposerQuote | undefined): void;\n clearQuote(): void;\n triggers: ComposerTriggerDefinition[];\n activeTrigger?: ComposerTriggerState | undefined;\n setActiveTrigger(update: ComposerTriggerStateUpdate): void;\n submit(): Promise<void>;\n stop(): void;\n status: ChatController[\"status\"];\n canSubmit: boolean;\n canStop: boolean;\n};\n\nconst ComposerContext = createContext<ComposerContextValue | undefined>(undefined);\n\nexport function InternalComposerProvider({\n value,\n children,\n}: {\n value: ComposerContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(ComposerContext.Provider, { value }, children);\n}\n\nexport function useComposer(): ComposerContextValue {\n const value = useContext(ComposerContext);\n if (value === undefined) {\n throw new Error(\"Composer primitives must be used inside ComposerPrimitive.Root.\");\n }\n return value;\n}\n","import type { ClientInteraction } from \"@anvia/client\";\nimport type {\n AgentQuestionAnswer,\n AgentQuestionPrompt,\n AgentToolApprovalRequest,\n AgentToolQuestionRequest,\n} from \"@anvia/core/agent/interactions\";\nimport {\n createContext,\n createElement,\n type ReactElement,\n type ReactNode,\n useContext,\n useMemo,\n useState,\n} from \"react\";\n\nexport type ApprovalContextValue = {\n approval: ApprovalInteraction;\n reason: string;\n setReason(reason: string): void;\n};\n\nexport type QuestionContextValue = {\n question: QuestionInteraction;\n answers: Record<string, AgentQuestionAnswer>;\n setAnswer(prompt: AgentQuestionPrompt, answer: AgentQuestionAnswer): void;\n};\n\nexport type QuestionPromptContextValue = {\n prompt: AgentQuestionPrompt;\n};\n\nexport type ApprovalInteraction = ClientInteraction & { request: AgentToolApprovalRequest };\nexport type QuestionInteraction = ClientInteraction & { request: AgentToolQuestionRequest };\n\nconst ApprovalContext = createContext<ApprovalContextValue | undefined>(undefined);\nconst QuestionContext = createContext<QuestionContextValue | undefined>(undefined);\nconst QuestionPromptContext = createContext<QuestionPromptContextValue | undefined>(undefined);\n\nexport function InternalApprovalProvider({\n approval,\n children,\n}: {\n approval: ApprovalInteraction;\n children?: ReactNode;\n}): ReactElement {\n const [reason, setReason] = useState(\"\");\n const value = useMemo<ApprovalContextValue>(\n () => ({ approval, reason, setReason }),\n [approval, reason],\n );\n\n return createElement(ApprovalContext.Provider, { value }, children);\n}\n\nexport function InternalQuestionProvider({\n value,\n children,\n}: {\n value: QuestionContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(QuestionContext.Provider, { value }, children);\n}\n\nexport function InternalQuestionPromptProvider({\n prompt,\n children,\n}: {\n prompt: AgentQuestionPrompt;\n children?: ReactNode;\n}): ReactElement {\n return createElement(QuestionPromptContext.Provider, { value: { prompt } }, children);\n}\n\nexport function useApproval(): ApprovalContextValue {\n const value = useContext(ApprovalContext);\n if (value === undefined) {\n throw new Error(\"Approval primitives must be used inside HumanInputPrimitive.Approval.\");\n }\n return value;\n}\n\nexport function useQuestion(): QuestionContextValue {\n const value = useContext(QuestionContext);\n if (value === undefined) {\n throw new Error(\"Question primitives must be used inside HumanInputPrimitive.Question.\");\n }\n return value;\n}\n\nexport function useQuestionPrompt(): QuestionPromptContextValue {\n const value = useContext(QuestionPromptContext);\n if (value === undefined) {\n throw new Error(\n \"Question choice primitives must be used inside HumanInputPrimitive.QuestionPrompt.\",\n );\n }\n return value;\n}\n","import type { UIAttachment } from \"@anvia/client\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type ImageContextValue = {\n attachment: UIAttachment;\n src?: string;\n name?: string;\n mediaType?: string;\n isImage: boolean;\n zoomOpen: boolean;\n setZoomOpen(open: boolean): void;\n};\n\nconst ImageContext = createContext<ImageContextValue | undefined>(undefined);\n\nexport function InternalImageProvider({\n value,\n children,\n}: {\n value: ImageContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(ImageContext.Provider, { value }, children);\n}\n\nexport function useImage(): ImageContextValue {\n const value = useContext(ImageContext);\n if (value === undefined) {\n throw new Error(\"Image primitives must be used inside ImagePrimitive.Root.\");\n }\n return value;\n}\n","import type { UIMessage, UIMessagePart } from \"@anvia/client\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type MessageContextValue = {\n message: UIMessage;\n};\n\nexport type MessagePartContextValue = {\n isLive: boolean;\n part: UIMessagePart;\n streamControlled: boolean;\n};\n\nconst MessageContext = createContext<MessageContextValue | undefined>(undefined);\nconst MessagePartContext = createContext<MessagePartContextValue | undefined>(undefined);\n\nexport function InternalMessageProvider({\n message,\n children,\n}: {\n message: UIMessage;\n children?: ReactNode;\n}): ReactElement {\n return createElement(MessageContext.Provider, { value: { message } }, children);\n}\n\nexport function InternalMessagePartProvider({\n part,\n isLive = false,\n streamControlled = false,\n children,\n}: {\n part: UIMessagePart;\n isLive?: boolean;\n streamControlled?: boolean;\n children?: ReactNode;\n}): ReactElement {\n return createElement(\n MessagePartContext.Provider,\n { value: { isLive, part, streamControlled } },\n children,\n );\n}\n\nexport function useMessage(): MessageContextValue {\n const value = useContext(MessageContext);\n if (value === undefined) {\n throw new Error(\n \"Message primitives must be used inside MessagePrimitive.Root or ThreadPrimitive.Messages.\",\n );\n }\n return value;\n}\n\nexport function useMessagePart(): MessagePartContextValue {\n const value = useContext(MessagePartContext);\n if (value === undefined) {\n throw new Error(\n \"Message part primitives must be used inside MessagePrimitive.Parts or MessagePrimitive.Part.\",\n );\n }\n return value;\n}\n\nexport function useOptionalMessagePart(): MessagePartContextValue | undefined {\n return useContext(MessagePartContext);\n}\n","import { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type SelectionToolbarSelection = {\n text: string;\n messageId: string;\n rect: DOMRect;\n};\n\nexport type SelectionToolbarContextValue = {\n selection?: SelectionToolbarSelection;\n quote(): void;\n copy(): Promise<void>;\n clear(): void;\n};\n\nconst SelectionToolbarContext = createContext<SelectionToolbarContextValue | undefined>(undefined);\n\nexport function InternalSelectionToolbarProvider({\n value,\n children,\n}: {\n value: SelectionToolbarContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(SelectionToolbarContext.Provider, { value }, children);\n}\n\nexport function useSelectionToolbar(): SelectionToolbarContextValue {\n const value = useContext(SelectionToolbarContext);\n if (value === undefined) {\n throw new Error(\n \"SelectionToolbar primitives must be used inside SelectionToolbarPrimitive.Root.\",\n );\n }\n return value;\n}\n","import {\n createContext,\n createElement,\n type MutableRefObject,\n type ReactElement,\n type ReactNode,\n useContext,\n} from \"react\";\n\nexport type ThreadContextValue = {\n viewportRef: MutableRefObject<HTMLElement | null>;\n messagesRef: MutableRefObject<HTMLElement | null>;\n atBottom: boolean;\n setAtBottom(atBottom: boolean): void;\n scrollToBottom(behavior?: ScrollBehavior): void;\n};\n\nconst ThreadContext = createContext<ThreadContextValue | undefined>(undefined);\n\nexport function InternalThreadProvider({\n value,\n children,\n}: {\n value: ThreadContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(ThreadContext.Provider, { value }, children);\n}\n\nexport function useThread(): ThreadContextValue {\n const value = useContext(ThreadContext);\n if (value === undefined) {\n throw new Error(\"Thread primitives must be used inside ThreadPrimitive.Root.\");\n }\n return value;\n}\n","import {\n createContext,\n createElement,\n type MutableRefObject,\n type ReactElement,\n type ReactNode,\n useContext,\n} from \"react\";\n\nexport type ThreadListRecord = {\n id: string;\n title?: string;\n createdAt?: string | Date;\n updatedAt?: string | Date;\n archived?: boolean;\n metadata?: unknown;\n};\n\nexport type ThreadListController = {\n threads: ThreadListRecord[];\n activeThreadId?: string;\n status?: \"idle\" | \"loading\" | \"error\";\n error?: unknown;\n createThread(): Promise<void> | void;\n switchThread(threadId: string): Promise<void> | void;\n archiveThread?(threadId: string): Promise<void> | void;\n unarchiveThread?(threadId: string): Promise<void> | void;\n deleteThread?(threadId: string): Promise<void> | void;\n};\n\nexport type ThreadListItemContextValue = {\n thread: ThreadListRecord;\n active: boolean;\n};\n\nexport type ThreadListProviderProps = {\n controller: ThreadListController;\n children?: ReactNode;\n};\n\nexport type InternalThreadListRootContextValue = {\n rootRef: MutableRefObject<HTMLDivElement | null>;\n newButtonRef: MutableRefObject<HTMLButtonElement | null>;\n itemElements: MutableRefObject<Map<string, HTMLDivElement>>;\n triggerElements: MutableRefObject<Map<string, HTMLButtonElement>>;\n registerItem(threadId: string, element: HTMLDivElement | null): void;\n registerTrigger(threadId: string, element: HTMLButtonElement | null): void;\n};\n\nconst ThreadListContext = createContext<ThreadListController | undefined>(undefined);\nconst ThreadListItemContext = createContext<ThreadListItemContextValue | undefined>(undefined);\nconst ThreadListRootContext = createContext<InternalThreadListRootContextValue | undefined>(\n undefined,\n);\n\nexport function ThreadListProvider({\n controller,\n children,\n}: ThreadListProviderProps): ReactElement {\n return createElement(ThreadListContext.Provider, { value: controller }, children);\n}\n\nexport function InternalThreadListItemProvider({\n value,\n children,\n}: {\n value: ThreadListItemContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(ThreadListItemContext.Provider, { value }, children);\n}\n\nexport function InternalThreadListRootProvider({\n value,\n children,\n}: {\n value: InternalThreadListRootContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(ThreadListRootContext.Provider, { value }, children);\n}\n\nexport function useThreadList(): ThreadListController {\n const value = useContext(ThreadListContext);\n if (value === undefined) {\n throw new Error(\"ThreadList primitives must be used inside ThreadListProvider.\");\n }\n return value;\n}\n\nexport function useThreadListItem(): ThreadListItemContextValue {\n const value = useContext(ThreadListItemContext);\n if (value === undefined) {\n throw new Error(\"ThreadListItem primitives must be used inside ThreadListPrimitive.Items.\");\n }\n return value;\n}\n\nexport function useInternalThreadListRoot(): InternalThreadListRootContextValue {\n const value = useContext(ThreadListRootContext);\n if (value === undefined) {\n throw new Error(\"Thread-list primitives must be used inside ThreadListPrimitive.Root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;AAAA,EACE,iBAAAC;AAAA,EACA,iBAAAC;AAAA,EAIA,cAAAC;AAAA,OACK;AA0CP,IAAM,oBAAoBF,gBAAgD,MAAS;AACnF,IAAM,wBAAwBA,gBAAsD,MAAS;AAC7F,IAAM,wBAAwBA;AAAA,EAC5B;AACF;AAEO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AACF,GAA0C;AACxC,SAAOC,gBAAc,kBAAkB,UAAU,EAAE,OAAO,WAAW,GAAG,QAAQ;AAClF;AAEO,SAAS,+BAA+B;AAAA,EAC7C;AAAA,EACA;AACF,GAGiB;AACf,SAAOA,gBAAc,sBAAsB,UAAU,EAAE,MAAM,GAAG,QAAQ;AAC1E;AAEO,SAAS,+BAA+B;AAAA,EAC7C;AAAA,EACA;AACF,GAGiB;AACf,SAAOA,gBAAc,sBAAsB,UAAU,EAAE,MAAM,GAAG,QAAQ;AAC1E;AAEO,SAAS,gBAAsC;AACpD,QAAM,QAAQC,aAAW,iBAAiB;AAC1C,MAAI,UAAU,QAAW;AACvB,UAAM,IAAI,MAAM,+DAA+D;AAAA,EACjF;AACA,SAAO;AACT;AAEO,SAAS,oBAAgD;AAC9D,QAAM,QAAQA,aAAW,qBAAqB;AAC9C,MAAI,UAAU,QAAW;AACvB,UAAM,IAAI,MAAM,0EAA0E;AAAA,EAC5F;AACA,SAAO;AACT;AAEO,SAAS,4BAAgE;AAC9E,QAAM,QAAQA,aAAW,qBAAqB;AAC9C,MAAI,UAAU,QAAW;AACvB,UAAM,IAAI,MAAM,sEAAsE;AAAA,EACxF;AACA,SAAO;AACT;","names":["createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext"]}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
InternalCompletionInputProvider,
|
|
6
6
|
useCompletionContext,
|
|
7
7
|
useCompletionInput
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-E73S3SOF.js";
|
|
9
9
|
|
|
10
10
|
// src/completion/form.tsx
|
|
11
11
|
import {
|
|
@@ -192,4 +192,4 @@ var CompletionPrimitive = {
|
|
|
192
192
|
export {
|
|
193
193
|
CompletionPrimitive
|
|
194
194
|
};
|
|
195
|
-
//# sourceMappingURL=chunk-
|
|
195
|
+
//# sourceMappingURL=chunk-HGOPGZNQ.js.map
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
InternalSelectionToolbarProvider,
|
|
9
9
|
useSelectionToolbar
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-E73S3SOF.js";
|
|
11
11
|
|
|
12
12
|
// src/selection-toolbar/parts.tsx
|
|
13
13
|
import {
|
|
@@ -217,4 +217,4 @@ var SelectionToolbarPrimitive = {
|
|
|
217
217
|
export {
|
|
218
218
|
SelectionToolbarPrimitive
|
|
219
219
|
};
|
|
220
|
-
//# sourceMappingURL=chunk-
|
|
220
|
+
//# sourceMappingURL=chunk-KHB5CHAU.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
useInternalThreadListRoot,
|
|
9
9
|
useThreadList,
|
|
10
10
|
useThreadListItem
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-E73S3SOF.js";
|
|
12
12
|
|
|
13
13
|
// src/thread-list/parts.tsx
|
|
14
14
|
import {
|
|
@@ -313,4 +313,4 @@ export {
|
|
|
313
313
|
ThreadListPrimitive,
|
|
314
314
|
ThreadListItemPrimitive
|
|
315
315
|
};
|
|
316
|
-
//# sourceMappingURL=chunk-
|
|
316
|
+
//# sourceMappingURL=chunk-LHABOAOP.js.map
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
useHumanInput,
|
|
14
14
|
useQuestion,
|
|
15
15
|
useQuestionPrompt
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-E73S3SOF.js";
|
|
17
17
|
|
|
18
18
|
// src/human-input/approvals.tsx
|
|
19
19
|
import { forwardRef, useCallback } from "react";
|
|
@@ -407,4 +407,4 @@ var HumanInputPrimitive = {
|
|
|
407
407
|
export {
|
|
408
408
|
HumanInputPrimitive
|
|
409
409
|
};
|
|
410
|
-
//# sourceMappingURL=chunk-
|
|
410
|
+
//# sourceMappingURL=chunk-N5XQU36W.js.map
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
MessagePrimitive,
|
|
3
3
|
isComposerEntityData,
|
|
4
4
|
shiftComposerEntityRanges
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Y4JLSCT7.js";
|
|
6
6
|
import {
|
|
7
7
|
AttachmentPrimitive
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-22EZJUPM.js";
|
|
9
9
|
import {
|
|
10
10
|
composeRefs,
|
|
11
11
|
renderPrimitive
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
useChatContext,
|
|
19
19
|
useComposer,
|
|
20
20
|
useThread
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-E73S3SOF.js";
|
|
22
22
|
|
|
23
23
|
// src/chat/composer.tsx
|
|
24
24
|
import { mergeAttributes } from "@tiptap/core";
|
|
@@ -1579,4 +1579,4 @@ export {
|
|
|
1579
1579
|
ComposerPrimitive,
|
|
1580
1580
|
ThreadPrimitive
|
|
1581
1581
|
};
|
|
1582
|
-
//# sourceMappingURL=chunk-
|
|
1582
|
+
//# sourceMappingURL=chunk-UAPCHIJI.js.map
|