@copilotkit/react-textarea 0.22.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/.turbo/turbo-build.log +104 -104
  2. package/CHANGELOG.md +33 -0
  3. package/dist/{chunk-WJYQWL4I.mjs → chunk-2C7O2EVM.mjs} +1 -1
  4. package/dist/{chunk-WJYQWL4I.mjs.map → chunk-2C7O2EVM.mjs.map} +1 -1
  5. package/dist/{chunk-KCHYD3EB.mjs → chunk-2CDXHWVF.mjs} +1 -1
  6. package/dist/chunk-2CDXHWVF.mjs.map +1 -0
  7. package/dist/{chunk-GCMQHIRF.mjs → chunk-2QDCE7PD.mjs} +1 -1
  8. package/dist/chunk-2QDCE7PD.mjs.map +1 -0
  9. package/dist/{chunk-ND5PXTAW.mjs → chunk-3PQ7GSFE.mjs} +1 -1
  10. package/dist/chunk-3PQ7GSFE.mjs.map +1 -0
  11. package/dist/{chunk-MRPRZQMN.mjs → chunk-5IISSXS2.mjs} +11 -11
  12. package/dist/chunk-5IISSXS2.mjs.map +1 -0
  13. package/dist/{chunk-RQHOUUXQ.mjs → chunk-5UNJXFUO.mjs} +1 -1
  14. package/dist/{chunk-RQHOUUXQ.mjs.map → chunk-5UNJXFUO.mjs.map} +1 -1
  15. package/dist/{chunk-NZKGYWQV.mjs → chunk-74HF6Q3L.mjs} +26 -27
  16. package/dist/chunk-74HF6Q3L.mjs.map +1 -0
  17. package/dist/{chunk-MPME5BW2.mjs → chunk-7LSRNPNI.mjs} +1 -1
  18. package/dist/chunk-7LSRNPNI.mjs.map +1 -0
  19. package/dist/{chunk-DYGPLRY3.mjs → chunk-7SZDD6XT.mjs} +4 -8
  20. package/dist/chunk-7SZDD6XT.mjs.map +1 -0
  21. package/dist/{chunk-SFEGMBSS.mjs → chunk-7VKOE5UL.mjs} +8 -12
  22. package/dist/chunk-7VKOE5UL.mjs.map +1 -0
  23. package/dist/{chunk-463BFNUP.mjs → chunk-AUCHS4VR.mjs} +2 -2
  24. package/dist/chunk-AUCHS4VR.mjs.map +1 -0
  25. package/dist/{chunk-JAFCXEPU.mjs → chunk-BLRAOGXD.mjs} +2 -2
  26. package/dist/{chunk-JAFCXEPU.mjs.map → chunk-BLRAOGXD.mjs.map} +1 -1
  27. package/dist/{chunk-NO3EYPQH.mjs → chunk-CK7Q3Y5A.mjs} +2 -2
  28. package/dist/{chunk-IXJ2HCOA.mjs → chunk-ECR45NSD.mjs} +1 -1
  29. package/dist/chunk-ECR45NSD.mjs.map +1 -0
  30. package/dist/{chunk-OELUUJZY.mjs → chunk-EZCKXWQF.mjs} +1 -1
  31. package/dist/chunk-EZCKXWQF.mjs.map +1 -0
  32. package/dist/{chunk-KGKLUWKW.mjs → chunk-F626GQCD.mjs} +1 -1
  33. package/dist/chunk-F626GQCD.mjs.map +1 -0
  34. package/dist/{chunk-5EJ5XOGP.mjs → chunk-FK2XUDQQ.mjs} +2 -2
  35. package/dist/chunk-FK2XUDQQ.mjs.map +1 -0
  36. package/dist/chunk-FP2EKU3L.mjs +28 -0
  37. package/dist/chunk-FP2EKU3L.mjs.map +1 -0
  38. package/dist/{chunk-F3MHL6ZY.mjs → chunk-GQN2HYFJ.mjs} +2 -5
  39. package/dist/chunk-GQN2HYFJ.mjs.map +1 -0
  40. package/dist/{chunk-AXN37AHC.mjs → chunk-K5LNB36H.mjs} +1 -1
  41. package/dist/chunk-K5LNB36H.mjs.map +1 -0
  42. package/dist/{chunk-JHTAOLEW.mjs → chunk-KDVMG3XF.mjs} +1 -1
  43. package/dist/chunk-KDVMG3XF.mjs.map +1 -0
  44. package/dist/{chunk-2NURR2DX.mjs → chunk-KMXSZRIA.mjs} +2 -2
  45. package/dist/chunk-KMXSZRIA.mjs.map +1 -0
  46. package/dist/{chunk-4S5ZJH3I.mjs → chunk-KNQIEOFP.mjs} +1 -1
  47. package/dist/{chunk-4S5ZJH3I.mjs.map → chunk-KNQIEOFP.mjs.map} +1 -1
  48. package/dist/{chunk-YQU7WG7T.mjs → chunk-LZ3UOAQ4.mjs} +3 -3
  49. package/dist/chunk-LZ3UOAQ4.mjs.map +1 -0
  50. package/dist/{chunk-NKW5OU2S.mjs → chunk-M2DR4KVB.mjs} +1 -1
  51. package/dist/chunk-M2DR4KVB.mjs.map +1 -0
  52. package/dist/{chunk-F2TIBXML.mjs → chunk-NTLVQENP.mjs} +7 -7
  53. package/dist/chunk-NTLVQENP.mjs.map +1 -0
  54. package/dist/{chunk-O5OWT5GE.mjs → chunk-PDCIGRCE.mjs} +8 -29
  55. package/dist/chunk-PDCIGRCE.mjs.map +1 -0
  56. package/dist/{chunk-YW3REYX6.mjs → chunk-QRKKPCUD.mjs} +2 -4
  57. package/dist/chunk-QRKKPCUD.mjs.map +1 -0
  58. package/dist/{chunk-RR6OQGTI.mjs → chunk-RBR32FWA.mjs} +1 -1
  59. package/dist/chunk-RBR32FWA.mjs.map +1 -0
  60. package/dist/{chunk-YTOPHPSG.mjs → chunk-T6MTDQZ7.mjs} +1 -1
  61. package/dist/chunk-T6MTDQZ7.mjs.map +1 -0
  62. package/dist/{chunk-QJDMIGLU.mjs → chunk-TZLW7PBU.mjs} +9 -12
  63. package/dist/chunk-TZLW7PBU.mjs.map +1 -0
  64. package/dist/{chunk-CSGFJU3L.mjs → chunk-U3LUDDT5.mjs} +2 -2
  65. package/dist/chunk-U3LUDDT5.mjs.map +1 -0
  66. package/dist/{chunk-LNAIMEB2.mjs → chunk-UEQYKC4W.mjs} +1 -1
  67. package/dist/chunk-UEQYKC4W.mjs.map +1 -0
  68. package/dist/{chunk-OD7ZMOVE.mjs → chunk-V55OPCG4.mjs} +2 -2
  69. package/dist/chunk-V55OPCG4.mjs.map +1 -0
  70. package/dist/{chunk-WPIA53HF.mjs → chunk-VYECMH73.mjs} +7 -25
  71. package/dist/chunk-VYECMH73.mjs.map +1 -0
  72. package/dist/{chunk-BYIG72TT.mjs → chunk-W2ZHOUV6.mjs} +5 -5
  73. package/dist/chunk-W2ZHOUV6.mjs.map +1 -0
  74. package/dist/{chunk-UHD44NC5.mjs → chunk-WVRTFPNO.mjs} +10 -20
  75. package/dist/chunk-WVRTFPNO.mjs.map +1 -0
  76. package/dist/{chunk-PGGR6HL5.mjs → chunk-ZEHF3AXH.mjs} +6 -9
  77. package/dist/chunk-ZEHF3AXH.mjs.map +1 -0
  78. package/dist/{chunk-XHUMROEY.mjs → chunk-ZKRM3DIR.mjs} +1 -1
  79. package/dist/chunk-ZKRM3DIR.mjs.map +1 -0
  80. package/dist/{chunk-WLPYYGES.mjs → chunk-ZMNOLW5V.mjs} +6 -16
  81. package/dist/chunk-ZMNOLW5V.mjs.map +1 -0
  82. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +31 -31
  83. package/dist/components/base-copilot-textarea/render-element.mjs +1 -1
  84. package/dist/components/base-copilot-textarea/render-placeholder.mjs +1 -1
  85. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +2 -2
  86. package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +1 -1
  87. package/dist/components/copilot-textarea/copilot-textarea.mjs +40 -40
  88. package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +1 -1
  89. package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +1 -1
  90. package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +1 -1
  91. package/dist/components/hovering-toolbar/hovering-toolbar.mjs +15 -15
  92. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +10 -10
  93. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +11 -11
  94. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +3 -3
  95. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +11 -11
  96. package/dist/components/index.mjs +40 -40
  97. package/dist/components/manual-ui/chip-with-icon.mjs +1 -5
  98. package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -1
  99. package/dist/components/source-search-box/source-search-box.mjs +4 -4
  100. package/dist/components/ui/button.mjs +2 -2
  101. package/dist/components/ui/card.mjs +46 -42
  102. package/dist/components/ui/card.mjs.map +1 -1
  103. package/dist/components/ui/command.mjs +3 -3
  104. package/dist/components/ui/dialog.mjs +2 -2
  105. package/dist/components/ui/label.mjs +2 -2
  106. package/dist/components/ui/separator.mjs +14 -16
  107. package/dist/components/ui/separator.mjs.map +1 -1
  108. package/dist/components/ui/textarea.mjs +1 -1
  109. package/dist/components/ui/textarea.mjs.map +1 -1
  110. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.ts +1 -1
  111. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +4 -4
  112. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +2 -2
  113. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +3 -3
  114. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +1 -1
  115. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +8 -8
  116. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.d.ts +1 -1
  117. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +8 -8
  118. package/dist/hooks/misc/use-autosize-textarea.mjs +1 -1
  119. package/dist/index.mjs +40 -40
  120. package/dist/lib/debouncer.mjs +1 -1
  121. package/dist/lib/editor-to-text.mjs +1 -1
  122. package/dist/lib/get-text-around-cursor.mjs +1 -1
  123. package/dist/lib/retry.mjs +1 -1
  124. package/dist/lib/slatejs-edits/add-autocompletions.mjs +1 -1
  125. package/dist/lib/slatejs-edits/clear-autocompletions.mjs +1 -1
  126. package/dist/lib/slatejs-edits/replace-text.mjs +1 -1
  127. package/dist/lib/slatejs-edits/with-partial-history.mjs +1 -1
  128. package/dist/lib/stream-promise-flatten.mjs +1 -1
  129. package/dist/lib/utils.mjs +1 -1
  130. package/dist/types/autosuggestions-config/autosuggestions-config.d.ts +1 -1
  131. package/dist/types/autosuggestions-config/autosuggestions-config.mjs +5 -5
  132. package/dist/types/autosuggestions-config/editing-api-config.mjs +1 -1
  133. package/dist/types/autosuggestions-config/index.mjs +6 -6
  134. package/dist/types/autosuggestions-config/insertions-api-config.mjs +1 -1
  135. package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.mjs +1 -1
  136. package/dist/types/autosuggestions-config/suggestions-api-config.mjs +1 -1
  137. package/dist/types/base/base-autosuggestions-config.d.ts +55 -2
  138. package/dist/types/base/base-autosuggestions-config.mjs +1 -1
  139. package/dist/types/base/editor-autocomplete-state.mjs +2 -2
  140. package/dist/types/base/index.mjs +1 -1
  141. package/dist/types/index.mjs +6 -6
  142. package/package.json +4 -4
  143. package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +31 -37
  144. package/src/components/base-copilot-textarea/render-element.tsx +3 -5
  145. package/src/components/base-copilot-textarea/render-placeholder.tsx +2 -4
  146. package/src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx +2 -5
  147. package/src/components/base-copilot-textarea/use-add-branding-css.tsx +2 -4
  148. package/src/components/copilot-textarea/copilot-textarea.tsx +12 -19
  149. package/src/components/hovering-toolbar/hovering-editor-provider.tsx +1 -3
  150. package/src/components/hovering-toolbar/hovering-toolbar-components.tsx +14 -31
  151. package/src/components/hovering-toolbar/hovering-toolbar.tsx +4 -16
  152. package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +11 -25
  153. package/src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx +9 -8
  154. package/src/components/manual-ui/chip-with-icon.tsx +3 -12
  155. package/src/components/source-search-box/source-search-box.tsx +2 -12
  156. package/src/components/ui/button.tsx +6 -13
  157. package/src/components/ui/card.tsx +35 -65
  158. package/src/components/ui/command.tsx +8 -21
  159. package/src/components/ui/dialog.tsx +8 -29
  160. package/src/components/ui/label.tsx +3 -8
  161. package/src/components/ui/separator.tsx +13 -18
  162. package/src/components/ui/textarea.tsx +3 -4
  163. package/src/hooks/base-copilot-textarea-implementation/use-autosuggestions.ts +13 -27
  164. package/src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx +1 -5
  165. package/src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts +4 -11
  166. package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +6 -11
  167. package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +16 -36
  168. package/src/hooks/misc/use-autosize-textarea.tsx +1 -4
  169. package/src/lib/debouncer.ts +1 -3
  170. package/src/lib/editor-to-text.ts +4 -7
  171. package/src/lib/get-text-around-cursor.ts +2 -14
  172. package/src/lib/retry.tsx +1 -1
  173. package/src/lib/slatejs-edits/add-autocompletions.ts +2 -2
  174. package/src/lib/slatejs-edits/clear-autocompletions.ts +1 -4
  175. package/src/lib/slatejs-edits/replace-text.ts +1 -1
  176. package/src/lib/slatejs-edits/with-partial-history.ts +4 -11
  177. package/src/lib/stream-promise-flatten.ts +1 -3
  178. package/src/lib/utils.ts +4 -8
  179. package/src/types/autosuggestions-config/autosuggestions-config-user-specified.tsx +3 -7
  180. package/src/types/autosuggestions-config/autosuggestions-config.tsx +9 -21
  181. package/src/types/autosuggestions-config/editing-api-config.tsx +3 -5
  182. package/src/types/autosuggestions-config/insertions-api-config.tsx +2 -3
  183. package/src/types/autosuggestions-config/subtypes/chatlike-api-endpoint.tsx +18 -26
  184. package/src/types/autosuggestions-config/subtypes/make-system-prompt.ts +1 -4
  185. package/src/types/autosuggestions-config/suggestions-api-config.tsx +2 -3
  186. package/src/types/base/autosuggestions-bare-function.ts +2 -2
  187. package/src/types/base/base-autosuggestions-config.tsx +82 -4
  188. package/src/types/base/editor-autocomplete-state.ts +1 -1
  189. package/dist/chunk-2NURR2DX.mjs.map +0 -1
  190. package/dist/chunk-463BFNUP.mjs.map +0 -1
  191. package/dist/chunk-5EJ5XOGP.mjs.map +0 -1
  192. package/dist/chunk-AXN37AHC.mjs.map +0 -1
  193. package/dist/chunk-BYIG72TT.mjs.map +0 -1
  194. package/dist/chunk-CSGFJU3L.mjs.map +0 -1
  195. package/dist/chunk-DYGPLRY3.mjs.map +0 -1
  196. package/dist/chunk-F2TIBXML.mjs.map +0 -1
  197. package/dist/chunk-F3MHL6ZY.mjs.map +0 -1
  198. package/dist/chunk-GCMQHIRF.mjs.map +0 -1
  199. package/dist/chunk-IXJ2HCOA.mjs.map +0 -1
  200. package/dist/chunk-JHTAOLEW.mjs.map +0 -1
  201. package/dist/chunk-KCHYD3EB.mjs.map +0 -1
  202. package/dist/chunk-KGKLUWKW.mjs.map +0 -1
  203. package/dist/chunk-LNAIMEB2.mjs.map +0 -1
  204. package/dist/chunk-MPME5BW2.mjs.map +0 -1
  205. package/dist/chunk-MRPRZQMN.mjs.map +0 -1
  206. package/dist/chunk-ND5PXTAW.mjs.map +0 -1
  207. package/dist/chunk-NKW5OU2S.mjs.map +0 -1
  208. package/dist/chunk-NZKGYWQV.mjs.map +0 -1
  209. package/dist/chunk-O5OWT5GE.mjs.map +0 -1
  210. package/dist/chunk-OD7ZMOVE.mjs.map +0 -1
  211. package/dist/chunk-OELUUJZY.mjs.map +0 -1
  212. package/dist/chunk-PGGR6HL5.mjs.map +0 -1
  213. package/dist/chunk-QJDMIGLU.mjs.map +0 -1
  214. package/dist/chunk-RR6OQGTI.mjs.map +0 -1
  215. package/dist/chunk-S6JUGJK2.mjs +0 -13
  216. package/dist/chunk-S6JUGJK2.mjs.map +0 -1
  217. package/dist/chunk-SFEGMBSS.mjs.map +0 -1
  218. package/dist/chunk-UHD44NC5.mjs.map +0 -1
  219. package/dist/chunk-WLPYYGES.mjs.map +0 -1
  220. package/dist/chunk-WPIA53HF.mjs.map +0 -1
  221. package/dist/chunk-XHUMROEY.mjs.map +0 -1
  222. package/dist/chunk-YQU7WG7T.mjs.map +0 -1
  223. package/dist/chunk-YTOPHPSG.mjs.map +0 -1
  224. package/dist/chunk-YW3REYX6.mjs.map +0 -1
  225. /package/dist/{chunk-NO3EYPQH.mjs.map → chunk-CK7Q3Y5A.mjs.map} +0 -0
