@copilotkit/react-ui 1.8.5-next.1 → 1.8.5-next.3
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/CHANGELOG.md +18 -0
- package/dist/{chunk-Q2YY2NX3.mjs → chunk-COZFHP6Y.mjs} +2 -2
- package/dist/{chunk-MYUOPOIL.mjs → chunk-DRAM4KIH.mjs} +13 -13
- package/dist/{chunk-PCTCOQK2.mjs → chunk-DYUT4CVD.mjs} +4 -4
- package/dist/{chunk-4TWPMWD4.mjs → chunk-GULJZORG.mjs} +8 -8
- package/dist/chunk-JGMFJZMG.mjs +11 -0
- package/dist/chunk-JGMFJZMG.mjs.map +1 -0
- package/dist/{chunk-XNQO5AZZ.mjs → chunk-KSW7FVYG.mjs} +2 -2
- package/dist/{chunk-5M7ODWKH.mjs → chunk-N7ZQXCKF.mjs} +2 -2
- package/dist/{chunk-6QV7AIIG.mjs → chunk-P53JYD5X.mjs} +2 -2
- package/dist/{chunk-D5XIJNXQ.mjs → chunk-Q6XB5B2M.mjs} +7 -7
- package/dist/{chunk-2OTVZXDX.mjs → chunk-QDC2Q7XX.mjs} +2 -2
- package/dist/{chunk-NMNC4ROZ.mjs → chunk-QMW2LYI3.mjs} +2 -2
- package/dist/{chunk-P7S3E5UW.mjs → chunk-QSUC3MKT.mjs} +35 -7
- package/dist/chunk-QSUC3MKT.mjs.map +1 -0
- package/dist/{chunk-QJKMOGWN.mjs → chunk-RXBEZZ5I.mjs} +4 -4
- package/dist/{chunk-U6ISBBRF.mjs → chunk-TYAYVE3X.mjs} +2 -2
- package/dist/{chunk-62QMTKMJ.mjs → chunk-USR5CBYD.mjs} +4 -4
- package/dist/{chunk-WNC6OCIB.mjs → chunk-YIQTTJAT.mjs} +2 -2
- package/dist/components/chat/Chat.mjs +11 -11
- package/dist/components/chat/CodeBlock.mjs +2 -2
- package/dist/components/chat/Header.mjs +3 -3
- package/dist/components/chat/Input.mjs +2 -2
- package/dist/components/chat/Markdown.mjs +3 -3
- package/dist/components/chat/Modal.js +66 -32
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +17 -16
- package/dist/components/chat/Popup.js +66 -32
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +18 -17
- package/dist/components/chat/Sidebar.js +66 -32
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +18 -17
- package/dist/components/chat/Window.js +39 -5
- package/dist/components/chat/Window.js.map +1 -1
- package/dist/components/chat/Window.mjs +2 -1
- package/dist/components/chat/index.js +66 -32
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +22 -21
- package/dist/components/chat/messages/AssistantMessage.mjs +4 -4
- package/dist/components/chat/messages/RenderActionExecutionMessage.mjs +5 -5
- package/dist/components/chat/messages/RenderAgentStateMessage.mjs +5 -5
- package/dist/components/chat/messages/RenderResultMessage.mjs +5 -5
- package/dist/components/chat/messages/RenderTextMessage.mjs +5 -5
- package/dist/components/dev-console/console.mjs +2 -2
- package/dist/components/dev-console/index.mjs +2 -2
- package/dist/components/index.js +66 -32
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +22 -21
- package/dist/hooks/use-dark-mode.d.ts +3 -0
- package/dist/hooks/use-dark-mode.js +35 -0
- package/dist/hooks/use-dark-mode.js.map +1 -0
- package/dist/hooks/use-dark-mode.mjs +8 -0
- package/dist/hooks/use-dark-mode.mjs.map +1 -0
- package/dist/index.css +25 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +68 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -27
- package/package.json +4 -4
- package/src/components/chat/Window.tsx +26 -1
- package/src/css/input.css +1 -1
- package/src/css/window.css +27 -0
- package/src/hooks/use-dark-mode.ts +10 -0
- package/dist/chunk-P7S3E5UW.mjs.map +0 -1
- /package/dist/{chunk-Q2YY2NX3.mjs.map → chunk-COZFHP6Y.mjs.map} +0 -0
- /package/dist/{chunk-MYUOPOIL.mjs.map → chunk-DRAM4KIH.mjs.map} +0 -0
- /package/dist/{chunk-PCTCOQK2.mjs.map → chunk-DYUT4CVD.mjs.map} +0 -0
- /package/dist/{chunk-4TWPMWD4.mjs.map → chunk-GULJZORG.mjs.map} +0 -0
- /package/dist/{chunk-XNQO5AZZ.mjs.map → chunk-KSW7FVYG.mjs.map} +0 -0
- /package/dist/{chunk-5M7ODWKH.mjs.map → chunk-N7ZQXCKF.mjs.map} +0 -0
- /package/dist/{chunk-6QV7AIIG.mjs.map → chunk-P53JYD5X.mjs.map} +0 -0
- /package/dist/{chunk-D5XIJNXQ.mjs.map → chunk-Q6XB5B2M.mjs.map} +0 -0
- /package/dist/{chunk-2OTVZXDX.mjs.map → chunk-QDC2Q7XX.mjs.map} +0 -0
- /package/dist/{chunk-NMNC4ROZ.mjs.map → chunk-QMW2LYI3.mjs.map} +0 -0
- /package/dist/{chunk-QJKMOGWN.mjs.map → chunk-RXBEZZ5I.mjs.map} +0 -0
- /package/dist/{chunk-U6ISBBRF.mjs.map → chunk-TYAYVE3X.mjs.map} +0 -0
- /package/dist/{chunk-62QMTKMJ.mjs.map → chunk-USR5CBYD.mjs.map} +0 -0
- /package/dist/{chunk-WNC6OCIB.mjs.map → chunk-YIQTTJAT.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# ui
|
|
2
2
|
|
|
3
|
+
## 1.8.5-next.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [77a7457]
|
|
8
|
+
- @copilotkit/react-core@1.8.5-next.3
|
|
9
|
+
- @copilotkit/runtime-client-gql@1.8.5-next.3
|
|
10
|
+
- @copilotkit/shared@1.8.5-next.3
|
|
11
|
+
|
|
12
|
+
## 1.8.5-next.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 4b5452d: - feat: add powered-by-copilotkit watermark
|
|
17
|
+
- @copilotkit/react-core@1.8.5-next.2
|
|
18
|
+
- @copilotkit/runtime-client-gql@1.8.5-next.2
|
|
19
|
+
- @copilotkit/shared@1.8.5-next.2
|
|
20
|
+
|
|
3
21
|
## 1.8.5-next.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AssistantMessage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-N7ZQXCKF.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest
|
|
6
6
|
} from "./chunk-MRXNTQOX.mjs";
|
|
@@ -109,4 +109,4 @@ function RenderAgentStateMessage(_a) {
|
|
|
109
109
|
export {
|
|
110
110
|
RenderAgentStateMessage
|
|
111
111
|
};
|
|
112
|
-
//# sourceMappingURL=chunk-
|
|
112
|
+
//# sourceMappingURL=chunk-COZFHP6Y.mjs.map
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RenderActionExecutionMessage
|
|
3
|
+
} from "./chunk-QMW2LYI3.mjs";
|
|
4
|
+
import {
|
|
5
|
+
RenderAgentStateMessage
|
|
6
|
+
} from "./chunk-COZFHP6Y.mjs";
|
|
1
7
|
import {
|
|
2
8
|
RenderResultMessage
|
|
3
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YIQTTJAT.mjs";
|
|
4
10
|
import {
|
|
5
11
|
RenderTextMessage
|
|
6
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-USR5CBYD.mjs";
|
|
13
|
+
import {
|
|
14
|
+
AssistantMessage
|
|
15
|
+
} from "./chunk-N7ZQXCKF.mjs";
|
|
7
16
|
import {
|
|
8
17
|
UserMessage
|
|
9
18
|
} from "./chunk-HEIDCT7I.mjs";
|
|
10
|
-
import {
|
|
11
|
-
RenderActionExecutionMessage
|
|
12
|
-
} from "./chunk-NMNC4ROZ.mjs";
|
|
13
|
-
import {
|
|
14
|
-
RenderAgentStateMessage
|
|
15
|
-
} from "./chunk-Q2YY2NX3.mjs";
|
|
16
|
-
import {
|
|
17
|
-
AssistantMessage
|
|
18
|
-
} from "./chunk-5M7ODWKH.mjs";
|
|
19
19
|
import {
|
|
20
20
|
Suggestion,
|
|
21
21
|
reloadSuggestions
|
|
22
22
|
} from "./chunk-TOQ7P4DO.mjs";
|
|
23
23
|
import {
|
|
24
24
|
Input
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-RXBEZZ5I.mjs";
|
|
26
26
|
import {
|
|
27
27
|
Messages
|
|
28
28
|
} from "./chunk-ZY25LVYR.mjs";
|
|
@@ -328,4 +328,4 @@ export {
|
|
|
328
328
|
WrappedCopilotChat,
|
|
329
329
|
useCopilotChatLogic
|
|
330
330
|
};
|
|
331
|
-
//# sourceMappingURL=chunk-
|
|
331
|
+
//# sourceMappingURL=chunk-DRAM4KIH.mjs.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useCopyToClipboard
|
|
3
|
+
} from "./chunk-54JAUBUJ.mjs";
|
|
1
4
|
import {
|
|
2
5
|
CheckIcon,
|
|
3
6
|
CopyIcon,
|
|
4
7
|
DownloadIcon
|
|
5
8
|
} from "./chunk-ORSMX3SE.mjs";
|
|
6
|
-
import {
|
|
7
|
-
useCopyToClipboard
|
|
8
|
-
} from "./chunk-54JAUBUJ.mjs";
|
|
9
9
|
|
|
10
10
|
// src/components/chat/CodeBlock.tsx
|
|
11
11
|
import { memo } from "react";
|
|
@@ -386,4 +386,4 @@ export {
|
|
|
386
386
|
generateRandomString,
|
|
387
387
|
CodeBlock
|
|
388
388
|
};
|
|
389
|
-
//# sourceMappingURL=chunk-
|
|
389
|
+
//# sourceMappingURL=chunk-DYUT4CVD.mjs.map
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Window
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QSUC3MKT.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Header
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QDC2Q7XX.mjs";
|
|
7
7
|
import {
|
|
8
8
|
Button
|
|
9
9
|
} from "./chunk-YOEL33HG.mjs";
|
|
10
10
|
import {
|
|
11
11
|
CopilotChat
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DRAM4KIH.mjs";
|
|
13
|
+
import {
|
|
14
|
+
AssistantMessage
|
|
15
|
+
} from "./chunk-N7ZQXCKF.mjs";
|
|
13
16
|
import {
|
|
14
17
|
UserMessage
|
|
15
18
|
} from "./chunk-HEIDCT7I.mjs";
|
|
16
|
-
import {
|
|
17
|
-
AssistantMessage
|
|
18
|
-
} from "./chunk-5M7ODWKH.mjs";
|
|
19
19
|
import {
|
|
20
20
|
Input
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-RXBEZZ5I.mjs";
|
|
22
22
|
import {
|
|
23
23
|
Messages
|
|
24
24
|
} from "./chunk-ZY25LVYR.mjs";
|
|
@@ -103,4 +103,4 @@ var CopilotModal = ({
|
|
|
103
103
|
export {
|
|
104
104
|
CopilotModal
|
|
105
105
|
};
|
|
106
|
-
//# sourceMappingURL=chunk-
|
|
106
|
+
//# sourceMappingURL=chunk-GULJZORG.mjs.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/hooks/use-dark-mode.ts
|
|
2
|
+
var useDarkMode = () => {
|
|
3
|
+
if (typeof window === "undefined")
|
|
4
|
+
return false;
|
|
5
|
+
return document.documentElement.classList.contains("dark") || document.body.classList.contains("dark") || document.documentElement.getAttribute("data-theme") === "dark" || document.body.getAttribute("data-theme") === "dark" || window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
useDarkMode
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=chunk-JGMFJZMG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/use-dark-mode.ts"],"sourcesContent":["export const useDarkMode = () => {\n if (typeof window === \"undefined\") return false;\n return (\n document.documentElement.classList.contains(\"dark\") ||\n document.body.classList.contains(\"dark\") ||\n document.documentElement.getAttribute(\"data-theme\") === \"dark\" ||\n document.body.getAttribute(\"data-theme\") === \"dark\" ||\n window.matchMedia(\"(prefers-color-scheme: dark)\").matches\n );\n};\n"],"mappings":";AAAO,IAAM,cAAc,MAAM;AAC/B,MAAI,OAAO,WAAW;AAAa,WAAO;AAC1C,SACE,SAAS,gBAAgB,UAAU,SAAS,MAAM,KAClD,SAAS,KAAK,UAAU,SAAS,MAAM,KACvC,SAAS,gBAAgB,aAAa,YAAY,MAAM,UACxD,SAAS,KAAK,aAAa,YAAY,MAAM,UAC7C,OAAO,WAAW,8BAA8B,EAAE;AAEtD;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CodeBlock
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DYUT4CVD.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest,
|
|
6
6
|
__spreadProps,
|
|
@@ -69,4 +69,4 @@ var components = {
|
|
|
69
69
|
export {
|
|
70
70
|
Markdown
|
|
71
71
|
};
|
|
72
|
-
//# sourceMappingURL=chunk-
|
|
72
|
+
//# sourceMappingURL=chunk-KSW7FVYG.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Markdown
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KSW7FVYG.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useChatContext
|
|
6
6
|
} from "./chunk-UN2E3HCK.mjs";
|
|
@@ -109,4 +109,4 @@ var AssistantMessage = (props) => {
|
|
|
109
109
|
export {
|
|
110
110
|
AssistantMessage
|
|
111
111
|
};
|
|
112
|
-
//# sourceMappingURL=chunk-
|
|
112
|
+
//# sourceMappingURL=chunk-N7ZQXCKF.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GULJZORG.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__spreadProps,
|
|
6
6
|
__spreadValues
|
|
@@ -18,4 +18,4 @@ function CopilotPopup(props) {
|
|
|
18
18
|
export {
|
|
19
19
|
CopilotPopup
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-P53JYD5X.mjs.map
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CheckIcon,
|
|
3
|
+
ChevronDownIcon,
|
|
4
|
+
ExclamationMarkIcon,
|
|
5
|
+
ExclamationMarkTriangleIcon
|
|
6
|
+
} from "./chunk-Q5V6S67N.mjs";
|
|
1
7
|
import {
|
|
2
8
|
getPublishedCopilotKitVersion,
|
|
3
9
|
logActions,
|
|
@@ -8,12 +14,6 @@ import {
|
|
|
8
14
|
import {
|
|
9
15
|
CopilotKitHelpModal
|
|
10
16
|
} from "./chunk-NRA3CFEE.mjs";
|
|
11
|
-
import {
|
|
12
|
-
CheckIcon,
|
|
13
|
-
ChevronDownIcon,
|
|
14
|
-
ExclamationMarkIcon,
|
|
15
|
-
ExclamationMarkTriangleIcon
|
|
16
|
-
} from "./chunk-Q5V6S67N.mjs";
|
|
17
17
|
import {
|
|
18
18
|
SmallSpinnerIcon
|
|
19
19
|
} from "./chunk-ORSMX3SE.mjs";
|
|
@@ -201,4 +201,4 @@ export {
|
|
|
201
201
|
CopilotDevConsole,
|
|
202
202
|
DebugMenuButton
|
|
203
203
|
};
|
|
204
|
-
//# sourceMappingURL=chunk-
|
|
204
|
+
//# sourceMappingURL=chunk-Q6XB5B2M.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotDevConsole
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Q6XB5B2M.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useChatContext
|
|
6
6
|
} from "./chunk-UN2E3HCK.mjs";
|
|
@@ -29,4 +29,4 @@ var Header = ({}) => {
|
|
|
29
29
|
export {
|
|
30
30
|
Header
|
|
31
31
|
};
|
|
32
|
-
//# sourceMappingURL=chunk-
|
|
32
|
+
//# sourceMappingURL=chunk-QDC2Q7XX.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AssistantMessage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-N7ZQXCKF.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest
|
|
6
6
|
} from "./chunk-MRXNTQOX.mjs";
|
|
@@ -121,4 +121,4 @@ function RenderActionExecutionMessage(_a) {
|
|
|
121
121
|
export {
|
|
122
122
|
RenderActionExecutionMessage
|
|
123
123
|
};
|
|
124
|
-
//# sourceMappingURL=chunk-
|
|
124
|
+
//# sourceMappingURL=chunk-QMW2LYI3.mjs.map
|
|
@@ -1,25 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useDarkMode
|
|
3
|
+
} from "./chunk-JGMFJZMG.mjs";
|
|
1
4
|
import {
|
|
2
5
|
useChatContext
|
|
3
6
|
} from "./chunk-UN2E3HCK.mjs";
|
|
4
7
|
|
|
5
8
|
// src/components/chat/Window.tsx
|
|
6
9
|
import React, { useCallback, useEffect } from "react";
|
|
7
|
-
import {
|
|
10
|
+
import { useCopilotContext } from "@copilotkit/react-core";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
12
|
var Window = ({
|
|
9
13
|
children,
|
|
10
14
|
clickOutsideToClose,
|
|
11
15
|
shortcut,
|
|
12
16
|
hitEscapeToClose
|
|
13
17
|
}) => {
|
|
18
|
+
var _a;
|
|
14
19
|
const windowRef = React.useRef(null);
|
|
20
|
+
const context = useCopilotContext();
|
|
15
21
|
const { open, setOpen } = useChatContext();
|
|
16
22
|
const handleClickOutside = useCallback(
|
|
17
23
|
(event) => {
|
|
18
|
-
var
|
|
24
|
+
var _a2;
|
|
19
25
|
if (!clickOutsideToClose) {
|
|
20
26
|
return;
|
|
21
27
|
}
|
|
22
|
-
const parentElement = (
|
|
28
|
+
const parentElement = (_a2 = windowRef.current) == null ? void 0 : _a2.parentElement;
|
|
23
29
|
let className = "";
|
|
24
30
|
if (event.target instanceof HTMLElement) {
|
|
25
31
|
className = event.target.className;
|
|
@@ -33,10 +39,10 @@ var Window = ({
|
|
|
33
39
|
);
|
|
34
40
|
const handleKeyDown = useCallback(
|
|
35
41
|
(event) => {
|
|
36
|
-
var
|
|
42
|
+
var _a2;
|
|
37
43
|
const target = event.target;
|
|
38
44
|
const isInput = target.tagName === "INPUT" || target.tagName === "SELECT" || target.tagName === "TEXTAREA" || target.isContentEditable;
|
|
39
|
-
const isDescendantOfWrapper = (
|
|
45
|
+
const isDescendantOfWrapper = (_a2 = windowRef.current) == null ? void 0 : _a2.contains(target);
|
|
40
46
|
if (open && event.key === "Escape" && (!isInput || isDescendantOfWrapper) && hitEscapeToClose) {
|
|
41
47
|
setOpen(false);
|
|
42
48
|
} else if (event.key === shortcut && (isMacOS() && event.metaKey || !isMacOS() && event.ctrlKey) && (!isInput || isDescendantOfWrapper)) {
|
|
@@ -91,7 +97,29 @@ var Window = ({
|
|
|
91
97
|
}
|
|
92
98
|
};
|
|
93
99
|
}, [adjustForMobile, handleClickOutside, handleKeyDown]);
|
|
94
|
-
|
|
100
|
+
const isDark = useDarkMode();
|
|
101
|
+
const showPoweredBy = !((_a = context.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
102
|
+
const poweredByStyle = {
|
|
103
|
+
visibility: "visible",
|
|
104
|
+
display: "block",
|
|
105
|
+
position: "static",
|
|
106
|
+
textAlign: "center",
|
|
107
|
+
fontSize: "12px",
|
|
108
|
+
padding: "3px 0",
|
|
109
|
+
color: isDark ? "rgb(69, 69, 69)" : "rgb(214, 214, 214)"
|
|
110
|
+
};
|
|
111
|
+
return /* @__PURE__ */ jsxs(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
className: `copilotKitWindow ${showPoweredBy ? " poweredByContainer" : ""} ${open ? " open" : ""}`,
|
|
115
|
+
ref: windowRef,
|
|
116
|
+
children: [
|
|
117
|
+
children,
|
|
118
|
+
showPoweredBy && // @ts-expect-error -- expecting position not to be a string, but it can be.
|
|
119
|
+
/* @__PURE__ */ jsx("p", { className: "poweredBy", style: poweredByStyle, children: "Powered by CopilotKit" })
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
);
|
|
95
123
|
};
|
|
96
124
|
var preventScroll = (event) => {
|
|
97
125
|
let targetElement = event.target;
|
|
@@ -115,4 +143,4 @@ function isMacOS() {
|
|
|
115
143
|
export {
|
|
116
144
|
Window
|
|
117
145
|
};
|
|
118
|
-
//# sourceMappingURL=chunk-
|
|
146
|
+
//# sourceMappingURL=chunk-QSUC3MKT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Window.tsx"],"sourcesContent":["import React, { useCallback, useEffect } from \"react\";\nimport { WindowProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\nimport { useCopilotContext } from \"@copilotkit/react-core\";\nimport { useDarkMode } from \"../../hooks/use-dark-mode\";\n\nexport const Window = ({\n children,\n clickOutsideToClose,\n shortcut,\n hitEscapeToClose,\n}: WindowProps) => {\n const windowRef = React.useRef<HTMLDivElement>(null);\n const context = useCopilotContext();\n\n const { open, setOpen } = useChatContext();\n\n const handleClickOutside = useCallback(\n (event: MouseEvent) => {\n if (!clickOutsideToClose) {\n return;\n }\n\n const parentElement = windowRef.current?.parentElement;\n\n let className = \"\";\n if (event.target instanceof HTMLElement) {\n className = event.target.className;\n }\n\n if (\n open &&\n parentElement &&\n !parentElement.contains(event.target as any) &&\n // prevent closing the window when clicking on the debug menu\n !className.includes(\"copilotKitDebugMenu\")\n ) {\n setOpen(false);\n }\n },\n [clickOutsideToClose, open, setOpen],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n const target = event.target as HTMLElement;\n const isInput =\n target.tagName === \"INPUT\" ||\n target.tagName === \"SELECT\" ||\n target.tagName === \"TEXTAREA\" ||\n target.isContentEditable;\n\n const isDescendantOfWrapper = windowRef.current?.contains(target);\n\n if (\n open &&\n event.key === \"Escape\" &&\n (!isInput || isDescendantOfWrapper) &&\n hitEscapeToClose\n ) {\n setOpen(false);\n } else if (\n event.key === shortcut &&\n ((isMacOS() && event.metaKey) || (!isMacOS() && event.ctrlKey)) &&\n (!isInput || isDescendantOfWrapper)\n ) {\n setOpen(!open);\n }\n },\n [hitEscapeToClose, shortcut, open, setOpen],\n );\n\n const adjustForMobile = useCallback(() => {\n const copilotKitWindow = windowRef.current;\n const vv = window.visualViewport;\n if (!copilotKitWindow || !vv) {\n return;\n }\n\n if (window.innerWidth < 640 && open) {\n copilotKitWindow.style.height = `${vv.height}px`;\n copilotKitWindow.style.left = `${vv.offsetLeft}px`;\n copilotKitWindow.style.top = `${vv.offsetTop}px`;\n\n document.body.style.position = \"fixed\";\n document.body.style.width = \"100%\";\n document.body.style.height = `${window.innerHeight}px`;\n document.body.style.overflow = \"hidden\";\n document.body.style.touchAction = \"none\";\n\n // Prevent scrolling on iOS\n document.body.addEventListener(\"touchmove\", preventScroll, {\n passive: false,\n });\n } else {\n copilotKitWindow.style.height = \"\";\n copilotKitWindow.style.left = \"\";\n copilotKitWindow.style.top = \"\";\n document.body.style.position = \"\";\n document.body.style.height = \"\";\n document.body.style.width = \"\";\n document.body.style.overflow = \"\";\n document.body.style.top = \"\";\n document.body.style.touchAction = \"\";\n\n document.body.removeEventListener(\"touchmove\", preventScroll);\n }\n }, [open]);\n\n useEffect(() => {\n document.addEventListener(\"mousedown\", handleClickOutside);\n document.addEventListener(\"keydown\", handleKeyDown);\n if (window.visualViewport) {\n window.visualViewport.addEventListener(\"resize\", adjustForMobile);\n adjustForMobile();\n }\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n document.removeEventListener(\"keydown\", handleKeyDown);\n if (window.visualViewport) {\n window.visualViewport.removeEventListener(\"resize\", adjustForMobile);\n }\n };\n }, [adjustForMobile, handleClickOutside, handleKeyDown]);\n\n const isDark = useDarkMode();\n\n const showPoweredBy = !context.copilotApiConfig?.publicApiKey;\n const poweredByStyle = {\n visibility: \"visible\",\n display: \"block\",\n position: \"static\",\n textAlign: \"center\",\n fontSize: \"12px\",\n padding: \"3px 0\",\n color: isDark ? \"rgb(69, 69, 69)\" : \"rgb(214, 214, 214)\",\n };\n\n return (\n <div\n className={`copilotKitWindow ${showPoweredBy ? \" poweredByContainer\" : \"\"} ${open ? \" open\" : \"\"}`}\n ref={windowRef}\n >\n {children}\n {showPoweredBy && (\n // @ts-expect-error -- expecting position not to be a string, but it can be.\n <p className=\"poweredBy\" style={poweredByStyle}>\n Powered by CopilotKit\n </p>\n )}\n </div>\n );\n};\n\nconst preventScroll = (event: TouchEvent): void => {\n let targetElement = event.target as Element;\n\n // Function to check if the target has the parent with a given class\n const hasParentWithClass = (element: Element, className: string): boolean => {\n while (element && element !== document.body) {\n if (element.classList.contains(className)) {\n return true;\n }\n element = element.parentElement!;\n }\n return false;\n };\n\n // Check if the target of the touch event is inside an element with the 'copilotKitMessages' class\n if (!hasParentWithClass(targetElement, \"copilotKitMessages\")) {\n event.preventDefault();\n }\n};\n\nfunction isMacOS() {\n return /Mac|iMac|Macintosh/i.test(navigator.userAgent);\n}\n"],"mappings":";;;;;;;;AAAA,OAAO,SAAS,aAAa,iBAAiB;AAG9C,SAAS,yBAAyB;AAyI9B,SAOI,KAPJ;AAtIG,IAAM,SAAS,CAAC;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAmB;AAXnB;AAYE,QAAM,YAAY,MAAM,OAAuB,IAAI;AACnD,QAAM,UAAU,kBAAkB;AAElC,QA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AAA,IACX,UAAU;AAAA,IACV,SAAS;AAAA,IACT,OAAO,SAAS,oBAAoB;AAAA,EACtC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,oBAAoB,gBAAgB,wBAAwB,MAAM,OAAO,UAAU;AAAA,MAC9F,KAAK;AAAA,MAEJ;AAAA;AAAA,QACA;AAAA,QAEC,oBAAC,OAAE,WAAU,aAAY,OAAO,gBAAgB,mCAEhD;AAAA;AAAA;AAAA,EAEJ;AAEJ;AAEA,IAAM,gBAAgB,CAAC,UAA4B;AACjD,MAAI,gBAAgB,MAAM;AAG1B,QAAM,qBAAqB,CAAC,SAAkB,cAA+B;AAC3E,WAAO,WAAW,YAAY,SAAS,MAAM;AAC3C,UAAI,QAAQ,UAAU,SAAS,SAAS,GAAG;AACzC,eAAO;AAAA,MACT;AACA,gBAAU,QAAQ;AAAA,IACpB;AACA,WAAO;AAAA,EACT;AAGA,MAAI,CAAC,mBAAmB,eAAe,oBAAoB,GAAG;AAC5D,UAAM,eAAe;AAAA,EACvB;AACF;AAEA,SAAS,UAAU;AACjB,SAAO,sBAAsB,KAAK,UAAU,SAAS;AACvD;","names":["_a"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
usePushToTalk
|
|
3
|
+
} from "./chunk-S5MBUNGN.mjs";
|
|
1
4
|
import {
|
|
2
5
|
Textarea_default
|
|
3
6
|
} from "./chunk-YQFVRDNC.mjs";
|
|
4
7
|
import {
|
|
5
8
|
useChatContext
|
|
6
9
|
} from "./chunk-UN2E3HCK.mjs";
|
|
7
|
-
import {
|
|
8
|
-
usePushToTalk
|
|
9
|
-
} from "./chunk-S5MBUNGN.mjs";
|
|
10
10
|
|
|
11
11
|
// src/components/chat/Input.tsx
|
|
12
12
|
import { useEffect, useRef, useState } from "react";
|
|
@@ -103,4 +103,4 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop }) => {
|
|
|
103
103
|
export {
|
|
104
104
|
Input
|
|
105
105
|
};
|
|
106
|
-
//# sourceMappingURL=chunk-
|
|
106
|
+
//# sourceMappingURL=chunk-RXBEZZ5I.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GULJZORG.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__spreadProps,
|
|
6
6
|
__spreadValues
|
|
@@ -27,4 +27,4 @@ function CopilotSidebar(props) {
|
|
|
27
27
|
export {
|
|
28
28
|
CopilotSidebar
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
30
|
+
//# sourceMappingURL=chunk-TYAYVE3X.mjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AssistantMessage
|
|
3
|
+
} from "./chunk-N7ZQXCKF.mjs";
|
|
1
4
|
import {
|
|
2
5
|
UserMessage
|
|
3
6
|
} from "./chunk-HEIDCT7I.mjs";
|
|
4
|
-
import {
|
|
5
|
-
AssistantMessage
|
|
6
|
-
} from "./chunk-5M7ODWKH.mjs";
|
|
7
7
|
import {
|
|
8
8
|
__objRest
|
|
9
9
|
} from "./chunk-MRXNTQOX.mjs";
|
|
@@ -63,4 +63,4 @@ function RenderTextMessage(_a) {
|
|
|
63
63
|
export {
|
|
64
64
|
RenderTextMessage
|
|
65
65
|
};
|
|
66
|
-
//# sourceMappingURL=chunk-
|
|
66
|
+
//# sourceMappingURL=chunk-USR5CBYD.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AssistantMessage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-N7ZQXCKF.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest
|
|
6
6
|
} from "./chunk-MRXNTQOX.mjs";
|
|
@@ -33,4 +33,4 @@ function RenderResultMessage(_a) {
|
|
|
33
33
|
export {
|
|
34
34
|
RenderResultMessage
|
|
35
35
|
};
|
|
36
|
-
//# sourceMappingURL=chunk-
|
|
36
|
+
//# sourceMappingURL=chunk-YIQTTJAT.mjs.map
|
|
@@ -2,23 +2,23 @@ import {
|
|
|
2
2
|
CopilotChat,
|
|
3
3
|
WrappedCopilotChat,
|
|
4
4
|
useCopilotChatLogic
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
5
|
+
} from "../../chunk-DRAM4KIH.mjs";
|
|
6
|
+
import "../../chunk-QMW2LYI3.mjs";
|
|
7
|
+
import "../../chunk-COZFHP6Y.mjs";
|
|
8
|
+
import "../../chunk-YIQTTJAT.mjs";
|
|
9
|
+
import "../../chunk-USR5CBYD.mjs";
|
|
10
|
+
import "../../chunk-N7ZQXCKF.mjs";
|
|
8
11
|
import "../../chunk-HEIDCT7I.mjs";
|
|
9
|
-
import "../../chunk-NMNC4ROZ.mjs";
|
|
10
|
-
import "../../chunk-Q2YY2NX3.mjs";
|
|
11
|
-
import "../../chunk-5M7ODWKH.mjs";
|
|
12
12
|
import "../../chunk-TOQ7P4DO.mjs";
|
|
13
|
-
import "../../chunk-
|
|
13
|
+
import "../../chunk-RXBEZZ5I.mjs";
|
|
14
|
+
import "../../chunk-S5MBUNGN.mjs";
|
|
14
15
|
import "../../chunk-YQFVRDNC.mjs";
|
|
15
|
-
import "../../chunk-
|
|
16
|
+
import "../../chunk-KSW7FVYG.mjs";
|
|
17
|
+
import "../../chunk-DYUT4CVD.mjs";
|
|
18
|
+
import "../../chunk-54JAUBUJ.mjs";
|
|
16
19
|
import "../../chunk-ZY25LVYR.mjs";
|
|
17
20
|
import "../../chunk-UN2E3HCK.mjs";
|
|
18
|
-
import "../../chunk-PCTCOQK2.mjs";
|
|
19
21
|
import "../../chunk-ORSMX3SE.mjs";
|
|
20
|
-
import "../../chunk-54JAUBUJ.mjs";
|
|
21
|
-
import "../../chunk-S5MBUNGN.mjs";
|
|
22
22
|
import "../../chunk-MRXNTQOX.mjs";
|
|
23
23
|
export {
|
|
24
24
|
CopilotChat,
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
CodeBlock,
|
|
3
3
|
generateRandomString,
|
|
4
4
|
programmingLanguages
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-ORSMX3SE.mjs";
|
|
5
|
+
} from "../../chunk-DYUT4CVD.mjs";
|
|
7
6
|
import "../../chunk-54JAUBUJ.mjs";
|
|
7
|
+
import "../../chunk-ORSMX3SE.mjs";
|
|
8
8
|
import "../../chunk-MRXNTQOX.mjs";
|
|
9
9
|
export {
|
|
10
10
|
CodeBlock,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Header
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-QDC2Q7XX.mjs";
|
|
4
4
|
import "../../chunk-V7W6IM2V.mjs";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-Q6XB5B2M.mjs";
|
|
6
|
+
import "../../chunk-Q5V6S67N.mjs";
|
|
6
7
|
import "../../chunk-6TCUJ3B7.mjs";
|
|
7
8
|
import "../../chunk-KXE2JCUH.mjs";
|
|
8
9
|
import "../../chunk-NRA3CFEE.mjs";
|
|
9
10
|
import "../../chunk-BH6PCAAL.mjs";
|
|
10
|
-
import "../../chunk-Q5V6S67N.mjs";
|
|
11
11
|
import "../../chunk-UN2E3HCK.mjs";
|
|
12
12
|
import "../../chunk-ORSMX3SE.mjs";
|
|
13
13
|
import "../../chunk-MRXNTQOX.mjs";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Input
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-RXBEZZ5I.mjs";
|
|
4
|
+
import "../../chunk-S5MBUNGN.mjs";
|
|
4
5
|
import "../../chunk-YQFVRDNC.mjs";
|
|
5
6
|
import "../../chunk-UN2E3HCK.mjs";
|
|
6
7
|
import "../../chunk-ORSMX3SE.mjs";
|
|
7
|
-
import "../../chunk-S5MBUNGN.mjs";
|
|
8
8
|
import "../../chunk-MRXNTQOX.mjs";
|
|
9
9
|
export {
|
|
10
10
|
Input
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Markdown
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-ORSMX3SE.mjs";
|
|
3
|
+
} from "../../chunk-KSW7FVYG.mjs";
|
|
4
|
+
import "../../chunk-DYUT4CVD.mjs";
|
|
6
5
|
import "../../chunk-54JAUBUJ.mjs";
|
|
6
|
+
import "../../chunk-ORSMX3SE.mjs";
|
|
7
7
|
import "../../chunk-MRXNTQOX.mjs";
|
|
8
8
|
export {
|
|
9
9
|
Markdown
|