@copilotkit/react-textarea 0.36.0-mme-fix-packaging-issues.0 → 0.36.0-mme-push-to-talk.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +172 -172
- package/CHANGELOG.md +8 -2
- package/dist/{chunk-7R7KMN2G.mjs → chunk-COQISBP2.mjs} +2 -2
- package/dist/{chunk-GZPRBYKA.mjs → chunk-DMLXXOXD.mjs} +2 -2
- package/dist/{chunk-P4EI4H6Y.mjs → chunk-OGLVRSCO.mjs} +2 -2
- package/dist/{chunk-MMVI7IPP.mjs → chunk-PQIOU3E5.mjs} +2 -2
- package/dist/{chunk-O3QC2FT5.mjs → chunk-XU5Z5BWV.mjs} +2 -2
- package/dist/chunk-YNXNMCDX.mjs +51 -0
- package/dist/chunk-YNXNMCDX.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js +66 -116
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +5 -5
- package/dist/components/copilot-textarea/copilot-textarea.js +73 -123
- package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.mjs +6 -6
- package/dist/components/hovering-toolbar/hovering-toolbar.js +45 -95
- package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +4 -4
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +34 -84
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +2 -2
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +34 -84
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +3 -3
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.d.ts +2 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js +19 -67
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +3 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +34 -84
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +3 -3
- package/dist/components/index.js +76 -126
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +6 -6
- package/dist/index.js +76 -126
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/package.json +7 -6
- package/src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx +13 -62
- package/typedoc.json +4 -0
- package/dist/chunk-JC6NGPO4.mjs +0 -100
- package/dist/chunk-JC6NGPO4.mjs.map +0 -1
- /package/dist/{chunk-7R7KMN2G.mjs.map → chunk-COQISBP2.mjs.map} +0 -0
- /package/dist/{chunk-GZPRBYKA.mjs.map → chunk-DMLXXOXD.mjs.map} +0 -0
- /package/dist/{chunk-P4EI4H6Y.mjs.map → chunk-OGLVRSCO.mjs.map} +0 -0
- /package/dist/{chunk-MMVI7IPP.mjs.map → chunk-PQIOU3E5.mjs.map} +0 -0
- /package/dist/{chunk-O3QC2FT5.mjs.map → chunk-XU5Z5BWV.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
# ui
|
|
2
2
|
|
|
3
|
-
## 0.36.0-mme-
|
|
3
|
+
## 0.36.0-mme-push-to-talk.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- Add push to talk prototype
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @copilotkit/react-core@0.36.0-mme-push-to-talk.0
|
|
13
|
+
- @copilotkit/shared@0.36.0-mme-push-to-talk.0
|
|
8
14
|
|
|
9
15
|
## 0.35.0
|
|
10
16
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HoveringInsertionPromptBoxCore
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OGLVRSCO.mjs";
|
|
4
4
|
|
|
5
5
|
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -28,4 +28,4 @@ var HoveringInsertionPromptBox = (props) => {
|
|
|
28
28
|
export {
|
|
29
29
|
HoveringInsertionPromptBox
|
|
30
30
|
};
|
|
31
|
-
//# sourceMappingURL=chunk-
|
|
31
|
+
//# sourceMappingURL=chunk-COQISBP2.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HoveringInsertionPromptBox
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-COQISBP2.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useHoveringEditorContext
|
|
6
6
|
} from "./chunk-LYB4B6MK.mjs";
|
|
@@ -121,4 +121,4 @@ function editorState(editor, selection) {
|
|
|
121
121
|
export {
|
|
122
122
|
HoveringToolbar
|
|
123
123
|
};
|
|
124
|
-
//# sourceMappingURL=chunk-
|
|
124
|
+
//# sourceMappingURL=chunk-DMLXXOXD.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IncludedFilesPreview
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YNXNMCDX.mjs";
|
|
4
4
|
import {
|
|
5
5
|
use_autosize_textarea_default
|
|
6
6
|
} from "./chunk-3PQ7GSFE.mjs";
|
|
@@ -222,4 +222,4 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
222
222
|
export {
|
|
223
223
|
HoveringInsertionPromptBoxCore
|
|
224
224
|
};
|
|
225
|
-
//# sourceMappingURL=chunk-
|
|
225
|
+
//# sourceMappingURL=chunk-OGLVRSCO.mjs.map
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-DKE57EAC.mjs";
|
|
10
10
|
import {
|
|
11
11
|
BaseCopilotTextarea
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XU5Z5BWV.mjs";
|
|
13
13
|
import {
|
|
14
14
|
__objRest,
|
|
15
15
|
__spreadProps,
|
|
@@ -57,4 +57,4 @@ var CopilotTextarea = React.forwardRef(
|
|
|
57
57
|
export {
|
|
58
58
|
CopilotTextarea
|
|
59
59
|
};
|
|
60
|
-
//# sourceMappingURL=chunk-
|
|
60
|
+
//# sourceMappingURL=chunk-PQIOU3E5.mjs.map
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
} from "./chunk-7LSRNPNI.mjs";
|
|
25
25
|
import {
|
|
26
26
|
HoveringToolbar
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-DMLXXOXD.mjs";
|
|
28
28
|
import {
|
|
29
29
|
HoveringEditorProvider,
|
|
30
30
|
useHoveringEditorContext
|
|
@@ -256,4 +256,4 @@ function makeSemiFakeReactTextAreaEvent(currentText) {
|
|
|
256
256
|
export {
|
|
257
257
|
BaseCopilotTextarea
|
|
258
258
|
};
|
|
259
|
-
//# sourceMappingURL=chunk-
|
|
259
|
+
//# sourceMappingURL=chunk-XU5Z5BWV.mjs.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Label
|
|
3
|
+
} from "./chunk-YFK5BFEI.mjs";
|
|
4
|
+
|
|
5
|
+
// src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx
|
|
6
|
+
import Chip from "@mui/material/Chip/Chip.js";
|
|
7
|
+
import Avatar from "@mui/material/Avatar/Avatar.js";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
var IncludedFilesPreview = ({
|
|
10
|
+
includedFiles,
|
|
11
|
+
setIncludedFiles
|
|
12
|
+
}) => {
|
|
13
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 mt-2", children: [
|
|
14
|
+
/* @__PURE__ */ jsx(Label, { className: "", children: "Included context:" }),
|
|
15
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: includedFiles.map((filePointer, index) => {
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
FileChipPreview,
|
|
18
|
+
{
|
|
19
|
+
filePointer,
|
|
20
|
+
onDelete: () => {
|
|
21
|
+
setIncludedFiles((prev) => prev.filter((fp) => fp !== filePointer));
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
`file-${filePointer.sourceApplication}.${filePointer.name}`
|
|
25
|
+
);
|
|
26
|
+
}) })
|
|
27
|
+
] });
|
|
28
|
+
};
|
|
29
|
+
var FileChipPreview = ({ filePointer, onDelete }) => {
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
Chip,
|
|
32
|
+
{
|
|
33
|
+
label: filePointer.name,
|
|
34
|
+
onDelete,
|
|
35
|
+
avatar: /* @__PURE__ */ jsx(
|
|
36
|
+
Avatar,
|
|
37
|
+
{
|
|
38
|
+
src: filePointer.iconImageUri,
|
|
39
|
+
alt: filePointer.sourceApplication,
|
|
40
|
+
sx: { backgroundColor: "transparent" }
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export {
|
|
48
|
+
IncludedFilesPreview,
|
|
49
|
+
FileChipPreview
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=chunk-YNXNMCDX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx"],"sourcesContent":["import { DocumentPointer } from \"@copilotkit/react-core\";\nimport { Label } from \"../../ui/label\";\nimport React from \"react\";\nimport Chip from \"@mui/material/Chip/Chip.js\";\nimport Avatar from \"@mui/material/Avatar/Avatar.js\";\n\nexport interface IncludedFilesPreviewProps {\n includedFiles: DocumentPointer[];\n setIncludedFiles: React.Dispatch<React.SetStateAction<DocumentPointer[]>>;\n}\n\nexport const IncludedFilesPreview = ({\n includedFiles,\n setIncludedFiles,\n}: IncludedFilesPreviewProps) => {\n return (\n <div className=\"flex flex-col gap-2 mt-2\">\n <Label className=\"\">Included context:</Label>\n <div className=\"flex flex-wrap gap-2\">\n {includedFiles.map((filePointer, index) => {\n return (\n <FileChipPreview\n key={`file-${filePointer.sourceApplication}.${filePointer.name}`}\n filePointer={filePointer}\n onDelete={() => {\n setIncludedFiles((prev) => prev.filter((fp) => fp !== filePointer));\n }}\n />\n );\n })}\n </div>\n </div>\n );\n};\n\nexport interface FileChipPreviewProps {\n filePointer: DocumentPointer;\n onDelete: () => void;\n}\n\nexport const FileChipPreview = ({ filePointer, onDelete }: FileChipPreviewProps) => {\n return (\n <Chip\n label={filePointer.name}\n onDelete={onDelete}\n avatar={\n <Avatar\n src={filePointer.iconImageUri}\n alt={filePointer.sourceApplication}\n sx={{ backgroundColor: \"transparent\" }}\n ></Avatar>\n }\n />\n );\n};\n"],"mappings":";;;;;AAGA,OAAO,UAAU;AACjB,OAAO,YAAY;AAYf,SACE,KADF;AALG,IAAM,uBAAuB,CAAC;AAAA,EACnC;AAAA,EACA;AACF,MAAiC;AAC/B,SACE,qBAAC,SAAI,WAAU,4BACb;AAAA,wBAAC,SAAM,WAAU,IAAG,+BAAiB;AAAA,IACrC,oBAAC,SAAI,WAAU,wBACZ,wBAAc,IAAI,CAAC,aAAa,UAAU;AACzC,aACE;AAAA,QAAC;AAAA;AAAA,UAEC;AAAA,UACA,UAAU,MAAM;AACd,6BAAiB,CAAC,SAAS,KAAK,OAAO,CAAC,OAAO,OAAO,WAAW,CAAC;AAAA,UACpE;AAAA;AAAA,QAJK,QAAQ,YAAY,qBAAqB,YAAY;AAAA,MAK5D;AAAA,IAEJ,CAAC,GACH;AAAA,KACF;AAEJ;AAOO,IAAM,kBAAkB,CAAC,EAAE,aAAa,SAAS,MAA4B;AAClF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,YAAY;AAAA,MACnB;AAAA,MACA,QACE;AAAA,QAAC;AAAA;AAAA,UACC,KAAK,YAAY;AAAA,UACjB,KAAK,YAAY;AAAA,UACjB,IAAI,EAAE,iBAAiB,cAAc;AAAA;AAAA,MACtC;AAAA;AAAA,EAEL;AAEJ;","names":[]}
|
|
@@ -82,7 +82,7 @@ __export(base_copilot_textarea_exports, {
|
|
|
82
82
|
BaseCopilotTextarea: () => BaseCopilotTextarea
|
|
83
83
|
});
|
|
84
84
|
module.exports = __toCommonJS(base_copilot_textarea_exports);
|
|
85
|
-
var
|
|
85
|
+
var import_react12 = __toESM(require("react"));
|
|
86
86
|
var import_slate10 = require("slate");
|
|
87
87
|
var import_slate_react5 = require("slate-react");
|
|
88
88
|
var import_tailwind_merge2 = require("tailwind-merge");
|
|
@@ -659,7 +659,7 @@ var defaultBaseAutosuggestionsConfig = {
|
|
|
659
659
|
};
|
|
660
660
|
|
|
661
661
|
// src/components/hovering-toolbar/hovering-toolbar.tsx
|
|
662
|
-
var
|
|
662
|
+
var import_react9 = require("react");
|
|
663
663
|
var import_slate7 = require("slate");
|
|
664
664
|
var import_slate_react3 = require("slate-react");
|
|
665
665
|
|
|
@@ -895,7 +895,7 @@ var Label = React4.forwardRef((_a, ref) => {
|
|
|
895
895
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
896
896
|
|
|
897
897
|
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
898
|
-
var
|
|
898
|
+
var import_react7 = require("react");
|
|
899
899
|
|
|
900
900
|
// src/lib/stream-promise-flatten.ts
|
|
901
901
|
function streamPromiseFlatten(promise) {
|
|
@@ -925,7 +925,8 @@ function streamPromiseFlatten(promise) {
|
|
|
925
925
|
var import_react_core2 = require("@copilotkit/react-core");
|
|
926
926
|
|
|
927
927
|
// src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx
|
|
928
|
-
var
|
|
928
|
+
var import_Chip = __toESM(require("@mui/material/Chip/Chip.js"));
|
|
929
|
+
var import_Avatar = __toESM(require("@mui/material/Avatar/Avatar.js"));
|
|
929
930
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
930
931
|
var IncludedFilesPreview = ({
|
|
931
932
|
includedFiles,
|
|
@@ -947,88 +948,37 @@ var IncludedFilesPreview = ({
|
|
|
947
948
|
}) })
|
|
948
949
|
] });
|
|
949
950
|
};
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
}) {
|
|
954
|
-
const CLOSE_BUTTON_COLOR = "rgba(0, 0, 0, 0.26)";
|
|
955
|
-
const [color, setColor] = import_react6.default.useState(CLOSE_BUTTON_COLOR);
|
|
956
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
957
|
-
"button",
|
|
951
|
+
var FileChipPreview = ({ filePointer, onDelete }) => {
|
|
952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
953
|
+
import_Chip.default,
|
|
958
954
|
{
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
boxSizing: "border-box",
|
|
970
|
-
border: 0,
|
|
971
|
-
verticalAlign: "middle",
|
|
972
|
-
outline: 0,
|
|
973
|
-
cursor: "default"
|
|
974
|
-
},
|
|
975
|
-
children: [
|
|
976
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
977
|
-
"img",
|
|
978
|
-
{
|
|
979
|
-
style: {
|
|
980
|
-
marginLeft: "5px",
|
|
981
|
-
width: "24px",
|
|
982
|
-
height: "24px",
|
|
983
|
-
backgroundColor: "transparent",
|
|
984
|
-
borderRadius: "50%"
|
|
985
|
-
},
|
|
986
|
-
src: filePointer.iconImageUri,
|
|
987
|
-
alt: filePointer.sourceApplication
|
|
988
|
-
}
|
|
989
|
-
),
|
|
990
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { marginLeft: "5px" }, children: filePointer.name }),
|
|
991
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
992
|
-
"svg",
|
|
993
|
-
{
|
|
994
|
-
style: {
|
|
995
|
-
color,
|
|
996
|
-
fontSize: "22px",
|
|
997
|
-
cursor: "pointer",
|
|
998
|
-
margin: "0 5px 0 5px",
|
|
999
|
-
userSelect: "none",
|
|
1000
|
-
width: "1em",
|
|
1001
|
-
height: "1em",
|
|
1002
|
-
display: "inline-block",
|
|
1003
|
-
fill: "currentColor",
|
|
1004
|
-
flexShrink: 0
|
|
1005
|
-
},
|
|
1006
|
-
viewBox: "0 0 24 24",
|
|
1007
|
-
preserveAspectRatio: "xMidYMid meet",
|
|
1008
|
-
onClick: onDelete,
|
|
1009
|
-
onMouseOver: () => setColor("rgba(0, 0, 0, 0.54)"),
|
|
1010
|
-
onMouseOut: () => setColor(CLOSE_BUTTON_COLOR),
|
|
1011
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z" })
|
|
1012
|
-
}
|
|
1013
|
-
)
|
|
1014
|
-
]
|
|
955
|
+
label: filePointer.name,
|
|
956
|
+
onDelete,
|
|
957
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
958
|
+
import_Avatar.default,
|
|
959
|
+
{
|
|
960
|
+
src: filePointer.iconImageUri,
|
|
961
|
+
alt: filePointer.sourceApplication,
|
|
962
|
+
sx: { backgroundColor: "transparent" }
|
|
963
|
+
}
|
|
964
|
+
)
|
|
1015
965
|
}
|
|
1016
|
-
)
|
|
1017
|
-
}
|
|
966
|
+
);
|
|
967
|
+
};
|
|
1018
968
|
|
|
1019
969
|
// src/components/hovering-toolbar/hovering-editor-provider.tsx
|
|
1020
|
-
var
|
|
970
|
+
var import_react6 = require("react");
|
|
1021
971
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1022
|
-
var HoveringEditorContext = (0,
|
|
972
|
+
var HoveringEditorContext = (0, import_react6.createContext)({
|
|
1023
973
|
isDisplayed: false,
|
|
1024
974
|
setIsDisplayed: () => {
|
|
1025
975
|
}
|
|
1026
976
|
});
|
|
1027
977
|
var HoveringEditorProvider = ({ children }) => {
|
|
1028
|
-
const [isDisplayed, setIsDisplayed] = (0,
|
|
978
|
+
const [isDisplayed, setIsDisplayed] = (0, import_react6.useState)(false);
|
|
1029
979
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HoveringEditorContext.Provider, { value: { isDisplayed, setIsDisplayed }, children });
|
|
1030
980
|
};
|
|
1031
|
-
var useHoveringEditorContext = () => (0,
|
|
981
|
+
var useHoveringEditorContext = () => (0, import_react6.useContext)(HoveringEditorContext);
|
|
1032
982
|
|
|
1033
983
|
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
1034
984
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
@@ -1038,27 +988,27 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1038
988
|
insertionOrEditingFunction,
|
|
1039
989
|
contextCategories
|
|
1040
990
|
}) => {
|
|
1041
|
-
const { getDocumentsContext } = (0,
|
|
1042
|
-
const [editSuggestion, setEditSuggestion] = (0,
|
|
1043
|
-
const [suggestionIsLoading, setSuggestionIsLoading] = (0,
|
|
1044
|
-
const [adjustmentPrompt, setAdjustmentPrompt] = (0,
|
|
1045
|
-
const [generatingSuggestion, setGeneratingSuggestion] = (0,
|
|
991
|
+
const { getDocumentsContext } = (0, import_react7.useContext)(import_react_core2.CopilotContext);
|
|
992
|
+
const [editSuggestion, setEditSuggestion] = (0, import_react7.useState)("");
|
|
993
|
+
const [suggestionIsLoading, setSuggestionIsLoading] = (0, import_react7.useState)(false);
|
|
994
|
+
const [adjustmentPrompt, setAdjustmentPrompt] = (0, import_react7.useState)("");
|
|
995
|
+
const [generatingSuggestion, setGeneratingSuggestion] = (0, import_react7.useState)(
|
|
1046
996
|
null
|
|
1047
997
|
);
|
|
1048
|
-
const adjustmentTextAreaRef = (0,
|
|
1049
|
-
const suggestionTextAreaRef = (0,
|
|
1050
|
-
const [filePointers, setFilePointers] = (0,
|
|
1051
|
-
const [suggestedFiles, setSuggestedFiles] = (0,
|
|
1052
|
-
(0,
|
|
998
|
+
const adjustmentTextAreaRef = (0, import_react7.useRef)(null);
|
|
999
|
+
const suggestionTextAreaRef = (0, import_react7.useRef)(null);
|
|
1000
|
+
const [filePointers, setFilePointers] = (0, import_react7.useState)([]);
|
|
1001
|
+
const [suggestedFiles, setSuggestedFiles] = (0, import_react7.useState)([]);
|
|
1002
|
+
(0, import_react7.useEffect)(() => {
|
|
1053
1003
|
setSuggestedFiles(getDocumentsContext(contextCategories));
|
|
1054
1004
|
}, [contextCategories, getDocumentsContext]);
|
|
1055
1005
|
use_autosize_textarea_default(suggestionTextAreaRef, editSuggestion || "");
|
|
1056
1006
|
use_autosize_textarea_default(adjustmentTextAreaRef, adjustmentPrompt || "");
|
|
1057
|
-
(0,
|
|
1007
|
+
(0, import_react7.useEffect)(() => {
|
|
1058
1008
|
var _a;
|
|
1059
1009
|
(_a = adjustmentTextAreaRef.current) == null ? void 0 : _a.focus();
|
|
1060
1010
|
}, []);
|
|
1061
|
-
(0,
|
|
1011
|
+
(0, import_react7.useEffect)(() => {
|
|
1062
1012
|
if (!generatingSuggestion) {
|
|
1063
1013
|
return;
|
|
1064
1014
|
}
|
|
@@ -1096,7 +1046,7 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1096
1046
|
releaseLockIfNotClosed();
|
|
1097
1047
|
};
|
|
1098
1048
|
}, [generatingSuggestion]);
|
|
1099
|
-
const beginGeneratingAdjustment = (0,
|
|
1049
|
+
const beginGeneratingAdjustment = (0, import_react7.useCallback)(() => __async(void 0, null, function* () {
|
|
1100
1050
|
if (!adjustmentPrompt.trim()) {
|
|
1101
1051
|
return;
|
|
1102
1052
|
}
|
|
@@ -1249,10 +1199,10 @@ var HoveringInsertionPromptBox = (props) => {
|
|
|
1249
1199
|
|
|
1250
1200
|
// src/components/hovering-toolbar/hovering-toolbar-components.tsx
|
|
1251
1201
|
var import_css = require("@emotion/css");
|
|
1252
|
-
var
|
|
1202
|
+
var import_react8 = __toESM(require("react"));
|
|
1253
1203
|
var import_react_dom = __toESM(require("react-dom"));
|
|
1254
1204
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1255
|
-
var Button2 =
|
|
1205
|
+
var Button2 = import_react8.default.forwardRef(
|
|
1256
1206
|
(_a, ref) => {
|
|
1257
1207
|
var _b = _a, {
|
|
1258
1208
|
className,
|
|
@@ -1278,7 +1228,7 @@ var Button2 = import_react9.default.forwardRef(
|
|
|
1278
1228
|
);
|
|
1279
1229
|
}
|
|
1280
1230
|
);
|
|
1281
|
-
var Icon =
|
|
1231
|
+
var Icon = import_react8.default.forwardRef(
|
|
1282
1232
|
(_a, ref) => {
|
|
1283
1233
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1284
1234
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -1297,7 +1247,7 @@ var Icon = import_react9.default.forwardRef(
|
|
|
1297
1247
|
);
|
|
1298
1248
|
}
|
|
1299
1249
|
);
|
|
1300
|
-
var Menu =
|
|
1250
|
+
var Menu = import_react8.default.forwardRef(
|
|
1301
1251
|
(_a, ref) => {
|
|
1302
1252
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1303
1253
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -1324,7 +1274,7 @@ var Menu = import_react9.default.forwardRef(
|
|
|
1324
1274
|
var Portal = ({ children }) => {
|
|
1325
1275
|
return typeof document === "object" ? import_react_dom.default.createPortal(children, document.body) : null;
|
|
1326
1276
|
};
|
|
1327
|
-
var Toolbar =
|
|
1277
|
+
var Toolbar = import_react8.default.forwardRef(
|
|
1328
1278
|
(_a, ref) => {
|
|
1329
1279
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1330
1280
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -1349,15 +1299,15 @@ var Toolbar = import_react9.default.forwardRef(
|
|
|
1349
1299
|
// src/components/hovering-toolbar/hovering-toolbar.tsx
|
|
1350
1300
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1351
1301
|
var HoveringToolbar = (props) => {
|
|
1352
|
-
const ref = (0,
|
|
1302
|
+
const ref = (0, import_react9.useRef)(null);
|
|
1353
1303
|
const editor = (0, import_slate_react3.useSlate)();
|
|
1354
1304
|
const selection = (0, import_slate_react3.useSlateSelection)();
|
|
1355
1305
|
const { isDisplayed, setIsDisplayed } = useHoveringEditorContext();
|
|
1356
|
-
const [isClient, setIsClient] = (0,
|
|
1357
|
-
(0,
|
|
1306
|
+
const [isClient, setIsClient] = (0, import_react9.useState)(false);
|
|
1307
|
+
(0, import_react9.useEffect)(() => {
|
|
1358
1308
|
setIsClient(true);
|
|
1359
1309
|
}, []);
|
|
1360
|
-
(0,
|
|
1310
|
+
(0, import_react9.useEffect)(() => {
|
|
1361
1311
|
const el = ref.current;
|
|
1362
1312
|
const { selection: selection2 } = editor;
|
|
1363
1313
|
if (!el) {
|
|
@@ -1395,7 +1345,7 @@ var HoveringToolbar = (props) => {
|
|
|
1395
1345
|
el.style.top = `${top}px`;
|
|
1396
1346
|
el.style.left = `${left}px`;
|
|
1397
1347
|
});
|
|
1398
|
-
(0,
|
|
1348
|
+
(0, import_react9.useEffect)(() => {
|
|
1399
1349
|
const handleClickOutside = (event) => {
|
|
1400
1350
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
1401
1351
|
setIsDisplayed(false);
|
|
@@ -1493,10 +1443,10 @@ function makeRenderPlaceholderFunction(placeholderStyle) {
|
|
|
1493
1443
|
}
|
|
1494
1444
|
|
|
1495
1445
|
// src/components/base-copilot-textarea/use-add-branding-css.tsx
|
|
1496
|
-
var
|
|
1446
|
+
var import_react10 = require("react");
|
|
1497
1447
|
function useAddBrandingCss(suggestionStyleAugmented, disableBranding) {
|
|
1498
1448
|
const cssSelector = ".copilot-textarea.with-branding";
|
|
1499
|
-
(0,
|
|
1449
|
+
(0, import_react10.useEffect)(() => {
|
|
1500
1450
|
if (disableBranding) {
|
|
1501
1451
|
return;
|
|
1502
1452
|
}
|
|
@@ -1548,7 +1498,7 @@ function useAddBrandingCss(suggestionStyleAugmented, disableBranding) {
|
|
|
1548
1498
|
}
|
|
1549
1499
|
|
|
1550
1500
|
// src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx
|
|
1551
|
-
var
|
|
1501
|
+
var import_react11 = require("react");
|
|
1552
1502
|
var import_slate_react4 = require("slate-react");
|
|
1553
1503
|
var import_slate9 = require("slate");
|
|
1554
1504
|
|
|
@@ -1601,7 +1551,7 @@ function TrackerTextEditedSinceLastCursorMovement(props) {
|
|
|
1601
1551
|
text: editorToText(state)
|
|
1602
1552
|
}));
|
|
1603
1553
|
const previousState = usePrevious(cursorState);
|
|
1604
|
-
(0,
|
|
1554
|
+
(0, import_react11.useEffect)(() => {
|
|
1605
1555
|
if (!previousState) {
|
|
1606
1556
|
return;
|
|
1607
1557
|
}
|
|
@@ -1624,8 +1574,8 @@ var isSelectionEqual = (a, b) => {
|
|
|
1624
1574
|
return import_slate9.Range.equals(a, b);
|
|
1625
1575
|
};
|
|
1626
1576
|
function usePrevious(value) {
|
|
1627
|
-
const ref = (0,
|
|
1628
|
-
(0,
|
|
1577
|
+
const ref = (0, import_react11.useRef)();
|
|
1578
|
+
(0, import_react11.useEffect)(() => {
|
|
1629
1579
|
ref.current = value;
|
|
1630
1580
|
});
|
|
1631
1581
|
return ref.current;
|
|
@@ -1633,21 +1583,21 @@ function usePrevious(value) {
|
|
|
1633
1583
|
|
|
1634
1584
|
// src/components/base-copilot-textarea/base-copilot-textarea.tsx
|
|
1635
1585
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1636
|
-
var BaseCopilotTextarea =
|
|
1586
|
+
var BaseCopilotTextarea = import_react12.default.forwardRef(
|
|
1637
1587
|
(props, ref) => {
|
|
1638
1588
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(HoveringEditorProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BaseCopilotTextareaWithHoveringContext, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
1639
1589
|
}
|
|
1640
1590
|
);
|
|
1641
|
-
var BaseCopilotTextareaWithHoveringContext =
|
|
1591
|
+
var BaseCopilotTextareaWithHoveringContext = import_react12.default.forwardRef(
|
|
1642
1592
|
(props, ref) => {
|
|
1643
1593
|
const autosuggestionsConfig = __spreadValues(__spreadValues({}, defaultBaseAutosuggestionsConfig), props.baseAutosuggestionsConfig);
|
|
1644
|
-
const valueOnInitialRender = (0,
|
|
1594
|
+
const valueOnInitialRender = (0, import_react12.useMemo)(() => {
|
|
1645
1595
|
var _a2;
|
|
1646
1596
|
return (_a2 = props.value) != null ? _a2 : "";
|
|
1647
1597
|
}, []);
|
|
1648
|
-
const [lastKnownFullEditorText, setLastKnownFullEditorText] = (0,
|
|
1649
|
-
const [cursorMovedSinceLastTextChange, setCursorMovedSinceLastTextChange] = (0,
|
|
1650
|
-
const initialValue = (0,
|
|
1598
|
+
const [lastKnownFullEditorText, setLastKnownFullEditorText] = (0, import_react12.useState)(valueOnInitialRender);
|
|
1599
|
+
const [cursorMovedSinceLastTextChange, setCursorMovedSinceLastTextChange] = (0, import_react12.useState)(false);
|
|
1600
|
+
const initialValue = (0, import_react12.useMemo)(() => {
|
|
1651
1601
|
return [
|
|
1652
1602
|
{
|
|
1653
1603
|
type: "paragraph",
|
|
@@ -1657,7 +1607,7 @@ var BaseCopilotTextareaWithHoveringContext = import_react13.default.forwardRef(
|
|
|
1657
1607
|
}, [valueOnInitialRender]);
|
|
1658
1608
|
const editor = useCopilotTextareaEditor();
|
|
1659
1609
|
const { isDisplayed: hoveringEditorIsDisplayed, setIsDisplayed: setHoveringEditorIsDisplayed } = useHoveringEditorContext();
|
|
1660
|
-
const insertText = (0,
|
|
1610
|
+
const insertText = (0, import_react12.useCallback)(
|
|
1661
1611
|
(autosuggestion) => {
|
|
1662
1612
|
import_slate10.Editor.insertText(editor, autosuggestion.text, {
|
|
1663
1613
|
at: autosuggestion.point
|
|
@@ -1683,7 +1633,7 @@ var BaseCopilotTextareaWithHoveringContext = import_react13.default.forwardRef(
|
|
|
1683
1633
|
autosuggestionsConfig.disableWhenEmpty,
|
|
1684
1634
|
shouldDisableAutosuggestions
|
|
1685
1635
|
);
|
|
1686
|
-
const onKeyDownHandlerForHoveringEditor = (0,
|
|
1636
|
+
const onKeyDownHandlerForHoveringEditor = (0, import_react12.useCallback)(
|
|
1687
1637
|
(event) => {
|
|
1688
1638
|
var _a2;
|
|
1689
1639
|
if (autosuggestionsConfig.shouldToggleHoveringEditorOnKeyPress(event, (_a2 = props.shortcut) != null ? _a2 : "k")) {
|
|
@@ -1697,7 +1647,7 @@ var BaseCopilotTextareaWithHoveringContext = import_react13.default.forwardRef(
|
|
|
1697
1647
|
autosuggestionsConfig.shouldToggleHoveringEditorOnKeyPress
|
|
1698
1648
|
]
|
|
1699
1649
|
);
|
|
1700
|
-
(0,
|
|
1650
|
+
(0, import_react12.useEffect)(() => {
|
|
1701
1651
|
clearAutocompletionsFromEditor(editor);
|
|
1702
1652
|
if (currentAutocompleteSuggestion) {
|
|
1703
1653
|
addAutocompletionsToEditor(
|
|
@@ -1707,23 +1657,23 @@ var BaseCopilotTextareaWithHoveringContext = import_react13.default.forwardRef(
|
|
|
1707
1657
|
);
|
|
1708
1658
|
}
|
|
1709
1659
|
}, [currentAutocompleteSuggestion]);
|
|
1710
|
-
const suggestionStyleAugmented = (0,
|
|
1660
|
+
const suggestionStyleAugmented = (0, import_react12.useMemo)(() => {
|
|
1711
1661
|
return __spreadValues({
|
|
1712
1662
|
fontStyle: "italic",
|
|
1713
1663
|
color: "gray"
|
|
1714
1664
|
}, props.suggestionsStyle);
|
|
1715
1665
|
}, [props.suggestionsStyle]);
|
|
1716
|
-
const renderElementMemoized = (0,
|
|
1666
|
+
const renderElementMemoized = (0, import_react12.useMemo)(() => {
|
|
1717
1667
|
return makeRenderElementFunction(suggestionStyleAugmented);
|
|
1718
1668
|
}, [suggestionStyleAugmented]);
|
|
1719
|
-
const renderPlaceholderMemoized = (0,
|
|
1669
|
+
const renderPlaceholderMemoized = (0, import_react12.useMemo)(() => {
|
|
1720
1670
|
const placeholderStyleSlatejsOverrides = {
|
|
1721
1671
|
top: void 0
|
|
1722
1672
|
};
|
|
1723
1673
|
const placeholderStyleAugmented = __spreadValues(__spreadValues({}, placeholderStyleSlatejsOverrides), props.placeholderStyle);
|
|
1724
1674
|
return makeRenderPlaceholderFunction(placeholderStyleAugmented);
|
|
1725
1675
|
}, [props.placeholderStyle]);
|
|
1726
|
-
(0,
|
|
1676
|
+
(0, import_react12.useEffect)(() => {
|
|
1727
1677
|
var _a2, _b;
|
|
1728
1678
|
if (props.value === lastKnownFullEditorText) {
|
|
1729
1679
|
return;
|