@@ -10,12 +10,9 @@ const buttonVariants = cva(
10
10
  variants: {
11
11
  variant: {
12
12
  default: "bg-primary text-primary-foreground hover:bg-primary/90",
13
- destructive:
14
- "bg-destructive text-destructive-foreground hover:bg-destructive/90",
15
- outline:
16
- "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
17
- secondary:
18
- "bg-secondary text-secondary-foreground hover:bg-secondary/80",
13
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
14
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
15
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
19
16
  ghost: "hover:bg-accent hover:text-accent-foreground",
20
17
  link: "text-primary underline-offset-4 hover:underline",
21
18
  },
@@ -30,7 +27,7 @@ const buttonVariants = cva(
30
27
  variant: "default",
31
28
  size: "default",
32
29
  },
33
- }
30
+ },
34
31
  );
35
32
 
36
33
  export interface ButtonProps
@@ -43,13 +40,9 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
43
40
  ({ className, variant, size, asChild = false, ...props }, ref) => {
44
41
  const Comp = asChild ? Slot : "button";
45
42
  return (
46
- <Comp
47
- className={cn(buttonVariants({ variant, size, className }))}
48
- ref={ref}
49
- {...props}
50
- />
43
+ <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />
51
44
  );
52
- }
45
+ },
53
46
  );
