@copilotkit/react-textarea 0.19.0-alpha.3 → 0.19.0-alpha.5

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.
Files changed (91) hide show
  1. package/.turbo/turbo-build.log +152 -209
  2. package/CHANGELOG.md +16 -0
  3. package/dist/{chunk-4MDDCR32.mjs → chunk-4HSJ5XUO.mjs} +2 -2
  4. package/dist/{chunk-CZMPLTHF.mjs → chunk-6Z6Z2K7O.mjs} +2 -2
  5. package/dist/{chunk-OS2YW2UX.mjs → chunk-7PSM4AUU.mjs} +4 -4
  6. package/dist/{chunk-23UHDUUY.mjs → chunk-GQJYEVBT.mjs} +28 -28
  7. package/dist/chunk-GQJYEVBT.mjs.map +1 -0
  8. package/dist/{chunk-U5GM2PRT.mjs → chunk-PHFEZQTN.mjs} +3 -3
  9. package/dist/{chunk-3YJ63D5D.mjs → chunk-XA7M72ZO.mjs} +2 -2
  10. package/dist/{chunk-3YJ63D5D.mjs.map → chunk-XA7M72ZO.mjs.map} +1 -1
  11. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +8 -8
  12. package/dist/components/copilot-textarea/copilot-textarea.mjs +10 -10
  13. package/dist/components/hovering-toolbar/hovering-toolbar.mjs +4 -4
  14. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +2 -2
  15. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +3 -3
  16. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +3 -3
  17. package/dist/components/index.mjs +10 -10
  18. package/dist/components/source-search-box/source-search-box.mjs +2 -2
  19. package/dist/components/ui/command.mjs +1 -1
  20. package/dist/index.css +3 -12
  21. package/dist/index.css.map +1 -1
  22. package/dist/index.mjs +10 -10
  23. package/package.json +4 -4
  24. package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +2 -1
  25. package/src/components/source-search-box/source-search-box.tsx +6 -9
  26. package/src/components/ui/command.tsx +1 -1
  27. package/dist/chunk-23UHDUUY.mjs.map +0 -1
  28. package/dist/components/base-copilot-textarea/base-copilot-textarea.d.ts +0 -13
  29. package/dist/components/base-copilot-textarea/render-element.d.ts +0 -6
  30. package/dist/components/base-copilot-textarea/render-placeholder.d.ts +0 -6
  31. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.d.ts +0 -6
  32. package/dist/components/base-copilot-textarea/use-add-branding-css.d.ts +0 -3
  33. package/dist/components/copilot-textarea/copilot-textarea.d.ts +0 -20
  34. package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +0 -13
  35. package/dist/components/hovering-toolbar/hovering-toolbar-components.d.ts +0 -18
  36. package/dist/components/hovering-toolbar/hovering-toolbar.d.ts +0 -8
  37. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.d.ts +0 -29
  38. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.d.ts +0 -12
  39. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.d.ts +0 -3
  40. package/dist/components/index.d.ts +0 -15
  41. package/dist/components/manual-ui/chip-with-icon.d.ts +0 -10
  42. package/dist/components/source-search-box/source-search-box.d.ts +0 -17
  43. package/dist/components/ui/button.d.ts +0 -14
  44. package/dist/components/ui/card.d.ts +0 -10
  45. package/dist/components/ui/command.d.ts +0 -48
  46. package/dist/components/ui/dialog.d.ts +0 -18
  47. package/dist/components/ui/label.d.ts +0 -8
  48. package/dist/components/ui/separator.d.ts +0 -6
  49. package/dist/components/ui/textarea.d.ts +0 -7
  50. package/dist/context/index.d.ts +0 -1
  51. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.ts +0 -13
  52. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.d.ts +0 -8
  53. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.d.ts +0 -7
  54. package/dist/hooks/index.d.ts +0 -1
  55. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +0 -22
  56. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.d.ts +0 -23
  57. package/dist/hooks/misc/use-autosize-textarea.d.ts +0 -5
  58. package/dist/index.d.ts +0 -15
  59. package/dist/lib/debouncer.d.ts +0 -11
  60. package/dist/lib/editor-to-text.d.ts +0 -7
  61. package/dist/lib/get-text-around-cursor.d.ts +0 -15
  62. package/dist/lib/retry.d.ts +0 -3
  63. package/dist/lib/slatejs-edits/add-autocompletions.d.ts +0 -8
  64. package/dist/lib/slatejs-edits/clear-autocompletions.d.ts +0 -8
  65. package/dist/lib/slatejs-edits/replace-text.d.ts +0 -5
  66. package/dist/lib/slatejs-edits/with-partial-history.d.ts +0 -10
  67. package/dist/lib/stream-promise-flatten.d.ts +0 -3
  68. package/dist/lib/utils.d.ts +0 -10
  69. package/dist/lib/utils.test.d.ts +0 -1
  70. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.ts +0 -25
  71. package/dist/types/autosuggestions-config/autosuggestions-config.d.ts +0 -20
  72. package/dist/types/autosuggestions-config/editing-api-config.d.ts +0 -17
  73. package/dist/types/autosuggestions-config/index.d.ts +0 -10
  74. package/dist/types/autosuggestions-config/insertions-api-config.d.ts +0 -17
  75. package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.d.ts +0 -26
  76. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.d.ts +0 -3
  77. package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.d.ts +0 -7
  78. package/dist/types/autosuggestions-config/suggestions-api-config.d.ts +0 -17
  79. package/dist/types/base/autosuggestion-state.d.ts +0 -8
  80. package/dist/types/base/autosuggestions-bare-function.d.ts +0 -17
  81. package/dist/types/base/base-autosuggestions-config.d.ts +0 -14
  82. package/dist/types/base/base-copilot-textarea-props.d.ts +0 -40
  83. package/dist/types/base/custom-editor.d.ts +0 -29
  84. package/dist/types/base/editor-autocomplete-state.d.ts +0 -10
  85. package/dist/types/base/index.d.ts +0 -4
  86. package/dist/types/html-copilot-textarea-element.d.ts +0 -7
  87. package/dist/types/index.d.ts +0 -13
  88. /package/dist/{chunk-4MDDCR32.mjs.map → chunk-4HSJ5XUO.mjs.map} +0 -0
  89. /package/dist/{chunk-CZMPLTHF.mjs.map → chunk-6Z6Z2K7O.mjs.map} +0 -0
  90. /package/dist/{chunk-OS2YW2UX.mjs.map → chunk-7PSM4AUU.mjs.map} +0 -0
  91. /package/dist/{chunk-U5GM2PRT.mjs.map → chunk-PHFEZQTN.mjs.map} +0 -0
