@anvia/react-ui 1.0.0-rc.1 → 1.0.0-rc.10

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.
Files changed (72) hide show
  1. package/README.md +52 -39
  2. package/dist/attachment/index.d.ts +5 -5
  3. package/dist/attachment/index.js +4 -4
  4. package/dist/{attachment-BP597fV3.d.ts → attachment-mbjsroli.d.ts} +1 -1
  5. package/dist/chat/index.d.ts +13 -12
  6. package/dist/chat/index.js +11 -9
  7. package/dist/chat-tfA570mg.d.ts +86 -0
  8. package/dist/{chunk-7RMRM7W3.js → chunk-647LAYRV.js} +90 -65
  9. package/dist/chunk-647LAYRV.js.map +1 -0
  10. package/dist/chunk-6XOJFLX4.js +22 -0
  11. package/dist/chunk-6XOJFLX4.js.map +1 -0
  12. package/dist/chunk-CKA4CE26.js +25 -0
  13. package/dist/chunk-CKA4CE26.js.map +1 -0
  14. package/dist/{chunk-JWZDNM5D.js → chunk-CRXNFZRW.js} +145 -125
  15. package/dist/chunk-CRXNFZRW.js.map +1 -0
  16. package/dist/{chunk-7HR34SOF.js → chunk-CVXLQCDI.js} +13 -21
  17. package/dist/chunk-CVXLQCDI.js.map +1 -0
  18. package/dist/{chunk-ULGJLLZE.js → chunk-F6AKBUO3.js} +12 -12
  19. package/dist/chunk-F6AKBUO3.js.map +1 -0
  20. package/dist/{chunk-FABSIZZ7.js → chunk-HWJIMLHC.js} +97 -90
  21. package/dist/chunk-HWJIMLHC.js.map +1 -0
  22. package/dist/{chunk-SBYUKODG.js → chunk-MISX4WUT.js} +10 -15
  23. package/dist/chunk-MISX4WUT.js.map +1 -0
  24. package/dist/{chunk-R3NA6BWW.js → chunk-OQE6SHZE.js} +54 -56
  25. package/dist/chunk-OQE6SHZE.js.map +1 -0
  26. package/dist/{chunk-VEYJNQVW.js → chunk-S4XLE2RN.js} +11 -16
  27. package/dist/chunk-S4XLE2RN.js.map +1 -0
  28. package/dist/{chunk-43U2XQP2.js → chunk-SOG2GVE4.js} +69 -25
  29. package/dist/chunk-SOG2GVE4.js.map +1 -0
  30. package/dist/{chunk-56CV6S76.js → chunk-UCBAG42A.js} +9 -21
  31. package/dist/chunk-UCBAG42A.js.map +1 -0
  32. package/dist/completion/index.d.ts +4 -3
  33. package/dist/completion/index.js +4 -4
  34. package/dist/completion-input-DHlwrhxB.d.ts +24 -0
  35. package/dist/{composer-CzsbDFPt.d.ts → composer-CigccTLT.d.ts} +19 -7
  36. package/dist/human-input/index.d.ts +10 -8
  37. package/dist/human-input/index.js +5 -4
  38. package/dist/human-input-D7jgYsfM.d.ts +27 -0
  39. package/dist/image/index.d.ts +6 -6
  40. package/dist/image/index.js +4 -4
  41. package/dist/{image-DanUxcl2.d.ts → image-VZv6Ddsn.d.ts} +1 -1
  42. package/dist/index.d.ts +19 -18
  43. package/dist/index.js +60 -64
  44. package/dist/index.js.map +1 -1
  45. package/dist/message/index.d.ts +12 -11
  46. package/dist/message/index.js +8 -6
  47. package/dist/{message-CkEnKhAn.d.ts → message-CNRnZQwU.d.ts} +1 -1
  48. package/dist/selection-toolbar/index.d.ts +2 -2
  49. package/dist/selection-toolbar/index.js +5 -4
  50. package/dist/shared.d.ts +9 -8
  51. package/dist/shared.js +1 -1
  52. package/dist/stream/index.d.ts +2 -0
  53. package/dist/stream/index.js +1 -1
  54. package/dist/{thread-uEm8hH0s.d.ts → thread-Bz6-1zaJ.d.ts} +1 -0
  55. package/dist/thread-list/index.d.ts +3 -3
  56. package/dist/thread-list/index.js +6 -6
  57. package/package.json +17 -17
  58. package/dist/chat-B3kucz1w.d.ts +0 -13
  59. package/dist/chunk-43U2XQP2.js.map +0 -1
  60. package/dist/chunk-56CV6S76.js.map +0 -1
  61. package/dist/chunk-7HR34SOF.js.map +0 -1
  62. package/dist/chunk-7RMRM7W3.js.map +0 -1
  63. package/dist/chunk-FABSIZZ7.js.map +0 -1
  64. package/dist/chunk-JWZDNM5D.js.map +0 -1
  65. package/dist/chunk-R3NA6BWW.js.map +0 -1
  66. package/dist/chunk-SBYUKODG.js.map +0 -1
  67. package/dist/chunk-ULGJLLZE.js.map +0 -1
  68. package/dist/chunk-VEYJNQVW.js.map +0 -1
  69. package/dist/completion-input-WjK6kUyG.d.ts +0 -23
  70. package/dist/human-input-CydeYm_7.d.ts +0 -20
  71. package/dist/stream/styles.css +0 -17
  72. package/dist/styles.css +0 -130
