@copilotkit/react-textarea 0.16.0 → 0.18.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.
Files changed (53) hide show
  1. package/.turbo/turbo-build.log +29 -27
  2. package/CHANGELOG.md +12 -0
  3. package/dist/{chunk-ZSQLGOES.mjs → chunk-5GGCWNTT.mjs} +5 -5
  4. package/dist/{chunk-ERPZ5XG5.mjs → chunk-BLRD23HM.mjs} +5 -5
  5. package/dist/chunk-BLRD23HM.mjs.map +1 -0
  6. package/dist/{chunk-4ES2IIB6.mjs → chunk-BTAUKCBN.mjs} +4 -4
  7. package/dist/chunk-BTAUKCBN.mjs.map +1 -0
  8. package/dist/{chunk-LGK56BTO.mjs → chunk-JWN2VEE3.mjs} +4 -8
  9. package/dist/chunk-JWN2VEE3.mjs.map +1 -0
  10. package/dist/{chunk-YFA7S5ER.mjs → chunk-LWVCQYWV.mjs} +2 -2
  11. package/dist/{chunk-7KWRVIYV.mjs → chunk-MFJNLKRC.mjs} +1 -1
  12. package/dist/chunk-MFJNLKRC.mjs.map +1 -0
  13. package/dist/{chunk-IGQI27NI.mjs → chunk-MPME5BW2.mjs} +2 -1
  14. package/dist/chunk-MPME5BW2.mjs.map +1 -0
  15. package/dist/chunk-RQHOUUXQ.mjs +29 -0
  16. package/dist/chunk-RQHOUUXQ.mjs.map +1 -0
  17. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +5 -5
  18. package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +1 -1
  19. package/dist/components/copilot-textarea/copilot-textarea.d.ts +3 -2
  20. package/dist/components/copilot-textarea/copilot-textarea.mjs +8 -8
  21. package/dist/components/index.mjs +8 -8
  22. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +2 -2
  23. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +2 -2
  24. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +1 -1
  25. package/dist/index.css +3 -0
  26. package/dist/index.css.map +1 -1
  27. package/dist/index.mjs +8 -8
  28. package/dist/lib/slatejs-edits/replace-text.mjs +1 -1
  29. package/dist/types/base/base-autosuggestions-config.d.ts +2 -2
  30. package/dist/types/base/base-autosuggestions-config.mjs +1 -1
  31. package/dist/types/base/base-copilot-textarea-props.d.ts +3 -3
  32. package/dist/types/base/index.mjs +1 -1
  33. package/dist/types/index.mjs +2 -2
  34. package/dist/types/standard-autosuggestions/autosuggestions-config.d.ts +2 -2
  35. package/dist/types/standard-autosuggestions/autosuggestions-config.mjs +2 -3
  36. package/dist/types/standard-autosuggestions/index.mjs +2 -2
  37. package/package.json +1 -1
  38. package/src/components/base-copilot-textarea/use-add-branding-css.tsx +1 -0
  39. package/src/components/copilot-textarea/copilot-textarea.tsx +4 -2
  40. package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +4 -4
  41. package/src/lib/slatejs-edits/replace-text.ts +21 -29
  42. package/src/types/base/base-autosuggestions-config.tsx +2 -2
  43. package/src/types/base/base-copilot-textarea-props.tsx +3 -3
  44. package/src/types/standard-autosuggestions/autosuggestions-config.tsx +4 -7
  45. package/dist/chunk-42QG2O6L.mjs +0 -34
  46. package/dist/chunk-42QG2O6L.mjs.map +0 -1
  47. package/dist/chunk-4ES2IIB6.mjs.map +0 -1
  48. package/dist/chunk-7KWRVIYV.mjs.map +0 -1
  49. package/dist/chunk-ERPZ5XG5.mjs.map +0 -1
  50. package/dist/chunk-IGQI27NI.mjs.map +0 -1
  51. package/dist/chunk-LGK56BTO.mjs.map +0 -1
  52. /package/dist/{chunk-ZSQLGOES.mjs.map → chunk-5GGCWNTT.mjs.map} +0 -0
  53. /package/dist/{chunk-YFA7S5ER.mjs.map → chunk-LWVCQYWV.mjs.map} +0 -0
@@ -1,5 +1,5 @@
1
1
 
2
- > @copilotkit/react-textarea@0.16.0 build /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/react-textarea
2
+ > @copilotkit/react-textarea@0.18.0 build /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/react-textarea
3
3
  > tsup --treeshake
4
4
 
5
5
  CLI 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
@@ -25,12 +25,14 @@ Generated an empty chunk: "chunk-SL4J5HMW".
25
25
  Generated an empty chunk: "chunk-WJHSY5T6".
26
26
  Generated an empty chunk: "chunk-IU3WTXLQ".
27
27
  Generated an empty chunk: "chunk-H4VKQGVU".
28
- ESM dist/index.css 5.99 KB
28
+ ESM dist/index.css 6.03 KB
29
29
  ESM dist/components/index.css 242.00 B
30
30
  ESM dist/components/base-copilot-textarea/base-copilot-textarea.css 258.00 B
31
31
  ESM dist/components/copilot-textarea/copilot-textarea.css 253.00 B
32
- ESM dist/index.css.map 12.66 KB
32
+ ESM dist/index.css.map 12.71 KB
33
33
  ESM dist/components/index.css.map 429.00 B
34
+ ESM dist/components/base-copilot-textarea/base-copilot-textarea.css.map 432.00 B
35
+ ESM dist/components/copilot-textarea/copilot-textarea.css.map 432.00 B
34
36
  ESM dist/lib/utils.test.mjs 200.00 B
35
37
  ESM dist/lib/slatejs-edits/add-autocompletions.mjs 186.00 B
36
38
  ESM dist/types/html-copilot-textarea-element.mjs 122.00 B
@@ -41,7 +43,7 @@ Generated an empty chunk: "chunk-H4VKQGVU".
41
43
  ESM dist/chunk-MMVDU6DF.mjs 76.00 B
42
44
  ESM dist/chunk-SL4J5HMW.mjs 76.00 B
43
45
  ESM dist/chunk-WJHSY5T6.mjs 76.00 B
44
- ESM dist/chunk-7KWRVIYV.mjs 314.00 B
46
+ ESM dist/chunk-MFJNLKRC.mjs 314.00 B
45
47
  ESM dist/chunk-IU3WTXLQ.mjs 76.00 B
46
48
  ESM dist/chunk-H4VKQGVU.mjs 76.00 B
47
49
  ESM dist/chunk-MRXNTQOX.mjs 1.92 KB
@@ -57,30 +59,28 @@ Generated an empty chunk: "chunk-H4VKQGVU".
57
59
  ESM dist/components/copilot-textarea/copilot-textarea.mjs 907.00 B
58
60
  ESM dist/index.mjs 1.12 KB
59
61
  ESM dist/components/index.mjs 888.00 B
60
- ESM dist/chunk-ERPZ5XG5.mjs 1.23 KB
61
- ESM dist/chunk-4ES2IIB6.mjs 1.76 KB
62
- ESM dist/chunk-LGK56BTO.mjs 2.86 KB
62
+ ESM dist/chunk-BLRD23HM.mjs 1.23 KB
63
+ ESM dist/chunk-BTAUKCBN.mjs 1.77 KB
63
64
  ESM dist/chunk-3A2CNIG5.mjs 949.00 B
64
- ESM dist/chunk-ZSQLGOES.mjs 6.02 KB
65
+ ESM dist/chunk-JWN2VEE3.mjs 2.72 KB
66
+ ESM dist/chunk-5GGCWNTT.mjs 6.02 KB
65
67
  ESM dist/chunk-HZGSG7ST.mjs 3.02 KB
66
68
  ESM dist/chunk-UW3ITU2Y.mjs 496.00 B
67
69
  ESM dist/chunk-CSGFJU3L.mjs 2.01 KB
68
- ESM dist/chunk-YFA7S5ER.mjs 2.57 KB
70
+ ESM dist/chunk-LWVCQYWV.mjs 2.57 KB
69
71
  ESM dist/chunk-WJYQWL4I.mjs 595.00 B
70
72
  ESM dist/chunk-F3MHL6ZY.mjs 680.00 B
71
- ESM dist/chunk-42QG2O6L.mjs 832.00 B
73
+ ESM dist/chunk-RQHOUUXQ.mjs 594.00 B
72
74
  ESM dist/chunk-KCHYD3EB.mjs 3.08 KB
73
75
  ESM dist/chunk-KGKLUWKW.mjs 1.37 KB
74
76
  ESM dist/chunk-LNAIMEB2.mjs 1.09 KB
75
77
  ESM dist/chunk-OELUUJZY.mjs 625.00 B
76
- ESM dist/chunk-IGQI27NI.mjs 2.11 KB
78
+ ESM dist/chunk-MPME5BW2.mjs 2.16 KB
77
79
  ESM dist/lib/debouncer.mjs 153.00 B
78
80
  ESM dist/chunk-NKW5OU2S.mjs 959.00 B
79
81
  ESM dist/lib/editor-to-text.mjs 1.34 KB
80
82
  ESM dist/lib/get-text-around-cursor.mjs 232.00 B
81
83
  ESM dist/chunk-3UQM3NLM.mjs 1.76 KB
82
- ESM dist/components/base-copilot-textarea/base-copilot-textarea.css.map 432.00 B
83
- ESM dist/components/copilot-textarea/copilot-textarea.css.map 432.00 B
84
84
  ESM dist/types/standard-autosuggestions/minimal-chat-gpt-message.mjs 86.00 B
85
85
  ESM dist/types/base/autosuggestion-state.mjs 82.00 B
86
86
  ESM dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs 283.00 B
@@ -93,7 +93,7 @@ Generated an empty chunk: "chunk-H4VKQGVU".
93
93
  ESM dist/types/base/base-autosuggestions-config.mjs 200.00 B
94
94
  ESM dist/types/base/editor-autocomplete-state.mjs 227.00 B
95
95
  ESM dist/types/base/index.mjs 213.00 B
96
- ESM dist/types/standard-autosuggestions/autosuggestions-config.mjs 345.00 B
96
+ ESM dist/types/standard-autosuggestions/autosuggestions-config.mjs 310.00 B
97
97
  ESM dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs 227.00 B
