@copilotkit/react-textarea 0.27.0-alpha.3 → 0.27.0-alpha.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.
- package/.turbo/turbo-build.log +153 -154
- package/CHANGELOG.md +26 -8
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +1745 -35
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-element.mjs +51 -3
- package/dist/components/base-copilot-textarea/render-element.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.mjs +49 -3
- package/dist/components/base-copilot-textarea/render-placeholder.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +86 -4
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +57 -3
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.mjs +2192 -47
- package/dist/components/copilot-textarea/copilot-textarea.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +17 -3
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +137 -3
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +875 -18
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +558 -12
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +581 -13
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +102 -5
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +581 -14
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +1 -1
- package/dist/components/index.mjs +2193 -48
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/manual-ui/chip-with-icon.mjs +5 -6
- package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -1
- package/dist/components/source-search-box/source-search-box.mjs +211 -6
- package/dist/components/source-search-box/source-search-box.mjs.map +1 -1
- package/dist/components/ui/button.mjs +85 -4
- package/dist/components/ui/button.mjs.map +1 -1
- package/dist/components/ui/card.mjs +53 -7
- package/dist/components/ui/card.mjs.map +1 -1
- package/dist/components/ui/command.mjs +244 -5
- package/dist/components/ui/command.mjs.map +1 -1
- package/dist/components/ui/dialog.mjs +144 -4
- package/dist/components/ui/dialog.mjs.map +1 -1
- package/dist/components/ui/label.mjs +60 -4
- package/dist/components/ui/label.mjs.map +1 -1
- package/dist/components/ui/separator.mjs +50 -8
- package/dist/components/ui/separator.mjs.map +1 -1
- package/dist/components/ui/textarea.mjs +48 -7
- package/dist/components/ui/textarea.mjs.map +1 -1
- package/dist/context/index.mjs +0 -2
- package/dist/context/index.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +158 -6
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +168 -4
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +148 -5
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map +1 -1
- package/dist/hooks/index.mjs +0 -2
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +114 -14
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +166 -14
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs.map +1 -1
- package/dist/hooks/misc/use-autosize-textarea.mjs +15 -3
- package/dist/hooks/misc/use-autosize-textarea.mjs.map +1 -1
- package/dist/index.css +0 -3
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +2195 -50
- package/dist/index.mjs.map +1 -1
- package/dist/lib/debouncer.mjs +51 -3
- package/dist/lib/debouncer.mjs.map +1 -1
- package/dist/lib/editor-to-text.mjs +43 -3
- package/dist/lib/editor-to-text.mjs.map +1 -1
- package/dist/lib/get-text-around-cursor.mjs +102 -3
- package/dist/lib/get-text-around-cursor.mjs.map +1 -1
- package/dist/lib/retry.mjs +17 -3
- package/dist/lib/retry.mjs.map +1 -1
- package/dist/lib/slatejs-edits/add-autocompletions.mjs +25 -3
- package/dist/lib/slatejs-edits/add-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs +20 -3
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/replace-text.mjs +27 -3
- package/dist/lib/slatejs-edits/replace-text.mjs.map +1 -1
- package/dist/lib/slatejs-edits/with-partial-history.mjs +106 -3
- package/dist/lib/slatejs-edits/with-partial-history.mjs.map +1 -1
- package/dist/lib/stream-promise-flatten.mjs +47 -3
- package/dist/lib/stream-promise-flatten.mjs.map +1 -1
- package/dist/lib/utils.mjs +71 -3
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/lib/utils.test.mjs +0 -1
- package/dist/lib/utils.test.mjs.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs +0 -2
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +274 -8
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.mjs +87 -3
- package/dist/types/autosuggestions-config/editing-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/index.d.ts +0 -1
- package/dist/types/autosuggestions-config/index.mjs +274 -10
- package/dist/types/autosuggestions-config/index.mjs.map +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.mjs +78 -3
- package/dist/types/autosuggestions-config/insertions-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs +0 -2
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs +0 -2
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs.map +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs +64 -3
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs.map +1 -1
- package/dist/types/base/autosuggestion-state.mjs +0 -2
- package/dist/types/base/autosuggestion-state.mjs.map +1 -1
- package/dist/types/base/autosuggestions-bare-function.mjs +0 -2
- package/dist/types/base/autosuggestions-bare-function.mjs.map +1 -1
- package/dist/types/base/base-autosuggestions-config.mjs +26 -3
- package/dist/types/base/base-autosuggestions-config.mjs.map +1 -1
- package/dist/types/base/base-copilot-textarea-props.mjs +0 -2
- package/dist/types/base/base-copilot-textarea-props.mjs.map +1 -1
- package/dist/types/base/custom-editor.mjs +0 -2
- package/dist/types/base/custom-editor.mjs.map +1 -1
- package/dist/types/base/editor-autocomplete-state.mjs +17 -4
- package/dist/types/base/editor-autocomplete-state.mjs.map +1 -1
- package/dist/types/base/index.mjs +26 -4
- package/dist/types/base/index.mjs.map +1 -1
- package/dist/types/html-copilot-textarea-element.mjs +0 -2
- package/dist/types/html-copilot-textarea-element.mjs.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.mjs +275 -12
- package/dist/types/index.mjs.map +1 -1
- package/package.json +2 -3
- package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +15 -9
- package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +22 -6
- package/src/types/autosuggestions-config/autosuggestions-config-user-specified.tsx +1 -1
- package/src/types/autosuggestions-config/autosuggestions-config.tsx +0 -1
- package/src/types/autosuggestions-config/editing-api-config.tsx +22 -17
- package/src/types/autosuggestions-config/index.ts +0 -2
- package/src/types/autosuggestions-config/insertions-api-config.tsx +11 -6
- package/dist/chunk-224UKA7C.mjs +0 -33
- package/dist/chunk-224UKA7C.mjs.map +0 -1
- package/dist/chunk-22SLIB4K.mjs +0 -46
- package/dist/chunk-22SLIB4K.mjs.map +0 -1
- package/dist/chunk-2C7O2EVM.mjs +0 -27
- package/dist/chunk-2C7O2EVM.mjs.map +0 -1
- package/dist/chunk-2QDCE7PD.mjs +0 -29
- package/dist/chunk-2QDCE7PD.mjs.map +0 -1
- package/dist/chunk-3PQ7GSFE.mjs +0 -17
- package/dist/chunk-3PQ7GSFE.mjs.map +0 -1
- package/dist/chunk-47L4PLG4.mjs +0 -45
- package/dist/chunk-47L4PLG4.mjs.map +0 -1
- package/dist/chunk-4NHVQZ67.mjs +0 -107
- package/dist/chunk-4NHVQZ67.mjs.map +0 -1
- package/dist/chunk-5FO6ISW4.mjs +0 -3
- package/dist/chunk-5FO6ISW4.mjs.map +0 -1
- package/dist/chunk-5UNJXFUO.mjs +0 -29
- package/dist/chunk-5UNJXFUO.mjs.map +0 -1
- package/dist/chunk-5ZCVCVRZ.mjs +0 -19
- package/dist/chunk-5ZCVCVRZ.mjs.map +0 -1
- package/dist/chunk-6TZ6V3QI.mjs +0 -217
- package/dist/chunk-6TZ6V3QI.mjs.map +0 -1
- package/dist/chunk-72P3KOHZ.mjs +0 -91
- package/dist/chunk-72P3KOHZ.mjs.map +0 -1
- package/dist/chunk-7LSRNPNI.mjs +0 -59
- package/dist/chunk-7LSRNPNI.mjs.map +0 -1
- package/dist/chunk-7SUZ6CXM.mjs +0 -47
- package/dist/chunk-7SUZ6CXM.mjs.map +0 -1
- package/dist/chunk-COUN55HQ.mjs +0 -53
- package/dist/chunk-COUN55HQ.mjs.map +0 -1
- package/dist/chunk-DE5K76I2.mjs +0 -3
- package/dist/chunk-DE5K76I2.mjs.map +0 -1
- package/dist/chunk-DRV2FOHZ.mjs +0 -65
- package/dist/chunk-DRV2FOHZ.mjs.map +0 -1
- package/dist/chunk-ECR45NSD.mjs +0 -101
- package/dist/chunk-ECR45NSD.mjs.map +0 -1
- package/dist/chunk-EPBVNDKE.mjs +0 -46
- package/dist/chunk-EPBVNDKE.mjs.map +0 -1
- package/dist/chunk-FJNUPSQK.mjs +0 -72
- package/dist/chunk-FJNUPSQK.mjs.map +0 -1
- package/dist/chunk-FP2EKU3L.mjs +0 -28
- package/dist/chunk-FP2EKU3L.mjs.map +0 -1
- package/dist/chunk-GQN2HYFJ.mjs +0 -22
- package/dist/chunk-GQN2HYFJ.mjs.map +0 -1
- package/dist/chunk-H4VKQGVU.mjs +0 -3
- package/dist/chunk-H4VKQGVU.mjs.map +0 -1
- package/dist/chunk-HSCZA5TS.mjs +0 -27
- package/dist/chunk-HSCZA5TS.mjs.map +0 -1
- package/dist/chunk-IU3WTXLQ.mjs +0 -3
- package/dist/chunk-IU3WTXLQ.mjs.map +0 -1
- package/dist/chunk-JJLQVT7S.mjs +0 -10
- package/dist/chunk-JJLQVT7S.mjs.map +0 -1
- package/dist/chunk-K5LNB36H.mjs +0 -80
- package/dist/chunk-K5LNB36H.mjs.map +0 -1
- package/dist/chunk-KDVMG3XF.mjs +0 -63
- package/dist/chunk-KDVMG3XF.mjs.map +0 -1
- package/dist/chunk-KFQZHRPJ.mjs +0 -19
- package/dist/chunk-KFQZHRPJ.mjs.map +0 -1
- package/dist/chunk-KNQIEOFP.mjs +0 -18
- package/dist/chunk-KNQIEOFP.mjs.map +0 -1
- package/dist/chunk-KTTN5H7S.mjs +0 -202
- package/dist/chunk-KTTN5H7S.mjs.map +0 -1
- package/dist/chunk-L7VVZH4Q.mjs +0 -3
- package/dist/chunk-L7VVZH4Q.mjs.map +0 -1
- package/dist/chunk-LQZBI6XD.mjs +0 -112
- package/dist/chunk-LQZBI6XD.mjs.map +0 -1
- package/dist/chunk-M2DR4KVB.mjs +0 -33
- package/dist/chunk-M2DR4KVB.mjs.map +0 -1
- package/dist/chunk-MMVDU6DF.mjs +0 -3
- package/dist/chunk-MMVDU6DF.mjs.map +0 -1
- package/dist/chunk-MRXNTQOX.mjs +0 -55
- package/dist/chunk-MRXNTQOX.mjs.map +0 -1
- package/dist/chunk-OHO4G6DR.mjs +0 -19
- package/dist/chunk-OHO4G6DR.mjs.map +0 -1
- package/dist/chunk-P4QVFRLY.mjs +0 -103
- package/dist/chunk-P4QVFRLY.mjs.map +0 -1
- package/dist/chunk-PTZVE6NC.mjs +0 -94
- package/dist/chunk-PTZVE6NC.mjs.map +0 -1
- package/dist/chunk-QDFAIRQF.mjs +0 -45
- package/dist/chunk-QDFAIRQF.mjs.map +0 -1
- package/dist/chunk-RBR32FWA.mjs +0 -74
- package/dist/chunk-RBR32FWA.mjs.map +0 -1
- package/dist/chunk-SBV2KVF5.mjs +0 -99
- package/dist/chunk-SBV2KVF5.mjs.map +0 -1
- package/dist/chunk-T6MTDQZ7.mjs +0 -45
- package/dist/chunk-T6MTDQZ7.mjs.map +0 -1
- package/dist/chunk-VPEH6V7T.mjs +0 -83
- package/dist/chunk-VPEH6V7T.mjs.map +0 -1
- package/dist/chunk-WADHCMPK.mjs +0 -3
- package/dist/chunk-WADHCMPK.mjs.map +0 -1
- package/dist/chunk-WFTAAA7R.mjs +0 -44
- package/dist/chunk-WFTAAA7R.mjs.map +0 -1
- package/dist/chunk-WJHSY5T6.mjs +0 -3
- package/dist/chunk-WJHSY5T6.mjs.map +0 -1
- package/dist/chunk-WTASPE2W.mjs +0 -105
- package/dist/chunk-WTASPE2W.mjs.map +0 -1
- package/dist/chunk-XV7MLLXQ.mjs +0 -18
- package/dist/chunk-XV7MLLXQ.mjs.map +0 -1
- package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.d.ts +0 -27
- package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.mjs +0 -4
- package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.mjs.map +0 -1
- package/src/types/autosuggestions-config/subtypes/chatlike-api-endpoint.tsx +0 -69
package/dist/chunk-PTZVE6NC.mjs
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { cn } from './chunk-7SUZ6CXM.mjs';
|
|
2
|
-
import { __objRest, __spreadValues, __spreadProps } from './chunk-MRXNTQOX.mjs';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
5
|
-
import { X } from 'lucide-react';
|
|
6
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
var Dialog = DialogPrimitive.Root;
|
|
9
|
-
var DialogTrigger = DialogPrimitive.Trigger;
|
|
10
|
-
var DialogPortal = (_a) => {
|
|
11
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
12
|
-
return /* @__PURE__ */ jsx(DialogPrimitive.Portal, __spreadValues({ className: cn(className) }, props));
|
|
13
|
-
};
|
|
14
|
-
DialogPortal.displayName = DialogPrimitive.Portal.displayName;
|
|
15
|
-
var DialogOverlay = React.forwardRef((_a, ref) => {
|
|
16
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
17
|
-
return /* @__PURE__ */ jsx(
|
|
18
|
-
DialogPrimitive.Overlay,
|
|
19
|
-
__spreadValues({
|
|
20
|
-
ref,
|
|
21
|
-
className: cn(
|
|
22
|
-
"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",
|
|
23
|
-
className
|
|
24
|
-
)
|
|
25
|
-
}, props)
|
|
26
|
-
);
|
|
27
|
-
});
|
|
28
|
-
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
29
|
-
var DialogContent = React.forwardRef((_a, ref) => {
|
|
30
|
-
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
31
|
-
return /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
32
|
-
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
33
|
-
/* @__PURE__ */ jsxs(
|
|
34
|
-
DialogPrimitive.Content,
|
|
35
|
-
__spreadProps(__spreadValues({
|
|
36
|
-
ref,
|
|
37
|
-
className: cn(
|
|
38
|
-
"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",
|
|
39
|
-
className
|
|
40
|
-
)
|
|
41
|
-
}, props), {
|
|
42
|
-
children: [
|
|
43
|
-
children,
|
|
44
|
-
/* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
45
|
-
/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
|
|
46
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
47
|
-
] })
|
|
48
|
-
]
|
|
49
|
-
})
|
|
50
|
-
)
|
|
51
|
-
] });
|
|
52
|
-
});
|
|
53
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
54
|
-
var DialogHeader = (_a) => {
|
|
55
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
56
|
-
return /* @__PURE__ */ jsx("div", __spreadValues({ className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className) }, props));
|
|
57
|
-
};
|
|
58
|
-
DialogHeader.displayName = "DialogHeader";
|
|
59
|
-
var DialogFooter = (_a) => {
|
|
60
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
61
|
-
return /* @__PURE__ */ jsx(
|
|
62
|
-
"div",
|
|
63
|
-
__spreadValues({
|
|
64
|
-
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)
|
|
65
|
-
}, props)
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
DialogFooter.displayName = "DialogFooter";
|
|
69
|
-
var DialogTitle = React.forwardRef((_a, ref) => {
|
|
70
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
71
|
-
return /* @__PURE__ */ jsx(
|
|
72
|
-
DialogPrimitive.Title,
|
|
73
|
-
__spreadValues({
|
|
74
|
-
ref,
|
|
75
|
-
className: cn("text-lg font-semibold leading-none tracking-tight", className)
|
|
76
|
-
}, props)
|
|
77
|
-
);
|
|
78
|
-
});
|
|
79
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
80
|
-
var DialogDescription = React.forwardRef((_a, ref) => {
|
|
81
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
82
|
-
return /* @__PURE__ */ jsx(
|
|
83
|
-
DialogPrimitive.Description,
|
|
84
|
-
__spreadValues({
|
|
85
|
-
ref,
|
|
86
|
-
className: cn("text-sm text-muted-foreground", className)
|
|
87
|
-
}, props)
|
|
88
|
-
);
|
|
89
|
-
});
|
|
90
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
91
|
-
|
|
92
|
-
export { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger };
|
|
93
|
-
//# sourceMappingURL=out.js.map
|
|
94
|
-
//# sourceMappingURL=chunk-PTZVE6NC.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ui/dialog.tsx"],"names":[],"mappings":";;;;;;;;;;AAEA,YAAY,WAAW;AACvB,YAAY,qBAAqB;AACjC,SAAS,SAAS;AAShB,cAkCI,YAlCJ;AALF,IAAM,SAAyB;AAE/B,IAAM,gBAAgC;AAEtC,IAAM,eAAe,CAAC,OAA4D;AAA5D,eAAE,YAZxB,IAYsB,IAAgB,kBAAhB,IAAgB,CAAd;AACtB,6BAAiB,wBAAhB,iBAAuB,WAAW,GAAG,SAAS,KAAO,MAAO;AAAA;AAE/D,aAAa,cAA8B,uBAAO;AAElD,IAAM,gBAAsB,iBAG1B,CAAC,IAAyB,QAAK;AAA9B,eAAE,YApBL,IAoBG,IAAgB,kBAAhB,IAAgB,CAAd;AACH;AAAA,IAAiB;AAAA,IAAhB;AAAA,MACC;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,OACI;AAAA,EACN;AAAA,CACD;AACD,cAAc,cAA8B,wBAAQ;AAEpD,IAAM,gBAAsB,iBAG1B,CAAC,IAAmC,QAAK;AAAxC,eAAE,aAAW,SAnChB,IAmCG,IAA0B,kBAA1B,IAA0B,CAAxB,aAAW;AACd,8BAAC,gBACC;AAAA,wBAAC,iBAAc;AAAA,IACf;AAAA,MAAiB;AAAA,MAAhB;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA;AAAA,QACF;AAAA,SACI,QANL;AAAA,QAQE;AAAA;AAAA,UACD,qBAAiB,uBAAhB,EAAsB,WAAU,iRAC/B;AAAA,gCAAC,KAAE,WAAU,WAAU;AAAA,YACvB,oBAAC,UAAK,WAAU,WAAU,mBAAK;AAAA,aACjC;AAAA;AAAA;AAAA,IACF;AAAA,KACF;AAAA,CACD;AACD,cAAc,cAA8B,wBAAQ;AAEpD,IAAM,eAAe,CAAC,OAA+D;AAA/D,eAAE,YAxDxB,IAwDsB,IAAgB,kBAAhB,IAAgB,CAAd;AACtB,6BAAC,wBAAI,WAAW,GAAG,sDAAsD,SAAS,KAAO,MAAO;AAAA;AAElG,aAAa,cAAc;AAE3B,IAAM,eAAe,CAAC,OAA+D;AAA/D,eAAE,YA7DxB,IA6DsB,IAAgB,kBAAhB,IAAgB,CAAd;AACtB;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,iEAAiE,SAAS;AAAA,OACpF;AAAA,EACN;AAAA;AAEF,aAAa,cAAc;AAE3B,IAAM,cAAoB,iBAGxB,CAAC,IAAyB,QAAK;AAA9B,eAAE,YAxEL,IAwEG,IAAgB,kBAAhB,IAAgB,CAAd;AACH;AAAA,IAAiB;AAAA,IAAhB;AAAA,MACC;AAAA,MACA,WAAW,GAAG,qDAAqD,SAAS;AAAA,OACxE;AAAA,EACN;AAAA,CACD;AACD,YAAY,cAA8B,sBAAM;AAEhD,IAAM,oBAA0B,iBAG9B,CAAC,IAAyB,QAAK;AAA9B,eAAE,YApFL,IAoFG,IAAgB,kBAAhB,IAAgB,CAAd;AACH;AAAA,IAAiB;AAAA,IAAhB;AAAA,MACC;AAAA,MACA,WAAW,GAAG,iCAAiC,SAAS;AAAA,OACpD;AAAA,EACN;AAAA,CACD;AACD,kBAAkB,cAA8B,4BAAY","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { X } from \"lucide-react\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst Dialog = DialogPrimitive.Root;\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = ({ className, ...props }: DialogPrimitive.DialogPortalProps) => (\n <DialogPrimitive.Portal className={cn(className)} {...props} />\n);\nDialogPortal.displayName = DialogPrimitive.Portal.displayName;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n \"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\",\n className,\n )}\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n \"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\",\n className,\n )}\n {...props}\n >\n {children}\n <DialogPrimitive.Close className=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground\">\n <X className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n </DialogPrimitive.Content>\n </DialogPortal>\n));\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div className={cn(\"flex flex-col space-y-1.5 text-center sm:text-left\", className)} {...props} />\n);\nDialogHeader.displayName = \"DialogHeader\";\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\", className)}\n {...props}\n />\n);\nDialogFooter.displayName = \"DialogFooter\";\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\"text-lg font-semibold leading-none tracking-tight\", className)}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogTrigger,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n};\n"]}
|
package/dist/chunk-QDFAIRQF.mjs
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { __async, __spreadValues, __spreadProps } from './chunk-MRXNTQOX.mjs';
|
|
2
|
-
import { copilotApiConfigExtrapolator } from '@copilotkit/react-core';
|
|
3
|
-
|
|
4
|
-
var ChatlikeApiEndpoint = class {
|
|
5
|
-
constructor(run) {
|
|
6
|
-
this.run = run;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Creates a new instance of ChatlikeApiEndpoint with the provided API endpoint.
|
|
10
|
-
* @param apiEndpoint The URL of the OpenAI-compatible API endpoint.
|
|
11
|
-
* @returns A new instance of ChatlikeApiEndpoint.
|
|
12
|
-
*/
|
|
13
|
-
static fromCopilotApiConfig(copilotApiConfig) {
|
|
14
|
-
return new ChatlikeApiEndpoint(
|
|
15
|
-
(abortSignal, messages, forwardedProps) => __async(this, null, function* () {
|
|
16
|
-
const res = yield fetch(copilotApiConfigExtrapolator(copilotApiConfig).chatApiEndpoint, {
|
|
17
|
-
method: "POST",
|
|
18
|
-
headers: __spreadValues({}, copilotApiConfig.headers),
|
|
19
|
-
body: JSON.stringify(__spreadProps(__spreadValues(__spreadValues({}, forwardedProps), copilotApiConfig.body), {
|
|
20
|
-
messages
|
|
21
|
-
})),
|
|
22
|
-
signal: abortSignal
|
|
23
|
-
});
|
|
24
|
-
const bodySteram = res.body;
|
|
25
|
-
if (!bodySteram) {
|
|
26
|
-
throw new Error("The response body is empty.");
|
|
27
|
-
}
|
|
28
|
-
const stringStream = bodySteram.pipeThrough(new TextDecoderStream());
|
|
29
|
-
return stringStream;
|
|
30
|
-
})
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Creates a fully customized instance of ChatlikeApiEndpoint.
|
|
35
|
-
* @param run - The implementation of the ChatlikeApiEndpointImpl interface.
|
|
36
|
-
* @returns A new instance of ChatlikeApiEndpoint .
|
|
37
|
-
*/
|
|
38
|
-
static custom(run) {
|
|
39
|
-
return new ChatlikeApiEndpoint(run);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export { ChatlikeApiEndpoint };
|
|
44
|
-
//# sourceMappingURL=out.js.map
|
|
45
|
-
//# sourceMappingURL=chunk-QDFAIRQF.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/autosuggestions-config/subtypes/chatlike-api-endpoint.tsx"],"names":[],"mappings":";;;;;;;AAAA,SAA2B,oCAAoC;AAexD,IAAM,sBAAN,MAA0B;AAAA,EAG/B,YAAY,KAAuC;AACjD,SAAK,MAAM;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,qBAAqB,kBAAyD;AACnF,WAAO,IAAI;AAAA,MACT,CACE,aACA,UACA,mBACG;AACH,cAAM,MAAM,MAAM,MAAM,6BAA6B,gBAAgB,EAAE,iBAAiB;AAAA,UACtF,QAAQ;AAAA,UACR,SAAS,mBACJ,iBAAiB;AAAA,UAEtB,MAAM,KAAK,UAAU,gDAChB,iBACA,iBAAiB,OAFD;AAAA,YAGnB;AAAA,UACF,EAAC;AAAA,UACD,QAAQ;AAAA,QACV,CAAC;AAED,cAAM,aAAgD,IAAI;AAC1D,YAAI,CAAC,YAAY;AACf,gBAAM,IAAI,MAAM,6BAA6B;AAAA,QAC/C;AAGA,cAAM,eAAe,WAAW,YAAY,IAAI,kBAAkB,CAAC;AAEnE,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,OAAO,KAA4D;AACxE,WAAO,IAAI,oBAAoB,GAAG;AAAA,EACpC;AACF","sourcesContent":["import { CopilotApiConfig, copilotApiConfigExtrapolator } from \"@copilotkit/react-core\";\nimport { MinimalChatGPTMessage } from \"./minimal-chat-gpt-message\";\n\nexport type ChatlikeApiEndpointImpl = (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any },\n) => Promise<string>;\n\nexport type StreamingChatlikeApiEndpointImpl = (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any },\n) => Promise<ReadableStream<string>>;\n\nexport class ChatlikeApiEndpoint {\n public run: StreamingChatlikeApiEndpointImpl;\n\n constructor(run: StreamingChatlikeApiEndpointImpl) {\n this.run = run;\n }\n\n /**\n * Creates a new instance of ChatlikeApiEndpoint with the provided API endpoint.\n * @param apiEndpoint The URL of the OpenAI-compatible API endpoint.\n * @returns A new instance of ChatlikeApiEndpoint.\n */\n static fromCopilotApiConfig(copilotApiConfig: CopilotApiConfig): ChatlikeApiEndpoint {\n return new ChatlikeApiEndpoint(\n async (\n abortSignal: AbortSignal,\n messages: MinimalChatGPTMessage[],\n forwardedProps?: { [key: string]: any },\n ) => {\n const res = await fetch(copilotApiConfigExtrapolator(copilotApiConfig).chatApiEndpoint, {\n method: \"POST\",\n headers: {\n ...copilotApiConfig.headers,\n },\n body: JSON.stringify({\n ...forwardedProps,\n ...copilotApiConfig.body,\n messages: messages,\n }),\n signal: abortSignal,\n });\n\n const bodySteram: ReadableStream<Uint8Array> | null = res.body;\n if (!bodySteram) {\n throw new Error(\"The response body is empty.\");\n }\n\n // map the stream to a stream of strings\n const stringStream = bodySteram.pipeThrough(new TextDecoderStream());\n\n return stringStream;\n },\n );\n }\n\n /**\n * Creates a fully customized instance of ChatlikeApiEndpoint.\n * @param run - The implementation of the ChatlikeApiEndpointImpl interface.\n * @returns A new instance of ChatlikeApiEndpoint .\n */\n static custom(run: StreamingChatlikeApiEndpointImpl): ChatlikeApiEndpoint {\n return new ChatlikeApiEndpoint(run);\n }\n}\n"]}
|
package/dist/chunk-RBR32FWA.mjs
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
// src/types/autosuggestions-config/insertions-api-config.tsx
|
|
2
|
-
var defaultInsertionsMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
3
|
-
return `You are a versatile writing assistant.
|
|
4
|
-
|
|
5
|
-
The user is writing some text.
|
|
6
|
-
The purpose is: "${textareaPurpose}"
|
|
7
|
-
|
|
8
|
-
The following external context is also provided. Use it to help you make better suggestions!!!
|
|
9
|
-
\`\`\`
|
|
10
|
-
${contextString}
|
|
11
|
-
\`\`\`
|
|
12
|
-
|
|
13
|
-
The user also provides you with a prompt for INSERTIONS into the text they are writing.
|
|
14
|
-
Your job is to come up with an INSERTION into the text that the user would like AS BEST YOU CAN.
|
|
15
|
-
Only insert a SHORT segment. Usually 1 sentence, or at most 1 paragraph.
|
|
16
|
-
|
|
17
|
-
Adjust yourself to the user's style and implied intent.
|
|
18
|
-
|
|
19
|
-
The user will provide the text before and after the cursor, as well as the insertion prompt. You should use this to infer the best relevant insertion.
|
|
20
|
-
<TextAfterCursor>
|
|
21
|
-
<TextBeforeCursor>
|
|
22
|
-
<InsertionPrompt>
|
|
23
|
-
<YourSuggestion>
|
|
24
|
-
`;
|
|
25
|
-
};
|
|
26
|
-
var defaultInsertionsFewShotMessages = [
|
|
27
|
-
{
|
|
28
|
-
role: "user",
|
|
29
|
-
name: "TextAfterCursor",
|
|
30
|
-
content: "While I was there I also picked up some apples, oranges, and bananas."
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
role: "user",
|
|
34
|
-
name: "TextBeforeCursor",
|
|
35
|
-
content: "This morning I woke up and went straight to the grocery store."
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
role: "user",
|
|
39
|
-
name: "InsertionPrompt",
|
|
40
|
-
content: "I bought a big watermelon"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
role: "assistant",
|
|
44
|
-
content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
role: "user",
|
|
48
|
-
name: "TextAfterCursor",
|
|
49
|
-
content: "and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof."
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
role: "user",
|
|
53
|
-
name: "TextBeforeCursor",
|
|
54
|
-
content: `The Optionholder, in the Optionholder's capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an "Equityholder" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an "Equityholder" thereunder;`
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
role: "user",
|
|
58
|
-
name: "InsertionPrompt",
|
|
59
|
-
content: "add section about the optionholder's pro rata share"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
role: "assistant",
|
|
63
|
-
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"; `
|
|
64
|
-
}
|
|
65
|
-
];
|
|
66
|
-
var defaultInsertionsApiConfig = {
|
|
67
|
-
makeSystemPrompt: defaultInsertionsMakeSystemPrompt,
|
|
68
|
-
fewShotMessages: defaultInsertionsFewShotMessages,
|
|
69
|
-
forwardedParams: void 0
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export { defaultInsertionsApiConfig, defaultInsertionsFewShotMessages, defaultInsertionsMakeSystemPrompt };
|
|
73
|
-
//# sourceMappingURL=out.js.map
|
|
74
|
-
//# sourceMappingURL=chunk-RBR32FWA.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/autosuggestions-config/insertions-api-config.tsx"],"names":[],"mappings":";AASO,IAAM,oCAAsD,CACjE,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;AAeF;AAEO,IAAM,mCAA4D;AAAA,EACvE;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AACF;AAEO,IAAM,6BAAkD;AAAA,EAC7D,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB","sourcesContent":["import { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\nimport { MinimalChatGPTMessage } from \"./subtypes/minimal-chat-gpt-message\";\n\nexport interface InsertionsApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: MinimalChatGPTMessage[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultInsertionsMakeSystemPrompt: 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\nThe following external context is also provided. Use it to help you make better suggestions!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThe user also provides you with a prompt for INSERTIONS into the text they are writing. \nYour job is to come up with an INSERTION into the text that the user would like AS BEST YOU CAN.\nOnly insert a SHORT segment. Usually 1 sentence, or at most 1 paragraph.\n\nAdjust yourself to the user's style and implied intent.\n\nThe user will provide the text before and after the cursor, as well as the insertion prompt. You should use this to infer the best relevant insertion.\n<TextAfterCursor>\n<TextBeforeCursor>\n<InsertionPrompt>\n<YourSuggestion>\n`;\n};\n\nexport const defaultInsertionsFewShotMessages: MinimalChatGPTMessage[] = [\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content: \"While I was there I also picked up some apples, oranges, and bananas.\",\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: \"This morning I woke up and went straight to the grocery store.\",\n },\n {\n role: \"user\",\n name: \"InsertionPrompt\",\n content: \"I bought a big watermelon\",\n },\n {\n role: \"assistant\",\n content:\n \" When I arrived I went straight to the produce section and picked out a big watermelon. \",\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content:\n \"and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.\",\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content:\n 'The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;',\n },\n {\n role: \"user\",\n name: \"InsertionPrompt\",\n content: \"add section about the optionholder's pro rata share\",\n },\n {\n role: \"assistant\",\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n },\n];\n\nexport const defaultInsertionsApiConfig: InsertionsApiConfig = {\n makeSystemPrompt: defaultInsertionsMakeSystemPrompt,\n fewShotMessages: defaultInsertionsFewShotMessages,\n forwardedParams: undefined,\n};\n"]}
|
package/dist/chunk-SBV2KVF5.mjs
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { retry } from './chunk-KNQIEOFP.mjs';
|
|
2
|
-
import { ChatlikeApiEndpoint } from './chunk-QDFAIRQF.mjs';
|
|
3
|
-
import { __async } from './chunk-MRXNTQOX.mjs';
|
|
4
|
-
import { CopilotContext } from '@copilotkit/react-core';
|
|
5
|
-
import { useContext, useCallback } from 'react';
|
|
6
|
-
|
|
7
|
-
function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCategories, insertionApiConfig, editingApiConfig) {
|
|
8
|
-
const { getContextString, copilotApiConfig } = useContext(CopilotContext);
|
|
9
|
-
const insertionFunction = useCallback(
|
|
10
|
-
(editorState, insertionPrompt, documents, abortSignal) => __async(this, null, function* () {
|
|
11
|
-
const res = yield retry(() => __async(this, null, function* () {
|
|
12
|
-
const messages = [
|
|
13
|
-
{
|
|
14
|
-
role: "system",
|
|
15
|
-
content: insertionApiConfig.makeSystemPrompt(
|
|
16
|
-
textareaPurpose,
|
|
17
|
-
getContextString(documents, contextCategories)
|
|
18
|
-
)
|
|
19
|
-
},
|
|
20
|
-
...insertionApiConfig.fewShotMessages,
|
|
21
|
-
{
|
|
22
|
-
role: "user",
|
|
23
|
-
name: "TextAfterCursor",
|
|
24
|
-
content: editorState.textAfterCursor
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
role: "user",
|
|
28
|
-
name: "TextBeforeCursor",
|
|
29
|
-
content: editorState.textBeforeCursor
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
role: "user",
|
|
33
|
-
name: "InsertionPrompt",
|
|
34
|
-
content: insertionPrompt
|
|
35
|
-
}
|
|
36
|
-
];
|
|
37
|
-
const apiEndpoint = ChatlikeApiEndpoint.fromCopilotApiConfig(copilotApiConfig);
|
|
38
|
-
return yield apiEndpoint.run(abortSignal, messages, insertionApiConfig.forwardedParams);
|
|
39
|
-
}));
|
|
40
|
-
return res;
|
|
41
|
-
}),
|
|
42
|
-
[insertionApiConfig, getContextString, contextCategories, textareaPurpose]
|
|
43
|
-
);
|
|
44
|
-
const editingFunction = useCallback(
|
|
45
|
-
(editorState, editingPrompt, documents, abortSignal) => __async(this, null, function* () {
|
|
46
|
-
const res = yield retry(() => __async(this, null, function* () {
|
|
47
|
-
const messages = [
|
|
48
|
-
{
|
|
49
|
-
role: "system",
|
|
50
|
-
content: editingApiConfig.makeSystemPrompt(
|
|
51
|
-
textareaPurpose,
|
|
52
|
-
getContextString(documents, contextCategories)
|
|
53
|
-
)
|
|
54
|
-
},
|
|
55
|
-
...editingApiConfig.fewShotMessages,
|
|
56
|
-
{
|
|
57
|
-
role: "user",
|
|
58
|
-
name: "TextBeforeCursor",
|
|
59
|
-
content: editorState.textBeforeCursor
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
role: "user",
|
|
63
|
-
name: "TextToEdit",
|
|
64
|
-
content: editorState.selectedText
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
role: "user",
|
|
68
|
-
name: "TextAfterCursor",
|
|
69
|
-
content: editorState.textAfterCursor
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
role: "user",
|
|
73
|
-
name: "EditingPrompt",
|
|
74
|
-
content: editingPrompt
|
|
75
|
-
}
|
|
76
|
-
];
|
|
77
|
-
const apiEndpoint = ChatlikeApiEndpoint.fromCopilotApiConfig(copilotApiConfig);
|
|
78
|
-
return yield apiEndpoint.run(abortSignal, messages, editingApiConfig.forwardedParams);
|
|
79
|
-
}));
|
|
80
|
-
return res;
|
|
81
|
-
}),
|
|
82
|
-
[editingApiConfig, getContextString, contextCategories, textareaPurpose]
|
|
83
|
-
);
|
|
84
|
-
const insertionOrEditingFunction = useCallback(
|
|
85
|
-
(editorState, insertionPrompt, documents, abortSignal) => __async(this, null, function* () {
|
|
86
|
-
if (editorState.selectedText === "") {
|
|
87
|
-
return yield insertionFunction(editorState, insertionPrompt, documents, abortSignal);
|
|
88
|
-
} else {
|
|
89
|
-
return yield editingFunction(editorState, insertionPrompt, documents, abortSignal);
|
|
90
|
-
}
|
|
91
|
-
}),
|
|
92
|
-
[insertionFunction, editingFunction]
|
|
93
|
-
);
|
|
94
|
-
return insertionOrEditingFunction;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export { useMakeStandardInsertionOrEditingFunction };
|
|
98
|
-
//# sourceMappingURL=out.js.map
|
|
99
|
-
//# sourceMappingURL=chunk-SBV2KVF5.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,SAAS,sBAAsB;AAC/B,SAAS,aAAa,kBAAkB;AA0BjC,SAAS,0CACd,iBACA,mBACA,oBACA,kBACwC;AACxC,QAAM,EAAE,kBAAkB,iBAAiB,IAAI,WAAW,cAAc;AAExE,QAAM,oBAAoB;AAAA,IACxB,CACE,aACA,iBACA,WACA,gBACG;AACH,YAAM,MAAM,MAAM,MAAM,MAAY;AAClC,cAAM,WAAoC;AAAA,UACxC;AAAA,YACE,MAAM;AAAA,YACN,SAAS,mBAAmB;AAAA,cAC1B;AAAA,cACA,iBAAiB,WAAW,iBAAiB;AAAA,YAC/C;AAAA,UACF;AAAA,UACA,GAAG,mBAAmB;AAAA,UACtB;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS,YAAY;AAAA,UACvB;AAAA,UACA;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS,YAAY;AAAA,UACvB;AAAA,UACA;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS;AAAA,UACX;AAAA,QACF;AAEA,cAAM,cAAc,oBAAoB,qBAAqB,gBAAgB;AAC7E,eAAO,MAAM,YAAY,IAAI,aAAa,UAAU,mBAAmB,eAAe;AAAA,MACxF,EAAC;AAED,aAAO;AAAA,IACT;AAAA,IACA,CAAC,oBAAoB,kBAAkB,mBAAmB,eAAe;AAAA,EAC3E;AAEA,QAAM,kBAAkB;AAAA,IACtB,CACE,aACA,eACA,WACA,gBACG;AACH,YAAM,MAAM,MAAM,MAAM,MAAY;AAClC,cAAM,WAAoC;AAAA,UACxC;AAAA,YACE,MAAM;AAAA,YACN,SAAS,iBAAiB;AAAA,cACxB;AAAA,cACA,iBAAiB,WAAW,iBAAiB;AAAA,YAC/C;AAAA,UACF;AAAA,UACA,GAAG,iBAAiB;AAAA,UACpB;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS,YAAY;AAAA,UACvB;AAAA,UACA;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS,YAAY;AAAA,UACvB;AAAA,UACA;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS,YAAY;AAAA,UACvB;AAAA,UACA;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS;AAAA,UACX;AAAA,QACF;AAEA,cAAM,cAAc,oBAAoB,qBAAqB,gBAAgB;AAC7E,eAAO,MAAM,YAAY,IAAI,aAAa,UAAU,iBAAiB,eAAe;AAAA,MACtF,EAAC;AAED,aAAO;AAAA,IACT;AAAA,IACA,CAAC,kBAAkB,kBAAkB,mBAAmB,eAAe;AAAA,EACzE;AAEA,QAAM,6BAA6B;AAAA,IACjC,CACE,aACA,iBACA,WACA,gBACG;AACH,UAAI,YAAY,iBAAiB,IAAI;AACnC,eAAO,MAAM,kBAAkB,aAAa,iBAAiB,WAAW,WAAW;AAAA,MACrF,OAAO;AACL,eAAO,MAAM,gBAAgB,aAAa,iBAAiB,WAAW,WAAW;AAAA,MACnF;AAAA,IACF;AAAA,IACA,CAAC,mBAAmB,eAAe;AAAA,EACrC;AAEA,SAAO;AACT","sourcesContent":["import { CopilotContext } from \"@copilotkit/react-core\";\nimport { useCallback, useContext } from \"react\";\nimport { ChatlikeApiEndpoint, MinimalChatGPTMessage } from \"../../types\";\nimport { retry } from \"../../lib/retry\";\nimport {\n EditingEditorState,\n Generator_InsertionOrEditingSuggestion,\n InsertionEditorApiConfig,\n InsertionEditorState,\n} from \"../../types/base/autosuggestions-bare-function\";\nimport { InsertionsApiConfig } from \"../../types/autosuggestions-config/insertions-api-config\";\nimport { EditingApiConfig } from \"../../types/autosuggestions-config/editing-api-config\";\nimport { DocumentPointer } from \"@copilotkit/react-core\";\n\n/**\n * Returns a memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.\n * The function takes in the text before and after the cursor, and an abort signal.\n * It sends a POST request to the API endpoint with the messages array containing the system message, few shot messages, and user messages.\n * The function returns the suggestion from the API response.\n *\n * @param textareaPurpose - The purpose of the textarea. This is included in the system message.\n * @param apiEndpoint - The API endpoint to send the autosuggestion request to.\n * @param makeSystemMessage - A function that takes in a context string and returns a system message to include in the autosuggestion request.\n * @param fewShotMessages - An array of few shot messages to include in the autosuggestion request.\n * @param contextCategories - The categories of context strings we want to include. By default, we include the (default) \"global\" context category.\n * @returns A memoized function that sends a request to the specified API endpoint to get an autosuggestion for the user's input.\n */\nexport function useMakeStandardInsertionOrEditingFunction(\n textareaPurpose: string,\n contextCategories: string[],\n insertionApiConfig: InsertionsApiConfig,\n editingApiConfig: EditingApiConfig,\n): Generator_InsertionOrEditingSuggestion {\n const { getContextString, copilotApiConfig } = useContext(CopilotContext);\n\n const insertionFunction = useCallback(\n async (\n editorState: EditingEditorState,\n insertionPrompt: string,\n documents: DocumentPointer[],\n abortSignal: AbortSignal,\n ) => {\n const res = await retry(async () => {\n const messages: MinimalChatGPTMessage[] = [\n {\n role: \"system\",\n content: insertionApiConfig.makeSystemPrompt(\n textareaPurpose,\n getContextString(documents, contextCategories),\n ),\n },\n ...insertionApiConfig.fewShotMessages,\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content: editorState.textAfterCursor,\n },\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: editorState.textBeforeCursor,\n },\n {\n role: \"user\",\n name: \"InsertionPrompt\",\n content: insertionPrompt,\n },\n ];\n\n const apiEndpoint = ChatlikeApiEndpoint.fromCopilotApiConfig(copilotApiConfig);\n return await apiEndpoint.run(abortSignal, messages, insertionApiConfig.forwardedParams);\n });\n\n return res;\n },\n [insertionApiConfig, getContextString, contextCategories, textareaPurpose],\n );\n\n const editingFunction = useCallback(\n async (\n editorState: EditingEditorState,\n editingPrompt: string,\n documents: DocumentPointer[],\n abortSignal: AbortSignal,\n ) => {\n const res = await retry(async () => {\n const messages: MinimalChatGPTMessage[] = [\n {\n role: \"system\",\n content: editingApiConfig.makeSystemPrompt(\n textareaPurpose,\n getContextString(documents, contextCategories),\n ),\n },\n ...editingApiConfig.fewShotMessages,\n {\n role: \"user\",\n name: \"TextBeforeCursor\",\n content: editorState.textBeforeCursor,\n },\n {\n role: \"user\",\n name: \"TextToEdit\",\n content: editorState.selectedText,\n },\n {\n role: \"user\",\n name: \"TextAfterCursor\",\n content: editorState.textAfterCursor,\n },\n {\n role: \"user\",\n name: \"EditingPrompt\",\n content: editingPrompt,\n },\n ];\n\n const apiEndpoint = ChatlikeApiEndpoint.fromCopilotApiConfig(copilotApiConfig);\n return await apiEndpoint.run(abortSignal, messages, editingApiConfig.forwardedParams);\n });\n\n return res;\n },\n [editingApiConfig, getContextString, contextCategories, textareaPurpose],\n );\n\n const insertionOrEditingFunction = useCallback(\n async (\n editorState: EditingEditorState,\n insertionPrompt: string,\n documents: DocumentPointer[],\n abortSignal: AbortSignal,\n ) => {\n if (editorState.selectedText === \"\") {\n return await insertionFunction(editorState, insertionPrompt, documents, abortSignal);\n } else {\n return await editingFunction(editorState, insertionPrompt, documents, abortSignal);\n }\n },\n [insertionFunction, editingFunction],\n );\n\n return insertionOrEditingFunction;\n}\n"]}
|
package/dist/chunk-T6MTDQZ7.mjs
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Element } from 'slate';
|
|
2
|
-
|
|
3
|
-
// src/lib/editor-to-text.ts
|
|
4
|
-
function nodeChildrenToTextComponents(editor, nodes) {
|
|
5
|
-
const indeciesOfInlineElements = new Set(
|
|
6
|
-
nodes.map((node, index) => {
|
|
7
|
-
if (Element.isElement(node) && editor.isInline(node)) {
|
|
8
|
-
return index;
|
|
9
|
-
}
|
|
10
|
-
return -1;
|
|
11
|
-
}).filter((index) => index !== -1)
|
|
12
|
-
);
|
|
13
|
-
const nonIgnorableItems = nodes.filter((node, index) => {
|
|
14
|
-
const isInline = indeciesOfInlineElements.has(index);
|
|
15
|
-
if (isInline) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
const isNeighbourOfInline = indeciesOfInlineElements.has(index - 1) || indeciesOfInlineElements.has(index + 1);
|
|
19
|
-
if (isNeighbourOfInline) {
|
|
20
|
-
return node.text !== "";
|
|
21
|
-
}
|
|
22
|
-
return true;
|
|
23
|
-
});
|
|
24
|
-
return nonIgnorableItems.map((node) => {
|
|
25
|
-
if (Element.isElement(node)) {
|
|
26
|
-
switch (node.type) {
|
|
27
|
-
case "paragraph":
|
|
28
|
-
return nodeChildrenToTextComponents(editor, node.children);
|
|
29
|
-
case "suggestion":
|
|
30
|
-
return [];
|
|
31
|
-
}
|
|
32
|
-
} else {
|
|
33
|
-
return [node];
|
|
34
|
-
}
|
|
35
|
-
}).reduce((acc, val) => acc.concat(val), []);
|
|
36
|
-
}
|
|
37
|
-
var editorToText = (editor) => {
|
|
38
|
-
const flattened = nodeChildrenToTextComponents(editor, editor.children);
|
|
39
|
-
const text = flattened.map((textComponent) => textComponent.text).join("\n");
|
|
40
|
-
return text;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export { editorToText };
|
|
44
|
-
//# sourceMappingURL=out.js.map
|
|
45
|
-
//# sourceMappingURL=chunk-T6MTDQZ7.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/editor-to-text.ts"],"names":[],"mappings":";AAAA,SAAiC,eAAe;AAKhD,SAAS,6BACP,QACA,OACuB;AAEvB,QAAM,2BAA2B,IAAI;AAAA,IACnC,MACG,IAAI,CAAC,MAAM,UAAU;AACpB,UAAI,QAAQ,UAAU,IAAI,KAAK,OAAO,SAAS,IAAI,GAAG;AACpD,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT,CAAC,EACA,OAAO,CAAC,UAAU,UAAU,EAAE;AAAA,EACnC;AAIA,QAAM,oBAAoB,MAAM,OAAO,CAAC,MAAM,UAAU;AACtD,UAAM,WAAW,yBAAyB,IAAI,KAAK;AACnD,QAAI,UAAU;AACZ,aAAO;AAAA,IACT;AAEA,UAAM,sBACJ,yBAAyB,IAAI,QAAQ,CAAC,KAAK,yBAAyB,IAAI,QAAQ,CAAC;AACnF,QAAI,qBAAqB;AACvB,aAAQ,KAAa,SAAS;AAAA,IAChC;AAEA,WAAO;AAAA,EACT,CAAC;AAED,SAAO,kBACJ,IAAI,CAAC,SAAS;AACb,QAAI,QAAQ,UAAU,IAAI,GAAG;AAC3B,cAAQ,KAAK,MAAM;AAAA,QACjB,KAAK;AACH,iBAAO,6BAA6B,QAAQ,KAAK,QAAQ;AAAA,QAC3D,KAAK;AACH,iBAAO,CAAC;AAAA,MACZ;AAAA,IACF,OAAO;AACL,aAAO,CAAC,IAAI;AAAA,IACd;AAAA,EACF,CAAC,EACA,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,GAAG,GAAG,CAAC,CAAC;AAC7C;AAEO,IAAM,eAAe,CAAC,WAAqD;AAChF,QAAM,YAAY,6BAA6B,QAAQ,OAAO,QAAQ;AAEtE,QAAM,OAAO,UAAU,IAAI,CAAC,kBAAkB,cAAc,IAAI,EAAE,KAAK,IAAI;AAE3E,SAAO;AACT","sourcesContent":["import { BaseEditor, Descendant, Element } from \"slate\";\nimport { HistoryEditor } from \"slate-history\";\nimport { ReactEditor } from \"slate-react\";\nimport { SuggestionAwareText } from \"../types/base/custom-editor\";\n\nfunction nodeChildrenToTextComponents(\n editor: BaseEditor & ReactEditor & HistoryEditor,\n nodes: Descendant[],\n): SuggestionAwareText[] {\n // find inlineable elements\n const indeciesOfInlineElements = new Set(\n nodes\n .map((node, index) => {\n if (Element.isElement(node) && editor.isInline(node)) {\n return index;\n }\n return -1;\n })\n .filter((index) => index !== -1),\n );\n\n // ignorable elements = inline elements,\n // or neighbors of inline elements that are {text: \"\"}\n const nonIgnorableItems = nodes.filter((node, index) => {\n const isInline = indeciesOfInlineElements.has(index);\n if (isInline) {\n return false;\n }\n\n const isNeighbourOfInline =\n indeciesOfInlineElements.has(index - 1) || indeciesOfInlineElements.has(index + 1);\n if (isNeighbourOfInline) {\n return (node as any).text !== \"\";\n }\n\n return true;\n });\n\n return nonIgnorableItems\n .map((node) => {\n if (Element.isElement(node)) {\n switch (node.type) {\n case \"paragraph\":\n return nodeChildrenToTextComponents(editor, node.children);\n case \"suggestion\":\n return [];\n }\n } else {\n return [node];\n }\n })\n .reduce((acc, val) => acc.concat(val), []);\n}\n\nexport const editorToText = (editor: BaseEditor & ReactEditor & HistoryEditor) => {\n const flattened = nodeChildrenToTextComponents(editor, editor.children);\n\n const text = flattened.map((textComponent) => textComponent.text).join(\"\\n\");\n\n return text;\n};\n"]}
|
package/dist/chunk-VPEH6V7T.mjs
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { replaceEditorText } from './chunk-5UNJXFUO.mjs';
|
|
2
|
-
import { getFullEditorTextWithNewlines } from './chunk-ECR45NSD.mjs';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { ReactEditor } from 'slate-react';
|
|
5
|
-
|
|
6
|
-
function usePopulateCopilotTextareaRef(editor, ref) {
|
|
7
|
-
React.useImperativeHandle(
|
|
8
|
-
ref,
|
|
9
|
-
() => {
|
|
10
|
-
class Combined {
|
|
11
|
-
constructor(customMethods2, editorHtmlElement2) {
|
|
12
|
-
this.customMethods = customMethods2;
|
|
13
|
-
this.editorHtmlElement = editorHtmlElement2;
|
|
14
|
-
}
|
|
15
|
-
get(target, propKey) {
|
|
16
|
-
if (this.isKeyOfCustomMethods(propKey)) {
|
|
17
|
-
const value = this.customMethods[propKey];
|
|
18
|
-
if (typeof value === "function") {
|
|
19
|
-
return value.bind(this.customMethods);
|
|
20
|
-
}
|
|
21
|
-
return value;
|
|
22
|
-
} else if (this.isKeyOfHTMLElement(propKey)) {
|
|
23
|
-
const value = this.editorHtmlElement[propKey];
|
|
24
|
-
if (typeof value === "function") {
|
|
25
|
-
return value.bind(this.editorHtmlElement);
|
|
26
|
-
}
|
|
27
|
-
return value;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
set(target, propKey, value) {
|
|
31
|
-
if (this.isKeyOfCustomMethods(propKey)) {
|
|
32
|
-
this.customMethods[propKey] = value;
|
|
33
|
-
} else if (this.isKeyOfHTMLElement(propKey)) {
|
|
34
|
-
this.editorHtmlElement[propKey] = value;
|
|
35
|
-
} else {
|
|
36
|
-
target[propKey] = value;
|
|
37
|
-
}
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
isKeyOfCustomMethods(key) {
|
|
41
|
-
return key in this.customMethods;
|
|
42
|
-
}
|
|
43
|
-
isKeyOfHTMLElement(key) {
|
|
44
|
-
return key in this.editorHtmlElement;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const handler = {
|
|
48
|
-
get(target, propKey) {
|
|
49
|
-
return target.get(target, propKey);
|
|
50
|
-
},
|
|
51
|
-
set(target, propKey, value) {
|
|
52
|
-
return target.set(target, propKey, value);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
class CustomMethods {
|
|
56
|
-
constructor(editor2) {
|
|
57
|
-
this.editor = editor2;
|
|
58
|
-
}
|
|
59
|
-
focus() {
|
|
60
|
-
ReactEditor.focus(this.editor);
|
|
61
|
-
}
|
|
62
|
-
blur() {
|
|
63
|
-
ReactEditor.blur(this.editor);
|
|
64
|
-
}
|
|
65
|
-
get value() {
|
|
66
|
-
return getFullEditorTextWithNewlines(this.editor);
|
|
67
|
-
}
|
|
68
|
-
set value(value) {
|
|
69
|
-
replaceEditorText(this.editor, value);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
const editorHtmlElement = ReactEditor.toDOMNode(editor, editor);
|
|
73
|
-
const customMethods = new CustomMethods(editor);
|
|
74
|
-
const combined = new Combined(customMethods, editorHtmlElement);
|
|
75
|
-
return new Proxy(combined, handler);
|
|
76
|
-
},
|
|
77
|
-
[editor]
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export { usePopulateCopilotTextareaRef };
|
|
82
|
-
//# sourceMappingURL=out.js.map
|
|
83
|
-
//# sourceMappingURL=chunk-VPEH6V7T.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts"],"names":["customMethods","editorHtmlElement","editor"],"mappings":";;;;;;;;AAAA,OAAO,WAAW;AAElB,SAAS,mBAAmB;AAMrB,SAAS,8BACd,QACA,KACA;AACA,QAAM;AAAA,IACJ;AAAA,IACA,MAAM;AACJ,YAAM,SAAS;AAAA,QACb,YAAoBA,gBAAsCC,oBAAgC;AAAtE,+BAAAD;AAAsC,mCAAAC;AAAA,QAAiC;AAAA,QAI3F,IAAI,QAAa,SAAsB;AACrC,cAAI,KAAK,qBAAqB,OAAO,GAAG;AACtC,kBAAM,QAAQ,KAAK,cAAc,OAAO;AACxC,gBAAI,OAAO,UAAU,YAAY;AAC/B,qBAAO,MAAM,KAAK,KAAK,aAAa;AAAA,YACtC;AACA,mBAAO;AAAA,UACT,WAAW,KAAK,mBAAmB,OAAO,GAAG;AAC3C,kBAAM,QAAQ,KAAK,kBAAkB,OAAO;AAC5C,gBAAI,OAAO,UAAU,YAAY;AAC/B,qBAAO,MAAM,KAAK,KAAK,iBAAiB;AAAA,YAC1C;AACA,mBAAO;AAAA,UACT;AAAA,QACF;AAAA,QAEA,IAAI,QAAa,SAAiB,OAAqB;AACrD,cAAI,KAAK,qBAAqB,OAAO,GAAG;AACtC,YAAC,KAAK,cAAsB,OAAO,IAAI;AAAA,UACzC,WAAW,KAAK,mBAAmB,OAAO,GAAG;AAC3C,YAAC,KAAK,kBAA0B,OAAO,IAAI;AAAA,UAC7C,OAAO;AAEL,mBAAO,OAAO,IAAI;AAAA,UACpB;AACA,iBAAO;AAAA,QACT;AAAA,QAEQ,qBAAqB,KAAyC;AACpE,iBAAO,OAAO,KAAK;AAAA,QACrB;AAAA,QAEQ,mBAAmB,KAAuC;AAChE,iBAAO,OAAO,KAAK;AAAA,QACrB;AAAA,MACF;AAEA,YAAM,UAAU;AAAA,QACd,IAAI,QAAa,SAAkD;AACjE,iBAAO,OAAO,IAAI,QAAQ,OAAO;AAAA,QACnC;AAAA,QACA,IAAI,QAAa,SAAkD,OAAY;AAC7E,iBAAO,OAAO,IAAI,QAAQ,SAAS,KAAK;AAAA,QAC1C;AAAA,MACF;AAEA,YAAM,cAAc;AAAA,QAClB,YAAoBC,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","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(private customMethods: CustomMethods, private editorHtmlElement: HTMLElement) {}\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"]}
|
package/dist/chunk-WADHCMPK.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/chunk-WFTAAA7R.mjs
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { cn } from './chunk-7SUZ6CXM.mjs';
|
|
2
|
-
import { __objRest, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
5
|
-
import { cva } from 'class-variance-authority';
|
|
6
|
-
import { jsx } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
var buttonVariants = cva(
|
|
9
|
-
"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
10
|
-
{
|
|
11
|
-
variants: {
|
|
12
|
-
variant: {
|
|
13
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
14
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
15
|
-
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
16
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
17
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
18
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
19
|
-
},
|
|
20
|
-
size: {
|
|
21
|
-
default: "h-10 px-4 py-2",
|
|
22
|
-
sm: "h-9 rounded-md px-3",
|
|
23
|
-
lg: "h-11 rounded-md px-8",
|
|
24
|
-
icon: "h-10 w-10"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
defaultVariants: {
|
|
28
|
-
variant: "default",
|
|
29
|
-
size: "default"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
var Button = React.forwardRef(
|
|
34
|
-
(_a, ref) => {
|
|
35
|
-
var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest(_b, ["className", "variant", "size", "asChild"]);
|
|
36
|
-
const Comp = asChild ? Slot : "button";
|
|
37
|
-
return /* @__PURE__ */ jsx(Comp, __spreadValues({ className: cn(buttonVariants({ variant, size, className })), ref }, props));
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
Button.displayName = "Button";
|
|
41
|
-
|
|
42
|
-
export { Button, buttonVariants };
|
|
43
|
-
//# sourceMappingURL=out.js.map
|
|
44
|
-
//# sourceMappingURL=chunk-WFTAAA7R.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ui/button.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,WAA8B;AAwCjC;AApCN,IAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,aAAa;AAAA,QACb,SAAS;AAAA,QACT,WAAW;AAAA,QACX,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,MACA,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAQA,IAAM,SAAe;AAAA,EACnB,CAAC,IAAyD,QAAQ;AAAjE,iBAAE,aAAW,SAAS,MAAM,UAAU,MAvCzC,IAuCG,IAAgD,kBAAhD,IAAgD,CAA9C,aAAW,WAAS,QAAM;AAC3B,UAAM,OAAO,UAAU,OAAO;AAC9B,WACE,oBAAC,uBAAK,WAAW,GAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC,GAAG,OAAc,MAAO;AAAA,EAE5F;AACF;AACA,OAAO,cAAc","sourcesContent":["import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive: \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline: \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-10 px-4 py-2\",\n sm: \"h-9 rounded-md px-3\",\n lg: \"h-11 rounded-md px-8\",\n icon: \"h-10 w-10\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />\n );\n },\n);\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n"]}
|
package/dist/chunk-WJHSY5T6.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|