@@ -1,48 +0,0 @@
1
- import * as React from 'react';
2
- import { DialogProps } from '@radix-ui/react-dialog';
3
-
4
- declare const Command: React.ForwardRefExoticComponent<Omit<{
5
- children?: React.ReactNode;
6
- } & React.HTMLAttributes<HTMLDivElement> & {
7
- label?: string | undefined;
8
- shouldFilter?: boolean | undefined;
9
- filter?: ((value: string, search: string) => number) | undefined;
10
- value?: string | undefined;
11
- onValueChange?: ((value: string) => void) | undefined;
12
- loop?: boolean | undefined;
13
- } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
14
- interface CommandDialogProps extends DialogProps {
15
- }
16
- declare const CommandDialog: ({ children, ...props }: CommandDialogProps) => JSX.Element;
17
- declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "type"> & {
18
- value?: string | undefined;
19
- onValueChange?: ((search: string) => void) | undefined;
20
- } & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
21
- declare const CommandList: React.ForwardRefExoticComponent<Omit<{
22
- children?: React.ReactNode;
23
- } & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
24
- declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
25
- children?: React.ReactNode;
26
- } & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
27
- declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
28
- children?: React.ReactNode;
29
- } & Omit<React.HTMLAttributes<HTMLDivElement>, "value" | "heading"> & {
30
- heading?: React.ReactNode;
31
- value?: string | undefined;
32
- } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
33
- declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement> & {
34
- alwaysRender?: boolean | undefined;
35
- } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
36
- declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
37
- children?: React.ReactNode;
38
- } & Omit<React.HTMLAttributes<HTMLDivElement>, "disabled" | "value" | "onSelect"> & {
39
- disabled?: boolean | undefined;
40
- onSelect?: ((value: string) => void) | undefined;
41
- value?: string | undefined;
42
- } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
43
- declare const CommandShortcut: {
44
- ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): JSX.Element;
45
- displayName: string;
46
- };
47
-
48
- export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
@@ -1,18 +0,0 @@
1
- import * as React from 'react';
2
- import * as DialogPrimitive from '@radix-ui/react-dialog';
3
-
4
- declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
5
- declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
6
- declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
- declare const DialogHeader: {
8
- ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): JSX.Element;
9
- displayName: string;
10
- };
11
- declare const DialogFooter: {
12
- ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): JSX.Element;
13
- displayName: string;
14
- };
15
- declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
16
- declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
17
-
18
- export { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger };
@@ -1,8 +0,0 @@
1
- import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
2
- import * as React from 'react';
3
- import * as LabelPrimitive from '@radix-ui/react-label';
4
- import { VariantProps } from 'class-variance-authority';
5
-
6
- declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: class_variance_authority_dist_types.ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
7
-
8
- export { Label };
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- import * as SeparatorPrimitive from '@radix-ui/react-separator';
3
-
4
- declare const Separator: React.ForwardRefExoticComponent<Omit<SeparatorPrimitive.SeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
-
6
- export { Separator };
@@ -1,7 +0,0 @@
1
- import * as React from 'react';
2
-
3
- interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
4
- }
5
- declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
6
-
7
- export { Textarea, TextareaProps };
@@ -1 +0,0 @@
1
-
@@ -1,13 +0,0 @@
1
- import { AutosuggestionsBareFunction } from '../../types/base/autosuggestions-bare-function.js';
2
- import { AutosuggestionState } from '../../types/base/autosuggestion-state.js';
3
- import { EditorAutocompleteState } from '../../types/base/editor-autocomplete-state.js';
4
- import 'slate';
5
-
6
- interface UseAutosuggestionsResult {
7
- currentAutocompleteSuggestion: AutosuggestionState | null;
8
- onChangeHandler: (newEditorState: EditorAutocompleteState | null) => void;
9
- onKeyDownHandler: (event: React.KeyboardEvent<HTMLDivElement>) => void;
10
- }
11
- declare function useAutosuggestions(debounceTime: number, acceptAutosuggestionKey: string, autosuggestionFunction: AutosuggestionsBareFunction, insertAutocompleteSuggestion: (suggestion: AutosuggestionState) => void, disableWhenEmpty: boolean, disabled: boolean): UseAutosuggestionsResult;
12
-
13
- export { UseAutosuggestionsResult, useAutosuggestions };
@@ -1,8 +0,0 @@
1
- import { CustomEditor } from '../../types/base/custom-editor.js';
2
- import 'slate';
3
- import 'slate-react';
4
- import 'slate-history';
5
-
6
- declare function useCopilotTextareaEditor(): CustomEditor;
7
-
8
- export { useCopilotTextareaEditor };
@@ -1,7 +0,0 @@
1
- import React__default from 'react';
2
- import { Editor } from 'slate';
3
- import { HTMLCopilotTextAreaElement } from '../../types/html-copilot-textarea-element.js';
4
-
5
- declare function usePopulateCopilotTextareaRef(editor: Editor, ref: React__default.Ref<HTMLCopilotTextAreaElement>): void;
6
-
7
- export { usePopulateCopilotTextareaRef };
@@ -1 +0,0 @@
1
-
@@ -1,22 +0,0 @@
1
- import { AutosuggestionsBareFunction } from '../../types/base/autosuggestions-bare-function.js';
2
- import { SuggestionsApiConfig } from '../../types/autosuggestions-config/suggestions-api-config.js';
3
- import '../../types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js';
4
- import '../../types/autosuggestions-config/subtypes/make-system-prompt.js';
5
- import '../../types/autosuggestions-config/subtypes/chatlike-api-endpoint.js';
6
-
7
- /**
8
- * Returns a memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.
9
- * The function takes in the text before and after the cursor, and an abort signal.
10
- * It sends a POST request to the API endpoint with the messages array containing the system message, few shot messages, and user messages.
11
- * The function returns the suggestion from the API response.
12
- *
13
- * @param textareaPurpose - The purpose of the textarea. This is included in the system message.
14
- * @param apiEndpoint - The API endpoint to send the autosuggestion request to.
15
- * @param makeSystemMessage - A function that takes in a context string and returns a system message to include in the autosuggestion request.
16
- * @param fewShotMessages - An array of few shot messages to include in the autosuggestion request.
17
- * @param contextCategories - The categories of context strings we want to include. By default, we include the (default) "global" context category.
18
- * @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.
19
- */
20
- declare function useMakeStandardAutosuggestionFunction(textareaPurpose: string, contextCategories: string[] | undefined, apiConfig: SuggestionsApiConfig): AutosuggestionsBareFunction;
21
-
22
- export { useMakeStandardAutosuggestionFunction };
@@ -1,23 +0,0 @@
1
- import { Generator_InsertionOrEditingSuggestion } from '../../types/base/autosuggestions-bare-function.js';
2
- import { InsertionsApiConfig } from '../../types/autosuggestions-config/insertions-api-config.js';
3
- import { EditingApiConfig } from '../../types/autosuggestions-config/editing-api-config.js';
4
- import '../../types/autosuggestions-config/subtypes/chatlike-api-endpoint.js';
5
- import '../../types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js';
6
- import '../../types/autosuggestions-config/subtypes/make-system-prompt.js';
7
-
8
- /**
9
- * Returns a memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.
10
- * The function takes in the text before and after the cursor, and an abort signal.
11
- * It sends a POST request to the API endpoint with the messages array containing the system message, few shot messages, and user messages.
12
- * The function returns the suggestion from the API response.
13
- *
14
- * @param textareaPurpose - The purpose of the textarea. This is included in the system message.
15
- * @param apiEndpoint - The API endpoint to send the autosuggestion request to.
16
- * @param makeSystemMessage - A function that takes in a context string and returns a system message to include in the autosuggestion request.
17
- * @param fewShotMessages - An array of few shot messages to include in the autosuggestion request.
18
- * @param contextCategories - The categories of context strings we want to include. By default, we include the (default) "global" context category.
19
- * @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.
20
- */
21
- declare function useMakeStandardInsertionOrEditingFunction(textareaPurpose: string, contextCategories: string[] | undefined, insertionApiConfig: InsertionsApiConfig, editingApiConfig: EditingApiConfig): Generator_InsertionOrEditingSuggestion;
22
-
23
- export { useMakeStandardInsertionOrEditingFunction };
@@ -1,5 +0,0 @@
1
- import { RefObject } from 'react';
2
-
3
- declare const useAutosizeTextArea: (textAreaRef: RefObject<HTMLTextAreaElement>, value: string) => void;
4
-
5
- export { useAutosizeTextArea as default };
package/dist/index.d.ts DELETED
@@ -1,15 +0,0 @@
1
- export { BaseCopilotTextarea } from './components/base-copilot-textarea/base-copilot-textarea.js';
2
- export { CopilotTextarea, CopilotTextareaProps } from './components/copilot-textarea/copilot-textarea.js';
3
- export { BaseAutosuggestionsConfig, defaultBaseAutosuggestionsConfig } from './types/base/base-autosuggestions-config.js';
4
- export { AutosuggestionsBareFunction } from './types/base/autosuggestions-bare-function.js';
5
- export { BaseCopilotTextareaProps } from './types/base/base-copilot-textarea-props.js';
6
- export { HTMLCopilotTextAreaElement } from './types/html-copilot-textarea-element.js';
7
- export { AutosuggestionsConfig, defaultAutosuggestionsConfig } from './types/autosuggestions-config/autosuggestions-config.js';
8
- export { MinimalChatGPTMessage } from './types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js';
9
- export { MakeSystemPrompt } from './types/autosuggestions-config/subtypes/make-system-prompt.js';
10
- export { ChatlikeApiEndpoint, ChatlikeApiEndpointImpl } from './types/autosuggestions-config/subtypes/chatlike-api-endpoint.js';
11
- export { AutosuggestionsConfigUserSpecified, InsertionsApiConfigUserSpecified, SuggestionsApiConfigUserSpecified } from './types/autosuggestions-config/autosuggestions-config-user-specified.js';
12
- import 'react';
13
- import './types/autosuggestions-config/suggestions-api-config.js';
14
- import './types/autosuggestions-config/insertions-api-config.js';
15
- import './types/autosuggestions-config/editing-api-config.js';
@@ -1,11 +0,0 @@
1
- type AsyncFunction<T extends any[]> = (...args: [...T, AbortSignal]) => Promise<void>;
2
- declare class Debouncer<T extends any[]> {
3
- private wait;
4
- private timeoutId?;
5
- private activeAbortController?;
6
- constructor(wait: number);
7
- debounce: (func: AsyncFunction<T>, ...args: T) => Promise<void>;
8
- cancel: () => void;
9
- }
10
-
11
- export { AsyncFunction, Debouncer };
@@ -1,7 +0,0 @@
1
- import { BaseEditor } from 'slate';
2
- import { HistoryEditor } from 'slate-history';
3
- import { ReactEditor } from 'slate-react';
4
-
5
- declare const editorToText: (editor: BaseEditor & ReactEditor & HistoryEditor) => string;
6
-
7
- export { editorToText };
@@ -1,15 +0,0 @@
1
- import { BaseRange, Editor, Range } from 'slate';
2
- import { EditorAutocompleteState } from '../types/base/editor-autocomplete-state.js';
3
-
4
- interface EditorTextState {
5
- selection: BaseRange;
6
- textBeforeCursor: string;
7
- selectedText: string;
8
- textAfterCursor: string;
9
- }
10
- declare function getTextAroundCollapsedCursor(editor: Editor): EditorAutocompleteState | null;
11
- declare function getTextAroundSelection(editor: Editor): EditorTextState | null;
12
- declare function getFullEditorTextWithNewlines(editor: Editor): string;
13
- declare function extractTextWithNewlines(editor: Editor, range: Range): string;
14
-
15
- export { EditorTextState, extractTextWithNewlines, getFullEditorTextWithNewlines, getTextAroundCollapsedCursor, getTextAroundSelection };
@@ -1,3 +0,0 @@
1
- declare function retry<T>(fn: () => Promise<T>, retriesLeft?: number, interval?: number, backoff?: number): Promise<T>;
2
-
3
- export { retry };
@@ -1,8 +0,0 @@
1
- import { BasePoint } from 'slate';
2
- import { CustomEditor } from '../../types/base/custom-editor.js';
3
- import 'slate-react';
4
- import 'slate-history';
5
-
6
- declare function addAutocompletionsToEditor(editor: CustomEditor, newSuggestion: string, point: BasePoint): void;
7
-
8
- export { addAutocompletionsToEditor };
@@ -1,8 +0,0 @@
1
- import { CustomEditor } from '../../types/base/custom-editor.js';
2
- import 'slate';
3
- import 'slate-react';
4
- import 'slate-history';
5
-
6
- declare function clearAutocompletionsFromEditor(editor: CustomEditor): void;
7
-
8
- export { clearAutocompletionsFromEditor };
@@ -1,5 +0,0 @@
1
- import { Editor } from 'slate';
2
-
3
- declare function replaceEditorText(editor: Editor, newText: string): void;
4
-
5
- export { replaceEditorText };
@@ -1,10 +0,0 @@
1
- import { CustomEditor } from '../../types/base/custom-editor.js';
2
- import { Operation } from 'slate';
3
- import { HistoryEditor } from 'slate-history';
4
- import 'slate-react';
5
-
6
- type ShouldSaveToHistory = (op: Operation, prev: Operation | undefined) => boolean;
7
- declare const withPartialHistory: <T extends CustomEditor>(editor: T, shouldSave: ShouldSaveToHistory) => T & HistoryEditor;
8
- declare const defaultShouldSave: (op: Operation, prev: Operation | undefined) => boolean;
9
-
10
- export { ShouldSaveToHistory, defaultShouldSave, withPartialHistory };
@@ -1,3 +0,0 @@
1
- declare function streamPromiseFlatten<A>(promise: Promise<ReadableStream<A>>): ReadableStream<A>;
2
-
3
- export { streamPromiseFlatten };
@@ -1,10 +0,0 @@
1
- import { ClassValue } from 'clsx';
2
-
3
- declare function cn(...inputs: ClassValue[]): string;
4
- declare const nanoid: (size?: number | undefined) => string;
5
- declare function fetcher<JSON = any>(input: RequestInfo, init?: RequestInit): Promise<JSON>;
6
- declare function formatDate(input: string | number | Date): string;
7
- declare const arraysAreEqual: (arr1: number[], arr2: number[]) => boolean;
8
- declare function nullableCompatibleEqualityCheck<T>(naiveEqualityCheck: (a: T, b: T) => boolean, a: T | null | undefined, b: T | null | undefined): boolean;
9
-
10
- export { arraysAreEqual, cn, fetcher, formatDate, nanoid, nullableCompatibleEqualityCheck };
@@ -1 +0,0 @@
1
-
@@ -1,25 +0,0 @@
1
- import { AutosuggestionsConfig } from './autosuggestions-config.js';
2
- import { ChatlikeApiEndpoint } from './subtypes/chatlike-api-endpoint.js';
3
- import { InsertionsApiConfig } from './insertions-api-config.js';
4
- import { SuggestionsApiConfig } from './suggestions-api-config.js';
5
- import '../base/base-autosuggestions-config.js';
6
- import '../base/autosuggestions-bare-function.js';
7
- import './editing-api-config.js';
8
- import './subtypes/make-system-prompt.js';
9
- import './subtypes/minimal-chat-gpt-message.js';
10
-
11
- interface SuggestionsApiConfigUserSpecified extends Partial<Omit<SuggestionsApiConfig, "apiEndpoint">> {
12
- apiEndpoint: ChatlikeApiEndpoint;
13
- }
14
- interface InsertionsApiConfigUserSpecified extends Partial<Omit<InsertionsApiConfig, "apiEndpoint">> {
15
- apiEndpoint: ChatlikeApiEndpoint;
16
- }
17
- interface AutosuggestionsConfigUserSpecified extends Partial<Omit<AutosuggestionsConfig, "chatApiConfigs" | "textareaPurpose">> {
18
- textareaPurpose: string;
19
- chatApiConfigs: {
20
- suggestionsApiConfig?: SuggestionsApiConfigUserSpecified;
21
- insertionApiConfig?: InsertionsApiConfigUserSpecified;
22
- };
23
- }
24
-
25
- export { AutosuggestionsConfigUserSpecified, InsertionsApiConfigUserSpecified, SuggestionsApiConfigUserSpecified };
@@ -1,20 +0,0 @@
1
- import { BaseAutosuggestionsConfig } from '../base/base-autosuggestions-config.js';
2
- import { SuggestionsApiConfig } from './suggestions-api-config.js';
3
- import { InsertionsApiConfig } from './insertions-api-config.js';
4
- import { EditingApiConfig } from './editing-api-config.js';
5
- import '../base/autosuggestions-bare-function.js';
6
- import './subtypes/minimal-chat-gpt-message.js';
7
- import './subtypes/make-system-prompt.js';
8
- import './subtypes/chatlike-api-endpoint.js';
9
-
10
- interface AutosuggestionsConfig extends Omit<BaseAutosuggestionsConfig, "apiConfig"> {
11
- externalContextCategories: string[] | undefined;
12
- chatApiConfigs: {
13
- suggestionsApiConfig: SuggestionsApiConfig;
14
- insertionApiConfig: InsertionsApiConfig;
15
- editingApiConfig: EditingApiConfig;
16
- };
17
- }
18
- declare const defaultAutosuggestionsConfig: Omit<AutosuggestionsConfig, "textareaPurpose" | "apiEndpoint">;
19
-
20
- export { AutosuggestionsConfig, defaultAutosuggestionsConfig };
@@ -1,17 +0,0 @@
1
- import { ChatlikeApiEndpoint } from './subtypes/chatlike-api-endpoint.js';
2
- import { MakeSystemPrompt } from './subtypes/make-system-prompt.js';
3
- import { MinimalChatGPTMessage } from './subtypes/minimal-chat-gpt-message.js';
4
-
5
- interface EditingApiConfig {
6
- apiEndpoint: ChatlikeApiEndpoint;
7
- makeSystemPrompt: MakeSystemPrompt;
8
- fewShotMessages: MinimalChatGPTMessage[];
9
- forwardedParams: {
10
- [key: string]: any;
11
- } | undefined;
12
- }
13
- declare const defaultEditingMakeSystemPrompt: MakeSystemPrompt;
14
- declare const defaultEditingFewShotMessages: MinimalChatGPTMessage[];
15
- declare const defaultEditingApiConfig: EditingApiConfig;
16
-
17
- export { EditingApiConfig, defaultEditingApiConfig, defaultEditingFewShotMessages, defaultEditingMakeSystemPrompt };
@@ -1,10 +0,0 @@
1
- export { AutosuggestionsConfig, defaultAutosuggestionsConfig } from './autosuggestions-config.js';
2
- export { MinimalChatGPTMessage } from './subtypes/minimal-chat-gpt-message.js';
3
- export { MakeSystemPrompt } from './subtypes/make-system-prompt.js';
4
- export { ChatlikeApiEndpoint, ChatlikeApiEndpointImpl } from './subtypes/chatlike-api-endpoint.js';
5
- export { AutosuggestionsConfigUserSpecified, InsertionsApiConfigUserSpecified, SuggestionsApiConfigUserSpecified } from './autosuggestions-config-user-specified.js';
6
- import '../base/base-autosuggestions-config.js';
7
- import '../base/autosuggestions-bare-function.js';
8
- import './suggestions-api-config.js';
9
- import './insertions-api-config.js';
10
- import './editing-api-config.js';
@@ -1,17 +0,0 @@
1
- import { ChatlikeApiEndpoint } from './subtypes/chatlike-api-endpoint.js';
2
- import { MakeSystemPrompt } from './subtypes/make-system-prompt.js';
3
- import { MinimalChatGPTMessage } from './subtypes/minimal-chat-gpt-message.js';
4
-
5
- interface InsertionsApiConfig {
6
- apiEndpoint: ChatlikeApiEndpoint;
7
- makeSystemPrompt: MakeSystemPrompt;
8
- fewShotMessages: MinimalChatGPTMessage[];
9
- forwardedParams: {
10
- [key: string]: any;
11
- } | undefined;
12
- }
13
- declare const defaultInsertionsMakeSystemPrompt: MakeSystemPrompt;
14
- declare const defaultInsertionsFewShotMessages: MinimalChatGPTMessage[];
15
- declare const defaultInsertionsApiConfig: InsertionsApiConfig;
16
-
17
- export { InsertionsApiConfig, defaultInsertionsApiConfig, defaultInsertionsFewShotMessages, defaultInsertionsMakeSystemPrompt };
@@ -1,26 +0,0 @@
1
- import { MinimalChatGPTMessage } from './minimal-chat-gpt-message.js';
2
-
3
- type ChatlikeApiEndpointImpl = (abortSignal: AbortSignal, messages: MinimalChatGPTMessage[], forwardedProps?: {
4
- [key: string]: any;
5
- }) => Promise<string>;
6
- type StreamingChatlikeApiEndpointImpl = (abortSignal: AbortSignal, messages: MinimalChatGPTMessage[], forwardedProps?: {
7
- [key: string]: any;
8
- }) => Promise<ReadableStream<string>>;
9
- declare class ChatlikeApiEndpoint {
10
- run: StreamingChatlikeApiEndpointImpl;
11
- constructor(run: StreamingChatlikeApiEndpointImpl);
12
- /**
13
- * Creates a new instance of ChatlikeApiEndpoint with the provided API endpoint.
14
- * @param apiEndpoint The URL of the OpenAI-compatible API endpoint.
15
- * @returns A new instance of ChatlikeApiEndpoint.
16
- */
17
- static standardOpenAIEndpoint(apiEndpoint: string): ChatlikeApiEndpoint;
18
- /**
19
- * Creates a fully customized instance of ChatlikeApiEndpoint.
20
- * @param run - The implementation of the ChatlikeApiEndpointImpl interface.
21
- * @returns A new instance of ChatlikeApiEndpoint .
22
- */
23
- static custom(run: StreamingChatlikeApiEndpointImpl): ChatlikeApiEndpoint;
24
- }
25
-
26
- export { ChatlikeApiEndpoint, ChatlikeApiEndpointImpl, StreamingChatlikeApiEndpointImpl };
@@ -1,3 +0,0 @@
1
- type MakeSystemPrompt = (textareaPurpose: string, contextString: string) => string;
2
-
3
- export { MakeSystemPrompt };
@@ -1,7 +0,0 @@
1
- interface MinimalChatGPTMessage {
2
- role: string;
3
- content: string;
4
- name?: string;
5
- }
6
-
7
- export { MinimalChatGPTMessage };
@@ -1,17 +0,0 @@
1
- import { MinimalChatGPTMessage } from './subtypes/minimal-chat-gpt-message.js';
2
- import { MakeSystemPrompt } from './subtypes/make-system-prompt.js';
3
- import { ChatlikeApiEndpoint } from './subtypes/chatlike-api-endpoint.js';
4
-
5
- interface SuggestionsApiConfig {
6
- apiEndpoint: ChatlikeApiEndpoint;
7
- makeSystemPrompt: MakeSystemPrompt;
8
- fewShotMessages: MinimalChatGPTMessage[];
9
- forwardedParams: {
10
- [key: string]: any;
11
- } | undefined;
12
- }
13
- declare const defaultSuggestionsMakeSystemPrompt: MakeSystemPrompt;
14
- declare const defaultSuggestionsFewShotMessages: MinimalChatGPTMessage[];
15
- declare const defaultSuggestionsApiConfig: SuggestionsApiConfig;
16
-
17
- export { SuggestionsApiConfig, defaultSuggestionsApiConfig, defaultSuggestionsFewShotMessages, defaultSuggestionsMakeSystemPrompt };
@@ -1,8 +0,0 @@
1
- import { BasePoint } from 'slate';
2
-
3
- interface AutosuggestionState {
4
- text: string;
5
- point: BasePoint;
6
- }
7
-
8
- export { AutosuggestionState };
@@ -1,17 +0,0 @@
1
- interface InsertionEditorState {
2
- textBeforeCursor: string;
3
- textAfterCursor: string;
4
- }
5
- interface EditingEditorState extends InsertionEditorState {
6
- selectedText: string;
7
- }
8
- type AutosuggestionsBareFunction = (editorState: InsertionEditorState, abortSignal: AbortSignal) => Promise<string>;
9
- type Generator_InsertionOrEditingSuggestion = (editorState: EditingEditorState, prompt: string, abortSignal: AbortSignal) => Promise<ReadableStream<string>>;
10
- interface InsertionEditorApiConfig {
11
- insertionOrEditingFunction: Generator_InsertionOrEditingSuggestion;
12
- }
13
- interface BaseCopilotTextareaApiConfig extends InsertionEditorApiConfig {
14
- autosuggestionsFunction: AutosuggestionsBareFunction;
15
- }
16
-
17
- export { AutosuggestionsBareFunction, BaseCopilotTextareaApiConfig, EditingEditorState, Generator_InsertionOrEditingSuggestion, InsertionEditorApiConfig, InsertionEditorState };
@@ -1,14 +0,0 @@
1
- import { BaseCopilotTextareaApiConfig } from './autosuggestions-bare-function.js';
2
-
3
- interface BaseAutosuggestionsConfig {
4
- textareaPurpose: string;
5
- debounceTime: number;
6
- acceptAutosuggestionKey: string;
7
- disableWhenEmpty: boolean;
8
- disabled: boolean;
9
- temporarilyDisableWhenMovingCursorWithoutChangingText: boolean;
10
- apiConfig: BaseCopilotTextareaApiConfig;
11
- }
12
- declare const defaultBaseAutosuggestionsConfig: Omit<BaseAutosuggestionsConfig, "textareaPurpose" | "apiConfig">;
13
-
14
- export { BaseAutosuggestionsConfig, defaultBaseAutosuggestionsConfig };
@@ -1,40 +0,0 @@
1
- import { TextareaHTMLAttributes } from 'react';
2
- import { BaseAutosuggestionsConfig } from './base-autosuggestions-config.js';
3
- import { BaseCopilotTextareaApiConfig } from './autosuggestions-bare-function.js';
4
-
5
- /**
6
- * `BaseCopilotTextareaProps` defines the properties for the `BaseCopilotTextarea` component.
7
- *
8
- * @extends {Omit<TextareaHTMLAttributes<HTMLDivElement>, "onChange">}
9
- *
10
- * @property {boolean} [disableBranding=false] - Determines whether branding should be disabled. Default is `false`.
11
- *
12
- * @property {React.CSSProperties} [placeholderStyle] - Specifies the CSS styles to apply to the placeholder text.
13
- *
14
- * @property {React.CSSProperties} [suggestionsStyle] - Specifies the CSS styles to apply to the suggestions list.
15
- *
16
- * @property {string} [value] - The initial value of the textarea. Can be controlled via `onValueChange`.
17
- *
18
- * @property {(value: string) => void} [onValueChange] - Callback invoked when the value of the textarea changes.
19
- *
20
- * @property {(event: React.ChangeEvent<HTMLTextAreaElement>) => void} [onChange] - Callback invoked when a `change` event is triggered on the textarea element. The event only actually includes the `event.target.value` and `event.currentTarget.value` properties (all that is required in 99% of cases).
21
- *
22
- * @property {Partial<BaseAutosuggestionsConfig> & {
23
- * textareaPurpose: string;
24
- * }} autosuggestionsConfig - Configuration settings for the autosuggestions feature.
25
- * Includes a mandatory `textareaPurpose` to guide the autosuggestions.
26
- */
27
- interface BaseCopilotTextareaProps extends Omit<TextareaHTMLAttributes<HTMLDivElement>, "onChange"> {
28
- disableBranding?: boolean;
29
- placeholderStyle?: React.CSSProperties;
30
- suggestionsStyle?: React.CSSProperties;
31
- value?: string;
32
- onValueChange?: (value: string) => void;
33
- onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
34
- baseAutosuggestionsConfig: Partial<BaseAutosuggestionsConfig> & {
35
- textareaPurpose: string;
36
- apiConfig: BaseCopilotTextareaApiConfig;
37
- };
38
- }
39
-
40
- export { BaseCopilotTextareaProps };
@@ -1,29 +0,0 @@
1
- import { BaseEditor } from 'slate';
2
- import { ReactEditor } from 'slate-react';
3
- import { HistoryEditor } from 'slate-history';
4
-
5
- type CustomEditor = BaseEditor & ReactEditor & HistoryEditor;
6
- type ParagraphElement = {
7
- type: "paragraph";
8
- children: CustomText[];
9
- };
10
- type SuggestionElement = {
11
- type: "suggestion";
12
- inline: boolean;
13
- content: string;
14
- children: CustomText[];
15
- };
16
- type CustomElement = ParagraphElement | SuggestionElement;
17
- type SuggestionAwareText = {
18
- text: string;
19
- };
20
- type CustomText = SuggestionAwareText;
21
- declare module "slate" {
22
- interface CustomTypes {
23
- Editor: CustomEditor;
24
- Element: CustomElement;
25
- Text: CustomText;
26
- }
27
- }
28
-
29
- export { CustomEditor, CustomElement, CustomText, ParagraphElement, SuggestionAwareText, SuggestionElement };
@@ -1,10 +0,0 @@
1
- import { BasePoint } from 'slate';
2
-
3
- interface EditorAutocompleteState {
4
- cursorPoint: BasePoint;
5
- textBeforeCursor: string;
6
- textAfterCursor: string;
7
- }
8
- declare function areEqual_autocompleteState(prev: EditorAutocompleteState, next: EditorAutocompleteState): boolean;
9
-
10
- export { EditorAutocompleteState, areEqual_autocompleteState };
@@ -1,4 +0,0 @@
1
- export { BaseAutosuggestionsConfig, defaultBaseAutosuggestionsConfig } from './base-autosuggestions-config.js';
2
- export { AutosuggestionsBareFunction } from './autosuggestions-bare-function.js';
3
- export { BaseCopilotTextareaProps } from './base-copilot-textarea-props.js';
4
- import 'react';
@@ -1,7 +0,0 @@
1
- interface HTMLCopilotTextAreaElement extends HTMLElement {
2
- value: string;
3
- focus: () => void;
4
- blur: () => void;
5
- }
6
-
7
- export { HTMLCopilotTextAreaElement };
@@ -1,13 +0,0 @@
1
- export { BaseAutosuggestionsConfig, defaultBaseAutosuggestionsConfig } from './base/base-autosuggestions-config.js';
2
- export { AutosuggestionsBareFunction } from './base/autosuggestions-bare-function.js';
3
- export { BaseCopilotTextareaProps } from './base/base-copilot-textarea-props.js';
4
- export { HTMLCopilotTextAreaElement } from './html-copilot-textarea-element.js';
5
- export { AutosuggestionsConfig, defaultAutosuggestionsConfig } from './autosuggestions-config/autosuggestions-config.js';
6
- export { MinimalChatGPTMessage } from './autosuggestions-config/subtypes/minimal-chat-gpt-message.js';
7
- export { MakeSystemPrompt } from './autosuggestions-config/subtypes/make-system-prompt.js';
8
- export { ChatlikeApiEndpoint, ChatlikeApiEndpointImpl } from './autosuggestions-config/subtypes/chatlike-api-endpoint.js';
9
- export { AutosuggestionsConfigUserSpecified, InsertionsApiConfigUserSpecified, SuggestionsApiConfigUserSpecified } from './autosuggestions-config/autosuggestions-config-user-specified.js';
10
- import 'react';
11
- import './autosuggestions-config/suggestions-api-config.js';
12
- import './autosuggestions-config/insertions-api-config.js';
13
- import './autosuggestions-config/editing-api-config.js';