54
47
  Button.displayName = "Button";
55
48
 
@@ -2,85 +2,55 @@ import * as React from "react";
2
2
 
3
3
  import { cn } from "../../lib/utils";
4
4
 
5
- const Card = React.forwardRef<
6
- HTMLDivElement,
7
- React.HTMLAttributes<HTMLDivElement>
8
- >(({ className, ...props }, ref) => (
9
- <div
10
- ref={ref}
11
- className={cn(
12
- "rounded-lg border bg-card text-card-foreground shadow-sm",
13
- className
14
- )}
15
- {...props}
16
- />
17
- ));
5
+ const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
6
+ ({ className, ...props }, ref) => (
7
+ <div
8
+ ref={ref}
9
+ className={cn("rounded-lg border bg-card text-card-foreground shadow-sm", className)}
10
+ {...props}
11
+ />
12
+ ),
13
+ );
18
14
  Card.displayName = "Card";
19
15
 
20
- const CardHeader = React.forwardRef<
21
- HTMLDivElement,
22
- React.HTMLAttributes<HTMLDivElement>
23
- >(({ className, ...props }, ref) => (
24
- <div
25
- ref={ref}
26
- className={cn("flex flex-col space-y-1.5 p-6", className)}
27
- {...props}
28
- />
29
- ));
16
+ const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
17
+ ({ className, ...props }, ref) => (
18
+ <div ref={ref} className={cn("flex flex-col space-y-1.5 p-6", className)} {...props} />
19
+ ),
20
+ );
30
21
  CardHeader.displayName = "CardHeader";
