@copilotkit/react-textarea 0.11.0 → 0.13.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/.turbo/turbo-build.log +90 -70
- package/CHANGELOG.md +13 -0
- package/dist/{chunk-EHQ5TN4R.mjs → chunk-3OR5RMJQ.mjs} +5 -2
- package/dist/chunk-3OR5RMJQ.mjs.map +1 -0
- package/dist/{chunk-A3SFEHWZ.mjs → chunk-4ES2IIB6.mjs} +24 -31
- package/dist/chunk-4ES2IIB6.mjs.map +1 -0
- package/dist/chunk-4YM33JFV.mjs +28 -0
- package/dist/chunk-4YM33JFV.mjs.map +1 -0
- package/dist/chunk-AOEXKPIX.mjs +83 -0
- package/dist/chunk-AOEXKPIX.mjs.map +1 -0
- package/dist/{chunk-6SYD77G6.mjs → chunk-CSGFJU3L.mjs} +2 -2
- package/dist/chunk-CSGFJU3L.mjs.map +1 -0
- package/dist/chunk-DE5K76I2.mjs +3 -0
- package/dist/{chunk-E2UEE45I.mjs → chunk-HZGSG7ST.mjs} +1 -1
- package/dist/chunk-HZGSG7ST.mjs.map +1 -0
- package/dist/{chunk-THWPPG6M.mjs → chunk-IGQI27NI.mjs} +20 -2
- package/dist/chunk-IGQI27NI.mjs.map +1 -0
- package/dist/chunk-M6QFKIBE.mjs +161 -0
- package/dist/chunk-M6QFKIBE.mjs.map +1 -0
- package/dist/chunk-RXISUUUY.mjs +32 -0
- package/dist/chunk-RXISUUUY.mjs.map +1 -0
- package/dist/chunk-WADHCMPK.mjs +3 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.d.ts +9 -4
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +9 -8
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.d.ts +4 -2
- package/dist/components/copilot-textarea/copilot-textarea.mjs +13 -11
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.mjs +13 -11
- package/dist/hooks/{use-autosuggestions.d.ts → base-copilot-textarea-implementation/use-autosuggestions.d.ts} +3 -3
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +7 -0
- package/dist/hooks/{use-copilot-textarea-editor.d.ts → base-copilot-textarea-implementation/use-copilot-textarea-editor.d.ts} +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +5 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.d.ts +7 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +6 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map +1 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +2 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +1 -1
- package/dist/index.css +7 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +15 -12
- package/dist/types/html-copilot-textarea-element.d.ts +7 -0
- package/dist/types/html-copilot-textarea-element.mjs +3 -0
- package/dist/types/html-copilot-textarea-element.mjs.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.mjs +4 -2
- package/dist/types/standard-autosuggestions/autosuggestions-config.d.ts +2 -1
- package/dist/types/standard-autosuggestions/autosuggestions-config.mjs +2 -1
- package/dist/types/standard-autosuggestions/chatlike-api-endpoint.d.ts +12 -0
- package/dist/types/standard-autosuggestions/chatlike-api-endpoint.mjs +4 -0
- package/dist/types/standard-autosuggestions/chatlike-api-endpoint.mjs.map +1 -0
- package/dist/types/standard-autosuggestions/index.d.ts +1 -0
- package/dist/types/standard-autosuggestions/index.mjs +2 -1
- package/package.json +1 -1
- package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +160 -146
- package/src/components/base-copilot-textarea/use-add-branding-css.tsx +25 -1
- package/src/components/copilot-textarea/copilot-textarea.tsx +31 -21
- package/src/hooks/{use-autosuggestions.ts → base-copilot-textarea-implementation/use-autosuggestions.ts} +5 -5
- package/src/hooks/{use-copilot-textarea-editor.tsx → base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx} +5 -5
- package/src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts +101 -0
- package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +25 -32
- package/src/types/html-copilot-textarea-element.ts +5 -0
- package/src/types/index.ts +1 -0
- package/src/types/standard-autosuggestions/autosuggestions-config.tsx +5 -2
- package/src/types/standard-autosuggestions/chatlike-api-endpoint.tsx +39 -0
- package/src/types/standard-autosuggestions/index.ts +10 -5
- package/dist/chunk-6SYD77G6.mjs.map +0 -1
- package/dist/chunk-A3SFEHWZ.mjs.map +0 -1
- package/dist/chunk-E2UEE45I.mjs.map +0 -1
- package/dist/chunk-EHQ5TN4R.mjs.map +0 -1
- package/dist/chunk-FD6FGKYY.mjs +0 -3
- package/dist/chunk-THWPPG6M.mjs.map +0 -1
- package/dist/chunk-YICIML6J.mjs +0 -154
- package/dist/chunk-YICIML6J.mjs.map +0 -1
- package/dist/chunk-YTT5NE6B.mjs +0 -25
- package/dist/chunk-YTT5NE6B.mjs.map +0 -1
- package/dist/hooks/use-autosuggestions.mjs +0 -7
- package/dist/hooks/use-copilot-textarea-editor.mjs +0 -5
- /package/dist/{chunk-FD6FGKYY.mjs.map → chunk-DE5K76I2.mjs.map} +0 -0
- /package/dist/{hooks/use-autosuggestions.mjs.map → chunk-WADHCMPK.mjs.map} +0 -0
- /package/dist/hooks/{use-copilot-textarea-editor.mjs.map → base-copilot-textarea-implementation/use-autosuggestions.mjs.map} +0 -0
package/dist/index.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/styles.css","../src/components/base-copilot-textarea/base-copilot-textarea.css"],"sourcesContent":["/*\n! tailwindcss v3.3.0 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n*/\n\nhtml {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font family by default.\n2. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\n[type='button'],\n[type='reset'],\n[type='submit'] {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n.block {\n display: block;\n}\n.inline {\n display: inline;\n}\n.resize-y {\n resize: vertical;\n}\n.overflow-y-auto {\n overflow-y: auto;\n}\n.border {\n border-width: 1px;\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity));\n}\n.italic {\n font-style: italic;\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n",".copilot-textarea.with-branding::after {\n content: ''; /* Initially empty because we overrdie this CSS dynamically and we want to avoid flashing */\n position: absolute;\n}\n \n \n.copilot-textarea.no-branding::after {\n content: '';\n}"],"mappings":";AAOA;AAAA;AAAA;AAGE;AACA;AACA;AACA;AAAA;AAGF;AAAA;AAEE;AAAA;AAYF;AACE;AACA;AACA;AACA;AACG;AACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAQF;AACE;AACA;AAAA;AASF;AACE;AACA;AACA;AAAA;AAOF;AACE;AACQ;AAAA;AAOV;AAAA;AAAA;AAAA;AAAA;AAAA;AAME;AACA;AAAA;AAOF;AACE;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AAAA;AAAA;AAAA;AAIE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAEE;AACA;AACA;AACA;AAAA;AAGF;AACE;AAAA;AAGF;AACE;AAAA;AASF;AACE;AACA;AACA;AAAA;AASF;AAAA;AAAA;AAAA;AAAA;AAKE;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AAAA;AAAA;AAAA;AAIE;AACA;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AACE;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AACE;AACA;AAAA;AAOF;AACE;AAAA;AAQF;AACE;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaE;AAAA;AAGF;AACE;AACA;AAAA;AAGF;AACE;AAAA;AAGF;AAAA;AAAA;AAGE;AACA;AACA;AAAA;AAOF;AACE;AAAA;AAQF;AAAA;AACE;AACA;AAAA;AAGF;AAAA;AAEE;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAMF;AACE;AAAA;AASF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQE;AACA;AAAA;AAOF;AAAA;AAEE;AACA;AAAA;AAIF;AACE;AAAA;AAGF;AAAA;AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAGF;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AACA;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;;;AC/eF;AACI;AACA;AAAA;AAIJ;AACI;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/styles.css","../src/components/base-copilot-textarea/base-copilot-textarea.css"],"sourcesContent":["/*\n! tailwindcss v3.3.0 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n*/\n\nhtml {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font family by default.\n2. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\n[type='button'],\n[type='reset'],\n[type='submit'] {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n.static {\n position: static;\n}\n.block {\n display: block;\n}\n.inline {\n display: inline;\n}\n.resize-y {\n resize: vertical;\n}\n.overflow-y-auto {\n overflow-y: auto;\n}\n.border {\n border-width: 1px;\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity));\n}\n.italic {\n font-style: italic;\n}\n.blur {\n --tw-blur: blur(8px);\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n",".copilot-textarea.with-branding::after {\n content: ''; /* Initially empty because we overrdie this CSS dynamically and we want to avoid flashing */\n position: absolute;\n}\n \n \n.copilot-textarea.no-branding::after {\n content: '';\n}"],"mappings":";AAOA;AAAA;AAAA;AAGE;AACA;AACA;AACA;AAAA;AAGF;AAAA;AAEE;AAAA;AAYF;AACE;AACA;AACA;AACA;AACG;AACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAQF;AACE;AACA;AAAA;AASF;AACE;AACA;AACA;AAAA;AAOF;AACE;AACQ;AAAA;AAOV;AAAA;AAAA;AAAA;AAAA;AAAA;AAME;AACA;AAAA;AAOF;AACE;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AAAA;AAAA;AAAA;AAIE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAEE;AACA;AACA;AACA;AAAA;AAGF;AACE;AAAA;AAGF;AACE;AAAA;AASF;AACE;AACA;AACA;AAAA;AASF;AAAA;AAAA;AAAA;AAAA;AAKE;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AAAA;AAAA;AAAA;AAIE;AACA;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AACE;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAEE;AAAA;AAQF;AACE;AACA;AAAA;AAOF;AACE;AAAA;AAQF;AACE;AACA;AAAA;AAOF;AACE;AAAA;AAOF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaE;AAAA;AAGF;AACE;AACA;AAAA;AAGF;AACE;AAAA;AAGF;AAAA;AAAA;AAGE;AACA;AACA;AAAA;AAOF;AACE;AAAA;AAQF;AAAA;AACE;AACA;AAAA;AAGF;AAAA;AAEE;AACA;AAAA;AAOF;AAAA;AAEE;AAAA;AAMF;AACE;AAAA;AASF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQE;AACA;AAAA;AAOF;AAAA;AAEE;AACA;AAAA;AAIF;AACE;AAAA;AAGF;AAAA;AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAGF;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AACA;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AACA;AAAA;AAEF;AACE;AAAA;;;ACtfF;AACI;AACA;AAAA;AAIJ;AACI;AAAA;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export { CopilotTextarea, CopilotTextareaProps } from './components/copilot-text
|
|
|
3
3
|
export { BaseAutosuggestionsConfig, defaultBaseAutosuggestionsConfig } from './types/base/base-autosuggestions-config.js';
|
|
4
4
|
export { AutosuggestionsBareFunction } from './types/base/autosuggestions-bare-function.js';
|
|
5
5
|
export { BaseCopilotTextareaProps } from './types/base/base-copilot-textarea-props.js';
|
|
6
|
+
export { HTMLCopilotTextAreaElement } from './types/html-copilot-textarea-element.js';
|
|
6
7
|
export { AutosuggestionsConfig, MakeSystemPrompt, defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from './types/standard-autosuggestions/autosuggestions-config.js';
|
|
7
8
|
export { MinimalChatGPTMessage } from './types/standard-autosuggestions/minimal-chat-gpt-message.js';
|
|
9
|
+
export { ChatlikeApiEndpoint as GenericChatlikeApiEndpoint, ChatlikeApiEndpointImpl as GenericChatlikeApiEndpointImpl } from './types/standard-autosuggestions/chatlike-api-endpoint.js';
|
|
8
10
|
import 'react';
|
package/dist/index.mjs
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
import './chunk-
|
|
1
|
+
import './chunk-DE5K76I2.mjs';
|
|
2
|
+
import './chunk-WADHCMPK.mjs';
|
|
2
3
|
import './chunk-MMVDU6DF.mjs';
|
|
3
|
-
export { CopilotTextarea } from './chunk-
|
|
4
|
-
import './chunk-
|
|
4
|
+
export { CopilotTextarea } from './chunk-RXISUUUY.mjs';
|
|
5
|
+
import './chunk-4ES2IIB6.mjs';
|
|
5
6
|
import './chunk-AZQCUNBV.mjs';
|
|
6
|
-
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from './chunk-
|
|
7
|
-
|
|
7
|
+
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from './chunk-3OR5RMJQ.mjs';
|
|
8
|
+
import './chunk-4YM33JFV.mjs';
|
|
9
|
+
export { BaseCopilotTextarea } from './chunk-M6QFKIBE.mjs';
|
|
10
|
+
import './chunk-HZGSG7ST.mjs';
|
|
11
|
+
import './chunk-UW3ITU2Y.mjs';
|
|
12
|
+
import './chunk-CSGFJU3L.mjs';
|
|
13
|
+
import './chunk-AOEXKPIX.mjs';
|
|
8
14
|
import './chunk-WJYQWL4I.mjs';
|
|
9
15
|
import './chunk-4XYYSJ5C.mjs';
|
|
10
16
|
import './chunk-TSF4AJIK.mjs';
|
|
11
|
-
import './chunk-
|
|
17
|
+
import './chunk-KCHYD3EB.mjs';
|
|
18
|
+
import './chunk-KGKLUWKW.mjs';
|
|
12
19
|
import './chunk-WJHSY5T6.mjs';
|
|
13
20
|
export { defaultBaseAutosuggestionsConfig } from './chunk-7KWRVIYV.mjs';
|
|
14
21
|
import './chunk-LNAIMEB2.mjs';
|
|
15
22
|
import './chunk-OELUUJZY.mjs';
|
|
16
|
-
import './chunk-
|
|
23
|
+
import './chunk-IGQI27NI.mjs';
|
|
17
24
|
import './chunk-IU3WTXLQ.mjs';
|
|
18
25
|
import './chunk-H4VKQGVU.mjs';
|
|
19
|
-
import './chunk-E2UEE45I.mjs';
|
|
20
|
-
import './chunk-UW3ITU2Y.mjs';
|
|
21
|
-
import './chunk-KGKLUWKW.mjs';
|
|
22
|
-
import './chunk-6SYD77G6.mjs';
|
|
23
|
-
import './chunk-KCHYD3EB.mjs';
|
|
24
26
|
import './chunk-NKW5OU2S.mjs';
|
|
27
|
+
import './chunk-3UQM3NLM.mjs';
|
|
25
28
|
import './chunk-MRXNTQOX.mjs';
|
|
26
29
|
//# sourceMappingURL=out.js.map
|
|
27
30
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { BaseAutosuggestionsConfig, defaultBaseAutosuggestionsConfig } from './base/base-autosuggestions-config.js';
|
|
2
2
|
export { AutosuggestionsBareFunction } from './base/autosuggestions-bare-function.js';
|
|
3
3
|
export { BaseCopilotTextareaProps } from './base/base-copilot-textarea-props.js';
|
|
4
|
+
export { HTMLCopilotTextAreaElement } from './html-copilot-textarea-element.js';
|
|
4
5
|
export { AutosuggestionsConfig, MakeSystemPrompt, defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from './standard-autosuggestions/autosuggestions-config.js';
|
|
5
6
|
export { MinimalChatGPTMessage } from './standard-autosuggestions/minimal-chat-gpt-message.js';
|
|
7
|
+
export { ChatlikeApiEndpoint as GenericChatlikeApiEndpoint, ChatlikeApiEndpointImpl as GenericChatlikeApiEndpointImpl } from './standard-autosuggestions/chatlike-api-endpoint.js';
|
|
6
8
|
import 'react';
|
package/dist/types/index.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import '../chunk-
|
|
1
|
+
import '../chunk-DE5K76I2.mjs';
|
|
2
|
+
import '../chunk-WADHCMPK.mjs';
|
|
2
3
|
import '../chunk-AZQCUNBV.mjs';
|
|
3
|
-
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../chunk-
|
|
4
|
+
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../chunk-3OR5RMJQ.mjs';
|
|
5
|
+
import '../chunk-4YM33JFV.mjs';
|
|
4
6
|
import '../chunk-WJHSY5T6.mjs';
|
|
5
7
|
export { defaultBaseAutosuggestionsConfig } from '../chunk-7KWRVIYV.mjs';
|
|
6
8
|
import '../chunk-MRXNTQOX.mjs';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BaseAutosuggestionsConfig } from '../base/base-autosuggestions-config.js';
|
|
2
|
+
import { ChatlikeApiEndpoint } from './chatlike-api-endpoint.js';
|
|
2
3
|
import { MinimalChatGPTMessage } from './minimal-chat-gpt-message.js';
|
|
3
4
|
|
|
4
5
|
type MakeSystemPrompt = (purposePrompt: string, contextString: string) => string;
|
|
5
6
|
interface AutosuggestionsConfig extends BaseAutosuggestionsConfig {
|
|
6
|
-
apiEndpoint:
|
|
7
|
+
apiEndpoint: ChatlikeApiEndpoint;
|
|
7
8
|
externalContextCategories: string[] | undefined;
|
|
8
9
|
makeSystemPrompt: MakeSystemPrompt;
|
|
9
10
|
fewShotMessages: MinimalChatGPTMessage[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../../chunk-
|
|
1
|
+
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../../chunk-3OR5RMJQ.mjs';
|
|
2
|
+
import '../../chunk-4YM33JFV.mjs';
|
|
2
3
|
import '../../chunk-WJHSY5T6.mjs';
|
|
3
4
|
import '../../chunk-7KWRVIYV.mjs';
|
|
4
5
|
import '../../chunk-MRXNTQOX.mjs';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MinimalChatGPTMessage } from './minimal-chat-gpt-message.js';
|
|
2
|
+
|
|
3
|
+
type ChatlikeApiEndpointImpl = (abortSignal: AbortSignal, messages: MinimalChatGPTMessage[], forwardedProps?: {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}) => Promise<string>;
|
|
6
|
+
declare class ChatlikeApiEndpoint {
|
|
7
|
+
run: ChatlikeApiEndpointImpl;
|
|
8
|
+
constructor(run: ChatlikeApiEndpointImpl);
|
|
9
|
+
static standardOpenAIEndpoint(apiEndpoint: string): ChatlikeApiEndpoint;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { ChatlikeApiEndpoint, ChatlikeApiEndpointImpl };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { AutosuggestionsConfig, MakeSystemPrompt, defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from './autosuggestions-config.js';
|
|
2
2
|
export { MinimalChatGPTMessage } from './minimal-chat-gpt-message.js';
|
|
3
|
+
export { ChatlikeApiEndpoint as GenericChatlikeApiEndpoint, ChatlikeApiEndpointImpl as GenericChatlikeApiEndpointImpl } from './chatlike-api-endpoint.js';
|
|
3
4
|
import '../base/base-autosuggestions-config.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import '../../chunk-AZQCUNBV.mjs';
|
|
2
|
-
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../../chunk-
|
|
2
|
+
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from '../../chunk-3OR5RMJQ.mjs';
|
|
3
|
+
import '../../chunk-4YM33JFV.mjs';
|
|
3
4
|
import '../../chunk-WJHSY5T6.mjs';
|
|
4
5
|
import '../../chunk-7KWRVIYV.mjs';
|
|
5
6
|
import '../../chunk-MRXNTQOX.mjs';
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
2
|
import { Descendant, Editor } from "slate";
|
|
3
3
|
import { Editable, Slate } from "slate-react";
|
|
4
4
|
import { twMerge } from "tailwind-merge";
|
|
5
|
-
import { useAutosuggestions } from "../../hooks/use-autosuggestions";
|
|
6
|
-
import { useCopilotTextareaEditor } from "../../hooks/use-copilot-textarea-editor";
|
|
5
|
+
import { useAutosuggestions } from "../../hooks/base-copilot-textarea-implementation/use-autosuggestions";
|
|
6
|
+
import { useCopilotTextareaEditor } from "../../hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor";
|
|
7
|
+
import { usePopulateCopilotTextareaRef } from "../../hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref";
|
|
7
8
|
import {
|
|
8
9
|
getFullEditorTextWithNewlines,
|
|
9
10
|
getTextAroundCursor,
|
|
@@ -23,158 +24,171 @@ import { makeRenderElementFunction } from "./render-element";
|
|
|
23
24
|
import { makeRenderPlaceholderFunction } from "./render-placeholder";
|
|
24
25
|
import { useAddBrandingCss } from "./use-add-branding-css";
|
|
25
26
|
|
|
26
|
-
export
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const autosuggestionsConfig: BaseAutosuggestionsConfig = {
|
|
32
|
-
...defaultBaseAutosuggestionsConfig,
|
|
33
|
-
...props.autosuggestionsConfig,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const valueOnInitialRender = useMemo(() => props.value ?? "", []);
|
|
37
|
-
const [lastKnownFullEditorText, setLastKnownFullEditorText] =
|
|
38
|
-
useState(valueOnInitialRender);
|
|
39
|
-
|
|
40
|
-
const initialValue: Descendant[] = useMemo(() => {
|
|
41
|
-
return [
|
|
42
|
-
{
|
|
43
|
-
type: "paragraph",
|
|
44
|
-
children: [{ text: valueOnInitialRender }],
|
|
45
|
-
},
|
|
46
|
-
];
|
|
47
|
-
}, [valueOnInitialRender]);
|
|
48
|
-
|
|
49
|
-
const editor = useCopilotTextareaEditor();
|
|
27
|
+
export interface HTMLCopilotTextAreaElement extends HTMLElement {
|
|
28
|
+
value: string;
|
|
29
|
+
focus: () => void;
|
|
30
|
+
blur: () => void;
|
|
31
|
+
}
|
|
50
32
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
33
|
+
export const BaseCopilotTextarea = React.forwardRef(
|
|
34
|
+
(
|
|
35
|
+
props: BaseCopilotTextareaProps & {
|
|
36
|
+
autosuggestionsFunction: AutosuggestionsBareFunction;
|
|
56
37
|
},
|
|
57
|
-
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
onChangeHandler: onChangeHandlerForAutocomplete,
|
|
63
|
-
onKeyDownHandler: onKeyDownHandlerForAutocomplete,
|
|
64
|
-
} = useAutosuggestions(
|
|
65
|
-
autosuggestionsConfig.debounceTime,
|
|
66
|
-
autosuggestionsConfig.acceptAutosuggestionKey,
|
|
67
|
-
props.autosuggestionsFunction,
|
|
68
|
-
insertText,
|
|
69
|
-
autosuggestionsConfig.disableWhenEmpty,
|
|
70
|
-
autosuggestionsConfig.disabled
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
// sync autosuggestions state with the editor
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
clearAutocompletionsFromEditor(editor);
|
|
76
|
-
if (currentAutocompleteSuggestion) {
|
|
77
|
-
addAutocompletionsToEditor(
|
|
78
|
-
editor,
|
|
79
|
-
currentAutocompleteSuggestion.text,
|
|
80
|
-
currentAutocompleteSuggestion.point
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
}, [currentAutocompleteSuggestion]);
|
|
84
|
-
|
|
85
|
-
const suggestionStyleAugmented: React.CSSProperties = useMemo(() => {
|
|
86
|
-
return {
|
|
87
|
-
fontStyle: "italic",
|
|
88
|
-
color: "gray",
|
|
89
|
-
...props.suggestionsStyle,
|
|
38
|
+
ref: React.Ref<HTMLCopilotTextAreaElement>
|
|
39
|
+
): JSX.Element => {
|
|
40
|
+
const autosuggestionsConfig: BaseAutosuggestionsConfig = {
|
|
41
|
+
...defaultBaseAutosuggestionsConfig,
|
|
42
|
+
...props.autosuggestionsConfig,
|
|
90
43
|
};
|
|
91
|
-
}, [props.suggestionsStyle]);
|
|
92
44
|
|
|
93
|
-
|
|
45
|
+
const valueOnInitialRender = useMemo(() => props.value ?? "", []);
|
|
46
|
+
const [lastKnownFullEditorText, setLastKnownFullEditorText] =
|
|
47
|
+
useState(valueOnInitialRender);
|
|
48
|
+
|
|
49
|
+
const initialValue: Descendant[] = useMemo(() => {
|
|
50
|
+
return [
|
|
51
|
+
{
|
|
52
|
+
type: "paragraph",
|
|
53
|
+
children: [{ text: valueOnInitialRender }],
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
}, [valueOnInitialRender]);
|
|
57
|
+
|
|
58
|
+
const editor = useCopilotTextareaEditor();
|
|
59
|
+
|
|
60
|
+
const insertText = useCallback(
|
|
61
|
+
(autosuggestion: AutosuggestionState) => {
|
|
62
|
+
Editor.insertText(editor, autosuggestion.text, {
|
|
63
|
+
at: autosuggestion.point,
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
[editor]
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const {
|
|
70
|
+
currentAutocompleteSuggestion,
|
|
71
|
+
onChangeHandler: onChangeHandlerForAutocomplete,
|
|
72
|
+
onKeyDownHandler: onKeyDownHandlerForAutocomplete,
|
|
73
|
+
} = useAutosuggestions(
|
|
74
|
+
autosuggestionsConfig.debounceTime,
|
|
75
|
+
autosuggestionsConfig.acceptAutosuggestionKey,
|
|
76
|
+
props.autosuggestionsFunction,
|
|
77
|
+
insertText,
|
|
78
|
+
autosuggestionsConfig.disableWhenEmpty,
|
|
79
|
+
autosuggestionsConfig.disabled
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
// sync autosuggestions state with the editor
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
clearAutocompletionsFromEditor(editor);
|
|
85
|
+
if (currentAutocompleteSuggestion) {
|
|
86
|
+
addAutocompletionsToEditor(
|
|
87
|
+
editor,
|
|
88
|
+
currentAutocompleteSuggestion.text,
|
|
89
|
+
currentAutocompleteSuggestion.point
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}, [currentAutocompleteSuggestion]);
|
|
93
|
+
|
|
94
|
+
const suggestionStyleAugmented: React.CSSProperties = useMemo(() => {
|
|
95
|
+
return {
|
|
96
|
+
fontStyle: "italic",
|
|
97
|
+
color: "gray",
|
|
98
|
+
...props.suggestionsStyle,
|
|
99
|
+
};
|
|
100
|
+
}, [props.suggestionsStyle]);
|
|
101
|
+
|
|
102
|
+
useAddBrandingCss(suggestionStyleAugmented, props.disableBranding);
|
|
103
|
+
|
|
104
|
+
const renderElementMemoized = useMemo(() => {
|
|
105
|
+
return makeRenderElementFunction(suggestionStyleAugmented);
|
|
106
|
+
}, [suggestionStyleAugmented]);
|
|
107
|
+
|
|
108
|
+
const renderPlaceholderMemoized = useMemo(() => {
|
|
109
|
+
// For some reason slateJS specifies a top value of 0, which makes for strange styling. We override this here.
|
|
110
|
+
const placeholderStyleSlatejsOverrides: React.CSSProperties = {
|
|
111
|
+
top: undefined,
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const placeholderStyleAugmented: React.CSSProperties = {
|
|
115
|
+
...placeholderStyleSlatejsOverrides,
|
|
116
|
+
...props.placeholderStyle,
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
return makeRenderPlaceholderFunction(placeholderStyleAugmented);
|
|
120
|
+
}, [props.placeholderStyle]);
|
|
121
|
+
|
|
122
|
+
// update the editor text, but only when the value changes from outside the component
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
if (props.value === lastKnownFullEditorText) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
setLastKnownFullEditorText(props.value ?? "");
|
|
129
|
+
replaceEditorText(editor, props.value ?? "");
|
|
130
|
+
}, [props.value]);
|
|
131
|
+
|
|
132
|
+
// separate into TextareaHTMLAttributes<HTMLDivElement> and CopilotTextareaProps
|
|
133
|
+
const {
|
|
134
|
+
placeholderStyle,
|
|
135
|
+
value,
|
|
136
|
+
onValueChange,
|
|
137
|
+
autosuggestionsConfig: autosuggestionsConfigFromProps,
|
|
138
|
+
autosuggestionsFunction,
|
|
139
|
+
className,
|
|
140
|
+
onChange,
|
|
141
|
+
onKeyDown,
|
|
142
|
+
...propsToForward
|
|
143
|
+
} = props;
|
|
144
|
+
|
|
145
|
+
const moddedClassName = (() => {
|
|
146
|
+
const baseClassName = "copilot-textarea";
|
|
147
|
+
const brandingClass = props.disableBranding
|
|
148
|
+
? "no-branding"
|
|
149
|
+
: "with-branding";
|
|
150
|
+
const defaultTailwindClassName = "bg-white overflow-y-auto resize-y";
|
|
151
|
+
const mergedClassName = twMerge(
|
|
152
|
+
defaultTailwindClassName,
|
|
153
|
+
className ?? ""
|
|
154
|
+
);
|
|
155
|
+
return `${baseClassName} ${brandingClass} ${mergedClassName}`;
|
|
156
|
+
})();
|
|
157
|
+
|
|
158
|
+
usePopulateCopilotTextareaRef(editor, ref);
|
|
94
159
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
160
|
+
return (
|
|
161
|
+
<Slate
|
|
162
|
+
editor={editor}
|
|
163
|
+
initialValue={initialValue}
|
|
164
|
+
onChange={(value) => {
|
|
165
|
+
const newEditorState = getTextAroundCursor(editor);
|
|
98
166
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
top: undefined,
|
|
103
|
-
};
|
|
167
|
+
const fullEditorText = newEditorState
|
|
168
|
+
? newEditorState.textBeforeCursor + newEditorState.textAfterCursor
|
|
169
|
+
: getFullEditorTextWithNewlines(editor); // we don't double-parse the editor. When `newEditorState` is null, we didn't parse the editor yet.
|
|
104
170
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
...props.placeholderStyle,
|
|
108
|
-
};
|
|
171
|
+
setLastKnownFullEditorText(fullEditorText);
|
|
172
|
+
onChangeHandlerForAutocomplete(newEditorState);
|
|
109
173
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
// update the editor text, but only when the value changes from outside the component
|
|
114
|
-
useEffect(() => {
|
|
115
|
-
if (props.value === lastKnownFullEditorText) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
setLastKnownFullEditorText(props.value ?? "");
|
|
120
|
-
replaceEditorText(editor, props.value ?? "");
|
|
121
|
-
}, [props.value]);
|
|
122
|
-
|
|
123
|
-
// separate into TextareaHTMLAttributes<HTMLDivElement> and CopilotTextareaProps
|
|
124
|
-
const {
|
|
125
|
-
placeholderStyle,
|
|
126
|
-
value,
|
|
127
|
-
onValueChange,
|
|
128
|
-
autosuggestionsConfig: autosuggestionsConfigFromProps,
|
|
129
|
-
autosuggestionsFunction,
|
|
130
|
-
className,
|
|
131
|
-
onChange,
|
|
132
|
-
onKeyDown,
|
|
133
|
-
...propsToForward
|
|
134
|
-
} = props;
|
|
135
|
-
|
|
136
|
-
const moddedClassName = (() => {
|
|
137
|
-
const baseClassName = "copilot-textarea";
|
|
138
|
-
const brandingClass = props.disableBranding
|
|
139
|
-
? "no-branding"
|
|
140
|
-
: "with-branding";
|
|
141
|
-
const defaultTailwindClassName = "bg-white overflow-y-auto resize-y";
|
|
142
|
-
const mergedClassName = twMerge(defaultTailwindClassName, className ?? "");
|
|
143
|
-
return `${baseClassName} ${brandingClass} ${mergedClassName}`;
|
|
144
|
-
})();
|
|
145
|
-
|
|
146
|
-
return (
|
|
147
|
-
// Add the editable component inside the context.
|
|
148
|
-
<Slate
|
|
149
|
-
editor={editor}
|
|
150
|
-
initialValue={initialValue}
|
|
151
|
-
onChange={(value) => {
|
|
152
|
-
const newEditorState = getTextAroundCursor(editor);
|
|
153
|
-
|
|
154
|
-
const fullEditorText = newEditorState
|
|
155
|
-
? newEditorState.textBeforeCursor + newEditorState.textAfterCursor
|
|
156
|
-
: getFullEditorTextWithNewlines(editor); // we don't double-parse the editor. When `newEditorState` is null, we didn't parse the editor yet.
|
|
157
|
-
|
|
158
|
-
setLastKnownFullEditorText(fullEditorText);
|
|
159
|
-
onChangeHandlerForAutocomplete(newEditorState);
|
|
160
|
-
|
|
161
|
-
props.onValueChange?.(fullEditorText);
|
|
162
|
-
props.onChange?.(makeSemiFakeReactTextAreaEvent(fullEditorText));
|
|
163
|
-
}}
|
|
164
|
-
>
|
|
165
|
-
<Editable
|
|
166
|
-
renderElement={renderElementMemoized}
|
|
167
|
-
renderPlaceholder={renderPlaceholderMemoized}
|
|
168
|
-
onKeyDown={(event) => {
|
|
169
|
-
onKeyDownHandlerForAutocomplete(event); // forward the event for internal use
|
|
170
|
-
props.onKeyDown?.(event); // forward the event for external use
|
|
174
|
+
props.onValueChange?.(fullEditorText);
|
|
175
|
+
props.onChange?.(makeSemiFakeReactTextAreaEvent(fullEditorText));
|
|
171
176
|
}}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
177
|
+
>
|
|
178
|
+
<Editable
|
|
179
|
+
renderElement={renderElementMemoized}
|
|
180
|
+
renderPlaceholder={renderPlaceholderMemoized}
|
|
181
|
+
onKeyDown={(event) => {
|
|
182
|
+
onKeyDownHandlerForAutocomplete(event); // forward the event for internal use
|
|
183
|
+
props.onKeyDown?.(event); // forward the event for external use
|
|
184
|
+
}}
|
|
185
|
+
className={moddedClassName}
|
|
186
|
+
{...propsToForward}
|
|
187
|
+
/>
|
|
188
|
+
</Slate>
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
);
|
|
178
192
|
|
|
179
193
|
// Consumers of <textarea> expect a `onChange: (React.ChangeEvent<HTMLTextAreaElement>) => void` event handler to be passed in.
|
|
180
194
|
// This is *extremely* common, and we want to support it.
|
|
@@ -4,11 +4,14 @@ export function useAddBrandingCss(
|
|
|
4
4
|
suggestionStyleAugmented: React.CSSProperties,
|
|
5
5
|
disableBranding: boolean | undefined
|
|
6
6
|
) {
|
|
7
|
+
const cssSelector = ".copilot-textarea.with-branding";
|
|
7
8
|
useEffect(() => {
|
|
8
9
|
if (disableBranding) {
|
|
9
10
|
return;
|
|
10
11
|
}
|
|
11
12
|
|
|
13
|
+
// ---
|
|
14
|
+
// 1: Add the CSS to the DOM
|
|
12
15
|
const styleEl = document.createElement("style");
|
|
13
16
|
styleEl.id = "dynamic-styles";
|
|
14
17
|
|
|
@@ -36,16 +39,37 @@ export function useAddBrandingCss(
|
|
|
36
39
|
|
|
37
40
|
// Append it to the ::after class
|
|
38
41
|
styleEl.innerHTML = `
|
|
39
|
-
|
|
42
|
+
${cssSelector}::after {
|
|
40
43
|
${dynamicStyles}
|
|
41
44
|
}
|
|
42
45
|
`;
|
|
43
46
|
|
|
44
47
|
document.head.appendChild(styleEl);
|
|
45
48
|
|
|
49
|
+
// ---
|
|
50
|
+
// 2: Add the scroll listener (to keep the branding in the bottom right as the textarea scrolls)
|
|
51
|
+
const textarea = document.querySelector(cssSelector);
|
|
52
|
+
const handleScroll = () => {
|
|
53
|
+
const styleEl = document.getElementById("dynamic-styles");
|
|
54
|
+
if (styleEl && textarea) {
|
|
55
|
+
const offsetFromBottom = -textarea.scrollTop + 6;
|
|
56
|
+
const offsetFromRight = -textarea.scrollLeft + 6;
|
|
57
|
+
styleEl.innerHTML = `
|
|
58
|
+
${cssSelector}::after {
|
|
59
|
+
${dynamicStyles}
|
|
60
|
+
bottom: ${offsetFromBottom}px;
|
|
61
|
+
right: ${offsetFromRight}px;
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
textarea?.addEventListener("scroll", handleScroll);
|
|
68
|
+
|
|
46
69
|
// Cleanup
|
|
47
70
|
return () => {
|
|
48
71
|
document.getElementById("dynamic-styles")?.remove();
|
|
72
|
+
textarea?.removeEventListener("scroll", handleScroll);
|
|
49
73
|
};
|
|
50
74
|
}, [disableBranding, suggestionStyleAugmented]);
|
|
51
75
|
}
|