@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/components/index.js
CHANGED
|
@@ -152,7 +152,10 @@ function useAutosuggestions(debounceTime, shouldAcceptAutosuggestionOnKeyPress,
|
|
|
152
152
|
if (disableWhenEmpty && editorAutocompleteState.textBeforeCursor === "" && editorAutocompleteState.textAfterCursor === "") {
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
|
-
const suggestion = yield autosuggestionFunction(
|
|
155
|
+
const suggestion = yield autosuggestionFunction(
|
|
156
|
+
editorAutocompleteState,
|
|
157
|
+
abortSignal
|
|
158
|
+
);
|
|
156
159
|
if (!suggestion || abortSignal.aborted) {
|
|
157
160
|
throw new DOMException("Aborted", "AbortError");
|
|
158
161
|
}
|
|
@@ -161,10 +164,17 @@ function useAutosuggestions(debounceTime, shouldAcceptAutosuggestionOnKeyPress,
|
|
|
161
164
|
point: editorAutocompleteState.cursorPoint
|
|
162
165
|
});
|
|
163
166
|
}),
|
|
164
|
-
[
|
|
167
|
+
[
|
|
168
|
+
autosuggestionFunction,
|
|
169
|
+
setCurrentAutocompleteSuggestion,
|
|
170
|
+
disableWhenEmpty,
|
|
171
|
+
disabled
|
|
172
|
+
]
|
|
165
173
|
);
|
|
166
174
|
const debouncedFunction = (0, import_react.useMemo)(
|
|
167
|
-
() => new Debouncer(
|
|
175
|
+
() => new Debouncer(
|
|
176
|
+
debounceTime
|
|
177
|
+
),
|
|
168
178
|
[debounceTime]
|
|
169
179
|
);
|
|
170
180
|
(0, import_react.useEffect)(() => {
|
|
@@ -202,7 +212,11 @@ function useAutosuggestions(debounceTime, shouldAcceptAutosuggestionOnKeyPress,
|
|
|
202
212
|
const keyDownOrTouchHandler = (0, import_react.useCallback)(
|
|
203
213
|
(event) => {
|
|
204
214
|
if (currentAutocompleteSuggestion) {
|
|
205
|
-
const shouldAcceptSuggestion = event.type === "touchstart" ? shouldAcceptAutosuggestionOnTouch(
|
|
215
|
+
const shouldAcceptSuggestion = event.type === "touchstart" ? shouldAcceptAutosuggestionOnTouch(
|
|
216
|
+
event
|
|
217
|
+
) : shouldAcceptAutosuggestionOnKeyPress(
|
|
218
|
+
event
|
|
219
|
+
);
|
|
206
220
|
if (shouldAcceptSuggestion) {
|
|
207
221
|
event.preventDefault();
|
|
208
222
|
insertAutocompleteSuggestion(currentAutocompleteSuggestion);
|
|
@@ -625,7 +639,10 @@ function clearAutocompletionsFromEditor(editor) {
|
|
|
625
639
|
try {
|
|
626
640
|
import_slate6.Transforms.removeNodes(editor, { at: path });
|
|
627
641
|
} catch (e) {
|
|
628
|
-
console.log(
|
|
642
|
+
console.log(
|
|
643
|
+
"CopilotTextarea.clearAutocompletionsFromEditor: error removing node",
|
|
644
|
+
e
|
|
645
|
+
);
|
|
629
646
|
}
|
|
630
647
|
}
|
|
631
648
|
}
|
|
@@ -669,7 +686,9 @@ var HoveringEditorContext = (0, import_react4.createContext)({
|
|
|
669
686
|
setIsDisplayed: () => {
|
|
670
687
|
}
|
|
671
688
|
});
|
|
672
|
-
var HoveringEditorProvider = ({
|
|
689
|
+
var HoveringEditorProvider = ({
|
|
690
|
+
children
|
|
691
|
+
}) => {
|
|
673
692
|
const [isDisplayed, setIsDisplayed] = (0, import_react4.useState)(false);
|
|
674
693
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HoveringEditorContext.Provider, { value: { isDisplayed, setIsDisplayed }, children });
|
|
675
694
|
};
|
|
@@ -696,73 +715,67 @@ var Button = import_react5.default.forwardRef((_a, ref) => {
|
|
|
696
715
|
})
|
|
697
716
|
);
|
|
698
717
|
});
|
|
699
|
-
var Icon = import_react5.default.forwardRef(
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
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
|
-
display: inline-block;
|
|
731
|
-
}
|
|
718
|
+
var Icon = import_react5.default.forwardRef((_a, ref) => {
|
|
719
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
721
|
+
"span",
|
|
722
|
+
__spreadProps(__spreadValues({}, props), {
|
|
723
|
+
ref,
|
|
724
|
+
className: (0, import_css.cx)(
|
|
725
|
+
"material-icons",
|
|
726
|
+
className,
|
|
727
|
+
import_css.css`
|
|
728
|
+
font-size: 18px;
|
|
729
|
+
vertical-align: text-bottom;
|
|
730
|
+
`
|
|
731
|
+
)
|
|
732
|
+
})
|
|
733
|
+
);
|
|
734
|
+
});
|
|
735
|
+
var Menu = import_react5.default.forwardRef((_a, ref) => {
|
|
736
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
738
|
+
"div",
|
|
739
|
+
__spreadProps(__spreadValues({}, props), {
|
|
740
|
+
"data-testid": "menu",
|
|
741
|
+
ref,
|
|
742
|
+
className: (0, import_css.cx)(
|
|
743
|
+
className,
|
|
744
|
+
import_css.css`
|
|
745
|
+
& > * {
|
|
746
|
+
display: inline-block;
|
|
747
|
+
}
|
|
732
748
|
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
);
|
|
749
|
+
& > * + * {
|
|
750
|
+
margin-left: 15px;
|
|
751
|
+
}
|
|
752
|
+
`
|
|
753
|
+
)
|
|
754
|
+
})
|
|
755
|
+
);
|
|
756
|
+
});
|
|
742
757
|
var Portal = ({ children }) => {
|
|
743
758
|
return typeof document === "object" ? import_react_dom.default.createPortal(children, document.body) : null;
|
|
744
759
|
};
|
|
745
|
-
var Toolbar = import_react5.default.forwardRef(
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
className
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
}
|
|
765
|
-
);
|
|
760
|
+
var Toolbar = import_react5.default.forwardRef((_a, ref) => {
|
|
761
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
763
|
+
Menu,
|
|
764
|
+
__spreadProps(__spreadValues({}, props), {
|
|
765
|
+
ref,
|
|
766
|
+
className: (0, import_css.cx)(
|
|
767
|
+
className,
|
|
768
|
+
import_css.css`
|
|
769
|
+
position: relative;
|
|
770
|
+
padding: 1px 18px 17px;
|
|
771
|
+
margin: 0 -20px;
|
|
772
|
+
border-bottom: 2px solid #eee;
|
|
773
|
+
margin-bottom: 20px;
|
|
774
|
+
`
|
|
775
|
+
)
|
|
776
|
+
})
|
|
777
|
+
);
|
|
778
|
+
});
|
|
766
779
|
|
|
767
780
|
// src/hooks/misc/use-autosize-textarea.tsx
|
|
768
781
|
var import_react6 = require("react");
|
|
@@ -818,12 +831,21 @@ var CommandList = React3.forwardRef((_a, ref) => {
|
|
|
818
831
|
import_cmdk.Command.List,
|
|
819
832
|
__spreadValues({
|
|
820
833
|
ref,
|
|
821
|
-
className: cn(
|
|
834
|
+
className: cn(
|
|
835
|
+
"max-h-[300px] overflow-y-auto overflow-x-hidden pb-2",
|
|
836
|
+
className
|
|
837
|
+
)
|
|
822
838
|
}, props)
|
|
823
839
|
);
|
|
824
840
|
});
|
|
825
841
|
CommandList.displayName = import_cmdk.Command.List.displayName;
|
|
826
|
-
var CommandEmpty = React3.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
842
|
+
var CommandEmpty = React3.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
843
|
+
import_cmdk.Command.Empty,
|
|
844
|
+
__spreadValues({
|
|
845
|
+
ref,
|
|
846
|
+
className: "py-6 text-center text-sm"
|
|
847
|
+
}, props)
|
|
848
|
+
));
|
|
827
849
|
CommandEmpty.displayName = import_cmdk.Command.Empty.displayName;
|
|
828
850
|
var CommandGroup = React3.forwardRef((_a, ref) => {
|
|
829
851
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
@@ -865,11 +887,18 @@ var CommandItem = React3.forwardRef((_a, ref) => {
|
|
|
865
887
|
});
|
|
866
888
|
CommandItem.displayName = import_cmdk.Command.Item.displayName;
|
|
867
889
|
var CommandShortcut = (_a) => {
|
|
868
|
-
var _b = _a, {
|
|
890
|
+
var _b = _a, {
|
|
891
|
+
className
|
|
892
|
+
} = _b, props = __objRest(_b, [
|
|
893
|
+
"className"
|
|
894
|
+
]);
|
|
869
895
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
870
896
|
"span",
|
|
871
897
|
__spreadValues({
|
|
872
|
-
className: cn(
|
|
898
|
+
className: cn(
|
|
899
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
900
|
+
className
|
|
901
|
+
)
|
|
873
902
|
}, props)
|
|
874
903
|
);
|
|
875
904
|
};
|
|
@@ -939,7 +968,14 @@ function Logo({
|
|
|
939
968
|
width,
|
|
940
969
|
height
|
|
941
970
|
}) {
|
|
942
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
971
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
972
|
+
"div",
|
|
973
|
+
{
|
|
974
|
+
className: "flex items-center justify-center",
|
|
975
|
+
style: { width, height },
|
|
976
|
+
children
|
|
977
|
+
}
|
|
978
|
+
);
|
|
943
979
|
}
|
|
944
980
|
|
|
945
981
|
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
@@ -979,7 +1015,13 @@ var Button2 = React4.forwardRef(
|
|
|
979
1015
|
(_a, ref) => {
|
|
980
1016
|
var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest(_b, ["className", "variant", "size", "asChild"]);
|
|
981
1017
|
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
982
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1019
|
+
Comp,
|
|
1020
|
+
__spreadValues({
|
|
1021
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
1022
|
+
ref
|
|
1023
|
+
}, props)
|
|
1024
|
+
);
|
|
983
1025
|
}
|
|
984
1026
|
);
|
|
985
1027
|
Button2.displayName = "Button";
|
|
@@ -994,7 +1036,13 @@ var labelVariants = (0, import_class_variance_authority2.cva)(
|
|
|
994
1036
|
);
|
|
995
1037
|
var Label = React5.forwardRef((_a, ref) => {
|
|
996
1038
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
997
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1040
|
+
LabelPrimitive.Root,
|
|
1041
|
+
__spreadValues({
|
|
1042
|
+
ref,
|
|
1043
|
+
className: cn(labelVariants(), className)
|
|
1044
|
+
}, props)
|
|
1045
|
+
);
|
|
998
1046
|
});
|
|
999
1047
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
1000
1048
|
|
|
@@ -1041,7 +1089,9 @@ var IncludedFilesPreview = ({
|
|
|
1041
1089
|
{
|
|
1042
1090
|
filePointer,
|
|
1043
1091
|
onDelete: () => {
|
|
1044
|
-
setIncludedFiles(
|
|
1092
|
+
setIncludedFiles(
|
|
1093
|
+
(prev) => prev.filter((fp) => fp !== filePointer)
|
|
1094
|
+
);
|
|
1045
1095
|
}
|
|
1046
1096
|
},
|
|
1047
1097
|
`file-${filePointer.sourceApplication}.${filePointer.name}`
|
|
@@ -1049,7 +1099,10 @@ var IncludedFilesPreview = ({
|
|
|
1049
1099
|
}) })
|
|
1050
1100
|
] });
|
|
1051
1101
|
};
|
|
1052
|
-
var FileChipPreview = ({
|
|
1102
|
+
var FileChipPreview = ({
|
|
1103
|
+
filePointer,
|
|
1104
|
+
onDelete
|
|
1105
|
+
}) => {
|
|
1053
1106
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1054
1107
|
import_Chip.default,
|
|
1055
1108
|
{
|
|
@@ -1079,9 +1132,7 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1079
1132
|
const [editSuggestion, setEditSuggestion] = (0, import_react8.useState)("");
|
|
1080
1133
|
const [suggestionIsLoading, setSuggestionIsLoading] = (0, import_react8.useState)(false);
|
|
1081
1134
|
const [adjustmentPrompt, setAdjustmentPrompt] = (0, import_react8.useState)("");
|
|
1082
|
-
const [generatingSuggestion, setGeneratingSuggestion] = (0, import_react8.useState)(
|
|
1083
|
-
null
|
|
1084
|
-
);
|
|
1135
|
+
const [generatingSuggestion, setGeneratingSuggestion] = (0, import_react8.useState)(null);
|
|
1085
1136
|
const adjustmentTextAreaRef = (0, import_react8.useRef)(null);
|
|
1086
1137
|
const suggestionTextAreaRef = (0, import_react8.useRef)(null);
|
|
1087
1138
|
const [filePointers, setFilePointers] = (0, import_react8.useState)([]);
|
|
@@ -1243,7 +1294,13 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1243
1294
|
const sourceSearchWord = (sourceSearchCandidate == null ? void 0 : sourceSearchCandidate.startsWith("@")) ? sourceSearchCandidate.slice(1) : void 0;
|
|
1244
1295
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "w-full flex flex-col items-start relative gap-2", children: [
|
|
1245
1296
|
AdjustmentPromptComponent,
|
|
1246
|
-
filePointers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1297
|
+
filePointers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1298
|
+
IncludedFilesPreview,
|
|
1299
|
+
{
|
|
1300
|
+
includedFiles: filePointers,
|
|
1301
|
+
setIncludedFiles: setFilePointers
|
|
1302
|
+
}
|
|
1303
|
+
),
|
|
1247
1304
|
sourceSearchWord !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1248
1305
|
SourceSearchBox,
|
|
1249
1306
|
{
|
|
@@ -1251,7 +1308,9 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1251
1308
|
suggestedFiles,
|
|
1252
1309
|
onSelectedFile: (filePointer) => {
|
|
1253
1310
|
var _a;
|
|
1254
|
-
setAdjustmentPrompt(
|
|
1311
|
+
setAdjustmentPrompt(
|
|
1312
|
+
adjustmentPrompt.replace(new RegExp(`@${sourceSearchWord}$`), "")
|
|
1313
|
+
);
|
|
1255
1314
|
setFilePointers((prev) => [...prev, filePointer]);
|
|
1256
1315
|
(_a = adjustmentTextAreaRef.current) == null ? void 0 : _a.focus();
|
|
1257
1316
|
}
|
|
@@ -1593,7 +1652,10 @@ var BaseCopilotTextareaWithHoveringContext = import_react12.default.forwardRef(
|
|
|
1593
1652
|
];
|
|
1594
1653
|
}, [valueOnInitialRender]);
|
|
1595
1654
|
const editor = useCopilotTextareaEditor();
|
|
1596
|
-
const {
|
|
1655
|
+
const {
|
|
1656
|
+
isDisplayed: hoveringEditorIsDisplayed,
|
|
1657
|
+
setIsDisplayed: setHoveringEditorIsDisplayed
|
|
1658
|
+
} = useHoveringEditorContext();
|
|
1597
1659
|
const insertText = (0, import_react12.useCallback)(
|
|
1598
1660
|
(autosuggestion) => {
|
|
1599
1661
|
import_slate10.Editor.insertText(editor, autosuggestion.text, {
|
|
@@ -1626,7 +1688,10 @@ var BaseCopilotTextareaWithHoveringContext = import_react12.default.forwardRef(
|
|
|
1626
1688
|
const onKeyDownHandlerForHoveringEditor = (0, import_react12.useCallback)(
|
|
1627
1689
|
(event) => {
|
|
1628
1690
|
var _a2;
|
|
1629
|
-
if (autosuggestionsConfig.shouldToggleHoveringEditorOnKeyPress(
|
|
1691
|
+
if (autosuggestionsConfig.shouldToggleHoveringEditorOnKeyPress(
|
|
1692
|
+
event,
|
|
1693
|
+
(_a2 = props.shortcut) != null ? _a2 : "k"
|
|
1694
|
+
)) {
|
|
1630
1695
|
event.preventDefault();
|
|
1631
1696
|
setHoveringEditorIsDisplayed(!hoveringEditorIsDisplayed);
|
|
1632
1697
|
}
|
|
@@ -1698,7 +1763,10 @@ var BaseCopilotTextareaWithHoveringContext = import_react12.default.forwardRef(
|
|
|
1698
1763
|
const baseClassName = "copilot-textarea";
|
|
1699
1764
|
const brandingClass = disableBranding ? "no-branding" : "with-branding";
|
|
1700
1765
|
const defaultTailwindClassName = "bg-white overflow-y-auto resize-y";
|
|
1701
|
-
const mergedClassName = (0, import_tailwind_merge2.twMerge)(
|
|
1766
|
+
const mergedClassName = (0, import_tailwind_merge2.twMerge)(
|
|
1767
|
+
defaultTailwindClassName,
|
|
1768
|
+
className != null ? className : ""
|
|
1769
|
+
);
|
|
1702
1770
|
return `${baseClassName} ${brandingClass} ${mergedClassName}`;
|
|
1703
1771
|
})();
|
|
1704
1772
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
@@ -1807,7 +1875,12 @@ function useMakeStandardAutosuggestionFunction(textareaPurpose, contextCategorie
|
|
|
1807
1875
|
const runtimeClient = { generateCopilotResponse: (...args) => {
|
|
1808
1876
|
} };
|
|
1809
1877
|
const { getContextString, copilotApiConfig } = (0, import_react_core3.useCopilotContext)();
|
|
1810
|
-
const {
|
|
1878
|
+
const {
|
|
1879
|
+
chatApiEndpoint: url,
|
|
1880
|
+
publicApiKey,
|
|
1881
|
+
credentials,
|
|
1882
|
+
properties
|
|
1883
|
+
} = copilotApiConfig;
|
|
1811
1884
|
const headers = __spreadValues(__spreadValues({}, copilotApiConfig.headers), publicApiKey ? { [import_shared2.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: publicApiKey } : {});
|
|
1812
1885
|
const { maxTokens, stop, temperature = 0 } = apiConfig;
|
|
1813
1886
|
return (0, import_react13.useCallback)(
|
|
@@ -2076,8 +2149,10 @@ var import_react_core5 = require("@copilotkit/react-core");
|
|
|
2076
2149
|
var import_react14 = require("react");
|
|
2077
2150
|
var import_runtime_client_gql5 = require("@copilotkit/runtime-client-gql");
|
|
2078
2151
|
function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCategories, insertionApiConfig, editingApiConfig) {
|
|
2079
|
-
const runtimeClient = {
|
|
2080
|
-
|
|
2152
|
+
const runtimeClient = {
|
|
2153
|
+
generateCopilotResponse: (...args) => {
|
|
2154
|
+
}
|
|
2155
|
+
};
|
|
2081
2156
|
const { getContextString, copilotApiConfig } = (0, import_react_core5.useCopilotContext)();
|
|
2082
2157
|
const headers = __spreadValues({}, copilotApiConfig.publicApiKey ? { [import_shared3.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: copilotApiConfig.publicApiKey } : {});
|
|
2083
2158
|
function runtimeClientResponseToStringStream(responsePromise) {
|
|
@@ -2093,7 +2168,9 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
2093
2168
|
if (done) {
|
|
2094
2169
|
break;
|
|
2095
2170
|
}
|
|
2096
|
-
const messages = (0, import_runtime_client_gql5.convertGqlOutputToMessages)(
|
|
2171
|
+
const messages = (0, import_runtime_client_gql5.convertGqlOutputToMessages)(
|
|
2172
|
+
value.generateCopilotResponse.messages
|
|
2173
|
+
);
|
|
2097
2174
|
let newContent = "";
|
|
2098
2175
|
for (const message of messages) {
|
|
2099
2176
|
if (message.isTextMessage()) {
|
|
@@ -2144,7 +2221,9 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
2144
2221
|
actions: [],
|
|
2145
2222
|
url: window.location.href
|
|
2146
2223
|
},
|
|
2147
|
-
messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)(
|
|
2224
|
+
messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)(
|
|
2225
|
+
(0, import_runtime_client_gql5.filterAgentStateMessages)(messages)
|
|
2226
|
+
),
|
|
2148
2227
|
metadata: {
|
|
2149
2228
|
requestType: import_runtime_client_gql5.CopilotRequestType.TextareaCompletion
|
|
2150
2229
|
}
|
|
@@ -2194,7 +2273,9 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
2194
2273
|
actions: [],
|
|
2195
2274
|
url: window.location.href
|
|
2196
2275
|
},
|
|
2197
|
-
messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)(
|
|
2276
|
+
messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)(
|
|
2277
|
+
(0, import_runtime_client_gql5.filterAgentStateMessages)(messages)
|
|
2278
|
+
),
|
|
2198
2279
|
metadata: {
|
|
2199
2280
|
requestType: import_runtime_client_gql5.CopilotRequestType.TextareaCompletion
|
|
2200
2281
|
}
|
|
@@ -2211,9 +2292,19 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
2211
2292
|
const insertionOrEditingFunction = (0, import_react14.useCallback)(
|
|
2212
2293
|
(editorState2, insertionPrompt, documents, abortSignal) => __async(this, null, function* () {
|
|
2213
2294
|
if (editorState2.selectedText === "") {
|
|
2214
|
-
return yield insertionFunction(
|
|
2295
|
+
return yield insertionFunction(
|
|
2296
|
+
editorState2,
|
|
2297
|
+
insertionPrompt,
|
|
2298
|
+
documents,
|
|
2299
|
+
abortSignal
|
|
2300
|
+
);
|
|
2215
2301
|
} else {
|
|
2216
|
-
return yield editingFunction(
|
|
2302
|
+
return yield editingFunction(
|
|
2303
|
+
editorState2,
|
|
2304
|
+
insertionPrompt,
|
|
2305
|
+
documents,
|
|
2306
|
+
abortSignal
|
|
2307
|
+
);
|
|
2217
2308
|
}
|
|
2218
2309
|
}),
|
|
2219
2310
|
[insertionFunction, editingFunction]
|
|
@@ -2226,7 +2317,11 @@ var import_lodash = __toESM(require("lodash.merge"));
|
|
|
2226
2317
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2227
2318
|
var CopilotTextarea = import_react15.default.forwardRef(
|
|
2228
2319
|
(props, ref) => {
|
|
2229
|
-
const _a = props, {
|
|
2320
|
+
const _a = props, {
|
|
2321
|
+
autosuggestionsConfig: autosuggestionsConfigUserSpecified
|
|
2322
|
+
} = _a, forwardedProps = __objRest(_a, [
|
|
2323
|
+
"autosuggestionsConfig"
|
|
2324
|
+
]);
|
|
2230
2325
|
const autosuggestionsConfig = (0, import_lodash.default)(
|
|
2231
2326
|
defaultAutosuggestionsConfig,
|
|
2232
2327
|
autosuggestionsConfigUserSpecified
|