@agentscope-ai/chat 1.1.39 → 1.1.41-beta.1764749089549

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 (233) hide show
  1. package/bin/starter_webui.zip +0 -0
  2. package/components/AgentScopeRuntimeWebUI/core/AgentScopeRuntime/Response/Builder.tsx +8 -4
  3. package/components/ImageGenerator/index.tsx +1 -1
  4. package/components/Markdown/Markdown.tsx +105 -0
  5. package/components/Markdown/{Markdown/defaultComponents → core/components}/CodeBlock.tsx +1 -1
  6. package/components/Markdown/core/components/Null.tsx +1 -0
  7. package/components/Markdown/core/components/Raw.tsx +18 -0
  8. package/components/Markdown/{Markdown → core}/hooks/useCitationsData.tsx +3 -7
  9. package/components/Markdown/core/hooks/useCursorContent.tsx +15 -0
  10. package/components/Markdown/{Markdown/hooks/useTyping.ts → core/hooks/useTyping.tsx} +4 -1
  11. package/components/Markdown/core/index.tsx +18 -0
  12. package/components/Markdown/{plugins → core/plugins}/citations/CitationComponent.tsx +5 -3
  13. package/components/Markdown/{plugins → core/plugins}/citations/index.tsx +3 -4
  14. package/components/Markdown/{plugins → core/plugins}/cursor/Underline.tsx +1 -1
  15. package/components/Markdown/{plugins → core/plugins}/cursor/index.tsx +8 -8
  16. package/components/Markdown/demo/cursor.tsx +2 -3
  17. package/components/Markdown/index.en-US.md +1 -2
  18. package/components/Markdown/index.tsx +6 -0
  19. package/components/Markdown/index.zh-CN.md +1 -2
  20. package/components/Markdown/{Markdown/style.ts → styles.ts} +12 -21
  21. package/components/Markdown/types.tsx +94 -0
  22. package/components/index.ts +1 -3
  23. package/lib/AgentScopeRuntimeWebUI/core/AgentScopeRuntime/Response/Builder.js +5 -3
  24. package/lib/ImageGenerator/index.js +1 -1
  25. package/lib/Markdown/Markdown.d.ts +4 -0
  26. package/lib/Markdown/Markdown.js +110 -0
  27. package/lib/Markdown/core/components/Null.d.ts +2 -0
  28. package/lib/Markdown/core/components/Null.js +3 -0
  29. package/lib/Markdown/core/components/Raw.d.ts +8 -0
  30. package/lib/Markdown/core/components/Raw.js +13 -0
  31. package/lib/Markdown/core/hooks/useCitationsData.d.ts +6 -0
  32. package/lib/Markdown/{Markdown → core}/hooks/useCitationsData.js +1 -1
  33. package/lib/Markdown/core/hooks/useCursorContent.d.ts +4 -0
  34. package/lib/Markdown/core/hooks/useCursorContent.js +14 -0
  35. package/lib/Markdown/core/hooks/useTyping.d.ts +5 -0
  36. package/lib/Markdown/{Markdown → core}/hooks/useTyping.js +3 -2
  37. package/lib/Markdown/core/index.d.ts +2 -0
  38. package/lib/Markdown/{Markdown/hooks/useAnimation.js → core/index.js} +23 -23
  39. package/lib/Markdown/{plugins → core/plugins}/citations/CitationComponent.js +5 -5
  40. package/lib/Markdown/{plugins → core/plugins}/citations/index.d.ts +1 -2
  41. package/lib/Markdown/{plugins → core/plugins}/citations/index.js +1 -1
  42. package/lib/Markdown/{plugins → core/plugins}/cursor/Dot.js +1 -1
  43. package/lib/Markdown/{plugins → core/plugins}/cursor/Underline.js +1 -1
  44. package/lib/Markdown/{plugins → core/plugins}/cursor/index.js +4 -4
  45. package/lib/Markdown/index.d.ts +2 -1
  46. package/lib/Markdown/styles.js +32 -0
  47. package/lib/Markdown/types.d.ts +78 -0
  48. package/lib/index.d.ts +0 -2
  49. package/lib/index.js +0 -2
  50. package/package.json +7 -31
  51. package/components/AGUI/components/HelpModal/icons.tsx +0 -68
  52. package/components/AGUI/components/HelpModal/index.tsx +0 -1
  53. package/components/AGUI/components/HelpModal/modal.tsx +0 -101
  54. package/components/AGUI/components/chat/Button.tsx +0 -18
  55. package/components/AGUI/components/chat/Chat.tsx +0 -780
  56. package/components/AGUI/components/chat/ChatContext.tsx +0 -248
  57. package/components/AGUI/components/chat/CodeBlock.tsx +0 -406
  58. package/components/AGUI/components/chat/Header.tsx +0 -22
  59. package/components/AGUI/components/chat/Icons.tsx +0 -237
  60. package/components/AGUI/components/chat/ImageUploadQueue.tsx +0 -77
  61. package/components/AGUI/components/chat/Input.tsx +0 -24
  62. package/components/AGUI/components/chat/Markdown.tsx +0 -134
  63. package/components/AGUI/components/chat/Messages.tsx +0 -259
  64. package/components/AGUI/components/chat/Modal.tsx +0 -133
  65. package/components/AGUI/components/chat/Popup.tsx +0 -57
  66. package/components/AGUI/components/chat/PoweredByTag.tsx +0 -29
  67. package/components/AGUI/components/chat/Sidebar.tsx +0 -74
  68. package/components/AGUI/components/chat/Suggestion.tsx +0 -132
  69. package/components/AGUI/components/chat/Suggestions.tsx +0 -20
  70. package/components/AGUI/components/chat/Textarea.tsx +0 -61
  71. package/components/AGUI/components/chat/Window.tsx +0 -152
  72. package/components/AGUI/components/chat/index.tsx +0 -11
  73. package/components/AGUI/components/chat/messages/AssistantMessage.tsx +0 -69
  74. package/components/AGUI/components/chat/messages/RenderActionExecutionMessage.tsx +0 -129
  75. package/components/AGUI/components/chat/messages/RenderAgentStateMessage.tsx +0 -116
  76. package/components/AGUI/components/chat/messages/RenderImageMessage.tsx +0 -64
  77. package/components/AGUI/components/chat/messages/RenderResultMessage.tsx +0 -26
  78. package/components/AGUI/components/chat/messages/RenderTextMessage.tsx +0 -51
  79. package/components/AGUI/components/chat/messages/UserMessage.tsx +0 -10
  80. package/components/AGUI/components/chat/props.ts +0 -186
  81. package/components/AGUI/components/index.ts +0 -1
  82. package/components/AGUI/context/index.ts +0 -1
  83. package/components/AGUI/hooks/index.ts +0 -1
  84. package/components/AGUI/hooks/use-copilot-chat-suggestions.tsx +0 -122
  85. package/components/AGUI/hooks/use-copy-to-clipboard.tsx +0 -29
  86. package/components/AGUI/hooks/use-dark-mode.ts +0 -10
  87. package/components/AGUI/hooks/use-push-to-talk.tsx +0 -166
  88. package/components/AGUI/index.tsx +0 -4
  89. package/components/AGUI/lib/utils.test.ts +0 -7
  90. package/components/AGUI/lib/utils.ts +0 -27
  91. package/components/AGUI/styles.css +0 -0
  92. package/components/AGUI/types/css.ts +0 -0
  93. package/components/AGUI/types/index.ts +0 -1
  94. package/components/AGUI/types/suggestions.ts +0 -6
  95. package/components/Markdown/Markdown/AnimationNode.tsx +0 -89
  96. package/components/Markdown/Markdown/Markdown.tsx +0 -61
  97. package/components/Markdown/Markdown/core/Parser.ts +0 -52
  98. package/components/Markdown/Markdown/core/Renderer.ts +0 -121
  99. package/components/Markdown/Markdown/core/index.ts +0 -4
  100. package/components/Markdown/Markdown/hooks/index.ts +0 -4
  101. package/components/Markdown/Markdown/hooks/useAnimation.tsx +0 -27
  102. package/components/Markdown/Markdown/hooks/useStreaming.ts +0 -503
  103. package/components/Markdown/Markdown/index.tsx +0 -198
  104. package/components/Markdown/Markdown/interface.ts +0 -217
  105. package/components/Markdown/demo/typing.tsx +0 -82
  106. package/components/Markdown/index.ts +0 -1
  107. package/components/Markdown/plugins/latex/index.ts +0 -109
  108. package/components/Markdown/plugins/type.ts +0 -71
  109. package/lib/AGUI/components/HelpModal/icons.d.ts +0 -5
  110. package/lib/AGUI/components/HelpModal/icons.js +0 -84
  111. package/lib/AGUI/components/HelpModal/index.d.ts +0 -1
  112. package/lib/AGUI/components/HelpModal/index.js +0 -1
  113. package/lib/AGUI/components/HelpModal/modal.d.ts +0 -1
  114. package/lib/AGUI/components/HelpModal/modal.js +0 -104
  115. package/lib/AGUI/components/chat/Button.d.ts +0 -2
  116. package/lib/AGUI/components/chat/Button.js +0 -27
  117. package/lib/AGUI/components/chat/Chat.d.ts +0 -242
  118. package/lib/AGUI/components/chat/Chat.js +0 -634
  119. package/lib/AGUI/components/chat/ChatContext.d.ts +0 -142
  120. package/lib/AGUI/components/chat/ChatContext.js +0 -75
  121. package/lib/AGUI/components/chat/CodeBlock.d.ts +0 -12
  122. package/lib/AGUI/components/chat/CodeBlock.js +0 -398
  123. package/lib/AGUI/components/chat/Header.d.ts +0 -2
  124. package/lib/AGUI/components/chat/Header.js +0 -28
  125. package/lib/AGUI/components/chat/Icons.d.ts +0 -16
  126. package/lib/AGUI/components/chat/Icons.js +0 -247
  127. package/lib/AGUI/components/chat/ImageUploadQueue.d.ts +0 -11
  128. package/lib/AGUI/components/chat/ImageUploadQueue.js +0 -65
  129. package/lib/AGUI/components/chat/Input.d.ts +0 -2
  130. package/lib/AGUI/components/chat/Input.js +0 -30
  131. package/lib/AGUI/components/chat/Markdown.d.ts +0 -7
  132. package/lib/AGUI/components/chat/Markdown.js +0 -187
  133. package/lib/AGUI/components/chat/Messages.d.ts +0 -7
  134. package/lib/AGUI/components/chat/Messages.js +0 -242
  135. package/lib/AGUI/components/chat/Modal.d.ts +0 -43
  136. package/lib/AGUI/components/chat/Modal.js +0 -113
  137. package/lib/AGUI/components/chat/Popup.d.ts +0 -49
  138. package/lib/AGUI/components/chat/Popup.js +0 -64
  139. package/lib/AGUI/components/chat/PoweredByTag.d.ts +0 -3
  140. package/lib/AGUI/components/chat/PoweredByTag.js +0 -27
  141. package/lib/AGUI/components/chat/Sidebar.d.ts +0 -2
  142. package/lib/AGUI/components/chat/Sidebar.js +0 -85
  143. package/lib/AGUI/components/chat/Suggestion.d.ts +0 -16
  144. package/lib/AGUI/components/chat/Suggestion.js +0 -146
  145. package/lib/AGUI/components/chat/Suggestions.d.ts +0 -2
  146. package/lib/AGUI/components/chat/Suggestions.js +0 -21
  147. package/lib/AGUI/components/chat/Textarea.d.ts +0 -11
  148. package/lib/AGUI/components/chat/Textarea.js +0 -60
  149. package/lib/AGUI/components/chat/Window.d.ts +0 -2
  150. package/lib/AGUI/components/chat/Window.js +0 -115
  151. package/lib/AGUI/components/chat/index.d.ts +0 -11
  152. package/lib/AGUI/components/chat/index.js +0 -11
  153. package/lib/AGUI/components/chat/messages/AssistantMessage.d.ts +0 -2
  154. package/lib/AGUI/components/chat/messages/AssistantMessage.js +0 -56
  155. package/lib/AGUI/components/chat/messages/RenderActionExecutionMessage.d.ts +0 -2
  156. package/lib/AGUI/components/chat/messages/RenderActionExecutionMessage.js +0 -114
  157. package/lib/AGUI/components/chat/messages/RenderAgentStateMessage.d.ts +0 -2
  158. package/lib/AGUI/components/chat/messages/RenderAgentStateMessage.js +0 -97
  159. package/lib/AGUI/components/chat/messages/RenderImageMessage.d.ts +0 -2
  160. package/lib/AGUI/components/chat/messages/RenderImageMessage.js +0 -61
  161. package/lib/AGUI/components/chat/messages/RenderResultMessage.d.ts +0 -2
  162. package/lib/AGUI/components/chat/messages/RenderResultMessage.js +0 -27
  163. package/lib/AGUI/components/chat/messages/RenderTextMessage.d.ts +0 -2
  164. package/lib/AGUI/components/chat/messages/RenderTextMessage.js +0 -47
  165. package/lib/AGUI/components/chat/messages/UserMessage.d.ts +0 -2
  166. package/lib/AGUI/components/chat/messages/UserMessage.js +0 -9
  167. package/lib/AGUI/components/chat/props.d.ts +0 -157
  168. package/lib/AGUI/components/index.d.ts +0 -1
  169. package/lib/AGUI/components/index.js +0 -1
  170. package/lib/AGUI/context/index.d.ts +0 -1
  171. package/lib/AGUI/context/index.js +0 -1
  172. package/lib/AGUI/hooks/index.d.ts +0 -1
  173. package/lib/AGUI/hooks/index.js +0 -1
  174. package/lib/AGUI/hooks/use-copilot-chat-suggestions.d.ts +0 -87
  175. package/lib/AGUI/hooks/use-copilot-chat-suggestions.js +0 -95
  176. package/lib/AGUI/hooks/use-copy-to-clipboard.d.ts +0 -7
  177. package/lib/AGUI/hooks/use-copy-to-clipboard.js +0 -34
  178. package/lib/AGUI/hooks/use-dark-mode.d.ts +0 -1
  179. package/lib/AGUI/hooks/use-dark-mode.js +0 -4
  180. package/lib/AGUI/hooks/use-push-to-talk.d.ts +0 -16
  181. package/lib/AGUI/hooks/use-push-to-talk.js +0 -260
  182. package/lib/AGUI/index.d.ts +0 -4
  183. package/lib/AGUI/index.js +0 -4
  184. package/lib/AGUI/lib/utils.d.ts +0 -2
  185. package/lib/AGUI/lib/utils.js +0 -52
  186. package/lib/AGUI/styles.css +0 -0
  187. package/lib/AGUI/types/css.d.ts +0 -0
  188. package/lib/AGUI/types/css.js +0 -0
  189. package/lib/AGUI/types/index.d.ts +0 -1
  190. package/lib/AGUI/types/index.js +0 -1
  191. package/lib/AGUI/types/suggestions.d.ts +0 -6
  192. package/lib/AGUI/types/suggestions.js +0 -1
  193. package/lib/Markdown/Markdown/AnimationNode.d.ts +0 -20
  194. package/lib/Markdown/Markdown/AnimationNode.js +0 -84
  195. package/lib/Markdown/Markdown/Markdown.d.ts +0 -4
  196. package/lib/Markdown/Markdown/Markdown.js +0 -58
  197. package/lib/Markdown/Markdown/core/Parser.d.ts +0 -16
  198. package/lib/Markdown/Markdown/core/Parser.js +0 -65
  199. package/lib/Markdown/Markdown/core/Renderer.d.ts +0 -24
  200. package/lib/Markdown/Markdown/core/Renderer.js +0 -137
  201. package/lib/Markdown/Markdown/core/index.d.ts +0 -3
  202. package/lib/Markdown/Markdown/core/index.js +0 -3
  203. package/lib/Markdown/Markdown/hooks/index.d.ts +0 -3
  204. package/lib/Markdown/Markdown/hooks/index.js +0 -3
  205. package/lib/Markdown/Markdown/hooks/useAnimation.d.ts +0 -4
  206. package/lib/Markdown/Markdown/hooks/useCitationsData.d.ts +0 -7
  207. package/lib/Markdown/Markdown/hooks/useStreaming.d.ts +0 -3
  208. package/lib/Markdown/Markdown/hooks/useStreaming.js +0 -521
  209. package/lib/Markdown/Markdown/hooks/useTyping.d.ts +0 -4
  210. package/lib/Markdown/Markdown/index.d.ts +0 -84
  211. package/lib/Markdown/Markdown/index.js +0 -161
  212. package/lib/Markdown/Markdown/interface.d.ts +0 -203
  213. package/lib/Markdown/Markdown/interface.js +0 -1
  214. package/lib/Markdown/Markdown/style.js +0 -32
  215. package/lib/Markdown/plugins/latex/index.d.ts +0 -9
  216. package/lib/Markdown/plugins/latex/index.js +0 -97
  217. package/lib/Markdown/plugins/type.d.ts +0 -60
  218. package/lib/Markdown/plugins/type.js +0 -1
  219. /package/components/Markdown/{Markdown/defaultComponents/DisabledImage.tsx → core/components/DisableImage.tsx} +0 -0
  220. /package/components/Markdown/{Markdown/defaultComponents → core/components}/Media.tsx +0 -0
  221. /package/components/Markdown/{plugins → core/plugins}/cursor/Dot.tsx +0 -0
  222. /package/lib/Markdown/{Markdown/defaultComponents → core/components}/CodeBlock.d.ts +0 -0
  223. /package/lib/Markdown/{Markdown/defaultComponents → core/components}/CodeBlock.js +0 -0
  224. /package/lib/Markdown/{Markdown/defaultComponents/DisabledImage.d.ts → core/components/DisableImage.d.ts} +0 -0
  225. /package/lib/Markdown/{Markdown/defaultComponents/DisabledImage.js → core/components/DisableImage.js} +0 -0
  226. /package/lib/Markdown/{Markdown/defaultComponents → core/components}/Media.d.ts +0 -0
  227. /package/lib/Markdown/{Markdown/defaultComponents → core/components}/Media.js +0 -0
  228. /package/lib/Markdown/{plugins → core/plugins}/citations/CitationComponent.d.ts +0 -0
  229. /package/lib/Markdown/{plugins → core/plugins}/cursor/Dot.d.ts +0 -0
  230. /package/lib/Markdown/{plugins → core/plugins}/cursor/Underline.d.ts +0 -0
  231. /package/lib/Markdown/{plugins → core/plugins}/cursor/index.d.ts +0 -0
  232. /package/lib/Markdown/{Markdown/style.d.ts → styles.d.ts} +0 -0
  233. /package/lib/{AGUI/components/chat/props.js → Markdown/types.js} +0 -0