31
22
 
32
- const CardTitle = React.forwardRef<
33
- HTMLParagraphElement,
34
- React.HTMLAttributes<HTMLHeadingElement>
35
- >(({ className, ...props }, ref) => (
36
- <h3
37
- ref={ref}
38
- className={cn(
39
- "text-2xl font-semibold leading-none tracking-tight",
40
- className
41
- )}
42
- {...props}
43
- />
44
- ));
23
+ const CardTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
24
+ ({ className, ...props }, ref) => (
25
+ <h3
26
+ ref={ref}
27
+ className={cn("text-2xl font-semibold leading-none tracking-tight", className)}
28
+ {...props}
29
+ />
30
+ ),
31
+ );
45
32
  CardTitle.displayName = "CardTitle";
46
33
 
47
34
  const CardDescription = React.forwardRef<
48
35
  HTMLParagraphElement,
49
36
  React.HTMLAttributes<HTMLParagraphElement>
50
37
  >(({ className, ...props }, ref) => (
51
- <p
52
- ref={ref}
53
- className={cn("text-sm text-muted-foreground", className)}
54
- {...props}
55
- />
38
+ <p ref={ref} className={cn("text-sm text-muted-foreground", className)} {...props} />
56
39
  ));
57
40
  CardDescription.displayName = "CardDescription";