package/dist/index.d.ts CHANGED
@@ -1,27 +1,28 @@
1
- export { Attachment } from './attachment/index.js';
2
- export { A as AttachmentContextValue, u as useAttachment } from './attachment-BP597fV3.js';
3
- export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-B3kucz1w.js';
4
- export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from './completion-input-WjK6kUyG.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-CzsbDFPt.js';
6
- export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-CydeYm_7.js';
7
- export { I as ImageContextValue, u as useImage } from './image-DanUxcl2.js';
8
- export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from './message-CkEnKhAn.js';
1
+ export { AttachmentPrimitive } from './attachment/index.js';
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-tfA570mg.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-CigccTLT.js';
6
+ export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-D7jgYsfM.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
- export { T as ThreadContextValue, u as useThread } from './thread-uEm8hH0s.js';
10
+ export { T as ThreadContextValue, u as useThread } from './thread-Bz6-1zaJ.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';
12
- export { Composer, ComposerSubmitMessage, ComposerSubmitMessageArgs, Thread } from './chat/index.js';
13
- export { Completion } from './completion/index.js';
12
+ export { ComposerPrimitive, ComposerSubmitMessage, ComposerSubmitMessageArgs, ThreadPrimitive } from './chat/index.js';
13
+ export { CompletionPrimitive } from './completion/index.js';
14
14
  import * as react from 'react';
15
15
  import { ReactNode } from 'react';
16
16
  import { UseChatResult } from '@anvia/react';
17
17
  import { P as PrimitiveProps } from './render-CRKWam2v.js';
18
18
  export { a as PrimitiveRef } from './render-CRKWam2v.js';
19
- export { HumanInput } from './human-input/index.js';
20
- export { Image } from './image/index.js';
21
- export { Message, MessageAttachmentPart, MessageEntityProps, MessagePartsFilter, MessageStreamOptions, MessageToolPart, MessageToolRenderWhen } from './message/index.js';
22
- export { SelectionToolbar } from './selection-toolbar/index.js';
19
+ export { HumanInputPrimitive } from './human-input/index.js';
20
+ export { ImagePrimitive } from './image/index.js';
21
+ export { MessageAttachmentPart, MessageEntityProps, MessagePartsFilter, MessagePrimitive, MessageStreamOptions, MessageToolPart, MessageToolRenderWhen } from './message/index.js';
22
+ export { SelectionToolbarPrimitive } from './selection-toolbar/index.js';
23
23
  export { StreamMarkdown, StreamMarkdownProps } from './stream/index.js';
24
- export { ThreadList, ThreadListItem } from './thread-list/index.js';
24
+ export { ThreadListItemPrimitive, ThreadListPrimitive } from './thread-list/index.js';
25
+ import '@anvia/client';
25
26
  import 'react-markdown';
26
27
 
27
28
  type ContextUsage = NonNullable<UseChatResult["contextUsage"]>;
@@ -30,10 +31,10 @@ type ContextMeterProps = Omit<PrimitiveProps<"div">, "children"> & {
30
31
  display?: "remaining" | "used";
31
32
  children?: ReactNode | ((usage: ContextUsage) => ReactNode);
32
33
  };
33
- declare const ContextMeter: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
34
+ declare const ContextMeterPrimitive: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
34
35
  usage?: ContextUsage;