@@ -1,97 +0,0 @@
1
- var _excluded = ["AssistantMessage"];
2
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
- import { useCopilotContext } from "@copilotkit/react-core";
5
- import { AssistantMessage as DefaultAssistantMessage } from "./AssistantMessage";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- export function RenderAgentStateMessage(_ref) {
8
- var _ref$AssistantMessage = _ref.AssistantMessage,
9
- AssistantMessage = _ref$AssistantMessage === void 0 ? DefaultAssistantMessage : _ref$AssistantMessage,
10
- props = _objectWithoutProperties(_ref, _excluded);
11
- var _useCopilotContext = useCopilotContext(),
12
- chatComponentsCache = _useCopilotContext.chatComponentsCache;
13
- var message = props.message,
14
- inProgress = props.inProgress,
15
- index = props.index,
16
- isCurrentMessage = props.isCurrentMessage;
17
- if (message.isAgentStateMessage()) {
18
- var render;
19
- if (chatComponentsCache.current !== null) {
20
- render = chatComponentsCache.current.coAgentStateRenders["".concat(message.agentName, "-").concat(message.nodeName)] || chatComponentsCache.current.coAgentStateRenders["".concat(message.agentName, "-global")];
21
- }
22
- if (render) {
23
- // render a static string
24
- if (typeof render === "string") {
25
- // when render is static, we show it only when in progress
26
- if (isCurrentMessage && inProgress) {
27
- return /*#__PURE__*/_jsx(AssistantMessage, {
28
- rawData: message,
29
- message: render,
30
- "data-message-role": "assistant",
31
- isLoading: true,
32
- isGenerating: true
33
- }, index);
34
- }
35
- // Done - silent by default to avoid a series of "done" messages
36
- else {
37
- return null;
38
- }
39
- }
40
- // render is a function
41
- else {
42
- var state = message.state;
43
- var status = message.active ? "inProgress" : "complete";
44
- var toRender = render({
45
- status: status,
46
- state: state,
47
- nodeName: message.nodeName
48
- });
49
-
50
- // No result and complete: stay silent
51
- if (!toRender && status === "complete") {
52
- return null;
53
- }
54
- if (!toRender && isCurrentMessage && inProgress) {
55
- return /*#__PURE__*/_jsx(AssistantMessage, {
56
- "data-message-role": "assistant",
57
- rawData: message,
58
- isLoading: true,
59
- isGenerating: true
60
- }, index);
61
- } else if (!toRender) {
62
- return null;
63
- }
64
- if (typeof toRender === "string") {
65
- return /*#__PURE__*/_jsx(AssistantMessage, {
66
- rawData: message,
67
- message: toRender,
68
- isLoading: true,
69
- isGenerating: true,
70
- "data-message-role": "assistant"
71
- }, index);
72
- } else {
73
- return /*#__PURE__*/_jsx(AssistantMessage, {
74
- rawData: message,
75
- "data-message-role": "agent-state-render",
76
- isLoading: false,
77
- isGenerating: false,
78
- subComponent: toRender
79
- }, index);
80
- }
81
- }
82
- }
83
- // No render function found- show the default message
84
- else if (!inProgress || !isCurrentMessage) {
85
- // Done - silent by default to avoid a series of "done" messages
86
- return null;
87
- } else {
88
- // In progress
89
- return /*#__PURE__*/_jsx(AssistantMessage, {
90
- rawData: message,
91
- isLoading: true,
92
- isGenerating: true,
93
- "data-message-role": "assistant"
94
- }, index);
95
- }
96
- }
97
- }
@@ -1,2 +0,0 @@
1
- import { RenderMessageProps } from "../props";
2
- export declare function RenderImageMessage({ UserMessage, AssistantMessage, ...props }: RenderMessageProps): import("react/jsx-runtime").JSX.Element;
@@ -1,61 +0,0 @@
1
- var _excluded = ["UserMessage", "AssistantMessage"];
2
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
- import { UserMessage as DefaultUserMessage } from "./UserMessage";
5
- import { AssistantMessage as DefaultAssistantMessage } from "./AssistantMessage";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- export function RenderImageMessage(_ref) {
8
- var _ref$UserMessage = _ref.UserMessage,
9
- UserMessage = _ref$UserMessage === void 0 ? DefaultUserMessage : _ref$UserMessage,
10
- _ref$AssistantMessage = _ref.AssistantMessage,
11
- AssistantMessage = _ref$AssistantMessage === void 0 ? DefaultAssistantMessage : _ref$AssistantMessage,
12
- props = _objectWithoutProperties(_ref, _excluded);
13
- var message = props.message,
14
- inProgress = props.inProgress,
15
- index = props.index,
16
- isCurrentMessage = props.isCurrentMessage,
17
- _onRegenerate = props.onRegenerate,
18
- onCopy = props.onCopy,
19
- onThumbsUp = props.onThumbsUp,
20
- onThumbsDown = props.onThumbsDown;
21
- if (message.isImageMessage()) {
22
- var imageData = "data:".concat(message.format, ";base64,").concat(message.bytes);
23
- var imageComponent = /*#__PURE__*/_jsx("div", {
24
- className: "copilotKitImage",
25
- children: /*#__PURE__*/_jsx("img", {
26
- src: imageData,
27
- alt: "User uploaded image",
28
- style: {
29
- maxWidth: "100%",
30
- maxHeight: "300px",
31
- borderRadius: "8px"
32
- }
33
- })
34
- });
35
- if (message.role === "user") {
36
- return /*#__PURE__*/_jsx(UserMessage, {
37
- "data-message-role": "user",
38
- message: "",
39
- rawData: message,
40
- subComponent: imageComponent
41
- }, index);
42
- } else if (message.role === "assistant") {
43
- return /*#__PURE__*/_jsx(AssistantMessage, {
44
- "data-message-role": "assistant",
45
- message: "",
46
- rawData: message,
47
- subComponent: imageComponent,
48
- isLoading: inProgress && isCurrentMessage && !message.bytes,
49
- isGenerating: inProgress && isCurrentMessage && !!message.bytes,
50
- isCurrentMessage: isCurrentMessage,
51
- onRegenerate: function onRegenerate() {
52
- return _onRegenerate === null || _onRegenerate === void 0 ? void 0 : _onRegenerate(message.id);
53
- },
54
- onCopy: onCopy,
55
- onThumbsUp: onThumbsUp,
56
- onThumbsDown: onThumbsDown
57
- }, index);
58
- }
59
- }
60
- return null;
61
- }
@@ -1,2 +0,0 @@
1
- import { RenderMessageProps } from "../props";
2
- export declare function RenderResultMessage({ AssistantMessage, ...props }: RenderMessageProps): import("react/jsx-runtime").JSX.Element;
@@ -1,27 +0,0 @@
1
- var _excluded = ["AssistantMessage"];
2
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
- import { AssistantMessage as DefaultAssistantMessage } from "./AssistantMessage";
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- export function RenderResultMessage(_ref) {
7
- var _ref$AssistantMessage = _ref.AssistantMessage,
8
- AssistantMessage = _ref$AssistantMessage === void 0 ? DefaultAssistantMessage : _ref$AssistantMessage,
9
- props = _objectWithoutProperties(_ref, _excluded);
10
- var message = props.message,
11
- inProgress = props.inProgress,
12
- index = props.index,
13
- isCurrentMessage = props.isCurrentMessage;
14
- if (message.isResultMessage() && inProgress && isCurrentMessage) {
15
- return /*#__PURE__*/_jsx(AssistantMessage, {
16
- "data-message-role": "assistant",
17
- rawData: message,
18
- isLoading: true,
19
- isGenerating: true
20
- }, index);
21
- }
22
-
23
- // Avoid 'Nothing was returned from render' React error
24
- else {
25
- return null;
26
- }
27
- }
@@ -1,2 +0,0 @@
1
- import { RenderMessageProps } from "../props";
2
- export declare function RenderTextMessage({ UserMessage, AssistantMessage, ...props }: RenderMessageProps): import("react/jsx-runtime").JSX.Element;
@@ -1,47 +0,0 @@
1
- var _excluded = ["UserMessage", "AssistantMessage"];
2
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
- import { UserMessage as DefaultUserMessage } from "./UserMessage";
5
- import { AssistantMessage as DefaultAssistantMessage } from "./AssistantMessage";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- export function RenderTextMessage(_ref) {
8
- var _ref$UserMessage = _ref.UserMessage,
9
- UserMessage = _ref$UserMessage === void 0 ? DefaultUserMessage : _ref$UserMessage,
10
- _ref$AssistantMessage = _ref.AssistantMessage,
11
- AssistantMessage = _ref$AssistantMessage === void 0 ? DefaultAssistantMessage : _ref$AssistantMessage,
12
- props = _objectWithoutProperties(_ref, _excluded);
13
- var message = props.message,
14
- inProgress = props.inProgress,
15
- index = props.index,
16
- isCurrentMessage = props.isCurrentMessage,
17
- _onRegenerate = props.onRegenerate,
18
- onCopy = props.onCopy,
19
- onThumbsUp = props.onThumbsUp,
20
- onThumbsDown = props.onThumbsDown,
21
- markdownTagRenderers = props.markdownTagRenderers;
22
- if (message.isTextMessage()) {
23
- if (message.role === "user") {
24
- return /*#__PURE__*/_jsx(UserMessage, {
25
- "data-message-role": "user",
26
- message: message.content,
27
- rawData: message
28
- }, index);
29
- } else if (message.role == "assistant") {
30
- return /*#__PURE__*/_jsx(AssistantMessage, {
31
- "data-message-role": "assistant",
32
- message: message.content,
33
- rawData: message,
34
- isLoading: inProgress && isCurrentMessage && !message.content,
35
- isGenerating: inProgress && isCurrentMessage && !!message.content,
36
- isCurrentMessage: isCurrentMessage,
37
- onRegenerate: function onRegenerate() {
38
- return _onRegenerate === null || _onRegenerate === void 0 ? void 0 : _onRegenerate(message.id);
39
- },
40
- onCopy: onCopy,
41
- onThumbsUp: onThumbsUp,
42
- onThumbsDown: onThumbsDown,
43
- markdownTagRenderers: markdownTagRenderers
44
- }, index);
45
- }
46
- }
47
- }
@@ -1,2 +0,0 @@
1
- import { UserMessageProps } from "../props";
2
- export declare const UserMessage: (props: UserMessageProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,9 +0,0 @@
1
- import { Bubble } from "../../../..";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- export var UserMessage = function UserMessage(props) {
4
- return /*#__PURE__*/_jsx(Bubble, {
5
- role: "user",
6
- content: props.rawData.content,
7
- id: props.rawData.id
8
- });
9
- };
@@ -1,157 +0,0 @@
1
- import { Message, TextMessage } from "@copilotkit/runtime-client-gql";
2
- import { CopilotChatSuggestion } from "../../types/suggestions";
3
- import { ReactNode } from "react";
4
- export interface ButtonProps {
5
- }
6
- export interface WindowProps {
7
- clickOutsideToClose: boolean;
8
- hitEscapeToClose: boolean;
9
- shortcut: string;
10
- children?: React.ReactNode;
11
- }
12
- export interface HeaderProps {
13
- }
14
- export interface SuggestionsProps {
15
- title: string;
16
- message: string;
17
- partial?: boolean;
18
- className?: string;
19
- onClick: (message: string) => void;
20
- }
21
- export type ComponentsMap<T extends Record<string, object> = Record<string, object>> = {
22
- [K in keyof T]: React.FC<{
23
- children?: ReactNode;
24
- } & T[K]>;
25
- };
26
- export interface MessagesProps {
27
- messages: Message[];
28
- inProgress: boolean;
29
- children?: React.ReactNode;
30
- AssistantMessage: React.ComponentType<AssistantMessageProps>;
31
- UserMessage: React.ComponentType<UserMessageProps>;
32
- RenderTextMessage: React.ComponentType<RenderMessageProps>;
33
- RenderActionExecutionMessage: React.ComponentType<RenderMessageProps>;
34
- RenderAgentStateMessage: React.ComponentType<RenderMessageProps>;
35
- RenderResultMessage: React.ComponentType<RenderMessageProps>;
36
- RenderImageMessage: React.ComponentType<RenderMessageProps>;
37
- /**
38
- * Callback function to regenerate the assistant's response
39
- */
40
- onRegenerate?: (messageId: string) => void;
41
- /**
42
- * Callback function when the message is copied
43
- */
44
- onCopy?: (message: string) => void;
45
- /**
46
- * Callback function for thumbs up feedback
47
- */
48
- onThumbsUp?: (message: TextMessage) => void;
49
- /**
50
- * Callback function for thumbs down feedback
51
- */
52
- onThumbsDown?: (message: TextMessage) => void;
53
- /**
54
- * A list of markdown components to render in assistant message.
55
- * Useful when you want to render custom elements in the message (e.g a reference tag element)
56
- */
57
- markdownTagRenderers?: ComponentsMap;
58
- }
59
- export interface Renderer {
60
- content: string;
61
- }
62
- export interface UserMessageProps {
63
- message?: string;
64
- rawData: any;
65
- subComponent?: React.JSX.Element;
66
- }
67
- export interface AssistantMessageProps {
68
- /**
69
- * The message content from the assistant
70
- */
71
- message?: string;
72
- /**
73
- * Indicates if this is the last message
74
- */
75
- isCurrentMessage?: boolean;
76
- /**
77
- * The raw data from the assistant's response
78
- */
79
- rawData: any;
80
- /**
81
- * A component that was decided to render by the LLM.
82
- * When working with useCopilotActions and useCoAgentStateRender, this will be
83
- * the render component that was specified.
84
- */
85
- subComponent?: React.JSX.Element;
86
- /**
87
- * Whether a response is loading, this is when the LLM is thinking of a response but hasn't finished yet.
88
- */
89
- isLoading: boolean;
90
- /**
91
- * Whether a response is generating, this is when the LLM is actively generating and streaming content.
92
- */
93
- isGenerating: boolean;
94
- /**
95
- * Callback function to regenerate the assistant's response
96
- */
97
- onRegenerate?: () => void;
98
- /**
99
- * Callback function when the message is copied
100
- */
101
- onCopy?: (message: string) => void;
102
- /**
103
- * Callback function for thumbs up feedback
104
- */
105
- onThumbsUp?: (message: TextMessage) => void;
106
- /**
107
- * Callback function for thumbs down feedback
108
- */
109
- onThumbsDown?: (message: TextMessage) => void;
110
- /**
111
- * A list of markdown components to render in assistant message.
112
- * Useful when you want to render custom elements in the message (e.g a reference tag element)
113
- */
114
- markdownTagRenderers?: ComponentsMap;
115
- }
116
- export interface RenderMessageProps {
117
- message: Message;
118
- inProgress: boolean;
119
- index: number;
120
- isCurrentMessage: boolean;
121
- actionResult?: string;
122
- AssistantMessage?: React.ComponentType<AssistantMessageProps>;
123
- UserMessage?: React.ComponentType<UserMessageProps>;
124
- /**
125
- * Callback function to regenerate the assistant's response
126
- */
127
- onRegenerate?: (messageId: string) => void;
128
- /**
129
- * Callback function when the message is copied
130
- */
131
- onCopy?: (message: string) => void;
132
- /**
133
- * Callback function for thumbs up feedback
134
- */
135
- onThumbsUp?: (message: TextMessage) => void;
136
- /**
137
- * Callback function for thumbs down feedback
138
- */
139
- onThumbsDown?: (message: TextMessage) => void;
140
- /**
141
- * A list of markdown components to render in assistant message.
142
- * Useful when you want to render custom elements in the message (e.g a reference tag element)
143
- */
144
- markdownTagRenderers?: ComponentsMap;
145
- }
146
- export interface InputProps {
147
- inProgress: boolean;
148
- onSend: (text: string) => Promise<Message>;
149
- isVisible?: boolean;
150
- onStop?: () => void;
151
- onUpload?: () => void;
152
- hideStopButton?: boolean;
153
- }
154
- export interface RenderSuggestionsListProps {
155
- suggestions: CopilotChatSuggestion[];
156
- onSuggestionClick: (message: string) => void;
157
- }
@@ -1 +0,0 @@
1
- export * from "./chat";
@@ -1 +0,0 @@
1
- export * from "./chat";
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export * from "./use-copilot-chat-suggestions";
@@ -1 +0,0 @@
1
- export * from "./use-copilot-chat-suggestions";
@@ -1,87 +0,0 @@
1
- /**
2
- * <Callout type="warning">
3
- * useCopilotChatSuggestions is experimental. The interface is not final and
4
- * can change without notice.
5
- * </Callout>
6
- *
7
- * `useCopilotReadable` is a React hook that provides app-state and other information
8
- * to the Copilot. Optionally, the hook can also handle hierarchical state within your
9
- * application, passing these parent-child relationships to the Copilot.
10
- *
11
- * <br/>
12
- * <img src="/images/use-copilot-chat-suggestions/use-copilot-chat-suggestions.gif" width="500" />
13
- *
14
- * ## Usage
15
- *
16
- * ### Install Dependencies
17
- *
18
- * This component is part of the [@copilotkit/react-ui](https://npmjs.com/package/@copilotkit/react-ui) package.
19
- *
20
- * ```shell npm2yarn \"@copilotkit/react-ui"\
21
- * npm install @copilotkit/react-core @copilotkit/react-ui
22
- * ```
23
- *
24
- * ### Simple Usage
25
- *
26
- * ```tsx
27
- * import { useCopilotChatSuggestions } from "@copilotkit/react-ui";
28
- *
29
- * export function MyComponent() {
30
- * const [employees, setEmployees] = useState([]);
31
- *
32
- * useCopilotChatSuggestions({
33
- * instructions: `The following employees are on duty: ${JSON.stringify(employees)}`,
34
- * });
35
- * }
36
- * ```
37
- *
38
- * ### Dependency Management
39
- *
40
- * ```tsx
41
- * import { useCopilotChatSuggestions } from "@copilotkit/react-ui";
42
- *
43
- * export function MyComponent() {
44
- * useCopilotChatSuggestions(
45
- * {
46
- * instructions: "Suggest the most relevant next actions.",
47
- * },
48
- * [appState],
49
- * );
50
- * }
51
- * ```
52
- *
53
- * In the example above, the suggestions are generated based on the given instructions.
54
- * The hook monitors `appState`, and updates suggestions accordingly whenever it changes.
55
- *
56
- * ### Behavior and Lifecycle
57
- *
58
- * The hook registers the configuration with the chat context upon component mount and
59
- * removes it on unmount, ensuring a clean and efficient lifecycle management.
60
- */
61
- interface UseCopilotChatSuggestionsConfiguration {
62
- /**
63
- * A prompt or instructions for the GPT to generate suggestions.
64
- */
65
- instructions: string;
66
- /**
67
- * The minimum number of suggestions to generate. Defaults to `1`.
68
- * @default 1
69
- */
70
- minSuggestions?: number;
71
- /**
72
- * The maximum number of suggestions to generate. Defaults to `3`.
73
- * @default 1
74
- */
75
- maxSuggestions?: number;
76
- /**
77
- * Whether the suggestions are available. Defaults to `enabled`.
78
- * @default enabled
79
- */
80
- available?: "enabled" | "disabled";
81
- /**
82
- * An optional class name to apply to the suggestions.
83
- */
84
- className?: string;
85
- }
86
- export declare function useCopilotChatSuggestions({ available, instructions, className, minSuggestions, maxSuggestions, }: UseCopilotChatSuggestionsConfiguration, dependencies?: any[]): void;
87
- export {};
@@ -1,95 +0,0 @@
1
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
- /**
8
- * <Callout type="warning">
9
- * useCopilotChatSuggestions is experimental. The interface is not final and
10
- * can change without notice.
11
- * </Callout>
12
- *
13
- * `useCopilotReadable` is a React hook that provides app-state and other information
14
- * to the Copilot. Optionally, the hook can also handle hierarchical state within your
15
- * application, passing these parent-child relationships to the Copilot.
16
- *
17
- * <br/>
18
- * <img src="/images/use-copilot-chat-suggestions/use-copilot-chat-suggestions.gif" width="500" />
19
- *
20
- * ## Usage
21
- *
22
- * ### Install Dependencies
23
- *
24
- * This component is part of the [@copilotkit/react-ui](https://npmjs.com/package/@copilotkit/react-ui) package.
25
- *
26
- * ```shell npm2yarn \"@copilotkit/react-ui"\
27
- * npm install @copilotkit/react-core @copilotkit/react-ui
28
- * ```
29
- *
30
- * ### Simple Usage
31
- *
32
- * ```tsx
33
- * import { useCopilotChatSuggestions } from "@copilotkit/react-ui";
34
- *
35
- * export function MyComponent() {
36
- * const [employees, setEmployees] = useState([]);
37
- *
38
- * useCopilotChatSuggestions({
39
- * instructions: `The following employees are on duty: ${JSON.stringify(employees)}`,
40
- * });
41
- * }
42
- * ```
43
- *
44
- * ### Dependency Management
45
- *
46
- * ```tsx
47
- * import { useCopilotChatSuggestions } from "@copilotkit/react-ui";
48
- *
49
- * export function MyComponent() {
50
- * useCopilotChatSuggestions(
51
- * {
52
- * instructions: "Suggest the most relevant next actions.",
53
- * },
54
- * [appState],
55
- * );
56
- * }
57
- * ```
58
- *
59
- * In the example above, the suggestions are generated based on the given instructions.
60
- * The hook monitors `appState`, and updates suggestions accordingly whenever it changes.
61
- *
62
- * ### Behavior and Lifecycle
63
- *
64
- * The hook registers the configuration with the chat context upon component mount and
65
- * removes it on unmount, ensuring a clean and efficient lifecycle management.
66
- */
67
-
68
- import { useEffect } from "react";
69
- import { useCopilotContext } from "@copilotkit/react-core";
70
- import { randomId } from "@copilotkit/shared";
71
- export function useCopilotChatSuggestions(_ref) {
72
- var _ref$available = _ref.available,
73
- available = _ref$available === void 0 ? "enabled" : _ref$available,
74
- instructions = _ref.instructions,
75
- className = _ref.className,
76
- _ref$minSuggestions = _ref.minSuggestions,
77
- minSuggestions = _ref$minSuggestions === void 0 ? 1 : _ref$minSuggestions,
78
- _ref$maxSuggestions = _ref.maxSuggestions,
79
- maxSuggestions = _ref$maxSuggestions === void 0 ? 3 : _ref$maxSuggestions;
80
- var dependencies = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
81
- var context = useCopilotContext();
82
- useEffect(function () {
83
- if (available === "disabled") return;
84
- var id = randomId();
85
- context.addChatSuggestionConfiguration(id, {
86
- instructions: instructions,
87
- minSuggestions: minSuggestions,
88
- maxSuggestions: maxSuggestions,
89
- className: className
90
- });
91
- return function () {
92
- context.removeChatSuggestionConfiguration(id);
93
- };
94
- }, [].concat(_toConsumableArray(dependencies), [instructions, minSuggestions, maxSuggestions, className, available]));
95
- }
@@ -1,7 +0,0 @@
1
- export interface useCopyToClipboardProps {
2
- timeout?: number;
3
- }
4
- export declare function useCopyToClipboard({ timeout }: useCopyToClipboardProps): {
5
- isCopied: Boolean;
6
- copyToClipboard: (value: string) => void;
7
- };
@@ -1,34 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import * as React from "react";
8
- export function useCopyToClipboard(_ref) {
9
- var _ref$timeout = _ref.timeout,
10
- timeout = _ref$timeout === void 0 ? 2000 : _ref$timeout;
11
- var _React$useState = React.useState(false),
12
- _React$useState2 = _slicedToArray(_React$useState, 2),
13
- isCopied = _React$useState2[0],
14
- setIsCopied = _React$useState2[1];
15
- var copyToClipboard = function copyToClipboard(value) {
16
- var _navigator$clipboard;
17
- if (typeof window === "undefined" || !((_navigator$clipboard = navigator.clipboard) !== null && _navigator$clipboard !== void 0 && _navigator$clipboard.writeText)) {
18
- return;
19
- }
20
- if (!value) {
21
- return;
22
- }
23
- navigator.clipboard.writeText(value).then(function () {
24
- setIsCopied(true);
25
- setTimeout(function () {
26
- setIsCopied(false);
27
- }, timeout);
28
- });
29
- };
30
- return {
31
- isCopied: isCopied,
32
- copyToClipboard: copyToClipboard
33
- };
34
- }
@@ -1 +0,0 @@
1
- export declare const useDarkMode: () => boolean;