98
98
  ESM dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs 273.00 B
99
99
  ESM dist/lib/utils.test.mjs.map 349.00 B
@@ -106,7 +106,7 @@ Generated an empty chunk: "chunk-H4VKQGVU".
106
106
  ESM dist/chunk-MMVDU6DF.mjs.map 51.00 B
107
107
  ESM dist/chunk-SL4J5HMW.mjs.map 51.00 B
108
108
  ESM dist/chunk-WJHSY5T6.mjs.map 51.00 B
109
- ESM dist/chunk-7KWRVIYV.mjs.map 623.00 B
109
+ ESM dist/chunk-MFJNLKRC.mjs.map 627.00 B
110
110
  ESM dist/chunk-IU3WTXLQ.mjs.map 51.00 B
111
111
  ESM dist/chunk-H4VKQGVU.mjs.map 51.00 B
112
112
  ESM dist/chunk-MRXNTQOX.mjs.map 71.00 B
@@ -122,23 +122,23 @@ Generated an empty chunk: "chunk-H4VKQGVU".
122
122
  ESM dist/components/copilot-textarea/copilot-textarea.mjs.map 51.00 B
123
123
  ESM dist/index.mjs.map 51.00 B
124
124
  ESM dist/components/index.mjs.map 51.00 B
125
- ESM dist/chunk-ERPZ5XG5.mjs.map 2.17 KB
126
- ESM dist/chunk-4ES2IIB6.mjs.map 4.41 KB
127
- ESM dist/chunk-LGK56BTO.mjs.map 4.17 KB
125
+ ESM dist/chunk-BLRD23HM.mjs.map 2.23 KB
126
+ ESM dist/chunk-BTAUKCBN.mjs.map 4.42 KB
128
127
  ESM dist/chunk-3A2CNIG5.mjs.map 2.15 KB
129
- ESM dist/chunk-ZSQLGOES.mjs.map 10.79 KB
128
+ ESM dist/chunk-JWN2VEE3.mjs.map 4.06 KB
129
+ ESM dist/chunk-5GGCWNTT.mjs.map 10.79 KB
130
130
  ESM dist/chunk-HZGSG7ST.mjs.map 5.83 KB
131
131
  ESM dist/chunk-UW3ITU2Y.mjs.map 878.00 B
132
132
  ESM dist/chunk-CSGFJU3L.mjs.map 3.82 KB
133
- ESM dist/chunk-YFA7S5ER.mjs.map 4.80 KB
133
+ ESM dist/chunk-LWVCQYWV.mjs.map 4.80 KB
134
134
  ESM dist/chunk-WJYQWL4I.mjs.map 1.04 KB
135
135
  ESM dist/chunk-F3MHL6ZY.mjs.map 1.14 KB
136
- ESM dist/chunk-42QG2O6L.mjs.map 1.50 KB
136
+ ESM dist/chunk-RQHOUUXQ.mjs.map 1.12 KB
137
137
  ESM dist/chunk-KCHYD3EB.mjs.map 6.12 KB
138
138
  ESM dist/chunk-KGKLUWKW.mjs.map 2.45 KB
139
139
  ESM dist/chunk-LNAIMEB2.mjs.map 1.73 KB
140
140
  ESM dist/chunk-OELUUJZY.mjs.map 957.00 B
141
- ESM dist/chunk-IGQI27NI.mjs.map 3.42 KB
141
+ ESM dist/chunk-MPME5BW2.mjs.map 3.48 KB
142
142
  ESM dist/lib/debouncer.mjs.map 51.00 B
143
143
  ESM dist/chunk-NKW5OU2S.mjs.map 1.60 KB
144
144
  ESM dist/lib/editor-to-text.mjs.map 2.83 KB
@@ -159,20 +159,22 @@ Generated an empty chunk: "chunk-H4VKQGVU".
159
159
  ESM dist/types/standard-autosuggestions/autosuggestions-config.mjs.map 51.00 B
160
160
  ESM dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map 51.00 B
161
161
  ESM dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map 51.00 B
162
- ESM ⚡️ Build success in 2717ms
162
+ ESM ⚡️ Build success in 2581ms
163
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
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 "ChatlikeApiEndpoint" of module "src/types/standard-autosuggestions/chatlike-api-endpoint.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/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
167
  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
168
  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
- DTS ⚡️ Build success in 5119ms
169
+ DTS ⚡️ Build success in 4989ms
168
170
  DTS dist/index.d.ts 1.01 KB
169
171
  DTS dist/components/base-copilot-textarea/base-copilot-textarea.d.ts 669.00 B
170
- DTS dist/components/copilot-textarea/copilot-textarea.d.ts 875.00 B
171
- DTS dist/types/base/base-autosuggestions-config.d.ts 355.00 B
172
+ DTS dist/components/copilot-textarea/copilot-textarea.d.ts 948.00 B
173
+ DTS dist/types/base/base-autosuggestions-config.d.ts 359.00 B
172
174
  DTS dist/types/base/autosuggestions-bare-function.d.ts 162.00 B
173
175
  DTS dist/types/base/base-copilot-textarea-props.d.ts 1.89 KB
174
176
  DTS dist/types/html-copilot-textarea-element.d.ts 165.00 B
175
- DTS dist/types/standard-autosuggestions/autosuggestions-config.d.ts 963.00 B
177
+ DTS dist/types/standard-autosuggestions/autosuggestions-config.d.ts 983.00 B
176
178
  DTS dist/types/standard-autosuggestions/minimal-chat-gpt-message.d.ts 129.00 B
177
179
  DTS dist/types/standard-autosuggestions/chatlike-api-endpoint.d.ts 1004.00 B
178
180
  DTS dist/components/index.d.ts 630.00 B
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # ui
2
2
 
3
+ ## 0.18.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e9624bc: fix text replacement behavior
8
+
9
+ ## 0.17.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 6624a13: Textarea: no default apiEndpoint, textareaPurpose, css bugfix
14
+
3
15
  ## 0.16.0
4
16
 
5
17
  ### Minor Changes
@@ -1,13 +1,13 @@
1
1
  import { useAutosuggestions } from './chunk-HZGSG7ST.mjs';
2
2
  import { useCopilotTextareaEditor } from './chunk-CSGFJU3L.mjs';
3
- import { usePopulateCopilotTextareaRef } from './chunk-YFA7S5ER.mjs';
3
+ import { usePopulateCopilotTextareaRef } from './chunk-LWVCQYWV.mjs';
4
4
  import { addAutocompletionsToEditor } from './chunk-WJYQWL4I.mjs';
5
5
  import { clearAutocompletionsFromEditor } from './chunk-F3MHL6ZY.mjs';
6
- import { replaceEditorText } from './chunk-42QG2O6L.mjs';
7
- import { defaultBaseAutosuggestionsConfig } from './chunk-7KWRVIYV.mjs';
6
+ import { replaceEditorText } from './chunk-RQHOUUXQ.mjs';
7
+ import { defaultBaseAutosuggestionsConfig } from './chunk-MFJNLKRC.mjs';
8
8
  import { makeRenderElementFunction } from './chunk-LNAIMEB2.mjs';
9
9
  import { makeRenderPlaceholderFunction } from './chunk-OELUUJZY.mjs';
10
- import { useAddBrandingCss } from './chunk-IGQI27NI.mjs';
10
+ import { useAddBrandingCss } from './chunk-MPME5BW2.mjs';
11
11
  import { getTextAroundCursor, getFullEditorTextWithNewlines } from './chunk-3UQM3NLM.mjs';
12
12
  import { __spreadValues, __objRest } from './chunk-MRXNTQOX.mjs';
13
13
  import React, { useMemo, useState, useCallback, useEffect } from 'react';
