@copilotkit/react-textarea 1.51.4-next.7 → 1.51.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +18 -12
- package/dist/{chunk-D47EKHIF.mjs → chunk-2X3CZVEP.mjs} +9 -3
- package/dist/chunk-2X3CZVEP.mjs.map +1 -0
- package/dist/{chunk-GU5LTWGL.mjs → chunk-3WLGLZTY.mjs} +19 -13
- package/dist/chunk-3WLGLZTY.mjs.map +1 -0
- package/dist/{chunk-DRV2FOHZ.mjs → chunk-7GZWOXE4.mjs} +2 -2
- package/dist/chunk-7GZWOXE4.mjs.map +1 -0
- package/dist/{chunk-NAFNY4FL.mjs → chunk-7V4ORVQX.mjs} +1 -1
- package/dist/chunk-7V4ORVQX.mjs.map +1 -0
- package/dist/{chunk-ECR45NSD.mjs → chunk-A6YGJFQI.mjs} +9 -2
- package/dist/chunk-A6YGJFQI.mjs.map +1 -0
- package/dist/{chunk-WGWQRALG.mjs → chunk-AHNPJMBR.mjs} +10 -3
- package/dist/chunk-AHNPJMBR.mjs.map +1 -0
- package/dist/{chunk-VSVQZUPW.mjs → chunk-ARLBRSB7.mjs} +23 -7
- package/dist/chunk-ARLBRSB7.mjs.map +1 -0
- package/dist/{chunk-72GJNLCO.mjs → chunk-AZ7RF6ED.mjs} +5 -5
- package/dist/chunk-AZ7RF6ED.mjs.map +1 -0
- package/dist/{chunk-I72DKFHD.mjs → chunk-CFCMZVQ2.mjs} +29 -7
- package/dist/chunk-CFCMZVQ2.mjs.map +1 -0
- package/dist/{chunk-T6MTDQZ7.mjs → chunk-CMKGYQFX.mjs} +1 -1
- package/dist/chunk-CMKGYQFX.mjs.map +1 -0
- package/dist/{chunk-DFTV4TST.mjs → chunk-DZMQBOPG.mjs} +1 -1
- package/dist/chunk-DZMQBOPG.mjs.map +1 -0
- package/dist/{chunk-CLGAJCZ5.mjs → chunk-E7C63KQP.mjs} +10 -6
- package/dist/chunk-E7C63KQP.mjs.map +1 -0
- package/dist/{chunk-GQN2HYFJ.mjs → chunk-EGBZSVLK.mjs} +5 -2
- package/dist/{chunk-GQN2HYFJ.mjs.map → chunk-EGBZSVLK.mjs.map} +1 -1
- package/dist/{chunk-3QJOFG3V.mjs → chunk-FTG7P3NP.mjs} +1 -1
- package/dist/chunk-FTG7P3NP.mjs.map +1 -0
- package/dist/{chunk-KMVGEY7Q.mjs → chunk-IBZTDP72.mjs} +9 -4
- package/dist/chunk-IBZTDP72.mjs.map +1 -0
- package/dist/{chunk-4PDYALMP.mjs → chunk-LYNGBKJR.mjs} +9 -3
- package/dist/chunk-LYNGBKJR.mjs.map +1 -0
- package/dist/{chunk-DL3JWL2E.mjs → chunk-M7GTVHFB.mjs} +26 -8
- package/dist/chunk-M7GTVHFB.mjs.map +1 -0
- package/dist/chunk-MQBPYOOZ.mjs +97 -0
- package/dist/chunk-MQBPYOOZ.mjs.map +1 -0
- package/dist/{chunk-6SGWO63I.mjs → chunk-MQXYWOE2.mjs} +3 -3
- package/dist/chunk-MQXYWOE2.mjs.map +1 -0
- package/dist/{chunk-F2ULK22F.mjs → chunk-NFMCLTJU.mjs} +1 -1
- package/dist/chunk-NFMCLTJU.mjs.map +1 -0
- package/dist/{chunk-F6RLSVG3.mjs → chunk-O4WCM57A.mjs} +1 -1
- package/dist/chunk-O4WCM57A.mjs.map +1 -0
- package/dist/{chunk-4NHVQZ67.mjs → chunk-PDFIUPCS.mjs} +1 -1
- package/dist/chunk-PDFIUPCS.mjs.map +1 -0
- package/dist/{chunk-7NOLZ5T3.mjs → chunk-SWX3MRZ4.mjs} +31 -22
- package/dist/chunk-SWX3MRZ4.mjs.map +1 -0
- package/dist/{chunk-QJNFNPWH.mjs → chunk-TGN3YVSO.mjs} +2 -2
- package/dist/chunk-TGN3YVSO.mjs.map +1 -0
- package/dist/{chunk-LYB4B6MK.mjs → chunk-UB4Y22EF.mjs} +4 -2
- package/dist/chunk-UB4Y22EF.mjs.map +1 -0
- package/dist/{chunk-ZQSEYPNN.mjs → chunk-UIBUYQPG.mjs} +7 -2
- package/dist/chunk-UIBUYQPG.mjs.map +1 -0
- package/dist/{chunk-AJ5OMEXM.mjs → chunk-VBPZTMXB.mjs} +2 -2
- package/dist/{chunk-EJGGLWWR.mjs → chunk-VH7INUR5.mjs} +1 -1
- package/dist/{chunk-EJGGLWWR.mjs.map → chunk-VH7INUR5.mjs.map} +1 -1
- package/dist/{chunk-7LSRNPNI.mjs → chunk-VVRGAA43.mjs} +1 -1
- package/dist/chunk-VVRGAA43.mjs.map +1 -0
- package/dist/{chunk-YLFAIYRY.mjs → chunk-VYLLLBUP.mjs} +1 -1
- package/dist/chunk-VYLLLBUP.mjs.map +1 -0
- package/dist/{chunk-2QDCE7PD.mjs → chunk-WXKPRNNO.mjs} +1 -1
- package/dist/chunk-WXKPRNNO.mjs.map +1 -0
- package/dist/{chunk-JLOABKLH.mjs → chunk-YINY56BI.mjs} +2 -2
- package/dist/{chunk-23Q6A46J.mjs → chunk-ZBP4SABT.mjs} +22 -8
- package/dist/chunk-ZBP4SABT.mjs.map +1 -0
- package/dist/{chunk-H5ZNEKUR.mjs → chunk-ZWI5KPQ5.mjs} +2 -2
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js +154 -86
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +29 -29
- package/dist/components/base-copilot-textarea/render-element.js.map +1 -1
- package/dist/components/base-copilot-textarea/render-element.mjs +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.js.map +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.mjs +1 -1
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js.map +1 -1
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +2 -2
- package/dist/components/base-copilot-textarea/use-add-branding-css.js.map +1 -1
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.js +190 -95
- package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.mjs +34 -34
- package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.js +3 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js +57 -63
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.js +117 -77
- package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +15 -15
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +60 -14
- 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 +11 -11
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +60 -14
- 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 +12 -12
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.d.ts +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js +14 -3
- 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 -3
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +60 -14
- 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 +12 -12
- package/dist/components/index.js +190 -95
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +34 -34
- package/dist/components/manual-ui/chip-with-icon.d.ts +1 -1
- package/dist/components/manual-ui/chip-with-icon.js +13 -2
- package/dist/components/manual-ui/chip-with-icon.js.map +1 -1
- package/dist/components/manual-ui/chip-with-icon.mjs +13 -2
- package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -1
- package/dist/components/source-search-box/source-search-box.js +28 -5
- package/dist/components/source-search-box/source-search-box.js.map +1 -1
- package/dist/components/source-search-box/source-search-box.mjs +4 -4
- package/dist/components/ui/button.js +7 -1
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/button.mjs +2 -2
- package/dist/components/ui/command.js +47 -9
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/command.mjs +3 -3
- package/dist/components/ui/dialog.js +27 -5
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/dialog.mjs +2 -2
- package/dist/components/ui/label.js +7 -1
- package/dist/components/ui/label.js.map +1 -1
- package/dist/components/ui/label.mjs +2 -2
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js +18 -4
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +4 -4
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +2 -2
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +2 -2
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js +6 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js +25 -7
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +1 -1
- package/dist/hooks/misc/use-autosize-textarea.js.map +1 -1
- package/dist/hooks/misc/use-autosize-textarea.mjs +1 -1
- package/dist/index.js +190 -95
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -35
- package/dist/index.umd.js +16 -16
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/debouncer.js.map +1 -1
- package/dist/lib/debouncer.mjs +1 -1
- package/dist/lib/editor-to-text.js.map +1 -1
- package/dist/lib/editor-to-text.mjs +1 -1
- package/dist/lib/get-text-around-cursor.js.map +1 -1
- package/dist/lib/get-text-around-cursor.mjs +1 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.js +4 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.js.map +1 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs +1 -1
- package/dist/lib/slatejs-edits/with-partial-history.js.map +1 -1
- package/dist/lib/slatejs-edits/with-partial-history.mjs +1 -1
- package/dist/lib/stream-promise-flatten.js.map +1 -1
- package/dist/lib/stream-promise-flatten.mjs +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/utils.mjs +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.js.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +3 -3
- package/dist/types/autosuggestions-config/editing-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.mjs +1 -1
- package/dist/types/autosuggestions-config/index.js.map +1 -1
- package/dist/types/autosuggestions-config/index.mjs +3 -3
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js.map +1 -1
- package/dist/types/base/base-autosuggestions-config.js.map +1 -1
- package/dist/types/base/base-autosuggestions-config.mjs +1 -1
- package/dist/types/base/base-copilot-textarea-props.js.map +1 -1
- package/dist/types/base/editor-autocomplete-state.js.map +1 -1
- package/dist/types/base/editor-autocomplete-state.mjs +2 -2
- package/dist/types/base/index.js.map +1 -1
- package/dist/types/base/index.mjs +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +3 -3
- package/package.json +8 -8
- package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +30 -10
- package/src/components/base-copilot-textarea/render-element.tsx +6 -2
- package/src/components/base-copilot-textarea/render-placeholder.tsx +3 -1
- package/src/components/base-copilot-textarea/use-add-branding-css.tsx +3 -1
- package/src/components/copilot-textarea/copilot-textarea.tsx +15 -9
- package/src/components/hovering-toolbar/hovering-editor-provider.tsx +3 -1
- package/src/components/hovering-toolbar/hovering-toolbar-components.tsx +63 -52
- package/src/components/hovering-toolbar/hovering-toolbar.tsx +21 -5
- package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +13 -7
- package/src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx +7 -2
- package/src/components/manual-ui/chip-with-icon.tsx +12 -3
- package/src/components/source-search-box/source-search-box.tsx +12 -2
- package/src/components/ui/button.tsx +13 -5
- package/src/components/ui/command.tsx +17 -4
- package/src/components/ui/dialog.tsx +23 -5
- package/src/components/ui/label.tsx +7 -2
- package/src/hooks/base-copilot-textarea-implementation/use-autosuggestions.ts +35 -9
- package/src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx +5 -1
- package/src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts +5 -1
- package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +9 -2
- package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +24 -6
- package/src/hooks/misc/use-autosize-textarea.tsx +4 -1
- package/src/lib/debouncer.ts +3 -1
- package/src/lib/editor-to-text.ts +5 -2
- package/src/lib/get-text-around-cursor.ts +14 -2
- package/src/lib/slatejs-edits/clear-autocompletions.ts +4 -1
- package/src/lib/slatejs-edits/with-partial-history.ts +10 -3
- package/src/lib/stream-promise-flatten.ts +3 -1
- package/src/lib/utils.ts +6 -2
- package/src/types/autosuggestions-config/autosuggestions-config-user-specified.tsx +3 -2
- package/src/types/autosuggestions-config/autosuggestions-config.tsx +20 -5
- package/src/types/autosuggestions-config/editing-api-config.tsx +2 -1
- package/src/types/autosuggestions-config/subtypes/make-system-prompt.ts +4 -1
- package/src/types/base/base-autosuggestions-config.tsx +10 -4
- package/src/types/base/base-copilot-textarea-props.tsx +4 -2
- package/tsconfig.json +1 -1
- package/tsup.config.ts +5 -1
- package/dist/chunk-23Q6A46J.mjs.map +0 -1
- package/dist/chunk-2IWVZ4PP.mjs +0 -103
- package/dist/chunk-2IWVZ4PP.mjs.map +0 -1
- package/dist/chunk-2QDCE7PD.mjs.map +0 -1
- package/dist/chunk-3QJOFG3V.mjs.map +0 -1
- package/dist/chunk-4NHVQZ67.mjs.map +0 -1
- package/dist/chunk-4PDYALMP.mjs.map +0 -1
- package/dist/chunk-6SGWO63I.mjs.map +0 -1
- package/dist/chunk-72GJNLCO.mjs.map +0 -1
- package/dist/chunk-7LSRNPNI.mjs.map +0 -1
- package/dist/chunk-7NOLZ5T3.mjs.map +0 -1
- package/dist/chunk-CLGAJCZ5.mjs.map +0 -1
- package/dist/chunk-D47EKHIF.mjs.map +0 -1
- package/dist/chunk-DFTV4TST.mjs.map +0 -1
- package/dist/chunk-DL3JWL2E.mjs.map +0 -1
- package/dist/chunk-DRV2FOHZ.mjs.map +0 -1
- package/dist/chunk-ECR45NSD.mjs.map +0 -1
- package/dist/chunk-F2ULK22F.mjs.map +0 -1
- package/dist/chunk-F6RLSVG3.mjs.map +0 -1
- package/dist/chunk-GU5LTWGL.mjs.map +0 -1
- package/dist/chunk-I72DKFHD.mjs.map +0 -1
- package/dist/chunk-KMVGEY7Q.mjs.map +0 -1
- package/dist/chunk-LYB4B6MK.mjs.map +0 -1
- package/dist/chunk-NAFNY4FL.mjs.map +0 -1
- package/dist/chunk-QJNFNPWH.mjs.map +0 -1
- package/dist/chunk-T6MTDQZ7.mjs.map +0 -1
- package/dist/chunk-VSVQZUPW.mjs.map +0 -1
- package/dist/chunk-WGWQRALG.mjs.map +0 -1
- package/dist/chunk-YLFAIYRY.mjs.map +0 -1
- package/dist/chunk-ZQSEYPNN.mjs.map +0 -1
- /package/dist/{chunk-AJ5OMEXM.mjs.map → chunk-VBPZTMXB.mjs.map} +0 -0
- /package/dist/{chunk-JLOABKLH.mjs.map → chunk-YINY56BI.mjs.map} +0 -0
- /package/dist/{chunk-H5ZNEKUR.mjs.map → chunk-ZWI5KPQ5.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -155,7 +155,10 @@ function useAutosuggestions(debounceTime, shouldAcceptAutosuggestionOnKeyPress,
|
|
|
155
155
|
if (disableWhenEmpty && editorAutocompleteState.textBeforeCursor === "" && editorAutocompleteState.textAfterCursor === "") {
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
|
-
const suggestion = yield autosuggestionFunction(
|
|
158
|
+
const suggestion = yield autosuggestionFunction(
|
|
159
|
+
editorAutocompleteState,
|
|
160
|
+
abortSignal
|
|
161
|
+
);
|
|
159
162
|
if (!suggestion || abortSignal.aborted) {
|
|
160
163
|
throw new DOMException("Aborted", "AbortError");
|
|
161
164
|
}
|
|
@@ -164,10 +167,17 @@ function useAutosuggestions(debounceTime, shouldAcceptAutosuggestionOnKeyPress,
|
|
|
164
167
|
point: editorAutocompleteState.cursorPoint
|
|
165
168
|
});
|
|
166
169
|
}),
|
|
167
|
-
[
|
|
170
|
+
[
|
|
171
|
+
autosuggestionFunction,
|
|
172
|
+
setCurrentAutocompleteSuggestion,
|
|
173
|
+
disableWhenEmpty,
|
|
174
|
+
disabled
|
|
175
|
+
]
|
|
168
176
|
);
|
|
169
177
|
const debouncedFunction = (0, import_react.useMemo)(
|
|
170
|
-
() => new Debouncer(
|
|
178
|
+
() => new Debouncer(
|
|
179
|
+
debounceTime
|
|
180
|
+
),
|
|
171
181
|
[debounceTime]
|
|
172
182
|
);
|
|
173
183
|
(0, import_react.useEffect)(() => {
|
|
@@ -205,7 +215,11 @@ function useAutosuggestions(debounceTime, shouldAcceptAutosuggestionOnKeyPress,
|
|
|
205
215
|
const keyDownOrTouchHandler = (0, import_react.useCallback)(
|
|
206
216
|
(event) => {
|
|
207
217
|
if (currentAutocompleteSuggestion) {
|
|
208
|
-
const shouldAcceptSuggestion = event.type === "touchstart" ? shouldAcceptAutosuggestionOnTouch(
|
|
218
|
+
const shouldAcceptSuggestion = event.type === "touchstart" ? shouldAcceptAutosuggestionOnTouch(
|
|
219
|
+
event
|
|
220
|
+
) : shouldAcceptAutosuggestionOnKeyPress(
|
|
221
|
+
event
|
|
222
|
+
);
|
|
209
223
|
if (shouldAcceptSuggestion) {
|
|
210
224
|
event.preventDefault();
|
|
211
225
|
insertAutocompleteSuggestion(currentAutocompleteSuggestion);
|
|
@@ -628,7 +642,10 @@ function clearAutocompletionsFromEditor(editor) {
|
|
|
628
642
|
try {
|
|
629
643
|
import_slate6.Transforms.removeNodes(editor, { at: path });
|
|
630
644
|
} catch (e) {
|
|
631
|
-
console.log(
|
|
645
|
+
console.log(
|
|
646
|
+
"CopilotTextarea.clearAutocompletionsFromEditor: error removing node",
|
|
647
|
+
e
|
|
648
|
+
);
|
|
632
649
|
}
|
|
633
650
|
}
|
|
634
651
|
}
|
|
@@ -672,7 +689,9 @@ var HoveringEditorContext = (0, import_react4.createContext)({
|
|
|
672
689
|
setIsDisplayed: () => {
|
|
673
690
|
}
|
|
674
691
|
});
|
|
675
|
-
var HoveringEditorProvider = ({
|
|
692
|
+
var HoveringEditorProvider = ({
|
|
693
|
+
children
|
|
694
|
+
}) => {
|
|
676
695
|
const [isDisplayed, setIsDisplayed] = (0, import_react4.useState)(false);
|
|
677
696
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HoveringEditorContext.Provider, { value: { isDisplayed, setIsDisplayed }, children });
|
|
678
697
|
};
|
|
@@ -699,73 +718,67 @@ var Button = import_react5.default.forwardRef((_a, ref) => {
|
|
|
699
718
|
})
|
|
700
719
|
);
|
|
701
720
|
});
|
|
702
|
-
var Icon = import_react5.default.forwardRef(
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
);
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
& > * {
|
|
733
|
-
display: inline-block;
|
|
734
|
-
}
|
|
721
|
+
var Icon = import_react5.default.forwardRef((_a, ref) => {
|
|
722
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
724
|
+
"span",
|
|
725
|
+
__spreadProps(__spreadValues({}, props), {
|
|
726
|
+
ref,
|
|
727
|
+
className: (0, import_css.cx)(
|
|
728
|
+
"material-icons",
|
|
729
|
+
className,
|
|
730
|
+
import_css.css`
|
|
731
|
+
font-size: 18px;
|
|
732
|
+
vertical-align: text-bottom;
|
|
733
|
+
`
|
|
734
|
+
)
|
|
735
|
+
})
|
|
736
|
+
);
|
|
737
|
+
});
|
|
738
|
+
var Menu = import_react5.default.forwardRef((_a, ref) => {
|
|
739
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
741
|
+
"div",
|
|
742
|
+
__spreadProps(__spreadValues({}, props), {
|
|
743
|
+
"data-testid": "menu",
|
|
744
|
+
ref,
|
|
745
|
+
className: (0, import_css.cx)(
|
|
746
|
+
className,
|
|
747
|
+
import_css.css`
|
|
748
|
+
& > * {
|
|
749
|
+
display: inline-block;
|
|
750
|
+
}
|
|
735
751
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
);
|
|
752
|
+
& > * + * {
|
|
753
|
+
margin-left: 15px;
|
|
754
|
+
}
|
|
755
|
+
`
|
|
756
|
+
)
|
|
757
|
+
})
|
|
758
|
+
);
|
|
759
|
+
});
|
|
745
760
|
var Portal = ({ children }) => {
|
|
746
761
|
return typeof document === "object" ? import_react_dom.default.createPortal(children, document.body) : null;
|
|
747
762
|
};
|
|
748
|
-
var Toolbar = import_react5.default.forwardRef(
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
className
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
}
|
|
768
|
-
);
|
|
763
|
+
var Toolbar = import_react5.default.forwardRef((_a, ref) => {
|
|
764
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
766
|
+
Menu,
|
|
767
|
+
__spreadProps(__spreadValues({}, props), {
|
|
768
|
+
ref,
|
|
769
|
+
className: (0, import_css.cx)(
|
|
770
|
+
className,
|
|
771
|
+
import_css.css`
|
|
772
|
+
position: relative;
|
|
773
|
+
padding: 1px 18px 17px;
|
|
774
|
+
margin: 0 -20px;
|
|
775
|
+
border-bottom: 2px solid #eee;
|
|
776
|
+
margin-bottom: 20px;
|
|
777
|
+
`
|
|
778
|
+
)
|
|
779
|
+
})
|
|
780
|
+
);
|
|
781
|
+
});
|
|
769
782
|
|
|
770
783
|
// src/hooks/misc/use-autosize-textarea.tsx
|
|
771
784
|
var import_react6 = require("react");
|
|
@@ -821,12 +834,21 @@ var CommandList = React3.forwardRef((_a, ref) => {
|
|
|
821
834
|
import_cmdk.Command.List,
|
|
822
835
|
__spreadValues({
|
|
823
836
|
ref,
|
|
824
|
-
className: cn(
|
|
837
|
+
className: cn(
|
|
838
|
+
"max-h-[300px] overflow-y-auto overflow-x-hidden pb-2",
|
|
839
|
+
className
|
|
840
|
+
)
|
|
825
841
|
}, props)
|
|
826
842
|
);
|
|
827
843
|
});
|
|
828
844
|
CommandList.displayName = import_cmdk.Command.List.displayName;
|
|
829
|
-
var CommandEmpty = React3.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
845
|
+
var CommandEmpty = React3.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
846
|
+
import_cmdk.Command.Empty,
|
|
847
|
+
__spreadValues({
|
|
848
|
+
ref,
|
|
849
|
+
className: "py-6 text-center text-sm"
|
|
850
|
+
}, props)
|
|
851
|
+
));
|
|
830
852
|
CommandEmpty.displayName = import_cmdk.Command.Empty.displayName;
|
|
831
853
|
var CommandGroup = React3.forwardRef((_a, ref) => {
|
|
832
854
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
@@ -868,11 +890,18 @@ var CommandItem = React3.forwardRef((_a, ref) => {
|
|
|
868
890
|
});
|
|
869
891
|
CommandItem.displayName = import_cmdk.Command.Item.displayName;
|
|
870
892
|
var CommandShortcut = (_a) => {
|
|
871
|
-
var _b = _a, {
|
|
893
|
+
var _b = _a, {
|
|
894
|
+
className
|
|
895
|
+
} = _b, props = __objRest(_b, [
|
|
896
|
+
"className"
|
|
897
|
+
]);
|
|
872
898
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
873
899
|
"span",
|
|
874
900
|
__spreadValues({
|
|
875
|
-
className: cn(
|
|
901
|
+
className: cn(
|
|
902
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
903
|
+
className
|
|
904
|
+
)
|
|
876
905
|
}, props)
|
|
877
906
|
);
|
|
878
907
|
};
|
|
@@ -942,7 +971,14 @@ function Logo({
|
|
|
942
971
|
width,
|
|
943
972
|
height
|
|
944
973
|
}) {
|
|
945
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
975
|
+
"div",
|
|
976
|
+
{
|
|
977
|
+
className: "flex items-center justify-center",
|
|
978
|
+
style: { width, height },
|
|
979
|
+
children
|
|
980
|
+
}
|
|
981
|
+
);
|
|
946
982
|
}
|
|
947
983
|
|
|
948
984
|
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
@@ -982,7 +1018,13 @@ var Button2 = React4.forwardRef(
|
|
|
982
1018
|
(_a, ref) => {
|
|
983
1019
|
var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest(_b, ["className", "variant", "size", "asChild"]);
|
|
984
1020
|
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
985
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1022
|
+
Comp,
|
|
1023
|
+
__spreadValues({
|
|
1024
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
1025
|
+
ref
|
|
1026
|
+
}, props)
|
|
1027
|
+
);
|
|
986
1028
|
}
|
|
987
1029
|
);
|
|
988
1030
|
Button2.displayName = "Button";
|
|
@@ -997,7 +1039,13 @@ var labelVariants = (0, import_class_variance_authority2.cva)(
|
|
|
997
1039
|
);
|
|
998
1040
|
var Label = React5.forwardRef((_a, ref) => {
|
|
999
1041
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1000
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1043
|
+
LabelPrimitive.Root,
|
|
1044
|
+
__spreadValues({
|
|
1045
|
+
ref,
|
|
1046
|
+
className: cn(labelVariants(), className)
|
|
1047
|
+
}, props)
|
|
1048
|
+
);
|
|
1001
1049
|
});
|
|
1002
1050
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
1003
1051
|
|
|
@@ -1044,7 +1092,9 @@ var IncludedFilesPreview = ({
|
|
|
1044
1092
|
{
|
|
1045
1093
|
filePointer,
|
|
1046
1094
|
onDelete: () => {
|
|
1047
|
-
setIncludedFiles(
|
|
1095
|
+
setIncludedFiles(
|
|
1096
|
+
(prev) => prev.filter((fp) => fp !== filePointer)
|
|
1097
|
+
);
|
|
1048
1098
|
}
|
|
1049
1099
|
},
|
|
1050
1100
|
`file-${filePointer.sourceApplication}.${filePointer.name}`
|
|
@@ -1052,7 +1102,10 @@ var IncludedFilesPreview = ({
|
|
|
1052
1102
|
}) })
|
|
1053
1103
|
] });
|
|
1054
1104
|
};
|
|
1055
|
-
var FileChipPreview = ({
|
|
1105
|
+
var FileChipPreview = ({
|
|
1106
|
+
filePointer,
|
|
1107
|
+
onDelete
|
|
1108
|
+
}) => {
|
|
1056
1109
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1057
1110
|
import_Chip.default,
|
|
1058
1111
|
{
|
|
@@ -1082,9 +1135,7 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1082
1135
|
const [editSuggestion, setEditSuggestion] = (0, import_react8.useState)("");
|
|
1083
1136
|
const [suggestionIsLoading, setSuggestionIsLoading] = (0, import_react8.useState)(false);
|
|
1084
1137
|
const [adjustmentPrompt, setAdjustmentPrompt] = (0, import_react8.useState)("");
|
|
1085
|
-
const [generatingSuggestion, setGeneratingSuggestion] = (0, import_react8.useState)(
|
|
1086
|
-
null
|
|
1087
|
-
);
|
|
1138
|
+
const [generatingSuggestion, setGeneratingSuggestion] = (0, import_react8.useState)(null);
|
|
1088
1139
|
const adjustmentTextAreaRef = (0, import_react8.useRef)(null);
|
|
1089
1140
|
const suggestionTextAreaRef = (0, import_react8.useRef)(null);
|
|
1090
1141
|
const [filePointers, setFilePointers] = (0, import_react8.useState)([]);
|
|
@@ -1246,7 +1297,13 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1246
1297
|
const sourceSearchWord = (sourceSearchCandidate == null ? void 0 : sourceSearchCandidate.startsWith("@")) ? sourceSearchCandidate.slice(1) : void 0;
|
|
1247
1298
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "w-full flex flex-col items-start relative gap-2", children: [
|
|
1248
1299
|
AdjustmentPromptComponent,
|
|
1249
|
-
filePointers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1300
|
+
filePointers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1301
|
+
IncludedFilesPreview,
|
|
1302
|
+
{
|
|
1303
|
+
includedFiles: filePointers,
|
|
1304
|
+
setIncludedFiles: setFilePointers
|
|
1305
|
+
}
|
|
1306
|
+
),
|
|
1250
1307
|
sourceSearchWord !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1251
1308
|
SourceSearchBox,
|
|
1252
1309
|
{
|
|
@@ -1254,7 +1311,9 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1254
1311
|
suggestedFiles,
|
|
1255
1312
|
onSelectedFile: (filePointer) => {
|
|
1256
1313
|
var _a;
|
|
1257
|
-
setAdjustmentPrompt(
|
|
1314
|
+
setAdjustmentPrompt(
|
|
1315
|
+
adjustmentPrompt.replace(new RegExp(`@${sourceSearchWord}$`), "")
|
|
1316
|
+
);
|
|
1258
1317
|
setFilePointers((prev) => [...prev, filePointer]);
|
|
1259
1318
|
(_a = adjustmentTextAreaRef.current) == null ? void 0 : _a.focus();
|
|
1260
1319
|
}
|
|
@@ -1596,7 +1655,10 @@ var BaseCopilotTextareaWithHoveringContext = import_react12.default.forwardRef(
|
|
|
1596
1655
|
];
|
|
1597
1656
|
}, [valueOnInitialRender]);
|
|
1598
1657
|
const editor = useCopilotTextareaEditor();
|
|
1599
|
-
const {
|
|
1658
|
+
const {
|
|
1659
|
+
isDisplayed: hoveringEditorIsDisplayed,
|
|
1660
|
+
setIsDisplayed: setHoveringEditorIsDisplayed
|
|
1661
|
+
} = useHoveringEditorContext();
|
|
1600
1662
|
const insertText = (0, import_react12.useCallback)(
|
|
1601
1663
|
(autosuggestion) => {
|
|
1602
1664
|
import_slate10.Editor.insertText(editor, autosuggestion.text, {
|
|
@@ -1629,7 +1691,10 @@ var BaseCopilotTextareaWithHoveringContext = import_react12.default.forwardRef(
|
|
|
1629
1691
|
const onKeyDownHandlerForHoveringEditor = (0, import_react12.useCallback)(
|
|
1630
1692
|
(event) => {
|
|
1631
1693
|
var _a2;
|
|
1632
|
-
if (autosuggestionsConfig.shouldToggleHoveringEditorOnKeyPress(
|
|
1694
|
+
if (autosuggestionsConfig.shouldToggleHoveringEditorOnKeyPress(
|
|
1695
|
+
event,
|
|
1696
|
+
(_a2 = props.shortcut) != null ? _a2 : "k"
|
|
1697
|
+
)) {
|
|
1633
1698
|
event.preventDefault();
|
|
1634
1699
|
setHoveringEditorIsDisplayed(!hoveringEditorIsDisplayed);
|
|
1635
1700
|
}
|
|
@@ -1701,7 +1766,10 @@ var BaseCopilotTextareaWithHoveringContext = import_react12.default.forwardRef(
|
|
|
1701
1766
|
const baseClassName = "copilot-textarea";
|
|
1702
1767
|
const brandingClass = disableBranding ? "no-branding" : "with-branding";
|
|
1703
1768
|
const defaultTailwindClassName = "bg-white overflow-y-auto resize-y";
|
|
1704
|
-
const mergedClassName = (0, import_tailwind_merge2.twMerge)(
|
|
1769
|
+
const mergedClassName = (0, import_tailwind_merge2.twMerge)(
|
|
1770
|
+
defaultTailwindClassName,
|
|
1771
|
+
className != null ? className : ""
|
|
1772
|
+
);
|
|
1705
1773
|
return `${baseClassName} ${brandingClass} ${mergedClassName}`;
|
|
1706
1774
|
})();
|
|
1707
1775
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
@@ -1810,7 +1878,12 @@ function useMakeStandardAutosuggestionFunction(textareaPurpose, contextCategorie
|
|
|
1810
1878
|
const runtimeClient = { generateCopilotResponse: (...args) => {
|
|
1811
1879
|
} };
|
|
1812
1880
|
const { getContextString, copilotApiConfig } = (0, import_react_core3.useCopilotContext)();
|
|
1813
|
-
const {
|
|
1881
|
+
const {
|
|
1882
|
+
chatApiEndpoint: url,
|
|
1883
|
+
publicApiKey,
|
|
1884
|
+
credentials,
|
|
1885
|
+
properties
|
|
1886
|
+
} = copilotApiConfig;
|
|
1814
1887
|
const headers = __spreadValues(__spreadValues({}, copilotApiConfig.headers), publicApiKey ? { [import_shared2.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: publicApiKey } : {});
|
|
1815
1888
|
const { maxTokens, stop, temperature = 0 } = apiConfig;
|
|
1816
1889
|
return (0, import_react13.useCallback)(
|
|
@@ -2079,8 +2152,10 @@ var import_react_core5 = require("@copilotkit/react-core");
|
|
|
2079
2152
|
var import_react14 = require("react");
|
|
2080
2153
|
var import_runtime_client_gql5 = require("@copilotkit/runtime-client-gql");
|
|
2081
2154
|
function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCategories, insertionApiConfig, editingApiConfig) {
|
|
2082
|
-
const runtimeClient = {
|
|
2083
|
-
|
|
2155
|
+
const runtimeClient = {
|
|
2156
|
+
generateCopilotResponse: (...args) => {
|
|
2157
|
+
}
|
|
2158
|
+
};
|
|
2084
2159
|
const { getContextString, copilotApiConfig } = (0, import_react_core5.useCopilotContext)();
|
|
2085
2160
|
const headers = __spreadValues({}, copilotApiConfig.publicApiKey ? { [import_shared3.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: copilotApiConfig.publicApiKey } : {});
|
|
2086
2161
|
function runtimeClientResponseToStringStream(responsePromise) {
|
|
@@ -2096,7 +2171,9 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
2096
2171
|
if (done) {
|
|
2097
2172
|
break;
|
|
2098
2173
|
}
|
|
2099
|
-
const messages = (0, import_runtime_client_gql5.convertGqlOutputToMessages)(
|
|
2174
|
+
const messages = (0, import_runtime_client_gql5.convertGqlOutputToMessages)(
|
|
2175
|
+
value.generateCopilotResponse.messages
|
|
2176
|
+
);
|
|
2100
2177
|
let newContent = "";
|
|
2101
2178
|
for (const message of messages) {
|
|
2102
2179
|
if (message.isTextMessage()) {
|
|
@@ -2147,7 +2224,9 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
2147
2224
|
actions: [],
|
|
2148
2225
|
url: window.location.href
|
|
2149
2226
|
},
|
|
2150
|
-
messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)(
|
|
2227
|
+
messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)(
|
|
2228
|
+
(0, import_runtime_client_gql5.filterAgentStateMessages)(messages)
|
|
2229
|
+
),
|
|
2151
2230
|
metadata: {
|
|
2152
2231
|
requestType: import_runtime_client_gql5.CopilotRequestType.TextareaCompletion
|
|
2153
2232
|
}
|
|
@@ -2197,7 +2276,9 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
2197
2276
|
actions: [],
|
|
2198
2277
|
url: window.location.href
|
|
2199
2278
|
},
|
|
2200
|
-
messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)(
|
|
2279
|
+
messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)(
|
|
2280
|
+
(0, import_runtime_client_gql5.filterAgentStateMessages)(messages)
|
|
2281
|
+
),
|
|
2201
2282
|
metadata: {
|
|
2202
2283
|
requestType: import_runtime_client_gql5.CopilotRequestType.TextareaCompletion
|
|
2203
2284
|
}
|
|
@@ -2214,9 +2295,19 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
2214
2295
|
const insertionOrEditingFunction = (0, import_react14.useCallback)(
|
|
2215
2296
|
(editorState2, insertionPrompt, documents, abortSignal) => __async(this, null, function* () {
|
|
2216
2297
|
if (editorState2.selectedText === "") {
|
|
2217
|
-
return yield insertionFunction(
|
|
2298
|
+
return yield insertionFunction(
|
|
2299
|
+
editorState2,
|
|
2300
|
+
insertionPrompt,
|
|
2301
|
+
documents,
|
|
2302
|
+
abortSignal
|
|
2303
|
+
);
|
|
2218
2304
|
} else {
|
|
2219
|
-
return yield editingFunction(
|
|
2305
|
+
return yield editingFunction(
|
|
2306
|
+
editorState2,
|
|
2307
|
+
insertionPrompt,
|
|
2308
|
+
documents,
|
|
2309
|
+
abortSignal
|
|
2310
|
+
);
|
|
2220
2311
|
}
|
|
2221
2312
|
}),
|
|
2222
2313
|
[insertionFunction, editingFunction]
|
|
@@ -2229,7 +2320,11 @@ var import_lodash = __toESM(require("lodash.merge"));
|
|
|
2229
2320
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2230
2321
|
var CopilotTextarea = import_react15.default.forwardRef(
|
|
2231
2322
|
(props, ref) => {
|
|
2232
|
-
const _a = props, {
|
|
2323
|
+
const _a = props, {
|
|
2324
|
+
autosuggestionsConfig: autosuggestionsConfigUserSpecified
|
|
2325
|
+
} = _a, forwardedProps = __objRest(_a, [
|
|
2326
|
+
"autosuggestionsConfig"
|
|
2327
|
+
]);
|
|
2233
2328
|
const autosuggestionsConfig = (0, import_lodash.default)(
|
|
2234
2329
|
defaultAutosuggestionsConfig,
|
|
2235
2330
|
autosuggestionsConfigUserSpecified
|