@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseCopilotTextarea
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-XU5Z5BWV.mjs";
|
|
4
4
|
import "../../chunk-DRV2FOHZ.mjs";
|
|
5
5
|
import "../../chunk-4NHVQZ67.mjs";
|
|
6
6
|
import "../../chunk-FMQG2ZM3.mjs";
|
|
@@ -11,11 +11,11 @@ import "../../chunk-QKS2IOUH.mjs";
|
|
|
11
11
|
import "../../chunk-JJLQVT7S.mjs";
|
|
12
12
|
import "../../chunk-LQ2OWQU7.mjs";
|
|
13
13
|
import "../../chunk-7LSRNPNI.mjs";
|
|
14
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-DMLXXOXD.mjs";
|
|
15
15
|
import "../../chunk-L7VVZH4Q.mjs";
|
|
16
|
-
import "../../chunk-
|
|
17
|
-
import "../../chunk-
|
|
18
|
-
import "../../chunk-
|
|
16
|
+
import "../../chunk-COQISBP2.mjs";
|
|
17
|
+
import "../../chunk-OGLVRSCO.mjs";
|
|
18
|
+
import "../../chunk-YNXNMCDX.mjs";
|
|
19
19
|
import "../../chunk-3PQ7GSFE.mjs";
|
|
20
20
|
import "../../chunk-WFTAAA7R.mjs";
|
|
21
21
|
import "../../chunk-YFK5BFEI.mjs";
|
|
@@ -82,7 +82,7 @@ __export(copilot_textarea_exports, {
|
|
|
82
82
|
CopilotTextarea: () => CopilotTextarea
|
|
83
83
|
});
|
|
84
84
|
module.exports = __toCommonJS(copilot_textarea_exports);
|
|
85
|
-
var
|
|
85
|
+
var import_react15 = __toESM(require("react"));
|
|
86
86
|
|
|
87
87
|
// src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx
|
|
88
88
|
var import_shared = require("@copilotkit/shared");
|
|
@@ -413,7 +413,7 @@ var defaultAutosuggestionsConfig = __spreadProps(__spreadValues({}, defaultBaseA
|
|
|
413
413
|
});
|
|
414
414
|
|
|
415
415
|
// src/components/base-copilot-textarea/base-copilot-textarea.tsx
|
|
416
|
-
var
|
|
416
|
+
var import_react13 = __toESM(require("react"));
|
|
417
417
|
var import_slate10 = require("slate");
|
|
418
418
|
var import_slate_react5 = require("slate-react");
|
|
419
419
|
var import_tailwind_merge2 = require("tailwind-merge");
|
|
@@ -966,7 +966,7 @@ function clearAutocompletionsFromEditor(editor) {
|
|
|
966
966
|
}
|
|
967
967
|
|
|
968
968
|
// src/components/hovering-toolbar/hovering-toolbar.tsx
|
|
969
|
-
var
|
|
969
|
+
var import_react10 = require("react");
|
|
970
970
|
var import_slate7 = require("slate");
|
|
971
971
|
var import_slate_react3 = require("slate-react");
|
|
972
972
|
|
|
@@ -1202,7 +1202,7 @@ var Label = React4.forwardRef((_a, ref) => {
|
|
|
1202
1202
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
1203
1203
|
|
|
1204
1204
|
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
1205
|
-
var
|
|
1205
|
+
var import_react8 = require("react");
|
|
1206
1206
|
|
|
1207
1207
|
// src/lib/stream-promise-flatten.ts
|
|
1208
1208
|
function streamPromiseFlatten(promise) {
|
|
@@ -1232,7 +1232,8 @@ function streamPromiseFlatten(promise) {
|
|
|
1232
1232
|
var import_react_core5 = require("@copilotkit/react-core");
|
|
1233
1233
|
|
|
1234
1234
|
// src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx
|
|
1235
|
-
var
|
|
1235
|
+
var import_Chip = __toESM(require("@mui/material/Chip/Chip.js"));
|
|
1236
|
+
var import_Avatar = __toESM(require("@mui/material/Avatar/Avatar.js"));
|
|
1236
1237
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1237
1238
|
var IncludedFilesPreview = ({
|
|
1238
1239
|
includedFiles,
|
|
@@ -1254,88 +1255,37 @@ var IncludedFilesPreview = ({
|
|
|
1254
1255
|
}) })
|
|
1255
1256
|
] });
|
|
1256
1257
|
};
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
}) {
|
|
1261
|
-
const CLOSE_BUTTON_COLOR = "rgba(0, 0, 0, 0.26)";
|
|
1262
|
-
const [color, setColor] = import_react7.default.useState(CLOSE_BUTTON_COLOR);
|
|
1263
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1264
|
-
"button",
|
|
1258
|
+
var FileChipPreview = ({ filePointer, onDelete }) => {
|
|
1259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1260
|
+
import_Chip.default,
|
|
1265
1261
|
{
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
boxSizing: "border-box",
|
|
1277
|
-
border: 0,
|
|
1278
|
-
verticalAlign: "middle",
|
|
1279
|
-
outline: 0,
|
|
1280
|
-
cursor: "default"
|
|
1281
|
-
},
|
|
1282
|
-
children: [
|
|
1283
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1284
|
-
"img",
|
|
1285
|
-
{
|
|
1286
|
-
style: {
|
|
1287
|
-
marginLeft: "5px",
|
|
1288
|
-
width: "24px",
|
|
1289
|
-
height: "24px",
|
|
1290
|
-
backgroundColor: "transparent",
|
|
1291
|
-
borderRadius: "50%"
|
|
1292
|
-
},
|
|
1293
|
-
src: filePointer.iconImageUri,
|
|
1294
|
-
alt: filePointer.sourceApplication
|
|
1295
|
-
}
|
|
1296
|
-
),
|
|
1297
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { marginLeft: "5px" }, children: filePointer.name }),
|
|
1298
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1299
|
-
"svg",
|
|
1300
|
-
{
|
|
1301
|
-
style: {
|
|
1302
|
-
color,
|
|
1303
|
-
fontSize: "22px",
|
|
1304
|
-
cursor: "pointer",
|
|
1305
|
-
margin: "0 5px 0 5px",
|
|
1306
|
-
userSelect: "none",
|
|
1307
|
-
width: "1em",
|
|
1308
|
-
height: "1em",
|
|
1309
|
-
display: "inline-block",
|
|
1310
|
-
fill: "currentColor",
|
|
1311
|
-
flexShrink: 0
|
|
1312
|
-
},
|
|
1313
|
-
viewBox: "0 0 24 24",
|
|
1314
|
-
preserveAspectRatio: "xMidYMid meet",
|
|
1315
|
-
onClick: onDelete,
|
|
1316
|
-
onMouseOver: () => setColor("rgba(0, 0, 0, 0.54)"),
|
|
1317
|
-
onMouseOut: () => setColor(CLOSE_BUTTON_COLOR),
|
|
1318
|
-
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" })
|
|
1319
|
-
}
|
|
1320
|
-
)
|
|
1321
|
-
]
|
|
1262
|
+
label: filePointer.name,
|
|
1263
|
+
onDelete,
|
|
1264
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1265
|
+
import_Avatar.default,
|
|
1266
|
+
{
|
|
1267
|
+
src: filePointer.iconImageUri,
|
|
1268
|
+
alt: filePointer.sourceApplication,
|
|
1269
|
+
sx: { backgroundColor: "transparent" }
|
|
1270
|
+
}
|
|
1271
|
+
)
|
|
1322
1272
|
}
|
|
1323
|
-
)
|
|
1324
|
-
}
|
|
1273
|
+
);
|
|
1274
|
+
};
|
|
1325
1275
|
|
|
1326
1276
|
// src/components/hovering-toolbar/hovering-editor-provider.tsx
|
|
1327
|
-
var
|
|
1277
|
+
var import_react7 = require("react");
|
|
1328
1278
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1329
|
-
var HoveringEditorContext = (0,
|
|
1279
|
+
var HoveringEditorContext = (0, import_react7.createContext)({
|
|
1330
1280
|
isDisplayed: false,
|
|
1331
1281
|
setIsDisplayed: () => {
|
|
1332
1282
|
}
|
|
1333
1283
|
});
|
|
1334
1284
|
var HoveringEditorProvider = ({ children }) => {
|
|
1335
|
-
const [isDisplayed, setIsDisplayed] = (0,
|
|
1285
|
+
const [isDisplayed, setIsDisplayed] = (0, import_react7.useState)(false);
|
|
1336
1286
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HoveringEditorContext.Provider, { value: { isDisplayed, setIsDisplayed }, children });
|
|
1337
1287
|
};
|
|
1338
|
-
var useHoveringEditorContext = () => (0,
|
|
1288
|
+
var useHoveringEditorContext = () => (0, import_react7.useContext)(HoveringEditorContext);
|
|
1339
1289
|
|
|
1340
1290
|
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
1341
1291
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
@@ -1345,27 +1295,27 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1345
1295
|
insertionOrEditingFunction,
|
|
1346
1296
|
contextCategories
|
|
1347
1297
|
}) => {
|
|
1348
|
-
const { getDocumentsContext } = (0,
|
|
1349
|
-
const [editSuggestion, setEditSuggestion] = (0,
|
|
1350
|
-
const [suggestionIsLoading, setSuggestionIsLoading] = (0,
|
|
1351
|
-
const [adjustmentPrompt, setAdjustmentPrompt] = (0,
|
|
1352
|
-
const [generatingSuggestion, setGeneratingSuggestion] = (0,
|
|
1298
|
+
const { getDocumentsContext } = (0, import_react8.useContext)(import_react_core5.CopilotContext);
|
|
1299
|
+
const [editSuggestion, setEditSuggestion] = (0, import_react8.useState)("");
|
|
1300
|
+
const [suggestionIsLoading, setSuggestionIsLoading] = (0, import_react8.useState)(false);
|
|
1301
|
+
const [adjustmentPrompt, setAdjustmentPrompt] = (0, import_react8.useState)("");
|
|
1302
|
+
const [generatingSuggestion, setGeneratingSuggestion] = (0, import_react8.useState)(
|
|
1353
1303
|
null
|
|
1354
1304
|
);
|
|
1355
|
-
const adjustmentTextAreaRef = (0,
|
|
1356
|
-
const suggestionTextAreaRef = (0,
|
|
1357
|
-
const [filePointers, setFilePointers] = (0,
|
|
1358
|
-
const [suggestedFiles, setSuggestedFiles] = (0,
|
|
1359
|
-
(0,
|
|
1305
|
+
const adjustmentTextAreaRef = (0, import_react8.useRef)(null);
|
|
1306
|
+
const suggestionTextAreaRef = (0, import_react8.useRef)(null);
|
|
1307
|
+
const [filePointers, setFilePointers] = (0, import_react8.useState)([]);
|
|
1308
|
+
const [suggestedFiles, setSuggestedFiles] = (0, import_react8.useState)([]);
|
|
1309
|
+
(0, import_react8.useEffect)(() => {
|
|
1360
1310
|
setSuggestedFiles(getDocumentsContext(contextCategories));
|
|
1361
1311
|
}, [contextCategories, getDocumentsContext]);
|
|
1362
1312
|
use_autosize_textarea_default(suggestionTextAreaRef, editSuggestion || "");
|
|
1363
1313
|
use_autosize_textarea_default(adjustmentTextAreaRef, adjustmentPrompt || "");
|
|
1364
|
-
(0,
|
|
1314
|
+
(0, import_react8.useEffect)(() => {
|
|
1365
1315
|
var _a;
|
|
1366
1316
|
(_a = adjustmentTextAreaRef.current) == null ? void 0 : _a.focus();
|
|
1367
1317
|
}, []);
|
|
1368
|
-
(0,
|
|
1318
|
+
(0, import_react8.useEffect)(() => {
|
|
1369
1319
|
if (!generatingSuggestion) {
|
|
1370
1320
|
return;
|
|
1371
1321
|
}
|
|
@@ -1403,7 +1353,7 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1403
1353
|
releaseLockIfNotClosed();
|
|
1404
1354
|
};
|
|
1405
1355
|
}, [generatingSuggestion]);
|
|
1406
|
-
const beginGeneratingAdjustment = (0,
|
|
1356
|
+
const beginGeneratingAdjustment = (0, import_react8.useCallback)(() => __async(void 0, null, function* () {
|
|
1407
1357
|
if (!adjustmentPrompt.trim()) {
|
|
1408
1358
|
return;
|
|
1409
1359
|
}
|
|
@@ -1556,10 +1506,10 @@ var HoveringInsertionPromptBox = (props) => {
|
|
|
1556
1506
|
|
|
1557
1507
|
// src/components/hovering-toolbar/hovering-toolbar-components.tsx
|
|
1558
1508
|
var import_css = require("@emotion/css");
|
|
1559
|
-
var
|
|
1509
|
+
var import_react9 = __toESM(require("react"));
|
|
1560
1510
|
var import_react_dom = __toESM(require("react-dom"));
|
|
1561
1511
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1562
|
-
var Button2 =
|
|
1512
|
+
var Button2 = import_react9.default.forwardRef(
|
|
1563
1513
|
(_a, ref) => {
|
|
1564
1514
|
var _b = _a, {
|
|
1565
1515
|
className,
|
|
@@ -1585,7 +1535,7 @@ var Button2 = import_react10.default.forwardRef(
|
|
|
1585
1535
|
);
|
|
1586
1536
|
}
|
|
1587
1537
|
);
|
|
1588
|
-
var Icon =
|
|
1538
|
+
var Icon = import_react9.default.forwardRef(
|
|
1589
1539
|
(_a, ref) => {
|
|
1590
1540
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1591
1541
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -1604,7 +1554,7 @@ var Icon = import_react10.default.forwardRef(
|
|
|
1604
1554
|
);
|
|
1605
1555
|
}
|
|
1606
1556
|
);
|
|
1607
|
-
var Menu =
|
|
1557
|
+
var Menu = import_react9.default.forwardRef(
|
|
1608
1558
|
(_a, ref) => {
|
|
1609
1559
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1610
1560
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -1631,7 +1581,7 @@ var Menu = import_react10.default.forwardRef(
|
|
|
1631
1581
|
var Portal = ({ children }) => {
|
|
1632
1582
|
return typeof document === "object" ? import_react_dom.default.createPortal(children, document.body) : null;
|
|
1633
1583
|
};
|
|
1634
|
-
var Toolbar =
|
|
1584
|
+
var Toolbar = import_react9.default.forwardRef(
|
|
1635
1585
|
(_a, ref) => {
|
|
1636
1586
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1637
1587
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -1656,15 +1606,15 @@ var Toolbar = import_react10.default.forwardRef(
|
|
|
1656
1606
|
// src/components/hovering-toolbar/hovering-toolbar.tsx
|
|
1657
1607
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1658
1608
|
var HoveringToolbar = (props) => {
|
|
1659
|
-
const ref = (0,
|
|
1609
|
+
const ref = (0, import_react10.useRef)(null);
|
|
1660
1610
|
const editor = (0, import_slate_react3.useSlate)();
|
|
1661
1611
|
const selection = (0, import_slate_react3.useSlateSelection)();
|
|
1662
1612
|
const { isDisplayed, setIsDisplayed } = useHoveringEditorContext();
|
|
1663
|
-
const [isClient, setIsClient] = (0,
|
|
1664
|
-
(0,
|
|
1613
|
+
const [isClient, setIsClient] = (0, import_react10.useState)(false);
|
|
1614
|
+
(0, import_react10.useEffect)(() => {
|
|
1665
1615
|
setIsClient(true);
|
|
1666
1616
|
}, []);
|
|
1667
|
-
(0,
|
|
1617
|
+
(0, import_react10.useEffect)(() => {
|
|
1668
1618
|
const el = ref.current;
|
|
1669
1619
|
const { selection: selection2 } = editor;
|
|
1670
1620
|
if (!el) {
|
|
@@ -1702,7 +1652,7 @@ var HoveringToolbar = (props) => {
|
|
|
1702
1652
|
el.style.top = `${top}px`;
|
|
1703
1653
|
el.style.left = `${left}px`;
|
|
1704
1654
|
});
|
|
1705
|
-
(0,
|
|
1655
|
+
(0, import_react10.useEffect)(() => {
|
|
1706
1656
|
const handleClickOutside = (event) => {
|
|
1707
1657
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
1708
1658
|
setIsDisplayed(false);
|
|
@@ -1800,10 +1750,10 @@ function makeRenderPlaceholderFunction(placeholderStyle) {
|
|
|
1800
1750
|
}
|
|
1801
1751
|
|
|
1802
1752
|
// src/components/base-copilot-textarea/use-add-branding-css.tsx
|
|
1803
|
-
var
|
|
1753
|
+
var import_react11 = require("react");
|
|
1804
1754
|
function useAddBrandingCss(suggestionStyleAugmented, disableBranding) {
|
|
1805
1755
|
const cssSelector = ".copilot-textarea.with-branding";
|
|
1806
|
-
(0,
|
|
1756
|
+
(0, import_react11.useEffect)(() => {
|
|
1807
1757
|
if (disableBranding) {
|
|
1808
1758
|
return;
|
|
1809
1759
|
}
|
|
@@ -1855,7 +1805,7 @@ function useAddBrandingCss(suggestionStyleAugmented, disableBranding) {
|
|
|
1855
1805
|
}
|
|
1856
1806
|
|
|
1857
1807
|
// src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx
|
|
1858
|
-
var
|
|
1808
|
+
var import_react12 = require("react");
|
|
1859
1809
|
var import_slate_react4 = require("slate-react");
|
|
1860
1810
|
var import_slate9 = require("slate");
|
|
1861
1811
|
|
|
@@ -1908,7 +1858,7 @@ function TrackerTextEditedSinceLastCursorMovement(props) {
|
|
|
1908
1858
|
text: editorToText(state)
|
|
1909
1859
|
}));
|
|
1910
1860
|
const previousState = usePrevious(cursorState);
|
|
1911
|
-
(0,
|
|
1861
|
+
(0, import_react12.useEffect)(() => {
|
|
1912
1862
|
if (!previousState) {
|
|
1913
1863
|
return;
|
|
1914
1864
|
}
|
|
@@ -1931,8 +1881,8 @@ var isSelectionEqual = (a, b) => {
|
|
|
1931
1881
|
return import_slate9.Range.equals(a, b);
|
|
1932
1882
|
};
|
|
1933
1883
|
function usePrevious(value) {
|
|
1934
|
-
const ref = (0,
|
|
1935
|
-
(0,
|
|
1884
|
+
const ref = (0, import_react12.useRef)();
|
|
1885
|
+
(0, import_react12.useEffect)(() => {
|
|
1936
1886
|
ref.current = value;
|
|
1937
1887
|
});
|
|
1938
1888
|
return ref.current;
|
|
@@ -1940,21 +1890,21 @@ function usePrevious(value) {
|
|
|
1940
1890
|
|
|
1941
1891
|
// src/components/base-copilot-textarea/base-copilot-textarea.tsx
|
|
1942
1892
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1943
|
-
var BaseCopilotTextarea =
|
|
1893
|
+
var BaseCopilotTextarea = import_react13.default.forwardRef(
|
|
1944
1894
|
(props, ref) => {
|
|
1945
1895
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(HoveringEditorProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BaseCopilotTextareaWithHoveringContext, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
1946
1896
|
}
|
|
1947
1897
|
);
|
|
1948
|
-
var BaseCopilotTextareaWithHoveringContext =
|
|
1898
|
+
var BaseCopilotTextareaWithHoveringContext = import_react13.default.forwardRef(
|
|
1949
1899
|
(props, ref) => {
|
|
1950
1900
|
const autosuggestionsConfig = __spreadValues(__spreadValues({}, defaultBaseAutosuggestionsConfig), props.baseAutosuggestionsConfig);
|
|
1951
|
-
const valueOnInitialRender = (0,
|
|
1901
|
+
const valueOnInitialRender = (0, import_react13.useMemo)(() => {
|
|
1952
1902
|
var _a2;
|
|
1953
1903
|
return (_a2 = props.value) != null ? _a2 : "";
|
|
1954
1904
|
}, []);
|
|
1955
|
-
const [lastKnownFullEditorText, setLastKnownFullEditorText] = (0,
|
|
1956
|
-
const [cursorMovedSinceLastTextChange, setCursorMovedSinceLastTextChange] = (0,
|
|
1957
|
-
const initialValue = (0,
|
|
1905
|
+
const [lastKnownFullEditorText, setLastKnownFullEditorText] = (0, import_react13.useState)(valueOnInitialRender);
|
|
1906
|
+
const [cursorMovedSinceLastTextChange, setCursorMovedSinceLastTextChange] = (0, import_react13.useState)(false);
|
|
1907
|
+
const initialValue = (0, import_react13.useMemo)(() => {
|
|
1958
1908
|
return [
|
|
1959
1909
|
{
|
|
1960
1910
|
type: "paragraph",
|
|
@@ -1964,7 +1914,7 @@ var BaseCopilotTextareaWithHoveringContext = import_react14.default.forwardRef(
|
|
|
1964
1914
|
}, [valueOnInitialRender]);
|
|
1965
1915
|
const editor = useCopilotTextareaEditor();
|
|
1966
1916
|
const { isDisplayed: hoveringEditorIsDisplayed, setIsDisplayed: setHoveringEditorIsDisplayed } = useHoveringEditorContext();
|
|
1967
|
-
const insertText = (0,
|
|
1917
|
+
const insertText = (0, import_react13.useCallback)(
|
|
1968
1918
|
(autosuggestion) => {
|
|
1969
1919
|
import_slate10.Editor.insertText(editor, autosuggestion.text, {
|
|
1970
1920
|
at: autosuggestion.point
|
|
@@ -1990,7 +1940,7 @@ var BaseCopilotTextareaWithHoveringContext = import_react14.default.forwardRef(
|
|
|
1990
1940
|
autosuggestionsConfig.disableWhenEmpty,
|
|
1991
1941
|
shouldDisableAutosuggestions
|
|
1992
1942
|
);
|
|
1993
|
-
const onKeyDownHandlerForHoveringEditor = (0,
|
|
1943
|
+
const onKeyDownHandlerForHoveringEditor = (0, import_react13.useCallback)(
|
|
1994
1944
|
(event) => {
|
|
1995
1945
|
var _a2;
|
|
1996
1946
|
if (autosuggestionsConfig.shouldToggleHoveringEditorOnKeyPress(event, (_a2 = props.shortcut) != null ? _a2 : "k")) {
|
|
@@ -2004,7 +1954,7 @@ var BaseCopilotTextareaWithHoveringContext = import_react14.default.forwardRef(
|
|
|
2004
1954
|
autosuggestionsConfig.shouldToggleHoveringEditorOnKeyPress
|
|
2005
1955
|
]
|
|
2006
1956
|
);
|
|
2007
|
-
(0,
|
|
1957
|
+
(0, import_react13.useEffect)(() => {
|
|
2008
1958
|
clearAutocompletionsFromEditor(editor);
|
|
2009
1959
|
if (currentAutocompleteSuggestion) {
|
|
2010
1960
|
addAutocompletionsToEditor(
|
|
@@ -2014,23 +1964,23 @@ var BaseCopilotTextareaWithHoveringContext = import_react14.default.forwardRef(
|
|
|
2014
1964
|
);
|
|
2015
1965
|
}
|
|
2016
1966
|
}, [currentAutocompleteSuggestion]);
|
|
2017
|
-
const suggestionStyleAugmented = (0,
|
|
1967
|
+
const suggestionStyleAugmented = (0, import_react13.useMemo)(() => {
|
|
2018
1968
|
return __spreadValues({
|
|
2019
1969
|
fontStyle: "italic",
|
|
2020
1970
|
color: "gray"
|
|
2021
1971
|
}, props.suggestionsStyle);
|
|
2022
1972
|
}, [props.suggestionsStyle]);
|
|
2023
|
-
const renderElementMemoized = (0,
|
|
1973
|
+
const renderElementMemoized = (0, import_react13.useMemo)(() => {
|
|
2024
1974
|
return makeRenderElementFunction(suggestionStyleAugmented);
|
|
2025
1975
|
}, [suggestionStyleAugmented]);
|
|
2026
|
-
const renderPlaceholderMemoized = (0,
|
|
1976
|
+
const renderPlaceholderMemoized = (0, import_react13.useMemo)(() => {
|
|
2027
1977
|
const placeholderStyleSlatejsOverrides = {
|
|
2028
1978
|
top: void 0
|
|
2029
1979
|
};
|
|
2030
1980
|
const placeholderStyleAugmented = __spreadValues(__spreadValues({}, placeholderStyleSlatejsOverrides), props.placeholderStyle);
|
|
2031
1981
|
return makeRenderPlaceholderFunction(placeholderStyleAugmented);
|
|
2032
1982
|
}, [props.placeholderStyle]);
|
|
2033
|
-
(0,
|
|
1983
|
+
(0, import_react13.useEffect)(() => {
|
|
2034
1984
|
var _a2, _b;
|
|
2035
1985
|
if (props.value === lastKnownFullEditorText) {
|
|
2036
1986
|
return;
|
|
@@ -2141,11 +2091,11 @@ function makeSemiFakeReactTextAreaEvent(currentText) {
|
|
|
2141
2091
|
|
|
2142
2092
|
// src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx
|
|
2143
2093
|
var import_react_core6 = require("@copilotkit/react-core");
|
|
2144
|
-
var
|
|
2094
|
+
var import_react14 = require("react");
|
|
2145
2095
|
var import_react_core7 = require("@copilotkit/react-core");
|
|
2146
2096
|
function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCategories, insertionApiConfig, editingApiConfig) {
|
|
2147
|
-
const { getContextString, copilotApiConfig } = (0,
|
|
2148
|
-
const insertionFunction = (0,
|
|
2097
|
+
const { getContextString, copilotApiConfig } = (0, import_react14.useContext)(import_react_core6.CopilotContext);
|
|
2098
|
+
const insertionFunction = (0, import_react14.useCallback)(
|
|
2149
2099
|
(editorState2, insertionPrompt, documents, abortSignal) => __async(this, null, function* () {
|
|
2150
2100
|
const res = yield retry(() => __async(this, null, function* () {
|
|
2151
2101
|
const messages = [
|
|
@@ -2185,7 +2135,7 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
2185
2135
|
}),
|
|
2186
2136
|
[insertionApiConfig, getContextString, contextCategories, textareaPurpose]
|
|
2187
2137
|
);
|
|
2188
|
-
const editingFunction = (0,
|
|
2138
|
+
const editingFunction = (0, import_react14.useCallback)(
|
|
2189
2139
|
(editorState2, editingPrompt, documents, abortSignal) => __async(this, null, function* () {
|
|
2190
2140
|
const res = yield retry(() => __async(this, null, function* () {
|
|
2191
2141
|
const messages = [
|
|
@@ -2230,7 +2180,7 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
2230
2180
|
}),
|
|
2231
2181
|
[editingApiConfig, getContextString, contextCategories, textareaPurpose]
|
|
2232
2182
|
);
|
|
2233
|
-
const insertionOrEditingFunction = (0,
|
|
2183
|
+
const insertionOrEditingFunction = (0, import_react14.useCallback)(
|
|
2234
2184
|
(editorState2, insertionPrompt, documents, abortSignal) => __async(this, null, function* () {
|
|
2235
2185
|
if (editorState2.selectedText === "") {
|
|
2236
2186
|
return yield insertionFunction(editorState2, insertionPrompt, documents, abortSignal);
|
|
@@ -2246,7 +2196,7 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
2246
2196
|
// src/components/copilot-textarea/copilot-textarea.tsx
|
|
2247
2197
|
var import_lodash = __toESM(require("lodash.merge"));
|
|
2248
2198
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2249
|
-
var CopilotTextarea =
|
|
2199
|
+
var CopilotTextarea = import_react15.default.forwardRef(
|
|
2250
2200
|
(props, ref) => {
|
|
2251
2201
|
const _a = props, { autosuggestionsConfig: autosuggestionsConfigUserSpecified } = _a, forwardedProps = __objRest(_a, ["autosuggestionsConfig"]);
|
|
2252
2202
|
const autosuggestionsConfig = (0, import_lodash.default)(
|