58
41
 
59
- const CardContent = React.forwardRef<
60
- HTMLDivElement,
61
- React.HTMLAttributes<HTMLDivElement>
62
- >(({ className, ...props }, ref) => (
63
- <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
64
- ));
42
+ const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
43
+ ({ className, ...props }, ref) => (
44
+ <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
45
+ ),
46
+ );
65
47
  CardContent.displayName = "CardContent";
66
48
 
67
- const CardFooter = React.forwardRef<
68
- HTMLDivElement,
69
- React.HTMLAttributes<HTMLDivElement>
70
- >(({ className, ...props }, ref) => (
71
- <div
72
- ref={ref}
73
- className={cn("flex items-center p-6 pt-0", className)}
74
- {...props}
75
- />
76
- ));
49
+ const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
50
+ ({ className, ...props }, ref) => (
51
+ <div ref={ref} className={cn("flex items-center p-6 pt-0", className)} {...props} />
52
+ ),
53
+ );
77
54
  CardFooter.displayName = "CardFooter";
78
55
 
79
- export {
80
- Card,
81
- CardHeader,
82
- CardFooter,
83
- CardTitle,
84
- CardDescription,
85
- CardContent,
86
- };
56
+ export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
@@ -16,7 +16,7 @@ const Command = React.forwardRef<
16
16
  ref={ref}
17
17
  className={cn(
18
18
  "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
19
- className
19
+ className,
20
20
  )}
21
21
  {...props}
22
22
  />
@@ -47,7 +47,7 @@ const CommandInput = React.forwardRef<
47
47
  ref={ref}
48
48
  className={cn(
49
49
  "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
50
- className
50
+ className,
51
51
  )}
52
52
  {...props}
53
53
  />
@@ -62,10 +62,7 @@ const CommandList = React.forwardRef<
62
62
  >(({ className, ...props }, ref) => (
63
63
  <CommandPrimitive.List
64
64
  ref={ref}
65
- className={cn(
66
- "max-h-[300px] overflow-y-auto overflow-x-hidden pb-2",
67
- className
68
- )}
65
+ className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden pb-2", className)}
69
66
  {...props}
70
67
  />
71
68
  ));
@@ -76,11 +73,7 @@ const CommandEmpty = React.forwardRef<
76
73
  React.ElementRef<typeof CommandPrimitive.Empty>,
77
74
  React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
78
75
  >((props, ref) => (
79
- <CommandPrimitive.Empty
80
- ref={ref}
81
- className="py-6 text-center text-sm"
82
- {...props}
83
- />
76
+ <CommandPrimitive.Empty ref={ref} className="py-6 text-center text-sm" {...props} />
84
77
  ));
85
78
 
86
79
  CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
@@ -93,7 +86,7 @@ const CommandGroup = React.forwardRef<
93
86
  ref={ref}
94
87
  className={cn(
95
88
  "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
96
- className
89
+ className,
97
90
  )}
