@copilotkit/react-textarea 1.5.1-next.3 → 1.5.1-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (386) hide show
  1. package/CHANGELOG.md +12 -2
  2. package/package.json +4 -4
  3. package/dist/chunk-23Q6A46J.mjs +0 -103
  4. package/dist/chunk-23Q6A46J.mjs.map +0 -1
  5. package/dist/chunk-2C7O2EVM.mjs +0 -27
  6. package/dist/chunk-2C7O2EVM.mjs.map +0 -1
  7. package/dist/chunk-2QDCE7PD.mjs +0 -32
  8. package/dist/chunk-2QDCE7PD.mjs.map +0 -1
  9. package/dist/chunk-3PQ7GSFE.mjs +0 -17
  10. package/dist/chunk-3PQ7GSFE.mjs.map +0 -1
  11. package/dist/chunk-4CVSOOJY.mjs +0 -30
  12. package/dist/chunk-4CVSOOJY.mjs.map +0 -1
  13. package/dist/chunk-4NHVQZ67.mjs +0 -108
  14. package/dist/chunk-4NHVQZ67.mjs.map +0 -1
  15. package/dist/chunk-4PDYALMP.mjs +0 -52
  16. package/dist/chunk-4PDYALMP.mjs.map +0 -1
  17. package/dist/chunk-4PNWGPAR.mjs +0 -32
  18. package/dist/chunk-4PNWGPAR.mjs.map +0 -1
  19. package/dist/chunk-5UNJXFUO.mjs +0 -29
  20. package/dist/chunk-5UNJXFUO.mjs.map +0 -1
  21. package/dist/chunk-7L6GIHDM.mjs +0 -39
  22. package/dist/chunk-7L6GIHDM.mjs.map +0 -1
  23. package/dist/chunk-7LSRNPNI.mjs +0 -59
  24. package/dist/chunk-7LSRNPNI.mjs.map +0 -1
  25. package/dist/chunk-AJ5OMEXM.mjs +0 -13
  26. package/dist/chunk-AJ5OMEXM.mjs.map +0 -1
  27. package/dist/chunk-AMQQHDWZ.mjs +0 -265
  28. package/dist/chunk-AMQQHDWZ.mjs.map +0 -1
  29. package/dist/chunk-BZBSPKHQ.mjs +0 -229
  30. package/dist/chunk-BZBSPKHQ.mjs.map +0 -1
  31. package/dist/chunk-D47EKHIF.mjs +0 -26
  32. package/dist/chunk-D47EKHIF.mjs.map +0 -1
  33. package/dist/chunk-DE5K76I2.mjs +0 -1
  34. package/dist/chunk-DE5K76I2.mjs.map +0 -1
  35. package/dist/chunk-DFTV4TST.mjs +0 -36
  36. package/dist/chunk-DFTV4TST.mjs.map +0 -1
  37. package/dist/chunk-DRV2FOHZ.mjs +0 -70
  38. package/dist/chunk-DRV2FOHZ.mjs.map +0 -1
  39. package/dist/chunk-ECR45NSD.mjs +0 -104
  40. package/dist/chunk-ECR45NSD.mjs.map +0 -1
  41. package/dist/chunk-EJGGLWWR.mjs +0 -82
  42. package/dist/chunk-EJGGLWWR.mjs.map +0 -1
  43. package/dist/chunk-EVEUQINY.mjs +0 -125
  44. package/dist/chunk-EVEUQINY.mjs.map +0 -1
  45. package/dist/chunk-GQN2HYFJ.mjs +0 -22
  46. package/dist/chunk-GQN2HYFJ.mjs.map +0 -1
  47. package/dist/chunk-GUZIMGGZ.mjs +0 -64
  48. package/dist/chunk-GUZIMGGZ.mjs.map +0 -1
  49. package/dist/chunk-H4VKQGVU.mjs +0 -1
  50. package/dist/chunk-H4VKQGVU.mjs.map +0 -1
  51. package/dist/chunk-HDBI2WN5.mjs +0 -113
  52. package/dist/chunk-HDBI2WN5.mjs.map +0 -1
  53. package/dist/chunk-I72DKFHD.mjs +0 -114
  54. package/dist/chunk-I72DKFHD.mjs.map +0 -1
  55. package/dist/chunk-IU3WTXLQ.mjs +0 -1
  56. package/dist/chunk-IU3WTXLQ.mjs.map +0 -1
  57. package/dist/chunk-KMVGEY7Q.mjs +0 -51
  58. package/dist/chunk-KMVGEY7Q.mjs.map +0 -1
  59. package/dist/chunk-KNQIEOFP.mjs +0 -19
  60. package/dist/chunk-KNQIEOFP.mjs.map +0 -1
  61. package/dist/chunk-L7VVZH4Q.mjs +0 -1
  62. package/dist/chunk-L7VVZH4Q.mjs.map +0 -1
  63. package/dist/chunk-LQ2OWQU7.mjs +0 -49
  64. package/dist/chunk-LQ2OWQU7.mjs.map +0 -1
  65. package/dist/chunk-LYB4B6MK.mjs +0 -19
  66. package/dist/chunk-LYB4B6MK.mjs.map +0 -1
  67. package/dist/chunk-MCNXIA4Q.mjs +0 -75
  68. package/dist/chunk-MCNXIA4Q.mjs.map +0 -1
  69. package/dist/chunk-MMVDU6DF.mjs +0 -1
  70. package/dist/chunk-MMVDU6DF.mjs.map +0 -1
  71. package/dist/chunk-MRXNTQOX.mjs +0 -59
  72. package/dist/chunk-MRXNTQOX.mjs.map +0 -1
  73. package/dist/chunk-PTPNOBEI.mjs +0 -92
  74. package/dist/chunk-PTPNOBEI.mjs.map +0 -1
  75. package/dist/chunk-QJNFNPWH.mjs +0 -85
  76. package/dist/chunk-QJNFNPWH.mjs.map +0 -1
  77. package/dist/chunk-RUV6NBIF.mjs +0 -1
  78. package/dist/chunk-RUV6NBIF.mjs.map +0 -1
  79. package/dist/chunk-RXV67GJN.mjs +0 -168
  80. package/dist/chunk-RXV67GJN.mjs.map +0 -1
  81. package/dist/chunk-T6MTDQZ7.mjs +0 -45
  82. package/dist/chunk-T6MTDQZ7.mjs.map +0 -1
  83. package/dist/chunk-TIS7PLZC.mjs +0 -31
  84. package/dist/chunk-TIS7PLZC.mjs.map +0 -1
  85. package/dist/chunk-VSVQZUPW.mjs +0 -124
  86. package/dist/chunk-VSVQZUPW.mjs.map +0 -1
  87. package/dist/chunk-VU4BKPKI.mjs +0 -60
  88. package/dist/chunk-VU4BKPKI.mjs.map +0 -1
  89. package/dist/chunk-WADHCMPK.mjs +0 -1
  90. package/dist/chunk-WADHCMPK.mjs.map +0 -1
  91. package/dist/chunk-WGWQRALG.mjs +0 -83
  92. package/dist/chunk-WGWQRALG.mjs.map +0 -1
  93. package/dist/chunk-WJHSY5T6.mjs +0 -1
  94. package/dist/chunk-WJHSY5T6.mjs.map +0 -1
  95. package/dist/chunk-XW3ICO4S.mjs +0 -25
  96. package/dist/chunk-XW3ICO4S.mjs.map +0 -1
  97. package/dist/chunk-YLFAIYRY.mjs +0 -50
  98. package/dist/chunk-YLFAIYRY.mjs.map +0 -1
  99. package/dist/components/base-copilot-textarea/base-copilot-textarea.css +0 -9
  100. package/dist/components/base-copilot-textarea/base-copilot-textarea.css.map +0 -1
  101. package/dist/components/base-copilot-textarea/base-copilot-textarea.d.ts +0 -43
  102. package/dist/components/base-copilot-textarea/base-copilot-textarea.js +0 -1795
  103. package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +0 -1
  104. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +0 -40
  105. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map +0 -1
  106. package/dist/components/base-copilot-textarea/render-element.d.ts +0 -6
  107. package/dist/components/base-copilot-textarea/render-element.js +0 -75
  108. package/dist/components/base-copilot-textarea/render-element.js.map +0 -1
  109. package/dist/components/base-copilot-textarea/render-element.mjs +0 -8
  110. package/dist/components/base-copilot-textarea/render-element.mjs.map +0 -1
  111. package/dist/components/base-copilot-textarea/render-placeholder.d.ts +0 -6
  112. package/dist/components/base-copilot-textarea/render-placeholder.js +0 -72
  113. package/dist/components/base-copilot-textarea/render-placeholder.js.map +0 -1
  114. package/dist/components/base-copilot-textarea/render-placeholder.mjs +0 -8
  115. package/dist/components/base-copilot-textarea/render-placeholder.mjs.map +0 -1
  116. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.d.ts +0 -8
  117. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js +0 -112
  118. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js.map +0 -1
  119. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +0 -9
  120. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs.map +0 -1
  121. package/dist/components/base-copilot-textarea/use-add-branding-css.d.ts +0 -3
  122. package/dist/components/base-copilot-textarea/use-add-branding-css.js +0 -83
  123. package/dist/components/base-copilot-textarea/use-add-branding-css.js.map +0 -1
  124. package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +0 -8
  125. package/dist/components/base-copilot-textarea/use-add-branding-css.mjs.map +0 -1
  126. package/dist/components/copilot-textarea/copilot-textarea.css +0 -9
  127. package/dist/components/copilot-textarea/copilot-textarea.css.map +0 -1
  128. package/dist/components/copilot-textarea/copilot-textarea.d.ts +0 -171
  129. package/dist/components/copilot-textarea/copilot-textarea.js +0 -2288
  130. package/dist/components/copilot-textarea/copilot-textarea.js.map +0 -1
  131. package/dist/components/copilot-textarea/copilot-textarea.mjs +0 -49
  132. package/dist/components/copilot-textarea/copilot-textarea.mjs.map +0 -1
  133. package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +0 -18
  134. package/dist/components/hovering-toolbar/hovering-editor-provider.js +0 -44
  135. package/dist/components/hovering-toolbar/hovering-editor-provider.js.map +0 -1
  136. package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +0 -10
  137. package/dist/components/hovering-toolbar/hovering-editor-provider.mjs.map +0 -1
  138. package/dist/components/hovering-toolbar/hovering-toolbar-components.d.ts +0 -18
  139. package/dist/components/hovering-toolbar/hovering-toolbar-components.js +0 -174
  140. package/dist/components/hovering-toolbar/hovering-toolbar-components.js.map +0 -1
  141. package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +0 -16
  142. package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs.map +0 -1
  143. package/dist/components/hovering-toolbar/hovering-toolbar.d.ts +0 -12
  144. package/dist/components/hovering-toolbar/hovering-toolbar.js +0 -912
  145. package/dist/components/hovering-toolbar/hovering-toolbar.js.map +0 -1
  146. package/dist/components/hovering-toolbar/hovering-toolbar.mjs +0 -23
  147. package/dist/components/hovering-toolbar/hovering-toolbar.mjs.map +0 -1
  148. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.d.ts +0 -16
  149. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +0 -606
  150. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js.map +0 -1
  151. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +0 -18
  152. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs.map +0 -1
  153. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.d.ts +0 -14
  154. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +0 -629
  155. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js.map +0 -1
  156. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +0 -19
  157. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs.map +0 -1
  158. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.d.ts +0 -16
  159. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js +0 -133
  160. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js.map +0 -1
  161. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +0 -12
  162. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs.map +0 -1
  163. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.d.ts +0 -4
  164. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +0 -629
  165. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js.map +0 -1
  166. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +0 -20
  167. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +0 -1
  168. package/dist/components/index.css +0 -9
  169. package/dist/components/index.css.map +0 -1
  170. package/dist/components/index.d.ts +0 -15
  171. package/dist/components/index.js +0 -2292
  172. package/dist/components/index.js.map +0 -1
  173. package/dist/components/index.mjs +0 -53
  174. package/dist/components/index.mjs.map +0 -1
  175. package/dist/components/manual-ui/chip-with-icon.d.ts +0 -10
  176. package/dist/components/manual-ui/chip-with-icon.js +0 -38
  177. package/dist/components/manual-ui/chip-with-icon.js.map +0 -1
  178. package/dist/components/manual-ui/chip-with-icon.mjs +0 -15
  179. package/dist/components/manual-ui/chip-with-icon.mjs.map +0 -1
  180. package/dist/components/source-search-box/source-search-box.d.ts +0 -16
  181. package/dist/components/source-search-box/source-search-box.js +0 -240
  182. package/dist/components/source-search-box/source-search-box.js.map +0 -1
  183. package/dist/components/source-search-box/source-search-box.mjs +0 -13
  184. package/dist/components/source-search-box/source-search-box.mjs.map +0 -1
  185. package/dist/components/ui/button.d.ts +0 -14
  186. package/dist/components/ui/button.js +0 -114
  187. package/dist/components/ui/button.js.map +0 -1
  188. package/dist/components/ui/button.mjs +0 -11
  189. package/dist/components/ui/button.mjs.map +0 -1
  190. package/dist/components/ui/command.d.ts +0 -53
  191. package/dist/components/ui/command.js +0 -285
  192. package/dist/components/ui/command.js.map +0 -1
  193. package/dist/components/ui/command.mjs +0 -26
  194. package/dist/components/ui/command.mjs.map +0 -1
  195. package/dist/components/ui/dialog.d.ts +0 -19
  196. package/dist/components/ui/dialog.js +0 -183
  197. package/dist/components/ui/dialog.js.map +0 -1
  198. package/dist/components/ui/dialog.mjs +0 -21
  199. package/dist/components/ui/dialog.mjs.map +0 -1
  200. package/dist/components/ui/label.d.ts +0 -8
  201. package/dist/components/ui/label.js +0 -87
  202. package/dist/components/ui/label.js.map +0 -1
  203. package/dist/components/ui/label.mjs +0 -9
  204. package/dist/components/ui/label.mjs.map +0 -1
  205. package/dist/context/index.d.ts +0 -2
  206. package/dist/context/index.js +0 -19
  207. package/dist/context/index.js.map +0 -1
  208. package/dist/context/index.mjs +0 -2
  209. package/dist/context/index.mjs.map +0 -1
  210. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.ts +0 -15
  211. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js +0 -180
  212. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js.map +0 -1
  213. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +0 -11
  214. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs.map +0 -1
  215. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.d.ts +0 -8
  216. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js +0 -194
  217. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js.map +0 -1
  218. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +0 -9
  219. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map +0 -1
  220. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.d.ts +0 -7
  221. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js +0 -180
  222. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js.map +0 -1
  223. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +0 -10
  224. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map +0 -1
  225. package/dist/hooks/index.d.ts +0 -2
  226. package/dist/hooks/index.js +0 -19
  227. package/dist/hooks/index.js.map +0 -1
  228. package/dist/hooks/index.mjs +0 -2
  229. package/dist/hooks/index.mjs.map +0 -1
  230. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +0 -22
  231. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js +0 -152
  232. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js.map +0 -1
  233. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +0 -9
  234. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs.map +0 -1
  235. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.d.ts +0 -23
  236. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js +0 -228
  237. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js.map +0 -1
  238. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +0 -9
  239. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs.map +0 -1
  240. package/dist/hooks/misc/use-autosize-textarea.d.ts +0 -5
  241. package/dist/hooks/misc/use-autosize-textarea.js +0 -37
  242. package/dist/hooks/misc/use-autosize-textarea.js.map +0 -1
  243. package/dist/hooks/misc/use-autosize-textarea.mjs +0 -8
  244. package/dist/hooks/misc/use-autosize-textarea.mjs.map +0 -1
  245. package/dist/index.css +0 -644
  246. package/dist/index.css.map +0 -1
  247. package/dist/index.d.ts +0 -15
  248. package/dist/index.js +0 -2297
  249. package/dist/index.js.map +0 -1
  250. package/dist/index.mjs +0 -64
  251. package/dist/index.mjs.map +0 -1
  252. package/dist/lib/debouncer.d.ts +0 -11
  253. package/dist/lib/debouncer.js +0 -76
  254. package/dist/lib/debouncer.js.map +0 -1
  255. package/dist/lib/debouncer.mjs +0 -8
  256. package/dist/lib/debouncer.mjs.map +0 -1
  257. package/dist/lib/editor-to-text.d.ts +0 -7
  258. package/dist/lib/editor-to-text.js +0 -69
  259. package/dist/lib/editor-to-text.js.map +0 -1
  260. package/dist/lib/editor-to-text.mjs +0 -8
  261. package/dist/lib/editor-to-text.mjs.map +0 -1
  262. package/dist/lib/get-text-around-cursor.d.ts +0 -15
  263. package/dist/lib/get-text-around-cursor.js +0 -131
  264. package/dist/lib/get-text-around-cursor.js.map +0 -1
  265. package/dist/lib/get-text-around-cursor.mjs +0 -14
  266. package/dist/lib/get-text-around-cursor.mjs.map +0 -1
  267. package/dist/lib/retry.d.ts +0 -3
  268. package/dist/lib/retry.js +0 -43
  269. package/dist/lib/retry.js.map +0 -1
  270. package/dist/lib/retry.mjs +0 -8
  271. package/dist/lib/retry.mjs.map +0 -1
  272. package/dist/lib/slatejs-edits/add-autocompletions.d.ts +0 -8
  273. package/dist/lib/slatejs-edits/add-autocompletions.js +0 -51
  274. package/dist/lib/slatejs-edits/add-autocompletions.js.map +0 -1
  275. package/dist/lib/slatejs-edits/add-autocompletions.mjs +0 -8
  276. package/dist/lib/slatejs-edits/add-autocompletions.mjs.map +0 -1
  277. package/dist/lib/slatejs-edits/clear-autocompletions.d.ts +0 -8
  278. package/dist/lib/slatejs-edits/clear-autocompletions.js +0 -46
  279. package/dist/lib/slatejs-edits/clear-autocompletions.js.map +0 -1
  280. package/dist/lib/slatejs-edits/clear-autocompletions.mjs +0 -8
  281. package/dist/lib/slatejs-edits/clear-autocompletions.mjs.map +0 -1
  282. package/dist/lib/slatejs-edits/replace-text.d.ts +0 -5
  283. package/dist/lib/slatejs-edits/replace-text.js +0 -53
  284. package/dist/lib/slatejs-edits/replace-text.js.map +0 -1
  285. package/dist/lib/slatejs-edits/replace-text.mjs +0 -8
  286. package/dist/lib/slatejs-edits/replace-text.mjs.map +0 -1
  287. package/dist/lib/slatejs-edits/with-partial-history.d.ts +0 -8
  288. package/dist/lib/slatejs-edits/with-partial-history.js +0 -133
  289. package/dist/lib/slatejs-edits/with-partial-history.js.map +0 -1
  290. package/dist/lib/slatejs-edits/with-partial-history.mjs +0 -10
  291. package/dist/lib/slatejs-edits/with-partial-history.mjs.map +0 -1
  292. package/dist/lib/stream-promise-flatten.d.ts +0 -12
  293. package/dist/lib/stream-promise-flatten.js +0 -72
  294. package/dist/lib/stream-promise-flatten.js.map +0 -1
  295. package/dist/lib/stream-promise-flatten.mjs +0 -8
  296. package/dist/lib/stream-promise-flatten.mjs.map +0 -1
  297. package/dist/lib/utils.d.ts +0 -9
  298. package/dist/lib/utils.js +0 -94
  299. package/dist/lib/utils.js.map +0 -1
  300. package/dist/lib/utils.mjs +0 -16
  301. package/dist/lib/utils.mjs.map +0 -1
  302. package/dist/lib/utils.test.d.ts +0 -2
  303. package/dist/lib/utils.test.js +0 -9
  304. package/dist/lib/utils.test.js.map +0 -1
  305. package/dist/lib/utils.test.mjs +0 -7
  306. package/dist/lib/utils.test.mjs.map +0 -1
  307. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.ts +0 -23
  308. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js +0 -19
  309. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js.map +0 -1
  310. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs +0 -1
  311. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs.map +0 -1
  312. package/dist/types/autosuggestions-config/autosuggestions-config.d.ts +0 -20
  313. package/dist/types/autosuggestions-config/autosuggestions-config.js +0 -287
  314. package/dist/types/autosuggestions-config/autosuggestions-config.js.map +0 -1
  315. package/dist/types/autosuggestions-config/autosuggestions-config.mjs +0 -13
  316. package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +0 -1
  317. package/dist/types/autosuggestions-config/editing-api-config.d.ts +0 -15
  318. package/dist/types/autosuggestions-config/editing-api-config.js +0 -108
  319. package/dist/types/autosuggestions-config/editing-api-config.js.map +0 -1
  320. package/dist/types/autosuggestions-config/editing-api-config.mjs +0 -12
  321. package/dist/types/autosuggestions-config/editing-api-config.mjs.map +0 -1
  322. package/dist/types/autosuggestions-config/index.d.ts +0 -10
  323. package/dist/types/autosuggestions-config/index.js +0 -287
  324. package/dist/types/autosuggestions-config/index.js.map +0 -1
  325. package/dist/types/autosuggestions-config/index.mjs +0 -14
  326. package/dist/types/autosuggestions-config/index.mjs.map +0 -1
  327. package/dist/types/autosuggestions-config/insertions-api-config.d.ts +0 -15
  328. package/dist/types/autosuggestions-config/insertions-api-config.js +0 -101
  329. package/dist/types/autosuggestions-config/insertions-api-config.js.map +0 -1
  330. package/dist/types/autosuggestions-config/insertions-api-config.mjs +0 -12
  331. package/dist/types/autosuggestions-config/insertions-api-config.mjs.map +0 -1
  332. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.d.ts +0 -3
  333. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js +0 -19
  334. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js.map +0 -1
  335. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs +0 -1
  336. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs.map +0 -1
  337. package/dist/types/autosuggestions-config/suggestions-api-config.d.ts +0 -14
  338. package/dist/types/autosuggestions-config/suggestions-api-config.js +0 -90
  339. package/dist/types/autosuggestions-config/suggestions-api-config.js.map +0 -1
  340. package/dist/types/autosuggestions-config/suggestions-api-config.mjs +0 -12
  341. package/dist/types/autosuggestions-config/suggestions-api-config.mjs.map +0 -1
  342. package/dist/types/base/autosuggestion-state.d.ts +0 -8
  343. package/dist/types/base/autosuggestion-state.js +0 -19
  344. package/dist/types/base/autosuggestion-state.js.map +0 -1
  345. package/dist/types/base/autosuggestion-state.mjs +0 -1
  346. package/dist/types/base/autosuggestion-state.mjs.map +0 -1
  347. package/dist/types/base/autosuggestions-bare-function.d.ts +0 -19
  348. package/dist/types/base/autosuggestions-bare-function.js +0 -19
  349. package/dist/types/base/autosuggestions-bare-function.js.map +0 -1
  350. package/dist/types/base/autosuggestions-bare-function.mjs +0 -1
  351. package/dist/types/base/autosuggestions-bare-function.mjs.map +0 -1
  352. package/dist/types/base/base-autosuggestions-config.d.ts +0 -83
  353. package/dist/types/base/base-autosuggestions-config.js +0 -54
  354. package/dist/types/base/base-autosuggestions-config.js.map +0 -1
  355. package/dist/types/base/base-autosuggestions-config.mjs +0 -8
  356. package/dist/types/base/base-autosuggestions-config.mjs.map +0 -1
  357. package/dist/types/base/base-copilot-textarea-props.d.ts +0 -5
  358. package/dist/types/base/base-copilot-textarea-props.js +0 -19
  359. package/dist/types/base/base-copilot-textarea-props.js.map +0 -1
  360. package/dist/types/base/base-copilot-textarea-props.mjs +0 -1
  361. package/dist/types/base/base-copilot-textarea-props.mjs.map +0 -1
  362. package/dist/types/base/custom-editor.d.ts +0 -29
  363. package/dist/types/base/custom-editor.js +0 -19
  364. package/dist/types/base/custom-editor.js.map +0 -1
  365. package/dist/types/base/custom-editor.mjs +0 -1
  366. package/dist/types/base/custom-editor.mjs.map +0 -1
  367. package/dist/types/base/editor-autocomplete-state.d.ts +0 -10
  368. package/dist/types/base/editor-autocomplete-state.js +0 -40
  369. package/dist/types/base/editor-autocomplete-state.js.map +0 -1
  370. package/dist/types/base/editor-autocomplete-state.mjs +0 -9
  371. package/dist/types/base/editor-autocomplete-state.mjs.map +0 -1
  372. package/dist/types/base/index.d.ts +0 -54
  373. package/dist/types/base/index.js +0 -56
  374. package/dist/types/base/index.js.map +0 -1
  375. package/dist/types/base/index.mjs +0 -9
  376. package/dist/types/base/index.mjs.map +0 -1
  377. package/dist/types/html-copilot-textarea-element.d.ts +0 -7
  378. package/dist/types/html-copilot-textarea-element.js +0 -19
  379. package/dist/types/html-copilot-textarea-element.js.map +0 -1
  380. package/dist/types/html-copilot-textarea-element.mjs +0 -2
  381. package/dist/types/html-copilot-textarea-element.mjs.map +0 -1
  382. package/dist/types/index.d.ts +0 -13
  383. package/dist/types/index.js +0 -289
  384. package/dist/types/index.js.map +0 -1
  385. package/dist/types/index.mjs +0 -19
  386. package/dist/types/index.mjs.map +0 -1