35
36
  display?: "remaining" | "used";
36
37
  children?: ReactNode | ((usage: ContextUsage) => ReactNode);
37
38
  } & react.RefAttributes<HTMLDivElement>>;
38
39
 
39
- export { ContextMeter, type ContextMeterProps, PrimitiveProps };
40
+ export { ContextMeterPrimitive, type ContextMeterProps, PrimitiveProps };
package/dist/index.js CHANGED
@@ -1,32 +1,34 @@
1
1
  import {
2
- ThreadList,
3
- ThreadListItem
4
- } from "./chunk-7RMRM7W3.js";
2
+ SelectionToolbarPrimitive
3
+ } from "./chunk-UCBAG42A.js";
5
4
  import {
6
- Composer,
7
- Thread
8
- } from "./chunk-FABSIZZ7.js";
5
+ ThreadListItemPrimitive,
6
+ ThreadListPrimitive
7
+ } from "./chunk-647LAYRV.js";
9
8
  import {
10
- Message
11
- } from "./chunk-JWZDNM5D.js";
9
+ ComposerPrimitive,
10
+ ThreadPrimitive
11
+ } from "./chunk-HWJIMLHC.js";
12
12
  import {
13
- StreamMarkdown
14
- } from "./chunk-ULGJLLZE.js";
13
+ CompletionPrimitive
14
+ } from "./chunk-S4XLE2RN.js";
15
15
  import {
16
- Attachment
17
- } from "./chunk-SBYUKODG.js";
16
+ HumanInputPrimitive
17
+ } from "./chunk-OQE6SHZE.js";
18
18
  import {
19
- Completion
20
- } from "./chunk-VEYJNQVW.js";
19
+ ImagePrimitive
20
+ } from "./chunk-CVXLQCDI.js";
21
21
  import {
22
- HumanInput
23
- } from "./chunk-R3NA6BWW.js";
22
+ MessagePrimitive
23
+ } from "./chunk-CRXNFZRW.js";
24
+ import "./chunk-6XOJFLX4.js";
24
25
  import {
25
- Image
26
- } from "./chunk-7HR34SOF.js";
26
+ StreamMarkdown
27
+ } from "./chunk-F6AKBUO3.js";
27
28
  import {
28
- SelectionToolbar
29
- } from "./chunk-56CV6S76.js";
29
+ AttachmentPrimitive
30
+ } from "./chunk-MISX4WUT.js";
31
+ import "./chunk-CKA4CE26.js";
30
32
  import {
31
33
  renderPrimitive
32
34
  } from "./chunk-T3ZFZ3NP.js";
@@ -50,60 +52,54 @@ import {
50
52
  useThread,
51
53
  useThreadList,
52
54
  useThreadListItem
53
- } from "./chunk-43U2XQP2.js";
55
+ } from "./chunk-SOG2GVE4.js";
54
56
 
55
57
  // src/context-meter.tsx
56
58
  import { forwardRef } from "react";