98
91
  {...props}
99
92
  />
@@ -121,7 +114,7 @@ const CommandItem = React.forwardRef<
121
114
  ref={ref}
122
115
  className={cn(
123
116
  "relative flex cursor-default select-none items-center rounded-sm text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
124
- className
117
+ className,
125
118
  )}
126
119
  {...props}
127
120
  />
@@ -129,16 +122,10 @@ const CommandItem = React.forwardRef<
129
122
 
130
123
  CommandItem.displayName = CommandPrimitive.Item.displayName;
131
124
 
132
- const CommandShortcut = ({
133
- className,
134
- ...props
135
- }: React.HTMLAttributes<HTMLSpanElement>) => {
125
+ const CommandShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
136
126
  return (
137
127
  <span
138
- className={cn(
139
- "ml-auto text-xs tracking-widest text-muted-foreground",
140
- className
141
- )}
128
+ className={cn("ml-auto text-xs tracking-widest text-muted-foreground", className)}
142
129
  {...props}
143
130
  />
144
131
  );
@@ -10,10 +10,7 @@ const Dialog = DialogPrimitive.Root;
10
10
 
11
11
  const DialogTrigger = DialogPrimitive.Trigger;
12
12
 
13
- const DialogPortal = ({
14
- className,
15
- ...props
16
- }: DialogPrimitive.DialogPortalProps) => (
13
+ const DialogPortal = ({ className, ...props }: DialogPrimitive.DialogPortalProps) => (
17
14
  <DialogPrimitive.Portal className={cn(className)} {...props} />
18
15
  );
19
16
  DialogPortal.displayName = DialogPrimitive.Portal.displayName;
@@ -26,7 +23,7 @@ const DialogOverlay = React.forwardRef<
26
23
  ref={ref}
27
24
  className={cn(
28
25
  "fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
29
- className
26
+ className,
30
27
  )}
31
28
  {...props}
32
29
  />
@@ -43,7 +40,7 @@ const DialogContent = React.forwardRef<
43
40
  ref={ref}
44
41
  className={cn(
45
42
  "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",
46
- className
43
+ className,
47
44
  )}
48
45
  {...props}
49
46
  >
@@ -57,29 +54,14 @@ const DialogContent = React.forwardRef<
57
54
  ));
58
55
  DialogContent.displayName = DialogPrimitive.Content.displayName;
59
56
 
60
- const DialogHeader = ({
61
- className,
62
- ...props
63
- }: React.HTMLAttributes<HTMLDivElement>) => (
64
- <div
65
- className={cn(
66
- "flex flex-col space-y-1.5 text-center sm:text-left",
67
- className
68
- )}
69
- {...props}
70
- />
57
+ const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
58
+ <div className={cn("flex flex-col space-y-1.5 text-center sm:text-left", className)} {...props} />
71
59
  );
72
60
  DialogHeader.displayName = "DialogHeader";
73
61
 
74
- const DialogFooter = ({
75
- className,
76
- ...props
77
- }: React.HTMLAttributes<HTMLDivElement>) => (
62
+ const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
78
63
  <div
79
- className={cn(
80
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
81
- className
82
- )}
64
+ className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
83
65
  {...props}
84
66
  />
85
67
  );
@@ -91,10 +73,7 @@ const DialogTitle = React.forwardRef<
91
73
  >(({ className, ...props }, ref) => (
92
74
  <DialogPrimitive.Title
93
75
  ref={ref}
94
- className={cn(
95
- "text-lg font-semibold leading-none tracking-tight",
96
- className
97
- )}
76
+ className={cn("text-lg font-semibold leading-none tracking-tight", className)}
98
77
  {...props}
99
78
  />
100
79
  ));
@@ -7,19 +7,14 @@ import { cva, type VariantProps } from "class-variance-authority";
7
7
  import { cn } from "../../lib/utils";
8
8
 
9
9
  const labelVariants = cva(
10
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
10
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
11
11
  );
12
12
 
13
13
  const Label = React.forwardRef<
14
14
  React.ElementRef<typeof LabelPrimitive.Root>,
15
- React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
16
- VariantProps<typeof labelVariants>
15
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & VariantProps<typeof labelVariants>
17
16
  >(({ className, ...props }, ref) => (
18
- <LabelPrimitive.Root
19
- ref={ref}
20
- className={cn(labelVariants(), className)}
21
- {...props}
22
- />
17
+ <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />
23
18
  ));
24
19
  Label.displayName = LabelPrimitive.Root.displayName;
25
20
 
@@ -8,24 +8,19 @@ import { cn } from "../../lib/utils";
8
8
  const Separator = React.forwardRef<
9
9
  React.ElementRef<typeof SeparatorPrimitive.Root>,
10
10
  React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