@@ -1,26 +0,0 @@
1
- import {
2
- cn
3
- } from "./chunk-YLFAIYRY.mjs";
4
- import {
5
- __objRest,
6
- __spreadValues
7
- } from "./chunk-MRXNTQOX.mjs";
8
-
9
- // src/components/ui/label.tsx
10
- import * as React from "react";
11
- import * as LabelPrimitive from "@radix-ui/react-label";
12
- import { cva } from "class-variance-authority";
13
- import { jsx } from "react/jsx-runtime";
14
- var labelVariants = cva(
15
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
16
- );
17
- var Label = React.forwardRef((_a, ref) => {
18
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
19
- return /* @__PURE__ */ jsx(LabelPrimitive.Root, __spreadValues({ ref, className: cn(labelVariants(), className) }, props));
20
- });
21
- Label.displayName = LabelPrimitive.Root.displayName;
22
-
23
- export {
24
- Label
25
- };
26
- //# sourceMappingURL=chunk-D47EKHIF.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/ui/label.tsx"],"sourcesContent":["import * as React from \"react\";\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n);\n\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & VariantProps<typeof labelVariants>\n>(({ className, ...props }, ref) => (\n <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />\n));\nLabel.displayName = LabelPrimitive.Root.displayName;\n\nexport { Label };\n"],"mappings":";;;;;;;;;AAAA,YAAY,WAAW;AACvB,YAAY,oBAAoB;AAChC,SAAS,WAA8B;AAYrC;AARF,IAAM,gBAAgB;AAAA,EACpB;AACF;AAEA,IAAM,QAAc,iBAGlB,CAAC,IAAyB,QAAK;AAA9B,eAAE,YAbL,IAaG,IAAgB,kBAAhB,IAAgB,CAAd;AACH,6BAAgB,qBAAf,iBAAoB,KAAU,WAAW,GAAG,cAAc,GAAG,SAAS,KAAO,MAAO;AAAA,CACtF;AACD,MAAM,cAA6B,oBAAK;","names":[]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-DE5K76I2.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,36 +0,0 @@
1
- import {
2
- __async
3
- } from "./chunk-MRXNTQOX.mjs";
4
-
5
- // src/lib/debouncer.ts
6
- var Debouncer = class {
7
- constructor(wait) {
8
- this.wait = wait;
9
- this.debounce = (func, ...args) => __async(this, null, function* () {
10
- this.cancel();
11
- this.timeoutId = setTimeout(() => __async(this, null, function* () {
12
- try {
13
- this.activeAbortController = new AbortController();
14
- yield func(...args, this.activeAbortController.signal);
15
- this.activeAbortController = void 0;
16
- } catch (error) {
17
- }
18
- }), this.wait);
19
- });
20
- this.cancel = () => {
21
- if (this.activeAbortController) {
22
- this.activeAbortController.abort();
23
- this.activeAbortController = void 0;
24
- }
25
- if (this.timeoutId !== void 0) {
26
- clearTimeout(this.timeoutId);
27
- this.timeoutId = void 0;
28
- }
29
- };
30
- }
31
- };
32
-
33
- export {
34
- Debouncer
35
- };
36
- //# sourceMappingURL=chunk-DFTV4TST.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/debouncer.ts"],"sourcesContent":["export type AsyncFunction<T extends any[]> = (...args: [...T, AbortSignal]) => Promise<void>;\n\nexport class Debouncer<T extends any[]> {\n private timeoutId?: ReturnType<typeof setTimeout>;\n private activeAbortController?: AbortController;\n\n constructor(private wait: number) {}\n\n debounce = async (func: AsyncFunction<T>, ...args: T) => {\n // Abort the previous promise immediately\n this.cancel();\n\n this.timeoutId = setTimeout(async () => {\n try {\n this.activeAbortController = new AbortController();\n\n // Pass the signal to the async function, assuming it supports it\n await func(...args, this.activeAbortController.signal);\n\n this.activeAbortController = undefined;\n } catch (error) {}\n }, this.wait);\n };\n\n cancel = () => {\n if (this.activeAbortController) {\n this.activeAbortController.abort();\n this.activeAbortController = undefined;\n }\n\n if (this.timeoutId !== undefined) {\n clearTimeout(this.timeoutId);\n this.timeoutId = undefined;\n }\n };\n}\n"],"mappings":";;;;;AAEO,IAAM,YAAN,MAAiC;AAAA,EAItC,YAAoB,MAAc;AAAd;AAEpB,oBAAW,CAAO,SAA2B,SAAY;AAEvD,WAAK,OAAO;AAEZ,WAAK,YAAY,WAAW,MAAY;AACtC,YAAI;AACF,eAAK,wBAAwB,IAAI,gBAAgB;AAGjD,gBAAM,KAAK,GAAG,MAAM,KAAK,sBAAsB,MAAM;AAErD,eAAK,wBAAwB;AAAA,QAC/B,SAAS,OAAP;AAAA,QAAe;AAAA,MACnB,IAAG,KAAK,IAAI;AAAA,IACd;AAEA,kBAAS,MAAM;AACb,UAAI,KAAK,uBAAuB;AAC9B,aAAK,sBAAsB,MAAM;AACjC,aAAK,wBAAwB;AAAA,MAC/B;AAEA,UAAI,KAAK,cAAc,QAAW;AAChC,qBAAa,KAAK,SAAS;AAC3B,aAAK,YAAY;AAAA,MACnB;AAAA,IACF;AAAA,EA5BmC;AA6BrC;","names":[]}
@@ -1,70 +0,0 @@
1
- import {
2
- defaultShouldSave,
3
- withPartialHistory
4
- } from "./chunk-4NHVQZ67.mjs";
5
-
6
- // src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx
7
- import { useMemo } from "react";
8
- import { createEditor, Element } from "slate";
9
- import { withReact } from "slate-react";
10
- var shouldSave = (op, prev) => {
11
- const excludedNodeType = "suggestion";
12
- if (op.type === "insert_node" && Element.isElement(op.node) && op.node.type === excludedNodeType) {
13
- return false;
14
- }
15
- if (op.type === "remove_node" && Element.isElement(op.node) && op.node.type === excludedNodeType) {
16
- return false;
17
- }
18
- if (op.type === "set_node" && "type" in op.newProperties && op.newProperties.type === excludedNodeType) {
19
- return false;
20
- }
21
- if (op.type == "set_node" && "type" in op.properties && op.properties.type === excludedNodeType) {
22
- return false;
23
- }
24
- if (op.type === "merge_node" && "type" in op.properties && op.properties.type === excludedNodeType) {
25
- return false;
26
- }
27
- if (op.type === "split_node" && "type" in op.properties && op.properties.type === excludedNodeType) {
28
- return false;
29
- }
30
- return defaultShouldSave(op, prev);
31
- };
32
- function useCopilotTextareaEditor() {
33
- const editor = useMemo(() => {
34
- const editor2 = withPartialHistory(withReact(createEditor()), shouldSave);
35
- const { isVoid } = editor2;
36
- editor2.isVoid = (element) => {
37
- switch (element.type) {
38
- case "suggestion":
39
- return true;
40
- default:
41
- return isVoid(element);
42
- }
43
- };
44
- const { markableVoid } = editor2;
45
- editor2.markableVoid = (element) => {
46
- switch (element.type) {
47
- case "suggestion":
48
- return true;
49
- default:
50
- return markableVoid(element);
51
- }
52
- };
53
- const { isInline } = editor2;
54
- editor2.isInline = (element) => {
55
- switch (element.type) {
56
- case "suggestion":
57
- return element.inline;
58
- default:
59
- return isInline(element);
60
- }
61
- };
62
- return editor2;
63
- }, []);
64
- return editor;
65
- }
66
-
67
- export {
68
- useCopilotTextareaEditor
69
- };
70
- //# sourceMappingURL=chunk-DRV2FOHZ.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { createEditor, Element } from \"slate\";\nimport { withReact } from \"slate-react\";\nimport {\n defaultShouldSave,\n ShouldSaveToHistory,\n withPartialHistory,\n} from \"../../lib/slatejs-edits/with-partial-history\";\nimport { CustomEditor } from \"../../types/base/custom-editor\";\n\nconst shouldSave: ShouldSaveToHistory = (op, prev) => {\n const excludedNodeType = \"suggestion\";\n // Check if the operation involves the suggestion inline node type\n if (\n op.type === \"insert_node\" &&\n Element.isElement(op.node) &&\n op.node.type === excludedNodeType\n ) {\n return false;\n }\n\n if (\n op.type === \"remove_node\" &&\n Element.isElement(op.node) &&\n op.node.type === excludedNodeType\n ) {\n return false;\n }\n\n if (\n op.type === \"set_node\" &&\n \"type\" in op.newProperties &&\n op.newProperties.type === excludedNodeType\n ) {\n return false;\n }\n\n if (op.type == \"set_node\" && \"type\" in op.properties && op.properties.type === excludedNodeType) {\n return false;\n }\n\n if (\n op.type === \"merge_node\" &&\n \"type\" in op.properties &&\n op.properties.type === excludedNodeType\n ) {\n return false;\n }\n\n if (\n op.type === \"split_node\" &&\n \"type\" in op.properties &&\n op.properties.type === excludedNodeType\n ) {\n return false;\n }\n\n // Otherwise, save the operation to history\n return defaultShouldSave(op, prev);\n};\n\nexport function useCopilotTextareaEditor(): CustomEditor {\n const editor = useMemo(() => {\n const editor = withPartialHistory(withReact(createEditor()), shouldSave);\n\n const { isVoid } = editor;\n editor.isVoid = (element) => {\n switch (element.type) {\n case \"suggestion\":\n return true;\n default:\n return isVoid(element);\n }\n };\n\n const { markableVoid } = editor;\n editor.markableVoid = (element) => {\n switch (element.type) {\n case \"suggestion\":\n return true;\n default:\n return markableVoid(element);\n }\n };\n\n const { isInline } = editor;\n editor.isInline = (element) => {\n switch (element.type) {\n case \"suggestion\":\n return element.inline;\n default:\n return isInline(element);\n }\n };\n\n return editor;\n }, []);\n\n return editor;\n}\n"],"mappings":";;;;;;AAAA,SAAS,eAAe;AACxB,SAAS,cAAc,eAAe;AACtC,SAAS,iBAAiB;AAQ1B,IAAM,aAAkC,CAAC,IAAI,SAAS;AACpD,QAAM,mBAAmB;AAEzB,MACE,GAAG,SAAS,iBACZ,QAAQ,UAAU,GAAG,IAAI,KACzB,GAAG,KAAK,SAAS,kBACjB;AACA,WAAO;AAAA,EACT;AAEA,MACE,GAAG,SAAS,iBACZ,QAAQ,UAAU,GAAG,IAAI,KACzB,GAAG,KAAK,SAAS,kBACjB;AACA,WAAO;AAAA,EACT;AAEA,MACE,GAAG,SAAS,cACZ,UAAU,GAAG,iBACb,GAAG,cAAc,SAAS,kBAC1B;AACA,WAAO;AAAA,EACT;AAEA,MAAI,GAAG,QAAQ,cAAc,UAAU,GAAG,cAAc,GAAG,WAAW,SAAS,kBAAkB;AAC/F,WAAO;AAAA,EACT;AAEA,MACE,GAAG,SAAS,gBACZ,UAAU,GAAG,cACb,GAAG,WAAW,SAAS,kBACvB;AACA,WAAO;AAAA,EACT;AAEA,MACE,GAAG,SAAS,gBACZ,UAAU,GAAG,cACb,GAAG,WAAW,SAAS,kBACvB;AACA,WAAO;AAAA,EACT;AAGA,SAAO,kBAAkB,IAAI,IAAI;AACnC;AAEO,SAAS,2BAAyC;AACvD,QAAM,SAAS,QAAQ,MAAM;AAC3B,UAAMA,UAAS,mBAAmB,UAAU,aAAa,CAAC,GAAG,UAAU;AAEvE,UAAM,EAAE,OAAO,IAAIA;AACnB,IAAAA,QAAO,SAAS,CAAC,YAAY;AAC3B,cAAQ,QAAQ,MAAM;AAAA,QACpB,KAAK;AACH,iBAAO;AAAA,QACT;AACE,iBAAO,OAAO,OAAO;AAAA,MACzB;AAAA,IACF;AAEA,UAAM,EAAE,aAAa,IAAIA;AACzB,IAAAA,QAAO,eAAe,CAAC,YAAY;AACjC,cAAQ,QAAQ,MAAM;AAAA,QACpB,KAAK;AACH,iBAAO;AAAA,QACT;AACE,iBAAO,aAAa,OAAO;AAAA,MAC/B;AAAA,IACF;AAEA,UAAM,EAAE,SAAS,IAAIA;AACrB,IAAAA,QAAO,WAAW,CAAC,YAAY;AAC7B,cAAQ,QAAQ,MAAM;AAAA,QACpB,KAAK;AACH,iBAAO,QAAQ;AAAA,QACjB;AACE,iBAAO,SAAS,OAAO;AAAA,MAC3B;AAAA,IACF;AAEA,WAAOA;AAAA,EACT,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;","names":["editor"]}
@@ -1,104 +0,0 @@
1
- // src/lib/get-text-around-cursor.ts
2
- import { Editor, Path, Range, Text, Element, Point } from "slate";
3
- function getTextAroundCollapsedCursor(editor) {
4
- const { selection } = editor;
5
- if (!selection || !Range.isCollapsed(selection)) {
6
- return null;
7
- }
8
- const cursorPoint = selection.anchor;
9
- const beforeRange = {
10
- anchor: Editor.start(editor, []),
11
- focus: cursorPoint
12
- };
13
- const afterRange = {
14
- anchor: cursorPoint,
15
- focus: Editor.end(editor, [])
16
- };
17
- const before = extractTextWithNewlines(editor, beforeRange);
18
- const after = extractTextWithNewlines(editor, afterRange);
19
- return {
20
- cursorPoint,
21
- textBeforeCursor: before,
22
- textAfterCursor: after
23
- };
24
- }
25
- function getTextAroundSelection(editor) {
26
- const { selection } = editor;
27
- if (!selection) {
28
- return null;
29
- }
30
- const wellOrderedSelection = wellOrderedRange(selection);
31
- const beforeRange = {
32
- anchor: Editor.start(editor, []),
33
- focus: wellOrderedSelection.anchor
34
- };
35
- const afterRange = {
36
- anchor: wellOrderedSelection.focus,
37
- focus: Editor.end(editor, [])
38
- };
39
- const before = extractTextWithNewlines(editor, beforeRange);
40
- const after = extractTextWithNewlines(editor, afterRange);
41
- const selectedText = extractTextWithNewlines(editor, wellOrderedSelection);
42
- return {
43
- selection: wellOrderedSelection,
44
- textBeforeCursor: before,
45
- selectedText,
46
- textAfterCursor: after
47
- };
48
- }
49
- function getFullEditorTextWithNewlines(editor) {
50
- const fullDocumentRange = {
51
- anchor: Editor.start(editor, []),
52
- focus: Editor.end(editor, [])
53
- };
54
- return extractTextWithNewlines(editor, fullDocumentRange);
55
- }
56
- function extractTextWithNewlines(editor, range) {
57
- const voids = false;
58
- const [start, end] = Range.edges(range);
59
- let text = "";
60
- let lastBlock = null;
61
- for (const [node, path] of Editor.nodes(editor, {
62
- at: range,
63
- match: Text.isText,
64
- voids
65
- })) {
66
- let t = node.text;
67
- const [block] = Editor.above(editor, {
68
- at: path,
69
- match: (n) => Element.isElement(n) && n.type === "paragraph"
70
- }) || [null];
71
- if (lastBlock !== block && block) {
72
- if (lastBlock) {
73
- text += "\n";
74
- }
75
- lastBlock = block;
76
- }
77
- if (Path.equals(path, end.path)) {
78
- t = t.slice(0, end.offset);
79
- }
80
- if (Path.equals(path, start.path)) {
81
- t = t.slice(start.offset);
82
- }
83
- text += t;
84
- }
85
- return text;
86
- }
87
- function wellOrderedRange(range) {
88
- const { anchor, focus } = range;
89
- if (Point.isBefore(anchor, focus)) {
90
- return range;
91
- }
92
- return {
93
- anchor: focus,
94
- focus: anchor
95
- };
96
- }
97
-
98
- export {
99
- getTextAroundCollapsedCursor,
100
- getTextAroundSelection,
101
- getFullEditorTextWithNewlines,
102
- extractTextWithNewlines
103
- };
104
- //# sourceMappingURL=chunk-ECR45NSD.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/get-text-around-cursor.ts"],"sourcesContent":["import { Editor, Node, Path, Range, Text, Element, BasePoint, BaseRange, Point } from \"slate\";\nimport { EditorAutocompleteState } from \"../types/base/editor-autocomplete-state\";\n\nexport interface EditorTextState {\n selection: BaseRange;\n\n textBeforeCursor: string;\n selectedText: string;\n textAfterCursor: string;\n}\n\nexport function getTextAroundCollapsedCursor(editor: Editor): EditorAutocompleteState | null {\n const { selection } = editor;\n if (!selection || !Range.isCollapsed(selection)) {\n return null;\n }\n\n const cursorPoint = selection.anchor;\n\n // Create two ranges: one before the anchor and one after\n const beforeRange: Range = {\n anchor: Editor.start(editor, []),\n focus: cursorPoint,\n };\n const afterRange: Range = {\n anchor: cursorPoint,\n focus: Editor.end(editor, []),\n };\n\n // Extract text for these ranges\n const before = extractTextWithNewlines(editor, beforeRange);\n const after = extractTextWithNewlines(editor, afterRange);\n\n return {\n cursorPoint: cursorPoint,\n textBeforeCursor: before,\n textAfterCursor: after,\n };\n}\n\nexport function getTextAroundSelection(editor: Editor): EditorTextState | null {\n const { selection } = editor;\n if (!selection) {\n return null;\n }\n\n const wellOrderedSelection = wellOrderedRange(selection);\n\n // Create two ranges: one before the anchor and one after\n const beforeRange: Range = {\n anchor: Editor.start(editor, []),\n focus: wellOrderedSelection.anchor,\n };\n const afterRange: Range = {\n anchor: wellOrderedSelection.focus,\n focus: Editor.end(editor, []),\n };\n\n // Extract text for these ranges\n const before = extractTextWithNewlines(editor, beforeRange);\n const after = extractTextWithNewlines(editor, afterRange);\n const selectedText = extractTextWithNewlines(editor, wellOrderedSelection);\n\n return {\n selection: wellOrderedSelection,\n textBeforeCursor: before,\n selectedText,\n textAfterCursor: after,\n };\n}\n\nexport function getFullEditorTextWithNewlines(editor: Editor): string {\n const fullDocumentRange: Range = {\n anchor: Editor.start(editor, []),\n focus: Editor.end(editor, []),\n };\n return extractTextWithNewlines(editor, fullDocumentRange);\n}\n\n// Helper function to extract text with newlines\nexport function extractTextWithNewlines(editor: Editor, range: Range): string {\n const voids = false;\n const [start, end] = Range.edges(range);\n let text = \"\";\n let lastBlock: Node | null = null;\n\n for (const [node, path] of Editor.nodes(editor, {\n at: range,\n match: Text.isText,\n voids,\n })) {\n let t = node.text;\n\n // Determine the parent block of the current text node\n const [block] = Editor.above(editor, {\n at: path,\n match: (n) => Element.isElement(n) && n.type === \"paragraph\",\n }) || [null];\n\n // If we encounter a new block, prepend a newline\n if (lastBlock !== block && block) {\n // check that lastBlock is not null to avoid adding a newline at the beginning\n if (lastBlock) {\n text += \"\\n\";\n }\n lastBlock = block;\n }\n\n if (Path.equals(path, end.path)) {\n t = t.slice(0, end.offset);\n }\n\n if (Path.equals(path, start.path)) {\n t = t.slice(start.offset);\n }\n\n text += t;\n }\n\n return text;\n}\n\nfunction wellOrderedRange(range: BaseRange): BaseRange {\n const { anchor, focus } = range;\n // if anchor is before focus, return range as is\n if (Point.isBefore(anchor, focus)) {\n return range;\n }\n\n // if focus is before anchor, return range with anchor and focus swapped\n return {\n anchor: focus,\n focus: anchor,\n };\n}\n"],"mappings":";AAAA,SAAS,QAAc,MAAM,OAAO,MAAM,SAA+B,aAAa;AAW/E,SAAS,6BAA6B,QAAgD;AAC3F,QAAM,EAAE,UAAU,IAAI;AACtB,MAAI,CAAC,aAAa,CAAC,MAAM,YAAY,SAAS,GAAG;AAC/C,WAAO;AAAA,EACT;AAEA,QAAM,cAAc,UAAU;AAG9B,QAAM,cAAqB;AAAA,IACzB,QAAQ,OAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC/B,OAAO;AAAA,EACT;AACA,QAAM,aAAoB;AAAA,IACxB,QAAQ;AAAA,IACR,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,EAC9B;AAGA,QAAM,SAAS,wBAAwB,QAAQ,WAAW;AAC1D,QAAM,QAAQ,wBAAwB,QAAQ,UAAU;AAExD,SAAO;AAAA,IACL;AAAA,IACA,kBAAkB;AAAA,IAClB,iBAAiB;AAAA,EACnB;AACF;AAEO,SAAS,uBAAuB,QAAwC;AAC7E,QAAM,EAAE,UAAU,IAAI;AACtB,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,EACT;AAEA,QAAM,uBAAuB,iBAAiB,SAAS;AAGvD,QAAM,cAAqB;AAAA,IACzB,QAAQ,OAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC/B,OAAO,qBAAqB;AAAA,EAC9B;AACA,QAAM,aAAoB;AAAA,IACxB,QAAQ,qBAAqB;AAAA,IAC7B,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,EAC9B;AAGA,QAAM,SAAS,wBAAwB,QAAQ,WAAW;AAC1D,QAAM,QAAQ,wBAAwB,QAAQ,UAAU;AACxD,QAAM,eAAe,wBAAwB,QAAQ,oBAAoB;AAEzE,SAAO;AAAA,IACL,WAAW;AAAA,IACX,kBAAkB;AAAA,IAClB;AAAA,IACA,iBAAiB;AAAA,EACnB;AACF;AAEO,SAAS,8BAA8B,QAAwB;AACpE,QAAM,oBAA2B;AAAA,IAC/B,QAAQ,OAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC/B,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,EAC9B;AACA,SAAO,wBAAwB,QAAQ,iBAAiB;AAC1D;AAGO,SAAS,wBAAwB,QAAgB,OAAsB;AAC5E,QAAM,QAAQ;AACd,QAAM,CAAC,OAAO,GAAG,IAAI,MAAM,MAAM,KAAK;AACtC,MAAI,OAAO;AACX,MAAI,YAAyB;AAE7B,aAAW,CAAC,MAAM,IAAI,KAAK,OAAO,MAAM,QAAQ;AAAA,IAC9C,IAAI;AAAA,IACJ,OAAO,KAAK;AAAA,IACZ;AAAA,EACF,CAAC,GAAG;AACF,QAAI,IAAI,KAAK;AAGb,UAAM,CAAC,KAAK,IAAI,OAAO,MAAM,QAAQ;AAAA,MACnC,IAAI;AAAA,MACJ,OAAO,CAAC,MAAM,QAAQ,UAAU,CAAC,KAAK,EAAE,SAAS;AAAA,IACnD,CAAC,KAAK,CAAC,IAAI;AAGX,QAAI,cAAc,SAAS,OAAO;AAEhC,UAAI,WAAW;AACb,gBAAQ;AAAA,MACV;AACA,kBAAY;AAAA,IACd;AAEA,QAAI,KAAK,OAAO,MAAM,IAAI,IAAI,GAAG;AAC/B,UAAI,EAAE,MAAM,GAAG,IAAI,MAAM;AAAA,IAC3B;AAEA,QAAI,KAAK,OAAO,MAAM,MAAM,IAAI,GAAG;AACjC,UAAI,EAAE,MAAM,MAAM,MAAM;AAAA,IAC1B;AAEA,YAAQ;AAAA,EACV;AAEA,SAAO;AACT;AAEA,SAAS,iBAAiB,OAA6B;AACrD,QAAM,EAAE,QAAQ,MAAM,IAAI;AAE1B,MAAI,MAAM,SAAS,QAAQ,KAAK,GAAG;AACjC,WAAO;AAAA,EACT;AAGA,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,OAAO;AAAA,EACT;AACF;","names":[]}
@@ -1,82 +0,0 @@
1
- // src/types/autosuggestions-config/editing-api-config.tsx
2
- import { Role, TextMessage } from "@copilotkit/runtime-client-gql";
3
- var defaultEditingMakeSystemPrompt = (textareaPurpose, contextString) => {
4
- return `You are a versatile writing assistant helping the user edit a portion of their text.
5
-
6
- The user is writing some text.
7
- The purpose is: "${textareaPurpose}"
8
-
9
- The following external context is also provided. Use it when relevant.
10
- \`\`\`
11
- ${contextString}
12
- \`\`\`
13
-
14
- The user has provided you with a PROMPT for EDITING a PORTION of the text.
15
- Your job is to come up with a new EDITED version OF THE SEGMENT IN QUESTION - AS BEST YOU CAN.
16
- Only rewrite the portion of the text that the user has marked as "TextToEdit"!!!
17
-
18
- Adjust yourself to the user's style and implied intent.
19
-
20
- The conversation will be structured as follows:
21
- <TextBeforeCursor>
22
- <TextToEdit>
23
- <TextAfterCursor>
24
- <EditingPrompt>
25
-
26
- <YourEditSuggestion>
27
- `;
28
- };
29
- var defaultEditingFewShotMessages = [
30
- new TextMessage({
31
- role: Role.User,
32
- content: "<TextBeforeCursor>This morning I woke up and went straight to the grocery store. </TextBeforeCursor>"
33
- }),
34
- new TextMessage({
35
- role: Role.User,
36
- content: "<TextToEdit>While I was there I picked up some apples, oranges, and bananas. </TextToEdit>"
37
- }),
38
- new TextMessage({
39
- role: Role.User,
40
- content: "<TextAfterCursor>The grocery store was having a sale on fruit, so I decided to stock up.</TextAfterCursor>"
41
- }),
42
- new TextMessage({
43
- role: Role.User,
44
- content: "<EditingPrompt>I also bought a big watermelon</EditingPrompt>"
45
- }),
46
- new TextMessage({
47
- role: Role.Assistant,
48
- content: "While I was there I picked up some apples, oranges, and bananas, and a big watermelon."
49
- }),
50
- new TextMessage({
51
- role: Role.User,
52
- content: "<TextBeforeCursor>Yesterday, I spent the afternoon working on my new project.</TextBeforeCursor>"
53
- }),
54
- new TextMessage({
55
- role: Role.User,
56
- content: "<TextToEdit>It's quite challenging and requires a lot of focus.</TextToEdit>"
57
- }),
58
- new TextMessage({
59
- role: Role.User,
60
- content: "<TextAfterCursor>I'm really excited about the potential outcomes of this project.</TextAfterCursor>"
61
- }),
62
- new TextMessage({
63
- role: Role.User,
64
- content: "<EditingPrompt>emphasize the complexity and my enthusiasm for the project</EditingPrompt>"
65
- }),
66
- new TextMessage({
67
- role: Role.Assistant,
68
- content: "It's a highly complex task that demands intense concentration, but I'm incredibly enthusiastic about the promising prospects of this project."
69
- })
70
- ];
71
- var defaultEditingApiConfig = {
72
- makeSystemPrompt: defaultEditingMakeSystemPrompt,
73
- fewShotMessages: defaultEditingFewShotMessages,
74
- forwardedParams: void 0
75
- };
76
-
77
- export {
78
- defaultEditingMakeSystemPrompt,
79
- defaultEditingFewShotMessages,
80
- defaultEditingApiConfig
81
- };
82
- //# sourceMappingURL=chunk-EJGGLWWR.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/types/autosuggestions-config/editing-api-config.tsx"],"sourcesContent":["import { Message, Role, TextMessage } from \"@copilotkit/runtime-client-gql\";\nimport { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\n\nexport interface EditingApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: Message[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultEditingMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString,\n) => {\n return `You are a versatile writing assistant helping the user edit a portion of their text.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nThe following external context is also provided. Use it when relevant.\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThe user has provided you with a PROMPT for EDITING a PORTION of the text. \nYour job is to come up with a new EDITED version OF THE SEGMENT IN QUESTION - AS BEST YOU CAN.\nOnly rewrite the portion of the text that the user has marked as \"TextToEdit\"!!!\n\nAdjust yourself to the user's style and implied intent.\n\nThe conversation will be structured as follows:\n<TextBeforeCursor>\n<TextToEdit>\n<TextAfterCursor>\n<EditingPrompt>\n\n<YourEditSuggestion>\n`;\n};\n\nexport const defaultEditingFewShotMessages: Message[] = [\n new TextMessage({\n role: Role.User,\n content:\n \"<TextBeforeCursor>This morning I woke up and went straight to the grocery store. </TextBeforeCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextToEdit>While I was there I picked up some apples, oranges, and bananas. </TextToEdit>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>The grocery store was having a sale on fruit, so I decided to stock up.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content: \"<EditingPrompt>I also bought a big watermelon</EditingPrompt>\",\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n \"While I was there I picked up some apples, oranges, and bananas, and a big watermelon.\",\n }),\n\n new TextMessage({\n role: Role.User,\n content:\n \"<TextBeforeCursor>Yesterday, I spent the afternoon working on my new project.</TextBeforeCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content: \"<TextToEdit>It's quite challenging and requires a lot of focus.</TextToEdit>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>I'm really excited about the potential outcomes of this project.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<EditingPrompt>emphasize the complexity and my enthusiasm for the project</EditingPrompt>\",\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n \"It's a highly complex task that demands intense concentration, but I'm incredibly enthusiastic about the promising prospects of this project.\",\n }),\n];\n\nexport const defaultEditingApiConfig: EditingApiConfig = {\n makeSystemPrompt: defaultEditingMakeSystemPrompt,\n fewShotMessages: defaultEditingFewShotMessages,\n forwardedParams: undefined,\n};\n"],"mappings":";AAAA,SAAkB,MAAM,mBAAmB;AASpC,IAAM,iCAAmD,CAC9D,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW;AAAA;AAAA;AAAA;AAAA,EAIlB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBF;AAEO,IAAM,gCAA2C;AAAA,EACtD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SAAS;AAAA,EACX,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EAED,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SAAS;AAAA,EACX,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AACH;AAEO,IAAM,0BAA4C;AAAA,EACvD,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB;","names":[]}
@@ -1,125 +0,0 @@
1
- import {
2
- HoveringInsertionPromptBox
3
- } from "./chunk-TIS7PLZC.mjs";
4
- import {
5
- useHoveringEditorContext
6
- } from "./chunk-LYB4B6MK.mjs";
7
- import {
8
- Menu,
9
- Portal
10
- } from "./chunk-HDBI2WN5.mjs";
11
- import {
12
- getFullEditorTextWithNewlines,
13
- getTextAroundSelection
14
- } from "./chunk-ECR45NSD.mjs";
15
-
16
- // src/components/hovering-toolbar/hovering-toolbar.tsx
17
- import { useEffect, useRef, useState } from "react";
18
- import { Transforms } from "slate";
19
- import { useSlate, useSlateSelection } from "slate-react";
20
- import { jsx } from "react/jsx-runtime";
21
- var HoveringToolbar = (props) => {
22
- const ref = useRef(null);
23
- const editor = useSlate();
24
- const selection = useSlateSelection();
25
- const { isDisplayed, setIsDisplayed } = useHoveringEditorContext();
26
- const [isClient, setIsClient] = useState(false);
27
- useEffect(() => {
28
- setIsClient(true);
29
- }, []);
30
- useEffect(() => {
31
- const el = ref.current;
32
- const { selection: selection2 } = editor;
33
- if (!el) {
34
- return;
35
- }
36
- if (!selection2) {
37
- el.removeAttribute("style");
38
- return;
39
- }
40
- const domSelection = window.getSelection();
41
- if (!domSelection || domSelection.rangeCount === 0) {
42
- return;
43
- }
44
- const domRange = domSelection.getRangeAt(0);
45
- const rect = domRange.getBoundingClientRect();
46
- if (rect.top === 0 && rect.left === 0 && rect.width === 0 && rect.height === 0) {
47
- return;
48
- }
49
- const minGapFromEdge = 60;
50
- const verticalOffsetFromCorner = 35;
51
- const horizontalOffsetFromCorner = 15;
52
- let top = rect.top + window.scrollY - el.offsetHeight + verticalOffsetFromCorner;
53
- if (top < minGapFromEdge) {
54
- top = rect.bottom + window.scrollY + minGapFromEdge;
55
- } else if (top + el.offsetHeight > window.innerHeight - minGapFromEdge) {
56
- top = rect.top + window.scrollY - el.offsetHeight - minGapFromEdge;
57
- }
58
- let left = rect.left + window.scrollX - el.offsetWidth / 2 + rect.width / 2 + horizontalOffsetFromCorner;
59
- if (left < minGapFromEdge) {
60
- left = minGapFromEdge;
61
- } else if (left + el.offsetWidth > window.innerWidth - minGapFromEdge) {
62
- left = window.innerWidth - el.offsetWidth - minGapFromEdge;
63
- }
64
- el.style.opacity = "1";
65
- el.style.position = "absolute";
66
- el.style.top = `${top}px`;
67
- el.style.left = `${left}px`;
68
- });
69
- useEffect(() => {
70
- const handleClickOutside = (event) => {
71
- if (ref.current && !ref.current.contains(event.target)) {
72
- setIsDisplayed(false);
73
- }
74
- };
75
- document.addEventListener("mousedown", handleClickOutside);
76
- return () => {
77
- document.removeEventListener("mousedown", handleClickOutside);
78
- };
79
- }, [ref, setIsDisplayed]);
80
- if (!isClient) {
81
- return null;
82
- }
83
- return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(
84
- Menu,
85
- {
86
- ref,
87
- className: "copilot-kit-textarea-css-scope " + (props.hoverMenuClassname || "p-2 absolute z-10 top-[-10000px] left-[-10000px] mt-[-6px] opacity-0 transition-opacity duration-700"),
88
- "data-testid": "hovering-toolbar",
89
- children: isDisplayed && selection && /* @__PURE__ */ jsx(
90
- HoveringInsertionPromptBox,
91
- {
92
- editorState: editorState(editor, selection),
93
- apiConfig: props.apiConfig,
94
- closeWindow: () => {
95
- setIsDisplayed(false);
96
- },
97
- performInsertion: (insertedText) => {
98
- Transforms.delete(editor, { at: selection });
99
- Transforms.insertText(editor, insertedText, {
100
- at: selection
101
- });
102
- setIsDisplayed(false);
103
- },
104
- contextCategories: props.contextCategories
105
- }
106
- )
107
- }
108
- ) });
109
- };
110
- function editorState(editor, selection) {
111
- const textAroundCursor = getTextAroundSelection(editor);
112
- if (textAroundCursor) {
113
- return textAroundCursor;
114
- }
115
- return {
116
- textBeforeCursor: getFullEditorTextWithNewlines(editor),
117
- textAfterCursor: "",
118
- selectedText: ""
119
- };
120
- }
121
-
122
- export {
123
- HoveringToolbar
124
- };
125
- //# sourceMappingURL=chunk-EVEUQINY.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/hovering-toolbar/hovering-toolbar.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { Editor, Location, Transforms } from \"slate\";\nimport { useSlate, useSlateSelection } from \"slate-react\";\nimport { HoveringInsertionPromptBox } from \"./text-insertion-prompt-box\";\nimport { Menu, Portal } from \"./hovering-toolbar-components\";\nimport { useHoveringEditorContext } from \"./hovering-editor-provider\";\nimport {\n getFullEditorTextWithNewlines,\n getTextAroundSelection,\n} from \"../../lib/get-text-around-cursor\";\nimport {\n EditingEditorState,\n InsertionEditorApiConfig,\n} from \"../../types/base/autosuggestions-bare-function\";\n\nexport interface HoveringToolbarProps {\n apiConfig: InsertionEditorApiConfig;\n contextCategories: string[];\n hoverMenuClassname: string | undefined;\n}\n\nexport const HoveringToolbar = (props: HoveringToolbarProps) => {\n const ref = useRef<HTMLDivElement>(null);\n const editor = useSlate();\n const selection = useSlateSelection();\n const { isDisplayed, setIsDisplayed } = useHoveringEditorContext();\n\n // only render on client\n const [isClient, setIsClient] = useState(false);\n useEffect(() => {\n setIsClient(true);\n }, []);\n\n useEffect(() => {\n const el = ref.current;\n const { selection } = editor;\n\n if (!el) {\n return;\n }\n\n if (!selection) {\n el.removeAttribute(\"style\");\n return;\n }\n\n const domSelection = window.getSelection();\n if (!domSelection || domSelection.rangeCount === 0) {\n return;\n }\n\n const domRange = domSelection.getRangeAt(0);\n const rect = domRange.getBoundingClientRect();\n\n // We use window = (0,0,0,0) as a signal that the selection is not in the original copilot-textarea,\n // but inside the hovering window.\n //\n // in such case, we simply do nothing.\n if (rect.top === 0 && rect.left === 0 && rect.width === 0 && rect.height === 0) {\n return;\n }\n const minGapFromEdge = 60;\n const verticalOffsetFromCorner = 35;\n const horizontalOffsetFromCorner = 15;\n let top = rect.top + window.scrollY - el.offsetHeight + verticalOffsetFromCorner;\n // make sure top is in the viewport and not too close to the edge\n if (top < minGapFromEdge) {\n top = rect.bottom + window.scrollY + minGapFromEdge;\n } else if (top + el.offsetHeight > window.innerHeight - minGapFromEdge) {\n top = rect.top + window.scrollY - el.offsetHeight - minGapFromEdge;\n }\n\n let left =\n rect.left + window.scrollX - el.offsetWidth / 2 + rect.width / 2 + horizontalOffsetFromCorner;\n // make sure left is in the viewport and not too close to the edge\n if (left < minGapFromEdge) {\n left = minGapFromEdge;\n } else if (left + el.offsetWidth > window.innerWidth - minGapFromEdge) {\n left = window.innerWidth - el.offsetWidth - minGapFromEdge;\n }\n\n el.style.opacity = \"1\";\n el.style.position = \"absolute\";\n\n el.style.top = `${top}px`;\n el.style.left = `${left}px`;\n });\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (ref.current && !ref.current.contains(event.target as Node)) {\n setIsDisplayed(false);\n }\n };\n\n document.addEventListener(\"mousedown\", handleClickOutside);\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [ref, setIsDisplayed]);\n\n if (!isClient) {\n return null;\n }\n\n return (\n <Portal>\n <Menu\n ref={ref}\n className={\n \"copilot-kit-textarea-css-scope \" +\n (props.hoverMenuClassname ||\n \"p-2 absolute z-10 top-[-10000px] left-[-10000px] mt-[-6px] opacity-0 transition-opacity duration-700\")\n }\n data-testid=\"hovering-toolbar\"\n >\n {isDisplayed && selection && (\n <HoveringInsertionPromptBox\n editorState={editorState(editor, selection)}\n apiConfig={props.apiConfig}\n closeWindow={() => {\n setIsDisplayed(false);\n }}\n performInsertion={(insertedText) => {\n // replace the selection with the inserted text\n Transforms.delete(editor, { at: selection });\n Transforms.insertText(editor, insertedText, {\n at: selection,\n });\n setIsDisplayed(false);\n }}\n contextCategories={props.contextCategories}\n />\n )}\n </Menu>\n </Portal>\n );\n};\n\nfunction editorState(editor: Editor, selection: Location): EditingEditorState {\n const textAroundCursor = getTextAroundSelection(editor);\n if (textAroundCursor) {\n return textAroundCursor;\n }\n\n return {\n textBeforeCursor: getFullEditorTextWithNewlines(editor),\n textAfterCursor: \"\",\n selectedText: \"\",\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAA2B,kBAAkB;AAC7C,SAAS,UAAU,yBAAyB;AAmHlC;AAhGH,IAAM,kBAAkB,CAAC,UAAgC;AAC9D,QAAM,MAAM,OAAuB,IAAI;AACvC,QAAM,SAAS,SAAS;AACxB,QAAM,YAAY,kBAAkB;AACpC,QAAM,EAAE,aAAa,eAAe,IAAI,yBAAyB;AAGjE,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAC9C,YAAU,MAAM;AACd,gBAAY,IAAI;AAAA,EAClB,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AACd,UAAM,KAAK,IAAI;AACf,UAAM,EAAE,WAAAA,WAAU,IAAI;AAEtB,QAAI,CAAC,IAAI;AACP;AAAA,IACF;AAEA,QAAI,CAACA,YAAW;AACd,SAAG,gBAAgB,OAAO;AAC1B;AAAA,IACF;AAEA,UAAM,eAAe,OAAO,aAAa;AACzC,QAAI,CAAC,gBAAgB,aAAa,eAAe,GAAG;AAClD;AAAA,IACF;AAEA,UAAM,WAAW,aAAa,WAAW,CAAC;AAC1C,UAAM,OAAO,SAAS,sBAAsB;AAM5C,QAAI,KAAK,QAAQ,KAAK,KAAK,SAAS,KAAK,KAAK,UAAU,KAAK,KAAK,WAAW,GAAG;AAC9E;AAAA,IACF;AACA,UAAM,iBAAiB;AACvB,UAAM,2BAA2B;AACjC,UAAM,6BAA6B;AACnC,QAAI,MAAM,KAAK,MAAM,OAAO,UAAU,GAAG,eAAe;AAExD,QAAI,MAAM,gBAAgB;AACxB,YAAM,KAAK,SAAS,OAAO,UAAU;AAAA,IACvC,WAAW,MAAM,GAAG,eAAe,OAAO,cAAc,gBAAgB;AACtE,YAAM,KAAK,MAAM,OAAO,UAAU,GAAG,eAAe;AAAA,IACtD;AAEA,QAAI,OACF,KAAK,OAAO,OAAO,UAAU,GAAG,cAAc,IAAI,KAAK,QAAQ,IAAI;AAErE,QAAI,OAAO,gBAAgB;AACzB,aAAO;AAAA,IACT,WAAW,OAAO,GAAG,cAAc,OAAO,aAAa,gBAAgB;AACrE,aAAO,OAAO,aAAa,GAAG,cAAc;AAAA,IAC9C;AAEA,OAAG,MAAM,UAAU;AACnB,OAAG,MAAM,WAAW;AAEpB,OAAG,MAAM,MAAM,GAAG;AAClB,OAAG,MAAM,OAAO,GAAG;AAAA,EACrB,CAAC;AAED,YAAU,MAAM;AACd,UAAM,qBAAqB,CAAC,UAAsB;AAChD,UAAI,IAAI,WAAW,CAAC,IAAI,QAAQ,SAAS,MAAM,MAAc,GAAG;AAC9D,uBAAe,KAAK;AAAA,MACtB;AAAA,IACF;AAEA,aAAS,iBAAiB,aAAa,kBAAkB;AACzD,WAAO,MAAM;AACX,eAAS,oBAAoB,aAAa,kBAAkB;AAAA,IAC9D;AAAA,EACF,GAAG,CAAC,KAAK,cAAc,CAAC;AAExB,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AAEA,SACE,oBAAC,UACC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WACE,qCACC,MAAM,sBACL;AAAA,MAEJ,eAAY;AAAA,MAEX,yBAAe,aACd;AAAA,QAAC;AAAA;AAAA,UACC,aAAa,YAAY,QAAQ,SAAS;AAAA,UAC1C,WAAW,MAAM;AAAA,UACjB,aAAa,MAAM;AACjB,2BAAe,KAAK;AAAA,UACtB;AAAA,UACA,kBAAkB,CAAC,iBAAiB;AAElC,uBAAW,OAAO,QAAQ,EAAE,IAAI,UAAU,CAAC;AAC3C,uBAAW,WAAW,QAAQ,cAAc;AAAA,cAC1C,IAAI;AAAA,YACN,CAAC;AACD,2BAAe,KAAK;AAAA,UACtB;AAAA,UACA,mBAAmB,MAAM;AAAA;AAAA,MAC3B;AAAA;AAAA,EAEJ,GACF;AAEJ;AAEA,SAAS,YAAY,QAAgB,WAAyC;AAC5E,QAAM,mBAAmB,uBAAuB,MAAM;AACtD,MAAI,kBAAkB;AACpB,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,kBAAkB,8BAA8B,MAAM;AAAA,IACtD,iBAAiB;AAAA,IACjB,cAAc;AAAA,EAChB;AACF;","names":["selection"]}
@@ -1,22 +0,0 @@
1
- // src/lib/slatejs-edits/clear-autocompletions.ts
2
- import { Element, Node, Transforms } from "slate";
3
- function clearAutocompletionsFromEditor(editor) {
4
- const paths = [];
5
- for (const [node, path] of Node.nodes(editor)) {
6
- if (Element.isElement(node) && node.type === "suggestion") {
7
- paths.push(path);
8
- }
9
- }
10
- for (const path of paths) {
11
- try {
12
- Transforms.removeNodes(editor, { at: path });
13
- } catch (e) {
14
- console.log("CopilotTextarea.clearAutocompletionsFromEditor: error removing node", e);
15
- }
16
- }
17
- }
18
-
19
- export {
20
- clearAutocompletionsFromEditor
21
- };
22
- //# sourceMappingURL=chunk-GQN2HYFJ.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/slatejs-edits/clear-autocompletions.ts"],"sourcesContent":["import { Element, Node, Path, Transforms } from \"slate\";\nimport { CustomEditor } from \"../../types/base/custom-editor\";\n\nexport function clearAutocompletionsFromEditor(editor: CustomEditor) {\n // clear previous suggestion\n const paths: Path[] = [];\n for (const [node, path] of Node.nodes(editor)) {\n if (Element.isElement(node) && node.type === \"suggestion\") {\n paths.push(path);\n }\n }\n for (const path of paths) {\n try {\n Transforms.removeNodes(editor, { at: path });\n } catch (e) {\n console.log(\"CopilotTextarea.clearAutocompletionsFromEditor: error removing node\", e);\n }\n }\n}\n"],"mappings":";AAAA,SAAS,SAAS,MAAY,kBAAkB;AAGzC,SAAS,+BAA+B,QAAsB;AAEnE,QAAM,QAAgB,CAAC;AACvB,aAAW,CAAC,MAAM,IAAI,KAAK,KAAK,MAAM,MAAM,GAAG;AAC7C,QAAI,QAAQ,UAAU,IAAI,KAAK,KAAK,SAAS,cAAc;AACzD,YAAM,KAAK,IAAI;AAAA,IACjB;AAAA,EACF;AACA,aAAW,QAAQ,OAAO;AACxB,QAAI;AACF,iBAAW,YAAY,QAAQ,EAAE,IAAI,KAAK,CAAC;AAAA,IAC7C,SAAS,GAAP;AACA,cAAQ,IAAI,uEAAuE,CAAC;AAAA,IACtF;AAAA,EACF;AACF;","names":[]}
@@ -1,64 +0,0 @@
1
- // src/types/autosuggestions-config/suggestions-api-config.tsx
2
- import { Role, TextMessage } from "@copilotkit/runtime-client-gql";
3
- var defaultSuggestionsMakeSystemPrompt = (textareaPurpose, contextString) => {
4
- return `You are a versatile writing assistant.
5
-
6
- The user is writing some text.
7
- The purpose is: "${textareaPurpose}"
8
-
9
- Your job is to guess what the user will write next AS BEST YOU CAN.
10
- Only guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.
11
-
12
- Adjust yourself to the user's style and implied intent.
13
-
14
- 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.
15
- <TextAfterCursor>
16
- <TextBeforeCursor>
17
- <YourSuggestion>
18
-
19
- If we need to add a whitespace character to the suggested text, make sure to explicitly add it in.
20
- Refrain from adding <YourSuggestion> tags when responding
21
-
22
- The following external context is also provided. Use it to help you make better suggestions!!!
23
- \`\`\`
24
- ${contextString}
25
- \`\`\`
26
- `;
27
- };
28
- var defaultSuggestionsFewShotMessages = [
29
- new TextMessage({
30
- role: Role.User,
31
- content: "<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>"
32
- }),
33
- new TextMessage({
34
- role: Role.User,
35
- content: "This morning I woke up and went straight to the grocery store."
36
- }),
37
- new TextMessage({
38
- role: Role.Assistant,
39
- content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
40
- }),
41
- new TextMessage({
42
- role: Role.User,
43
- content: "<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>"
44
- }),
45
- new TextMessage({
46
- role: Role.User,
47
- content: `<TextBeforeCursor>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;</TextBeforeCursor>`
48
- }),
49
- new TextMessage({
50
- role: Role.Assistant,
51
- 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"; `
52
- })
53
- ];
54
- var defaultSuggestionsApiConfig = {
55
- makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,
56
- fewShotMessages: defaultSuggestionsFewShotMessages
57
- };
58
-
59
- export {
60
- defaultSuggestionsMakeSystemPrompt,
61
- defaultSuggestionsFewShotMessages,
62
- defaultSuggestionsApiConfig
63
- };
64
- //# sourceMappingURL=chunk-GUZIMGGZ.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/types/autosuggestions-config/suggestions-api-config.tsx"],"sourcesContent":["import { Message, Role, TextMessage } from \"@copilotkit/runtime-client-gql\";\nimport { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\n\nexport interface SuggestionsApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: Message[];\n maxTokens?: number;\n stop?: string[];\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.\nRefrain from adding <YourSuggestion> tags when responding\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: Message[] = [\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content: \"This morning I woke up and went straight to the grocery store.\",\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n \" When I arrived I went straight to the produce section and picked out a big watermelon. \",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n '<TextBeforeCursor>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;</TextBeforeCursor>',\n }),\n new TextMessage({\n role: 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};\n"],"mappings":";AAAA,SAAkB,MAAM,mBAAmB;AAUpC,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;AAAA,EAiBlB;AAAA;AAAA;AAGF;AAEO,IAAM,oCAA+C;AAAA,EAC1D,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SAAS;AAAA,EACX,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AACH;AAEO,IAAM,8BAAoD;AAAA,EAC/D,kBAAkB;AAAA,EAClB,iBAAiB;AACnB;","names":[]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-H4VKQGVU.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}