57
59
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
58
- var ContextMeter = forwardRef(function ContextMeter2({ usage, display = "remaining", children, ...props }, ref) {
59
- if (usage === void 0) {
60
- return null;
61
- }
62
- const percent = display === "remaining" ? usage.remainingPercent : usage.usedPercent;
63
- const roundedPercent = Math.round(percent);
64
- const label = `${roundedPercent}% context ${display === "remaining" ? "left" : "used"}`;
65
- const content = typeof children === "function" ? children(usage) : children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
66
- /* @__PURE__ */ jsx("span", { "data-anvia-context-meter-label": "", children: label }),
67
- /* @__PURE__ */ jsx("span", { "aria-hidden": "true", "data-anvia-context-meter-track": "", children: /* @__PURE__ */ jsx(
68
- "span",
60
+ var ContextMeterPrimitive = forwardRef(
61
+ function ContextMeter({ usage, display = "remaining", children, ...props }, ref) {
62
+ if (usage === void 0) {
63
+ return null;
64
+ }
65
+ const percent = display === "remaining" ? usage.remainingPercent : usage.usedPercent;
66
+ const roundedPercent = Math.round(percent);
67
+ const label = `${roundedPercent}% context ${display === "remaining" ? "left" : "used"}`;
68
+ const content = typeof children === "function" ? children(usage) : children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
69
+ /* @__PURE__ */ jsx("span", { children: label }),
70
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", { style: { width: `${Math.min(100, Math.max(0, percent))}%` } }) })
71
+ ] });
72
+ return renderPrimitive(
73
+ "div",
69
74
  {
70
- "data-anvia-context-meter-value": "",
71
- style: { width: `${Math.min(100, Math.max(0, percent))}%` }
72
- }
73
- ) })
74
- ] });
75
- return renderPrimitive(
76
- "div",
77
- {
78
- ...props,
79
- children: content,
80
- "aria-label": props["aria-label"] ?? label,
81
- "aria-valuemax": 100,
82
- "aria-valuemin": 0,
83
- "aria-valuenow": roundedPercent,
84
- "data-anvia-context-meter": "",
85
- "data-display": display,
86
- role: props.role ?? "progressbar"
87
- },
88
- ref
89
- );
90
- });
75
+ ...props,
76
+ children: content,
77
+ "aria-label": props["aria-label"] ?? label,
78
+ "aria-valuemax": 100,
79
+ "aria-valuemin": 0,
80
+ "aria-valuenow": roundedPercent,
81
+ role: props.role ?? "progressbar"
82
+ },
83
+ ref
84
+ );
85
+ }
86
+ );
91
87
  export {
92
- Attachment,
88
+ AttachmentPrimitive,
93
89
  ChatProvider,
94
- Completion,
90
+ CompletionPrimitive,
95
91
  CompletionProvider,
96
- Composer,
97
- ContextMeter,
98
- HumanInput,
99
- Image,
100
- Message,
101
- SelectionToolbar,
92
+ ComposerPrimitive,
93
+ ContextMeterPrimitive,
94
+ HumanInputPrimitive,
95
+ ImagePrimitive,
96
+ MessagePrimitive,
97
+ SelectionToolbarPrimitive,
102
98
  StreamMarkdown,
103
- Thread,
104
- ThreadList,
105
- ThreadListItem,
99
+ ThreadListItemPrimitive,
100
+ ThreadListPrimitive,
106
101
  ThreadListProvider,
102
+ ThreadPrimitive,
107
103
  useApproval,
108
104
  useAttachment,
109
105
  useChatContext,
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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"]}
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 ContextMeterPrimitive = forwardRef<HTMLDivElement, ContextMeterProps>(\n function ContextMeter({ usage, display = \"remaining\", children, ...props }, ref) {\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>{label}</span>\n <span aria-hidden=\"true\">\n <span style={{ width: `${Math.min(100, Math.max(0, percent))}%` }} />\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 role: props.role ?? \"progressbar\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,kBAAkC;AAyB/B,mBACE,KADF;AAbL,IAAM,wBAAwB;AAAA,EACnC,SAAS,aAAa,EAAE,OAAO,UAAU,aAAa,UAAU,GAAG,MAAM,GAAG,KAAK;AAC/E,QAAI,UAAU,QAAW;AACvB,aAAO;AAAA,IACT;AAEA,UAAM,UAAU,YAAY,cAAc,MAAM,mBAAmB,MAAM;AACzE,UAAM,iBAAiB,KAAK,MAAM,OAAO;AACzC,UAAM,QAAQ,GAAG,cAAc,aAAa,YAAY,cAAc,SAAS,MAAM;AACrF,UAAM,UACJ,OAAO,aAAa,aAChB,SAAS,KAAK,IACb,YACC,iCACE;AAAA,0BAAC,UAAM,iBAAM;AAAA,MACb,oBAAC,UAAK,eAAY,QAChB,8BAAC,UAAK,OAAO,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,CAAC,IAAI,GAAG,GACrE;AAAA,OACF;AAGR,WAAO;AAAA,MACL;AAAA,MACA;AAAA,QACE,GAAG;AAAA,QACH,UAAU;AAAA,QACV,cAAc,MAAM,YAAY,KAAK;AAAA,QACrC,iBAAiB;AAAA,QACjB,iBAAiB;AAAA,QACjB,iBAAiB;AAAA,QACjB,MAAM,MAAM,QAAQ;AAAA,MACtB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -1,11 +1,12 @@
1
1
  import * as react_markdown from 'react-markdown';
2
- import * as _anvia_react from '@anvia/react';
3
- import { UIMessagePart, StreamSmoothingLifecycle } from '@anvia/react';
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-B3kucz1w.js';
7
- import { d as ComposerEntity } from '../composer-CzsbDFPt.js';
8
- export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from '../message-CkEnKhAn.js';
7
+ export { u as useChatContext } from '../chat-tfA570mg.js';
8
+ import { d as ComposerEntity } from '../composer-CigccTLT.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;
@@ -22,21 +23,21 @@ type MessageEntityProps = HTMLAttributes<HTMLSpanElement> & {
22
23
  entity: ComposerEntity;
23
24
  };
24
25
 
25
- declare const Message: {
26
+ declare const MessagePrimitive: {
26
27
  readonly Root: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"article">, "children"> & {
27
- children?: react.ReactNode | ((message: _anvia_react.UIMessage) => react.ReactNode);
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: _anvia_react.UIMessagePart) => react.ReactNode);
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: _anvia_react.UIMessagePart) => react.ReactNode);
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: _anvia_react.UIAttachment) => react.ReactNode);
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;
@@ -101,4 +102,4 @@ declare const Message: {
101
102
  } & react.RefAttributes<HTMLButtonElement>>;
102
103
  };