11
- >(
12
- (
13
- { className, orientation = "horizontal", decorative = true, ...props },
14
- ref
15
- ) => (
16
- <SeparatorPrimitive.Root
17
- ref={ref}
18
- decorative={decorative}
19
- orientation={orientation}
20
- className={cn(
21
- "shrink-0 bg-border",
22
- orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
23
- className
24
- )}
25
- {...props}
26
- />
27
- )
28
- );
11
+ >(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => (
12
+ <SeparatorPrimitive.Root
13
+ ref={ref}
14
+ decorative={decorative}
15
+ orientation={orientation}
16
+ className={cn(
17
+ "shrink-0 bg-border",
18
+ orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
19
+ className,
20
+ )}
21
+ {...props}
22
+ />
23
+ ));
29
24
  Separator.displayName = SeparatorPrimitive.Root.displayName;
30
25
 
31
26
  export { Separator };
@@ -2,8 +2,7 @@ import * as React from "react";
2
2
 
3
3
  import { cn } from "../../lib/utils";
4
4
 
5
- export interface TextareaProps
6
- extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
5
+ export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
7
6
 
8
7
  const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
9
8
  ({ className, ...props }, ref) => {
@@ -11,13 +10,13 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
11
10
  <textarea
12
11
  className={cn(
13
12
  "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
14
- className
13
+ className,
15
14
  )}
16
15
  ref={ref}
17
16
  {...props}
18
17
  />
19
18
  );
20
- }
19
+ },
21
20
  );
22
21
  Textarea.displayName = "Textarea";
23
22
 
