@copilotkit/react-textarea 0.27.0-alpha.2 → 0.27.0-alpha.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/.turbo/turbo-build.log +153 -154
- package/CHANGELOG.md +35 -6
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +1745 -35
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-element.mjs +51 -3
- package/dist/components/base-copilot-textarea/render-element.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.mjs +49 -3
- package/dist/components/base-copilot-textarea/render-placeholder.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +86 -4
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +57 -3
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.mjs +2192 -47
- package/dist/components/copilot-textarea/copilot-textarea.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +17 -3
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +137 -3
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +875 -18
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +558 -12
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +581 -13
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +102 -5
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +581 -14
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +1 -1
- package/dist/components/index.mjs +2193 -48
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/manual-ui/chip-with-icon.mjs +5 -6
- package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -1
- package/dist/components/source-search-box/source-search-box.mjs +211 -6
- package/dist/components/source-search-box/source-search-box.mjs.map +1 -1
- package/dist/components/ui/button.mjs +85 -4
- package/dist/components/ui/button.mjs.map +1 -1
- package/dist/components/ui/card.mjs +53 -7
- package/dist/components/ui/card.mjs.map +1 -1
- package/dist/components/ui/command.mjs +244 -5
- package/dist/components/ui/command.mjs.map +1 -1
- package/dist/components/ui/dialog.mjs +144 -4
- package/dist/components/ui/dialog.mjs.map +1 -1
- package/dist/components/ui/label.mjs +60 -4
- package/dist/components/ui/label.mjs.map +1 -1
- package/dist/components/ui/separator.mjs +50 -8
- package/dist/components/ui/separator.mjs.map +1 -1
- package/dist/components/ui/textarea.mjs +48 -7
- package/dist/components/ui/textarea.mjs.map +1 -1
- package/dist/context/index.mjs +0 -2
- package/dist/context/index.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +158 -6
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +168 -4
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +148 -5
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map +1 -1
- package/dist/hooks/index.mjs +0 -2
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +114 -14
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +166 -14
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs.map +1 -1
- package/dist/hooks/misc/use-autosize-textarea.mjs +15 -3
- package/dist/hooks/misc/use-autosize-textarea.mjs.map +1 -1
- package/dist/index.css +0 -3
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +2195 -50
- package/dist/index.mjs.map +1 -1
- package/dist/lib/debouncer.mjs +51 -3
- package/dist/lib/debouncer.mjs.map +1 -1
- package/dist/lib/editor-to-text.mjs +43 -3
- package/dist/lib/editor-to-text.mjs.map +1 -1
- package/dist/lib/get-text-around-cursor.mjs +102 -3
- package/dist/lib/get-text-around-cursor.mjs.map +1 -1
- package/dist/lib/retry.mjs +17 -3
- package/dist/lib/retry.mjs.map +1 -1
- package/dist/lib/slatejs-edits/add-autocompletions.mjs +25 -3
- package/dist/lib/slatejs-edits/add-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs +20 -3
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/replace-text.mjs +27 -3
- package/dist/lib/slatejs-edits/replace-text.mjs.map +1 -1
- package/dist/lib/slatejs-edits/with-partial-history.mjs +106 -3
- package/dist/lib/slatejs-edits/with-partial-history.mjs.map +1 -1
- package/dist/lib/stream-promise-flatten.mjs +47 -3
- package/dist/lib/stream-promise-flatten.mjs.map +1 -1
- package/dist/lib/utils.mjs +71 -3
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/lib/utils.test.mjs +0 -1
- package/dist/lib/utils.test.mjs.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs +0 -2
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +274 -8
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.mjs +87 -3
- package/dist/types/autosuggestions-config/editing-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/index.d.ts +0 -1
- package/dist/types/autosuggestions-config/index.mjs +274 -10
- package/dist/types/autosuggestions-config/index.mjs.map +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.mjs +78 -3
- package/dist/types/autosuggestions-config/insertions-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs +0 -2
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs +0 -2
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs.map +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs +64 -3
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs.map +1 -1
- package/dist/types/base/autosuggestion-state.mjs +0 -2
- package/dist/types/base/autosuggestion-state.mjs.map +1 -1
- package/dist/types/base/autosuggestions-bare-function.mjs +0 -2
- package/dist/types/base/autosuggestions-bare-function.mjs.map +1 -1
- package/dist/types/base/base-autosuggestions-config.mjs +26 -3
- package/dist/types/base/base-autosuggestions-config.mjs.map +1 -1
- package/dist/types/base/base-copilot-textarea-props.mjs +0 -2
- package/dist/types/base/base-copilot-textarea-props.mjs.map +1 -1
- package/dist/types/base/custom-editor.mjs +0 -2
- package/dist/types/base/custom-editor.mjs.map +1 -1
- package/dist/types/base/editor-autocomplete-state.mjs +17 -4
- package/dist/types/base/editor-autocomplete-state.mjs.map +1 -1
- package/dist/types/base/index.mjs +26 -4
- package/dist/types/base/index.mjs.map +1 -1
- package/dist/types/html-copilot-textarea-element.mjs +0 -2
- package/dist/types/html-copilot-textarea-element.mjs.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.mjs +275 -12
- package/dist/types/index.mjs.map +1 -1
- package/package.json +3 -4
- package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +15 -9
- package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +22 -6
- package/src/types/autosuggestions-config/autosuggestions-config-user-specified.tsx +1 -1
- package/src/types/autosuggestions-config/autosuggestions-config.tsx +0 -1
- package/src/types/autosuggestions-config/editing-api-config.tsx +22 -17
- package/src/types/autosuggestions-config/index.ts +0 -2
- package/src/types/autosuggestions-config/insertions-api-config.tsx +11 -6
- package/dist/chunk-224UKA7C.mjs +0 -33
- package/dist/chunk-224UKA7C.mjs.map +0 -1
- package/dist/chunk-22SLIB4K.mjs +0 -46
- package/dist/chunk-22SLIB4K.mjs.map +0 -1
- package/dist/chunk-2C7O2EVM.mjs +0 -27
- package/dist/chunk-2C7O2EVM.mjs.map +0 -1
- package/dist/chunk-2QDCE7PD.mjs +0 -29
- package/dist/chunk-2QDCE7PD.mjs.map +0 -1
- package/dist/chunk-3PQ7GSFE.mjs +0 -17
- package/dist/chunk-3PQ7GSFE.mjs.map +0 -1
- package/dist/chunk-47L4PLG4.mjs +0 -45
- package/dist/chunk-47L4PLG4.mjs.map +0 -1
- package/dist/chunk-4NHVQZ67.mjs +0 -107
- package/dist/chunk-4NHVQZ67.mjs.map +0 -1
- package/dist/chunk-5FO6ISW4.mjs +0 -3
- package/dist/chunk-5FO6ISW4.mjs.map +0 -1
- package/dist/chunk-5UNJXFUO.mjs +0 -29
- package/dist/chunk-5UNJXFUO.mjs.map +0 -1
- package/dist/chunk-5ZCVCVRZ.mjs +0 -19
- package/dist/chunk-5ZCVCVRZ.mjs.map +0 -1
- package/dist/chunk-6TZ6V3QI.mjs +0 -217
- package/dist/chunk-6TZ6V3QI.mjs.map +0 -1
- package/dist/chunk-72P3KOHZ.mjs +0 -91
- package/dist/chunk-72P3KOHZ.mjs.map +0 -1
- package/dist/chunk-7LSRNPNI.mjs +0 -59
- package/dist/chunk-7LSRNPNI.mjs.map +0 -1
- package/dist/chunk-7SUZ6CXM.mjs +0 -47
- package/dist/chunk-7SUZ6CXM.mjs.map +0 -1
- package/dist/chunk-COUN55HQ.mjs +0 -53
- package/dist/chunk-COUN55HQ.mjs.map +0 -1
- package/dist/chunk-DE5K76I2.mjs +0 -3
- package/dist/chunk-DE5K76I2.mjs.map +0 -1
- package/dist/chunk-DRV2FOHZ.mjs +0 -65
- package/dist/chunk-DRV2FOHZ.mjs.map +0 -1
- package/dist/chunk-ECR45NSD.mjs +0 -101
- package/dist/chunk-ECR45NSD.mjs.map +0 -1
- package/dist/chunk-EPBVNDKE.mjs +0 -46
- package/dist/chunk-EPBVNDKE.mjs.map +0 -1
- package/dist/chunk-FJNUPSQK.mjs +0 -72
- package/dist/chunk-FJNUPSQK.mjs.map +0 -1
- package/dist/chunk-FP2EKU3L.mjs +0 -28
- package/dist/chunk-FP2EKU3L.mjs.map +0 -1
- package/dist/chunk-GQN2HYFJ.mjs +0 -22
- package/dist/chunk-GQN2HYFJ.mjs.map +0 -1
- package/dist/chunk-H4VKQGVU.mjs +0 -3
- package/dist/chunk-H4VKQGVU.mjs.map +0 -1
- package/dist/chunk-HSCZA5TS.mjs +0 -27
- package/dist/chunk-HSCZA5TS.mjs.map +0 -1
- package/dist/chunk-IU3WTXLQ.mjs +0 -3
- package/dist/chunk-IU3WTXLQ.mjs.map +0 -1
- package/dist/chunk-JJLQVT7S.mjs +0 -10
- package/dist/chunk-JJLQVT7S.mjs.map +0 -1
- package/dist/chunk-K5LNB36H.mjs +0 -80
- package/dist/chunk-K5LNB36H.mjs.map +0 -1
- package/dist/chunk-KDVMG3XF.mjs +0 -63
- package/dist/chunk-KDVMG3XF.mjs.map +0 -1
- package/dist/chunk-KFQZHRPJ.mjs +0 -19
- package/dist/chunk-KFQZHRPJ.mjs.map +0 -1
- package/dist/chunk-KNQIEOFP.mjs +0 -18
- package/dist/chunk-KNQIEOFP.mjs.map +0 -1
- package/dist/chunk-KTTN5H7S.mjs +0 -202
- package/dist/chunk-KTTN5H7S.mjs.map +0 -1
- package/dist/chunk-L7VVZH4Q.mjs +0 -3
- package/dist/chunk-L7VVZH4Q.mjs.map +0 -1
- package/dist/chunk-LQZBI6XD.mjs +0 -112
- package/dist/chunk-LQZBI6XD.mjs.map +0 -1
- package/dist/chunk-M2DR4KVB.mjs +0 -33
- package/dist/chunk-M2DR4KVB.mjs.map +0 -1
- package/dist/chunk-MMVDU6DF.mjs +0 -3
- package/dist/chunk-MMVDU6DF.mjs.map +0 -1
- package/dist/chunk-MRXNTQOX.mjs +0 -55
- package/dist/chunk-MRXNTQOX.mjs.map +0 -1
- package/dist/chunk-OHO4G6DR.mjs +0 -19
- package/dist/chunk-OHO4G6DR.mjs.map +0 -1
- package/dist/chunk-P4QVFRLY.mjs +0 -103
- package/dist/chunk-P4QVFRLY.mjs.map +0 -1
- package/dist/chunk-PTZVE6NC.mjs +0 -94
- package/dist/chunk-PTZVE6NC.mjs.map +0 -1
- package/dist/chunk-QDFAIRQF.mjs +0 -45
- package/dist/chunk-QDFAIRQF.mjs.map +0 -1
- package/dist/chunk-RBR32FWA.mjs +0 -74
- package/dist/chunk-RBR32FWA.mjs.map +0 -1
- package/dist/chunk-SBV2KVF5.mjs +0 -99
- package/dist/chunk-SBV2KVF5.mjs.map +0 -1
- package/dist/chunk-T6MTDQZ7.mjs +0 -45
- package/dist/chunk-T6MTDQZ7.mjs.map +0 -1
- package/dist/chunk-VPEH6V7T.mjs +0 -83
- package/dist/chunk-VPEH6V7T.mjs.map +0 -1
- package/dist/chunk-WADHCMPK.mjs +0 -3
- package/dist/chunk-WADHCMPK.mjs.map +0 -1
- package/dist/chunk-WFTAAA7R.mjs +0 -44
- package/dist/chunk-WFTAAA7R.mjs.map +0 -1
- package/dist/chunk-WJHSY5T6.mjs +0 -3
- package/dist/chunk-WJHSY5T6.mjs.map +0 -1
- package/dist/chunk-WTASPE2W.mjs +0 -105
- package/dist/chunk-WTASPE2W.mjs.map +0 -1
- package/dist/chunk-XV7MLLXQ.mjs +0 -18
- package/dist/chunk-XV7MLLXQ.mjs.map +0 -1
- package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.d.ts +0 -27
- package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.mjs +0 -4
- package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.mjs.map +0 -1
- package/src/types/autosuggestions-config/subtypes/chatlike-api-endpoint.tsx +0 -69
package/dist/chunk-ECR45NSD.mjs
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { Range, Editor, Text, Element, Path, Point } from 'slate';
|
|
2
|
-
|
|
3
|
-
// src/lib/get-text-around-cursor.ts
|
|
4
|
-
function getTextAroundCollapsedCursor(editor) {
|
|
5
|
-
const { selection } = editor;
|
|
6
|
-
if (!selection || !Range.isCollapsed(selection)) {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
const cursorPoint = selection.anchor;
|
|
10
|
-
const beforeRange = {
|
|
11
|
-
anchor: Editor.start(editor, []),
|
|
12
|
-
focus: cursorPoint
|
|
13
|
-
};
|
|
14
|
-
const afterRange = {
|
|
15
|
-
anchor: cursorPoint,
|
|
16
|
-
focus: Editor.end(editor, [])
|
|
17
|
-
};
|
|
18
|
-
const before = extractTextWithNewlines(editor, beforeRange);
|
|
19
|
-
const after = extractTextWithNewlines(editor, afterRange);
|
|
20
|
-
return {
|
|
21
|
-
cursorPoint,
|
|
22
|
-
textBeforeCursor: before,
|
|
23
|
-
textAfterCursor: after
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function getTextAroundSelection(editor) {
|
|
27
|
-
const { selection } = editor;
|
|
28
|
-
if (!selection) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
const wellOrderedSelection = wellOrderedRange(selection);
|
|
32
|
-
const beforeRange = {
|
|
33
|
-
anchor: Editor.start(editor, []),
|
|
34
|
-
focus: wellOrderedSelection.anchor
|
|
35
|
-
};
|
|
36
|
-
const afterRange = {
|
|
37
|
-
anchor: wellOrderedSelection.focus,
|
|
38
|
-
focus: Editor.end(editor, [])
|
|
39
|
-
};
|
|
40
|
-
const before = extractTextWithNewlines(editor, beforeRange);
|
|
41
|
-
const after = extractTextWithNewlines(editor, afterRange);
|
|
42
|
-
const selectedText = extractTextWithNewlines(editor, wellOrderedSelection);
|
|
43
|
-
return {
|
|
44
|
-
selection: wellOrderedSelection,
|
|
45
|
-
textBeforeCursor: before,
|
|
46
|
-
selectedText,
|
|
47
|
-
textAfterCursor: after
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function getFullEditorTextWithNewlines(editor) {
|
|
51
|
-
const fullDocumentRange = {
|
|
52
|
-
anchor: Editor.start(editor, []),
|
|
53
|
-
focus: Editor.end(editor, [])
|
|
54
|
-
};
|
|
55
|
-
return extractTextWithNewlines(editor, fullDocumentRange);
|
|
56
|
-
}
|
|
57
|
-
function extractTextWithNewlines(editor, range) {
|
|
58
|
-
const voids = false;
|
|
59
|
-
const [start, end] = Range.edges(range);
|
|
60
|
-
let text = "";
|
|
61
|
-
let lastBlock = null;
|
|
62
|
-
for (const [node, path] of Editor.nodes(editor, {
|
|
63
|
-
at: range,
|
|
64
|
-
match: Text.isText,
|
|
65
|
-
voids
|
|
66
|
-
})) {
|
|
67
|
-
let t = node.text;
|
|
68
|
-
const [block] = Editor.above(editor, {
|
|
69
|
-
at: path,
|
|
70
|
-
match: (n) => Element.isElement(n) && n.type === "paragraph"
|
|
71
|
-
}) || [null];
|
|
72
|
-
if (lastBlock !== block && block) {
|
|
73
|
-
if (lastBlock) {
|
|
74
|
-
text += "\n";
|
|
75
|
-
}
|
|
76
|
-
lastBlock = block;
|
|
77
|
-
}
|
|
78
|
-
if (Path.equals(path, end.path)) {
|
|
79
|
-
t = t.slice(0, end.offset);
|
|
80
|
-
}
|
|
81
|
-
if (Path.equals(path, start.path)) {
|
|
82
|
-
t = t.slice(start.offset);
|
|
83
|
-
}
|
|
84
|
-
text += t;
|
|
85
|
-
}
|
|
86
|
-
return text;
|
|
87
|
-
}
|
|
88
|
-
function wellOrderedRange(range) {
|
|
89
|
-
const { anchor, focus } = range;
|
|
90
|
-
if (Point.isBefore(anchor, focus)) {
|
|
91
|
-
return range;
|
|
92
|
-
}
|
|
93
|
-
return {
|
|
94
|
-
anchor: focus,
|
|
95
|
-
focus: anchor
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export { extractTextWithNewlines, getFullEditorTextWithNewlines, getTextAroundCollapsedCursor, getTextAroundSelection };
|
|
100
|
-
//# sourceMappingURL=out.js.map
|
|
101
|
-
//# sourceMappingURL=chunk-ECR45NSD.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/get-text-around-cursor.ts"],"names":[],"mappings":";AAAA,SAAS,QAAc,MAAM,OAAO,MAAM,SAA+B,aAAa;AAW/E,SAAS,6BAA6B,QAAgD;AAC3F,QAAM,EAAE,UAAU,IAAI;AACtB,MAAI,CAAC,aAAa,CAAC,MAAM,YAAY,SAAS,GAAG;AAC/C,WAAO;AAAA,EACT;AAEA,QAAM,cAAc,UAAU;AAG9B,QAAM,cAAqB;AAAA,IACzB,QAAQ,OAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC/B,OAAO;AAAA,EACT;AACA,QAAM,aAAoB;AAAA,IACxB,QAAQ;AAAA,IACR,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,EAC9B;AAGA,QAAM,SAAS,wBAAwB,QAAQ,WAAW;AAC1D,QAAM,QAAQ,wBAAwB,QAAQ,UAAU;AAExD,SAAO;AAAA,IACL;AAAA,IACA,kBAAkB;AAAA,IAClB,iBAAiB;AAAA,EACnB;AACF;AAEO,SAAS,uBAAuB,QAAwC;AAC7E,QAAM,EAAE,UAAU,IAAI;AACtB,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,EACT;AAEA,QAAM,uBAAuB,iBAAiB,SAAS;AAGvD,QAAM,cAAqB;AAAA,IACzB,QAAQ,OAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC/B,OAAO,qBAAqB;AAAA,EAC9B;AACA,QAAM,aAAoB;AAAA,IACxB,QAAQ,qBAAqB;AAAA,IAC7B,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,EAC9B;AAGA,QAAM,SAAS,wBAAwB,QAAQ,WAAW;AAC1D,QAAM,QAAQ,wBAAwB,QAAQ,UAAU;AACxD,QAAM,eAAe,wBAAwB,QAAQ,oBAAoB;AAEzE,SAAO;AAAA,IACL,WAAW;AAAA,IACX,kBAAkB;AAAA,IAClB;AAAA,IACA,iBAAiB;AAAA,EACnB;AACF;AAEO,SAAS,8BAA8B,QAAwB;AACpE,QAAM,oBAA2B;AAAA,IAC/B,QAAQ,OAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC/B,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,EAC9B;AACA,SAAO,wBAAwB,QAAQ,iBAAiB;AAC1D;AAGO,SAAS,wBAAwB,QAAgB,OAAsB;AAC5E,QAAM,QAAQ;AACd,QAAM,CAAC,OAAO,GAAG,IAAI,MAAM,MAAM,KAAK;AACtC,MAAI,OAAO;AACX,MAAI,YAAyB;AAE7B,aAAW,CAAC,MAAM,IAAI,KAAK,OAAO,MAAM,QAAQ;AAAA,IAC9C,IAAI;AAAA,IACJ,OAAO,KAAK;AAAA,IACZ;AAAA,EACF,CAAC,GAAG;AACF,QAAI,IAAI,KAAK;AAGb,UAAM,CAAC,KAAK,IAAI,OAAO,MAAM,QAAQ;AAAA,MACnC,IAAI;AAAA,MACJ,OAAO,CAAC,MAAM,QAAQ,UAAU,CAAC,KAAK,EAAE,SAAS;AAAA,IACnD,CAAC,KAAK,CAAC,IAAI;AAGX,QAAI,cAAc,SAAS,OAAO;AAEhC,UAAI,WAAW;AACb,gBAAQ;AAAA,MACV;AACA,kBAAY;AAAA,IACd;AAEA,QAAI,KAAK,OAAO,MAAM,IAAI,IAAI,GAAG;AAC/B,UAAI,EAAE,MAAM,GAAG,IAAI,MAAM;AAAA,IAC3B;AAEA,QAAI,KAAK,OAAO,MAAM,MAAM,IAAI,GAAG;AACjC,UAAI,EAAE,MAAM,MAAM,MAAM;AAAA,IAC1B;AAEA,YAAQ;AAAA,EACV;AAEA,SAAO;AACT;AAEA,SAAS,iBAAiB,OAA6B;AACrD,QAAM,EAAE,QAAQ,MAAM,IAAI;AAE1B,MAAI,MAAM,SAAS,QAAQ,KAAK,GAAG;AACjC,WAAO;AAAA,EACT;AAGA,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,OAAO;AAAA,EACT;AACF","sourcesContent":["import { Editor, Node, Path, Range, Text, Element, BasePoint, BaseRange, Point } from \"slate\";\nimport { EditorAutocompleteState } from \"../types/base/editor-autocomplete-state\";\n\nexport interface EditorTextState {\n selection: BaseRange;\n\n textBeforeCursor: string;\n selectedText: string;\n textAfterCursor: string;\n}\n\nexport function getTextAroundCollapsedCursor(editor: Editor): EditorAutocompleteState | null {\n const { selection } = editor;\n if (!selection || !Range.isCollapsed(selection)) {\n return null;\n }\n\n const cursorPoint = selection.anchor;\n\n // Create two ranges: one before the anchor and one after\n const beforeRange: Range = {\n anchor: Editor.start(editor, []),\n focus: cursorPoint,\n };\n const afterRange: Range = {\n anchor: cursorPoint,\n focus: Editor.end(editor, []),\n };\n\n // Extract text for these ranges\n const before = extractTextWithNewlines(editor, beforeRange);\n const after = extractTextWithNewlines(editor, afterRange);\n\n return {\n cursorPoint: cursorPoint,\n textBeforeCursor: before,\n textAfterCursor: after,\n };\n}\n\nexport function getTextAroundSelection(editor: Editor): EditorTextState | null {\n const { selection } = editor;\n if (!selection) {\n return null;\n }\n\n const wellOrderedSelection = wellOrderedRange(selection);\n\n // Create two ranges: one before the anchor and one after\n const beforeRange: Range = {\n anchor: Editor.start(editor, []),\n focus: wellOrderedSelection.anchor,\n };\n const afterRange: Range = {\n anchor: wellOrderedSelection.focus,\n focus: Editor.end(editor, []),\n };\n\n // Extract text for these ranges\n const before = extractTextWithNewlines(editor, beforeRange);\n const after = extractTextWithNewlines(editor, afterRange);\n const selectedText = extractTextWithNewlines(editor, wellOrderedSelection);\n\n return {\n selection: wellOrderedSelection,\n textBeforeCursor: before,\n selectedText,\n textAfterCursor: after,\n };\n}\n\nexport function getFullEditorTextWithNewlines(editor: Editor): string {\n const fullDocumentRange: Range = {\n anchor: Editor.start(editor, []),\n focus: Editor.end(editor, []),\n };\n return extractTextWithNewlines(editor, fullDocumentRange);\n}\n\n// Helper function to extract text with newlines\nexport function extractTextWithNewlines(editor: Editor, range: Range): string {\n const voids = false;\n const [start, end] = Range.edges(range);\n let text = \"\";\n let lastBlock: Node | null = null;\n\n for (const [node, path] of Editor.nodes(editor, {\n at: range,\n match: Text.isText,\n voids,\n })) {\n let t = node.text;\n\n // Determine the parent block of the current text node\n const [block] = Editor.above(editor, {\n at: path,\n match: (n) => Element.isElement(n) && n.type === \"paragraph\",\n }) || [null];\n\n // If we encounter a new block, prepend a newline\n if (lastBlock !== block && block) {\n // check that lastBlock is not null to avoid adding a newline at the beginning\n if (lastBlock) {\n text += \"\\n\";\n }\n lastBlock = block;\n }\n\n if (Path.equals(path, end.path)) {\n t = t.slice(0, end.offset);\n }\n\n if (Path.equals(path, start.path)) {\n t = t.slice(start.offset);\n }\n\n text += t;\n }\n\n return text;\n}\n\nfunction wellOrderedRange(range: BaseRange): BaseRange {\n const { anchor, focus } = range;\n // if anchor is before focus, return range as is\n if (Point.isBefore(anchor, focus)) {\n return range;\n }\n\n // if focus is before anchor, return range with anchor and focus swapped\n return {\n anchor: focus,\n focus: anchor,\n };\n}\n"]}
|
package/dist/chunk-EPBVNDKE.mjs
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Label } from './chunk-KFQZHRPJ.mjs';
|
|
2
|
-
import Chip from '@mui/material/Chip/Chip.js';
|
|
3
|
-
import Avatar from '@mui/material/Avatar/Avatar.js';
|
|
4
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
-
|
|
6
|
-
var IncludedFilesPreview = ({
|
|
7
|
-
includedFiles,
|
|
8
|
-
setIncludedFiles
|
|
9
|
-
}) => {
|
|
10
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 mt-2", children: [
|
|
11
|
-
/* @__PURE__ */ jsx(Label, { className: "", children: "Included context:" }),
|
|
12
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: includedFiles.map((filePointer, index) => {
|
|
13
|
-
return /* @__PURE__ */ jsx(
|
|
14
|
-
FileChipPreview,
|
|
15
|
-
{
|
|
16
|
-
filePointer,
|
|
17
|
-
onDelete: () => {
|
|
18
|
-
setIncludedFiles((prev) => prev.filter((fp) => fp !== filePointer));
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
`file-${filePointer.sourceApplication}.${filePointer.name}`
|
|
22
|
-
);
|
|
23
|
-
}) })
|
|
24
|
-
] });
|
|
25
|
-
};
|
|
26
|
-
var FileChipPreview = ({ filePointer, onDelete }) => {
|
|
27
|
-
return /* @__PURE__ */ jsx(
|
|
28
|
-
Chip,
|
|
29
|
-
{
|
|
30
|
-
label: filePointer.name,
|
|
31
|
-
onDelete,
|
|
32
|
-
avatar: /* @__PURE__ */ jsx(
|
|
33
|
-
Avatar,
|
|
34
|
-
{
|
|
35
|
-
src: filePointer.iconImageUri,
|
|
36
|
-
alt: filePointer.sourceApplication,
|
|
37
|
-
sx: { backgroundColor: "transparent" }
|
|
38
|
-
}
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export { FileChipPreview, IncludedFilesPreview };
|
|
45
|
-
//# sourceMappingURL=out.js.map
|
|
46
|
-
//# sourceMappingURL=chunk-EPBVNDKE.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx"],"names":[],"mappings":";;;;;AAGA,OAAO,UAAU;AACjB,OAAO,YAAY;AAYf,SACE,KADF;AALG,IAAM,uBAA4D,CAAC;AAAA,EACxE;AAAA,EACA;AACF,MAAM;AACJ,SACE,qBAAC,SAAI,WAAU,4BACb;AAAA,wBAAC,SAAM,WAAU,IAAG,+BAAiB;AAAA,IACrC,oBAAC,SAAI,WAAU,wBACZ,wBAAc,IAAI,CAAC,aAAa,UAAU;AACzC,aACE;AAAA,QAAC;AAAA;AAAA,UAEC;AAAA,UACA,UAAU,MAAM;AACd,6BAAiB,CAAC,SAAS,KAAK,OAAO,CAAC,OAAO,OAAO,WAAW,CAAC;AAAA,UACpE;AAAA;AAAA,QAJK,QAAQ,YAAY,qBAAqB,YAAY;AAAA,MAK5D;AAAA,IAEJ,CAAC,GACH;AAAA,KACF;AAEJ;AAOO,IAAM,kBAAiD,CAAC,EAAE,aAAa,SAAS,MAAM;AAC3F,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,YAAY;AAAA,MACnB;AAAA,MACA,QACE;AAAA,QAAC;AAAA;AAAA,UACC,KAAK,YAAY;AAAA,UACjB,KAAK,YAAY;AAAA,UACjB,IAAI,EAAE,iBAAiB,cAAc;AAAA;AAAA,MACtC;AAAA;AAAA,EAEL;AAEJ","sourcesContent":["import { DocumentPointer } from \"@copilotkit/react-core\";\nimport { Label } from \"../../ui/label\";\nimport React from \"react\";\nimport Chip from \"@mui/material/Chip/Chip.js\";\nimport Avatar from \"@mui/material/Avatar/Avatar.js\";\n\nexport interface IncludedFilesPreviewProps {\n includedFiles: DocumentPointer[];\n setIncludedFiles: React.Dispatch<React.SetStateAction<DocumentPointer[]>>;\n}\n\nexport const IncludedFilesPreview: React.FC<IncludedFilesPreviewProps> = ({\n includedFiles,\n setIncludedFiles,\n}) => {\n return (\n <div className=\"flex flex-col gap-2 mt-2\">\n <Label className=\"\">Included context:</Label>\n <div className=\"flex flex-wrap gap-2\">\n {includedFiles.map((filePointer, index) => {\n return (\n <FileChipPreview\n key={`file-${filePointer.sourceApplication}.${filePointer.name}`}\n filePointer={filePointer}\n onDelete={() => {\n setIncludedFiles((prev) => prev.filter((fp) => fp !== filePointer));\n }}\n />\n );\n })}\n </div>\n </div>\n );\n};\n\nexport interface FileChipPreviewProp {\n filePointer: DocumentPointer;\n onDelete: () => void;\n}\n\nexport const FileChipPreview: React.FC<FileChipPreviewProp> = ({ filePointer, onDelete }) => {\n return (\n <Chip\n label={filePointer.name}\n onDelete={onDelete}\n avatar={\n <Avatar\n src={filePointer.iconImageUri}\n alt={filePointer.sourceApplication}\n sx={{ backgroundColor: \"transparent\" }}\n ></Avatar>\n }\n />\n );\n};\n"]}
|
package/dist/chunk-FJNUPSQK.mjs
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandSeparator } from './chunk-WTASPE2W.mjs';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
function SourceSearchBox(props) {
|
|
6
|
-
const [selectedValue, setSelectedValue] = useState("");
|
|
7
|
-
return /* @__PURE__ */ jsxs(
|
|
8
|
-
Command,
|
|
9
|
-
{
|
|
10
|
-
className: "rounded-lg border shadow-md",
|
|
11
|
-
value: selectedValue,
|
|
12
|
-
onValueChange: (value) => {
|
|
13
|
-
setSelectedValue(value);
|
|
14
|
-
},
|
|
15
|
-
filter: (value, search) => {
|
|
16
|
-
if (props.searchTerm === "")
|
|
17
|
-
return 1;
|
|
18
|
-
if (value.startsWith(props.searchTerm))
|
|
19
|
-
return 1;
|
|
20
|
-
return 0;
|
|
21
|
-
},
|
|
22
|
-
children: [
|
|
23
|
-
/* @__PURE__ */ jsx(
|
|
24
|
-
CommandInput,
|
|
25
|
-
{
|
|
26
|
-
value: props.searchTerm,
|
|
27
|
-
className: "rounded-t-lg hidden",
|
|
28
|
-
placeholder: "Search for a command..."
|
|
29
|
-
}
|
|
30
|
-
),
|
|
31
|
-
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
32
|
-
/* @__PURE__ */ jsx(CommandEmpty, { children: "No results found." }),
|
|
33
|
-
/* @__PURE__ */ jsx(CommandGroup, { heading: "Available resources", children: props.suggestedFiles.map((filePointer) => {
|
|
34
|
-
return /* @__PURE__ */ jsx(
|
|
35
|
-
CommandItem,
|
|
36
|
-
{
|
|
37
|
-
value: filePointer.name,
|
|
38
|
-
onSelect: (value) => {
|
|
39
|
-
props.onSelectedFile(filePointer);
|
|
40
|
-
},
|
|
41
|
-
children: /* @__PURE__ */ jsxs("div", { className: " px-3 flex flex-row gap-1 items-center", children: [
|
|
42
|
-
/* @__PURE__ */ jsx(Logo, { width: "20px", height: "20px", children: /* @__PURE__ */ jsx(
|
|
43
|
-
"img",
|
|
44
|
-
{
|
|
45
|
-
src: filePointer.iconImageUri,
|
|
46
|
-
alt: filePointer.sourceApplication,
|
|
47
|
-
className: "w-full h-full"
|
|
48
|
-
}
|
|
49
|
-
) }),
|
|
50
|
-
filePointer.name
|
|
51
|
-
] })
|
|
52
|
-
},
|
|
53
|
-
`word-${filePointer.sourceApplication}.${filePointer.name}`
|
|
54
|
-
);
|
|
55
|
-
}) }),
|
|
56
|
-
/* @__PURE__ */ jsx(CommandSeparator, {})
|
|
57
|
-
] })
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
function Logo({
|
|
63
|
-
children,
|
|
64
|
-
width,
|
|
65
|
-
height
|
|
66
|
-
}) {
|
|
67
|
-
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", style: { width, height }, children });
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { Logo, SourceSearchBox };
|
|
71
|
-
//# sourceMappingURL=out.js.map
|
|
72
|
-
//# sourceMappingURL=chunk-FJNUPSQK.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/source-search-box/source-search-box.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,SAAS,gBAAgB;AA4CnB,cAkBU,YAlBV;AArBC,SAAS,gBAAgB,OAA6B;AAC3D,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAiB,EAAE;AAE7D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,OAAO;AAAA,MACP,eAAe,CAAC,UAAU;AACxB,yBAAiB,KAAK;AAAA,MACxB;AAAA,MACA,QAAQ,CAAC,OAAO,WAAW;AAEzB,YAAI,MAAM,eAAe;AAAI,iBAAO;AAGpC,YAAI,MAAM,WAAW,MAAM,UAAU;AAAG,iBAAO;AAG/C,eAAO;AAAA,MACT;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,MAAM;AAAA,YACb,WAAU;AAAA,YACV,aAAY;AAAA;AAAA,QACd;AAAA,QACA,qBAAC,eACC;AAAA,8BAAC,gBAAa,+BAAiB;AAAA,UAE/B,oBAAC,gBAAa,SAAQ,uBACnB,gBAAM,eAAe,IAAI,CAAC,gBAAgB;AACzC,mBACE;AAAA,cAAC;AAAA;AAAA,gBAEC,OAAO,YAAY;AAAA,gBACnB,UAAU,CAAC,UAAU;AACnB,wBAAM,eAAe,WAAW;AAAA,gBAClC;AAAA,gBAEA,+BAAC,SAAI,WAAU,2CACb;AAAA,sCAAC,QAAK,OAAM,QAAO,QAAO,QACxB;AAAA,oBAAC;AAAA;AAAA,sBACC,KAAK,YAAY;AAAA,sBACjB,KAAK,YAAY;AAAA,sBACjB,WAAU;AAAA;AAAA,kBACZ,GACF;AAAA,kBACC,YAAY;AAAA,mBACf;AAAA;AAAA,cAfK,QAAQ,YAAY,qBAAqB,YAAY;AAAA,YAgB5D;AAAA,UAEJ,CAAC,GACH;AAAA,UAqBA,oBAAC,oBAAiB;AAAA,WACpB;AAAA;AAAA;AAAA,EACF;AAEJ;AAEO,SAAS,KAAK;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,SACE,oBAAC,SAAI,WAAU,oCAAmC,OAAO,EAAE,OAAc,OAAe,GACrF,UACH;AAEJ","sourcesContent":["import { useState } from \"react\";\nimport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n} from \"../ui/command\";\n\nimport { Calculator, Calendar, CreditCard, Settings, Smile, User } from \"lucide-react\";\n\nimport { DocumentPointer } from \"@copilotkit/react-core\";\n\nexport interface SourceSearchBoxProps {\n searchTerm: string;\n suggestedFiles: DocumentPointer[];\n onSelectedFile: (filePointer: DocumentPointer) => void;\n}\n\nexport function SourceSearchBox(props: SourceSearchBoxProps) {\n const [selectedValue, setSelectedValue] = useState<string>(\"\");\n\n return (\n <Command\n className=\"rounded-lg border shadow-md\"\n value={selectedValue}\n onValueChange={(value) => {\n setSelectedValue(value);\n }}\n filter={(value, search) => {\n // if the search term is empty, show all commands\n if (props.searchTerm === \"\") return 1;\n\n // if the search term is a prefix of the command, show it\n if (value.startsWith(props.searchTerm)) return 1;\n\n // otherwise, don't show it\n return 0;\n }}\n >\n <CommandInput\n value={props.searchTerm}\n className=\"rounded-t-lg hidden\"\n placeholder=\"Search for a command...\"\n />\n <CommandList>\n <CommandEmpty>No results found.</CommandEmpty>\n\n <CommandGroup heading=\"Available resources\">\n {props.suggestedFiles.map((filePointer) => {\n return (\n <CommandItem\n key={`word-${filePointer.sourceApplication}.${filePointer.name}`}\n value={filePointer.name}\n onSelect={(value) => {\n props.onSelectedFile(filePointer);\n }}\n >\n <div className=\" px-3 flex flex-row gap-1 items-center\">\n <Logo width=\"20px\" height=\"20px\">\n <img\n src={filePointer.iconImageUri}\n alt={filePointer.sourceApplication}\n className=\"w-full h-full\"\n />\n </Logo>\n {filePointer.name}\n </div>\n </CommandItem>\n );\n })}\n </CommandGroup>\n\n {/* <CommandGroup heading=\"Suggestions\">\n <CommandItem\n onSelect={(value) => {\n console.log(value);\n console.log(value);\n }}\n >\n <Calendar className=\"mr-2 h-4 w-4\" />\n <span>Calendar</span>\n </CommandItem>\n <CommandItem>\n <Smile className=\"mr-2 h-4 w-4\" />\n <span>Search Emoji</span>\n </CommandItem>\n <CommandItem>\n <Calculator className=\"mr-2 h-4 w-4\" />\n <span>Calculator</span>\n </CommandItem>\n </CommandGroup> */}\n <CommandSeparator />\n </CommandList>\n </Command>\n );\n}\n\nexport function Logo({\n children,\n width,\n height,\n}: {\n children: React.ReactNode;\n width: string;\n height: string;\n}) {\n return (\n <div className=\"flex items-center justify-center\" style={{ width: width, height: height }}>\n {children}\n </div>\n );\n}\n"]}
|
package/dist/chunk-FP2EKU3L.mjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { defaultCopilotContextCategories } from '@copilotkit/react-core';
|
|
2
|
-
|
|
3
|
-
// src/types/base/base-autosuggestions-config.tsx
|
|
4
|
-
var defaultShouldToggleHoveringEditorOnKeyPress = (event) => {
|
|
5
|
-
if (event.key === "k" && event.metaKey) {
|
|
6
|
-
return true;
|
|
7
|
-
}
|
|
8
|
-
return false;
|
|
9
|
-
};
|
|
10
|
-
var defaultShouldAcceptAutosuggestionOnKeyPress = (event) => {
|
|
11
|
-
if (event.key === "Tab") {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
return false;
|
|
15
|
-
};
|
|
16
|
-
var defaultBaseAutosuggestionsConfig = {
|
|
17
|
-
debounceTime: 250,
|
|
18
|
-
contextCategories: defaultCopilotContextCategories,
|
|
19
|
-
disableWhenEmpty: true,
|
|
20
|
-
disabled: false,
|
|
21
|
-
temporarilyDisableWhenMovingCursorWithoutChangingText: true,
|
|
22
|
-
shouldToggleHoveringEditorOnKeyPress: defaultShouldToggleHoveringEditorOnKeyPress,
|
|
23
|
-
shouldAcceptAutosuggestionOnKeyPress: defaultShouldAcceptAutosuggestionOnKeyPress
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export { defaultBaseAutosuggestionsConfig };
|
|
27
|
-
//# sourceMappingURL=out.js.map
|
|
28
|
-
//# sourceMappingURL=chunk-FP2EKU3L.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/base/base-autosuggestions-config.tsx"],"names":[],"mappings":";AACA,SAAS,uCAAuC;AAyDhD,IAAM,8CAA8C,CAClD,UACG;AAEH,MAAI,MAAM,QAAQ,OAAO,MAAM,SAAS;AACtC,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,IAAM,8CAA8C,CAClD,UACG;AAEH,MAAI,MAAM,QAAQ,OAAO;AACvB,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAcO,IAAM,mCAGT;AAAA,EACF,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,uDAAuD;AAAA,EACvD,sCAAsC;AAAA,EACtC,sCAAsC;AACxC","sourcesContent":["import { BaseCopilotTextareaApiConfig } from \"./autosuggestions-bare-function\";\nimport { defaultCopilotContextCategories } from \"@copilotkit/react-core\";\n\n/**\n * @interface BaseAutosuggestionsConfig\n *\n * @property {string} textareaPurpose - The purpose of the textarea. This is used to guide the autosuggestions.\n *\n * @property {string[]} contextCategories - The categories of context to consider when providing autosuggestions.\n *\n * @property {number} debounceTime - The amount of time (in milliseconds) to wait before triggering autosuggestions after the user has stopped typing.\n *\n * @property {BaseCopilotTextareaApiConfig} apiConfig - The configuration for the API that provides the autosuggestions.\n *\n * @property {boolean} disableWhenEmpty - Whether to disable autosuggestions when the textarea is empty.\n *\n * @property {boolean} disabled - Whether to disable autosuggestions entirely.\n *\n * @property {boolean} temporarilyDisableWhenMovingCursorWithoutChangingText - Whether to temporarily disable autosuggestions when the user moves the cursor without changing the text.\n *\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnKeyPress - A function that determines whether to accept the current autosuggestion based on a key press event. By default, the Tab key is used to accept the autosuggestion. Example code:\n *\n * ```typescript\n * const defaultShouldAcceptAutosuggestionOnKeyPress = (event: React.KeyboardEvent<HTMLDivElement>) => {\n * // if tab, accept the autosuggestion\n * if (event.key === \"Tab\") {\n * return true;\n * }\n * return false;\n * }\n * ```\n *\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldToggleHoveringEditorOnKeyPress - A function that determines whether to toggle the hovering editor based on a key press event. By default, the Command + K key combination is used to toggle the hovering editor. Example code:\n *\n * ```typescript\n * const defaultShouldToggleHoveringEditorOnKeyPress = (event: React.KeyboardEvent<HTMLDivElement>) => {\n * // if command-k, toggle the hovering editor\n * if (event.key === \"k\" && event.metaKey) {\n * return true;\n * }\n * return false;\n * }\n * ```\n */\nexport interface BaseAutosuggestionsConfig {\n textareaPurpose: string;\n contextCategories: string[];\n debounceTime: number;\n apiConfig: BaseCopilotTextareaApiConfig;\n\n disableWhenEmpty: boolean;\n disabled: boolean;\n temporarilyDisableWhenMovingCursorWithoutChangingText: boolean;\n shouldAcceptAutosuggestionOnKeyPress: (event: React.KeyboardEvent<HTMLDivElement>) => boolean;\n shouldToggleHoveringEditorOnKeyPress: (event: React.KeyboardEvent<HTMLDivElement>) => boolean;\n}\n\n// by default, command-k toggles the hovering editor\nconst defaultShouldToggleHoveringEditorOnKeyPress = (\n event: React.KeyboardEvent<HTMLDivElement>,\n) => {\n // if command-k, toggle the hovering editor\n if (event.key === \"k\" && event.metaKey) {\n return true;\n }\n return false;\n};\n\nconst defaultShouldAcceptAutosuggestionOnKeyPress = (\n event: React.KeyboardEvent<HTMLDivElement>,\n) => {\n // if tab, accept the autosuggestion\n if (event.key === \"Tab\") {\n return true;\n }\n return false;\n};\n\n/**\n * Default configuration for the BaseAutosuggestions.\n *\n * @property {number} debounceTime - The amount of time to wait before triggering the autosuggestions API call.\n * @property {string[]} contextCategories - The categories to use for context when making the autosuggestions API call.\n * @property {boolean} disableWhenEmpty - Whether to disable the autosuggestions when the textarea is empty.\n * @property {boolean} disabled - Whether to disable the autosuggestions feature entirely.\n * @property {boolean} temporarilyDisableWhenMovingCursorWithoutChangingText - Whether to temporarily disable the autosuggestions when the cursor is moved without changing the text.\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldToggleHoveringEditorOnKeyPress - A function that determines whether to toggle the hovering editor based on a key press event.\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnKeyPress - A function that determines whether to accept the autosuggestion based on a key press event.\n */\n\nexport const defaultBaseAutosuggestionsConfig: Omit<\n BaseAutosuggestionsConfig,\n \"textareaPurpose\" | \"apiConfig\"\n> = {\n debounceTime: 250,\n contextCategories: defaultCopilotContextCategories,\n disableWhenEmpty: true,\n disabled: false,\n temporarilyDisableWhenMovingCursorWithoutChangingText: true,\n shouldToggleHoveringEditorOnKeyPress: defaultShouldToggleHoveringEditorOnKeyPress,\n shouldAcceptAutosuggestionOnKeyPress: defaultShouldAcceptAutosuggestionOnKeyPress,\n};\n"]}
|
package/dist/chunk-GQN2HYFJ.mjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Node, Element, Transforms } from 'slate';
|
|
2
|
-
|
|
3
|
-
// src/lib/slatejs-edits/clear-autocompletions.ts
|
|
4
|
-
function clearAutocompletionsFromEditor(editor) {
|
|
5
|
-
const paths = [];
|
|
6
|
-
for (const [node, path] of Node.nodes(editor)) {
|
|
7
|
-
if (Element.isElement(node) && node.type === "suggestion") {
|
|
8
|
-
paths.push(path);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
for (const path of paths) {
|
|
12
|
-
try {
|
|
13
|
-
Transforms.removeNodes(editor, { at: path });
|
|
14
|
-
} catch (e) {
|
|
15
|
-
console.log("CopilotTextarea.clearAutocompletionsFromEditor: error removing node", e);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { clearAutocompletionsFromEditor };
|
|
21
|
-
//# sourceMappingURL=out.js.map
|
|
22
|
-
//# sourceMappingURL=chunk-GQN2HYFJ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/slatejs-edits/clear-autocompletions.ts"],"names":[],"mappings":";AAAA,SAAS,SAAS,MAAY,kBAAkB;AAGzC,SAAS,+BAA+B,QAAsB;AAEnE,QAAM,QAAgB,CAAC;AACvB,aAAW,CAAC,MAAM,IAAI,KAAK,KAAK,MAAM,MAAM,GAAG;AAC7C,QAAI,QAAQ,UAAU,IAAI,KAAK,KAAK,SAAS,cAAc;AACzD,YAAM,KAAK,IAAI;AAAA,IACjB;AAAA,EACF;AACA,aAAW,QAAQ,OAAO;AACxB,QAAI;AACF,iBAAW,YAAY,QAAQ,EAAE,IAAI,KAAK,CAAC;AAAA,IAC7C,SAAS,GAAP;AACA,cAAQ,IAAI,uEAAuE,CAAC;AAAA,IACtF;AAAA,EACF;AACF","sourcesContent":["import { Element, Node, Path, Transforms } from \"slate\";\nimport { CustomEditor } from \"../../types/base/custom-editor\";\n\nexport function clearAutocompletionsFromEditor(editor: CustomEditor) {\n // clear previous suggestion\n const paths: Path[] = [];\n for (const [node, path] of Node.nodes(editor)) {\n if (Element.isElement(node) && node.type === \"suggestion\") {\n paths.push(path);\n }\n }\n for (const path of paths) {\n try {\n Transforms.removeNodes(editor, { at: path });\n } catch (e) {\n console.log(\"CopilotTextarea.clearAutocompletionsFromEditor: error removing node\", e);\n }\n }\n}\n"]}
|
package/dist/chunk-H4VKQGVU.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/chunk-HSCZA5TS.mjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { HoveringInsertionPromptBoxCore } from './chunk-KTTN5H7S.mjs';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
|
|
4
|
-
var HoveringInsertionPromptBox = (props) => {
|
|
5
|
-
return /* @__PURE__ */ jsx(
|
|
6
|
-
"div",
|
|
7
|
-
{
|
|
8
|
-
className: "flex flex-col justify-center items-center space-y-4 rounded-md border shadow-lg p-4 border-gray- bg-white",
|
|
9
|
-
style: { width: "35rem" },
|
|
10
|
-
children: /* @__PURE__ */ jsx(
|
|
11
|
-
HoveringInsertionPromptBoxCore,
|
|
12
|
-
{
|
|
13
|
-
state: {
|
|
14
|
-
editorState: props.editorState
|
|
15
|
-
},
|
|
16
|
-
insertionOrEditingFunction: props.apiConfig.insertionOrEditingFunction,
|
|
17
|
-
performInsertion: props.performInsertion,
|
|
18
|
-
contextCategories: props.contextCategories
|
|
19
|
-
}
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export { HoveringInsertionPromptBox };
|
|
26
|
-
//# sourceMappingURL=out.js.map
|
|
27
|
-
//# sourceMappingURL=chunk-HSCZA5TS.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx"],"names":[],"mappings":";;;;;AAqBM;AANC,IAAM,6BAA8C,CAAC,UAAU;AACpE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,OAAO,EAAE,OAAO,QAAQ;AAAA,MAExB;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,YACL,aAAa,MAAM;AAAA,UACrB;AAAA,UACA,4BAA4B,MAAM,UAAU;AAAA,UAC5C,kBAAkB,MAAM;AAAA,UACxB,mBAAmB,MAAM;AAAA;AAAA,MAC3B;AAAA;AAAA,EACF;AAEJ","sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport { HoveringInsertionPromptBoxCore } from \"./hovering-insertion-prompt-box-core\";\nimport {\n EditingEditorState,\n InsertionEditorApiConfig,\n} from \"../../../types/base/autosuggestions-bare-function\";\n\nexport interface Props {\n editorState: EditingEditorState;\n apiConfig: InsertionEditorApiConfig;\n performInsertion: (insertedText: string) => void;\n closeWindow: () => void;\n contextCategories: string[];\n}\n\nexport const HoveringInsertionPromptBox: React.FC<Props> = (props) => {\n return (\n <div\n className=\"flex flex-col justify-center items-center space-y-4 rounded-md border shadow-lg p-4 border-gray- bg-white\"\n style={{ width: \"35rem\" }}\n >\n <HoveringInsertionPromptBoxCore\n state={{\n editorState: props.editorState,\n }}\n insertionOrEditingFunction={props.apiConfig.insertionOrEditingFunction}\n performInsertion={props.performInsertion}\n contextCategories={props.contextCategories}\n />\n </div>\n );\n};\n"]}
|
package/dist/chunk-IU3WTXLQ.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/chunk-JJLQVT7S.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { arraysAreEqual } from './chunk-7SUZ6CXM.mjs';
|
|
2
|
-
|
|
3
|
-
// src/types/base/editor-autocomplete-state.ts
|
|
4
|
-
function areEqual_autocompleteState(prev, next) {
|
|
5
|
-
return prev.cursorPoint.offset === next.cursorPoint.offset && arraysAreEqual(prev.cursorPoint.path, next.cursorPoint.path) && prev.textBeforeCursor === next.textBeforeCursor && prev.textAfterCursor === next.textAfterCursor;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export { areEqual_autocompleteState };
|
|
9
|
-
//# sourceMappingURL=out.js.map
|
|
10
|
-
//# sourceMappingURL=chunk-JJLQVT7S.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/base/editor-autocomplete-state.ts"],"names":[],"mappings":";;;;;AASO,SAAS,2BACd,MACA,MACA;AACA,SACE,KAAK,YAAY,WAAW,KAAK,YAAY,UAC7C,eAAe,KAAK,YAAY,MAAM,KAAK,YAAY,IAAI,KAC3D,KAAK,qBAAqB,KAAK,oBAC/B,KAAK,oBAAoB,KAAK;AAElC","sourcesContent":["import { BasePoint } from \"slate\";\nimport { arraysAreEqual } from \"../../lib/utils\";\n\nexport interface EditorAutocompleteState {\n cursorPoint: BasePoint;\n textBeforeCursor: string;\n textAfterCursor: string;\n}\n\nexport function areEqual_autocompleteState(\n prev: EditorAutocompleteState,\n next: EditorAutocompleteState,\n) {\n return (\n prev.cursorPoint.offset === next.cursorPoint.offset &&\n arraysAreEqual(prev.cursorPoint.path, next.cursorPoint.path) &&\n prev.textBeforeCursor === next.textBeforeCursor &&\n prev.textAfterCursor === next.textAfterCursor\n );\n}\n"]}
|
package/dist/chunk-K5LNB36H.mjs
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
// src/types/autosuggestions-config/editing-api-config.tsx
|
|
2
|
-
var defaultEditingMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
3
|
-
return `You are a versatile writing assistant.
|
|
4
|
-
|
|
5
|
-
The user is writing some text.
|
|
6
|
-
The purpose is: "${textareaPurpose}"
|
|
7
|
-
|
|
8
|
-
The following external context is also provided. Use it to help you make better suggestions!!!
|
|
9
|
-
\`\`\`
|
|
10
|
-
${contextString}
|
|
11
|
-
\`\`\`
|
|
12
|
-
|
|
13
|
-
The user also provides you with a prompt for EDITING some text they are writing.
|
|
14
|
-
Your job is to come up with an EDIT of the text that the user would like to use - AS BEST YOU CAN.
|
|
15
|
-
|
|
16
|
-
Adjust yourself to the user's style and implied intent.
|
|
17
|
-
|
|
18
|
-
The user will provide the following information; use this to infer the best relevant EDIT:
|
|
19
|
-
<TextBeforeCursor>
|
|
20
|
-
<TextToEdit>
|
|
21
|
-
<TextAfterCursor>
|
|
22
|
-
<EditingPrompt>
|
|
23
|
-
|
|
24
|
-
<YourEditSuggestion>
|
|
25
|
-
`;
|
|
26
|
-
};
|
|
27
|
-
var defaultEditingFewShotMessages = [
|
|
28
|
-
{
|
|
29
|
-
role: "user",
|
|
30
|
-
name: "TextBeforeCursor",
|
|
31
|
-
content: "This morning I woke up and went straight to the grocery store. "
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
role: "user",
|
|
35
|
-
name: "TextToEdit",
|
|
36
|
-
content: "While I was there I also picked up some apples, oranges, and bananas. "
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
role: "user",
|
|
40
|
-
name: "TextAfterCursor",
|
|
41
|
-
content: "The grocery store was having a sale on fruit, so I decided to stock up."
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
role: "user",
|
|
45
|
-
name: "EditingPrompt",
|
|
46
|
-
content: "I bought a big watermelon"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
role: "assistant",
|
|
50
|
-
content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
role: "user",
|
|
54
|
-
name: "TextAfterCursor",
|
|
55
|
-
content: "and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof."
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
role: "user",
|
|
59
|
-
name: "TextBeforeCursor",
|
|
60
|
-
content: `The Optionholder, in the Optionholder's capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an "Equityholder" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an "Equityholder" thereunder;`
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
role: "user",
|
|
64
|
-
name: "InsertionPrompt",
|
|
65
|
-
content: "add section about the optionholder's pro rata share"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
role: "assistant",
|
|
69
|
-
content: ` (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder's "Pro Rata Share"; `
|
|
70
|
-
}
|
|
71
|
-
];
|
|
72
|
-
var defaultEditingApiConfig = {
|
|
73
|
-
makeSystemPrompt: defaultEditingMakeSystemPrompt,
|
|
74
|
-
fewShotMessages: defaultEditingFewShotMessages,
|
|
75
|
-
forwardedParams: void 0
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export { defaultEditingApiConfig, defaultEditingFewShotMessages, defaultEditingMakeSystemPrompt };
|
|
79
|
-
//# sourceMappingURL=out.js.map
|
|
80
|
-
//# sourceMappingURL=chunk-K5LNB36H.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/autosuggestions-config/editing-api-config.tsx"],"names":[],"mappings":";AASO,IAAM,iCAAmD,CAC9D,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW;AAAA;AAAA;AAAA;AAAA,EAIlB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBF;AAEO,IAAM,gCAAyD;AAAA,EACpE;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AACF;AAEO,IAAM,0BAA4C;AAAA,EACvD,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB","sourcesContent":["import { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\nimport { MinimalChatGPTMessage } from \"./subtypes/minimal-chat-gpt-message\";\n\nexport interface EditingApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: MinimalChatGPTMessage[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultEditingMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString,\n) => {\n return `You are a versatile writing assistant.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nThe following external context is also provided. Use it to help you make better suggestions!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThe user also provides you with a prompt for EDITING some text they are writing. \nYour job is to come up with an EDIT of the text that the user would like to use - AS BEST YOU CAN.\n\nAdjust yourself to the user's style and implied intent.\n\nThe user will provide the following information; use this to infer the best relevant EDIT:\n<TextBeforeCursor>\n<TextToEdit>\n<TextAfterCursor>\n<EditingPrompt>\n\n<YourEditSuggestion>\n`;\n};\n\nexport const defaultEditingFewShotMessages: MinimalChatGPTMessage[] = [\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: \"This morning I woke up and went straight to the grocery store. \",\n },\n {\n role: \"user\",\n name: \"TextToEdit\",\n content: \"While I was there I also picked up some apples, oranges, and bananas. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content: \"The grocery store was having a sale on fruit, so I decided to stock up.\",\n },\n {\n role: \"user\",\n name: \"EditingPrompt\",\n content: \"I bought a big watermelon\",\n },\n {\n role: \"assistant\",\n content:\n \" When I arrived I went straight to the produce section and picked out a big watermelon. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.\",\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content:\n 'The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;',\n },\n {\n role: \"user\",\n name: \"InsertionPrompt\",\n content: \"add section about the optionholder's pro rata share\",\n },\n {\n role: \"assistant\",\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n },\n];\n\nexport const defaultEditingApiConfig: EditingApiConfig = {\n makeSystemPrompt: defaultEditingMakeSystemPrompt,\n fewShotMessages: defaultEditingFewShotMessages,\n forwardedParams: undefined,\n};\n"]}
|
package/dist/chunk-KDVMG3XF.mjs
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// src/types/autosuggestions-config/suggestions-api-config.tsx
|
|
2
|
-
var defaultSuggestionsMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
3
|
-
return `You are a versatile writing assistant.
|
|
4
|
-
|
|
5
|
-
The user is writing some text.
|
|
6
|
-
The purpose is: "${textareaPurpose}"
|
|
7
|
-
|
|
8
|
-
Your job is to guess what the user will write next AS BEST YOU CAN.
|
|
9
|
-
Only guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.
|
|
10
|
-
|
|
11
|
-
Adjust yourself to the user's style and implied intent.
|
|
12
|
-
|
|
13
|
-
The user will provide both the text before and after the cursor. You should use this to infer what the user is likely to write next.
|
|
14
|
-
<TextAfterCursor>
|
|
15
|
-
<TextBeforeCursor>
|
|
16
|
-
<YourSuggestion>
|
|
17
|
-
|
|
18
|
-
If we need to add a whitespace character to the suggested text, make sure to explicitly add it in.
|
|
19
|
-
|
|
20
|
-
The following external context is also provided. Use it to help you make better suggestions!!!
|
|
21
|
-
\`\`\`
|
|
22
|
-
${contextString}
|
|
23
|
-
\`\`\`
|
|
24
|
-
`;
|
|
25
|
-
};
|
|
26
|
-
var defaultSuggestionsFewShotMessages = [
|
|
27
|
-
{
|
|
28
|
-
role: "user",
|
|
29
|
-
name: "TextAfterCursor",
|
|
30
|
-
content: "While I was there I also picked up some apples, oranges, and bananas."
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
role: "user",
|
|
34
|
-
content: "This morning I woke up and went straight to the grocery store."
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
role: "assistant",
|
|
38
|
-
content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
role: "user",
|
|
42
|
-
name: "TextAfterCursor",
|
|
43
|
-
content: "and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof."
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
role: "user",
|
|
47
|
-
name: "TextBeforeCursor",
|
|
48
|
-
content: `The Optionholder, in the Optionholder's capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an "Equityholder" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an "Equityholder" thereunder;`
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
role: "assistant",
|
|
52
|
-
content: ` (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder's "Pro Rata Share"; `
|
|
53
|
-
}
|
|
54
|
-
];
|
|
55
|
-
var defaultSuggestionsApiConfig = {
|
|
56
|
-
makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,
|
|
57
|
-
fewShotMessages: defaultSuggestionsFewShotMessages,
|
|
58
|
-
forwardedParams: void 0
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export { defaultSuggestionsApiConfig, defaultSuggestionsFewShotMessages, defaultSuggestionsMakeSystemPrompt };
|
|
62
|
-
//# sourceMappingURL=out.js.map
|
|
63
|
-
//# sourceMappingURL=chunk-KDVMG3XF.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/autosuggestions-config/suggestions-api-config.tsx"],"names":[],"mappings":";AASO,IAAM,qCAAuD,CAClE,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBlB;AAAA;AAAA;AAGF;AAEO,IAAM,oCAA6D;AAAA,EACxE;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AACF;AAEO,IAAM,8BAAoD;AAAA,EAC/D,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB","sourcesContent":["import { MinimalChatGPTMessage } from \"./subtypes/minimal-chat-gpt-message\";\nimport { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\n\nexport interface SuggestionsApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: MinimalChatGPTMessage[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultSuggestionsMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString,\n) => {\n return `You are a versatile writing assistant.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nYour job is to guess what the user will write next AS BEST YOU CAN.\nOnly guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.\n\nAdjust yourself to the user's style and implied intent.\n\nThe user will provide both the text before and after the cursor. You should use this to infer what the user is likely to write next.\n<TextAfterCursor>\n<TextBeforeCursor>\n<YourSuggestion>\n\nIf we need to add a whitespace character to the suggested text, make sure to explicitly add it in.\n\nThe following external context is also provided. Use it to help you make better suggestions!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n`;\n};\n\nexport const defaultSuggestionsFewShotMessages: MinimalChatGPTMessage[] = [\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content: \"While I was there I also picked up some apples, oranges, and bananas.\",\n },\n {\n role: \"user\",\n content: \"This morning I woke up and went straight to the grocery store.\",\n },\n {\n role: \"assistant\",\n content:\n \" When I arrived I went straight to the produce section and picked out a big watermelon. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.\",\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content:\n 'The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;',\n },\n {\n role: \"assistant\",\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n },\n];\n\nexport const defaultSuggestionsApiConfig: SuggestionsApiConfig = {\n makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,\n fewShotMessages: defaultSuggestionsFewShotMessages,\n forwardedParams: undefined,\n};\n"]}
|
package/dist/chunk-KFQZHRPJ.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { cn } from './chunk-7SUZ6CXM.mjs';
|
|
2
|
-
import { __objRest, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
5
|
-
import { cva } from 'class-variance-authority';
|
|
6
|
-
import { jsx } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
var labelVariants = cva(
|
|
9
|
-
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
10
|
-
);
|
|
11
|
-
var Label = React.forwardRef((_a, ref) => {
|
|
12
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
13
|
-
return /* @__PURE__ */ jsx(LabelPrimitive.Root, __spreadValues({ ref, className: cn(labelVariants(), className) }, props));
|
|
14
|
-
});
|
|
15
|
-
Label.displayName = LabelPrimitive.Root.displayName;
|
|
16
|
-
|
|
17
|
-
export { Label };
|
|
18
|
-
//# sourceMappingURL=out.js.map
|
|
19
|
-
//# sourceMappingURL=chunk-KFQZHRPJ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ui/label.tsx"],"names":[],"mappings":";;;;;;;;;AAEA,YAAY,WAAW;AACvB,YAAY,oBAAoB;AAChC,SAAS,WAA8B;AAYrC;AARF,IAAM,gBAAgB;AAAA,EACpB;AACF;AAEA,IAAM,QAAc,iBAGlB,CAAC,IAAyB,QAAK;AAA9B,eAAE,YAfL,IAeG,IAAgB,kBAAhB,IAAgB,CAAd;AACH,6BAAgB,qBAAf,iBAAoB,KAAU,WAAW,GAAG,cAAc,GAAG,SAAS,KAAO,MAAO;AAAA,CACtF;AACD,MAAM,cAA6B,oBAAK","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n);\n\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & VariantProps<typeof labelVariants>\n>(({ className, ...props }, ref) => (\n <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />\n));\nLabel.displayName = LabelPrimitive.Root.displayName;\n\nexport { Label };\n"]}
|
package/dist/chunk-KNQIEOFP.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// src/lib/retry.tsx
|
|
2
|
-
function retry(fn, retriesLeft = 2, interval = 200, backoff = 1.5) {
|
|
3
|
-
return new Promise((resolve, reject) => {
|
|
4
|
-
fn().then(resolve).catch((error) => {
|
|
5
|
-
if (retriesLeft === 1) {
|
|
6
|
-
reject(error);
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
setTimeout(() => {
|
|
10
|
-
retry(fn, retriesLeft - 1, interval * backoff, backoff).then(resolve).catch(reject);
|
|
11
|
-
}, interval);
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { retry };
|
|
17
|
-
//# sourceMappingURL=out.js.map
|
|
18
|
-
//# sourceMappingURL=chunk-KNQIEOFP.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/retry.tsx"],"names":[],"mappings":";AAAO,SAAS,MACd,IACA,cAAsB,GACtB,WAAmB,KACnB,UAAkB,KACN;AACZ,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,OAAG,EACA,KAAK,OAAO,EACZ,MAAM,CAAC,UAAU;AAChB,UAAI,gBAAgB,GAAG;AACrB,eAAO,KAAK;AACZ;AAAA,MACF;AAEA,iBAAW,MAAM;AACf,cAAM,IAAI,cAAc,GAAG,WAAW,SAAS,OAAO,EACnD,KAAK,OAAO,EACZ,MAAM,MAAM;AAAA,MACjB,GAAG,QAAQ;AAAA,IACb,CAAC;AAAA,EACL,CAAC;AACH","sourcesContent":["export function retry<T>(\n fn: () => Promise<T>,\n retriesLeft: number = 2,\n interval: number = 200,\n backoff: number = 1.5,\n): Promise<T> {\n return new Promise((resolve, reject) => {\n fn()\n .then(resolve)\n .catch((error) => {\n if (retriesLeft === 1) {\n reject(error);\n return;\n }\n\n setTimeout(() => {\n retry(fn, retriesLeft - 1, interval * backoff, backoff)\n .then(resolve)\n .catch(reject);\n }, interval);\n });\n });\n}\n"]}
|