@@ -160,4 +160,4 @@ function makeSemiFakeReactTextAreaEvent(currentText) {
160
160
 
161
161
  export { BaseCopilotTextarea };
162
162
  //# sourceMappingURL=out.js.map
163
- //# sourceMappingURL=chunk-ZSQLGOES.mjs.map
163
+ //# sourceMappingURL=chunk-5GGCWNTT.mjs.map
@@ -1,6 +1,6 @@
1
- import { useMakeStandardAutosuggestionFunction } from './chunk-4ES2IIB6.mjs';
2
- import { defaultAutosuggestionsConfig } from './chunk-LGK56BTO.mjs';
3
- import { BaseCopilotTextarea } from './chunk-ZSQLGOES.mjs';
1
+ import { useMakeStandardAutosuggestionFunction } from './chunk-BTAUKCBN.mjs';
2
+ import { defaultAutosuggestionsConfig } from './chunk-JWN2VEE3.mjs';
3
+ import { BaseCopilotTextarea } from './chunk-5GGCWNTT.mjs';
4
4
  import { __spreadValues, __spreadProps } from './chunk-MRXNTQOX.mjs';
5
5
  import React from 'react';
6
6
  import { jsx, Fragment } from 'react/jsx-runtime';
@@ -9,7 +9,7 @@ var CopilotTextarea = React.forwardRef(
9
9
  (props, ref) => {
10
10
  const autosuggestionsConfig = __spreadValues(__spreadValues({}, defaultAutosuggestionsConfig), props.autosuggestionsConfig);
11
11
  const autosuggestionsFunction = useMakeStandardAutosuggestionFunction(
12
- autosuggestionsConfig.purposePrompt,
12
+ autosuggestionsConfig.textareaPurpose,
13
13
  autosuggestionsConfig.apiEndpoint,
14
14
  autosuggestionsConfig.makeSystemPrompt,
15
15
  autosuggestionsConfig.fewShotMessages,
@@ -29,4 +29,4 @@ var CopilotTextarea = React.forwardRef(
29
29
 
30
30
  export { CopilotTextarea };
31
31
  //# sourceMappingURL=out.js.map
32
- //# sourceMappingURL=chunk-ERPZ5XG5.mjs.map
32
+ //# sourceMappingURL=chunk-BLRD23HM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/copilot-textarea/copilot-textarea.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,OAAO,WAAW;AAsCZ,mBACE,WADF;AApBC,IAAM,kBAAkB,MAAM;AAAA,EACnC,CACE,OACA,QACgB;AAChB,UAAM,wBAA+C,kCAChD,+BACA,MAAM;AAGX,UAAM,0BAA0B;AAAA,MAC9B,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,IACxB;AAEA,WACE;AAAA,MACE,8BAAC;AAAA,QACC;AAAA,SACI,QAFL;AAAA,QAGC;AAAA,QACA;AAAA,QACF;AAAA,KACF;AAAA,EAEJ;AACF","sourcesContent":["// This example is for an Editor with `ReactEditor` and `HistoryEditor`\nimport React from \"react\";\nimport { useMakeStandardAutosuggestionFunction } from \"../../hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function\";\nimport { HTMLCopilotTextAreaElement } from \"../../types\";\nimport { BaseCopilotTextareaProps } from \"../../types/base/base-copilot-textarea-props\";\nimport {\n AutosuggestionsConfig,\n ChatlikeApiEndpoint,\n defaultAutosuggestionsConfig,\n} from \"../../types/standard-autosuggestions\";\nimport { BaseCopilotTextarea } from \"../base-copilot-textarea/base-copilot-textarea\";\n\nexport interface CopilotTextareaProps extends BaseCopilotTextareaProps {\n autosuggestionsConfig: Partial<AutosuggestionsConfig> & {\n textareaPurpose: string;\n apiEndpoint: ChatlikeApiEndpoint;\n };\n}\n\nexport const CopilotTextarea = React.forwardRef(\n (\n props: CopilotTextareaProps,\n ref: React.Ref<HTMLCopilotTextAreaElement>\n ): JSX.Element => {\n const autosuggestionsConfig: AutosuggestionsConfig = {\n ...defaultAutosuggestionsConfig,\n ...props.autosuggestionsConfig,\n };\n\n const autosuggestionsFunction = useMakeStandardAutosuggestionFunction(\n autosuggestionsConfig.textareaPurpose,\n autosuggestionsConfig.apiEndpoint,\n autosuggestionsConfig.makeSystemPrompt,\n autosuggestionsConfig.fewShotMessages,\n autosuggestionsConfig.externalContextCategories,\n autosuggestionsConfig.forwardedParams\n );\n\n return (\n <>\n <BaseCopilotTextarea\n ref={ref}\n {...props}\n autosuggestionsConfig={autosuggestionsConfig}\n autosuggestionsFunction={autosuggestionsFunction}\n />\n </>\n );\n }\n);\n"]}
@@ -2,7 +2,7 @@ import { __async } from './chunk-MRXNTQOX.mjs';
2
2
  import { CopilotContext } from '@copilotkit/react-core';
3
3
  import { useContext, useCallback } from 'react';
4
4
 
5
- function useMakeStandardAutosuggestionFunction(purposePrompt, apiEndpoint, makeSystemPrompt, fewShotMessages, contextCategories, forwardedProps) {
5
+ function useMakeStandardAutosuggestionFunction(textareaPurpose, apiEndpoint, makeSystemPrompt, fewShotMessages, contextCategories, forwardedProps) {
6
6
  const { getContextString } = useContext(CopilotContext);
7
7
  return useCallback(
8
8
  (beforeText, afterText, abortSignal) => __async(this, null, function* () {
@@ -11,7 +11,7 @@ function useMakeStandardAutosuggestionFunction(purposePrompt, apiEndpoint, makeS
11
11
  {
12
12
  role: "system",
13
13
  content: makeSystemPrompt(
14
- purposePrompt,
14
+ textareaPurpose,
15
15
  getContextString(contextCategories)
16
16
  )
17
17
  },
@@ -37,7 +37,7 @@ function useMakeStandardAutosuggestionFunction(purposePrompt, apiEndpoint, makeS
37
37
  fewShotMessages,
38
38
  getContextString,
39
39
  contextCategories,
40
- purposePrompt
40
+ textareaPurpose
41
41
  ]
42
42
  );
43
43
  }
@@ -57,4 +57,4 @@ function retry(fn, retriesLeft = 2, interval = 200, backoff = 1.5) {
57
57
 
58
58
  export { useMakeStandardAutosuggestionFunction };
59
59
  //# sourceMappingURL=out.js.map
60
- //# sourceMappingURL=chunk-4ES2IIB6.mjs.map
60
+ //# sourceMappingURL=chunk-BTAUKCBN.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,iBACA,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 textareaPurpose - 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 textareaPurpose: 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 textareaPurpose,\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 textareaPurpose,\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"]}
@@ -1,13 +1,12 @@
1
- import { ChatlikeApiEndpoint } from './chunk-3A2CNIG5.mjs';
2
- import { defaultBaseAutosuggestionsConfig } from './chunk-7KWRVIYV.mjs';
1
+ import { defaultBaseAutosuggestionsConfig } from './chunk-MFJNLKRC.mjs';
3
2
  import { __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
4
3
 
5
4
  // src/types/standard-autosuggestions/autosuggestions-config.tsx
6
- var defaultMakeSystemPrompt = (purposePrompt, contextString) => {
5
+ var defaultMakeSystemPrompt = (textareaPurpose, contextString) => {
7
6
  return `You are a versatile writing assistant.
8
7
 
9
8
  The user is writing some text.
10
- The purpose is: "${purposePrompt}"
9
+ The purpose is: "${textareaPurpose}"
11
10
 
12
11
  Your job is to guess what the user will write next AS BEST YOU CAN.
13
12
  Only guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.
@@ -58,9 +57,6 @@ var defaultFewShotMessages = [
58
57
  }
59
58
  ];
60
59
  var defaultAutosuggestionsConfig = __spreadProps(__spreadValues({}, defaultBaseAutosuggestionsConfig), {
61
- apiEndpoint: ChatlikeApiEndpoint.standardOpenAIEndpoint(
62
- "api/autosuggestions"
63
- ),
64
60
  makeSystemPrompt: defaultMakeSystemPrompt,
65
61
  fewShotMessages: defaultFewShotMessages,
66
62
  externalContextCategories: void 0,
@@ -69,4 +65,4 @@ var defaultAutosuggestionsConfig = __spreadProps(__spreadValues({}, defaultBaseA
69
65
 
70
66
  export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt };
71
67
  //# sourceMappingURL=out.js.map
72
- //# sourceMappingURL=chunk-LGK56BTO.mjs.map
68
+ //# sourceMappingURL=chunk-JWN2VEE3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/standard-autosuggestions/autosuggestions-config.tsx"],"names":[],"mappings":";;;;;;;;;AAoBO,IAAM,0BAA4C,CACvD,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,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,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 textareaPurpose: 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 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 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 \"textareaPurpose\" | \"apiEndpoint\"\n> = {\n ...defaultBaseAutosuggestionsConfig,\n\n makeSystemPrompt: defaultMakeSystemPrompt,\n fewShotMessages: defaultFewShotMessages,\n externalContextCategories: undefined,\n forwardedParams: undefined,\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { replaceEditorText } from './chunk-42QG2O6L.mjs';
1
+ import { replaceEditorText } from './chunk-RQHOUUXQ.mjs';
2
2
  import { getFullEditorTextWithNewlines } from './chunk-3UQM3NLM.mjs';
3
3
  import React from 'react';
4
4
  import { ReactEditor } from 'slate-react';
@@ -80,4 +80,4 @@ function usePopulateCopilotTextareaRef(editor, ref) {
80
80
 
81
81
  export { usePopulateCopilotTextareaRef };
82
82
  //# sourceMappingURL=out.js.map
83
- //# sourceMappingURL=chunk-YFA7S5ER.mjs.map
83
+ //# sourceMappingURL=chunk-LWVCQYWV.mjs.map
@@ -8,4 +8,4 @@ var defaultBaseAutosuggestionsConfig = {
8
8
 
9
9
  export { defaultBaseAutosuggestionsConfig };
10
10
  //# sourceMappingURL=out.js.map
11
- //# sourceMappingURL=chunk-7KWRVIYV.mjs.map
11
+ //# sourceMappingURL=chunk-MFJNLKRC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/base/base-autosuggestions-config.tsx"],"names":[],"mappings":";AAQO,IAAM,mCAGT;AAAA,EACF,cAAc;AAAA,EACd,yBAAyB;AAAA,EACzB,kBAAkB;AAAA,EAClB,UAAU;AACZ","sourcesContent":["export interface BaseAutosuggestionsConfig {\n textareaPurpose: string;\n debounceTime: number;\n acceptAutosuggestionKey: string;\n disableWhenEmpty: boolean;\n disabled: boolean;\n}\n\nexport const defaultBaseAutosuggestionsConfig: Omit<\n BaseAutosuggestionsConfig,\n \"textareaPurpose\"\n> = {\n debounceTime: 500,\n acceptAutosuggestionKey: \"Tab\",\n disableWhenEmpty: true,\n disabled: false,\n};\n"]}
@@ -23,6 +23,7 @@ function useAddBrandingCss(suggestionStyleAugmented, disableBranding) {
23
23
  dynamicStyles += `margin: 0;`;
24
24
  dynamicStyles += `border: 0;`;
25
25
  dynamicStyles += `line-height: 1;`;
26
+ dynamicStyles += `position: absolute;`;
26
27
  styleEl.innerHTML = `
27
28
  ${cssSelector}::after {
28
29
  ${dynamicStyles}
@@ -55,4 +56,4 @@ function useAddBrandingCss(suggestionStyleAugmented, disableBranding) {
55
56
 
56
57
  export { useAddBrandingCss };
57
58
  //# sourceMappingURL=out.js.map
58
- //# sourceMappingURL=chunk-IGQI27NI.mjs.map
59
+ //# sourceMappingURL=chunk-MPME5BW2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/base-copilot-textarea/use-add-branding-css.tsx"],"names":["styleEl"],"mappings":";AAAA,SAAS,iBAAiB;AAEnB,SAAS,kBACd,0BACA,iBACA;AACA,QAAM,cAAc;AACpB,YAAU,MAAM;AACd,QAAI,iBAAiB;AACnB;AAAA,IACF;AAIA,UAAM,UAAU,SAAS,cAAc,OAAO;AAC9C,YAAQ,KAAK;AAGb,QAAI,gBAAgB,OAAO,QAAQ,wBAAwB,EACxD,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AACrB,YAAM,eAAe,IAClB,QAAQ,gCAAgC,OAAO,EAC/C,YAAY;AACf,aAAO,GAAG,iBAAiB;AAAA,IAC7B,CAAC,EACA,KAAK,GAAG;AAGX,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AAGjB,YAAQ,YAAY;AAAA,QAChB;AAAA,UACE;AAAA;AAAA;AAIN,aAAS,KAAK,YAAY,OAAO;AAIjC,UAAM,WAAW,SAAS,cAAc,WAAW;AACnD,UAAM,eAAe,MAAM;AACzB,YAAMA,WAAU,SAAS,eAAe,gBAAgB;AACxD,UAAIA,YAAW,UAAU;AACvB,cAAM,mBAAmB,CAAC,SAAS,YAAY;AAC/C,cAAM,kBAAkB,CAAC,SAAS,aAAa;AAC/C,QAAAA,SAAQ,YAAY;AAAA,YAChB;AAAA,cACE;AAAA,sBACQ;AAAA,qBACD;AAAA;AAAA;AAAA,MAGf;AAAA,IACF;AAEA,yCAAU,iBAAiB,UAAU;AAGrC,WAAO,MAAM;AAtEjB;AAuEM,qBAAS,eAAe,gBAAgB,MAAxC,mBAA2C;AAC3C,2CAAU,oBAAoB,UAAU;AAAA,IAC1C;AAAA,EACF,GAAG,CAAC,iBAAiB,wBAAwB,CAAC;AAChD","sourcesContent":["import { useEffect } from \"react\";\n\nexport function useAddBrandingCss(\n suggestionStyleAugmented: React.CSSProperties,\n disableBranding: boolean | undefined\n) {\n const cssSelector = \".copilot-textarea.with-branding\";\n useEffect(() => {\n if (disableBranding) {\n return;\n }\n\n // ---\n // 1: Add the CSS to the DOM\n const styleEl = document.createElement(\"style\");\n styleEl.id = \"dynamic-styles\";\n\n // Build the CSS string dynamically\n let dynamicStyles = Object.entries(suggestionStyleAugmented)\n .map(([key, value]) => {\n const kebabCaseKey = key\n .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, \"$1-$2\")\n .toLowerCase();\n return `${kebabCaseKey}: ${value};`;\n })\n .join(\" \");\n\n // Append overrides for italics and font-size\n dynamicStyles += `font-style: normal; font-size: x-small;`;\n dynamicStyles += `content: \"CopilotKit\";`;\n dynamicStyles += `bottom: 6px;`;\n dynamicStyles += `right: 6px;`;\n dynamicStyles += `pointer-events: none;`;\n dynamicStyles += `font-weight: 200;`;\n dynamicStyles += `padding: 0;`;\n dynamicStyles += `margin: 0;`;\n dynamicStyles += `border: 0;`;\n dynamicStyles += `line-height: 1;`;\n dynamicStyles += `position: absolute;`;\n\n // Append it to the ::after class\n styleEl.innerHTML = `\n ${cssSelector}::after {\n ${dynamicStyles}\n }\n `;\n\n document.head.appendChild(styleEl);\n\n // ---\n // 2: Add the scroll listener (to keep the branding in the bottom right as the textarea scrolls)\n const textarea = document.querySelector(cssSelector);\n const handleScroll = () => {\n const styleEl = document.getElementById(\"dynamic-styles\");\n if (styleEl && textarea) {\n const offsetFromBottom = -textarea.scrollTop + 6;\n const offsetFromRight = -textarea.scrollLeft + 6;\n styleEl.innerHTML = `\n ${cssSelector}::after {\n ${dynamicStyles}\n bottom: ${offsetFromBottom}px;\n right: ${offsetFromRight}px;\n }\n `;\n }\n };\n\n textarea?.addEventListener(\"scroll\", handleScroll);\n\n // Cleanup\n return () => {\n document.getElementById(\"dynamic-styles\")?.remove();\n textarea?.removeEventListener(\"scroll\", handleScroll);\n };\n }, [disableBranding, suggestionStyleAugmented]);\n}\n"]}
@@ -0,0 +1,29 @@
1
+ import { Transforms, Editor } from 'slate';
2
+
3
+ // src/lib/slatejs-edits/replace-text.ts
4
+ function replaceEditorText(editor, newText) {
5
+ Transforms.delete(editor, {
6
+ at: {
7
+ anchor: Editor.start(editor, []),
8
+ focus: Editor.end(editor, [])
9
+ }
10
+ });
11
+ if (newText && newText !== "") {
12
+ Transforms.insertNodes(
13
+ editor,
14
+ [
15
+ {
16
+ type: "paragraph",
17
+ children: [{ text: newText }]
18
+ }
19
+ ],
20
+ {
21
+ at: [0]
22
+ }
23
+ );
24
+ }
25
+ }
26
+
27
+ export { replaceEditorText };
28
+ //# sourceMappingURL=out.js.map
29
+ //# sourceMappingURL=chunk-RQHOUUXQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/slatejs-edits/replace-text.ts"],"names":[],"mappings":";AAAA,SAAS,QAAQ,kBAAkB;AAE5B,SAAS,kBAAkB,QAAgB,SAAiB;AAEjE,aAAW,OAAO,QAAQ;AAAA,IACxB,IAAI;AAAA,MACF,QAAQ,OAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,MAC/B,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,IAC9B;AAAA,EACF,CAAC;AAGD,MAAI,WAAW,YAAY,IAAI;AAE7B,eAAW;AAAA,MACT;AAAA,MACA;AAAA,QACE;AAAA,UACE,MAAM;AAAA,UACN,UAAU,CAAC,EAAE,MAAM,QAAQ,CAAC;AAAA,QAC9B;AAAA,MACF;AAAA,MACA;AAAA,QACE,IAAI,CAAC,CAAC;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF","sourcesContent":["import { Editor, Transforms } from \"slate\";\n\nexport function replaceEditorText(editor: Editor, newText: string) {\n // clear all previous text\n Transforms.delete(editor, {\n at: {\n anchor: Editor.start(editor, []),\n focus: Editor.end(editor, []),\n },\n });\n\n // insert new text\n if (newText && newText !== \"\") {\n // don't insert empty text - results in strange visual behavior\n Transforms.insertNodes(\n editor,\n [\n {\n type: \"paragraph\",\n children: [{ text: newText }],\n },\n ],\n {\n at: [0],\n }\n );\n }\n}\n"]}
@@ -1,18 +1,18 @@
1
- export { BaseCopilotTextarea } from '../../chunk-ZSQLGOES.mjs';
1
+ export { BaseCopilotTextarea } from '../../chunk-5GGCWNTT.mjs';
2
2
  import '../../chunk-HZGSG7ST.mjs';
3
3
  import '../../chunk-UW3ITU2Y.mjs';
4
4
  import '../../chunk-CSGFJU3L.mjs';
5
- import '../../chunk-YFA7S5ER.mjs';
5
+ import '../../chunk-LWVCQYWV.mjs';
6
6
  import '../../chunk-WJYQWL4I.mjs';
7
7
  import '../../chunk-F3MHL6ZY.mjs';
8
- import '../../chunk-42QG2O6L.mjs';
8
+ import '../../chunk-RQHOUUXQ.mjs';
9
9
  import '../../chunk-KCHYD3EB.mjs';
10
10
  import '../../chunk-KGKLUWKW.mjs';
11
11
  import '../../chunk-WJHSY5T6.mjs';
12
- import '../../chunk-7KWRVIYV.mjs';
12
+ import '../../chunk-MFJNLKRC.mjs';
13
13
  import '../../chunk-LNAIMEB2.mjs';
14
14
  import '../../chunk-OELUUJZY.mjs';
15
- import '../../chunk-IGQI27NI.mjs';
15
+ import '../../chunk-MPME5BW2.mjs';
16
16
  import '../../chunk-NKW5OU2S.mjs';
17
17
  import '../../chunk-3UQM3NLM.mjs';
18
18
  import '../../chunk-MRXNTQOX.mjs';
@@ -1,4 +1,4 @@
1
- export { useAddBrandingCss } from '../../chunk-IGQI27NI.mjs';
1
+ export { useAddBrandingCss } from '../../chunk-MPME5BW2.mjs';
2
2
  import '../../chunk-MRXNTQOX.mjs';
3
3
  //# sourceMappingURL=out.js.map
4
4
  //# sourceMappingURL=use-add-branding-css.mjs.map
@@ -2,13 +2,14 @@ import React from 'react';
2
2
  import { BaseCopilotTextareaProps } from '../../types/base/base-copilot-textarea-props.js';
3
3
  import { HTMLCopilotTextAreaElement } from '../../types/html-copilot-textarea-element.js';
4
4
  import { AutosuggestionsConfig } from '../../types/standard-autosuggestions/autosuggestions-config.js';
5
+ import { ChatlikeApiEndpoint } from '../../types/standard-autosuggestions/chatlike-api-endpoint.js';
5
6
  import '../../types/base/base-autosuggestions-config.js';
6
- import '../../types/standard-autosuggestions/chatlike-api-endpoint.js';
7
7
  import '../../types/standard-autosuggestions/minimal-chat-gpt-message.js';
8
8
 
9
9
  interface CopilotTextareaProps extends BaseCopilotTextareaProps {
10
10
  autosuggestionsConfig: Partial<AutosuggestionsConfig> & {
11
- purposePrompt: string;
11
+ textareaPurpose: string;
12
+ apiEndpoint: ChatlikeApiEndpoint;
12
13
  };
13
14
  }
14
15
  declare const CopilotTextarea: React.ForwardRefExoticComponent<CopilotTextareaProps & React.RefAttributes<HTMLCopilotTextAreaElement>>;
@@ -1,23 +1,23 @@
1
- export { CopilotTextarea } from '../../chunk-ERPZ5XG5.mjs';
2
- import '../../chunk-4ES2IIB6.mjs';
1
+ export { CopilotTextarea } from '../../chunk-BLRD23HM.mjs';
2
+ import '../../chunk-BTAUKCBN.mjs';
3
3
  import '../../chunk-SL4J5HMW.mjs';
4
- import '../../chunk-LGK56BTO.mjs';
5
4
  import '../../chunk-3A2CNIG5.mjs';
6
- import '../../chunk-ZSQLGOES.mjs';
5
+ import '../../chunk-JWN2VEE3.mjs';
6
+ import '../../chunk-5GGCWNTT.mjs';
7
7
  import '../../chunk-HZGSG7ST.mjs';
8
8
  import '../../chunk-UW3ITU2Y.mjs';
9
9
  import '../../chunk-CSGFJU3L.mjs';
10
- import '../../chunk-YFA7S5ER.mjs';
10
+ import '../../chunk-LWVCQYWV.mjs';
11
11
  import '../../chunk-WJYQWL4I.mjs';
12
12
  import '../../chunk-F3MHL6ZY.mjs';
13
- import '../../chunk-42QG2O6L.mjs';
13
+ import '../../chunk-RQHOUUXQ.mjs';
14
14
  import '../../chunk-KCHYD3EB.mjs';
15
15
  import '../../chunk-KGKLUWKW.mjs';
16
16
  import '../../chunk-WJHSY5T6.mjs';
17
- import '../../chunk-7KWRVIYV.mjs';
17
+ import '../../chunk-MFJNLKRC.mjs';
18
18
  import '../../chunk-LNAIMEB2.mjs';
19
19
  import '../../chunk-OELUUJZY.mjs';
20
- import '../../chunk-IGQI27NI.mjs';
20
+ import '../../chunk-MPME5BW2.mjs';
21
21
  import '../../chunk-NKW5OU2S.mjs';
22
22
  import '../../chunk-3UQM3NLM.mjs';
23
23
  import '../../chunk-MRXNTQOX.mjs';
@@ -1,24 +1,24 @@
1
1
  import '../chunk-MMVDU6DF.mjs';
2
- export { CopilotTextarea } from '../chunk-ERPZ5XG5.mjs';
3
- import '../chunk-4ES2IIB6.mjs';
2
+ export { CopilotTextarea } from '../chunk-BLRD23HM.mjs';
3
+ import '../chunk-BTAUKCBN.mjs';
4
4
  import '../chunk-SL4J5HMW.mjs';
5
- import '../chunk-LGK56BTO.mjs';
6
5
  import '../chunk-3A2CNIG5.mjs';
7
- export { BaseCopilotTextarea } from '../chunk-ZSQLGOES.mjs';
6
+ import '../chunk-JWN2VEE3.mjs';
7
+ export { BaseCopilotTextarea } from '../chunk-5GGCWNTT.mjs';
8
8
  import '../chunk-HZGSG7ST.mjs';
9
9
  import '../chunk-UW3ITU2Y.mjs';
10
10
  import '../chunk-CSGFJU3L.mjs';
11
- import '../chunk-YFA7S5ER.mjs';
11
+ import '../chunk-LWVCQYWV.mjs';
12
12
  import '../chunk-WJYQWL4I.mjs';
13
13
  import '../chunk-F3MHL6ZY.mjs';
14
- import '../chunk-42QG2O6L.mjs';
14
+ import '../chunk-RQHOUUXQ.mjs';
15
15
  import '../chunk-KCHYD3EB.mjs';
16
16
  import '../chunk-KGKLUWKW.mjs';
17
17
  import '../chunk-WJHSY5T6.mjs';
18
- import '../chunk-7KWRVIYV.mjs';
18
+ import '../chunk-MFJNLKRC.mjs';
19
19
  import '../chunk-LNAIMEB2.mjs';
20
20
  import '../chunk-OELUUJZY.mjs';
21
- import '../chunk-IGQI27NI.mjs';
21
+ import '../chunk-MPME5BW2.mjs';
22
22
  import '../chunk-NKW5OU2S.mjs';
23
23
  import '../chunk-3UQM3NLM.mjs';
24
24
  import '../chunk-MRXNTQOX.mjs';
@@ -1,5 +1,5 @@
1
- export { usePopulateCopilotTextareaRef } from '../../chunk-YFA7S5ER.mjs';
2
- import '../../chunk-42QG2O6L.mjs';
1
+ export { usePopulateCopilotTextareaRef } from '../../chunk-LWVCQYWV.mjs';
2
+ import '../../chunk-RQHOUUXQ.mjs';
3
3
  import '../../chunk-3UQM3NLM.mjs';
4
4
  import '../../chunk-MRXNTQOX.mjs';
5
5
  //# sourceMappingURL=out.js.map
@@ -10,14 +10,14 @@ import '../../types/base/base-autosuggestions-config.js';
10
10
  * It sends a POST request to the API endpoint with the messages array containing the system message, few shot messages, and user messages.
11
11
  * The function returns the suggestion from the API response.
12
12
  *
13
- * @param purposePrompt - The purpose of the textarea. This is included in the system message.
13
+ * @param textareaPurpose - The purpose of the textarea. This is included in the system message.
14
14
  * @param apiEndpoint - The API endpoint to send the autosuggestion request to.
15
15
  * @param makeSystemMessage - A function that takes in a context string and returns a system message to include in the autosuggestion request.
16
16
  * @param fewShotMessages - An array of few shot messages to include in the autosuggestion request.
17
17
  * @param contextCategories - The categories of context strings we want to include. By default, we include the (default) "global" context category.
18
18
  * @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.
19
19
  */
20
- declare function useMakeStandardAutosuggestionFunction(purposePrompt: string, apiEndpoint: ChatlikeApiEndpoint, makeSystemPrompt: MakeSystemPrompt, fewShotMessages: MinimalChatGPTMessage[], contextCategories: string[] | undefined, forwardedProps?: {
20
+ declare function useMakeStandardAutosuggestionFunction(textareaPurpose: string, apiEndpoint: ChatlikeApiEndpoint, makeSystemPrompt: MakeSystemPrompt, fewShotMessages: MinimalChatGPTMessage[], contextCategories: string[] | undefined, forwardedProps?: {
21
21
  [key: string]: any;
22
22
  }): AutosuggestionsBareFunction;
23
23
 
@@ -1,4 +1,4 @@
1
- export { useMakeStandardAutosuggestionFunction } from '../../chunk-4ES2IIB6.mjs';
1
+ export { useMakeStandardAutosuggestionFunction } from '../../chunk-BTAUKCBN.mjs';
2
2
  import '../../chunk-MRXNTQOX.mjs';
3
3
  //# sourceMappingURL=out.js.map
4
4
  //# sourceMappingURL=use-make-standard-autosuggestions-function.mjs.map
package/dist/index.css CHANGED
@@ -318,6 +318,9 @@ video {
318
318
  .static {
319
319
  position: static;
320
320
  }
321
+ .absolute {
322
+ position: absolute;
323
+ }
321
324
  .block {
322
325
  display: block;
323
326
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/styles.css","../src/components/base-copilot-textarea/base-copilot-textarea.css"],"sourcesContent":["/*\n! tailwindcss v3.3.0 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n*/\n\nhtml {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font family by default.\n2. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\n[type='button'],\n[type='reset'],\n[type='submit'] {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n.static {\n position: static;\n}\n.block {\n display: block;\n}\n.inline {\n display: inline;\n}\n.resize-y {\n resize: vertical;\n}\n.overflow-y-auto {\n overflow-y: auto;\n}\n.border {\n border-width: 1px;\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity));\n}\n.italic {\n font-style: italic;\n}\n.blur {\n --tw-blur: blur(8px);\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n",".copilot-textarea.with-branding::after {\n content: ''; /* Initially empty because we overrdie this CSS dynamically and we want to avoid flashing */\n position: absolute;\n}\n \n \n.copilot-textarea.no-branding::after {\n content: '';\n}"],"mappings":";AAOA;AAAA;AAAA;AAGE;AACA;AACA;AACA;AAAA;AAGF;AAAA;AAEE;AAAA;AAYF;AACE;AACA;AACA;AACA;AACG;AACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAQF;AACE;AACA;AAAA;AASF;AACE;AACA;AACA;AAAA;AAOF;AACE;AACQ;AAAA;AAOV;AAAA;AAAA;AAAA;AAAA;AAAA;AAME;AACA;AAAA;AAOF;AACE;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AAAA;AAAA;AAAA;AAIE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAEE;AACA;AACA;AACA;AAAA;AAGF;AACE;AAAA;AAGF;AACE;AAAA;AASF;AACE;AACA;AACA;AAAA;AASF;AAAA;AAAA;AAAA;AAAA;AAKE;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AAAA;AAAA;AAAA;AAIE;AACA;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AACE;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AACE;AACA;AAAA;AAOF;AACE;AAAA;AAQF;AACE;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaE;AAAA;AAGF;AACE;AACA;AAAA;AAGF;AACE;AAAA;AAGF;AAAA;AAAA;AAGE;AACA;AACA;AAAA;AAOF;AACE;AAAA;AAQF;AAAA;AACE;AACA;AAAA;AAGF;AAAA;AAEE;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAMF;AACE;AAAA;AASF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQE;AACA;AAAA;AAOF;AAAA;AAEE;AACA;AAAA;AAIF;AACE;AAAA;AAGF;AAAA;AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAGF;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AACA;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AACA;AAAA;AAEF;AACE;AAAA;;;ACtfF;AACI;AACA;AAAA;AAIJ;AACI;AAAA;","names":[]}
1
+ {"version":3,"sources":["../src/styles.css","../src/components/base-copilot-textarea/base-copilot-textarea.css"],"sourcesContent":["/*\n! tailwindcss v3.3.0 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n*/\n\nhtml {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font family by default.\n2. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\n[type='button'],\n[type='reset'],\n[type='submit'] {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n.static {\n position: static;\n}\n.absolute {\n position: absolute;\n}\n.block {\n display: block;\n}\n.inline {\n display: inline;\n}\n.resize-y {\n resize: vertical;\n}\n.overflow-y-auto {\n overflow-y: auto;\n}\n.border {\n border-width: 1px;\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity));\n}\n.italic {\n font-style: italic;\n}\n.blur {\n --tw-blur: blur(8px);\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n",".copilot-textarea.with-branding::after {\n content: ''; /* Initially empty because we overrdie this CSS dynamically and we want to avoid flashing */\n position: absolute;\n}\n \n \n.copilot-textarea.no-branding::after {\n content: '';\n}"],"mappings":";AAOA;AAAA;AAAA;AAGE;AACA;AACA;AACA;AAAA;AAGF;AAAA;AAEE;AAAA;AAYF;AACE;AACA;AACA;AACA;AACG;AACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAQF;AACE;AACA;AAAA;AASF;AACE;AACA;AACA;AAAA;AAOF;AACE;AACQ;AAAA;AAOV;AAAA;AAAA;AAAA;AAAA;AAAA;AAME;AACA;AAAA;AAOF;AACE;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AAAA;AAAA;AAAA;AAIE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAEE;AACA;AACA;AACA;AAAA;AAGF;AACE;AAAA;AAGF;AACE;AAAA;AASF;AACE;AACA;AACA;AAAA;AASF;AAAA;AAAA;AAAA;AAAA;AAKE;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AAAA;AAAA;AAAA;AAIE;AACA;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AACE;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AACE;AACA;AAAA;AAOF;AACE;AAAA;AAQF;AACE;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaE;AAAA;AAGF;AACE;AACA;AAAA;AAGF;AACE;AAAA;AAGF;AAAA;AAAA;AAGE;AACA;AACA;AAAA;AAOF;AACE;AAAA;AAQF;AAAA;AACE;AACA;AAAA;AAGF;AAAA;AAEE;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAMF;AACE;AAAA;AASF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQE;AACA;AAAA;AAOF;AAAA;AAEE;AACA;AAAA;AAIF;AACE;AAAA;AAGF;AAAA;AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAGF;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AACA;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AACA;AAAA;AAEF;AACE;AAAA;;;ACzfF;AACI;AACA;AAAA;AAIJ;AACI;AAAA;","names":[]}
package/dist/index.mjs CHANGED
@@ -1,26 +1,26 @@
1
1
  import './chunk-DE5K76I2.mjs';
2
2
  import './chunk-WADHCMPK.mjs';
3
3
  import './chunk-MMVDU6DF.mjs';
4
- export { CopilotTextarea } from './chunk-ERPZ5XG5.mjs';
5
- import './chunk-4ES2IIB6.mjs';
4
+ export { CopilotTextarea } from './chunk-BLRD23HM.mjs';
5
+ import './chunk-BTAUKCBN.mjs';
6
6
  import './chunk-SL4J5HMW.mjs';
7
- export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from './chunk-LGK56BTO.mjs';
8
7
  export { ChatlikeApiEndpoint } from './chunk-3A2CNIG5.mjs';
9
- export { BaseCopilotTextarea } from './chunk-ZSQLGOES.mjs';
8
+ export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from './chunk-JWN2VEE3.mjs';
9
+ export { BaseCopilotTextarea } from './chunk-5GGCWNTT.mjs';
10
10
  import './chunk-HZGSG7ST.mjs';
11
11
  import './chunk-UW3ITU2Y.mjs';
12
12
  import './chunk-CSGFJU3L.mjs';
13
- import './chunk-YFA7S5ER.mjs';
13
+ import './chunk-LWVCQYWV.mjs';
14
14
  import './chunk-WJYQWL4I.mjs';
15
15
  import './chunk-F3MHL6ZY.mjs';
16
- import './chunk-42QG2O6L.mjs';
16
+ import './chunk-RQHOUUXQ.mjs';
17
17
  import './chunk-KCHYD3EB.mjs';
18
18
  import './chunk-KGKLUWKW.mjs';
19
19
  import './chunk-WJHSY5T6.mjs';
20
- export { defaultBaseAutosuggestionsConfig } from './chunk-7KWRVIYV.mjs';
20
+ export { defaultBaseAutosuggestionsConfig } from './chunk-MFJNLKRC.mjs';
21
21
  import './chunk-LNAIMEB2.mjs';
22
22
  import './chunk-OELUUJZY.mjs';
23
- import './chunk-IGQI27NI.mjs';
23
+ import './chunk-MPME5BW2.mjs';
24
24
  import './chunk-IU3WTXLQ.mjs';
25
25
  import './chunk-H4VKQGVU.mjs';
26
26
  import './chunk-NKW5OU2S.mjs';
@@ -1,4 +1,4 @@
1
- export { replaceEditorText } from '../../chunk-42QG2O6L.mjs';
1
+ export { replaceEditorText } from '../../chunk-RQHOUUXQ.mjs';
2
2
  import '../../chunk-MRXNTQOX.mjs';
3
3
  //# sourceMappingURL=out.js.map
4
4
  //# sourceMappingURL=replace-text.mjs.map
@@ -1,10 +1,10 @@
1
1
  interface BaseAutosuggestionsConfig {
2
- purposePrompt: string;
2
+ textareaPurpose: string;
3
3
  debounceTime: number;
4
4
  acceptAutosuggestionKey: string;
5
5
  disableWhenEmpty: boolean;
6
6
  disabled: boolean;
7
7
  }
8
- declare const defaultBaseAutosuggestionsConfig: Omit<BaseAutosuggestionsConfig, "purposePrompt">;
8
+ declare const defaultBaseAutosuggestionsConfig: Omit<BaseAutosuggestionsConfig, "textareaPurpose">;
9
9
 
10
10
  export { BaseAutosuggestionsConfig, defaultBaseAutosuggestionsConfig };
@@ -1,4 +1,4 @@
1
- export { defaultBaseAutosuggestionsConfig } from '../../chunk-7KWRVIYV.mjs';
1
+ export { defaultBaseAutosuggestionsConfig } from '../../chunk-MFJNLKRC.mjs';
2
2
  import '../../chunk-MRXNTQOX.mjs';
3
3
  //# sourceMappingURL=out.js.map
4
4
  //# sourceMappingURL=base-autosuggestions-config.mjs.map
@@ -19,9 +19,9 @@ import { BaseAutosuggestionsConfig } from './base-autosuggestions-config.js';
19
19
  * @property {(event: React.ChangeEvent<HTMLTextAreaElement>) => void} [onChange] - Callback invoked when a `change` event is triggered on the textarea element. The event only actually includes the `event.target.value` and `event.currentTarget.value` properties (all that is required in 99% of cases).
20
20
  *
21
21
  * @property {Partial<BaseAutosuggestionsConfig> & {
22
- * purposePrompt: string;
22
+ * textareaPurpose: string;
23
23
  * }} autosuggestionsConfig - Configuration settings for the autosuggestions feature.
24
- * Includes a mandatory `purposePrompt` to guide the autosuggestions.
24
+ * Includes a mandatory `textareaPurpose` to guide the autosuggestions.
25
25
  */
26
26
  interface BaseCopilotTextareaProps extends Omit<TextareaHTMLAttributes<HTMLDivElement>, "onChange"> {
27
27
  disableBranding?: boolean;
@@ -31,7 +31,7 @@ interface BaseCopilotTextareaProps extends Omit<TextareaHTMLAttributes<HTMLDivEl
31
31
  onValueChange?: (value: string) => void;
32
32
  onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
33
33
  autosuggestionsConfig: Partial<BaseAutosuggestionsConfig> & {
34
- purposePrompt: string;
34
+ textareaPurpose: string;
35
35
  };
36
36
  }
37
37
 
@@ -1,5 +1,5 @@
1
1
  import '../../chunk-WJHSY5T6.mjs';
2
- export { defaultBaseAutosuggestionsConfig } from '../../chunk-7KWRVIYV.mjs';
2
+ export { defaultBaseAutosuggestionsConfig } from '../../chunk-MFJNLKRC.mjs';
3
3
  import '../../chunk-MRXNTQOX.mjs';
4
4
  //# sourceMappingURL=out.js.map
5
5
  //# sourceMappingURL=index.mjs.map
@@ -1,10 +1,10 @@
1
1
  import '../chunk-DE5K76I2.mjs';
2
2
  import '../chunk-WADHCMPK.mjs';
3
3
  import '../chunk-SL4J5HMW.mjs';
4
- export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../chunk-LGK56BTO.mjs';
5
4
  export { ChatlikeApiEndpoint } from '../chunk-3A2CNIG5.mjs';
5
+ export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../chunk-JWN2VEE3.mjs';
6
6
  import '../chunk-WJHSY5T6.mjs';
7
- export { defaultBaseAutosuggestionsConfig } from '../chunk-7KWRVIYV.mjs';
7
+ export { defaultBaseAutosuggestionsConfig } from '../chunk-MFJNLKRC.mjs';
8
8
  import '../chunk-MRXNTQOX.mjs';
9
9
  //# sourceMappingURL=out.js.map
10
10
  //# sourceMappingURL=index.mjs.map
@@ -2,7 +2,7 @@ import { BaseAutosuggestionsConfig } from '../base/base-autosuggestions-config.j
2
2
  import { ChatlikeApiEndpoint } from './chatlike-api-endpoint.js';
3
3
  import { MinimalChatGPTMessage } from './minimal-chat-gpt-message.js';
4
4
 
5
- type MakeSystemPrompt = (purposePrompt: string, contextString: string) => string;
5
+ type MakeSystemPrompt = (textareaPurpose: string, contextString: string) => string;
6
6
  interface AutosuggestionsConfig extends BaseAutosuggestionsConfig {
7
7
  apiEndpoint: ChatlikeApiEndpoint;
8
8
  externalContextCategories: string[] | undefined;
@@ -14,6 +14,6 @@ interface AutosuggestionsConfig extends BaseAutosuggestionsConfig {
14
14
  }
15
15
  declare const defaultMakeSystemPrompt: MakeSystemPrompt;
16
16
  declare const defaultFewShotMessages: MinimalChatGPTMessage[];
17
- declare const defaultAutosuggestionsConfig: Omit<AutosuggestionsConfig, "purposePrompt">;
17
+ declare const defaultAutosuggestionsConfig: Omit<AutosuggestionsConfig, "textareaPurpose" | "apiEndpoint">;
18
18
 
19
19
  export { AutosuggestionsConfig, MakeSystemPrompt, defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt };
@@ -1,7 +1,6 @@
1
- export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../../chunk-LGK56BTO.mjs';
2
- import '../../chunk-3A2CNIG5.mjs';
1
+ export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../../chunk-JWN2VEE3.mjs';
3
2
  import '../../chunk-WJHSY5T6.mjs';
4
- import '../../chunk-7KWRVIYV.mjs';
3
+ import '../../chunk-MFJNLKRC.mjs';
5
4
  import '../../chunk-MRXNTQOX.mjs';
6
5
  //# sourceMappingURL=out.js.map
7
6
  //# sourceMappingURL=autosuggestions-config.mjs.map
@@ -1,8 +1,8 @@
1
1
  import '../../chunk-SL4J5HMW.mjs';
2
- export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../../chunk-LGK56BTO.mjs';
3
2
  export { ChatlikeApiEndpoint } from '../../chunk-3A2CNIG5.mjs';
3
+ export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../../chunk-JWN2VEE3.mjs';
4
4
  import '../../chunk-WJHSY5T6.mjs';
5
- import '../../chunk-7KWRVIYV.mjs';
5
+ import '../../chunk-MFJNLKRC.mjs';
6
6
  import '../../chunk-MRXNTQOX.mjs';
7
7
  //# sourceMappingURL=out.js.map
8
8
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.16.0",
7
+ "version": "0.18.0",
8
8
  "sideEffects": [
9
9
  "**/*.css"
10
10
  ],
@@ -36,6 +36,7 @@ export function useAddBrandingCss(
36
36
  dynamicStyles += `margin: 0;`;
37
37
  dynamicStyles += `border: 0;`;
38
38
  dynamicStyles += `line-height: 1;`;
39
+ dynamicStyles += `position: absolute;`;
39
40
 
40
41
  // Append it to the ::after class
41
42
  styleEl.innerHTML = `
@@ -5,13 +5,15 @@ import { HTMLCopilotTextAreaElement } from "../../types";
5
5
  import { BaseCopilotTextareaProps } from "../../types/base/base-copilot-textarea-props";
6
6
  import {
7
7
  AutosuggestionsConfig,
8
+ ChatlikeApiEndpoint,
8
9
  defaultAutosuggestionsConfig,
9
10
  } from "../../types/standard-autosuggestions";
10
11
  import { BaseCopilotTextarea } from "../base-copilot-textarea/base-copilot-textarea";
11
12
 
12
13
  export interface CopilotTextareaProps extends BaseCopilotTextareaProps {
13
14
  autosuggestionsConfig: Partial<AutosuggestionsConfig> & {
14
- purposePrompt: string;
15
+ textareaPurpose: string;
16
+ apiEndpoint: ChatlikeApiEndpoint;
15
17
  };
16
18
  }
17
19
 
@@ -26,7 +28,7 @@ export const CopilotTextarea = React.forwardRef(
26
28
  };
27
29
 
28
30
  const autosuggestionsFunction = useMakeStandardAutosuggestionFunction(
29
- autosuggestionsConfig.purposePrompt,
31
+ autosuggestionsConfig.textareaPurpose,
30
32
  autosuggestionsConfig.apiEndpoint,
31
33
  autosuggestionsConfig.makeSystemPrompt,
32
34
  autosuggestionsConfig.fewShotMessages,
@@ -12,7 +12,7 @@ import { ChatlikeApiEndpoint } from "../../types/standard-autosuggestions/chatli
12
12
  * It sends a POST request to the API endpoint with the messages array containing the system message, few shot messages, and user messages.
13
13
  * The function returns the suggestion from the API response.
14
14
  *
15
- * @param purposePrompt - The purpose of the textarea. This is included in the system message.
15
+ * @param textareaPurpose - The purpose of the textarea. This is included in the system message.
16
16
  * @param apiEndpoint - The API endpoint to send the autosuggestion request to.
17
17
  * @param makeSystemMessage - A function that takes in a context string and returns a system message to include in the autosuggestion request.
18
18
  * @param fewShotMessages - An array of few shot messages to include in the autosuggestion request.
@@ -20,7 +20,7 @@ import { ChatlikeApiEndpoint } from "../../types/standard-autosuggestions/chatli
20
20
  * @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.
21
21
  */
22
22
  export function useMakeStandardAutosuggestionFunction(
23
- purposePrompt: string,
23
+ textareaPurpose: string,
24
24
  apiEndpoint: ChatlikeApiEndpoint,
25
25
  makeSystemPrompt: MakeSystemPrompt,
26
26
  fewShotMessages: MinimalChatGPTMessage[],
@@ -36,7 +36,7 @@ export function useMakeStandardAutosuggestionFunction(
36
36
  {
37
37
  role: "system",
38
38
  content: makeSystemPrompt(
39
- purposePrompt,
39
+ textareaPurpose,
40
40
  getContextString(contextCategories)
41
41
  ),
42
42
  },
@@ -64,7 +64,7 @@ export function useMakeStandardAutosuggestionFunction(
64
64
  fewShotMessages,
65
65
  getContextString,
66
66
  contextCategories,
67
- purposePrompt,
67
+ textareaPurpose,
68
68
  ]
69
69
  );
70
70
  }
@@ -1,36 +1,28 @@
1
- import { Editor, Element, Node, Path, Transforms } from "slate";
1
+ import { Editor, Transforms } from "slate";
2
2
 
3
3
  export function replaceEditorText(editor: Editor, newText: string) {
4
4
  // clear all previous text
5
- const paths: Path[] = [];
6
- for (const [node, path] of Node.nodes(editor)) {
7
- if (
8
- Element.isElement(node) &&
9
- (node.type === "paragraph" || node.type === "suggestion") &&
10
- path.length === 1
11
- ) {
12
- paths.push(path);
13
- }
14
- }
15
- for (const path of paths) {
16
- try {
17
- Transforms.removeNodes(editor, { at: path });
18
- } catch (e) {
19
- console.log("CopilotTextarea.replaceEditorText: error removing node", e);
20
- }
21
- }
5
+ Transforms.delete(editor, {
6
+ at: {
7
+ anchor: Editor.start(editor, []),
8
+ focus: Editor.end(editor, []),
9
+ },
10
+ });
22
11
 
23
12
  // insert new text
24
- Transforms.insertNodes(
25
- editor,
26
- [
13
+ if (newText && newText !== "") {
14
+ // don't insert empty text - results in strange visual behavior
15
+ Transforms.insertNodes(
16
+ editor,
17
+ [
18
+ {
19
+ type: "paragraph",
20
+ children: [{ text: newText }],
21
+ },
22
+ ],
27
23
  {
28
- type: "paragraph",
29
- children: [{ text: newText }],
30
- },
31
- ],
32
- {
33
- at: [0],
34
- }
35
- );
24
+ at: [0],
25
+ }
26
+ );
27
+ }
36
28
  }
@@ -1,5 +1,5 @@
1
1
  export interface BaseAutosuggestionsConfig {
2
- purposePrompt: string;
2
+ textareaPurpose: string;
3
3
  debounceTime: number;
4
4
  acceptAutosuggestionKey: string;
5
5
  disableWhenEmpty: boolean;
@@ -8,7 +8,7 @@ export interface BaseAutosuggestionsConfig {
8
8
 
9
9
  export const defaultBaseAutosuggestionsConfig: Omit<
10
10
  BaseAutosuggestionsConfig,
11
- "purposePrompt"
11
+ "textareaPurpose"
12
12
  > = {
13
13
  debounceTime: 500,
14
14
  acceptAutosuggestionKey: "Tab",
@@ -19,9 +19,9 @@ import { BaseAutosuggestionsConfig } from ".";
19
19
  * @property {(event: React.ChangeEvent<HTMLTextAreaElement>) => void} [onChange] - Callback invoked when a `change` event is triggered on the textarea element. The event only actually includes the `event.target.value` and `event.currentTarget.value` properties (all that is required in 99% of cases).
20
20
  *
21
21
  * @property {Partial<BaseAutosuggestionsConfig> & {
22
- * purposePrompt: string;
22
+ * textareaPurpose: string;
23
23
  * }} autosuggestionsConfig - Configuration settings for the autosuggestions feature.
24
- * Includes a mandatory `purposePrompt` to guide the autosuggestions.
24
+ * Includes a mandatory `textareaPurpose` to guide the autosuggestions.
25
25
  */
26
26
  export interface BaseCopilotTextareaProps
27
27
  extends Omit<TextareaHTMLAttributes<HTMLDivElement>, "onChange"> {
@@ -32,6 +32,6 @@ export interface BaseCopilotTextareaProps
32
32
  onValueChange?: (value: string) => void;
33
33
  onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
34
34
  autosuggestionsConfig: Partial<BaseAutosuggestionsConfig> & {
35
- purposePrompt: string;
35
+ textareaPurpose: string;
36
36
  };
37
37
  }
@@ -6,7 +6,7 @@ import { ChatlikeApiEndpoint } from "./chatlike-api-endpoint";
6
6
  import { MinimalChatGPTMessage } from "./minimal-chat-gpt-message";
7
7
 
8
8
  export type MakeSystemPrompt = (
9
- purposePrompt: string,
9
+ textareaPurpose: string,
10
10
  contextString: string
11
11
  ) => string;
12
12
 
@@ -19,13 +19,13 @@ export interface AutosuggestionsConfig extends BaseAutosuggestionsConfig {
19
19
  }
20
20
 
21
21
  export const defaultMakeSystemPrompt: MakeSystemPrompt = (
22
- purposePrompt,
22
+ textareaPurpose,
23
23
  contextString
24
24
  ) => {
25
25
  return `You are a versatile writing assistant.
26
26
 
27
27
  The user is writing some text.
28
- The purpose is: \"${purposePrompt}\"
28
+ The purpose is: \"${textareaPurpose}\"
29
29
 
30
30
  Your job is to guess what the user will write next AS BEST YOU CAN.
31
31
  Only guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.
@@ -83,13 +83,10 @@ export const defaultFewShotMessages: MinimalChatGPTMessage[] = [
83
83
  ];
84
84
  export const defaultAutosuggestionsConfig: Omit<
85
85
  AutosuggestionsConfig,
86
- "purposePrompt"
86
+ "textareaPurpose" | "apiEndpoint"
87
87
  > = {
88
88
  ...defaultBaseAutosuggestionsConfig,
89
89
 
90
- apiEndpoint: ChatlikeApiEndpoint.standardOpenAIEndpoint(
91
- "api/autosuggestions"
92
- ),
93
90
  makeSystemPrompt: defaultMakeSystemPrompt,
94
91
  fewShotMessages: defaultFewShotMessages,
95
92
  externalContextCategories: undefined,
@@ -1,34 +0,0 @@
1
- import { Node, Element, Transforms } from 'slate';
2
-
3
- // src/lib/slatejs-edits/replace-text.ts
4
- function replaceEditorText(editor, newText) {
5
- const paths = [];
6
- for (const [node, path] of Node.nodes(editor)) {
7
- if (Element.isElement(node) && (node.type === "paragraph" || node.type === "suggestion") && path.length === 1) {
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.replaceEditorText: error removing node", e);
16
- }
17
- }
18
- Transforms.insertNodes(
19
- editor,
20
- [
21
- {
22
- type: "paragraph",
23
- children: [{ text: newText }]
24
- }
25
- ],
26
- {
27
- at: [0]
28
- }
29
- );
30
- }
31
-
32
- export { replaceEditorText };
33
- //# sourceMappingURL=out.js.map
34
- //# sourceMappingURL=chunk-42QG2O6L.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/slatejs-edits/replace-text.ts"],"names":[],"mappings":";AAAA,SAAiB,SAAS,MAAY,kBAAkB;AAEjD,SAAS,kBAAkB,QAAgB,SAAiB;AAEjE,QAAM,QAAgB,CAAC;AACvB,aAAW,CAAC,MAAM,IAAI,KAAK,KAAK,MAAM,MAAM,GAAG;AAC7C,QACE,QAAQ,UAAU,IAAI,MACrB,KAAK,SAAS,eAAe,KAAK,SAAS,iBAC5C,KAAK,WAAW,GAChB;AACA,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,0DAA0D,CAAC;AAAA,IACzE;AAAA,EACF;AAGA,aAAW;AAAA,IACT;AAAA,IACA;AAAA,MACE;AAAA,QACE,MAAM;AAAA,QACN,UAAU,CAAC,EAAE,MAAM,QAAQ,CAAC;AAAA,MAC9B;AAAA,IACF;AAAA,IACA;AAAA,MACE,IAAI,CAAC,CAAC;AAAA,IACR;AAAA,EACF;AACF","sourcesContent":["import { Editor, Element, Node, Path, Transforms } from \"slate\";\n\nexport function replaceEditorText(editor: Editor, newText: string) {\n // clear all previous text\n const paths: Path[] = [];\n for (const [node, path] of Node.nodes(editor)) {\n if (\n Element.isElement(node) &&\n (node.type === \"paragraph\" || node.type === \"suggestion\") &&\n path.length === 1\n ) {\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.replaceEditorText: error removing node\", e);\n }\n }\n\n // insert new text\n Transforms.insertNodes(\n editor,\n [\n {\n type: \"paragraph\",\n children: [{ text: newText }],\n },\n ],\n {\n at: [0],\n }\n );\n}\n"]}
@@ -1 +0,0 @@
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"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/types/base/base-autosuggestions-config.tsx"],"names":[],"mappings":";AAQO,IAAM,mCAGT;AAAA,EACF,cAAc;AAAA,EACd,yBAAyB;AAAA,EACzB,kBAAkB;AAAA,EAClB,UAAU;AACZ","sourcesContent":["export interface BaseAutosuggestionsConfig {\n purposePrompt: string;\n debounceTime: number;\n acceptAutosuggestionKey: string;\n disableWhenEmpty: boolean;\n disabled: boolean;\n}\n\nexport const defaultBaseAutosuggestionsConfig: Omit<\n BaseAutosuggestionsConfig,\n \"purposePrompt\"\n> = {\n debounceTime: 500,\n acceptAutosuggestionKey: \"Tab\",\n disableWhenEmpty: true,\n disabled: false,\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/copilot-textarea/copilot-textarea.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,OAAO,WAAW;AAoCZ,mBACE,WADF;AApBC,IAAM,kBAAkB,MAAM;AAAA,EACnC,CACE,OACA,QACgB;AAChB,UAAM,wBAA+C,kCAChD,+BACA,MAAM;AAGX,UAAM,0BAA0B;AAAA,MAC9B,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,IACxB;AAEA,WACE;AAAA,MACE,8BAAC;AAAA,QACC;AAAA,SACI,QAFL;AAAA,QAGC;AAAA,QACA;AAAA,QACF;AAAA,KACF;AAAA,EAEJ;AACF","sourcesContent":["// This example is for an Editor with `ReactEditor` and `HistoryEditor`\nimport React from \"react\";\nimport { useMakeStandardAutosuggestionFunction } from \"../../hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function\";\nimport { HTMLCopilotTextAreaElement } from \"../../types\";\nimport { BaseCopilotTextareaProps } from \"../../types/base/base-copilot-textarea-props\";\nimport {\n AutosuggestionsConfig,\n defaultAutosuggestionsConfig,\n} from \"../../types/standard-autosuggestions\";\nimport { BaseCopilotTextarea } from \"../base-copilot-textarea/base-copilot-textarea\";\n\nexport interface CopilotTextareaProps extends BaseCopilotTextareaProps {\n autosuggestionsConfig: Partial<AutosuggestionsConfig> & {\n purposePrompt: string;\n };\n}\n\nexport const CopilotTextarea = React.forwardRef(\n (\n props: CopilotTextareaProps,\n ref: React.Ref<HTMLCopilotTextAreaElement>\n ): JSX.Element => {\n const autosuggestionsConfig: AutosuggestionsConfig = {\n ...defaultAutosuggestionsConfig,\n ...props.autosuggestionsConfig,\n };\n\n const autosuggestionsFunction = useMakeStandardAutosuggestionFunction(\n autosuggestionsConfig.purposePrompt,\n autosuggestionsConfig.apiEndpoint,\n autosuggestionsConfig.makeSystemPrompt,\n autosuggestionsConfig.fewShotMessages,\n autosuggestionsConfig.externalContextCategories,\n autosuggestionsConfig.forwardedParams\n );\n\n return (\n <>\n <BaseCopilotTextarea\n ref={ref}\n {...props}\n autosuggestionsConfig={autosuggestionsConfig}\n autosuggestionsFunction={autosuggestionsFunction}\n />\n </>\n );\n }\n);\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/base-copilot-textarea/use-add-branding-css.tsx"],"names":["styleEl"],"mappings":";AAAA,SAAS,iBAAiB;AAEnB,SAAS,kBACd,0BACA,iBACA;AACA,QAAM,cAAc;AACpB,YAAU,MAAM;AACd,QAAI,iBAAiB;AACnB;AAAA,IACF;AAIA,UAAM,UAAU,SAAS,cAAc,OAAO;AAC9C,YAAQ,KAAK;AAGb,QAAI,gBAAgB,OAAO,QAAQ,wBAAwB,EACxD,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AACrB,YAAM,eAAe,IAClB,QAAQ,gCAAgC,OAAO,EAC/C,YAAY;AACf,aAAO,GAAG,iBAAiB;AAAA,IAC7B,CAAC,EACA,KAAK,GAAG;AAGX,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AAGjB,YAAQ,YAAY;AAAA,QAChB;AAAA,UACE;AAAA;AAAA;AAIN,aAAS,KAAK,YAAY,OAAO;AAIjC,UAAM,WAAW,SAAS,cAAc,WAAW;AACnD,UAAM,eAAe,MAAM;AACzB,YAAMA,WAAU,SAAS,eAAe,gBAAgB;AACxD,UAAIA,YAAW,UAAU;AACvB,cAAM,mBAAmB,CAAC,SAAS,YAAY;AAC/C,cAAM,kBAAkB,CAAC,SAAS,aAAa;AAC/C,QAAAA,SAAQ,YAAY;AAAA,YAChB;AAAA,cACE;AAAA,sBACQ;AAAA,qBACD;AAAA;AAAA;AAAA,MAGf;AAAA,IACF;AAEA,yCAAU,iBAAiB,UAAU;AAGrC,WAAO,MAAM;AArEjB;AAsEM,qBAAS,eAAe,gBAAgB,MAAxC,mBAA2C;AAC3C,2CAAU,oBAAoB,UAAU;AAAA,IAC1C;AAAA,EACF,GAAG,CAAC,iBAAiB,wBAAwB,CAAC;AAChD","sourcesContent":["import { useEffect } from \"react\";\n\nexport function useAddBrandingCss(\n suggestionStyleAugmented: React.CSSProperties,\n disableBranding: boolean | undefined\n) {\n const cssSelector = \".copilot-textarea.with-branding\";\n useEffect(() => {\n if (disableBranding) {\n return;\n }\n\n // ---\n // 1: Add the CSS to the DOM\n const styleEl = document.createElement(\"style\");\n styleEl.id = \"dynamic-styles\";\n\n // Build the CSS string dynamically\n let dynamicStyles = Object.entries(suggestionStyleAugmented)\n .map(([key, value]) => {\n const kebabCaseKey = key\n .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, \"$1-$2\")\n .toLowerCase();\n return `${kebabCaseKey}: ${value};`;\n })\n .join(\" \");\n\n // Append overrides for italics and font-size\n dynamicStyles += `font-style: normal; font-size: x-small;`;\n dynamicStyles += `content: \"CopilotKit\";`;\n dynamicStyles += `bottom: 6px;`;\n dynamicStyles += `right: 6px;`;\n dynamicStyles += `pointer-events: none;`;\n dynamicStyles += `font-weight: 200;`;\n dynamicStyles += `padding: 0;`;\n dynamicStyles += `margin: 0;`;\n dynamicStyles += `border: 0;`;\n dynamicStyles += `line-height: 1;`;\n\n // Append it to the ::after class\n styleEl.innerHTML = `\n ${cssSelector}::after {\n ${dynamicStyles}\n }\n `;\n\n document.head.appendChild(styleEl);\n\n // ---\n // 2: Add the scroll listener (to keep the branding in the bottom right as the textarea scrolls)\n const textarea = document.querySelector(cssSelector);\n const handleScroll = () => {\n const styleEl = document.getElementById(\"dynamic-styles\");\n if (styleEl && textarea) {\n const offsetFromBottom = -textarea.scrollTop + 6;\n const offsetFromRight = -textarea.scrollLeft + 6;\n styleEl.innerHTML = `\n ${cssSelector}::after {\n ${dynamicStyles}\n bottom: ${offsetFromBottom}px;\n right: ${offsetFromRight}px;\n }\n `;\n }\n };\n\n textarea?.addEventListener(\"scroll\", handleScroll);\n\n // Cleanup\n return () => {\n document.getElementById(\"dynamic-styles\")?.remove();\n textarea?.removeEventListener(\"scroll\", handleScroll);\n };\n }, [disableBranding, suggestionStyleAugmented]);\n}\n"]}
@@ -1 +0,0 @@
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"]}