@anvia/react-ui 0.7.1 → 1.0.0-rc.2
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/README.md +4 -1
- package/dist/attachment/index.d.ts +3 -3
- package/dist/attachment/index.js +2 -2
- package/dist/{attachment-BP597fV3.d.ts → attachment-mbjsroli.d.ts} +1 -1
- package/dist/chat/index.d.ts +9 -8
- package/dist/chat/index.js +5 -4
- package/dist/chat-WPrlqdvZ.d.ts +14 -0
- package/dist/{chunk-FABSIZZ7.js → chunk-3OVUVDNY.js} +18 -17
- package/dist/chunk-3OVUVDNY.js.map +1 -0
- package/dist/{chunk-SBYUKODG.js → chunk-6J6XAQNS.js} +2 -2
- package/dist/chunk-6J6XAQNS.js.map +1 -0
- package/dist/chunk-CKA4CE26.js +25 -0
- package/dist/chunk-CKA4CE26.js.map +1 -0
- package/dist/{chunk-R3NA6BWW.js → chunk-G3D5YKD2.js} +16 -7
- package/dist/chunk-G3D5YKD2.js.map +1 -0
- package/dist/{chunk-7HR34SOF.js → chunk-OUWDPMJK.js} +2 -2
- package/dist/chunk-OUWDPMJK.js.map +1 -0
- package/dist/{chunk-VEYJNQVW.js → chunk-OVCNT3OR.js} +7 -6
- package/dist/chunk-OVCNT3OR.js.map +1 -0
- package/dist/{chunk-43U2XQP2.js → chunk-P3JZMVPK.js} +8 -10
- package/dist/chunk-P3JZMVPK.js.map +1 -0
- package/dist/{chunk-JWZDNM5D.js → chunk-PBR53CKI.js} +8 -26
- package/dist/chunk-PBR53CKI.js.map +1 -0
- package/dist/{chunk-56CV6S76.js → chunk-R5FQUAAE.js} +2 -2
- package/dist/{chunk-7RMRM7W3.js → chunk-YFPDH2JM.js} +2 -2
- package/dist/completion/index.d.ts +2 -1
- package/dist/completion/index.js +2 -2
- package/dist/completion-input-DHlwrhxB.d.ts +24 -0
- package/dist/{composer-CzsbDFPt.d.ts → composer-C4IJllVz.d.ts} +2 -2
- package/dist/human-input/index.d.ts +5 -4
- package/dist/human-input/index.js +3 -2
- package/dist/{human-input-CydeYm_7.d.ts → human-input-Bdq46Q56.d.ts} +1 -1
- package/dist/image/index.d.ts +4 -4
- package/dist/image/index.js +2 -2
- package/dist/{image-DanUxcl2.d.ts → image-VZv6Ddsn.d.ts} +1 -1
- package/dist/index.d.ts +8 -7
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/dist/message/index.d.ts +10 -9
- package/dist/message/index.js +4 -3
- package/dist/{message-CkEnKhAn.d.ts → message-CNRnZQwU.d.ts} +1 -1
- package/dist/selection-toolbar/index.js +2 -2
- package/dist/shared.d.ts +8 -7
- package/dist/shared.js +1 -1
- package/dist/thread-list/index.js +2 -2
- package/package.json +16 -14
- package/dist/chat-B3kucz1w.d.ts +0 -13
- package/dist/chunk-43U2XQP2.js.map +0 -1
- package/dist/chunk-7HR34SOF.js.map +0 -1
- package/dist/chunk-FABSIZZ7.js.map +0 -1
- package/dist/chunk-JWZDNM5D.js.map +0 -1
- package/dist/chunk-R3NA6BWW.js.map +0 -1
- package/dist/chunk-SBYUKODG.js.map +0 -1
- package/dist/chunk-VEYJNQVW.js.map +0 -1
- package/dist/completion-input-WjK6kUyG.d.ts +0 -23
- /package/dist/{chunk-56CV6S76.js.map → chunk-R5FQUAAE.js.map} +0 -0
- /package/dist/{chunk-7RMRM7W3.js.map → chunk-YFPDH2JM.js.map} +0 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
InternalSelectionToolbarProvider,
|
|
6
6
|
useSelectionToolbar
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-P3JZMVPK.js";
|
|
8
8
|
|
|
9
9
|
// src/selection-toolbar/parts.tsx
|
|
10
10
|
import {
|
|
@@ -229,4 +229,4 @@ var SelectionToolbar = {
|
|
|
229
229
|
export {
|
|
230
230
|
SelectionToolbar
|
|
231
231
|
};
|
|
232
|
-
//# sourceMappingURL=chunk-
|
|
232
|
+
//# sourceMappingURL=chunk-R5FQUAAE.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
InternalThreadListItemProvider,
|
|
6
6
|
useThreadList,
|
|
7
7
|
useThreadListItem
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-P3JZMVPK.js";
|
|
9
9
|
|
|
10
10
|
// src/thread-list/parts.tsx
|
|
11
11
|
import {
|
|
@@ -288,4 +288,4 @@ export {
|
|
|
288
288
|
ThreadList,
|
|
289
289
|
ThreadListItem
|
|
290
290
|
};
|
|
291
|
-
//# sourceMappingURL=chunk-
|
|
291
|
+
//# sourceMappingURL=chunk-YFPDH2JM.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from '../completion-input-
|
|
2
|
+
export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from '../completion-input-DHlwrhxB.js';
|
|
3
|
+
import '@anvia/client';
|
|
3
4
|
import '@anvia/react';
|
|
4
5
|
|
|
5
6
|
declare const Completion: {
|
package/dist/completion/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Completion
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-OVCNT3OR.js";
|
|
4
4
|
import "../chunk-T3ZFZ3NP.js";
|
|
5
5
|
import {
|
|
6
6
|
CompletionProvider,
|
|
7
7
|
useCompletionContext,
|
|
8
8
|
useCompletionInput
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-P3JZMVPK.js";
|
|
10
10
|
export {
|
|
11
11
|
Completion,
|
|
12
12
|
CompletionProvider,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ClientMetadata, ClientDataMap } from '@anvia/client';
|
|
2
|
+
import { UseCompletionResult } from '@anvia/react';
|
|
3
|
+
import { ReactNode, ReactElement } from 'react';
|
|
4
|
+
|
|
5
|
+
type CompletionController<Metadata extends ClientMetadata = ClientMetadata, Data extends ClientDataMap = ClientDataMap> = UseCompletionResult<Metadata, Data>;
|
|
6
|
+
type CompletionProviderProps<Metadata extends ClientMetadata = ClientMetadata, Data extends ClientDataMap = ClientDataMap> = {
|
|
7
|
+
controller: CompletionController<Metadata, Data>;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
declare function CompletionProvider<Metadata extends ClientMetadata = ClientMetadata, Data extends ClientDataMap = ClientDataMap>({ controller, children }: CompletionProviderProps<Metadata, Data>): ReactElement;
|
|
11
|
+
declare function useCompletionContext<Metadata extends ClientMetadata = ClientMetadata, Data extends ClientDataMap = ClientDataMap>(): CompletionController<Metadata, Data>;
|
|
12
|
+
|
|
13
|
+
type CompletionInputContextValue = {
|
|
14
|
+
input: string;
|
|
15
|
+
setInput(input: string): void;
|
|
16
|
+
submit(): Promise<void>;
|
|
17
|
+
stop(): void;
|
|
18
|
+
status: CompletionController["status"];
|
|
19
|
+
canSubmit: boolean;
|
|
20
|
+
canStop: boolean;
|
|
21
|
+
};
|
|
22
|
+
declare function useCompletionInput(): CompletionInputContextValue;
|
|
23
|
+
|
|
24
|
+
export { type CompletionController as C, type CompletionInputContextValue as a, CompletionProvider as b, type CompletionProviderProps as c, useCompletionInput as d, useCompletionContext as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CreateUIAttachment, UIAttachment } from '@anvia/
|
|
1
|
+
import { CreateUIAttachment, UIAttachment } from '@anvia/client';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { C as ChatController } from './chat-
|
|
3
|
+
import { C as ChatController } from './chat-WPrlqdvZ.js';
|
|
4
4
|
|
|
5
5
|
type ComposerEntityData = string | number | boolean | null | ComposerEntityData[] | {
|
|
6
6
|
[key: string]: ComposerEntityData | undefined;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { ToolApproval, ToolQuestion } from '@anvia/
|
|
4
|
-
import { c as useHumanInput } from '../chat-
|
|
5
|
-
export { u as useChatContext } from '../chat-
|
|
6
|
-
export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from '../human-input-
|
|
3
|
+
import { ToolApproval, ToolQuestion } from '@anvia/client';
|
|
4
|
+
import { c as useHumanInput } from '../chat-WPrlqdvZ.js';
|
|
5
|
+
export { u as useChatContext } from '../chat-WPrlqdvZ.js';
|
|
6
|
+
export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from '../human-input-Bdq46Q56.js';
|
|
7
7
|
import { P as PrimitiveProps } from '../render-CRKWam2v.js';
|
|
8
|
+
import '@anvia/react';
|
|
8
9
|
|
|
9
10
|
type ApprovalChildren = ReactNode | ((approval: ToolApproval) => ReactNode);
|
|
10
11
|
type HumanInputFilter = "pending" | "all";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HumanInput
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-G3D5YKD2.js";
|
|
4
|
+
import "../chunk-CKA4CE26.js";
|
|
4
5
|
import "../chunk-T3ZFZ3NP.js";
|
|
5
6
|
import {
|
|
6
7
|
useApproval,
|
|
@@ -8,7 +9,7 @@ import {
|
|
|
8
9
|
useHumanInput,
|
|
9
10
|
useQuestion,
|
|
10
11
|
useQuestionPrompt
|
|
11
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-P3JZMVPK.js";
|
|
12
13
|
export {
|
|
13
14
|
HumanInput,
|
|
14
15
|
useApproval,
|
package/dist/image/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as
|
|
3
|
-
import { I as ImageContextValue } from '../image-
|
|
4
|
-
export { u as useImage } from '../image-
|
|
2
|
+
import * as _anvia_client from '@anvia/client';
|
|
3
|
+
import { I as ImageContextValue } from '../image-VZv6Ddsn.js';
|
|
4
|
+
export { u as useImage } from '../image-VZv6Ddsn.js';
|
|
5
5
|
import { P as PrimitiveProps } from '../render-CRKWam2v.js';
|
|
6
6
|
|
|
7
7
|
declare const Image: {
|
|
8
8
|
readonly Root: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"figure">, "children"> & {
|
|
9
|
-
attachment?:
|
|
9
|
+
attachment?: _anvia_client.UIAttachment;
|
|
10
10
|
children?: react.ReactNode | ((image: ImageContextValue) => react.ReactNode);
|
|
11
11
|
renderWhen?: "image" | "always";
|
|
12
12
|
} & react.RefAttributes<HTMLElement>>;
|
package/dist/image/index.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { Attachment } from './attachment/index.js';
|
|
2
|
-
export { A as AttachmentContextValue, u as useAttachment } from './attachment-
|
|
3
|
-
export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-
|
|
4
|
-
export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from './completion-input-
|
|
5
|
-
export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, d as ComposerEntity, e as ComposerEntityData, f as ComposerMessageMetadata, g as ComposerQuote, h as ComposerTriggerDefinition, i as ComposerTriggerItem, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, l as ComposerTriggerState, m as ComposerTriggerStateUpdate, u as useComposer } from './composer-
|
|
6
|
-
export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-
|
|
7
|
-
export { I as ImageContextValue, u as useImage } from './image-
|
|
8
|
-
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from './message-
|
|
2
|
+
export { A as AttachmentContextValue, u as useAttachment } from './attachment-mbjsroli.js';
|
|
3
|
+
export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-WPrlqdvZ.js';
|
|
4
|
+
export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from './completion-input-DHlwrhxB.js';
|
|
5
|
+
export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, d as ComposerEntity, e as ComposerEntityData, f as ComposerMessageMetadata, g as ComposerQuote, h as ComposerTriggerDefinition, i as ComposerTriggerItem, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, l as ComposerTriggerState, m as ComposerTriggerStateUpdate, u as useComposer } from './composer-C4IJllVz.js';
|
|
6
|
+
export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-Bdq46Q56.js';
|
|
7
|
+
export { I as ImageContextValue, u as useImage } from './image-VZv6Ddsn.js';
|
|
8
|
+
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from './message-CNRnZQwU.js';
|
|
9
9
|
export { S as SelectionToolbarContextValue, a as SelectionToolbarSelection, u as useSelectionToolbar } from './selection-toolbar-Cwjbuv5S.js';
|
|
10
10
|
export { T as ThreadContextValue, u as useThread } from './thread-uEm8hH0s.js';
|
|
11
11
|
export { T as ThreadListController, a as ThreadListItemContextValue, b as ThreadListProvider, c as ThreadListProviderProps, d as ThreadListRecord, u as useThreadList, e as useThreadListItem } from './thread-list-On8db4XL.js';
|
|
@@ -22,6 +22,7 @@ export { Message, MessageAttachmentPart, MessageEntityProps, MessagePartsFilter,
|
|
|
22
22
|
export { SelectionToolbar } from './selection-toolbar/index.js';
|
|
23
23
|
export { StreamMarkdown, StreamMarkdownProps } from './stream/index.js';
|
|
24
24
|
export { ThreadList, ThreadListItem } from './thread-list/index.js';
|
|
25
|
+
import '@anvia/client';
|
|
25
26
|
import 'react-markdown';
|
|
26
27
|
|
|
27
28
|
type ContextUsage = NonNullable<UseChatResult["contextUsage"]>;
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SelectionToolbar
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-R5FQUAAE.js";
|
|
4
4
|
import {
|
|
5
5
|
ThreadList,
|
|
6
6
|
ThreadListItem
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YFPDH2JM.js";
|
|
8
8
|
import {
|
|
9
9
|
Composer,
|
|
10
10
|
Thread
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-3OVUVDNY.js";
|
|
12
12
|
import {
|
|
13
13
|
Completion
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-OVCNT3OR.js";
|
|
15
15
|
import {
|
|
16
16
|
HumanInput
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-G3D5YKD2.js";
|
|
18
18
|
import {
|
|
19
19
|
Image
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-OUWDPMJK.js";
|
|
21
21
|
import {
|
|
22
22
|
Message
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-PBR53CKI.js";
|
|
24
24
|
import {
|
|
25
25
|
StreamMarkdown
|
|
26
26
|
} from "./chunk-ULGJLLZE.js";
|
|
27
27
|
import {
|
|
28
28
|
Attachment
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-6J6XAQNS.js";
|
|
30
|
+
import "./chunk-CKA4CE26.js";
|
|
30
31
|
import {
|
|
31
32
|
renderPrimitive
|
|
32
33
|
} from "./chunk-T3ZFZ3NP.js";
|
|
@@ -50,7 +51,7 @@ import {
|
|
|
50
51
|
useThread,
|
|
51
52
|
useThreadList,
|
|
52
53
|
useThreadListItem
|
|
53
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-P3JZMVPK.js";
|
|
54
55
|
|
|
55
56
|
// src/context-meter.tsx
|
|
56
57
|
import { forwardRef } from "react";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/context-meter.tsx"],"sourcesContent":["import type { UseChatResult } from \"@anvia/react\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nimport { type PrimitiveProps, renderPrimitive } from \"./primitives\";\n\ntype ContextUsage = NonNullable<UseChatResult[\"contextUsage\"]>;\n\nexport type ContextMeterProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n usage?: ContextUsage;\n display?: \"remaining\" | \"used\";\n children?: ReactNode | ((usage: ContextUsage) => ReactNode);\n};\n\nexport const ContextMeter = forwardRef<HTMLDivElement, ContextMeterProps>(function ContextMeter(\n { usage, display = \"remaining\", children, ...props },\n ref,\n) {\n if (usage === undefined) {\n return null;\n }\n\n const percent = display === \"remaining\" ? usage.remainingPercent : usage.usedPercent;\n const roundedPercent = Math.round(percent);\n const label = `${roundedPercent}% context ${display === \"remaining\" ? \"left\" : \"used\"}`;\n const content =\n typeof children === \"function\"\n ? children(usage)\n : (children ?? (\n <>\n <span data-anvia-context-meter-label=\"\">{label}</span>\n <span aria-hidden=\"true\" data-anvia-context-meter-track=\"\">\n <span\n data-anvia-context-meter-value=\"\"\n style={{ width: `${Math.min(100, Math.max(0, percent))}%` }}\n />\n </span>\n </>\n ));\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: content,\n \"aria-label\": props[\"aria-label\"] ?? label,\n \"aria-valuemax\": 100,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": roundedPercent,\n \"data-anvia-context-meter\": \"\",\n \"data-display\": display,\n role: props.role ?? \"progressbar\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/context-meter.tsx"],"sourcesContent":["import type { UseChatResult } from \"@anvia/react\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nimport { type PrimitiveProps, renderPrimitive } from \"./primitives\";\n\ntype ContextUsage = NonNullable<UseChatResult[\"contextUsage\"]>;\n\nexport type ContextMeterProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n usage?: ContextUsage;\n display?: \"remaining\" | \"used\";\n children?: ReactNode | ((usage: ContextUsage) => ReactNode);\n};\n\nexport const ContextMeter = forwardRef<HTMLDivElement, ContextMeterProps>(function ContextMeter(\n { usage, display = \"remaining\", children, ...props },\n ref,\n) {\n if (usage === undefined) {\n return null;\n }\n\n const percent = display === \"remaining\" ? usage.remainingPercent : usage.usedPercent;\n const roundedPercent = Math.round(percent);\n const label = `${roundedPercent}% context ${display === \"remaining\" ? \"left\" : \"used\"}`;\n const content =\n typeof children === \"function\"\n ? children(usage)\n : (children ?? (\n <>\n <span data-anvia-context-meter-label=\"\">{label}</span>\n <span aria-hidden=\"true\" data-anvia-context-meter-track=\"\">\n <span\n data-anvia-context-meter-value=\"\"\n style={{ width: `${Math.min(100, Math.max(0, percent))}%` }}\n />\n </span>\n </>\n ));\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: content,\n \"aria-label\": props[\"aria-label\"] ?? label,\n \"aria-valuemax\": 100,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": roundedPercent,\n \"data-anvia-context-meter\": \"\",\n \"data-display\": display,\n role: props.role ?? \"progressbar\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,kBAAkC;AA2BjC,mBACE,KADF;AAfH,IAAM,eAAe,WAA8C,SAASA,cACjF,EAAE,OAAO,UAAU,aAAa,UAAU,GAAG,MAAM,GACnD,KACA;AACA,MAAI,UAAU,QAAW;AACvB,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,YAAY,cAAc,MAAM,mBAAmB,MAAM;AACzE,QAAM,iBAAiB,KAAK,MAAM,OAAO;AACzC,QAAM,QAAQ,GAAG,cAAc,aAAa,YAAY,cAAc,SAAS,MAAM;AACrF,QAAM,UACJ,OAAO,aAAa,aAChB,SAAS,KAAK,IACb,YACC,iCACE;AAAA,wBAAC,UAAK,kCAA+B,IAAI,iBAAM;AAAA,IAC/C,oBAAC,UAAK,eAAY,QAAO,kCAA+B,IACtD;AAAA,MAAC;AAAA;AAAA,QACC,kCAA+B;AAAA,QAC/B,OAAO,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,CAAC,IAAI;AAAA;AAAA,IAC5D,GACF;AAAA,KACF;AAGR,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,UAAU;AAAA,MACV,cAAc,MAAM,YAAY,KAAK;AAAA,MACrC,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,MACjB,4BAA4B;AAAA,MAC5B,gBAAgB;AAAA,MAChB,MAAM,MAAM,QAAQ;AAAA,IACtB;AAAA,IACA;AAAA,EACF;AACF,CAAC;","names":["ContextMeter"]}
|
package/dist/message/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as react_markdown from 'react-markdown';
|
|
2
|
-
import * as
|
|
3
|
-
import { UIMessagePart
|
|
2
|
+
import * as _anvia_client from '@anvia/client';
|
|
3
|
+
import { UIMessagePart } from '@anvia/client';
|
|
4
|
+
import { StreamSmoothingLifecycle } from '@anvia/react';
|
|
4
5
|
import * as react from 'react';
|
|
5
6
|
import { HTMLAttributes } from 'react';
|
|
6
|
-
export { u as useChatContext } from '../chat-
|
|
7
|
-
import { d as ComposerEntity } from '../composer-
|
|
8
|
-
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from '../message-
|
|
7
|
+
export { u as useChatContext } from '../chat-WPrlqdvZ.js';
|
|
8
|
+
import { d as ComposerEntity } from '../composer-C4IJllVz.js';
|
|
9
|
+
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from '../message-CNRnZQwU.js';
|
|
9
10
|
import { P as PrimitiveProps } from '../render-CRKWam2v.js';
|
|
10
11
|
|
|
11
12
|
type MessagePartsFilter = (part: UIMessagePart) => boolean;
|
|
@@ -24,19 +25,19 @@ type MessageEntityProps = HTMLAttributes<HTMLSpanElement> & {
|
|
|
24
25
|
|
|
25
26
|
declare const Message: {
|
|
26
27
|
readonly Root: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"article">, "children"> & {
|
|
27
|
-
children?: react.ReactNode | ((message:
|
|
28
|
+
children?: react.ReactNode | ((message: _anvia_client.UIMessage) => react.ReactNode);
|
|
28
29
|
} & react.RefAttributes<HTMLElement>>;
|
|
29
30
|
readonly Content: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
30
31
|
asChild?: boolean;
|
|
31
32
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
32
33
|
readonly Parts: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
33
|
-
children?: react.ReactNode | ((part:
|
|
34
|
+
children?: react.ReactNode | ((part: _anvia_client.UIMessagePart) => react.ReactNode);
|
|
34
35
|
filter?: MessagePartsFilter;
|
|
35
36
|
} & {
|
|
36
37
|
stream?: MessageStreamOptions;
|
|
37
38
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
38
39
|
readonly Part: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
39
|
-
children?: react.ReactNode | ((part:
|
|
40
|
+
children?: react.ReactNode | ((part: _anvia_client.UIMessagePart) => react.ReactNode);
|
|
40
41
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
41
42
|
readonly Text: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "asChild"> & {
|
|
42
43
|
asChild?: boolean;
|
|
@@ -82,7 +83,7 @@ declare const Message: {
|
|
|
82
83
|
asChild?: boolean;
|
|
83
84
|
} & react.RefAttributes<HTMLSpanElement>>;
|
|
84
85
|
readonly Attachment: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
85
|
-
children?: react.ReactNode | ((attachment:
|
|
86
|
+
children?: react.ReactNode | ((attachment: _anvia_client.UIAttachment) => react.ReactNode);
|
|
86
87
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
87
88
|
readonly Data: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLPreElement>, HTMLPreElement>, "ref">, "asChild"> & {
|
|
88
89
|
asChild?: boolean;
|
package/dist/message/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Message
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-PBR53CKI.js";
|
|
4
4
|
import "../chunk-ULGJLLZE.js";
|
|
5
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-6J6XAQNS.js";
|
|
6
|
+
import "../chunk-CKA4CE26.js";
|
|
6
7
|
import "../chunk-T3ZFZ3NP.js";
|
|
7
8
|
import {
|
|
8
9
|
useChatContext,
|
|
9
10
|
useMessage,
|
|
10
11
|
useMessagePart
|
|
11
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-P3JZMVPK.js";
|
|
12
13
|
export {
|
|
13
14
|
Message,
|
|
14
15
|
useChatContext,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SelectionToolbar
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-R5FQUAAE.js";
|
|
4
4
|
import "../chunk-T3ZFZ3NP.js";
|
|
5
5
|
import {
|
|
6
6
|
useSelectionToolbar
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-P3JZMVPK.js";
|
|
8
8
|
export {
|
|
9
9
|
SelectionToolbar,
|
|
10
10
|
useSelectionToolbar
|
package/dist/shared.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
export { A as AttachmentContextValue, u as useAttachment } from './attachment-
|
|
2
|
-
export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-
|
|
3
|
-
export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from './completion-input-
|
|
4
|
-
export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, d as ComposerEntity, e as ComposerEntityData, f as ComposerMessageMetadata, g as ComposerQuote, h as ComposerTriggerDefinition, i as ComposerTriggerItem, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, l as ComposerTriggerState, m as ComposerTriggerStateUpdate, u as useComposer } from './composer-
|
|
5
|
-
export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-
|
|
6
|
-
export { I as ImageContextValue, u as useImage } from './image-
|
|
7
|
-
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from './message-
|
|
1
|
+
export { A as AttachmentContextValue, u as useAttachment } from './attachment-mbjsroli.js';
|
|
2
|
+
export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-WPrlqdvZ.js';
|
|
3
|
+
export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from './completion-input-DHlwrhxB.js';
|
|
4
|
+
export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, d as ComposerEntity, e as ComposerEntityData, f as ComposerMessageMetadata, g as ComposerQuote, h as ComposerTriggerDefinition, i as ComposerTriggerItem, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, l as ComposerTriggerState, m as ComposerTriggerStateUpdate, u as useComposer } from './composer-C4IJllVz.js';
|
|
5
|
+
export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-Bdq46Q56.js';
|
|
6
|
+
export { I as ImageContextValue, u as useImage } from './image-VZv6Ddsn.js';
|
|
7
|
+
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from './message-CNRnZQwU.js';
|
|
8
8
|
export { S as SelectionToolbarContextValue, a as SelectionToolbarSelection, u as useSelectionToolbar } from './selection-toolbar-Cwjbuv5S.js';
|
|
9
9
|
export { T as ThreadContextValue, u as useThread } from './thread-uEm8hH0s.js';
|
|
10
10
|
export { T as ThreadListController, a as ThreadListItemContextValue, b as ThreadListProvider, c as ThreadListProviderProps, d as ThreadListRecord, u as useThreadList, e as useThreadListItem } from './thread-list-On8db4XL.js';
|
|
11
11
|
export { P as PrimitiveProps, a as PrimitiveRef } from './render-CRKWam2v.js';
|
|
12
|
+
import '@anvia/client';
|
|
12
13
|
import '@anvia/react';
|
|
13
14
|
import 'react';
|
package/dist/shared.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ThreadList,
|
|
3
3
|
ThreadListItem
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-YFPDH2JM.js";
|
|
5
5
|
import "../chunk-T3ZFZ3NP.js";
|
|
6
6
|
import {
|
|
7
7
|
ThreadListProvider,
|
|
8
8
|
useThreadList,
|
|
9
9
|
useThreadListItem
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-P3JZMVPK.js";
|
|
11
11
|
export {
|
|
12
12
|
ThreadList,
|
|
13
13
|
ThreadListItem,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anvia/react-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-rc.2",
|
|
4
4
|
"description": "Composable React UI primitives for Anvia chat and completion experiences.",
|
|
5
5
|
"author": "anvia",
|
|
6
6
|
"maintainer": "Indra Zulfi",
|
|
@@ -69,24 +69,25 @@
|
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@radix-ui/react-slot": "^1.3.3",
|
|
72
|
-
"@tiptap/core": "^3.
|
|
73
|
-
"@tiptap/extension-document": "^3.
|
|
74
|
-
"@tiptap/extension-hard-break": "^3.
|
|
75
|
-
"@tiptap/extension-mention": "^3.
|
|
76
|
-
"@tiptap/extension-paragraph": "^3.
|
|
77
|
-
"@tiptap/extension-placeholder": "^3.
|
|
78
|
-
"@tiptap/extension-text": "^3.
|
|
79
|
-
"@tiptap/pm": "^3.
|
|
80
|
-
"@tiptap/react": "^3.
|
|
81
|
-
"@tiptap/suggestion": "^3.
|
|
72
|
+
"@tiptap/core": "^3.30.1",
|
|
73
|
+
"@tiptap/extension-document": "^3.30.1",
|
|
74
|
+
"@tiptap/extension-hard-break": "^3.30.1",
|
|
75
|
+
"@tiptap/extension-mention": "^3.30.1",
|
|
76
|
+
"@tiptap/extension-paragraph": "^3.30.1",
|
|
77
|
+
"@tiptap/extension-placeholder": "^3.30.1",
|
|
78
|
+
"@tiptap/extension-text": "^3.30.1",
|
|
79
|
+
"@tiptap/pm": "^3.30.1",
|
|
80
|
+
"@tiptap/react": "^3.30.1",
|
|
81
|
+
"@tiptap/suggestion": "^3.30.1",
|
|
82
82
|
"marked": "^18.0.9",
|
|
83
83
|
"react-markdown": "^10.1.0",
|
|
84
84
|
"remark-gfm": "^4.0.1"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
|
-
"@anvia/react": ">=0.9.0 <1.0.0",
|
|
88
87
|
"react": ">=18",
|
|
89
|
-
"react-dom": ">=18"
|
|
88
|
+
"react-dom": ">=18",
|
|
89
|
+
"@anvia/client": "1.0.0-rc.2",
|
|
90
|
+
"@anvia/react": "1.0.0-rc.2"
|
|
90
91
|
},
|
|
91
92
|
"devDependencies": {
|
|
92
93
|
"@testing-library/react": "^16.3.2",
|
|
@@ -100,7 +101,8 @@
|
|
|
100
101
|
"tsup": "^8.5.0",
|
|
101
102
|
"typescript": "^5.9.3",
|
|
102
103
|
"vitest": "^4.0.8",
|
|
103
|
-
"@anvia/
|
|
104
|
+
"@anvia/client": "1.0.0-rc.2",
|
|
105
|
+
"@anvia/react": "1.0.0-rc.2"
|
|
104
106
|
},
|
|
105
107
|
"scripts": {
|
|
106
108
|
"build": "tsup src/index.ts src/attachment/index.ts src/chat/index.ts src/completion/index.ts src/human-input/index.ts src/image/index.ts src/message/index.ts src/selection-toolbar/index.ts src/shared.ts src/stream/index.ts src/thread-list/index.ts --format esm --dts --sourcemap --clean --external react --external react-dom && cp src/styles.css dist/styles.css && cp src/stream/styles.css dist/stream/styles.css",
|
package/dist/chat-B3kucz1w.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { UseChatResult } from '@anvia/react';
|
|
2
|
-
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
|
|
4
|
-
type ChatController<TEvent = unknown> = UseChatResult<TEvent>;
|
|
5
|
-
type ChatProviderProps<TEvent = unknown> = {
|
|
6
|
-
controller: ChatController<TEvent>;
|
|
7
|
-
children?: ReactNode;
|
|
8
|
-
};
|
|
9
|
-
declare function ChatProvider<TEvent = unknown>({ controller, children, }: ChatProviderProps<TEvent>): ReactElement;
|
|
10
|
-
declare function useChatContext<TEvent = unknown>(): ChatController<TEvent>;
|
|
11
|
-
declare function useHumanInput(): ChatController["humanInput"];
|
|
12
|
-
|
|
13
|
-
export { type ChatController as C, ChatProvider as a, type ChatProviderProps as b, useHumanInput as c, useChatContext as u };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/contexts/attachment.tsx","../src/contexts/chat.tsx","../src/contexts/completion.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/react\";\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 Attachment.Root.\");\n }\n return value;\n}\n\nexport function useOptionalAttachment(): AttachmentContextValue | undefined {\n return useContext(AttachmentContext);\n}\n","import type { UseChatResult } from \"@anvia/react\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type ChatController<TEvent = unknown> = UseChatResult<TEvent>;\n\nexport type ChatProviderProps<TEvent = unknown> = {\n controller: ChatController<TEvent>;\n children?: ReactNode;\n};\n\nconst ChatContext = createContext<ChatController | undefined>(undefined);\n\nexport function ChatProvider<TEvent = unknown>({\n controller,\n children,\n}: ChatProviderProps<TEvent>): ReactElement {\n return createElement(ChatContext.Provider, { value: controller as ChatController }, children);\n}\n\nexport function useChatContext<TEvent = unknown>(): ChatController<TEvent> {\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 ChatController<TEvent>;\n}\n\nexport function useHumanInput(): ChatController[\"humanInput\"] {\n return useChatContext().humanInput;\n}\n","import type { UseCompletionResult } from \"@anvia/react\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type CompletionController<TEvent = unknown> = UseCompletionResult<TEvent>;\n\nexport type CompletionProviderProps<TEvent = unknown> = {\n controller: CompletionController<TEvent>;\n children?: ReactNode;\n};\n\nconst CompletionContext = createContext<CompletionController | undefined>(undefined);\n\nexport function CompletionProvider<TEvent = unknown>({\n controller,\n children,\n}: CompletionProviderProps<TEvent>): ReactElement {\n return createElement(\n CompletionContext.Provider,\n { value: controller as CompletionController },\n children,\n );\n}\n\nexport function useCompletionContext<TEvent = unknown>(): CompletionController<TEvent> {\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 CompletionController<TEvent>;\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 Completion.Form.\");\n }\n return value;\n}\n","import type { CreateUIAttachment, UIAttachment } from \"@anvia/react\";\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 | ComposerEntityData[]\n | { [key: string]: ComposerEntityData | undefined };\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};\nexport type ComposerMessageMetadata = {\n composer: {\n entities: ComposerEntity[];\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 Composer.Root.\");\n }\n return value;\n}\n","import type {\n ToolApproval,\n ToolQuestion,\n ToolQuestionAnswer,\n ToolQuestionPrompt,\n} from \"@anvia/react\";\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: ToolApproval;\n reason: string;\n setReason(reason: string): void;\n};\n\nexport type QuestionContextValue = {\n question: ToolQuestion;\n answers: Record<string, ToolQuestionAnswer>;\n setAnswer(prompt: ToolQuestionPrompt, answer: ToolQuestionAnswer): void;\n};\n\nexport type QuestionPromptContextValue = {\n prompt: ToolQuestionPrompt;\n};\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: ToolApproval;\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: ToolQuestionPrompt;\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 HumanInput.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 HumanInput.Question.\");\n }\n return value;\n}\n\nexport function useQuestionPrompt(): QuestionPromptContextValue {\n const value = useContext(QuestionPromptContext);\n if (value === undefined) {\n throw new Error(\"Question choice primitives must be used inside HumanInput.QuestionPrompt.\");\n }\n return value;\n}\n","import type { UIAttachment } from \"@anvia/react\";\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 Image.Root.\");\n }\n return value;\n}\n","import type { UIMessage, UIMessagePart } from \"@anvia/react\";\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(\"Message primitives must be used inside Message.Root or Thread.Messages.\");\n }\n return value;\n}\n\nexport function useMessagePart(): MessagePartContextValue {\n const value = useContext(MessagePartContext);\n if (value === undefined) {\n throw new Error(\"Message part primitives must be used inside Message.Parts or Message.Part.\");\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(\"SelectionToolbar primitives must be used inside SelectionToolbar.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 ThreadContextValue = {\n viewportRef: 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 Thread.Root.\");\n }\n return value;\n}\n","import { createContext, createElement, type ReactElement, type ReactNode, useContext } 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\nconst ThreadListContext = createContext<ThreadListController | undefined>(undefined);\nconst ThreadListItemContext = createContext<ThreadListItemContextValue | undefined>(undefined);\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 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 ThreadList.Items.\");\n }\n return value;\n}\n"],"mappings":";AACA,SAAS,eAAe,eAAkD,kBAAkB;AAO5F,IAAM,oBAAoB,cAAkD,MAAS;AAE9E,SAAS,2BAA2B;AAAA,EACzC;AAAA,EACA;AACF,GAGiB;AACf,SAAO,cAAc,kBAAkB,UAAU,EAAE,MAAM,GAAG,QAAQ;AACtE;AAEO,SAAS,gBAAwC;AACtD,QAAM,QAAQ,WAAW,iBAAiB;AAC1C,MAAI,UAAU,QAAW;AACvB,UAAM,IAAI,MAAM,4DAA4D;AAAA,EAC9E;AACA,SAAO;AACT;AAEO,SAAS,wBAA4D;AAC1E,SAAO,WAAW,iBAAiB;AACrC;;;AC7BA,SAAS,iBAAAA,gBAAe,iBAAAC,gBAAkD,cAAAC,mBAAkB;AAS5F,IAAM,cAAcF,eAA0C,MAAS;AAEhE,SAAS,aAA+B;AAAA,EAC7C;AAAA,EACA;AACF,GAA4C;AAC1C,SAAOC,eAAc,YAAY,UAAU,EAAE,OAAO,WAA6B,GAAG,QAAQ;AAC9F;AAEO,SAAS,iBAA2D;AACzE,QAAM,QAAQC,YAAW,WAAW;AACpC,MAAI,UAAU,QAAW;AACvB,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AACA,SAAO;AACT;AAEO,SAAS,gBAA8C;AAC5D,SAAO,eAAe,EAAE;AAC1B;;;AC5BA,SAAS,iBAAAC,gBAAe,iBAAAC,gBAAkD,cAAAC,mBAAkB;AAS5F,IAAM,oBAAoBF,eAAgD,MAAS;AAE5E,SAAS,mBAAqC;AAAA,EACnD;AAAA,EACA;AACF,GAAkD;AAChD,SAAOC;AAAA,IACL,kBAAkB;AAAA,IAClB,EAAE,OAAO,WAAmC;AAAA,IAC5C;AAAA,EACF;AACF;AAEO,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GiB;AACf,SAAOC,gBAAc,cAAc,UAAU,EAAE,MAAM,GAAG,QAAQ;AAClE;AAEO,SAAS,YAAgC;AAC9C,QAAM,QAAQC,aAAW,aAAa;AACtC,MAAI,UAAU,QAAW;AACvB,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACA,SAAO;AACT;;;AClCA,SAAS,iBAAAC,iBAAe,iBAAAC,iBAAkD,cAAAC,oBAAkB;AAiC5F,IAAM,oBAAoBF,gBAAgD,MAAS;AACnF,IAAM,wBAAwBA,gBAAsD,MAAS;AAEtF,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,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,iEAAiE;AAAA,EACnF;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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/image/parts.tsx","../src/image/index.ts"],"sourcesContent":["import type { UIAttachment } from \"@anvia/react\";\nimport {\n forwardRef,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport {\n type ImageContextValue,\n InternalImageProvider,\n useImage,\n useOptionalAttachment,\n} from \"../contexts\";\nimport { composeRefs, type PrimitiveProps, renderPrimitive } from \"../primitives\";\n\ntype ImageRootChildren = ReactNode | ((image: ImageContextValue) => ReactNode);\ntype ImageRenderWhen = \"image\" | \"always\";\n\ntype ImageRootProps = Omit<PrimitiveProps<\"figure\">, \"children\"> & {\n attachment?: UIAttachment;\n children?: ImageRootChildren;\n renderWhen?: ImageRenderWhen;\n};\n\nconst ImageRoot = forwardRef<HTMLElement, ImageRootProps>(function ImageRoot(\n { attachment: attachmentProp, children, renderWhen = \"image\", ...props },\n ref,\n) {\n const attachmentContext = useOptionalAttachment();\n const attachment = attachmentProp ?? attachmentContext?.attachment;\n const [zoomOpen, setZoomOpen] = useState(false);\n\n if (attachment === undefined) {\n throw new Error(\"Image.Root requires an attachment prop or Attachment context.\");\n }\n\n const src = imageSource(attachment);\n const isImage = isImageAttachment(attachment);\n const value = useMemo<ImageContextValue>(() => {\n const context: ImageContextValue = {\n attachment,\n isImage,\n zoomOpen,\n setZoomOpen,\n };\n if (src !== undefined) context.src = src;\n if (attachment.name !== undefined) context.name = attachment.name;\n if (attachment.mediaType !== undefined) context.mediaType = attachment.mediaType;\n return context;\n }, [attachment, attachment.mediaType, attachment.name, isImage, src, zoomOpen]);\n if (!isImage && renderWhen !== \"always\") {\n return null;\n }\n\n const renderedChildren = typeof children === \"function\" ? children(value) : children;\n\n return (\n <InternalImageProvider value={value}>\n {renderPrimitive(\n \"figure\",\n {\n ...props,\n children: renderedChildren ?? (\n <>\n <ImagePreview />\n <ImageName />\n </>\n ),\n \"data-anvia-image\": \"\",\n \"data-state\": src === undefined ? \"unavailable\" : \"ready\",\n \"data-type\": attachment.type,\n } as PrimitiveProps<\"figure\">,\n ref,\n )}\n </InternalImageProvider>\n );\n});\n\ntype ImagePreviewProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n alt?: string;\n errorFallback?: ReactNode;\n loadingFallback?: ReactNode;\n};\n\nconst ImagePreview = forwardRef<HTMLDivElement, ImagePreviewProps>(function ImagePreview(\n { alt, errorFallback, loadingFallback, ...props },\n ref,\n) {\n const image = useImage();\n const [state, setState] = useState<\"loading\" | \"ready\" | \"error\">(\n image.src === undefined ? \"error\" : \"loading\",\n );\n\n useEffect(() => {\n setState(image.src === undefined ? \"error\" : \"loading\");\n }, [image.src]);\n\n const fallback =\n state === \"loading\"\n ? (loadingFallback ?? \"Loading image\")\n : state === \"error\"\n ? (errorFallback ?? \"Image unavailable\")\n : null;\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children:\n image.src === undefined ? (\n fallback\n ) : (\n <>\n {state === \"ready\" ? null : <span data-anvia-image-fallback=\"\">{fallback}</span>}\n <img\n alt={alt ?? image.name ?? \"Image\"}\n data-anvia-image-img=\"\"\n hidden={state !== \"ready\"}\n onError={() => setState(\"error\")}\n onLoad={() => setState(\"ready\")}\n src={image.src}\n />\n </>\n ),\n \"data-anvia-image-preview\": \"\",\n \"data-state\": state,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n});\n\nconst ImageName = forwardRef<HTMLElement, PrimitiveProps<\"figcaption\">>(\n function ImageName(props, ref) {\n const image = useImage();\n\n return renderPrimitive(\n \"figcaption\",\n {\n ...props,\n children: props.children ?? image.name ?? image.mediaType ?? image.attachment.type,\n \"data-anvia-image-name\": \"\",\n } as PrimitiveProps<\"figcaption\">,\n ref,\n );\n },\n);\n\nconst ImageActions = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function ImageActions(props, ref) {\n return renderPrimitive(\n \"div\",\n {\n ...props,\n \"data-anvia-image-actions\": \"\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype ImageActionState = \"idle\" | \"done\" | \"error\";\n\nconst ImageCopy = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(function ImageCopy(\n { onClick, ...props },\n ref,\n) {\n const image = useImage();\n const [copyState, setCopyState] = useState<ImageActionState>(\"idle\");\n const disabled = props.disabled ?? image.src === undefined;\n\n const handleClick = useCallback(\n async (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled || image.src === undefined) {\n return;\n }\n try {\n await copyImage(image);\n setCopyState(\"done\");\n } catch {\n setCopyState(\"error\");\n }\n },\n [disabled, image, onClick],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Copy image\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-anvia-image-copy\": \"\",\n \"data-state\": copyState,\n } as PrimitiveProps<\"button\">,\n ref,\n );\n});\n\ntype ImageDownloadProps = PrimitiveProps<\"button\"> & {\n filename?: string;\n};\n\nconst ImageDownload = forwardRef<HTMLButtonElement, ImageDownloadProps>(function ImageDownload(\n { filename, onClick, ...props },\n ref,\n) {\n const image = useImage();\n const disabled = props.disabled ?? image.src === undefined;\n\n const handleClick = useCallback(\n async (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled || image.src === undefined) {\n return;\n }\n try {\n await downloadImage(image, filename);\n } catch {\n return;\n }\n },\n [disabled, filename, image, onClick],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Download\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-anvia-image-download\": \"\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n});\n\nconst ImageZoomTrigger = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function ImageZoomTrigger({ onClick, ...props }, ref) {\n const image = useImage();\n const disabled = props.disabled ?? image.src === undefined;\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) {\n return;\n }\n image.setZoomOpen(true);\n },\n [disabled, image, onClick],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Open image\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-anvia-image-zoom-trigger\": \"\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\ntype ImageZoomOverlayProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n container?: Element | DocumentFragment;\n};\n\nconst ImageZoomOverlay = forwardRef<HTMLDivElement, ImageZoomOverlayProps>(\n function ImageZoomOverlay({ container, onClick, onKeyDown, ...props }, ref) {\n const image = useImage();\n const portalContainer = container ?? globalThis.document?.body;\n const overlayRef = useRef<HTMLDivElement | null>(null);\n const composedRef = useMemo(() => composeRefs(overlayRef, ref), [ref]);\n\n useEffect(() => {\n if (!image.zoomOpen) {\n return;\n }\n const document = globalThis.document;\n if (document === undefined) {\n return;\n }\n const handleKeyDown = (event: globalThis.KeyboardEvent) => {\n if (event.key === \"Escape\") {\n image.setZoomOpen(false);\n }\n };\n document.addEventListener(\"keydown\", handleKeyDown);\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [image.setZoomOpen, image.zoomOpen]);\n\n useEffect(() => {\n if (!image.zoomOpen) {\n return;\n }\n const activeElement = globalThis.document?.activeElement;\n const previousFocus = activeElement instanceof HTMLElement ? activeElement : undefined;\n focusOverlay(overlayRef.current);\n return () => {\n if (previousFocus?.isConnected === true) {\n previousFocus.focus();\n }\n };\n }, [image.zoomOpen]);\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLDivElement>) => {\n onClick?.(event);\n if (!event.defaultPrevented) {\n image.setZoomOpen(false);\n }\n },\n [image, onClick],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) {\n return;\n }\n if (event.key === \"Escape\") {\n image.setZoomOpen(false);\n return;\n }\n if (event.key === \"Tab\") {\n trapOverlayFocus(event, overlayRef.current);\n }\n },\n [image, onKeyDown],\n );\n\n if (!image.zoomOpen || image.src === undefined || portalContainer === undefined) {\n return null;\n }\n\n const overlay = renderPrimitive(\n \"div\",\n {\n ...props,\n children: <img alt={image.name ?? \"Image\"} data-anvia-image-zoom-img=\"\" src={image.src} />,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n \"aria-modal\": props[\"aria-modal\"] ?? true,\n role: props.role ?? \"dialog\",\n tabIndex: props.tabIndex ?? -1,\n \"data-anvia-image-zoom-overlay\": \"\",\n } as PrimitiveProps<\"div\">,\n composedRef,\n );\n\n return createPortal(overlay, portalContainer);\n },\n);\n\nfunction isImageAttachment(attachment: UIAttachment): boolean {\n return attachment.type === \"image\" || attachment.mediaType?.startsWith(\"image/\") === true;\n}\n\nfunction imageSource(attachment: UIAttachment): string | undefined {\n if (!isImageAttachment(attachment)) {\n return attachment.url;\n }\n if (attachment.url !== undefined) {\n return attachment.url;\n }\n if (attachment.data !== undefined && attachment.mediaType !== undefined) {\n return `data:${attachment.mediaType};base64,${attachment.data}`;\n }\n return undefined;\n}\n\nasync function copyImage(image: ImageContextValue): Promise<void> {\n if (image.src === undefined) {\n throw new Error(\"Image source is unavailable.\");\n }\n const clipboard = globalThis.navigator?.clipboard as\n | (Clipboard & { write?: (items: ClipboardItem[]) => Promise<void> })\n | undefined;\n const ClipboardItemConstructor = globalThis.ClipboardItem;\n if (clipboard?.write === undefined || ClipboardItemConstructor === undefined) {\n throw new Error(\"Clipboard image copy is unavailable.\");\n }\n const blob = await imageBlob(image);\n await clipboard.write([new ClipboardItemConstructor({ [blob.type]: blob })]);\n}\n\nasync function imageBlob(image: ImageContextValue): Promise<Blob> {\n if (image.attachment.data !== undefined) {\n return base64ToBlob(\n image.attachment.data,\n image.attachment.mediaType ?? image.mediaType ?? \"image/png\",\n );\n }\n if (image.src === undefined || globalThis.fetch === undefined) {\n throw new Error(\"Image source is unavailable.\");\n }\n const response = await fetch(image.src);\n return response.blob();\n}\n\nfunction base64ToBlob(data: string, mediaType: string): Blob {\n const binary = globalThis.atob(data);\n const bytes = new Uint8Array(binary.length);\n for (let index = 0; index < binary.length; index += 1) {\n bytes[index] = binary.charCodeAt(index);\n }\n return new Blob([bytes], { type: mediaType });\n}\n\nasync function downloadImage(\n image: ImageContextValue,\n filename: string | undefined,\n): Promise<void> {\n const document = globalThis.document;\n const url = globalThis.URL;\n if (image.src === undefined || document === undefined || url?.createObjectURL === undefined) {\n return;\n }\n const blobUrl = url.createObjectURL(await imageBlob(image));\n const link = document.createElement(\"a\");\n try {\n link.href = blobUrl;\n link.download = filename ?? image.name ?? defaultImageFilename(image);\n link.rel = \"noopener\";\n document.body.append(link);\n link.click();\n } finally {\n link.remove();\n url.revokeObjectURL(blobUrl);\n }\n}\n\nfunction defaultImageFilename(image: ImageContextValue): string {\n const extension = image.mediaType?.split(\"/\")[1]?.split(\";\")[0] ?? \"png\";\n return `image.${extension}`;\n}\n\nfunction focusOverlay(overlay: HTMLDivElement | null): void {\n if (overlay === null) {\n return;\n }\n const [firstFocusable] = focusableElements(overlay);\n (firstFocusable ?? overlay).focus();\n}\n\nfunction trapOverlayFocus(\n event: KeyboardEvent<HTMLDivElement>,\n overlay: HTMLDivElement | null,\n): void {\n if (overlay === null) {\n return;\n }\n const focusable = focusableElements(overlay);\n if (focusable.length === 0) {\n event.preventDefault();\n overlay.focus();\n return;\n }\n\n const firstFocusable = focusable[0];\n const lastFocusable = focusable[focusable.length - 1];\n const activeElement = globalThis.document?.activeElement;\n if (event.shiftKey && activeElement === firstFocusable) {\n event.preventDefault();\n lastFocusable?.focus();\n return;\n }\n if (!event.shiftKey && activeElement === lastFocusable) {\n event.preventDefault();\n firstFocusable?.focus();\n return;\n }\n if (activeElement instanceof Node && !overlay.contains(activeElement)) {\n event.preventDefault();\n (event.shiftKey ? lastFocusable : firstFocusable)?.focus();\n }\n}\n\nfunction focusableElements(container: HTMLElement): HTMLElement[] {\n return Array.from(\n container.querySelectorAll<HTMLElement>(\n [\n \"a[href]\",\n \"button:not(:disabled)\",\n \"input:not(:disabled)\",\n \"select:not(:disabled)\",\n \"textarea:not(:disabled)\",\n \"[tabindex]\",\n ].join(\",\"),\n ),\n ).filter((element) => element.tabIndex >= 0 && element.getAttribute(\"aria-hidden\") !== \"true\");\n}\n\nexport {\n ImageActions,\n ImageCopy,\n ImageDownload,\n ImageName,\n ImagePreview,\n ImageRoot,\n ImageZoomOverlay,\n ImageZoomTrigger,\n};\n","import {\n ImageActions,\n ImageCopy,\n ImageDownload,\n ImageName,\n ImagePreview,\n ImageRoot,\n ImageZoomOverlay,\n ImageZoomTrigger,\n} from \"./parts\";\n\nexport const Image = {\n Root: ImageRoot,\n Preview: ImagePreview,\n Name: ImageName,\n Actions: ImageActions,\n Copy: ImageCopy,\n Download: ImageDownload,\n ZoomTrigger: ImageZoomTrigger,\n ZoomOverlay: ImageZoomOverlay,\n} as const;\n\nexport type { ImageContextValue } from \"../contexts\";\nexport { useImage } from \"../contexts\";\n"],"mappings":";;;;;;;;;;;AACA;AAAA,EACE;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AA0DjB,mBACE,KADF;AAvCZ,IAAM,YAAY,WAAwC,SAASA,WACjE,EAAE,YAAY,gBAAgB,UAAU,aAAa,SAAS,GAAG,MAAM,GACvE,KACA;AACA,QAAM,oBAAoB,sBAAsB;AAChD,QAAM,aAAa,kBAAkB,mBAAmB;AACxD,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAE9C,MAAI,eAAe,QAAW;AAC5B,UAAM,IAAI,MAAM,+DAA+D;AAAA,EACjF;AAEA,QAAM,MAAM,YAAY,UAAU;AAClC,QAAM,UAAU,kBAAkB,UAAU;AAC5C,QAAM,QAAQ,QAA2B,MAAM;AAC7C,UAAM,UAA6B;AAAA,MACjC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,QAAI,QAAQ,OAAW,SAAQ,MAAM;AACrC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A,MACR;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,EAAE,KAAK,GAAG;AAAA,IACZ;AAAA,EACF,EAAE,OAAO,CAAC,YAAY,QAAQ,YAAY,KAAK,QAAQ,aAAa,aAAa,MAAM,MAAM;AAC/F;;;ACrfO,IAAM,QAAQ;AAAA,EACnB,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM;AAAA,EACN,UAAU;AAAA,EACV,aAAa;AAAA,EACb,aAAa;AACf;","names":["ImageRoot","ImagePreview","ImageName","ImageActions","ImageCopy","ImageDownload","ImageZoomTrigger","ImageZoomOverlay","handleKeyDown"]}
|