@copilotkit/react-textarea 0.21.0 → 0.24.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 +30 -30
- package/CHANGELOG.md +28 -0
- package/dist/{chunk-IJC2EXRO.mjs → chunk-3L6CNVCE.mjs} +3 -3
- package/dist/chunk-3L6CNVCE.mjs.map +1 -0
- package/dist/{chunk-WPIA53HF.mjs → chunk-4HHYJGZE.mjs} +1 -1
- package/dist/chunk-4HHYJGZE.mjs.map +1 -0
- package/dist/{chunk-PGGR6HL5.mjs → chunk-4LOLCQGR.mjs} +3 -1
- package/dist/chunk-4LOLCQGR.mjs.map +1 -0
- package/dist/{chunk-DYGPLRY3.mjs → chunk-4UYKBG35.mjs} +1 -1
- package/dist/{chunk-DYGPLRY3.mjs.map → chunk-4UYKBG35.mjs.map} +1 -1
- package/dist/{chunk-S6JUGJK2.mjs → chunk-6Z2ATUNY.mjs} +4 -2
- package/dist/chunk-6Z2ATUNY.mjs.map +1 -0
- package/dist/{chunk-UIN6BEVR.mjs → chunk-AQHORK66.mjs} +7 -7
- package/dist/{chunk-UIN6BEVR.mjs.map → chunk-AQHORK66.mjs.map} +1 -1
- package/dist/{chunk-MRPRZQMN.mjs → chunk-GIJ3JZ4P.mjs} +2 -2
- package/dist/{chunk-F2TIBXML.mjs → chunk-GUH3Y2H4.mjs} +4 -4
- package/dist/chunk-GUH3Y2H4.mjs.map +1 -0
- package/dist/{chunk-JBI2MZB4.mjs → chunk-JYVC4AW3.mjs} +7 -4
- package/dist/chunk-JYVC4AW3.mjs.map +1 -0
- package/dist/{chunk-NO3EYPQH.mjs → chunk-O4MHJSK2.mjs} +2 -2
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +6 -6
- package/dist/components/copilot-textarea/copilot-textarea.mjs +10 -10
- package/dist/components/hovering-toolbar/hovering-toolbar.d.ts +1 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +4 -4
- 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.mjs +3 -3
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +3 -3
- package/dist/components/index.mjs +10 -10
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +3 -3
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.d.ts +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +3 -3
- package/dist/index.mjs +10 -10
- package/dist/types/autosuggestions-config/autosuggestions-config.d.ts +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +2 -2
- package/dist/types/autosuggestions-config/index.mjs +2 -2
- package/dist/types/base/base-autosuggestions-config.mjs +1 -1
- package/dist/types/base/base-copilot-textarea-props.d.ts +3 -0
- package/dist/types/base/index.mjs +1 -1
- package/dist/types/index.mjs +2 -2
- package/package.json +2 -2
- package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +2 -0
- package/src/components/copilot-textarea/copilot-textarea.tsx +2 -2
- package/src/components/hovering-toolbar/hovering-toolbar.tsx +5 -1
- package/src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx +7 -1
- package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +1 -1
- package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +1 -1
- package/src/types/autosuggestions-config/autosuggestions-config.tsx +4 -3
- package/src/types/base/base-autosuggestions-config.tsx +2 -1
- package/src/types/base/base-copilot-textarea-props.tsx +3 -0
- package/dist/chunk-F2TIBXML.mjs.map +0 -1
- package/dist/chunk-IJC2EXRO.mjs.map +0 -1
- package/dist/chunk-JBI2MZB4.mjs.map +0 -1
- package/dist/chunk-PGGR6HL5.mjs.map +0 -1
- package/dist/chunk-S6JUGJK2.mjs.map +0 -1
- package/dist/chunk-WPIA53HF.mjs.map +0 -1
- /package/dist/{chunk-MRPRZQMN.mjs.map → chunk-GIJ3JZ4P.mjs.map} +0 -0
- /package/dist/{chunk-NO3EYPQH.mjs.map → chunk-O4MHJSK2.mjs.map} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export { CopilotTextarea } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
1
|
+
export { CopilotTextarea } from '../../chunk-AQHORK66.mjs';
|
|
2
|
+
import '../../chunk-4UYKBG35.mjs';
|
|
3
|
+
import '../../chunk-4HHYJGZE.mjs';
|
|
4
4
|
import '../../chunk-DE5K76I2.mjs';
|
|
5
5
|
import '../../chunk-5FO6ISW4.mjs';
|
|
6
6
|
import '../../chunk-QJDMIGLU.mjs';
|
|
7
|
-
import '../../chunk-
|
|
7
|
+
import '../../chunk-GUH3Y2H4.mjs';
|
|
8
8
|
import '../../chunk-AXN37AHC.mjs';
|
|
9
9
|
import '../../chunk-RR6OQGTI.mjs';
|
|
10
10
|
import '../../chunk-JHTAOLEW.mjs';
|
|
11
11
|
import '../../chunk-WADHCMPK.mjs';
|
|
12
|
-
import '../../chunk-
|
|
12
|
+
import '../../chunk-JYVC4AW3.mjs';
|
|
13
13
|
import '../../chunk-CSGFJU3L.mjs';
|
|
14
14
|
import '../../chunk-KCHYD3EB.mjs';
|
|
15
15
|
import '../../chunk-YQU7WG7T.mjs';
|
|
@@ -20,11 +20,11 @@ import '../../chunk-UHD44NC5.mjs';
|
|
|
20
20
|
import '../../chunk-JAFCXEPU.mjs';
|
|
21
21
|
import '../../chunk-OD7ZMOVE.mjs';
|
|
22
22
|
import '../../chunk-MPME5BW2.mjs';
|
|
23
|
-
import '../../chunk-
|
|
23
|
+
import '../../chunk-3L6CNVCE.mjs';
|
|
24
24
|
import '../../chunk-L7VVZH4Q.mjs';
|
|
25
|
-
import '../../chunk-
|
|
26
|
-
import '../../chunk-
|
|
27
|
-
import '../../chunk-
|
|
25
|
+
import '../../chunk-O4MHJSK2.mjs';
|
|
26
|
+
import '../../chunk-GIJ3JZ4P.mjs';
|
|
27
|
+
import '../../chunk-4LOLCQGR.mjs';
|
|
28
28
|
import '../../chunk-ND5PXTAW.mjs';
|
|
29
29
|
import '../../chunk-2NURR2DX.mjs';
|
|
30
30
|
import '../../chunk-5EJ5XOGP.mjs';
|
|
@@ -36,7 +36,7 @@ import '../../chunk-O5OWT5GE.mjs';
|
|
|
36
36
|
import '../../chunk-GCMQHIRF.mjs';
|
|
37
37
|
import '../../chunk-KGKLUWKW.mjs';
|
|
38
38
|
import '../../chunk-WJHSY5T6.mjs';
|
|
39
|
-
import '../../chunk-
|
|
39
|
+
import '../../chunk-6Z2ATUNY.mjs';
|
|
40
40
|
import '../../chunk-LNAIMEB2.mjs';
|
|
41
41
|
import '../../chunk-OELUUJZY.mjs';
|
|
42
42
|
import '../../chunk-NKW5OU2S.mjs';
|
|
@@ -4,6 +4,7 @@ import '@copilotkit/react-core';
|
|
|
4
4
|
interface HoveringToolbarProps {
|
|
5
5
|
apiConfig: InsertionEditorApiConfig;
|
|
6
6
|
contextCategories: string[];
|
|
7
|
+
hoverMenuClassname: string | undefined;
|
|
7
8
|
}
|
|
8
9
|
declare const HoveringToolbar: (props: HoveringToolbarProps) => JSX.Element | null;
|
|
9
10
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { HoveringToolbar } from '../../chunk-
|
|
1
|
+
export { HoveringToolbar } from '../../chunk-3L6CNVCE.mjs';
|
|
2
2
|
import '../../chunk-L7VVZH4Q.mjs';
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
3
|
+
import '../../chunk-O4MHJSK2.mjs';
|
|
4
|
+
import '../../chunk-GIJ3JZ4P.mjs';
|
|
5
|
+
import '../../chunk-4LOLCQGR.mjs';
|
|
6
6
|
import '../../chunk-ND5PXTAW.mjs';
|
|
7
7
|
import '../../chunk-2NURR2DX.mjs';
|
|
8
8
|
import '../../chunk-5EJ5XOGP.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { HoveringInsertionPromptBoxCore } from '../../../chunk-
|
|
2
|
-
import '../../../chunk-
|
|
1
|
+
export { HoveringInsertionPromptBoxCore } from '../../../chunk-GIJ3JZ4P.mjs';
|
|
2
|
+
import '../../../chunk-4LOLCQGR.mjs';
|
|
3
3
|
import '../../../chunk-ND5PXTAW.mjs';
|
|
4
4
|
import '../../../chunk-2NURR2DX.mjs';
|
|
5
5
|
import '../../../chunk-5EJ5XOGP.mjs';
|
package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { HoveringInsertionPromptBox } from '../../../chunk-
|
|
2
|
-
import '../../../chunk-
|
|
3
|
-
import '../../../chunk-
|
|
1
|
+
export { HoveringInsertionPromptBox } from '../../../chunk-O4MHJSK2.mjs';
|
|
2
|
+
import '../../../chunk-GIJ3JZ4P.mjs';
|
|
3
|
+
import '../../../chunk-4LOLCQGR.mjs';
|
|
4
4
|
import '../../../chunk-ND5PXTAW.mjs';
|
|
5
5
|
import '../../../chunk-2NURR2DX.mjs';
|
|
6
6
|
import '../../../chunk-5EJ5XOGP.mjs';
|
package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { FileChipPreview, IncludedFilesPreview } from '../../../chunk-
|
|
1
|
+
export { FileChipPreview, IncludedFilesPreview } from '../../../chunk-4LOLCQGR.mjs';
|
|
2
2
|
import '../../../chunk-5EJ5XOGP.mjs';
|
|
3
3
|
import '../../../chunk-KGKLUWKW.mjs';
|
|
4
4
|
import '../../../chunk-MRXNTQOX.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../../../chunk-L7VVZH4Q.mjs';
|
|
2
|
-
export { HoveringInsertionPromptBox } from '../../../chunk-
|
|
3
|
-
import '../../../chunk-
|
|
4
|
-
import '../../../chunk-
|
|
2
|
+
export { HoveringInsertionPromptBox } from '../../../chunk-O4MHJSK2.mjs';
|
|
3
|
+
import '../../../chunk-GIJ3JZ4P.mjs';
|
|
4
|
+
import '../../../chunk-4LOLCQGR.mjs';
|
|
5
5
|
import '../../../chunk-ND5PXTAW.mjs';
|
|
6
6
|
import '../../../chunk-2NURR2DX.mjs';
|
|
7
7
|
import '../../../chunk-5EJ5XOGP.mjs';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import '../chunk-MMVDU6DF.mjs';
|
|
2
|
-
export { CopilotTextarea } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
2
|
+
export { CopilotTextarea } from '../chunk-AQHORK66.mjs';
|
|
3
|
+
import '../chunk-4UYKBG35.mjs';
|
|
4
|
+
import '../chunk-4HHYJGZE.mjs';
|
|
5
5
|
import '../chunk-DE5K76I2.mjs';
|
|
6
6
|
import '../chunk-5FO6ISW4.mjs';
|
|
7
7
|
import '../chunk-QJDMIGLU.mjs';
|
|
8
|
-
import '../chunk-
|
|
8
|
+
import '../chunk-GUH3Y2H4.mjs';
|
|
9
9
|
import '../chunk-AXN37AHC.mjs';
|
|
10
10
|
import '../chunk-RR6OQGTI.mjs';
|
|
11
11
|
import '../chunk-JHTAOLEW.mjs';
|
|
12
12
|
import '../chunk-WADHCMPK.mjs';
|
|
13
|
-
export { BaseCopilotTextarea } from '../chunk-
|
|
13
|
+
export { BaseCopilotTextarea } from '../chunk-JYVC4AW3.mjs';
|
|
14
14
|
import '../chunk-CSGFJU3L.mjs';
|
|
15
15
|
import '../chunk-KCHYD3EB.mjs';
|
|
16
16
|
import '../chunk-YQU7WG7T.mjs';
|
|
@@ -21,11 +21,11 @@ import '../chunk-UHD44NC5.mjs';
|
|
|
21
21
|
import '../chunk-JAFCXEPU.mjs';
|
|
22
22
|
import '../chunk-OD7ZMOVE.mjs';
|
|
23
23
|
import '../chunk-MPME5BW2.mjs';
|
|
24
|
-
import '../chunk-
|
|
24
|
+
import '../chunk-3L6CNVCE.mjs';
|
|
25
25
|
import '../chunk-L7VVZH4Q.mjs';
|
|
26
|
-
import '../chunk-
|
|
27
|
-
import '../chunk-
|
|
28
|
-
import '../chunk-
|
|
26
|
+
import '../chunk-O4MHJSK2.mjs';
|
|
27
|
+
import '../chunk-GIJ3JZ4P.mjs';
|
|
28
|
+
import '../chunk-4LOLCQGR.mjs';
|
|
29
29
|
import '../chunk-ND5PXTAW.mjs';
|
|
30
30
|
import '../chunk-2NURR2DX.mjs';
|
|
31
31
|
import '../chunk-5EJ5XOGP.mjs';
|
|
@@ -37,7 +37,7 @@ import '../chunk-O5OWT5GE.mjs';
|
|
|
37
37
|
import '../chunk-GCMQHIRF.mjs';
|
|
38
38
|
import '../chunk-KGKLUWKW.mjs';
|
|
39
39
|
import '../chunk-WJHSY5T6.mjs';
|
|
40
|
-
import '../chunk-
|
|
40
|
+
import '../chunk-6Z2ATUNY.mjs';
|
|
41
41
|
import '../chunk-LNAIMEB2.mjs';
|
|
42
42
|
import '../chunk-OELUUJZY.mjs';
|
|
43
43
|
import '../chunk-NKW5OU2S.mjs';
|
package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts
CHANGED
|
@@ -17,6 +17,6 @@ import '../../types/autosuggestions-config/subtypes/make-system-prompt.js';
|
|
|
17
17
|
* @param contextCategories - The categories of context strings we want to include. By default, we include the (default) "global" context category.
|
|
18
18
|
* @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.
|
|
19
19
|
*/
|
|
20
|
-
declare function useMakeStandardAutosuggestionFunction(textareaPurpose: string, contextCategories: string[]
|
|
20
|
+
declare function useMakeStandardAutosuggestionFunction(textareaPurpose: string, contextCategories: string[], apiConfig: SuggestionsApiConfig): AutosuggestionsBareFunction;
|
|
21
21
|
|
|
22
22
|
export { useMakeStandardAutosuggestionFunction };
|
package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { useMakeStandardAutosuggestionFunction } from '../../chunk-
|
|
1
|
+
export { useMakeStandardAutosuggestionFunction } from '../../chunk-4UYKBG35.mjs';
|
|
2
2
|
import '../../chunk-DE5K76I2.mjs';
|
|
3
3
|
import '../../chunk-5FO6ISW4.mjs';
|
|
4
4
|
import '../../chunk-QJDMIGLU.mjs';
|
|
5
|
-
import '../../chunk-
|
|
5
|
+
import '../../chunk-GUH3Y2H4.mjs';
|
|
6
6
|
import '../../chunk-AXN37AHC.mjs';
|
|
7
7
|
import '../../chunk-RR6OQGTI.mjs';
|
|
8
8
|
import '../../chunk-JHTAOLEW.mjs';
|
|
9
9
|
import '../../chunk-WADHCMPK.mjs';
|
|
10
10
|
import '../../chunk-WJHSY5T6.mjs';
|
|
11
|
-
import '../../chunk-
|
|
11
|
+
import '../../chunk-6Z2ATUNY.mjs';
|
|
12
12
|
import '../../chunk-4S5ZJH3I.mjs';
|
|
13
13
|
import '../../chunk-MRXNTQOX.mjs';
|
|
14
14
|
//# sourceMappingURL=out.js.map
|
|
@@ -18,6 +18,6 @@ import '../../types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js'
|
|
|
18
18
|
* @param contextCategories - The categories of context strings we want to include. By default, we include the (default) "global" context category.
|
|
19
19
|
* @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.
|
|
20
20
|
*/
|
|
21
|
-
declare function useMakeStandardInsertionOrEditingFunction(textareaPurpose: string, contextCategories: string[]
|
|
21
|
+
declare function useMakeStandardInsertionOrEditingFunction(textareaPurpose: string, contextCategories: string[], insertionApiConfig: InsertionsApiConfig, editingApiConfig: EditingApiConfig): Generator_InsertionOrEditingSuggestion;
|
|
22
22
|
|
|
23
23
|
export { useMakeStandardInsertionOrEditingFunction };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { useMakeStandardInsertionOrEditingFunction } from '../../chunk-
|
|
1
|
+
export { useMakeStandardInsertionOrEditingFunction } from '../../chunk-4HHYJGZE.mjs';
|
|
2
2
|
import '../../chunk-DE5K76I2.mjs';
|
|
3
3
|
import '../../chunk-5FO6ISW4.mjs';
|
|
4
4
|
import '../../chunk-QJDMIGLU.mjs';
|
|
5
|
-
import '../../chunk-
|
|
5
|
+
import '../../chunk-GUH3Y2H4.mjs';
|
|
6
6
|
import '../../chunk-AXN37AHC.mjs';
|
|
7
7
|
import '../../chunk-RR6OQGTI.mjs';
|
|
8
8
|
import '../../chunk-JHTAOLEW.mjs';
|
|
9
9
|
import '../../chunk-WADHCMPK.mjs';
|
|
10
10
|
import '../../chunk-WJHSY5T6.mjs';
|
|
11
|
-
import '../../chunk-
|
|
11
|
+
import '../../chunk-6Z2ATUNY.mjs';
|
|
12
12
|
import '../../chunk-4S5ZJH3I.mjs';
|
|
13
13
|
import '../../chunk-MRXNTQOX.mjs';
|
|
14
14
|
//# sourceMappingURL=out.js.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import './chunk-MMVDU6DF.mjs';
|
|
2
|
-
export { CopilotTextarea } from './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
2
|
+
export { CopilotTextarea } from './chunk-AQHORK66.mjs';
|
|
3
|
+
import './chunk-4UYKBG35.mjs';
|
|
4
|
+
import './chunk-4HHYJGZE.mjs';
|
|
5
5
|
import './chunk-DE5K76I2.mjs';
|
|
6
6
|
import './chunk-5FO6ISW4.mjs';
|
|
7
7
|
export { ChatlikeApiEndpoint } from './chunk-QJDMIGLU.mjs';
|
|
8
|
-
export { defaultAutosuggestionsConfig } from './chunk-
|
|
8
|
+
export { defaultAutosuggestionsConfig } from './chunk-GUH3Y2H4.mjs';
|
|
9
9
|
import './chunk-AXN37AHC.mjs';
|
|
10
10
|
import './chunk-RR6OQGTI.mjs';
|
|
11
11
|
import './chunk-JHTAOLEW.mjs';
|
|
12
12
|
import './chunk-WADHCMPK.mjs';
|
|
13
|
-
export { BaseCopilotTextarea } from './chunk-
|
|
13
|
+
export { BaseCopilotTextarea } from './chunk-JYVC4AW3.mjs';
|
|
14
14
|
import './chunk-CSGFJU3L.mjs';
|
|
15
15
|
import './chunk-KCHYD3EB.mjs';
|
|
16
16
|
import './chunk-YQU7WG7T.mjs';
|
|
@@ -21,11 +21,11 @@ import './chunk-UHD44NC5.mjs';
|
|
|
21
21
|
import './chunk-JAFCXEPU.mjs';
|
|
22
22
|
import './chunk-OD7ZMOVE.mjs';
|
|
23
23
|
import './chunk-MPME5BW2.mjs';
|
|
24
|
-
import './chunk-
|
|
24
|
+
import './chunk-3L6CNVCE.mjs';
|
|
25
25
|
import './chunk-L7VVZH4Q.mjs';
|
|
26
|
-
import './chunk-
|
|
27
|
-
import './chunk-
|
|
28
|
-
import './chunk-
|
|
26
|
+
import './chunk-O4MHJSK2.mjs';
|
|
27
|
+
import './chunk-GIJ3JZ4P.mjs';
|
|
28
|
+
import './chunk-4LOLCQGR.mjs';
|
|
29
29
|
import './chunk-ND5PXTAW.mjs';
|
|
30
30
|
import './chunk-2NURR2DX.mjs';
|
|
31
31
|
import './chunk-5EJ5XOGP.mjs';
|
|
@@ -37,7 +37,7 @@ import './chunk-O5OWT5GE.mjs';
|
|
|
37
37
|
import './chunk-GCMQHIRF.mjs';
|
|
38
38
|
import './chunk-KGKLUWKW.mjs';
|
|
39
39
|
import './chunk-WJHSY5T6.mjs';
|
|
40
|
-
export { defaultBaseAutosuggestionsConfig } from './chunk-
|
|
40
|
+
export { defaultBaseAutosuggestionsConfig } from './chunk-6Z2ATUNY.mjs';
|
|
41
41
|
import './chunk-LNAIMEB2.mjs';
|
|
42
42
|
import './chunk-OELUUJZY.mjs';
|
|
43
43
|
import './chunk-IU3WTXLQ.mjs';
|
|
@@ -8,7 +8,7 @@ import './subtypes/minimal-chat-gpt-message.js';
|
|
|
8
8
|
import './subtypes/make-system-prompt.js';
|
|
9
9
|
|
|
10
10
|
interface AutosuggestionsConfig extends Omit<BaseAutosuggestionsConfig, "apiConfig"> {
|
|
11
|
-
|
|
11
|
+
contextCategories: string[];
|
|
12
12
|
chatApiConfigs: {
|
|
13
13
|
suggestionsApiConfig: SuggestionsApiConfig;
|
|
14
14
|
insertionApiConfig: InsertionsApiConfig;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { defaultAutosuggestionsConfig } from '../../chunk-
|
|
1
|
+
export { defaultAutosuggestionsConfig } from '../../chunk-GUH3Y2H4.mjs';
|
|
2
2
|
import '../../chunk-AXN37AHC.mjs';
|
|
3
3
|
import '../../chunk-RR6OQGTI.mjs';
|
|
4
4
|
import '../../chunk-JHTAOLEW.mjs';
|
|
5
5
|
import '../../chunk-WJHSY5T6.mjs';
|
|
6
|
-
import '../../chunk-
|
|
6
|
+
import '../../chunk-6Z2ATUNY.mjs';
|
|
7
7
|
import '../../chunk-MRXNTQOX.mjs';
|
|
8
8
|
//# sourceMappingURL=out.js.map
|
|
9
9
|
//# sourceMappingURL=autosuggestions-config.mjs.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import '../../chunk-5FO6ISW4.mjs';
|
|
2
2
|
export { ChatlikeApiEndpoint } from '../../chunk-QJDMIGLU.mjs';
|
|
3
|
-
export { defaultAutosuggestionsConfig } from '../../chunk-
|
|
3
|
+
export { defaultAutosuggestionsConfig } from '../../chunk-GUH3Y2H4.mjs';
|
|
4
4
|
import '../../chunk-AXN37AHC.mjs';
|
|
5
5
|
import '../../chunk-RR6OQGTI.mjs';
|
|
6
6
|
import '../../chunk-JHTAOLEW.mjs';
|
|
7
7
|
import '../../chunk-WJHSY5T6.mjs';
|
|
8
|
-
import '../../chunk-
|
|
8
|
+
import '../../chunk-6Z2ATUNY.mjs';
|
|
9
9
|
import '../../chunk-MRXNTQOX.mjs';
|
|
10
10
|
//# sourceMappingURL=out.js.map
|
|
11
11
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defaultBaseAutosuggestionsConfig } from '../../chunk-
|
|
1
|
+
export { defaultBaseAutosuggestionsConfig } from '../../chunk-6Z2ATUNY.mjs';
|
|
2
2
|
import '../../chunk-MRXNTQOX.mjs';
|
|
3
3
|
//# sourceMappingURL=out.js.map
|
|
4
4
|
//# sourceMappingURL=base-autosuggestions-config.mjs.map
|
|
@@ -14,6 +14,8 @@ import '@copilotkit/react-core';
|
|
|
14
14
|
*
|
|
15
15
|
* @property {React.CSSProperties} [suggestionsStyle] - Specifies the CSS styles to apply to the suggestions list.
|
|
16
16
|
*
|
|
17
|
+
* @property {string} [hoverMenuClassname] - a classname to applly to the editor popover window.
|
|
18
|
+
*
|
|
17
19
|
* @property {string} [value] - The initial value of the textarea. Can be controlled via `onValueChange`.
|
|
18
20
|
*
|
|
19
21
|
* @property {(value: string) => void} [onValueChange] - Callback invoked when the value of the textarea changes.
|
|
@@ -29,6 +31,7 @@ interface BaseCopilotTextareaProps extends Omit<TextareaHTMLAttributes<HTMLDivEl
|
|
|
29
31
|
disableBranding?: boolean;
|
|
30
32
|
placeholderStyle?: React.CSSProperties;
|
|
31
33
|
suggestionsStyle?: React.CSSProperties;
|
|
34
|
+
hoverMenuClassname?: string;
|
|
32
35
|
value?: string;
|
|
33
36
|
onValueChange?: (value: string) => void;
|
|
34
37
|
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../../chunk-WJHSY5T6.mjs';
|
|
2
|
-
export { defaultBaseAutosuggestionsConfig } from '../../chunk-
|
|
2
|
+
export { defaultBaseAutosuggestionsConfig } from '../../chunk-6Z2ATUNY.mjs';
|
|
3
3
|
import '../../chunk-MRXNTQOX.mjs';
|
|
4
4
|
//# sourceMappingURL=out.js.map
|
|
5
5
|
//# sourceMappingURL=index.mjs.map
|
package/dist/types/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import '../chunk-DE5K76I2.mjs';
|
|
2
2
|
import '../chunk-5FO6ISW4.mjs';
|
|
3
3
|
export { ChatlikeApiEndpoint } from '../chunk-QJDMIGLU.mjs';
|
|
4
|
-
export { defaultAutosuggestionsConfig } from '../chunk-
|
|
4
|
+
export { defaultAutosuggestionsConfig } from '../chunk-GUH3Y2H4.mjs';
|
|
5
5
|
import '../chunk-AXN37AHC.mjs';
|
|
6
6
|
import '../chunk-RR6OQGTI.mjs';
|
|
7
7
|
import '../chunk-JHTAOLEW.mjs';
|
|
8
8
|
import '../chunk-WADHCMPK.mjs';
|
|
9
9
|
import '../chunk-WJHSY5T6.mjs';
|
|
10
|
-
export { defaultBaseAutosuggestionsConfig } from '../chunk-
|
|
10
|
+
export { defaultBaseAutosuggestionsConfig } from '../chunk-6Z2ATUNY.mjs';
|
|
11
11
|
import '../chunk-MRXNTQOX.mjs';
|
|
12
12
|
//# sourceMappingURL=out.js.map
|
|
13
13
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.24.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"**/*.css"
|
|
10
10
|
],
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"slate-history": "^0.93.0",
|
|
60
60
|
"slate-react": "^0.98.1",
|
|
61
61
|
"tailwind-merge": "^1.13.2",
|
|
62
|
-
"@copilotkit/react-core": "0.
|
|
62
|
+
"@copilotkit/react-core": "0.13.0"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"build": "tsup --treeshake",
|
|
@@ -160,6 +160,7 @@ const BaseCopilotTextareaWithHoveringContext = React.forwardRef(
|
|
|
160
160
|
const {
|
|
161
161
|
placeholderStyle,
|
|
162
162
|
value,
|
|
163
|
+
hoverMenuClassname,
|
|
163
164
|
onValueChange,
|
|
164
165
|
baseAutosuggestionsConfig: autosuggestionsConfigFromProps,
|
|
165
166
|
className,
|
|
@@ -212,6 +213,7 @@ const BaseCopilotTextareaWithHoveringContext = React.forwardRef(
|
|
|
212
213
|
<HoveringToolbar
|
|
213
214
|
apiConfig={autosuggestionsConfig.apiConfig}
|
|
214
215
|
contextCategories={autosuggestionsConfig.contextCategories}
|
|
216
|
+
hoverMenuClassname={hoverMenuClassname}
|
|
215
217
|
/>
|
|
216
218
|
<Editable
|
|
217
219
|
renderElement={renderElementMemoized}
|
|
@@ -37,14 +37,14 @@ export const CopilotTextarea = React.forwardRef(
|
|
|
37
37
|
|
|
38
38
|
const autosuggestionsFunction = useMakeStandardAutosuggestionFunction(
|
|
39
39
|
autosuggestionsConfig.textareaPurpose,
|
|
40
|
-
autosuggestionsConfig.
|
|
40
|
+
autosuggestionsConfig.contextCategories,
|
|
41
41
|
autosuggestionsConfig.chatApiConfigs.suggestionsApiConfig
|
|
42
42
|
);
|
|
43
43
|
|
|
44
44
|
const insertionOrEditingFunction =
|
|
45
45
|
useMakeStandardInsertionOrEditingFunction(
|
|
46
46
|
autosuggestionsConfig.textareaPurpose,
|
|
47
|
-
autosuggestionsConfig.
|
|
47
|
+
autosuggestionsConfig.contextCategories,
|
|
48
48
|
autosuggestionsConfig.chatApiConfigs.insertionApiConfig,
|
|
49
49
|
autosuggestionsConfig.chatApiConfigs.editingApiConfig
|
|
50
50
|
);
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
export interface HoveringToolbarProps {
|
|
18
18
|
apiConfig: InsertionEditorApiConfig;
|
|
19
19
|
contextCategories: string[];
|
|
20
|
+
hoverMenuClassname: string | undefined;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export const HoveringToolbar: (
|
|
@@ -118,7 +119,10 @@ export const HoveringToolbar: (
|
|
|
118
119
|
<Portal>
|
|
119
120
|
<Menu
|
|
120
121
|
ref={ref}
|
|
121
|
-
className=
|
|
122
|
+
className={
|
|
123
|
+
props.hoverMenuClassname ||
|
|
124
|
+
"p-2 absolute z-10 top-[-10000px] left-[-10000px] mt-[-6px] opacity-0 transition-opacity duration-700"
|
|
125
|
+
}
|
|
122
126
|
>
|
|
123
127
|
{isDisplayed && selection && (
|
|
124
128
|
<HoveringInsertionPromptBox
|
package/src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx
CHANGED
|
@@ -48,7 +48,13 @@ export const FileChipPreview: React.FC<FileChipPreviewProp> = ({
|
|
|
48
48
|
<Chip
|
|
49
49
|
label={filePointer.name}
|
|
50
50
|
onDelete={onDelete}
|
|
51
|
-
avatar={
|
|
51
|
+
avatar={
|
|
52
|
+
<Avatar
|
|
53
|
+
src={filePointer.iconImageUri}
|
|
54
|
+
alt={filePointer.sourceApplication}
|
|
55
|
+
sx={{ backgroundColor: "transparent" }}
|
|
56
|
+
></Avatar>
|
|
57
|
+
}
|
|
52
58
|
/>
|
|
53
59
|
);
|
|
54
60
|
};
|
package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx
CHANGED
|
@@ -23,7 +23,7 @@ import { SuggestionsApiConfig } from "../../types/autosuggestions-config/suggest
|
|
|
23
23
|
*/
|
|
24
24
|
export function useMakeStandardAutosuggestionFunction(
|
|
25
25
|
textareaPurpose: string,
|
|
26
|
-
contextCategories: string[]
|
|
26
|
+
contextCategories: string[],
|
|
27
27
|
apiConfig: SuggestionsApiConfig
|
|
28
28
|
): AutosuggestionsBareFunction {
|
|
29
29
|
const { getContextString, copilotApiConfig } = useContext(CopilotContext);
|
|
@@ -27,7 +27,7 @@ import { DocumentPointer } from "@copilotkit/react-core";
|
|
|
27
27
|
*/
|
|
28
28
|
export function useMakeStandardInsertionOrEditingFunction(
|
|
29
29
|
textareaPurpose: string,
|
|
30
|
-
contextCategories: string[]
|
|
30
|
+
contextCategories: string[],
|
|
31
31
|
insertionApiConfig: InsertionsApiConfig,
|
|
32
32
|
editingApiConfig: EditingApiConfig
|
|
33
33
|
): Generator_InsertionOrEditingSuggestion {
|
|
@@ -15,13 +15,14 @@ import {
|
|
|
15
15
|
EditingApiConfig,
|
|
16
16
|
defaultEditingApiConfig,
|
|
17
17
|
} from "./editing-api-config";
|
|
18
|
+
import { defaultCopilotContextCategories } from "@copilotkit/react-core";
|
|
18
19
|
|
|
19
20
|
// Like the base autosuggestions config, with 2 additional fields:
|
|
20
|
-
// 1.
|
|
21
|
+
// 1. contextCategories: string[] | undefined;
|
|
21
22
|
// 2. instead of apiConfigs, we have chatApiConfigs: a higher-level abstraction that uses a ChatGPT-like API endpoint.
|
|
22
23
|
export interface AutosuggestionsConfig
|
|
23
24
|
extends Omit<BaseAutosuggestionsConfig, "apiConfig"> {
|
|
24
|
-
|
|
25
|
+
contextCategories: string[];
|
|
25
26
|
chatApiConfigs: {
|
|
26
27
|
suggestionsApiConfig: SuggestionsApiConfig;
|
|
27
28
|
insertionApiConfig: InsertionsApiConfig;
|
|
@@ -34,7 +35,7 @@ export const defaultAutosuggestionsConfig: Omit<
|
|
|
34
35
|
"textareaPurpose" | "apiEndpoint"
|
|
35
36
|
> = {
|
|
36
37
|
...defaultBaseAutosuggestionsConfig,
|
|
37
|
-
|
|
38
|
+
contextCategories: defaultCopilotContextCategories,
|
|
38
39
|
chatApiConfigs: {
|
|
39
40
|
suggestionsApiConfig: defaultSuggestionsApiConfig,
|
|
40
41
|
insertionApiConfig: defaultInsertionsApiConfig,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseCopilotTextareaApiConfig } from "./autosuggestions-bare-function";
|
|
2
|
+
import { defaultCopilotContextCategories } from "@copilotkit/react-core";
|
|
2
3
|
|
|
3
4
|
export interface BaseAutosuggestionsConfig {
|
|
4
5
|
textareaPurpose: string;
|
|
@@ -16,7 +17,7 @@ export const defaultBaseAutosuggestionsConfig: Omit<
|
|
|
16
17
|
"textareaPurpose" | "apiConfig"
|
|
17
18
|
> = {
|
|
18
19
|
debounceTime: 250,
|
|
19
|
-
contextCategories:
|
|
20
|
+
contextCategories: defaultCopilotContextCategories,
|
|
20
21
|
acceptAutosuggestionKey: "Tab",
|
|
21
22
|
disableWhenEmpty: true,
|
|
22
23
|
disabled: false,
|
|
@@ -13,6 +13,8 @@ import { BaseCopilotTextareaApiConfig } from "./autosuggestions-bare-function";
|
|
|
13
13
|
*
|
|
14
14
|
* @property {React.CSSProperties} [suggestionsStyle] - Specifies the CSS styles to apply to the suggestions list.
|
|
15
15
|
*
|
|
16
|
+
* @property {string} [hoverMenuClassname] - a classname to applly to the editor popover window.
|
|
17
|
+
*
|
|
16
18
|
* @property {string} [value] - The initial value of the textarea. Can be controlled via `onValueChange`.
|
|
17
19
|
*
|
|
18
20
|
* @property {(value: string) => void} [onValueChange] - Callback invoked when the value of the textarea changes.
|
|
@@ -29,6 +31,7 @@ export interface BaseCopilotTextareaProps
|
|
|
29
31
|
disableBranding?: boolean;
|
|
30
32
|
placeholderStyle?: React.CSSProperties;
|
|
31
33
|
suggestionsStyle?: React.CSSProperties;
|
|
34
|
+
hoverMenuClassname?: string;
|
|
32
35
|
value?: string;
|
|
33
36
|
onValueChange?: (value: string) => void;
|
|
34
37
|
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/autosuggestions-config/autosuggestions-config.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA+BO,IAAM,+BAGT,iCACC,mCADD;AAAA,EAEF,2BAA2B;AAAA,EAC3B,gBAAgB;AAAA,IACd,sBAAsB;AAAA,IACtB,oBAAoB;AAAA,IACpB,kBAAkB;AAAA,EACpB;AACF","sourcesContent":["import {\n BaseAutosuggestionsConfig,\n defaultBaseAutosuggestionsConfig,\n} from \"../base\";\nimport {\n SuggestionsApiConfig,\n defaultSuggestionsApiConfig,\n} from \"./suggestions-api-config\";\nimport {\n InsertionsApiConfig,\n defaultInsertionsApiConfig,\n} from \"./insertions-api-config\";\nimport { ChatlikeApiEndpoint } from \".\";\nimport {\n EditingApiConfig,\n defaultEditingApiConfig,\n} from \"./editing-api-config\";\n\n// Like the base autosuggestions config, with 2 additional fields:\n// 1. externalContextCategories: string[] | undefined;\n// 2. instead of apiConfigs, we have chatApiConfigs: a higher-level abstraction that uses a ChatGPT-like API endpoint.\nexport interface AutosuggestionsConfig\n extends Omit<BaseAutosuggestionsConfig, \"apiConfig\"> {\n externalContextCategories: string[] | undefined;\n chatApiConfigs: {\n suggestionsApiConfig: SuggestionsApiConfig;\n insertionApiConfig: InsertionsApiConfig;\n editingApiConfig: EditingApiConfig;\n };\n}\n\nexport const defaultAutosuggestionsConfig: Omit<\n AutosuggestionsConfig,\n \"textareaPurpose\" | \"apiEndpoint\"\n> = {\n ...defaultBaseAutosuggestionsConfig,\n externalContextCategories: undefined,\n chatApiConfigs: {\n suggestionsApiConfig: defaultSuggestionsApiConfig,\n insertionApiConfig: defaultInsertionsApiConfig,\n editingApiConfig: defaultEditingApiConfig,\n },\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/hovering-toolbar/hovering-toolbar.tsx"],"names":["selection"],"mappings":"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","sourcesContent":["import { css } from \"@emotion/css\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { BaseSelection, Editor, Range, Location, Transforms } from \"slate\";\nimport { useSlate, useSlateSelection } from \"slate-react\";\nimport { HoveringInsertionPromptBox } from \"./text-insertion-prompt-box\";\nimport { Button, Icon, Menu, Portal } from \"./hovering-toolbar-components\";\nimport { useHoveringEditorContext } from \"./hovering-editor-provider\";\nimport {\n getFullEditorTextWithNewlines,\n getTextAroundSelection,\n} from \"../../lib/get-text-around-cursor\";\nimport {\n EditingEditorState,\n InsertionEditorApiConfig,\n} from \"../../types/base/autosuggestions-bare-function\";\n\nexport interface HoveringToolbarProps {\n apiConfig: InsertionEditorApiConfig;\n contextCategories: string[];\n}\n\nexport const HoveringToolbar: (\n props: HoveringToolbarProps\n) => JSX.Element | null = (props) => {\n const ref = useRef<HTMLDivElement>(null);\n const editor = useSlate();\n const selection = useSlateSelection();\n const { isDisplayed, setIsDisplayed } = useHoveringEditorContext();\n\n // only render on client\n const [isClient, setIsClient] = useState(false);\n useEffect(() => {\n setIsClient(true);\n }, []);\n\n useEffect(() => {\n const el = ref.current;\n const { selection } = editor;\n\n if (!el) {\n return;\n }\n\n if (!selection) {\n el.removeAttribute(\"style\");\n return;\n }\n\n const domSelection = window.getSelection();\n if (!domSelection) {\n return;\n }\n\n const domRange = domSelection.getRangeAt(0);\n const rect = domRange.getBoundingClientRect();\n\n // We use window = (0,0,0,0) as a signal that the selection is not in the original copilot-textarea,\n // but inside the hovering window.\n //\n // in such case, we simply do nothing.\n if (\n rect.top === 0 &&\n rect.left === 0 &&\n rect.width === 0 &&\n rect.height === 0\n ) {\n return;\n }\n\n const minGapFromEdge = 60;\n const verticalOffsetFromCorner = 35;\n const horizontalOffsetFromCorner = 15;\n let top =\n rect.top + window.scrollY - el.offsetHeight + verticalOffsetFromCorner;\n // make sure top is in the viewport and not too close to the edge\n if (top < minGapFromEdge) {\n top = rect.bottom + window.scrollY + minGapFromEdge;\n } else if (top + el.offsetHeight > window.innerHeight - minGapFromEdge) {\n top = rect.top + window.scrollY - el.offsetHeight - minGapFromEdge;\n }\n\n let left =\n rect.left +\n window.scrollX -\n el.offsetWidth / 2 +\n rect.width / 2 +\n horizontalOffsetFromCorner;\n // make sure left is in the viewport and not too close to the edge\n if (left < minGapFromEdge) {\n left = minGapFromEdge;\n } else if (left + el.offsetWidth > window.innerWidth - minGapFromEdge) {\n left = window.innerWidth - el.offsetWidth - minGapFromEdge;\n }\n\n el.style.opacity = \"1\";\n el.style.top = `${top}px`;\n el.style.left = `${left}px`;\n });\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (ref.current && !ref.current.contains(event.target as Node)) {\n setIsDisplayed(false);\n }\n };\n\n document.addEventListener(\"mousedown\", handleClickOutside);\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [ref, setIsDisplayed]);\n\n if (!isClient) {\n return null;\n }\n\n return (\n <Portal>\n <Menu\n ref={ref}\n className=\"p-2 absolute z-10 top-[-10000px] left-[-10000px] mt-[-6px] opacity-0 transition-opacity duration-700\"\n >\n {isDisplayed && selection && (\n <HoveringInsertionPromptBox\n editorState={editorState(editor, selection)}\n apiConfig={props.apiConfig}\n closeWindow={() => {\n setIsDisplayed(false);\n }}\n performInsertion={(insertedText) => {\n console.log(\"inserted text\", insertedText);\n // replace the selection with the inserted text\n Transforms.delete(editor, { at: selection });\n Transforms.insertText(editor, insertedText, {\n at: selection,\n });\n setIsDisplayed(false);\n }}\n contextCategories={props.contextCategories}\n />\n )}\n </Menu>\n </Portal>\n );\n};\n\nfunction editorState(editor: Editor, selection: Location): EditingEditorState {\n const textAroundCursor = getTextAroundSelection(editor);\n if (textAroundCursor) {\n return textAroundCursor;\n }\n\n return {\n textBeforeCursor: getFullEditorTextWithNewlines(editor),\n textAfterCursor: \"\",\n selectedText: \"\",\n };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/base-copilot-textarea/base-copilot-textarea.tsx"],"names":["_a","value"],"mappings":"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","sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { Descendant, Editor } from \"slate\";\nimport { Editable, Slate } from \"slate-react\";\nimport { twMerge } from \"tailwind-merge\";\nimport { useAutosuggestions } from \"../../hooks/base-copilot-textarea-implementation/use-autosuggestions\";\nimport { useCopilotTextareaEditor } from \"../../hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor\";\nimport { usePopulateCopilotTextareaRef } from \"../../hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref\";\nimport {\n getFullEditorTextWithNewlines,\n getTextAroundCollapsedCursor,\n} from \"../../lib/get-text-around-cursor\";\nimport { addAutocompletionsToEditor } from \"../../lib/slatejs-edits/add-autocompletions\";\nimport { clearAutocompletionsFromEditor } from \"../../lib/slatejs-edits/clear-autocompletions\";\nimport { replaceEditorText } from \"../../lib/slatejs-edits/replace-text\";\nimport {\n BaseAutosuggestionsConfig,\n defaultBaseAutosuggestionsConfig,\n} from \"../../types/base\";\nimport { AutosuggestionState } from \"../../types/base/autosuggestion-state\";\nimport { BaseCopilotTextareaProps } from \"../../types/base/base-copilot-textarea-props\";\nimport \"./base-copilot-textarea.css\";\nimport { HoveringToolbar } from \"../hovering-toolbar/hovering-toolbar\";\nimport { makeRenderElementFunction } from \"./render-element\";\nimport { makeRenderPlaceholderFunction } from \"./render-placeholder\";\nimport { useAddBrandingCss } from \"./use-add-branding-css\";\nimport {\n HoveringEditorProvider,\n useHoveringEditorContext,\n} from \"../hovering-toolbar/hovering-editor-provider\";\nimport { EditorAutocompleteState } from \"../../types/base/editor-autocomplete-state\";\nimport { TrackerTextEditedSinceLastCursorMovement } from \"./track-cursor-moved-since-last-text-change\";\n\nexport interface HTMLCopilotTextAreaElement extends HTMLElement {\n value: string;\n focus: () => void;\n blur: () => void;\n}\n\nconst BaseCopilotTextareaWithHoveringContext = React.forwardRef(\n (\n props: BaseCopilotTextareaProps,\n ref: React.Ref<HTMLCopilotTextAreaElement>\n ): JSX.Element => {\n const autosuggestionsConfig: BaseAutosuggestionsConfig = {\n ...defaultBaseAutosuggestionsConfig,\n ...props.baseAutosuggestionsConfig,\n };\n\n const valueOnInitialRender = useMemo(() => props.value ?? \"\", []);\n const [lastKnownFullEditorText, setLastKnownFullEditorText] =\n useState(valueOnInitialRender);\n const [cursorMovedSinceLastTextChange, setCursorMovedSinceLastTextChange] =\n useState(false);\n\n // // When the editor text changes, we want to reset the `textEditedSinceLastCursorMovement` state.\n // useEffect(() => {\n // setCursorMovedSinceLastTextChange(false);\n // }, [lastKnownFullEditorText]);\n\n const initialValue: Descendant[] = useMemo(() => {\n return [\n {\n type: \"paragraph\",\n children: [{ text: valueOnInitialRender }],\n },\n ];\n }, [valueOnInitialRender]);\n\n const editor = useCopilotTextareaEditor();\n\n const {\n isDisplayed: hoveringEditorIsDisplayed,\n setIsDisplayed: setHoveringEditorIsDisplayed,\n } = useHoveringEditorContext();\n\n const insertText = useCallback(\n (autosuggestion: AutosuggestionState) => {\n Editor.insertText(editor, autosuggestion.text, {\n at: autosuggestion.point,\n });\n },\n [editor]\n );\n\n const {\n currentAutocompleteSuggestion,\n onChangeHandler: onChangeHandlerForAutocomplete,\n onKeyDownHandler: onKeyDownHandlerForAutocomplete,\n } = useAutosuggestions(\n autosuggestionsConfig.debounceTime,\n autosuggestionsConfig.acceptAutosuggestionKey,\n autosuggestionsConfig.apiConfig.autosuggestionsFunction,\n insertText,\n autosuggestionsConfig.disableWhenEmpty,\n autosuggestionsConfig.disabled ||\n hoveringEditorIsDisplayed || // disable autosuggestions when the hovering editor is displayed\n (cursorMovedSinceLastTextChange &&\n autosuggestionsConfig.temporarilyDisableWhenMovingCursorWithoutChangingText) // disable autosuggestions when the cursor has moved since the last text change\n );\n const onKeyDownHandlerForHoveringEditor = useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n // if command-k, toggle the hovering editor\n if (event.key === \"k\" && event.metaKey) {\n event.preventDefault();\n setHoveringEditorIsDisplayed(!hoveringEditorIsDisplayed);\n }\n },\n [hoveringEditorIsDisplayed, setHoveringEditorIsDisplayed]\n );\n\n // sync autosuggestions state with the editor\n useEffect(() => {\n clearAutocompletionsFromEditor(editor);\n if (currentAutocompleteSuggestion) {\n addAutocompletionsToEditor(\n editor,\n currentAutocompleteSuggestion.text,\n currentAutocompleteSuggestion.point\n );\n }\n }, [currentAutocompleteSuggestion]);\n\n const suggestionStyleAugmented: React.CSSProperties = useMemo(() => {\n return {\n fontStyle: \"italic\",\n color: \"gray\",\n ...props.suggestionsStyle,\n };\n }, [props.suggestionsStyle]);\n\n const renderElementMemoized = useMemo(() => {\n return makeRenderElementFunction(suggestionStyleAugmented);\n }, [suggestionStyleAugmented]);\n\n const renderPlaceholderMemoized = useMemo(() => {\n // For some reason slateJS specifies a top value of 0, which makes for strange styling. We override this here.\n const placeholderStyleSlatejsOverrides: React.CSSProperties = {\n top: undefined,\n };\n\n const placeholderStyleAugmented: React.CSSProperties = {\n ...placeholderStyleSlatejsOverrides,\n ...props.placeholderStyle,\n };\n\n return makeRenderPlaceholderFunction(placeholderStyleAugmented);\n }, [props.placeholderStyle]);\n\n // update the editor text, but only when the value changes from outside the component\n useEffect(() => {\n if (props.value === lastKnownFullEditorText) {\n return;\n }\n\n setLastKnownFullEditorText(props.value ?? \"\");\n replaceEditorText(editor, props.value ?? \"\");\n }, [props.value]);\n\n // separate into TextareaHTMLAttributes<HTMLDivElement> and CopilotTextareaProps\n const {\n placeholderStyle,\n value,\n onValueChange,\n baseAutosuggestionsConfig: autosuggestionsConfigFromProps,\n className,\n onChange,\n onKeyDown,\n disableBranding,\n ...propsToForward\n } = props;\n\n useAddBrandingCss(suggestionStyleAugmented, disableBranding);\n usePopulateCopilotTextareaRef(editor, ref);\n\n const moddedClassName = (() => {\n const baseClassName = \"copilot-textarea\";\n const brandingClass = disableBranding ? \"no-branding\" : \"with-branding\";\n const defaultTailwindClassName = \"bg-white overflow-y-auto resize-y\";\n const mergedClassName = twMerge(\n defaultTailwindClassName,\n className ?? \"\"\n );\n return `${baseClassName} ${brandingClass} ${mergedClassName}`;\n })();\n\n return (\n <Slate\n editor={editor}\n initialValue={initialValue}\n onChange={(value) => {\n const newEditorState = getTextAroundCollapsedCursor(editor);\n\n const fullEditorText = newEditorState\n ? newEditorState.textBeforeCursor + newEditorState.textAfterCursor\n : getFullEditorTextWithNewlines(editor); // we don't double-parse the editor. When `newEditorState` is null, we didn't parse the editor yet.\n\n setLastKnownFullEditorText((prev) => {\n if (prev !== fullEditorText) {\n setCursorMovedSinceLastTextChange(false);\n }\n return fullEditorText;\n });\n onChangeHandlerForAutocomplete(newEditorState);\n\n props.onValueChange?.(fullEditorText);\n props.onChange?.(makeSemiFakeReactTextAreaEvent(fullEditorText));\n }}\n >\n <TrackerTextEditedSinceLastCursorMovement\n setCursorMovedSinceLastTextChange={setCursorMovedSinceLastTextChange}\n />\n <HoveringToolbar\n apiConfig={autosuggestionsConfig.apiConfig}\n contextCategories={autosuggestionsConfig.contextCategories}\n />\n <Editable\n renderElement={renderElementMemoized}\n renderPlaceholder={renderPlaceholderMemoized}\n onKeyDown={(event) => {\n onKeyDownHandlerForHoveringEditor(event); // forward the event for internal use\n onKeyDownHandlerForAutocomplete(event); // forward the event for internal use\n props.onKeyDown?.(event); // forward the event for external use\n }}\n className={moddedClassName}\n {...propsToForward}\n />\n </Slate>\n );\n }\n);\n\n// Consumers of <textarea> expect a `onChange: (React.ChangeEvent<HTMLTextAreaElement>) => void` event handler to be passed in.\n// This is *extremely* common, and we want to support it.\n//\n// We can't support the full functionality, but in 99% of cases, the consumer only cares about the `event.target.value` property --\n// that's how they get the new value of the textarea.\n//\n// So, the tradeoff we are making is minimizing compiler complaint, with a small chance of runtime error.\n// The alternative would be defining a different onChange entrypoint (we actually do have that in `onValueChange`),\n// And starting to explain subtleties to users the moment they try to use the component for the first time for very basic functionality.\n//\n// If this proves problematic, we can always revisit this decision.\nfunction makeSemiFakeReactTextAreaEvent(\n currentText: string\n): React.ChangeEvent<HTMLTextAreaElement> {\n return {\n target: {\n value: currentText,\n type: \"copilot-textarea\",\n },\n currentTarget: {\n value: currentText,\n type: \"copilot-textarea\",\n },\n } as React.ChangeEvent<HTMLTextAreaElement>;\n}\n\nexport const BaseCopilotTextarea = React.forwardRef(\n (\n props: BaseCopilotTextareaProps,\n ref: React.Ref<HTMLCopilotTextAreaElement>\n ): JSX.Element => {\n return (\n <HoveringEditorProvider>\n <BaseCopilotTextareaWithHoveringContext {...props} ref={ref} />\n </HoveringEditorProvider>\n );\n }\n);\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx"],"names":[],"mappings":";;;;;AAGA,OAAO,UAAU;AACjB,OAAO,YAAY;AAYf,SACE,KADF;AALG,IAAM,uBAA4D,CAAC;AAAA,EACxE;AAAA,EACA;AACF,MAAM;AACJ,SACE,qBAAC;AAAA,IAAI,WAAU;AAAA,IACb;AAAA,0BAAC;AAAA,QAAM,WAAU;AAAA,QAAG;AAAA,OAAiB;AAAA,MACrC,oBAAC;AAAA,QAAI,WAAU;AAAA,QACZ,wBAAc,IAAI,CAAC,aAAa,UAAU;AACzC,iBACE,oBAAC;AAAA,YAEC;AAAA,YACA,UAAU,MAAM;AACd;AAAA,gBAAiB,CAAC,SAChB,KAAK,OAAO,CAAC,OAAO,OAAO,WAAW;AAAA,cACxC;AAAA,YACF;AAAA,aANK,QAAQ,YAAY,qBAAqB,YAAY,MAO5D;AAAA,QAEJ,CAAC;AAAA,OACH;AAAA;AAAA,GACF;AAEJ;AAOO,IAAM,kBAAiD,CAAC;AAAA,EAC7D;AAAA,EACA;AACF,MAAM;AACJ,SACE,oBAAC;AAAA,IACC,OAAO,YAAY;AAAA,IACnB;AAAA,IACA,QAAQ,oBAAC;AAAA,MAAO,IAAI,EAAE,iBAAiB,cAAc;AAAA,KAAG;AAAA,GAC1D;AAEJ","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: React.FC<IncludedFilesPreviewProps> = ({\n includedFiles,\n setIncludedFiles,\n}) => {\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) =>\n prev.filter((fp) => fp !== filePointer)\n );\n }}\n />\n );\n })}\n </div>\n </div>\n );\n};\n\nexport interface FileChipPreviewProp {\n filePointer: DocumentPointer;\n onDelete: () => void;\n}\n\nexport const FileChipPreview: React.FC<FileChipPreviewProp> = ({\n filePointer,\n onDelete,\n}) => {\n return (\n <Chip\n label={filePointer.name}\n onDelete={onDelete}\n avatar={<Avatar sx={{ backgroundColor: \"transparent\" }}></Avatar>}\n />\n );\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/base/base-autosuggestions-config.tsx"],"names":[],"mappings":";AAaO,IAAM,mCAGT;AAAA,EACF,cAAc;AAAA,EACd,mBAAmB,CAAC,QAAQ;AAAA,EAC5B,yBAAyB;AAAA,EACzB,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,uDAAuD;AACzD","sourcesContent":["import { BaseCopilotTextareaApiConfig } from \"./autosuggestions-bare-function\";\n\nexport interface BaseAutosuggestionsConfig {\n textareaPurpose: string;\n contextCategories: string[];\n debounceTime: number;\n acceptAutosuggestionKey: string;\n disableWhenEmpty: boolean;\n disabled: boolean;\n temporarilyDisableWhenMovingCursorWithoutChangingText: boolean;\n apiConfig: BaseCopilotTextareaApiConfig;\n}\n\nexport const defaultBaseAutosuggestionsConfig: Omit<\n BaseAutosuggestionsConfig,\n \"textareaPurpose\" | \"apiConfig\"\n> = {\n debounceTime: 250,\n contextCategories: [\"global\"],\n acceptAutosuggestionKey: \"Tab\",\n disableWhenEmpty: true,\n disabled: false,\n temporarilyDisableWhenMovingCursorWithoutChangingText: true,\n};\n"]}
|