103
104
 
104
- export { Message, type MessageAttachmentPart, type MessageEntityProps, type MessagePartsFilter, type MessageStreamOptions, type MessageToolPart, type MessageToolRenderWhen };
105
+ export { type MessageAttachmentPart, type MessageEntityProps, type MessagePartsFilter, MessagePrimitive, type MessageStreamOptions, type MessageToolPart, type MessageToolRenderWhen };
@@ -1,16 +1,18 @@
1
1
  import {
2
- Message
3
- } from "../chunk-JWZDNM5D.js";
4
- import "../chunk-ULGJLLZE.js";
5
- import "../chunk-SBYUKODG.js";
2
+ MessagePrimitive
3
+ } from "../chunk-CRXNFZRW.js";
4
+ import "../chunk-6XOJFLX4.js";
5
+ import "../chunk-F6AKBUO3.js";
6
+ import "../chunk-MISX4WUT.js";
7
+ import "../chunk-CKA4CE26.js";
6
8
  import "../chunk-T3ZFZ3NP.js";
7
9
  import {
8
10
  useChatContext,
9
11
  useMessage,
10
12
  useMessagePart
11
- } from "../chunk-43U2XQP2.js";
13
+ } from "../chunk-SOG2GVE4.js";
12
14
  export {
13
- Message,
15
+ MessagePrimitive,
14
16
  useChatContext,
15
17
  useMessage,
16
18
  useMessagePart
@@ -1,4 +1,4 @@
1
- import { UIMessage, UIMessagePart } from '@anvia/react';
1
+ import { UIMessage, UIMessagePart } from '@anvia/client';
2
2
 
3
3
  type MessageContextValue = {
4
4
  message: UIMessage;
@@ -3,7 +3,7 @@ import { a as SelectionToolbarSelection } from '../selection-toolbar-Cwjbuv5S.js
3
3
  export { S as SelectionToolbarContextValue, u as useSelectionToolbar } from '../selection-toolbar-Cwjbuv5S.js';
4
4
  import { P as PrimitiveProps } from '../render-CRKWam2v.js';
5
5
 
6
- declare const SelectionToolbar: {
6
+ declare const SelectionToolbarPrimitive: {
7
7
  readonly Root: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
8
8
  children?: react.ReactNode;
9
9
  container?: Element | DocumentFragment;
@@ -18,4 +18,4 @@ declare const SelectionToolbar: {
18
18
  } & react.RefAttributes<HTMLButtonElement>>;
19
19
  };
20
20
 
21
- export { SelectionToolbar, SelectionToolbarSelection };
21
+ export { SelectionToolbarPrimitive, SelectionToolbarSelection };
@@ -1,12 +1,13 @@
1
1
  import {
2
- SelectionToolbar
3
- } from "../chunk-56CV6S76.js";
2
+ SelectionToolbarPrimitive
3
+ } from "../chunk-UCBAG42A.js";
4
+ import "../chunk-6XOJFLX4.js";
4
5
  import "../chunk-T3ZFZ3NP.js";
5
6
  import {
6
7
  useSelectionToolbar
7
- } from "../chunk-43U2XQP2.js";
8
+ } from "../chunk-SOG2GVE4.js";
8
9
  export {
9
- SelectionToolbar,
10
+ SelectionToolbarPrimitive,
10
11
  useSelectionToolbar
11
12
  };
12
13
  //# sourceMappingURL=index.js.map
package/dist/shared.d.ts CHANGED
@@ -1,13 +1,14 @@
1
- export { A as AttachmentContextValue, u as useAttachment } from './attachment-BP597fV3.js';
2
- export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-B3kucz1w.js';
3
- export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from './completion-input-WjK6kUyG.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-CzsbDFPt.js';
5
- export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-CydeYm_7.js';
6
- export { I as ImageContextValue, u as useImage } from './image-DanUxcl2.js';
7
- export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from './message-CkEnKhAn.js';
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-tfA570mg.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-CigccTLT.js';
5
+ export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-D7jgYsfM.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
- export { T as ThreadContextValue, u as useThread } from './thread-uEm8hH0s.js';
9
+ export { T as ThreadContextValue, u as useThread } from './thread-Bz6-1zaJ.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
@@ -18,7 +18,7 @@ import {
18
18
  useThread,
19
19
  useThreadList,
20
20
  useThreadListItem
21
- } from "./chunk-43U2XQP2.js";
21
+ } from "./chunk-SOG2GVE4.js";
22
22
  export {
23
23
  ChatProvider,
24
24
  CompletionProvider,
@@ -3,6 +3,7 @@ import { Components, Options } from 'react-markdown';
3
3
  import { P as PrimitiveProps } from '../render-CRKWam2v.js';
4
4
 
5
5
  type StreamMarkdownProps = Omit<PrimitiveProps<"div">, "children"> & {
6
+ "data-state"?: string | undefined;
6
7
  components?: Components;
7
8
  content: string;
8
9
  live?: boolean;
@@ -10,6 +11,7 @@ type StreamMarkdownProps = Omit<PrimitiveProps<"div">, "children"> & {
10
11
  remarkRehypeOptions?: Options["remarkRehypeOptions"];
11
12
  };
12
13
  declare const StreamMarkdown: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
14
+ "data-state"?: string | undefined;
13
15
  components?: Components;
14
16
  content: string;
15
17
  live?: boolean;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  StreamMarkdown
3
- } from "../chunk-ULGJLLZE.js";
3
+ } from "../chunk-F6AKBUO3.js";
4
4
  import "../chunk-T3ZFZ3NP.js";