@@ -16,11 +16,11 @@ export interface UseAutosuggestionsResult {
16
16
 
17
17
  export function useAutosuggestions(
18
18
  debounceTime: number,
19
- acceptAutosuggestionKey: string,
19
+ shouldAcceptAutosuggestionOnKeyPress: (event: React.KeyboardEvent<HTMLDivElement>) => boolean,
20
20
  autosuggestionFunction: AutosuggestionsBareFunction,
21
21
  insertAutocompleteSuggestion: (suggestion: AutosuggestionState) => void,
22
22
  disableWhenEmpty: boolean,
23
- disabled: boolean
23
+ disabled: boolean,
24
24
  ): UseAutosuggestionsResult {
25
25
  const [previousAutocompleteState, setPreviousAutocompleteState] =
26
26
  useState<EditorAutocompleteState | null>(null);
@@ -30,12 +30,9 @@ export function useAutosuggestions(
30
30
 
31
31
  const awaitForAndAppendSuggestion: (
32
32
  editorAutocompleteState: EditorAutocompleteState,
33
- abortSignal: AbortSignal
33
+ abortSignal: AbortSignal,
34
34
  ) => Promise<void> = useCallback(
35
- async (
36
- editorAutocompleteState: EditorAutocompleteState,
37
- abortSignal: AbortSignal
38
- ) => {
35
+ async (editorAutocompleteState: EditorAutocompleteState, abortSignal: AbortSignal) => {
39
36
  // early return if disabled
40
37
  if (disabled) {
41
38
  return;
@@ -50,10 +47,7 @@ export function useAutosuggestions(
50
47
  }
51
48
 
52
49
  // fetch the suggestion
53
- const suggestion = await autosuggestionFunction(
54
- editorAutocompleteState,
55
- abortSignal
56
- );
50
+ const suggestion = await autosuggestionFunction(editorAutocompleteState, abortSignal);
57
51
 
58
52
  // We'll assume for now that the autocomplete function might or might not respect the abort signal.
59
53
  if (!suggestion || abortSignal.aborted) {
@@ -65,20 +59,12 @@ export function useAutosuggestions(
65
59
  point: editorAutocompleteState.cursorPoint,
66
60
  });
67
61
  },
68
- [
69
- autosuggestionFunction,
70
- setCurrentAutocompleteSuggestion,
71
- disableWhenEmpty,
72
- disabled,
73
- ]
62
+ [autosuggestionFunction, setCurrentAutocompleteSuggestion, disableWhenEmpty, disabled],
74
63
  );
75
64
 
76
65
  const debouncedFunction = useMemo(
77
- () =>
78
- new Debouncer<[editorAutocompleteState: EditorAutocompleteState]>(
79
- debounceTime
80
- ),
81
- [debounceTime]
66
+ () => new Debouncer<[editorAutocompleteState: EditorAutocompleteState]>(debounceTime),
67
+ [debounceTime],
82
68
  );
83
69
 
84
70
  // clean current state when unmounting or disabling
@@ -94,7 +80,7 @@ export function useAutosuggestions(
94
80
  const editorStateHasChanged = !nullableCompatibleEqualityCheck(
95
81
  areEqual_autocompleteState,
96
82
  previousAutocompleteState,
97
- newEditorState
83
+ newEditorState,
98
84
  );
99
85
  setPreviousAutocompleteState(newEditorState);
100
86
 
@@ -119,13 +105,13 @@ export function useAutosuggestions(
119
105
  debouncedFunction,
120
106
  awaitForAndAppendSuggestion,
121
107
  setCurrentAutocompleteSuggestion,
122
- ]
108
+ ],
123
109
  );
124
110
 
125
111
  const keyDownHandler = useCallback(
126
112
  (event: React.KeyboardEvent<HTMLDivElement>) => {
127
113
  if (currentAutocompleteSuggestion) {
128
- if (event.key === acceptAutosuggestionKey) {
114
+ if (shouldAcceptAutosuggestionOnKeyPress(event)) {
129
115
  event.preventDefault();
130
116
  insertAutocompleteSuggestion(currentAutocompleteSuggestion);
131
117
  setCurrentAutocompleteSuggestion(null);
@@ -136,8 +122,8 @@ export function useAutosuggestions(
136
122
  currentAutocompleteSuggestion,
137
123
  setCurrentAutocompleteSuggestion,
138
124
  insertAutocompleteSuggestion,
139
- acceptAutosuggestionKey,
140
- ]
125
+ shouldAcceptAutosuggestionOnKeyPress,
126
+ ],
141
127
  );
142
128
 
143
129
  return {
@@ -35,11 +35,7 @@ const shouldSave: ShouldSaveToHistory = (op, prev) => {
35
35
  return false;
36
36
  }
37
37
 
38
- if (
39
- op.type == "set_node" &&
40
- "type" in op.properties &&
41
- op.properties.type === excludedNodeType
42
- ) {
38
+ if (op.type == "set_node" && "type" in op.properties && op.properties.type === excludedNodeType) {
43
39
  return false;
44
40
  }
45
41
 
@@ -8,16 +8,13 @@ import { CustomEditor } from "../../types/base/custom-editor";
8
8
 
9
9
  export function usePopulateCopilotTextareaRef(
10
10
  editor: Editor,
11
- ref: React.Ref<HTMLCopilotTextAreaElement>
11
+ ref: React.Ref<HTMLCopilotTextAreaElement>,
12
12
  ) {
13
13
  React.useImperativeHandle(
14
14
  ref,
15
15
  () => {
16
16
  class Combined {
17
- constructor(
18
- private customMethods: CustomMethods,
19
- private editorHtmlElement: HTMLElement
20
- ) {}
17
+ constructor(private customMethods: CustomMethods, private editorHtmlElement: HTMLElement) {}
21
18
 
22
19
  [key: string]: any;
23
20
 
@@ -62,11 +59,7 @@ export function usePopulateCopilotTextareaRef(
62
59
  get(target: any, propKey: keyof CustomMethods | keyof HTMLElement) {
63
60
  return target.get(target, propKey);
64
61
  },
65
- set(
66
- target: any,
67
- propKey: keyof CustomMethods | keyof HTMLElement,
68
- value: any
69
- ) {
62
+ set(target: any, propKey: keyof CustomMethods | keyof HTMLElement, value: any) {
70
63
  return target.set(target, propKey, value);
71
64
  },
72
65
  };
@@ -96,6 +89,6 @@ export function usePopulateCopilotTextareaRef(
96
89
  const combined = new Combined(customMethods, editorHtmlElement);
97
90
  return new Proxy(combined, handler);
98
91
  },
99
- [editor]
92
+ [editor],
100
93
  );
101
94
  }
@@ -23,8 +23,8 @@ import { SuggestionsApiConfig } from "../../types/autosuggestions-config/suggest
23
23
  */
24
24
  export function useMakeStandardAutosuggestionFunction(
25
25
  textareaPurpose: string,
26
- contextCategories: string[] | undefined,
27
- apiConfig: SuggestionsApiConfig
26
+ contextCategories: string[],
27
+ apiConfig: SuggestionsApiConfig,
28
28
  ): AutosuggestionsBareFunction {
29
29
  const { getContextString, copilotApiConfig } = useContext(CopilotContext);
30
30
 
@@ -36,7 +36,7 @@ export function useMakeStandardAutosuggestionFunction(
36
36
  role: "system",
37
37
  content: apiConfig.makeSystemPrompt(
38
38
  textareaPurpose,
39
- getContextString([], contextCategories)
39
+ getContextString([], contextCategories),
40
40
  ),
41
41
  },
42
42
  ...apiConfig.fewShotMessages,
@@ -52,13 +52,8 @@ export function useMakeStandardAutosuggestionFunction(
52
52
  },
53
53
  ];
54
54
 
55
- const apiEndpoint =
56
- ChatlikeApiEndpoint.fromCopilotApiConfig(copilotApiConfig);
57
- const stream = await apiEndpoint.run(
58
- abortSignal,
59
- messages,
60
- apiConfig.forwardedParams
61
- );
55
+ const apiEndpoint = ChatlikeApiEndpoint.fromCopilotApiConfig(copilotApiConfig);
56
+ const stream = await apiEndpoint.run(abortSignal, messages, apiConfig.forwardedParams);
62
57
 
63
58
  // read the stream:
64
59
  const reader = stream.getReader();
@@ -77,6 +72,6 @@ export function useMakeStandardAutosuggestionFunction(
77
72
 
78
73
  return res;
79
74
  },
80
- [apiConfig, getContextString, contextCategories, textareaPurpose]
75
+ [apiConfig, getContextString, contextCategories, textareaPurpose],
81
76
  );
82
77
  }