@copilotkit/react-textarea 0.35.0-function-calling-fixes.1 → 0.35.0-mme-cloud.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,28 +1,16 @@
1
1
  # ui
2
2
 
3
- ## 0.35.0-function-calling-fixes.1
3
+ ## 0.35.0-mme-cloud.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - gpt-4-turbo-april-2024 function calling fixes
7
+ - Support input guardrails (cloud)
8
8
 
9
9
  ### Patch Changes
10
10
 
11
11
  - Updated dependencies
12
- - @copilotkit/react-core@0.25.0-function-calling-fixes.1
13
- - @copilotkit/shared@0.9.0-function-calling-fixes.1
14
-
15
- ## 0.35.0-alpha.0
16
-
17
- ### Minor Changes
18
-
19
- - gpt-4-turbo-april-2024
20
-
21
- ### Patch Changes
22
-
23
- - Updated dependencies
24
- - @copilotkit/shared@0.9.0-alpha.0
25
- - @copilotkit/react-core@0.25.0-alpha.0
12
+ - @copilotkit/react-core@0.25.0-mme-cloud.0
13
+ - @copilotkit/shared@0.9.0-mme-cloud.0
26
14
 
27
15
  ## 0.34.0
28
16
 
@@ -86,4 +86,4 @@ function usePopulateCopilotTextareaRef(editor, ref) {
86
86
  export {
87
87
  usePopulateCopilotTextareaRef
88
88
  };
89
- //# sourceMappingURL=chunk-VPEH6V7T.mjs.map
89
+ //# sourceMappingURL=chunk-FMQG2ZM3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts"],"sourcesContent":["import React from \"react\";\nimport { Editor } from \"slate\";\nimport { ReactEditor } from \"slate-react\";\nimport { getFullEditorTextWithNewlines } from \"../../lib/get-text-around-cursor\";\nimport { replaceEditorText } from \"../../lib/slatejs-edits/replace-text\";\nimport { HTMLCopilotTextAreaElement } from \"../../types\";\nimport { CustomEditor } from \"../../types/base/custom-editor\";\n\nexport function usePopulateCopilotTextareaRef(\n editor: Editor,\n ref: React.Ref<HTMLCopilotTextAreaElement>,\n) {\n React.useImperativeHandle(\n ref,\n () => {\n class Combined {\n constructor(\n private customMethods: CustomMethods,\n private editorHtmlElement: HTMLElement,\n ) {}\n\n [key: string]: any;\n\n get(target: any, propKey: string): any {\n if (this.isKeyOfCustomMethods(propKey)) {\n const value = this.customMethods[propKey];\n if (typeof value === \"function\") {\n return value.bind(this.customMethods);\n }\n return value;\n } else if (this.isKeyOfHTMLElement(propKey)) {\n const value = this.editorHtmlElement[propKey];\n if (typeof value === \"function\") {\n return value.bind(this.editorHtmlElement);\n }\n return value;\n }\n }\n\n set(target: any, propKey: string, value: any): boolean {\n if (this.isKeyOfCustomMethods(propKey)) {\n (this.customMethods as any)[propKey] = value;\n } else if (this.isKeyOfHTMLElement(propKey)) {\n (this.editorHtmlElement as any)[propKey] = value;\n } else {\n // Default behavior (optional)\n target[propKey] = value;\n }\n return true;\n }\n\n private isKeyOfCustomMethods(key: string): key is keyof CustomMethods {\n return key in this.customMethods;\n }\n\n private isKeyOfHTMLElement(key: string): key is keyof HTMLElement {\n return key in this.editorHtmlElement;\n }\n }\n\n const handler = {\n get(target: any, propKey: keyof CustomMethods | keyof HTMLElement) {\n return target.get(target, propKey);\n },\n set(target: any, propKey: keyof CustomMethods | keyof HTMLElement, value: any) {\n return target.set(target, propKey, value);\n },\n };\n\n class CustomMethods {\n constructor(private editor: CustomEditor) {}\n\n focus() {\n ReactEditor.focus(this.editor);\n }\n\n blur() {\n ReactEditor.blur(this.editor);\n }\n\n get value() {\n return getFullEditorTextWithNewlines(this.editor);\n }\n set value(value: string) {\n replaceEditorText(this.editor, value);\n }\n }\n\n const editorHtmlElement = ReactEditor.toDOMNode(editor, editor);\n const customMethods = new CustomMethods(editor);\n\n const combined = new Combined(customMethods, editorHtmlElement);\n return new Proxy(combined, handler);\n },\n [editor],\n );\n}\n"],"mappings":";;;;;;;;AAAA,OAAO,WAAW;AAElB,SAAS,mBA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,SAAsB;AAAtB,wBAAAA;AAAA,QAAuB;AAAA,QAE3C,QAAQ;AACN,sBAAY,MAAM,KAAK,MAAM;AAAA,QAC/B;AAAA,QAEA,OAAO;AACL,sBAAY,KAAK,KAAK,MAAM;AAAA,QAC9B;AAAA,QAEA,IAAI,QAAQ;AACV,iBAAO,8BAA8B,KAAK,MAAM;AAAA,QAClD;AAAA,QACA,IAAI,MAAM,OAAe;AACvB,4BAAkB,KAAK,QAAQ,KAAK;AAAA,QACtC;AAAA,MACF;AAEA,YAAM,oBAAoB,YAAY,UAAU,QAAQ,MAAM;AAC9D,YAAM,gBAAgB,IAAI,cAAc,MAAM;AAE9C,YAAM,WAAW,IAAI,SAAS,eAAe,iBAAiB;AAC9D,aAAO,IAAI,MAAM,UAAU,OAAO;AAAA,IACpC;AAAA,IACA,CAAC,MAAM;AAAA,EACT;AACF;","names":["customMethods","editorHtmlElement","editor"]}
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-DKE57EAC.mjs";
10
10
  import {
11
11
  BaseCopilotTextarea
12
- } from "./chunk-22TYLEZZ.mjs";
12
+ } from "./chunk-XU5Z5BWV.mjs";
13
13
  import {
14
14
  __objRest,
15
15
  __spreadProps,
@@ -57,4 +57,4 @@ var CopilotTextarea = React.forwardRef(
57
57
  export {
58
58
  CopilotTextarea
59
59
  };
60
- //# sourceMappingURL=chunk-SP5HFO3H.mjs.map
60
+ //# sourceMappingURL=chunk-HWM2CVKO.mjs.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-DRV2FOHZ.mjs";
4
4
  import {
5
5
  usePopulateCopilotTextareaRef
6
- } from "./chunk-VPEH6V7T.mjs";
6
+ } from "./chunk-FMQG2ZM3.mjs";
7
7
  import {
8
8
  addAutocompletionsToEditor
9
9
  } from "./chunk-2C7O2EVM.mjs";
@@ -256,4 +256,4 @@ function makeSemiFakeReactTextAreaEvent(currentText) {
256
256
  export {
257
257
  BaseCopilotTextarea
258
258
  };
259
- //# sourceMappingURL=chunk-22TYLEZZ.mjs.map
259
+ //# sourceMappingURL=chunk-XU5Z5BWV.mjs.map