5
5
  export {
6
6
  StreamMarkdown
@@ -2,6 +2,7 @@ import { MutableRefObject } from 'react';
2
2
 
3
3
  type ThreadContextValue = {
4
4
  viewportRef: MutableRefObject<HTMLElement | null>;
5
+ messagesRef: MutableRefObject<HTMLElement | null>;
5
6
  atBottom: boolean;
6
7
  setAtBottom(atBottom: boolean): void;
7
8
  scrollToBottom(behavior?: ScrollBehavior): void;
@@ -3,7 +3,7 @@ import { d as ThreadListRecord } from '../thread-list-On8db4XL.js';
3
3
  export { T as ThreadListController, a as ThreadListItemContextValue, b as ThreadListProvider, c as ThreadListProviderProps, u as useThreadList, e as useThreadListItem } from '../thread-list-On8db4XL.js';
4
4
  import { P as PrimitiveProps } from '../render-CRKWam2v.js';
5
5
 
6
- declare const ThreadList: {
6
+ declare const ThreadListPrimitive: {
7
7
  readonly Root: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
8
8
  asChild?: boolean;
9
9
  } & react.RefAttributes<HTMLDivElement>>;
@@ -21,7 +21,7 @@ declare const ThreadList: {
21
21
  archived?: boolean;
22
22
  } & react.RefAttributes<HTMLDivElement>>;
23
23
  };
24
- declare const ThreadListItem: {
24
+ declare const ThreadListItemPrimitive: {
25
25
  readonly Root: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
26
26
  asChild?: boolean;
27
27
  } & react.RefAttributes<HTMLDivElement>>;
@@ -44,4 +44,4 @@ declare const ThreadListItem: {
44
44
  } & react.RefAttributes<HTMLButtonElement>>;
45
45
  };
46
46
 
47
- export { ThreadList, ThreadListItem, ThreadListRecord };
47
+ export { ThreadListItemPrimitive, ThreadListPrimitive, ThreadListRecord };
@@ -1,16 +1,16 @@
1
1
  import {
2
- ThreadList,
3
- ThreadListItem
4
- } from "../chunk-7RMRM7W3.js";
2
+ ThreadListItemPrimitive,
3
+ ThreadListPrimitive
4
+ } from "../chunk-647LAYRV.js";
5
5
  import "../chunk-T3ZFZ3NP.js";
6
6
  import {
7
7
  ThreadListProvider,
8
8
  useThreadList,
9
9
  useThreadListItem
10
- } from "../chunk-43U2XQP2.js";
10
+ } from "../chunk-SOG2GVE4.js";
11
11
  export {
12
- ThreadList,
13
- ThreadListItem,
12
+ ThreadListItemPrimitive,
13
+ ThreadListPrimitive,
14
14
  ThreadListProvider,
15
15
  useThreadList,
16
16
  useThreadListItem
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anvia/react-ui",
3
- "version": "1.0.0-rc.1",
3
+ "version": "1.0.0-rc.10",
4
4
  "description": "Composable React UI primitives for Anvia chat and completion experiences.",
5
5
  "author": "anvia",
6
6
  "maintainer": "Indra Zulfi",
@@ -56,7 +56,6 @@
56
56
  "types": "./dist/stream/index.d.ts",
57
57
  "import": "./dist/stream/index.js"
58
58
  },
