@copilotkit/react-textarea 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +90 -70
- package/CHANGELOG.md +13 -0
- package/dist/{chunk-EHQ5TN4R.mjs → chunk-3OR5RMJQ.mjs} +5 -2
- package/dist/chunk-3OR5RMJQ.mjs.map +1 -0
- package/dist/{chunk-A3SFEHWZ.mjs → chunk-4ES2IIB6.mjs} +24 -31
- package/dist/chunk-4ES2IIB6.mjs.map +1 -0
- package/dist/chunk-4YM33JFV.mjs +28 -0
- package/dist/chunk-4YM33JFV.mjs.map +1 -0
- package/dist/chunk-AOEXKPIX.mjs +83 -0
- package/dist/chunk-AOEXKPIX.mjs.map +1 -0
- package/dist/{chunk-6SYD77G6.mjs → chunk-CSGFJU3L.mjs} +2 -2
- package/dist/chunk-CSGFJU3L.mjs.map +1 -0
- package/dist/chunk-DE5K76I2.mjs +3 -0
- package/dist/{chunk-E2UEE45I.mjs → chunk-HZGSG7ST.mjs} +1 -1
- package/dist/chunk-HZGSG7ST.mjs.map +1 -0
- package/dist/{chunk-THWPPG6M.mjs → chunk-IGQI27NI.mjs} +20 -2
- package/dist/chunk-IGQI27NI.mjs.map +1 -0
- package/dist/chunk-M6QFKIBE.mjs +161 -0
- package/dist/chunk-M6QFKIBE.mjs.map +1 -0
- package/dist/chunk-RXISUUUY.mjs +32 -0
- package/dist/chunk-RXISUUUY.mjs.map +1 -0
- package/dist/chunk-WADHCMPK.mjs +3 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.d.ts +9 -4
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +9 -8
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.d.ts +4 -2
- package/dist/components/copilot-textarea/copilot-textarea.mjs +13 -11
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.mjs +13 -11
- package/dist/hooks/{use-autosuggestions.d.ts → base-copilot-textarea-implementation/use-autosuggestions.d.ts} +3 -3
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +7 -0
- package/dist/hooks/{use-copilot-textarea-editor.d.ts → base-copilot-textarea-implementation/use-copilot-textarea-editor.d.ts} +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +5 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.d.ts +7 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +6 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map +1 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +2 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +1 -1
- package/dist/index.css +7 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +15 -12
- package/dist/types/html-copilot-textarea-element.d.ts +7 -0
- package/dist/types/html-copilot-textarea-element.mjs +3 -0
- package/dist/types/html-copilot-textarea-element.mjs.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.mjs +4 -2
- package/dist/types/standard-autosuggestions/autosuggestions-config.d.ts +2 -1
- package/dist/types/standard-autosuggestions/autosuggestions-config.mjs +2 -1
- package/dist/types/standard-autosuggestions/chatlike-api-endpoint.d.ts +12 -0
- package/dist/types/standard-autosuggestions/chatlike-api-endpoint.mjs +4 -0
- package/dist/types/standard-autosuggestions/chatlike-api-endpoint.mjs.map +1 -0
- package/dist/types/standard-autosuggestions/index.d.ts +1 -0
- package/dist/types/standard-autosuggestions/index.mjs +2 -1
- package/package.json +1 -1
- package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +160 -146
- package/src/components/base-copilot-textarea/use-add-branding-css.tsx +25 -1
- package/src/components/copilot-textarea/copilot-textarea.tsx +31 -21
- package/src/hooks/{use-autosuggestions.ts → base-copilot-textarea-implementation/use-autosuggestions.ts} +5 -5
- package/src/hooks/{use-copilot-textarea-editor.tsx → base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx} +5 -5
- package/src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts +101 -0
- package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +25 -32
- package/src/types/html-copilot-textarea-element.ts +5 -0
- package/src/types/index.ts +1 -0
- package/src/types/standard-autosuggestions/autosuggestions-config.tsx +5 -2
- package/src/types/standard-autosuggestions/chatlike-api-endpoint.tsx +39 -0
- package/src/types/standard-autosuggestions/index.ts +10 -5
- package/dist/chunk-6SYD77G6.mjs.map +0 -1
- package/dist/chunk-A3SFEHWZ.mjs.map +0 -1
- package/dist/chunk-E2UEE45I.mjs.map +0 -1
- package/dist/chunk-EHQ5TN4R.mjs.map +0 -1
- package/dist/chunk-FD6FGKYY.mjs +0 -3
- package/dist/chunk-THWPPG6M.mjs.map +0 -1
- package/dist/chunk-YICIML6J.mjs +0 -154
- package/dist/chunk-YICIML6J.mjs.map +0 -1
- package/dist/chunk-YTT5NE6B.mjs +0 -25
- package/dist/chunk-YTT5NE6B.mjs.map +0 -1
- package/dist/hooks/use-autosuggestions.mjs +0 -7
- package/dist/hooks/use-copilot-textarea-editor.mjs +0 -5
- /package/dist/{chunk-FD6FGKYY.mjs.map → chunk-DE5K76I2.mjs.map} +0 -0
- /package/dist/{hooks/use-autosuggestions.mjs.map → chunk-WADHCMPK.mjs.map} +0 -0
- /package/dist/hooks/{use-copilot-textarea-editor.mjs.map → base-copilot-textarea-implementation/use-autosuggestions.mjs.map} +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
> @copilotkit/react-textarea@0.
|
|
2
|
+
> @copilotkit/react-textarea@0.13.0 build /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/react-textarea
|
|
3
3
|
> tsup --treeshake
|
|
4
4
|
|
|
5
|
-
[34mCLI[39m Building entry: src/index.tsx, src/components/index.ts, src/context/index.ts, src/hooks/index.ts, src/
|
|
5
|
+
[34mCLI[39m Building entry: src/index.tsx, src/components/index.ts, src/context/index.ts, src/hooks/index.ts, src/lib/debouncer.ts, src/lib/editor-to-text.ts, src/lib/get-text-around-cursor.ts, src/lib/utils.test.ts, src/lib/utils.ts, src/types/html-copilot-textarea-element.ts, src/types/index.ts, src/components/base-copilot-textarea/base-copilot-textarea.tsx, src/components/base-copilot-textarea/render-element.tsx, src/components/base-copilot-textarea/render-placeholder.tsx, src/components/base-copilot-textarea/use-add-branding-css.tsx, src/components/copilot-textarea/copilot-textarea.tsx, src/hooks/base-copilot-textarea-implementation/use-autosuggestions.ts, src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx, src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts, src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx, src/lib/slatejs-edits/add-autocompletions.ts, src/lib/slatejs-edits/clear-autocompletions.ts, src/lib/slatejs-edits/replace-text.ts, src/lib/slatejs-edits/with-partial-history.ts, src/types/base/autosuggestion-state.ts, src/types/base/autosuggestions-bare-function.ts, src/types/base/base-autosuggestions-config.tsx, src/types/base/base-copilot-textarea-props.tsx, src/types/base/custom-editor.tsx, src/types/base/editor-autocomplete-state.ts, src/types/base/index.ts, src/types/standard-autosuggestions/autosuggestions-config.tsx, src/types/standard-autosuggestions/chatlike-api-endpoint.tsx, src/types/standard-autosuggestions/index.ts, src/types/standard-autosuggestions/minimal-chat-gpt-message.tsx
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v6.5.0
|
|
8
8
|
[34mCLI[39m Using tsup config: /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/react-textarea/tsup.config.ts
|
|
@@ -13,29 +13,31 @@ Browserslist: caniuse-lite is outdated. Please run:
|
|
|
13
13
|
npx update-browserslist-db@latest
|
|
14
14
|
Why you should do it regularly: https://github.com/browserslist/update-db#readme
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
Generated an empty chunk: "base-copilot-textarea-props".
|
|
17
|
-
Generated an empty chunk: "custom-editor".
|
|
18
16
|
Generated an empty chunk: "minimal-chat-gpt-message".
|
|
19
17
|
Generated an empty chunk: "autosuggestion-state".
|
|
20
18
|
Generated an empty chunk: "autosuggestions-bare-function".
|
|
21
|
-
Generated an empty chunk: "
|
|
19
|
+
Generated an empty chunk: "base-copilot-textarea-props".
|
|
20
|
+
Generated an empty chunk: "custom-editor".
|
|
21
|
+
Generated an empty chunk: "chunk-DE5K76I2".
|
|
22
|
+
Generated an empty chunk: "chunk-WADHCMPK".
|
|
22
23
|
Generated an empty chunk: "chunk-MMVDU6DF".
|
|
23
24
|
Generated an empty chunk: "chunk-AZQCUNBV".
|
|
24
25
|
Generated an empty chunk: "chunk-WJHSY5T6".
|
|
25
26
|
Generated an empty chunk: "chunk-IU3WTXLQ".
|
|
26
27
|
Generated an empty chunk: "chunk-H4VKQGVU".
|
|
27
|
-
[32mESM[39m [1mdist/index.css [22m[32m5.
|
|
28
|
+
[32mESM[39m [1mdist/index.css [22m[32m5.99 KB[39m
|
|
28
29
|
[32mESM[39m [1mdist/components/index.css [22m[32m242.00 B[39m
|
|
29
|
-
[32mESM[39m [1mdist/components/copilot-textarea/copilot-textarea.css [22m[32m253.00 B[39m
|
|
30
30
|
[32mESM[39m [1mdist/components/base-copilot-textarea/base-copilot-textarea.css [22m[32m258.00 B[39m
|
|
31
|
-
[32mESM[39m [1mdist/
|
|
31
|
+
[32mESM[39m [1mdist/components/copilot-textarea/copilot-textarea.css [22m[32m253.00 B[39m
|
|
32
|
+
[32mESM[39m [1mdist/index.css.map [22m[32m12.66 KB[39m
|
|
32
33
|
[32mESM[39m [1mdist/components/index.css.map [22m[32m429.00 B[39m
|
|
33
34
|
[32mESM[39m [1mdist/lib/utils.test.mjs [22m[32m200.00 B[39m
|
|
34
35
|
[32mESM[39m [1mdist/lib/slatejs-edits/add-autocompletions.mjs [22m[32m186.00 B[39m
|
|
35
|
-
[32mESM[39m [1mdist/types/
|
|
36
|
+
[32mESM[39m [1mdist/types/html-copilot-textarea-element.mjs [22m[32m122.00 B[39m
|
|
36
37
|
[32mESM[39m [1mdist/context/index.mjs [22m[32m98.00 B[39m
|
|
37
38
|
[32mESM[39m [1mdist/hooks/index.mjs [22m[32m98.00 B[39m
|
|
38
|
-
[32mESM[39m [1mdist/chunk-
|
|
39
|
+
[32mESM[39m [1mdist/chunk-DE5K76I2.mjs [22m[32m76.00 B[39m
|
|
40
|
+
[32mESM[39m [1mdist/chunk-WADHCMPK.mjs [22m[32m76.00 B[39m
|
|
39
41
|
[32mESM[39m [1mdist/chunk-MMVDU6DF.mjs [22m[32m76.00 B[39m
|
|
40
42
|
[32mESM[39m [1mdist/chunk-AZQCUNBV.mjs [22m[32m76.00 B[39m
|
|
41
43
|
[32mESM[39m [1mdist/chunk-WJHSY5T6.mjs [22m[32m76.00 B[39m
|
|
@@ -43,58 +45,64 @@ Generated an empty chunk: "chunk-H4VKQGVU".
|
|
|
43
45
|
[32mESM[39m [1mdist/chunk-IU3WTXLQ.mjs [22m[32m76.00 B[39m
|
|
44
46
|
[32mESM[39m [1mdist/chunk-H4VKQGVU.mjs [22m[32m76.00 B[39m
|
|
45
47
|
[32mESM[39m [1mdist/chunk-MRXNTQOX.mjs [22m[32m1.92 KB[39m
|
|
46
|
-
[32mESM[39m [1mdist/components/copilot-textarea/copilot-textarea.mjs [22m[32m837.00 B[39m
|
|
47
48
|
[32mESM[39m [1mdist/lib/slatejs-edits/clear-autocompletions.mjs [22m[32m192.00 B[39m
|
|
48
49
|
[32mESM[39m [1mdist/lib/slatejs-edits/replace-text.mjs [22m[32m170.00 B[39m
|
|
49
50
|
[32mESM[39m [1mdist/lib/slatejs-edits/with-partial-history.mjs [22m[32m198.00 B[39m
|
|
50
|
-
[32mESM[39m [1mdist/lib/get-text-around-cursor.mjs [22m[32m232.00 B[39m
|
|
51
51
|
[32mESM[39m [1mdist/lib/utils.mjs [22m[32m220.00 B[39m
|
|
52
|
-
[32mESM[39m [1mdist/
|
|
52
|
+
[32mESM[39m [1mdist/types/index.mjs [22m[32m451.00 B[39m
|
|
53
|
+
[32mESM[39m [1mdist/components/base-copilot-textarea/base-copilot-textarea.mjs [22m[32m741.00 B[39m
|
|
53
54
|
[32mESM[39m [1mdist/components/base-copilot-textarea/render-element.mjs [22m[32m180.00 B[39m
|
|
54
55
|
[32mESM[39m [1mdist/components/base-copilot-textarea/render-placeholder.mjs [22m[32m188.00 B[39m
|
|
55
56
|
[32mESM[39m [1mdist/components/base-copilot-textarea/use-add-branding-css.mjs [22m[32m178.00 B[39m
|
|
56
|
-
[32mESM[39m [1mdist/
|
|
57
|
-
[32mESM[39m [1mdist/
|
|
58
|
-
[32mESM[39m [1mdist/
|
|
59
|
-
[32mESM[39m [1mdist/chunk-
|
|
60
|
-
[32mESM[39m [1mdist/chunk-
|
|
61
|
-
[32mESM[39m [1mdist/chunk-
|
|
57
|
+
[32mESM[39m [1mdist/components/copilot-textarea/copilot-textarea.mjs [22m[32m907.00 B[39m
|
|
58
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m1.09 KB[39m
|
|
59
|
+
[32mESM[39m [1mdist/components/index.mjs [22m[32m888.00 B[39m
|
|
60
|
+
[32mESM[39m [1mdist/chunk-RXISUUUY.mjs [22m[32m1.23 KB[39m
|
|
61
|
+
[32mESM[39m [1mdist/chunk-4ES2IIB6.mjs [22m[32m1.76 KB[39m
|
|
62
|
+
[32mESM[39m [1mdist/chunk-3OR5RMJQ.mjs [22m[32m2.86 KB[39m
|
|
63
|
+
[32mESM[39m [1mdist/chunk-4YM33JFV.mjs [22m[32m881.00 B[39m
|
|
64
|
+
[32mESM[39m [1mdist/chunk-M6QFKIBE.mjs [22m[32m5.99 KB[39m
|
|
65
|
+
[32mESM[39m [1mdist/chunk-HZGSG7ST.mjs [22m[32m3.02 KB[39m
|
|
66
|
+
[32mESM[39m [1mdist/chunk-UW3ITU2Y.mjs [22m[32m496.00 B[39m
|
|
67
|
+
[32mESM[39m [1mdist/chunk-CSGFJU3L.mjs [22m[32m2.01 KB[39m
|
|
68
|
+
[32mESM[39m [1mdist/chunk-AOEXKPIX.mjs [22m[32m2.57 KB[39m
|
|
62
69
|
[32mESM[39m [1mdist/chunk-WJYQWL4I.mjs [22m[32m595.00 B[39m
|
|
63
70
|
[32mESM[39m [1mdist/chunk-4XYYSJ5C.mjs [22m[32m527.00 B[39m
|
|
64
71
|
[32mESM[39m [1mdist/chunk-TSF4AJIK.mjs [22m[32m716.00 B[39m
|
|
65
|
-
[32mESM[39m [1mdist/chunk-
|
|
72
|
+
[32mESM[39m [1mdist/chunk-KCHYD3EB.mjs [22m[32m3.08 KB[39m
|
|
73
|
+
[32mESM[39m [1mdist/chunk-KGKLUWKW.mjs [22m[32m1.37 KB[39m
|
|
66
74
|
[32mESM[39m [1mdist/chunk-LNAIMEB2.mjs [22m[32m1.09 KB[39m
|
|
67
75
|
[32mESM[39m [1mdist/chunk-OELUUJZY.mjs [22m[32m625.00 B[39m
|
|
68
|
-
[32mESM[39m [1mdist/chunk-
|
|
69
|
-
[32mESM[39m [1mdist/hooks/use-autosuggestions.mjs [22m[32m268.00 B[39m
|
|
70
|
-
[32mESM[39m [1mdist/chunk-E2UEE45I.mjs [22m[32m3.02 KB[39m
|
|
71
|
-
[32mESM[39m [1mdist/chunk-UW3ITU2Y.mjs [22m[32m496.00 B[39m
|
|
72
|
-
[32mESM[39m [1mdist/chunk-KGKLUWKW.mjs [22m[32m1.37 KB[39m
|
|
73
|
-
[32mESM[39m [1mdist/hooks/use-copilot-textarea-editor.mjs [22m[32m218.00 B[39m
|
|
74
|
-
[32mESM[39m [1mdist/chunk-6SYD77G6.mjs [22m[32m2.01 KB[39m
|
|
75
|
-
[32mESM[39m [1mdist/chunk-KCHYD3EB.mjs [22m[32m3.08 KB[39m
|
|
76
|
+
[32mESM[39m [1mdist/chunk-IGQI27NI.mjs [22m[32m2.11 KB[39m
|
|
76
77
|
[32mESM[39m [1mdist/lib/debouncer.mjs [22m[32m153.00 B[39m
|
|
77
78
|
[32mESM[39m [1mdist/chunk-NKW5OU2S.mjs [22m[32m959.00 B[39m
|
|
78
79
|
[32mESM[39m [1mdist/lib/editor-to-text.mjs [22m[32m1.34 KB[39m
|
|
79
|
-
[32mESM[39m [1mdist/
|
|
80
|
+
[32mESM[39m [1mdist/lib/get-text-around-cursor.mjs [22m[32m232.00 B[39m
|
|
81
|
+
[32mESM[39m [1mdist/chunk-3UQM3NLM.mjs [22m[32m1.76 KB[39m
|
|
80
82
|
[32mESM[39m [1mdist/components/base-copilot-textarea/base-copilot-textarea.css.map [22m[32m432.00 B[39m
|
|
81
|
-
[32mESM[39m [1mdist/
|
|
83
|
+
[32mESM[39m [1mdist/components/copilot-textarea/copilot-textarea.css.map [22m[32m432.00 B[39m
|
|
82
84
|
[32mESM[39m [1mdist/types/standard-autosuggestions/minimal-chat-gpt-message.mjs [22m[32m86.00 B[39m
|
|
83
|
-
[32mESM[39m [1mdist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs [22m[32m220.00 B[39m
|
|
84
|
-
[32mESM[39m [1mdist/types/base/custom-editor.mjs [22m[32m75.00 B[39m
|
|
85
85
|
[32mESM[39m [1mdist/types/base/autosuggestion-state.mjs [22m[32m82.00 B[39m
|
|
86
|
+
[32mESM[39m [1mdist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs [22m[32m283.00 B[39m
|
|
87
|
+
[32mESM[39m [1mdist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs [22m[32m220.00 B[39m
|
|
86
88
|
[32mESM[39m [1mdist/types/base/autosuggestions-bare-function.mjs [22m[32m91.00 B[39m
|
|
89
|
+
[32mESM[39m [1mdist/types/base/base-copilot-textarea-props.mjs [22m[32m89.00 B[39m
|
|
90
|
+
[32mESM[39m [1mdist/types/base/custom-editor.mjs [22m[32m75.00 B[39m
|
|
91
|
+
[32mESM[39m [1mdist/types/standard-autosuggestions/chatlike-api-endpoint.mjs [22m[32m181.00 B[39m
|
|
92
|
+
[32mESM[39m [1mdist/types/standard-autosuggestions/index.mjs [22m[32m363.00 B[39m
|
|
87
93
|
[32mESM[39m [1mdist/types/base/base-autosuggestions-config.mjs [22m[32m200.00 B[39m
|
|
88
94
|
[32mESM[39m [1mdist/types/base/editor-autocomplete-state.mjs [22m[32m227.00 B[39m
|
|
89
95
|
[32mESM[39m [1mdist/types/base/index.mjs [22m[32m213.00 B[39m
|
|
90
|
-
[32mESM[39m [1mdist/types/standard-autosuggestions/autosuggestions-config.mjs [22m[
|
|
91
|
-
[32mESM[39m [1mdist/
|
|
96
|
+
[32mESM[39m [1mdist/types/standard-autosuggestions/autosuggestions-config.mjs [22m[32m345.00 B[39m
|
|
97
|
+
[32mESM[39m [1mdist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs [22m[32m227.00 B[39m
|
|
98
|
+
[32mESM[39m [1mdist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs [22m[32m273.00 B[39m
|
|
92
99
|
[32mESM[39m [1mdist/lib/utils.test.mjs.map [22m[32m349.00 B[39m
|
|
93
100
|
[32mESM[39m [1mdist/lib/slatejs-edits/add-autocompletions.mjs.map [22m[32m51.00 B[39m
|
|
94
|
-
[32mESM[39m [1mdist/types/
|
|
101
|
+
[32mESM[39m [1mdist/types/html-copilot-textarea-element.mjs.map [22m[32m51.00 B[39m
|
|
95
102
|
[32mESM[39m [1mdist/context/index.mjs.map [22m[32m51.00 B[39m
|
|
96
103
|
[32mESM[39m [1mdist/hooks/index.mjs.map [22m[32m51.00 B[39m
|
|
97
|
-
[32mESM[39m [1mdist/chunk-
|
|
104
|
+
[32mESM[39m [1mdist/chunk-DE5K76I2.mjs.map [22m[32m51.00 B[39m
|
|
105
|
+
[32mESM[39m [1mdist/chunk-WADHCMPK.mjs.map [22m[32m51.00 B[39m
|
|
98
106
|
[32mESM[39m [1mdist/chunk-MMVDU6DF.mjs.map [22m[32m51.00 B[39m
|
|
99
107
|
[32mESM[39m [1mdist/chunk-AZQCUNBV.mjs.map [22m[32m51.00 B[39m
|
|
100
108
|
[32mESM[39m [1mdist/chunk-WJHSY5T6.mjs.map [22m[32m51.00 B[39m
|
|
@@ -102,81 +110,93 @@ Generated an empty chunk: "chunk-H4VKQGVU".
|
|
|
102
110
|
[32mESM[39m [1mdist/chunk-IU3WTXLQ.mjs.map [22m[32m51.00 B[39m
|
|
103
111
|
[32mESM[39m [1mdist/chunk-H4VKQGVU.mjs.map [22m[32m51.00 B[39m
|
|
104
112
|
[32mESM[39m [1mdist/chunk-MRXNTQOX.mjs.map [22m[32m71.00 B[39m
|
|
105
|
-
[32mESM[39m [1mdist/components/copilot-textarea/copilot-textarea.mjs.map [22m[32m51.00 B[39m
|
|
106
113
|
[32mESM[39m [1mdist/lib/slatejs-edits/clear-autocompletions.mjs.map [22m[32m51.00 B[39m
|
|
107
114
|
[32mESM[39m [1mdist/lib/slatejs-edits/replace-text.mjs.map [22m[32m51.00 B[39m
|
|
108
115
|
[32mESM[39m [1mdist/lib/slatejs-edits/with-partial-history.mjs.map [22m[32m51.00 B[39m
|
|
109
|
-
[32mESM[39m [1mdist/lib/get-text-around-cursor.mjs.map [22m[32m51.00 B[39m
|
|
110
116
|
[32mESM[39m [1mdist/lib/utils.mjs.map [22m[32m51.00 B[39m
|
|
117
|
+
[32mESM[39m [1mdist/types/index.mjs.map [22m[32m51.00 B[39m
|
|
111
118
|
[32mESM[39m [1mdist/components/base-copilot-textarea/base-copilot-textarea.mjs.map [22m[32m51.00 B[39m
|
|
112
119
|
[32mESM[39m [1mdist/components/base-copilot-textarea/render-element.mjs.map [22m[32m51.00 B[39m
|
|
113
120
|
[32mESM[39m [1mdist/components/base-copilot-textarea/render-placeholder.mjs.map [22m[32m51.00 B[39m
|
|
114
121
|
[32mESM[39m [1mdist/components/base-copilot-textarea/use-add-branding-css.mjs.map [22m[32m51.00 B[39m
|
|
122
|
+
[32mESM[39m [1mdist/components/copilot-textarea/copilot-textarea.mjs.map [22m[32m51.00 B[39m
|
|
115
123
|
[32mESM[39m [1mdist/index.mjs.map [22m[32m51.00 B[39m
|
|
116
124
|
[32mESM[39m [1mdist/components/index.mjs.map [22m[32m51.00 B[39m
|
|
117
|
-
[32mESM[39m [1mdist/chunk-
|
|
118
|
-
[32mESM[39m [1mdist/chunk-
|
|
119
|
-
[32mESM[39m [1mdist/chunk-
|
|
120
|
-
[32mESM[39m [1mdist/chunk-
|
|
125
|
+
[32mESM[39m [1mdist/chunk-RXISUUUY.mjs.map [22m[32m2.17 KB[39m
|
|
126
|
+
[32mESM[39m [1mdist/chunk-4ES2IIB6.mjs.map [22m[32m4.41 KB[39m
|
|
127
|
+
[32mESM[39m [1mdist/chunk-3OR5RMJQ.mjs.map [22m[32m4.17 KB[39m
|
|
128
|
+
[32mESM[39m [1mdist/chunk-4YM33JFV.mjs.map [22m[32m1.57 KB[39m
|
|
129
|
+
[32mESM[39m [1mdist/chunk-M6QFKIBE.mjs.map [22m[32m10.78 KB[39m
|
|
130
|
+
[32mESM[39m [1mdist/chunk-HZGSG7ST.mjs.map [22m[32m5.83 KB[39m
|
|
131
|
+
[32mESM[39m [1mdist/chunk-UW3ITU2Y.mjs.map [22m[32m878.00 B[39m
|
|
132
|
+
[32mESM[39m [1mdist/chunk-CSGFJU3L.mjs.map [22m[32m3.82 KB[39m
|
|
133
|
+
[32mESM[39m [1mdist/chunk-AOEXKPIX.mjs.map [22m[32m4.80 KB[39m
|
|
121
134
|
[32mESM[39m [1mdist/chunk-WJYQWL4I.mjs.map [22m[32m1.04 KB[39m
|
|
122
135
|
[32mESM[39m [1mdist/chunk-4XYYSJ5C.mjs.map [22m[32m921.00 B[39m
|
|
123
136
|
[32mESM[39m [1mdist/chunk-TSF4AJIK.mjs.map [22m[32m1.31 KB[39m
|
|
124
|
-
[32mESM[39m [1mdist/chunk-
|
|
137
|
+
[32mESM[39m [1mdist/chunk-KCHYD3EB.mjs.map [22m[32m6.12 KB[39m
|
|
138
|
+
[32mESM[39m [1mdist/chunk-KGKLUWKW.mjs.map [22m[32m2.45 KB[39m
|
|
125
139
|
[32mESM[39m [1mdist/chunk-LNAIMEB2.mjs.map [22m[32m1.73 KB[39m
|
|
126
140
|
[32mESM[39m [1mdist/chunk-OELUUJZY.mjs.map [22m[32m957.00 B[39m
|
|
127
|
-
[32mESM[39m [1mdist/chunk-
|
|
128
|
-
[32mESM[39m [1mdist/hooks/use-autosuggestions.mjs.map [22m[32m51.00 B[39m
|
|
129
|
-
[32mESM[39m [1mdist/chunk-E2UEE45I.mjs.map [22m[32m5.78 KB[39m
|
|
130
|
-
[32mESM[39m [1mdist/chunk-UW3ITU2Y.mjs.map [22m[32m878.00 B[39m
|
|
131
|
-
[32mESM[39m [1mdist/chunk-KGKLUWKW.mjs.map [22m[32m2.45 KB[39m
|
|
132
|
-
[32mESM[39m [1mdist/hooks/use-copilot-textarea-editor.mjs.map [22m[32m51.00 B[39m
|
|
133
|
-
[32mESM[39m [1mdist/chunk-6SYD77G6.mjs.map [22m[32m3.78 KB[39m
|
|
134
|
-
[32mESM[39m [1mdist/chunk-KCHYD3EB.mjs.map [22m[32m6.12 KB[39m
|
|
141
|
+
[32mESM[39m [1mdist/chunk-IGQI27NI.mjs.map [22m[32m3.42 KB[39m
|
|
135
142
|
[32mESM[39m [1mdist/lib/debouncer.mjs.map [22m[32m51.00 B[39m
|
|
136
143
|
[32mESM[39m [1mdist/chunk-NKW5OU2S.mjs.map [22m[32m1.60 KB[39m
|
|
137
144
|
[32mESM[39m [1mdist/lib/editor-to-text.mjs.map [22m[32m2.83 KB[39m
|
|
138
|
-
[32mESM[39m [1mdist/
|
|
145
|
+
[32mESM[39m [1mdist/lib/get-text-around-cursor.mjs.map [22m[32m51.00 B[39m
|
|
146
|
+
[32mESM[39m [1mdist/chunk-3UQM3NLM.mjs.map [22m[32m3.63 KB[39m
|
|
139
147
|
[32mESM[39m [1mdist/types/standard-autosuggestions/minimal-chat-gpt-message.mjs.map [22m[32m51.00 B[39m
|
|
140
|
-
[32mESM[39m [1mdist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs.map [22m[32m51.00 B[39m
|
|
141
|
-
[32mESM[39m [1mdist/types/base/custom-editor.mjs.map [22m[32m51.00 B[39m
|
|
142
148
|
[32mESM[39m [1mdist/types/base/autosuggestion-state.mjs.map [22m[32m51.00 B[39m
|
|
149
|
+
[32mESM[39m [1mdist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs.map [22m[32m51.00 B[39m
|
|
150
|
+
[32mESM[39m [1mdist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs.map [22m[32m51.00 B[39m
|
|
143
151
|
[32mESM[39m [1mdist/types/base/autosuggestions-bare-function.mjs.map [22m[32m51.00 B[39m
|
|
152
|
+
[32mESM[39m [1mdist/types/base/base-copilot-textarea-props.mjs.map [22m[32m51.00 B[39m
|
|
153
|
+
[32mESM[39m [1mdist/types/base/custom-editor.mjs.map [22m[32m51.00 B[39m
|
|
154
|
+
[32mESM[39m [1mdist/types/standard-autosuggestions/chatlike-api-endpoint.mjs.map [22m[32m51.00 B[39m
|
|
155
|
+
[32mESM[39m [1mdist/types/standard-autosuggestions/index.mjs.map [22m[32m51.00 B[39m
|
|
144
156
|
[32mESM[39m [1mdist/types/base/base-autosuggestions-config.mjs.map [22m[32m51.00 B[39m
|
|
145
157
|
[32mESM[39m [1mdist/types/base/editor-autocomplete-state.mjs.map [22m[32m51.00 B[39m
|
|
146
158
|
[32mESM[39m [1mdist/types/base/index.mjs.map [22m[32m51.00 B[39m
|
|
147
159
|
[32mESM[39m [1mdist/types/standard-autosuggestions/autosuggestions-config.mjs.map [22m[32m51.00 B[39m
|
|
148
|
-
[32mESM[39m [1mdist/
|
|
149
|
-
[32mESM[39m
|
|
150
|
-
[
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
160
|
+
[32mESM[39m [1mdist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map [22m[32m51.00 B[39m
|
|
161
|
+
[32mESM[39m [1mdist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map [22m[32m51.00 B[39m
|
|
162
|
+
[32mESM[39m ⚡️ Build success in 4397ms
|
|
163
|
+
Export "AutosuggestionsConfig" of module "src/types/standard-autosuggestions/autosuggestions-config.tsx" was reexported through module "src/types/standard-autosuggestions/index.ts" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
|
|
164
|
+
Either change the import in "src/components/copilot-textarea/copilot-textarea.tsx" to point directly to the exporting module or do not use "preserveModules" to ensure these modules end up in the same chunk.
|
|
165
|
+
Export "MakeSystemPrompt" of module "src/types/standard-autosuggestions/autosuggestions-config.tsx" was reexported through module "src/types/standard-autosuggestions/index.ts" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
|
|
166
|
+
Either change the import in "src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx" to point directly to the exporting module or do not use "preserveModules" to ensure these modules end up in the same chunk.
|
|
167
|
+
[32mDTS[39m ⚡️ Build success in 7550ms
|
|
168
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.07 KB[39m
|
|
169
|
+
[32mDTS[39m [1mdist/components/base-copilot-textarea/base-copilot-textarea.d.ts [22m[32m669.00 B[39m
|
|
170
|
+
[32mDTS[39m [1mdist/components/copilot-textarea/copilot-textarea.d.ts [22m[32m875.00 B[39m
|
|
154
171
|
[32mDTS[39m [1mdist/types/base/base-autosuggestions-config.d.ts [22m[32m355.00 B[39m
|
|
155
172
|
[32mDTS[39m [1mdist/types/base/autosuggestions-bare-function.d.ts [22m[32m162.00 B[39m
|
|
156
173
|
[32mDTS[39m [1mdist/types/base/base-copilot-textarea-props.d.ts [22m[32m1.89 KB[39m
|
|
157
|
-
[32mDTS[39m [1mdist/types/
|
|
174
|
+
[32mDTS[39m [1mdist/types/html-copilot-textarea-element.d.ts [22m[32m165.00 B[39m
|
|
175
|
+
[32mDTS[39m [1mdist/types/standard-autosuggestions/autosuggestions-config.d.ts [22m[32m963.00 B[39m
|
|
158
176
|
[32mDTS[39m [1mdist/types/standard-autosuggestions/minimal-chat-gpt-message.d.ts [22m[32m129.00 B[39m
|
|
159
|
-
[32mDTS[39m [1mdist/
|
|
177
|
+
[32mDTS[39m [1mdist/types/standard-autosuggestions/chatlike-api-endpoint.d.ts [22m[32m485.00 B[39m
|
|
178
|
+
[32mDTS[39m [1mdist/components/index.d.ts [22m[32m630.00 B[39m
|
|
160
179
|
[32mDTS[39m [1mdist/context/index.d.ts [22m[32m1.00 B[39m
|
|
161
180
|
[32mDTS[39m [1mdist/hooks/index.d.ts [22m[32m1.00 B[39m
|
|
162
|
-
[32mDTS[39m [1mdist/hooks/use-autosuggestions.d.ts [22m[32m879.00 B[39m
|
|
163
|
-
[32mDTS[39m [1mdist/types/base/autosuggestion-state.d.ts [22m[32m143.00 B[39m
|
|
164
|
-
[32mDTS[39m [1mdist/types/base/editor-autocomplete-state.d.ts [22m[32m342.00 B[39m
|
|
165
|
-
[32mDTS[39m [1mdist/hooks/use-copilot-textarea-editor.d.ts [22m[32m223.00 B[39m
|
|
166
|
-
[32mDTS[39m [1mdist/types/base/custom-editor.d.ts [22m[32m801.00 B[39m
|
|
167
181
|
[32mDTS[39m [1mdist/lib/debouncer.d.ts [22m[32m372.00 B[39m
|
|
168
182
|
[32mDTS[39m [1mdist/lib/editor-to-text.d.ts [22m[32m243.00 B[39m
|
|
169
183
|
[32mDTS[39m [1mdist/lib/get-text-around-cursor.d.ts [22m[32m453.00 B[39m
|
|
184
|
+
[32mDTS[39m [1mdist/types/base/editor-autocomplete-state.d.ts [22m[32m342.00 B[39m
|
|
170
185
|
[32mDTS[39m [1mdist/lib/utils.test.d.ts [22m[32m1.00 B[39m
|
|
171
186
|
[32mDTS[39m [1mdist/lib/utils.d.ts [22m[32m638.00 B[39m
|
|
172
|
-
[32mDTS[39m [1mdist/types/index.d.ts [22m[
|
|
187
|
+
[32mDTS[39m [1mdist/types/index.d.ts [22m[32m850.00 B[39m
|
|
173
188
|
[32mDTS[39m [1mdist/components/base-copilot-textarea/render-element.d.ts [22m[32m292.00 B[39m
|
|
174
189
|
[32mDTS[39m [1mdist/components/base-copilot-textarea/render-placeholder.d.ts [22m[32m321.00 B[39m
|
|
175
190
|
[32mDTS[39m [1mdist/components/base-copilot-textarea/use-add-branding-css.d.ts [22m[32m158.00 B[39m
|
|
176
|
-
[32mDTS[39m [1mdist/hooks/
|
|
191
|
+
[32mDTS[39m [1mdist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.ts [22m[32m888.00 B[39m
|
|
192
|
+
[32mDTS[39m [1mdist/types/base/autosuggestion-state.d.ts [22m[32m143.00 B[39m
|
|
193
|
+
[32mDTS[39m [1mdist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.d.ts [22m[32m226.00 B[39m
|
|
194
|
+
[32mDTS[39m [1mdist/types/base/custom-editor.d.ts [22m[32m801.00 B[39m
|
|
195
|
+
[32mDTS[39m [1mdist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.d.ts [22m[32m308.00 B[39m
|
|
196
|
+
[32mDTS[39m [1mdist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts [22m[32m1.90 KB[39m
|
|
177
197
|
[32mDTS[39m [1mdist/lib/slatejs-edits/add-autocompletions.d.ts [22m[32m302.00 B[39m
|
|
178
198
|
[32mDTS[39m [1mdist/lib/slatejs-edits/clear-autocompletions.d.ts [22m[32m250.00 B[39m
|
|
179
199
|
[32mDTS[39m [1mdist/lib/slatejs-edits/replace-text.d.ts [22m[32m139.00 B[39m
|
|
180
200
|
[32mDTS[39m [1mdist/lib/slatejs-edits/with-partial-history.d.ts [22m[32m542.00 B[39m
|
|
181
201
|
[32mDTS[39m [1mdist/types/base/index.d.ts [22m[32m287.00 B[39m
|
|
182
|
-
[32mDTS[39m [1mdist/types/standard-autosuggestions/index.d.ts [22m[
|
|
202
|
+
[32mDTS[39m [1mdist/types/standard-autosuggestions/index.d.ts [22m[32m441.00 B[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# ui
|
|
2
2
|
|
|
3
|
+
## 0.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1f26798: standard CopilotTextarea apiEndpoint takes an implementation, not just a string endpoint
|
|
8
|
+
|
|
9
|
+
## 0.12.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- ec7484f: - CopilotTextarea supports passing in ref compatible with <textarea>'s HTMLTextAreaElement ref (for focus, blur, styling, etc.)
|
|
14
|
+
- Minor bug fix: CopilotTextarea branding remains correclty positioned as textarea scrolls
|
|
15
|
+
|
|
3
16
|
## 0.11.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChatlikeApiEndpoint } from './chunk-4YM33JFV.mjs';
|
|
1
2
|
import { defaultBaseAutosuggestionsConfig } from './chunk-7KWRVIYV.mjs';
|
|
2
3
|
import { __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
3
4
|
|
|
@@ -57,7 +58,9 @@ var defaultFewShotMessages = [
|
|
|
57
58
|
}
|
|
58
59
|
];
|
|
59
60
|
var defaultAutosuggestionsConfig = __spreadProps(__spreadValues({}, defaultBaseAutosuggestionsConfig), {
|
|
60
|
-
apiEndpoint:
|
|
61
|
+
apiEndpoint: ChatlikeApiEndpoint.standardOpenAIEndpoint(
|
|
62
|
+
"api/autosuggestions"
|
|
63
|
+
),
|
|
61
64
|
makeSystemPrompt: defaultMakeSystemPrompt,
|
|
62
65
|
fewShotMessages: defaultFewShotMessages,
|
|
63
66
|
externalContextCategories: void 0,
|
|
@@ -66,4 +69,4 @@ var defaultAutosuggestionsConfig = __spreadProps(__spreadValues({}, defaultBaseA
|
|
|
66
69
|
|
|
67
70
|
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt };
|
|
68
71
|
//# sourceMappingURL=out.js.map
|
|
69
|
-
//# sourceMappingURL=chunk-
|
|
72
|
+
//# sourceMappingURL=chunk-3OR5RMJQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/standard-autosuggestions/autosuggestions-config.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAoBO,IAAM,0BAA4C,CACvD,eACA,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,yBAAkD;AAAA,EAC7D;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;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;AACO,IAAM,+BAGT,iCACC,mCADD;AAAA,EAGF,aAAa,oBAAoB;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,2BAA2B;AAAA,EAC3B,iBAAiB;AACnB","sourcesContent":["import {\n BaseAutosuggestionsConfig,\n defaultBaseAutosuggestionsConfig,\n} from \"../base\";\nimport { ChatlikeApiEndpoint } from \"./chatlike-api-endpoint\";\nimport { MinimalChatGPTMessage } from \"./minimal-chat-gpt-message\";\n\nexport type MakeSystemPrompt = (\n purposePrompt: string,\n contextString: string\n) => string;\n\nexport interface AutosuggestionsConfig extends BaseAutosuggestionsConfig {\n apiEndpoint: ChatlikeApiEndpoint;\n externalContextCategories: string[] | undefined;\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: MinimalChatGPTMessage[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultMakeSystemPrompt: MakeSystemPrompt = (\n purposePrompt,\n contextString\n) => {\n return `You are a versatile writing assistant.\n \nThe user is writing some text.\nThe purpose is: \\\"${purposePrompt}\\\"\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 defaultFewShotMessages: MinimalChatGPTMessage[] = [\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"While I was there I also picked up some apples, oranges, and bananas.\",\n },\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: \"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];\nexport const defaultAutosuggestionsConfig: Omit<\n AutosuggestionsConfig,\n \"purposePrompt\"\n> = {\n ...defaultBaseAutosuggestionsConfig,\n\n apiEndpoint: ChatlikeApiEndpoint.standardOpenAIEndpoint(\n \"api/autosuggestions\"\n ),\n makeSystemPrompt: defaultMakeSystemPrompt,\n fewShotMessages: defaultFewShotMessages,\n externalContextCategories: undefined,\n forwardedParams: undefined,\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __async
|
|
1
|
+
import { __async } from './chunk-MRXNTQOX.mjs';
|
|
2
2
|
import { CopilotContext } from '@copilotkit/react-core';
|
|
3
3
|
import { useContext, useCallback } from 'react';
|
|
4
4
|
|
|
@@ -7,36 +7,29 @@ function useMakeStandardAutosuggestionFunction(purposePrompt, apiEndpoint, makeS
|
|
|
7
7
|
return useCallback(
|
|
8
8
|
(beforeText, afterText, abortSignal) => __async(this, null, function* () {
|
|
9
9
|
const res = yield retry(() => __async(this, null, function* () {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
})),
|
|
34
|
-
signal: abortSignal
|
|
35
|
-
});
|
|
10
|
+
const messages = [
|
|
11
|
+
{
|
|
12
|
+
role: "system",
|
|
13
|
+
content: makeSystemPrompt(
|
|
14
|
+
purposePrompt,
|
|
15
|
+
getContextString(contextCategories)
|
|
16
|
+
)
|
|
17
|
+
},
|
|
18
|
+
...fewShotMessages,
|
|
19
|
+
{
|
|
20
|
+
role: "user",
|
|
21
|
+
name: "TextAfterCursor",
|
|
22
|
+
content: afterText
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
role: "user",
|
|
26
|
+
name: "TextBeforeCursor",
|
|
27
|
+
content: beforeText
|
|
28
|
+
}
|
|
29
|
+
];
|
|
30
|
+
return yield apiEndpoint.run(abortSignal, messages, forwardedProps);
|
|
36
31
|
}));
|
|
37
|
-
|
|
38
|
-
const suggestion = json.choices[0].message.content;
|
|
39
|
-
return suggestion;
|
|
32
|
+
return res;
|
|
40
33
|
}),
|
|
41
34
|
[
|
|
42
35
|
apiEndpoint,
|
|
@@ -64,4 +57,4 @@ function retry(fn, retriesLeft = 2, interval = 200, backoff = 1.5) {
|
|
|
64
57
|
|
|
65
58
|
export { useMakeStandardAutosuggestionFunction };
|
|
66
59
|
//# sourceMappingURL=out.js.map
|
|
67
|
-
//# sourceMappingURL=chunk-
|
|
60
|
+
//# sourceMappingURL=chunk-4ES2IIB6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx"],"names":[],"mappings":";;;;;AAAA,SAAS,sBAAsB;AAC/B,SAAS,aAAa,kBAAkB;AAoBjC,SAAS,sCACd,eACA,aACA,kBACA,iBACA,mBACA,gBAC6B;AAC7B,QAAM,EAAE,iBAAiB,IAAI,WAAW,cAAc;AAEtD,SAAO;AAAA,IACL,CAAO,YAAoB,WAAmB,gBAA6B;AACzE,YAAM,MAAM,MAAM,MAAM,MAAY;AAClC,cAAM,WAAoC;AAAA,UACxC;AAAA,YACE,MAAM;AAAA,YACN,SAAS;AAAA,cACP;AAAA,cACA,iBAAiB,iBAAiB;AAAA,YACpC;AAAA,UACF;AAAA,UACA,GAAG;AAAA,UACH;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS;AAAA,UACX;AAAA,UACA;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS;AAAA,UACX;AAAA,QACF;AAEA,eAAO,MAAM,YAAY,IAAI,aAAa,UAAU,cAAc;AAAA,MACpE,EAAC;AAED,aAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,MACP,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":["import { CopilotContext } from \"@copilotkit/react-core\";\nimport { useCallback, useContext } from \"react\";\nimport {\n AutosuggestionsBareFunction,\n MakeSystemPrompt,\n MinimalChatGPTMessage,\n} from \"../../types\";\nimport { ChatlikeApiEndpoint } from \"../../types/standard-autosuggestions/chatlike-api-endpoint\";\n/**\n * Returns a memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.\n * The function takes in the text before and after the cursor, and an abort signal.\n * It sends a POST request to the API endpoint with the messages array containing the system message, few shot messages, and user messages.\n * The function returns the suggestion from the API response.\n *\n * @param purposePrompt - The purpose of the textarea. This is included in the system message.\n * @param apiEndpoint - The API endpoint to send the autosuggestion request to.\n * @param makeSystemMessage - A function that takes in a context string and returns a system message to include in the autosuggestion request.\n * @param fewShotMessages - An array of few shot messages to include in the autosuggestion request.\n * @param contextCategories - The categories of context strings we want to include. By default, we include the (default) \"global\" context category.\n * @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.\n */\nexport function useMakeStandardAutosuggestionFunction(\n purposePrompt: string,\n apiEndpoint: ChatlikeApiEndpoint,\n makeSystemPrompt: MakeSystemPrompt,\n fewShotMessages: MinimalChatGPTMessage[],\n contextCategories: string[] | undefined,\n forwardedProps?: { [key: string]: any }\n): AutosuggestionsBareFunction {\n const { getContextString } = useContext(CopilotContext);\n\n return useCallback(\n async (beforeText: string, afterText: string, abortSignal: AbortSignal) => {\n const res = await retry(async () => {\n const messages: MinimalChatGPTMessage[] = [\n {\n role: \"system\",\n content: makeSystemPrompt(\n purposePrompt,\n getContextString(contextCategories)\n ),\n },\n ...fewShotMessages,\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content: afterText,\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: beforeText,\n },\n ];\n\n return await apiEndpoint.run(abortSignal, messages, forwardedProps);\n });\n\n return res;\n },\n [\n apiEndpoint,\n makeSystemPrompt,\n fewShotMessages,\n getContextString,\n contextCategories,\n purposePrompt,\n ]\n );\n}\n\nfunction 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"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { __async, __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
2
|
+
|
|
3
|
+
// src/types/standard-autosuggestions/chatlike-api-endpoint.tsx
|
|
4
|
+
var ChatlikeApiEndpoint = class {
|
|
5
|
+
constructor(run) {
|
|
6
|
+
this.run = run;
|
|
7
|
+
}
|
|
8
|
+
static standardOpenAIEndpoint(apiEndpoint) {
|
|
9
|
+
return new ChatlikeApiEndpoint(
|
|
10
|
+
(abortSignal, messages, forwardedProps) => __async(this, null, function* () {
|
|
11
|
+
const res = yield fetch(apiEndpoint, {
|
|
12
|
+
method: "POST",
|
|
13
|
+
body: JSON.stringify(__spreadProps(__spreadValues({}, forwardedProps), {
|
|
14
|
+
messages
|
|
15
|
+
})),
|
|
16
|
+
signal: abortSignal
|
|
17
|
+
});
|
|
18
|
+
const json = yield res.json();
|
|
19
|
+
const suggestion = json.choices[0].message.content;
|
|
20
|
+
return suggestion;
|
|
21
|
+
})
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { ChatlikeApiEndpoint };
|
|
27
|
+
//# sourceMappingURL=out.js.map
|
|
28
|
+
//# sourceMappingURL=chunk-4YM33JFV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/standard-autosuggestions/chatlike-api-endpoint.tsx"],"names":[],"mappings":";;;;;;;AAQO,IAAM,sBAAN,MAA0B;AAAA,EAG/B,YAAY,KAA8B;AACxC,SAAK,MAAM;AAAA,EACb;AAAA,EAGA,OAAO,uBAAuB,aAA0C;AACtE,WAAO,IAAI;AAAA,MACT,CACE,aACA,UACA,mBACG;AACH,cAAM,MAAM,MAAM,MAAM,aAAa;AAAA,UACnC,QAAQ;AAAA,UACR,MAAM,KAAK,UAAU,iCAChB,iBADgB;AAAA,YAEnB;AAAA,UACF,EAAC;AAAA,UACD,QAAQ;AAAA,QACV,CAAC;AAED,cAAM,OAAO,MAAM,IAAI,KAAK;AAC5B,cAAM,aAAa,KAAK,QAAQ,GAAG,QAAQ;AAC3C,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF","sourcesContent":["import { MinimalChatGPTMessage } from \"..\";\n\nexport type ChatlikeApiEndpointImpl = (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any }\n) => Promise<string>;\n\nexport class ChatlikeApiEndpoint {\n public run: ChatlikeApiEndpointImpl;\n\n constructor(run: ChatlikeApiEndpointImpl) {\n this.run = run;\n }\n\n // Static method\n static standardOpenAIEndpoint(apiEndpoint: string): ChatlikeApiEndpoint {\n return new ChatlikeApiEndpoint(\n async (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any }\n ) => {\n const res = await fetch(apiEndpoint, {\n method: \"POST\",\n body: JSON.stringify({\n ...forwardedProps,\n messages: messages,\n }),\n signal: abortSignal,\n });\n\n const json = await res.json();\n const suggestion = json.choices[0].message.content;\n return suggestion;\n }\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { replaceEditorText } from './chunk-TSF4AJIK.mjs';
|
|
2
|
+
import { getFullEditorTextWithNewlines } from './chunk-3UQM3NLM.mjs';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { ReactEditor } from 'slate-react';
|
|
5
|
+
|
|
6
|
+
function usePopulateCopilotTextareaRef(editor, ref) {
|
|
7
|
+
React.useImperativeHandle(
|
|
8
|
+
ref,
|
|
9
|
+
() => {
|
|
10
|
+
class Combined {
|
|
11
|
+
constructor(customMethods2, editorHtmlElement2) {
|
|
12
|
+
this.customMethods = customMethods2;
|
|
13
|
+
this.editorHtmlElement = editorHtmlElement2;
|
|
14
|
+
}
|
|
15
|
+
get(target, propKey) {
|
|
16
|
+
if (this.isKeyOfCustomMethods(propKey)) {
|
|
17
|
+
const value = this.customMethods[propKey];
|
|
18
|
+
if (typeof value === "function") {
|
|
19
|
+
return value.bind(this.customMethods);
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
} else if (this.isKeyOfHTMLElement(propKey)) {
|
|
23
|
+
const value = this.editorHtmlElement[propKey];
|
|
24
|
+
if (typeof value === "function") {
|
|
25
|
+
return value.bind(this.editorHtmlElement);
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
set(target, propKey, value) {
|
|
31
|
+
if (this.isKeyOfCustomMethods(propKey)) {
|
|
32
|
+
this.customMethods[propKey] = value;
|
|
33
|
+
} else if (this.isKeyOfHTMLElement(propKey)) {
|
|
34
|
+
this.editorHtmlElement[propKey] = value;
|
|
35
|
+
} else {
|
|
36
|
+
target[propKey] = value;
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
isKeyOfCustomMethods(key) {
|
|
41
|
+
return key in this.customMethods;
|
|
42
|
+
}
|
|
43
|
+
isKeyOfHTMLElement(key) {
|
|
44
|
+
return key in this.editorHtmlElement;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const handler = {
|
|
48
|
+
get(target, propKey) {
|
|
49
|
+
return target.get(target, propKey);
|
|
50
|
+
},
|
|
51
|
+
set(target, propKey, value) {
|
|
52
|
+
return target.set(target, propKey, value);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
class CustomMethods {
|
|
56
|
+
constructor(editor2) {
|
|
57
|
+
this.editor = editor2;
|
|
58
|
+
}
|
|
59
|
+
focus() {
|
|
60
|
+
ReactEditor.focus(this.editor);
|
|
61
|
+
}
|
|
62
|
+
blur() {
|
|
63
|
+
ReactEditor.blur(this.editor);
|
|
64
|
+
}
|
|
65
|
+
get value() {
|
|
66
|
+
return getFullEditorTextWithNewlines(this.editor);
|
|
67
|
+
}
|
|
68
|
+
set value(value) {
|
|
69
|
+
replaceEditorText(this.editor, value);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const editorHtmlElement = ReactEditor.toDOMNode(editor, editor);
|
|
73
|
+
const customMethods = new CustomMethods(editor);
|
|
74
|
+
const combined = new Combined(customMethods, editorHtmlElement);
|
|
75
|
+
return new Proxy(combined, handler);
|
|
76
|
+
},
|
|
77
|
+
[editor]
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { usePopulateCopilotTextareaRef };
|
|
82
|
+
//# sourceMappingURL=out.js.map
|
|
83
|
+
//# sourceMappingURL=chunk-AOEXKPIX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts"],"names":["customMethods","editorHtmlElement","editor"],"mappings":";;;;;;;;AAAA,OAAO,WAAW;AAElB,SAAS,mBAAmB;AAMrB,SAAS,8BACd,QACA,KACA;AACA,QAAM;AAAA,IACJ;AAAA,IACA,MAAM;AACJ,YAAM,SAAS;AAAA,QACb,YACUA,gBACAC,oBACR;AAFQ,+BAAAD;AACA,mCAAAC;AAAA,QACP;AAAA,QAIH,IAAI,QAAa,SAAsB;AACrC,cAAI,KAAK,qBAAqB,OAAO,GAAG;AACtC,kBAAM,QAAQ,KAAK,cAAc;AACjC,gBAAI,OAAO,UAAU,YAAY;AAC/B,qBAAO,MAAM,KAAK,KAAK,aAAa;AAAA,YACtC;AACA,mBAAO;AAAA,UACT,WAAW,KAAK,mBAAmB,OAAO,GAAG;AAC3C,kBAAM,QAAQ,KAAK,kBAAkB;AACrC,gBAAI,OAAO,UAAU,YAAY;AAC/B,qBAAO,MAAM,KAAK,KAAK,iBAAiB;AAAA,YAC1C;AACA,mBAAO;AAAA,UACT;AAAA,QACF;AAAA,QAEA,IAAI,QAAa,SAAiB,OAAqB;AACrD,cAAI,KAAK,qBAAqB,OAAO,GAAG;AACtC,YAAC,KAAK,cAAsB,WAAW;AAAA,UACzC,WAAW,KAAK,mBAAmB,OAAO,GAAG;AAC3C,YAAC,KAAK,kBAA0B,WAAW;AAAA,UAC7C,OAAO;AAEL,mBAAO,WAAW;AAAA,UACpB;AACA,iBAAO;AAAA,QACT;AAAA,QAEQ,qBAAqB,KAAyC;AACpE,iBAAO,OAAO,KAAK;AAAA,QACrB;AAAA,QAEQ,mBAAmB,KAAuC;AAChE,iBAAO,OAAO,KAAK;AAAA,QACrB;AAAA,MACF;AAEA,YAAM,UAAU;AAAA,QACd,IAAI,QAAa,SAAkD;AACjE,iBAAO,OAAO,IAAI,QAAQ,OAAO;AAAA,QACnC;AAAA,QACA,IACE,QACA,SACA,OACA;AACA,iBAAO,OAAO,IAAI,QAAQ,SAAS,KAAK;AAAA,QAC1C;AAAA,MACF;AAEA,YAAM,cAAc;AAAA,QAClB,YAAoBC,SAAsB;AAAtB,wBAAAA;AAAA,QAAuB;AAAA,QAE3C,QAAQ;AACN,sBAAY,MAAM,KAAK,MAAM;AAAA,QAC/B;AAAA,QAEA,OAAO;AACL,sBAAY,KAAK,KAAK,MAAM;AAAA,QAC9B;AAAA,QAEA,IAAI,QAAQ;AACV,iBAAO,8BAA8B,KAAK,MAAM;AAAA,QAClD;AAAA,QACA,IAAI,MAAM,OAAe;AACvB,4BAAkB,KAAK,QAAQ,KAAK;AAAA,QACtC;AAAA,MACF;AAEA,YAAM,oBAAoB,YAAY,UAAU,QAAQ,MAAM;AAC9D,YAAM,gBAAgB,IAAI,cAAc,MAAM;AAE9C,YAAM,WAAW,IAAI,SAAS,eAAe,iBAAiB;AAC9D,aAAO,IAAI,MAAM,UAAU,OAAO;AAAA,IACpC;AAAA,IACA,CAAC,MAAM;AAAA,EACT;AACF","sourcesContent":["import React from \"react\";\nimport { Editor } from \"slate\";\nimport { ReactEditor } from \"slate-react\";\nimport { getFullEditorTextWithNewlines } from \"../../lib/get-text-around-cursor\";\nimport { replaceEditorText } from \"../../lib/slatejs-edits/replace-text\";\nimport { HTMLCopilotTextAreaElement } from \"../../types\";\nimport { CustomEditor } from \"../../types/base/custom-editor\";\n\nexport function usePopulateCopilotTextareaRef(\n editor: Editor,\n ref: React.Ref<HTMLCopilotTextAreaElement>\n) {\n React.useImperativeHandle(\n ref,\n () => {\n class Combined {\n constructor(\n private customMethods: CustomMethods,\n private editorHtmlElement: HTMLElement\n ) {}\n\n [key: string]: any;\n\n get(target: any, propKey: string): any {\n if (this.isKeyOfCustomMethods(propKey)) {\n const value = this.customMethods[propKey];\n if (typeof value === \"function\") {\n return value.bind(this.customMethods);\n }\n return value;\n } else if (this.isKeyOfHTMLElement(propKey)) {\n const value = this.editorHtmlElement[propKey];\n if (typeof value === \"function\") {\n return value.bind(this.editorHtmlElement);\n }\n return value;\n }\n }\n\n set(target: any, propKey: string, value: any): boolean {\n if (this.isKeyOfCustomMethods(propKey)) {\n (this.customMethods as any)[propKey] = value;\n } else if (this.isKeyOfHTMLElement(propKey)) {\n (this.editorHtmlElement as any)[propKey] = value;\n } else {\n // Default behavior (optional)\n target[propKey] = value;\n }\n return true;\n }\n\n private isKeyOfCustomMethods(key: string): key is keyof CustomMethods {\n return key in this.customMethods;\n }\n\n private isKeyOfHTMLElement(key: string): key is keyof HTMLElement {\n return key in this.editorHtmlElement;\n }\n }\n\n const handler = {\n get(target: any, propKey: keyof CustomMethods | keyof HTMLElement) {\n return target.get(target, propKey);\n },\n set(\n target: any,\n propKey: keyof CustomMethods | keyof HTMLElement,\n value: any\n ) {\n return target.set(target, propKey, value);\n },\n };\n\n class CustomMethods {\n constructor(private editor: CustomEditor) {}\n\n focus() {\n ReactEditor.focus(this.editor);\n }\n\n blur() {\n ReactEditor.blur(this.editor);\n }\n\n get value() {\n return getFullEditorTextWithNewlines(this.editor);\n }\n set value(value: string) {\n replaceEditorText(this.editor, value);\n }\n }\n\n const editorHtmlElement = ReactEditor.toDOMNode(editor, editor);\n const customMethods = new CustomMethods(editor);\n\n const combined = new Combined(customMethods, editorHtmlElement);\n return new Proxy(combined, handler);\n },\n [editor]\n );\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { withPartialHistory, defaultShouldSave } from './chunk-KCHYD3EB.mjs';
|
|
2
|
+
import { useMemo } from 'react';
|
|
2
3
|
import { createEditor, Element } from 'slate';
|
|
3
4
|
import { withReact } from 'slate-react';
|
|
4
|
-
import { useMemo } from 'react';
|
|
5
5
|
|
|
6
6
|
var shouldSave = (op, prev) => {
|
|
7
7
|
const excludedNodeType = "suggestion";
|
|
@@ -62,4 +62,4 @@ function useCopilotTextareaEditor() {
|
|
|
62
62
|
|
|
63
63
|
export { useCopilotTextareaEditor };
|
|
64
64
|
//# sourceMappingURL=out.js.map
|
|
65
|
-
//# sourceMappingURL=chunk-
|
|
65
|
+
//# sourceMappingURL=chunk-CSGFJU3L.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx"],"names":["editor"],"mappings":";;;;;;AAAA,SAAS,eAAe;AACxB,SAAS,cAAc,eAAe;AACtC,SAAS,iBAAiB;AAQ1B,IAAM,aAAkC,CAAC,IAAI,SAAS;AACpD,QAAM,mBAAmB;AAEzB,MACE,GAAG,SAAS,iBACZ,QAAQ,UAAU,GAAG,IAAI,KACzB,GAAG,KAAK,SAAS,kBACjB;AACA,WAAO;AAAA,EACT;AAEA,MACE,GAAG,SAAS,iBACZ,QAAQ,UAAU,GAAG,IAAI,KACzB,GAAG,KAAK,SAAS,kBACjB;AACA,WAAO;AAAA,EACT;AAEA,MACE,GAAG,SAAS,cACZ,UAAU,GAAG,iBACb,GAAG,cAAc,SAAS,kBAC1B;AACA,WAAO;AAAA,EACT;AAEA,MACE,GAAG,QAAQ,cACX,UAAU,GAAG,cACb,GAAG,WAAW,SAAS,kBACvB;AACA,WAAO;AAAA,EACT;AAEA,MACE,GAAG,SAAS,gBACZ,UAAU,GAAG,cACb,GAAG,WAAW,SAAS,kBACvB;AACA,WAAO;AAAA,EACT;AAEA,MACE,GAAG,SAAS,gBACZ,UAAU,GAAG,cACb,GAAG,WAAW,SAAS,kBACvB;AACA,WAAO;AAAA,EACT;AAGA,SAAO,kBAAkB,IAAI,IAAI;AACnC;AAEO,SAAS,2BAAyC;AACvD,QAAM,SAAS,QAAQ,MAAM;AAC3B,UAAMA,UAAS,mBAAmB,UAAU,aAAa,CAAC,GAAG,UAAU;AAEvE,UAAM,EAAE,OAAO,IAAIA;AACnB,IAAAA,QAAO,SAAS,CAAC,YAAY;AAC3B,cAAQ,QAAQ,MAAM;AAAA,QACpB,KAAK;AACH,iBAAO;AAAA,QACT;AACE,iBAAO,OAAO,OAAO;AAAA,MACzB;AAAA,IACF;AAEA,UAAM,EAAE,aAAa,IAAIA;AACzB,IAAAA,QAAO,eAAe,CAAC,YAAY;AACjC,cAAQ,QAAQ,MAAM;AAAA,QACpB,KAAK;AACH,iBAAO;AAAA,QACT;AACE,iBAAO,aAAa,OAAO;AAAA,MAC/B;AAAA,IACF;AAEA,UAAM,EAAE,SAAS,IAAIA;AACrB,IAAAA,QAAO,WAAW,CAAC,YAAY;AAC7B,cAAQ,QAAQ,MAAM;AAAA,QACpB,KAAK;AACH,iBAAO,QAAQ;AAAA,QACjB;AACE,iBAAO,SAAS,OAAO;AAAA,MAC3B;AAAA,IACF;AAEA,WAAOA;AAAA,EACT,GAAG,CAAC,CAAC;AAEL,SAAO;AACT","sourcesContent":["import { useMemo } from \"react\";\nimport { createEditor, Element } from \"slate\";\nimport { withReact } from \"slate-react\";\nimport {\n defaultShouldSave,\n ShouldSaveToHistory,\n withPartialHistory,\n} from \"../../lib/slatejs-edits/with-partial-history\";\nimport { CustomEditor } from \"../../types/base/custom-editor\";\n\nconst shouldSave: ShouldSaveToHistory = (op, prev) => {\n const excludedNodeType = \"suggestion\";\n // Check if the operation involves the suggestion inline node type\n if (\n op.type === \"insert_node\" &&\n Element.isElement(op.node) &&\n op.node.type === excludedNodeType\n ) {\n return false;\n }\n\n if (\n op.type === \"remove_node\" &&\n Element.isElement(op.node) &&\n op.node.type === excludedNodeType\n ) {\n return false;\n }\n\n if (\n op.type === \"set_node\" &&\n \"type\" in op.newProperties &&\n op.newProperties.type === excludedNodeType\n ) {\n return false;\n }\n\n if (\n op.type == \"set_node\" &&\n \"type\" in op.properties &&\n op.properties.type === excludedNodeType\n ) {\n return false;\n }\n\n if (\n op.type === \"merge_node\" &&\n \"type\" in op.properties &&\n op.properties.type === excludedNodeType\n ) {\n return false;\n }\n\n if (\n op.type === \"split_node\" &&\n \"type\" in op.properties &&\n op.properties.type === excludedNodeType\n ) {\n return false;\n }\n\n // Otherwise, save the operation to history\n return defaultShouldSave(op, prev);\n};\n\nexport function useCopilotTextareaEditor(): CustomEditor {\n const editor = useMemo(() => {\n const editor = withPartialHistory(withReact(createEditor()), shouldSave);\n\n const { isVoid } = editor;\n editor.isVoid = (element) => {\n switch (element.type) {\n case \"suggestion\":\n return true;\n default:\n return isVoid(element);\n }\n };\n\n const { markableVoid } = editor;\n editor.markableVoid = (element) => {\n switch (element.type) {\n case \"suggestion\":\n return true;\n default:\n return markableVoid(element);\n }\n };\n\n const { isInline } = editor;\n editor.isInline = (element) => {\n switch (element.type) {\n case \"suggestion\":\n return element.inline;\n default:\n return isInline(element);\n }\n };\n\n return editor;\n }, []);\n\n return editor;\n}\n"]}
|