@copilotkit/react-textarea 0.21.0-alpha.1 → 0.21.0-alpha.3

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 (147) hide show
  1. package/.turbo/turbo-build.log +314 -182
  2. package/CHANGELOG.md +22 -0
  3. package/dist/{chunk-F4WZCQG6.mjs → chunk-7D5DUGLT.mjs} +4 -4
  4. package/dist/{chunk-7JO276KU.mjs → chunk-G4U3POLM.mjs} +2 -2
  5. package/dist/{chunk-IPM5WWPW.mjs → chunk-NHYCKIK7.mjs} +4 -4
  6. package/dist/{chunk-LRXRD5KU.mjs → chunk-QQ3KP25O.mjs} +2 -2
  7. package/dist/{chunk-34D4UIYX.mjs → chunk-YF4T3ZZF.mjs} +18 -18
  8. package/dist/components/base-copilot-textarea/base-copilot-textarea.js +1772 -0
  9. package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -0
  10. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +16 -16
  11. package/dist/components/base-copilot-textarea/render-element.js +75 -0
  12. package/dist/components/base-copilot-textarea/render-element.js.map +1 -0
  13. package/dist/components/base-copilot-textarea/render-placeholder.js +69 -0
  14. package/dist/components/base-copilot-textarea/render-placeholder.js.map +1 -0
  15. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js +112 -0
  16. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js.map +1 -0
  17. package/dist/components/base-copilot-textarea/use-add-branding-css.js +83 -0
  18. package/dist/components/base-copilot-textarea/use-add-branding-css.js.map +1 -0
  19. package/dist/components/copilot-textarea/copilot-textarea.js +2246 -0
  20. package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -0
  21. package/dist/components/copilot-textarea/copilot-textarea.mjs +25 -25
  22. package/dist/components/hovering-toolbar/hovering-editor-provider.js +49 -0
  23. package/dist/components/hovering-toolbar/hovering-editor-provider.js.map +1 -0
  24. package/dist/components/hovering-toolbar/hovering-toolbar-components.js +158 -0
  25. package/dist/components/hovering-toolbar/hovering-toolbar-components.js.map +1 -0
  26. package/dist/components/hovering-toolbar/hovering-toolbar.js +915 -0
  27. package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -0
  28. package/dist/components/hovering-toolbar/hovering-toolbar.mjs +7 -7
  29. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +622 -0
  30. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js.map +1 -0
  31. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +3 -3
  32. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +639 -0
  33. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js.map +1 -0
  34. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +4 -4
  35. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js +140 -0
  36. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js.map +1 -0
  37. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +639 -0
  38. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js.map +1 -0
  39. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +4 -4
  40. package/dist/components/index.js +2250 -0
  41. package/dist/components/index.js.map +1 -0
  42. package/dist/components/index.mjs +25 -25
  43. package/dist/components/manual-ui/chip-with-icon.js +53 -0
  44. package/dist/components/manual-ui/chip-with-icon.js.map +1 -0
  45. package/dist/components/source-search-box/source-search-box.js +243 -0
  46. package/dist/components/source-search-box/source-search-box.js.map +1 -0
  47. package/dist/components/ui/button.js +118 -0
  48. package/dist/components/ui/button.js.map +1 -0
  49. package/dist/components/ui/card.js +142 -0
  50. package/dist/components/ui/card.js.map +1 -0
  51. package/dist/components/ui/command.js +306 -0
  52. package/dist/components/ui/command.js.map +1 -0
  53. package/dist/components/ui/dialog.js +199 -0
  54. package/dist/components/ui/dialog.js.map +1 -0
  55. package/dist/components/ui/label.js +92 -0
  56. package/dist/components/ui/label.js.map +1 -0
  57. package/dist/components/ui/separator.js +96 -0
  58. package/dist/components/ui/separator.js.map +1 -0
  59. package/dist/components/ui/textarea.js +91 -0
  60. package/dist/components/ui/textarea.js.map +1 -0
  61. package/dist/context/index.js +19 -0
  62. package/dist/context/index.js.map +1 -0
  63. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js +193 -0
  64. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js.map +1 -0
  65. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js +194 -0
  66. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js.map +1 -0
  67. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js +180 -0
  68. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js.map +1 -0
  69. package/dist/hooks/index.js +19 -0
  70. package/dist/hooks/index.js.map +1 -0
  71. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js +167 -0
  72. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js.map +1 -0
  73. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +1 -1
  74. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js +227 -0
  75. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js.map +1 -0
  76. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +1 -1
  77. package/dist/hooks/misc/use-autosize-textarea.js +39 -0
  78. package/dist/hooks/misc/use-autosize-textarea.js.map +1 -0
  79. package/dist/index.js +2256 -0
  80. package/dist/index.js.map +1 -0
  81. package/dist/index.mjs +31 -31
  82. package/dist/lib/debouncer.js +76 -0
  83. package/dist/lib/debouncer.js.map +1 -0
  84. package/dist/lib/editor-to-text.js +69 -0
  85. package/dist/lib/editor-to-text.js.map +1 -0
  86. package/dist/lib/get-text-around-cursor.js +131 -0
  87. package/dist/lib/get-text-around-cursor.js.map +1 -0
  88. package/dist/lib/retry.js +43 -0
  89. package/dist/lib/retry.js.map +1 -0
  90. package/dist/lib/slatejs-edits/add-autocompletions.js +51 -0
  91. package/dist/lib/slatejs-edits/add-autocompletions.js.map +1 -0
  92. package/dist/lib/slatejs-edits/clear-autocompletions.js +49 -0
  93. package/dist/lib/slatejs-edits/clear-autocompletions.js.map +1 -0
  94. package/dist/lib/slatejs-edits/replace-text.js +53 -0
  95. package/dist/lib/slatejs-edits/replace-text.js.map +1 -0
  96. package/dist/lib/slatejs-edits/with-partial-history.js +133 -0
  97. package/dist/lib/slatejs-edits/with-partial-history.js.map +1 -0
  98. package/dist/lib/stream-promise-flatten.js +72 -0
  99. package/dist/lib/stream-promise-flatten.js.map +1 -0
  100. package/dist/lib/utils.js +101 -0
  101. package/dist/lib/utils.js.map +1 -0
  102. package/dist/lib/utils.test.js +9 -0
  103. package/dist/lib/utils.test.js.map +1 -0
  104. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js +19 -0
  105. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js.map +1 -0
  106. package/dist/types/autosuggestions-config/autosuggestions-config.js +275 -0
  107. package/dist/types/autosuggestions-config/autosuggestions-config.js.map +1 -0
  108. package/dist/types/autosuggestions-config/editing-api-config.js +109 -0
  109. package/dist/types/autosuggestions-config/editing-api-config.js.map +1 -0
  110. package/dist/types/autosuggestions-config/index.js +331 -0
  111. package/dist/types/autosuggestions-config/index.js.map +1 -0
  112. package/dist/types/autosuggestions-config/insertions-api-config.js +103 -0
  113. package/dist/types/autosuggestions-config/insertions-api-config.js.map +1 -0
  114. package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.js +99 -0
  115. package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.js.map +1 -0
  116. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js +19 -0
  117. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js.map +1 -0
  118. package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js +19 -0
  119. package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js.map +1 -0
  120. package/dist/types/autosuggestions-config/suggestions-api-config.js +92 -0
  121. package/dist/types/autosuggestions-config/suggestions-api-config.js.map +1 -0
  122. package/dist/types/base/autosuggestion-state.js +19 -0
  123. package/dist/types/base/autosuggestion-state.js.map +1 -0
  124. package/dist/types/base/autosuggestions-bare-function.js +19 -0
  125. package/dist/types/base/autosuggestions-bare-function.js.map +1 -0
  126. package/dist/types/base/base-autosuggestions-config.js +38 -0
  127. package/dist/types/base/base-autosuggestions-config.js.map +1 -0
  128. package/dist/types/base/base-copilot-textarea-props.js +19 -0
  129. package/dist/types/base/base-copilot-textarea-props.js.map +1 -0
  130. package/dist/types/base/custom-editor.js +19 -0
  131. package/dist/types/base/custom-editor.js.map +1 -0
  132. package/dist/types/base/editor-autocomplete-state.js +45 -0
  133. package/dist/types/base/editor-autocomplete-state.js.map +1 -0
  134. package/dist/types/base/index.js +40 -0
  135. package/dist/types/base/index.js.map +1 -0
  136. package/dist/types/html-copilot-textarea-element.js +19 -0
  137. package/dist/types/html-copilot-textarea-element.js.map +1 -0
  138. package/dist/types/index.js +333 -0
  139. package/dist/types/index.js.map +1 -0
  140. package/dist/types/index.mjs +1 -1
  141. package/package.json +9 -6
  142. package/tsup.config.ts +1 -1
  143. /package/dist/{chunk-F4WZCQG6.mjs.map → chunk-7D5DUGLT.mjs.map} +0 -0
  144. /package/dist/{chunk-7JO276KU.mjs.map → chunk-G4U3POLM.mjs.map} +0 -0
  145. /package/dist/{chunk-IPM5WWPW.mjs.map → chunk-NHYCKIK7.mjs.map} +0 -0
  146. /package/dist/{chunk-LRXRD5KU.mjs.map → chunk-QQ3KP25O.mjs.map} +0 -0
  147. /package/dist/{chunk-34D4UIYX.mjs.map → chunk-YF4T3ZZF.mjs.map} +0 -0
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/types/autosuggestions-config/suggestions-api-config.tsx
21
+ var suggestions_api_config_exports = {};
22
+ __export(suggestions_api_config_exports, {
23
+ defaultSuggestionsApiConfig: () => defaultSuggestionsApiConfig,
24
+ defaultSuggestionsFewShotMessages: () => defaultSuggestionsFewShotMessages,
25
+ defaultSuggestionsMakeSystemPrompt: () => defaultSuggestionsMakeSystemPrompt
26
+ });
27
+ module.exports = __toCommonJS(suggestions_api_config_exports);
28
+ var defaultSuggestionsMakeSystemPrompt = (textareaPurpose, contextString) => {
29
+ return `You are a versatile writing assistant.
30
+
31
+ The user is writing some text.
32
+ The purpose is: "${textareaPurpose}"
33
+
34
+ Your job is to guess what the user will write next AS BEST YOU CAN.
35
+ Only guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.
36
+
37
+ Adjust yourself to the user's style and implied intent.
38
+
39
+ The user will provide both the text before and after the cursor. You should use this to infer what the user is likely to write next.
40
+ <TextAfterCursor>
41
+ <TextBeforeCursor>
42
+ <YourSuggestion>
43
+
44
+ If we need to add a whitespace character to the suggested text, make sure to explicitly add it in.
45
+
46
+ The following external context is also provided. Use it to help you make better suggestions!!!
47
+ \`\`\`
48
+ ${contextString}
49
+ \`\`\`
50
+ `;
51
+ };
52
+ var defaultSuggestionsFewShotMessages = [
53
+ {
54
+ role: "user",
55
+ name: "TextAfterCursor",
56
+ content: "While I was there I also picked up some apples, oranges, and bananas."
57
+ },
58
+ {
59
+ role: "user",
60
+ content: "This morning I woke up and went straight to the grocery store."
61
+ },
62
+ {
63
+ role: "assistant",
64
+ content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
65
+ },
66
+ {
67
+ role: "user",
68
+ name: "TextAfterCursor",
69
+ content: "and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof."
70
+ },
71
+ {
72
+ role: "user",
73
+ name: "TextBeforeCursor",
74
+ content: `The Optionholder, in the Optionholder's capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an "Equityholder" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an "Equityholder" thereunder;`
75
+ },
76
+ {
77
+ role: "assistant",
78
+ content: ` (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder's "Pro Rata Share"; `
79
+ }
80
+ ];
81
+ var defaultSuggestionsApiConfig = {
82
+ makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,
83
+ fewShotMessages: defaultSuggestionsFewShotMessages,
84
+ forwardedParams: void 0
85
+ };
86
+ // Annotate the CommonJS export names for ESM import in node:
87
+ 0 && (module.exports = {
88
+ defaultSuggestionsApiConfig,
89
+ defaultSuggestionsFewShotMessages,
90
+ defaultSuggestionsMakeSystemPrompt
91
+ });
92
+ //# sourceMappingURL=suggestions-api-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/autosuggestions-config/suggestions-api-config.tsx"],"sourcesContent":["import { MinimalChatGPTMessage } from \"./subtypes/minimal-chat-gpt-message\";\nimport { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\n\nexport interface SuggestionsApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: MinimalChatGPTMessage[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultSuggestionsMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString\n) => {\n return `You are a versatile writing assistant.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nYour job is to guess what the user will write next AS BEST YOU CAN.\nOnly guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.\n\nAdjust yourself to the user's style and implied intent.\n\nThe user will provide both the text before and after the cursor. You should use this to infer what the user is likely to write next.\n<TextAfterCursor>\n<TextBeforeCursor>\n<YourSuggestion>\n\nIf we need to add a whitespace character to the suggested text, make sure to explicitly add it in.\n\nThe following external context is also provided. Use it to help you make better suggestions!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n`;\n};\n\nexport const defaultSuggestionsFewShotMessages: MinimalChatGPTMessage[] = [\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"While I was there I also picked up some apples, oranges, and bananas.\",\n },\n {\n role: \"user\",\n content: \"This morning I woke up and went straight to the grocery store.\",\n },\n {\n role: \"assistant\",\n content:\n \" When I arrived I went straight to the produce section and picked out a big watermelon. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.\",\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content:\n 'The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;',\n },\n {\n role: \"assistant\",\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n },\n];\n\nexport const defaultSuggestionsApiConfig: SuggestionsApiConfig = {\n makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,\n fewShotMessages: defaultSuggestionsFewShotMessages,\n forwardedParams: undefined,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,qCAAuD,CAClE,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBlB;AAAA;AAAA;AAGF;AAEO,IAAM,oCAA6D;AAAA,EACxE;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AACF;AAEO,IAAM,8BAAoD;AAAA,EAC/D,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB;","names":[]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types/base/autosuggestion-state.ts
17
+ var autosuggestion_state_exports = {};
18
+ module.exports = __toCommonJS(autosuggestion_state_exports);
19
+ //# sourceMappingURL=autosuggestion-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/base/autosuggestion-state.ts"],"sourcesContent":["import { BasePoint } from \"slate\";\n\nexport interface AutosuggestionState {\n text: string;\n point: BasePoint;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types/base/autosuggestions-bare-function.ts
17
+ var autosuggestions_bare_function_exports = {};
18
+ module.exports = __toCommonJS(autosuggestions_bare_function_exports);
19
+ //# sourceMappingURL=autosuggestions-bare-function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/base/autosuggestions-bare-function.ts"],"sourcesContent":["import { DocumentPointer } from \"@copilotkit/react-core\";\n\nexport interface InsertionEditorState {\n textBeforeCursor: string;\n textAfterCursor: string;\n}\n\nexport interface EditingEditorState extends InsertionEditorState {\n selectedText: string;\n}\n\nexport type AutosuggestionsBareFunction = (\n editorState: InsertionEditorState,\n abortSignal: AbortSignal\n) => Promise<string>;\n\nexport type Generator_InsertionOrEditingSuggestion = (\n editorState: EditingEditorState,\n prompt: string,\n documents: DocumentPointer[],\n abortSignal: AbortSignal\n) => Promise<ReadableStream<string>>;\n\nexport interface InsertionEditorApiConfig {\n insertionOrEditingFunction: Generator_InsertionOrEditingSuggestion;\n}\n\nexport interface BaseCopilotTextareaApiConfig extends InsertionEditorApiConfig {\n autosuggestionsFunction: AutosuggestionsBareFunction;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/types/base/base-autosuggestions-config.tsx
21
+ var base_autosuggestions_config_exports = {};
22
+ __export(base_autosuggestions_config_exports, {
23
+ defaultBaseAutosuggestionsConfig: () => defaultBaseAutosuggestionsConfig
24
+ });
25
+ module.exports = __toCommonJS(base_autosuggestions_config_exports);
26
+ var defaultBaseAutosuggestionsConfig = {
27
+ debounceTime: 250,
28
+ contextCategories: ["global"],
29
+ acceptAutosuggestionKey: "Tab",
30
+ disableWhenEmpty: true,
31
+ disabled: false,
32
+ temporarilyDisableWhenMovingCursorWithoutChangingText: true
33
+ };
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ defaultBaseAutosuggestionsConfig
37
+ });
38
+ //# sourceMappingURL=base-autosuggestions-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/base/base-autosuggestions-config.tsx"],"sourcesContent":["import { BaseCopilotTextareaApiConfig } from \"./autosuggestions-bare-function\";\n\nexport interface BaseAutosuggestionsConfig {\n textareaPurpose: string;\n contextCategories: string[];\n debounceTime: number;\n acceptAutosuggestionKey: string;\n disableWhenEmpty: boolean;\n disabled: boolean;\n temporarilyDisableWhenMovingCursorWithoutChangingText: boolean;\n apiConfig: BaseCopilotTextareaApiConfig;\n}\n\nexport const defaultBaseAutosuggestionsConfig: Omit<\n BaseAutosuggestionsConfig,\n \"textareaPurpose\" | \"apiConfig\"\n> = {\n debounceTime: 250,\n contextCategories: [\"global\"],\n acceptAutosuggestionKey: \"Tab\",\n disableWhenEmpty: true,\n disabled: false,\n temporarilyDisableWhenMovingCursorWithoutChangingText: true,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,IAAM,mCAGT;AAAA,EACF,cAAc;AAAA,EACd,mBAAmB,CAAC,QAAQ;AAAA,EAC5B,yBAAyB;AAAA,EACzB,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,uDAAuD;AACzD;","names":[]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types/base/base-copilot-textarea-props.tsx
17
+ var base_copilot_textarea_props_exports = {};
18
+ module.exports = __toCommonJS(base_copilot_textarea_props_exports);
19
+ //# sourceMappingURL=base-copilot-textarea-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/base/base-copilot-textarea-props.tsx"],"sourcesContent":["import { TextareaHTMLAttributes } from \"react\";\nimport { BaseAutosuggestionsConfig } from \".\";\nimport { BaseCopilotTextareaApiConfig } from \"./autosuggestions-bare-function\";\n\n/**\n * `BaseCopilotTextareaProps` defines the properties for the `BaseCopilotTextarea` component.\n *\n * @extends {Omit<TextareaHTMLAttributes<HTMLDivElement>, \"onChange\">}\n *\n * @property {boolean} [disableBranding=false] - Determines whether branding should be disabled. Default is `false`.\n *\n * @property {React.CSSProperties} [placeholderStyle] - Specifies the CSS styles to apply to the placeholder text.\n *\n * @property {React.CSSProperties} [suggestionsStyle] - Specifies the CSS styles to apply to the suggestions list.\n *\n * @property {string} [value] - The initial value of the textarea. Can be controlled via `onValueChange`.\n *\n * @property {(value: string) => void} [onValueChange] - Callback invoked when the value of the textarea changes.\n *\n * @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).\n *\n * @property {Partial<BaseAutosuggestionsConfig> & {\n * textareaPurpose: string;\n * }} autosuggestionsConfig - Configuration settings for the autosuggestions feature.\n * Includes a mandatory `textareaPurpose` to guide the autosuggestions.\n */\nexport interface BaseCopilotTextareaProps\n extends Omit<TextareaHTMLAttributes<HTMLDivElement>, \"onChange\"> {\n disableBranding?: boolean;\n placeholderStyle?: React.CSSProperties;\n suggestionsStyle?: React.CSSProperties;\n value?: string;\n onValueChange?: (value: string) => void;\n onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;\n baseAutosuggestionsConfig: Partial<BaseAutosuggestionsConfig> & {\n textareaPurpose: string;\n apiConfig: BaseCopilotTextareaApiConfig;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types/base/custom-editor.tsx
17
+ var custom_editor_exports = {};
18
+ module.exports = __toCommonJS(custom_editor_exports);
19
+ //# sourceMappingURL=custom-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/base/custom-editor.tsx"],"sourcesContent":["import { BaseEditor } from \"slate\";\nimport { ReactEditor } from \"slate-react\";\nimport { HistoryEditor } from \"slate-history\";\n\nexport type CustomEditor = BaseEditor & ReactEditor & HistoryEditor;\n\nexport type ParagraphElement = {\n type: \"paragraph\";\n children: CustomText[];\n};\n\nexport type SuggestionElement = {\n type: \"suggestion\";\n inline: boolean;\n content: string;\n children: CustomText[];\n};\n\nexport type CustomElement = ParagraphElement | SuggestionElement;\nexport type SuggestionAwareText = { text: string };\nexport type CustomText = SuggestionAwareText;\n\ndeclare module \"slate\" {\n interface CustomTypes {\n Editor: CustomEditor;\n Element: CustomElement;\n Text: CustomText;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/types/base/editor-autocomplete-state.ts
21
+ var editor_autocomplete_state_exports = {};
22
+ __export(editor_autocomplete_state_exports, {
23
+ areEqual_autocompleteState: () => areEqual_autocompleteState
24
+ });
25
+ module.exports = __toCommonJS(editor_autocomplete_state_exports);
26
+
27
+ // src/lib/utils.ts
28
+ var import_clsx = require("clsx");
29
+ var import_nanoid = require("nanoid");
30
+ var import_tailwind_merge = require("tailwind-merge");
31
+ var nanoid = (0, import_nanoid.customAlphabet)(
32
+ "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
33
+ 7
34
+ );
35
+ var arraysAreEqual = (arr1, arr2) => arr1.length === arr2.length && arr1.every((value, index) => value === arr2[index]);
36
+
37
+ // src/types/base/editor-autocomplete-state.ts
38
+ function areEqual_autocompleteState(prev, next) {
39
+ return prev.cursorPoint.offset === next.cursorPoint.offset && arraysAreEqual(prev.cursorPoint.path, next.cursorPoint.path) && prev.textBeforeCursor === next.textBeforeCursor && prev.textAfterCursor === next.textAfterCursor;
40
+ }
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {
43
+ areEqual_autocompleteState
44
+ });
45
+ //# sourceMappingURL=editor-autocomplete-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/base/editor-autocomplete-state.ts","../../../src/lib/utils.ts"],"sourcesContent":["import { BasePoint } from \"slate\";\nimport { arraysAreEqual } from \"../../lib/utils\";\n\nexport interface EditorAutocompleteState {\n cursorPoint: BasePoint;\n textBeforeCursor: string;\n textAfterCursor: string;\n}\n\nexport function areEqual_autocompleteState(\n prev: EditorAutocompleteState,\n next: EditorAutocompleteState\n) {\n return (\n prev.cursorPoint.offset === next.cursorPoint.offset &&\n arraysAreEqual(prev.cursorPoint.path, next.cursorPoint.path) &&\n prev.textBeforeCursor === next.textBeforeCursor &&\n prev.textAfterCursor === next.textAfterCursor\n );\n}\n","import { clsx, type ClassValue } from \"clsx\";\nimport { customAlphabet } from \"nanoid\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport const nanoid = customAlphabet(\n \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\",\n 7\n); // 7-character random string\n\nexport async function fetcher<JSON = any>(\n input: RequestInfo,\n init?: RequestInit\n): Promise<JSON> {\n const res = await fetch(input, init);\n\n if (!res.ok) {\n const json = await res.json();\n if (json.error) {\n const error = new Error(json.error) as Error & {\n status: number;\n };\n error.status = res.status;\n throw error;\n } else {\n throw new Error(\"An unexpected error occurred\");\n }\n }\n\n return res.json();\n}\n\nexport function formatDate(input: string | number | Date): string {\n const date = new Date(input);\n return date.toLocaleDateString(\"en-US\", {\n month: \"long\",\n day: \"numeric\",\n year: \"numeric\",\n });\n}\n\nexport const arraysAreEqual = (arr1: number[], arr2: number[]): boolean =>\n arr1.length === arr2.length &&\n arr1.every((value, index) => value === arr2[index]);\n\nexport function nullableCompatibleEqualityCheck<T>(\n naiveEqualityCheck: (a: T, b: T) => boolean,\n a: T | null | undefined,\n b: T | null | undefined\n): boolean {\n if (a === null || a === undefined || b === null || b === undefined) {\n return a === b;\n }\n\n return naiveEqualityCheck(a, b);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAsC;AACtC,oBAA+B;AAC/B,4BAAwB;AAMjB,IAAM,aAAS;AAAA,EACpB;AAAA,EACA;AACF;AAiCO,IAAM,iBAAiB,CAAC,MAAgB,SAC7C,KAAK,WAAW,KAAK,UACrB,KAAK,MAAM,CAAC,OAAO,UAAU,UAAU,KAAK,MAAM;;;ADrC7C,SAAS,2BACd,MACA,MACA;AACA,SACE,KAAK,YAAY,WAAW,KAAK,YAAY,UAC7C,eAAe,KAAK,YAAY,MAAM,KAAK,YAAY,IAAI,KAC3D,KAAK,qBAAqB,KAAK,oBAC/B,KAAK,oBAAoB,KAAK;AAElC;","names":[]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/types/base/index.ts
21
+ var base_exports = {};
22
+ __export(base_exports, {
23
+ defaultBaseAutosuggestionsConfig: () => defaultBaseAutosuggestionsConfig
24
+ });
25
+ module.exports = __toCommonJS(base_exports);
26
+
27
+ // src/types/base/base-autosuggestions-config.tsx
28
+ var defaultBaseAutosuggestionsConfig = {
29
+ debounceTime: 250,
30
+ contextCategories: ["global"],
31
+ acceptAutosuggestionKey: "Tab",
32
+ disableWhenEmpty: true,
33
+ disabled: false,
34
+ temporarilyDisableWhenMovingCursorWithoutChangingText: true
35
+ };
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ defaultBaseAutosuggestionsConfig
39
+ });
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/base/index.ts","../../../src/types/base/base-autosuggestions-config.tsx"],"sourcesContent":["export { defaultBaseAutosuggestionsConfig } from \"./base-autosuggestions-config\";\n\nexport type { AutosuggestionsBareFunction } from \"./autosuggestions-bare-function\";\nexport type { BaseAutosuggestionsConfig } from \"./base-autosuggestions-config\";\n\nexport type { BaseCopilotTextareaProps } from \"./base-copilot-textarea-props\";\n","import { BaseCopilotTextareaApiConfig } from \"./autosuggestions-bare-function\";\n\nexport interface BaseAutosuggestionsConfig {\n textareaPurpose: string;\n contextCategories: string[];\n debounceTime: number;\n acceptAutosuggestionKey: string;\n disableWhenEmpty: boolean;\n disabled: boolean;\n temporarilyDisableWhenMovingCursorWithoutChangingText: boolean;\n apiConfig: BaseCopilotTextareaApiConfig;\n}\n\nexport const defaultBaseAutosuggestionsConfig: Omit<\n BaseAutosuggestionsConfig,\n \"textareaPurpose\" | \"apiConfig\"\n> = {\n debounceTime: 250,\n contextCategories: [\"global\"],\n acceptAutosuggestionKey: \"Tab\",\n disableWhenEmpty: true,\n disabled: false,\n temporarilyDisableWhenMovingCursorWithoutChangingText: true,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaO,IAAM,mCAGT;AAAA,EACF,cAAc;AAAA,EACd,mBAAmB,CAAC,QAAQ;AAAA,EAC5B,yBAAyB;AAAA,EACzB,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,uDAAuD;AACzD;","names":[]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types/html-copilot-textarea-element.ts
17
+ var html_copilot_textarea_element_exports = {};
18
+ module.exports = __toCommonJS(html_copilot_textarea_element_exports);
19
+ //# sourceMappingURL=html-copilot-textarea-element.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/html-copilot-textarea-element.ts"],"sourcesContent":["export interface HTMLCopilotTextAreaElement extends HTMLElement {\n value: string;\n focus: () => void;\n blur: () => void;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}