59
- "./stream/styles.css": "./dist/stream/styles.css",
60
59
  "./shared": {
61
60
  "types": "./dist/shared.d.ts",
62
61
  "import": "./dist/shared.js"
@@ -64,21 +63,20 @@
64
63
  "./thread-list": {
65
64
  "types": "./dist/thread-list/index.d.ts",
66
65
  "import": "./dist/thread-list/index.js"
67
- },
68
- "./styles.css": "./dist/styles.css"
66
+ }
69
67
  },
70
68
  "dependencies": {
71
69
  "@radix-ui/react-slot": "^1.3.3",
72
- "@tiptap/core": "^3.29.2",
73
- "@tiptap/extension-document": "^3.29.2",
74
- "@tiptap/extension-hard-break": "^3.29.2",
75
- "@tiptap/extension-mention": "^3.29.2",
76
- "@tiptap/extension-paragraph": "^3.29.2",
77
- "@tiptap/extension-placeholder": "^3.29.2",
78
- "@tiptap/extension-text": "^3.29.2",
79
- "@tiptap/pm": "^3.29.2",
80
- "@tiptap/react": "^3.29.2",
81
- "@tiptap/suggestion": "^3.29.2",
70
+ "@tiptap/core": "^3.30.1",
71
+ "@tiptap/extension-document": "^3.30.1",
72
+ "@tiptap/extension-hard-break": "^3.30.1",
73
+ "@tiptap/extension-mention": "^3.30.1",
74
+ "@tiptap/extension-paragraph": "^3.30.1",
75
+ "@tiptap/extension-placeholder": "^3.30.1",
76
+ "@tiptap/extension-text": "^3.30.1",
77
+ "@tiptap/pm": "^3.30.1",
78
+ "@tiptap/react": "^3.30.1",
79
+ "@tiptap/suggestion": "^3.30.1",
82
80
  "marked": "^18.0.9",
83
81
  "react-markdown": "^10.1.0",
84
82
  "remark-gfm": "^4.0.1"
@@ -86,7 +84,8 @@
86
84
  "peerDependencies": {
87
85
  "react": ">=18",
88
86
  "react-dom": ">=18",
89
- "@anvia/react": "1.0.0-rc.1"
87
+ "@anvia/client": "1.0.0-rc.10",
88
+ "@anvia/react": "1.0.0-rc.10"
90
89
  },
91
90
  "devDependencies": {
92
91
  "@testing-library/react": "^16.3.2",
@@ -100,10 +99,11 @@
100
99
  "tsup": "^8.5.0",
101
100
  "typescript": "^5.9.3",
102
101
  "vitest": "^4.0.8",
103
- "@anvia/react": "1.0.0-rc.1"
102
+ "@anvia/client": "1.0.0-rc.10",
103
+ "@anvia/react": "1.0.0-rc.10"
104
104
  },
105
105
  "scripts": {
106
- "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",
106
+ "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",
107
107
  "coverage": "vitest run --coverage",
108
108
  "test": "vitest run",
109
109
  "typecheck": "tsc --noEmit"
@@ -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 };