@copilotkit/react-textarea 1.1.3-feat-runtime-remote-actions.2 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -19
- package/dist/components/base-copilot-textarea/base-copilot-textarea.d.mts +43 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.d.ts +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js +49 -114
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +1687 -36
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-element.d.mts +6 -0
- package/dist/components/base-copilot-textarea/render-element.d.ts +1 -1
- package/dist/components/base-copilot-textarea/render-element.mjs +48 -4
- package/dist/components/base-copilot-textarea/render-element.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.d.mts +6 -0
- package/dist/components/base-copilot-textarea/render-placeholder.d.ts +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.mjs +46 -4
- 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.d.mts +8 -0
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js +2 -4
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js.map +1 -1
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +81 -5
- 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.d.mts +3 -0
- package/dist/components/base-copilot-textarea/use-add-branding-css.js.map +1 -1
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +54 -4
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.d.mts +165 -0
- package/dist/components/copilot-textarea/copilot-textarea.d.ts +2 -8
- package/dist/components/copilot-textarea/copilot-textarea.js +55 -119
- package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.mjs +2211 -44
- package/dist/components/copilot-textarea/copilot-textarea.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.d.mts +18 -0
- package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +13 -5
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.d.mts +17 -0
- package/dist/components/hovering-toolbar/hovering-toolbar-components.d.ts +1 -2
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js +0 -21
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +111 -9
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.d.mts +12 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.d.ts +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.js +31 -94
- package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +808 -19
- 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.d.mts +16 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.d.ts +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +21 -65
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +520 -14
- 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.d.mts +14 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.d.ts +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +24 -68
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +543 -15
- 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/index.d.mts +4 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +24 -68
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +543 -16
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +1 -1
- package/dist/components/index.d.mts +15 -0
- package/dist/components/index.js +55 -119
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2210 -46
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/manual-ui/chip-with-icon.d.mts +10 -0
- package/dist/components/manual-ui/chip-with-icon.d.ts +1 -1
- package/dist/components/manual-ui/chip-with-icon.mjs +0 -2
- package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -1
- package/dist/components/source-search-box/source-search-box.d.mts +16 -0
- package/dist/components/source-search-box/source-search-box.d.ts +1 -1
- package/dist/components/source-search-box/source-search-box.js +2 -4
- package/dist/components/source-search-box/source-search-box.js.map +1 -1
- package/dist/components/source-search-box/source-search-box.mjs +200 -8
- package/dist/components/source-search-box/source-search-box.mjs.map +1 -1
- package/dist/components/ui/button.d.mts +14 -0
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/button.mjs +76 -6
- package/dist/components/ui/button.mjs.map +1 -1
- package/dist/components/ui/command.d.mts +53 -0
- package/dist/components/ui/command.mjs +233 -14
- package/dist/components/ui/command.mjs.map +1 -1
- package/dist/components/ui/dialog.d.mts +19 -0
- package/dist/components/ui/dialog.mjs +135 -11
- package/dist/components/ui/dialog.mjs.map +1 -1
- package/dist/components/ui/label.d.mts +8 -0
- package/dist/components/ui/label.mjs +51 -5
- package/dist/components/ui/label.mjs.map +1 -1
- package/dist/context/index.d.mts +2 -0
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.mjs +0 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.mts +15 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.ts +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +152 -7
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.d.mts +8 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +165 -5
- 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.d.mts +7 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +141 -6
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map +1 -1
- package/dist/hooks/index.d.mts +2 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.mjs +0 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.mts +22 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js +2 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +139 -4
- 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.d.mts +23 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js +2 -2
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +220 -4
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs.map +1 -1
- package/dist/hooks/misc/use-autosize-textarea.d.mts +5 -0
- package/dist/hooks/misc/use-autosize-textarea.mjs +12 -4
- package/dist/hooks/misc/use-autosize-textarea.mjs.map +1 -1
- package/dist/index.css +1 -644
- package/dist/index.d.mts +15 -0
- package/dist/index.js +62 -119
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2217 -54
- package/dist/index.mjs.map +1 -1
- package/dist/lib/debouncer.d.mts +11 -0
- package/dist/lib/debouncer.d.ts +1 -1
- package/dist/lib/debouncer.js.map +1 -1
- package/dist/lib/debouncer.mjs +48 -4
- package/dist/lib/debouncer.mjs.map +1 -1
- package/dist/lib/editor-to-text.d.mts +7 -0
- package/dist/lib/editor-to-text.mjs +40 -4
- package/dist/lib/editor-to-text.mjs.map +1 -1
- package/dist/lib/get-text-around-cursor.d.mts +15 -0
- package/dist/lib/get-text-around-cursor.d.ts +1 -1
- package/dist/lib/get-text-around-cursor.mjs +96 -7
- package/dist/lib/get-text-around-cursor.mjs.map +1 -1
- package/dist/lib/retry.d.mts +3 -0
- package/dist/lib/retry.mjs +14 -4
- package/dist/lib/retry.mjs.map +1 -1
- package/dist/lib/slatejs-edits/add-autocompletions.d.mts +8 -0
- package/dist/lib/slatejs-edits/add-autocompletions.mjs +22 -4
- package/dist/lib/slatejs-edits/add-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.d.mts +8 -0
- package/dist/lib/slatejs-edits/clear-autocompletions.js.map +1 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs +17 -4
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/replace-text.d.mts +5 -0
- package/dist/lib/slatejs-edits/replace-text.mjs +24 -4
- package/dist/lib/slatejs-edits/replace-text.mjs.map +1 -1
- package/dist/lib/slatejs-edits/with-partial-history.d.mts +8 -0
- package/dist/lib/slatejs-edits/with-partial-history.d.ts +1 -1
- package/dist/lib/slatejs-edits/with-partial-history.mjs +102 -5
- package/dist/lib/slatejs-edits/with-partial-history.mjs.map +1 -1
- package/dist/lib/stream-promise-flatten.d.mts +12 -0
- package/dist/lib/stream-promise-flatten.js.map +1 -1
- package/dist/lib/stream-promise-flatten.mjs +44 -4
- package/dist/lib/stream-promise-flatten.mjs.map +1 -1
- package/dist/lib/utils.d.mts +9 -0
- package/dist/lib/utils.mjs +58 -8
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/lib/utils.test.d.mts +2 -0
- package/dist/lib/utils.test.d.ts +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.mts +23 -0
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.ts +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.d.mts +20 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.d.ts +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.js.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +258 -9
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.d.mts +15 -0
- package/dist/types/autosuggestions-config/editing-api-config.d.ts +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.mjs +75 -6
- package/dist/types/autosuggestions-config/editing-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/index.d.mts +10 -0
- package/dist/types/autosuggestions-config/index.js.map +1 -1
- package/dist/types/autosuggestions-config/index.mjs +258 -10
- package/dist/types/autosuggestions-config/index.mjs.map +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.d.mts +15 -0
- package/dist/types/autosuggestions-config/insertions-api-config.d.ts +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.mjs +68 -6
- package/dist/types/autosuggestions-config/insertions-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.d.mts +3 -0
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.d.ts +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.d.mts +14 -0
- package/dist/types/autosuggestions-config/suggestions-api-config.d.ts +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs +56 -6
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs.map +1 -1
- package/dist/types/base/autosuggestion-state.d.mts +8 -0
- package/dist/types/base/autosuggestion-state.d.ts +1 -1
- package/dist/types/base/autosuggestions-bare-function.d.mts +19 -0
- package/dist/types/base/autosuggestions-bare-function.d.ts +1 -1
- package/dist/types/base/base-autosuggestions-config.d.mts +83 -0
- package/dist/types/base/base-autosuggestions-config.d.ts +1 -1
- package/dist/types/base/base-autosuggestions-config.mjs +25 -4
- package/dist/types/base/base-autosuggestions-config.mjs.map +1 -1
- package/dist/types/base/base-copilot-textarea-props.d.mts +5 -0
- package/dist/types/base/custom-editor.d.mts +29 -0
- package/dist/types/base/custom-editor.d.ts +1 -1
- package/dist/types/base/editor-autocomplete-state.d.mts +10 -0
- package/dist/types/base/editor-autocomplete-state.d.ts +1 -1
- package/dist/types/base/editor-autocomplete-state.mjs +9 -5
- package/dist/types/base/editor-autocomplete-state.mjs.map +1 -1
- package/dist/types/base/index.d.mts +54 -0
- package/dist/types/base/index.d.ts +1 -1
- package/dist/types/base/index.mjs +25 -5
- package/dist/types/base/index.mjs.map +1 -1
- package/dist/types/html-copilot-textarea-element.d.mts +7 -0
- package/dist/types/html-copilot-textarea-element.d.ts +1 -1
- package/dist/types/html-copilot-textarea-element.mjs +0 -1
- package/dist/types/index.d.mts +13 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +258 -14
- package/dist/types/index.mjs.map +1 -1
- package/package.json +17 -11
- package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +0 -1
- package/src/components/copilot-textarea/copilot-textarea.tsx +1 -7
- package/src/components/hovering-toolbar/hovering-toolbar-components.tsx +0 -17
- package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +4 -7
- package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +2 -2
- package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +2 -3
- package/src/styles.css +9 -2
- package/tsup.config.ts +63 -15
- package/dist/chunk-224UKA7C.mjs +0 -38
- package/dist/chunk-224UKA7C.mjs.map +0 -1
- package/dist/chunk-23Q6A46J.mjs +0 -103
- package/dist/chunk-23Q6A46J.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 -32
- package/dist/chunk-2QDCE7PD.mjs.map +0 -1
- package/dist/chunk-2XDYLKPH.mjs +0 -181
- package/dist/chunk-2XDYLKPH.mjs.map +0 -1
- package/dist/chunk-3PQ7GSFE.mjs +0 -17
- package/dist/chunk-3PQ7GSFE.mjs.map +0 -1
- package/dist/chunk-4AMCUMC7.mjs +0 -124
- package/dist/chunk-4AMCUMC7.mjs.map +0 -1
- package/dist/chunk-4CVSOOJY.mjs +0 -30
- package/dist/chunk-4CVSOOJY.mjs.map +0 -1
- package/dist/chunk-4NHVQZ67.mjs +0 -108
- package/dist/chunk-4NHVQZ67.mjs.map +0 -1
- package/dist/chunk-4PDYALMP.mjs +0 -52
- package/dist/chunk-4PDYALMP.mjs.map +0 -1
- package/dist/chunk-5UNJXFUO.mjs +0 -29
- package/dist/chunk-5UNJXFUO.mjs.map +0 -1
- package/dist/chunk-7LSRNPNI.mjs +0 -59
- package/dist/chunk-7LSRNPNI.mjs.map +0 -1
- package/dist/chunk-AJ5OMEXM.mjs +0 -13
- package/dist/chunk-AJ5OMEXM.mjs.map +0 -1
- package/dist/chunk-CF5GISTC.mjs +0 -113
- package/dist/chunk-CF5GISTC.mjs.map +0 -1
- package/dist/chunk-D2SUDM2O.mjs +0 -99
- package/dist/chunk-D2SUDM2O.mjs.map +0 -1
- package/dist/chunk-D47EKHIF.mjs +0 -26
- package/dist/chunk-D47EKHIF.mjs.map +0 -1
- package/dist/chunk-DE5K76I2.mjs +0 -1
- package/dist/chunk-DE5K76I2.mjs.map +0 -1
- package/dist/chunk-DFTV4TST.mjs +0 -36
- package/dist/chunk-DFTV4TST.mjs.map +0 -1
- package/dist/chunk-DRV2FOHZ.mjs +0 -70
- package/dist/chunk-DRV2FOHZ.mjs.map +0 -1
- package/dist/chunk-ECR45NSD.mjs +0 -104
- package/dist/chunk-ECR45NSD.mjs.map +0 -1
- package/dist/chunk-EJGGLWWR.mjs +0 -82
- package/dist/chunk-EJGGLWWR.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 -1
- package/dist/chunk-H4VKQGVU.mjs.map +0 -1
- package/dist/chunk-HL7EF7KA.mjs +0 -32
- package/dist/chunk-HL7EF7KA.mjs.map +0 -1
- package/dist/chunk-I3SPIGAI.mjs +0 -31
- package/dist/chunk-I3SPIGAI.mjs.map +0 -1
- package/dist/chunk-I72DKFHD.mjs +0 -114
- package/dist/chunk-I72DKFHD.mjs.map +0 -1
- package/dist/chunk-IU3WTXLQ.mjs +0 -1
- package/dist/chunk-IU3WTXLQ.mjs.map +0 -1
- package/dist/chunk-J62KUPFZ.mjs +0 -264
- package/dist/chunk-J62KUPFZ.mjs.map +0 -1
- package/dist/chunk-KMVGEY7Q.mjs +0 -51
- package/dist/chunk-KMVGEY7Q.mjs.map +0 -1
- package/dist/chunk-KNQIEOFP.mjs +0 -19
- package/dist/chunk-KNQIEOFP.mjs.map +0 -1
- package/dist/chunk-L7VVZH4Q.mjs +0 -1
- package/dist/chunk-L7VVZH4Q.mjs.map +0 -1
- package/dist/chunk-LQ2OWQU7.mjs +0 -49
- package/dist/chunk-LQ2OWQU7.mjs.map +0 -1
- package/dist/chunk-LYB4B6MK.mjs +0 -19
- package/dist/chunk-LYB4B6MK.mjs.map +0 -1
- package/dist/chunk-MCNXIA4Q.mjs +0 -75
- package/dist/chunk-MCNXIA4Q.mjs.map +0 -1
- package/dist/chunk-MMVDU6DF.mjs +0 -1
- package/dist/chunk-MMVDU6DF.mjs.map +0 -1
- package/dist/chunk-MRXNTQOX.mjs +0 -59
- package/dist/chunk-MRXNTQOX.mjs.map +0 -1
- package/dist/chunk-OFPAO25A.mjs +0 -60
- package/dist/chunk-OFPAO25A.mjs.map +0 -1
- package/dist/chunk-QJNFNPWH.mjs +0 -85
- package/dist/chunk-QJNFNPWH.mjs.map +0 -1
- package/dist/chunk-RUV6NBIF.mjs +0 -1
- package/dist/chunk-RUV6NBIF.mjs.map +0 -1
- package/dist/chunk-SDHH6DI6.mjs +0 -63
- package/dist/chunk-SDHH6DI6.mjs.map +0 -1
- package/dist/chunk-T6MTDQZ7.mjs +0 -45
- package/dist/chunk-T6MTDQZ7.mjs.map +0 -1
- package/dist/chunk-UGEKMSRR.mjs +0 -225
- package/dist/chunk-UGEKMSRR.mjs.map +0 -1
- package/dist/chunk-VSVQZUPW.mjs +0 -124
- package/dist/chunk-VSVQZUPW.mjs.map +0 -1
- package/dist/chunk-WADHCMPK.mjs +0 -1
- package/dist/chunk-WADHCMPK.mjs.map +0 -1
- package/dist/chunk-WGWQRALG.mjs +0 -83
- package/dist/chunk-WGWQRALG.mjs.map +0 -1
- package/dist/chunk-WJHSY5T6.mjs +0 -1
- package/dist/chunk-WJHSY5T6.mjs.map +0 -1
- package/dist/chunk-XW3ICO4S.mjs +0 -25
- package/dist/chunk-XW3ICO4S.mjs.map +0 -1
- package/dist/chunk-YLFAIYRY.mjs +0 -50
- package/dist/chunk-YLFAIYRY.mjs.map +0 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.css +0 -9
- package/dist/components/base-copilot-textarea/base-copilot-textarea.css.map +0 -1
- package/dist/components/copilot-textarea/copilot-textarea.css +0 -9
- package/dist/components/copilot-textarea/copilot-textarea.css.map +0 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.d.ts +0 -16
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js +0 -133
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js.map +0 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +0 -12
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs.map +0 -1
- package/dist/components/index.css +0 -9
- package/dist/components/index.css.map +0 -1
- package/dist/index.css.map +0 -1
- package/src/components/base-copilot-textarea/base-copilot-textarea.css +0 -9
- package/src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx +0 -55
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/types/autosuggestions-config/suggestions-api-config.tsx"],"sourcesContent":["import { Message, Role, TextMessage } from \"@copilotkit/runtime-client-gql\";\nimport { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\n\nexport interface SuggestionsApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: Message[];\n maxTokens?: number;\n stop?: string[];\n}\n\nexport const defaultSuggestionsMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString,\n) => {\n return `You are a versatile writing assistant.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nYour job is to guess what the user will write next AS BEST YOU CAN.\nOnly guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.\n\nAdjust yourself to the user's style and implied intent.\n\nThe user will provide both the text before and after the cursor. You should use this to infer what the user is likely to write next.\n<TextAfterCursor>\n<TextBeforeCursor>\n<YourSuggestion>\n\nIf we need to add a whitespace character to the suggested text, make sure to explicitly add it in.\n\nThe following external context is also provided. Use it to help you make better suggestions!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n`;\n};\n\nexport const defaultSuggestionsFewShotMessages: Message[] = [\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content: \"This morning I woke up and went straight to the grocery store.\",\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n \" When I arrived I went straight to the produce section and picked out a big watermelon. \",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n '<TextBeforeCursor>The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;</TextBeforeCursor>',\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n }),\n];\n\nexport const defaultSuggestionsApiConfig: SuggestionsApiConfig = {\n makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,\n fewShotMessages: defaultSuggestionsFewShotMessages,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAA2C;AAUpC,IAAM,qCAAuD,CAClE,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/types/autosuggestions-config/suggestions-api-config.tsx"],"sourcesContent":["import { Message, Role, TextMessage } from \"@copilotkit/runtime-client-gql\";\nimport { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\n\nexport interface SuggestionsApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: Message[];\n maxTokens?: number;\n stop?: string[];\n}\n\nexport const defaultSuggestionsMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString,\n) => {\n return `You are a versatile writing assistant.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nYour job is to guess what the user will write next AS BEST YOU CAN.\nOnly guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.\n\nAdjust yourself to the user's style and implied intent.\n\nThe user will provide both the text before and after the cursor. You should use this to infer what the user is likely to write next.\n<TextAfterCursor>\n<TextBeforeCursor>\n<YourSuggestion>\n\nIf we need to add a whitespace character to the suggested text, make sure to explicitly add it in.\n\nThe following external context is also provided. Use it to help you make better suggestions!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n`;\n};\n\nexport const defaultSuggestionsFewShotMessages: Message[] = [\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content: \"This morning I woke up and went straight to the grocery store.\",\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n \" When I arrived I went straight to the produce section and picked out a big watermelon. \",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n '<TextBeforeCursor>The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;</TextBeforeCursor>',\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n }),\n];\n\nexport const defaultSuggestionsApiConfig: SuggestionsApiConfig = {\n makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,\n fewShotMessages: defaultSuggestionsFewShotMessages,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAA2C;AAUpC,IAAM,qCAAuD,CAClE,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBjC,aAAa;AAAA;AAAA;AAGf;AAEO,IAAM,oCAA+C;AAAA,EAC1D,IAAI,sCAAY;AAAA,IACd,MAAM,+BAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,sCAAY;AAAA,IACd,MAAM,+BAAK;AAAA,IACX,SAAS;AAAA,EACX,CAAC;AAAA,EACD,IAAI,sCAAY;AAAA,IACd,MAAM,+BAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,sCAAY;AAAA,IACd,MAAM,+BAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,sCAAY;AAAA,IACd,MAAM,+BAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,sCAAY;AAAA,IACd,MAAM,+BAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AACH;AAEO,IAAM,8BAAoD;AAAA,EAC/D,kBAAkB;AAAA,EAClB,iBAAiB;AACnB;","names":[]}
|
|
@@ -1,9 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
// src/types/autosuggestions-config/suggestions-api-config.tsx
|
|
2
|
+
import { Role, TextMessage } from "@copilotkit/runtime-client-gql";
|
|
3
|
+
var defaultSuggestionsMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
4
|
+
return `You are a versatile writing assistant.
|
|
5
|
+
|
|
6
|
+
The user is writing some text.
|
|
7
|
+
The purpose is: "${textareaPurpose}"
|
|
8
|
+
|
|
9
|
+
Your job is to guess what the user will write next AS BEST YOU CAN.
|
|
10
|
+
Only guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.
|
|
11
|
+
|
|
12
|
+
Adjust yourself to the user's style and implied intent.
|
|
13
|
+
|
|
14
|
+
The user will provide both the text before and after the cursor. You should use this to infer what the user is likely to write next.
|
|
15
|
+
<TextAfterCursor>
|
|
16
|
+
<TextBeforeCursor>
|
|
17
|
+
<YourSuggestion>
|
|
18
|
+
|
|
19
|
+
If we need to add a whitespace character to the suggested text, make sure to explicitly add it in.
|
|
20
|
+
|
|
21
|
+
The following external context is also provided. Use it to help you make better suggestions!!!
|
|
22
|
+
\`\`\`
|
|
23
|
+
${contextString}
|
|
24
|
+
\`\`\`
|
|
25
|
+
`;
|
|
26
|
+
};
|
|
27
|
+
var defaultSuggestionsFewShotMessages = [
|
|
28
|
+
new TextMessage({
|
|
29
|
+
role: Role.User,
|
|
30
|
+
content: "<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>"
|
|
31
|
+
}),
|
|
32
|
+
new TextMessage({
|
|
33
|
+
role: Role.User,
|
|
34
|
+
content: "This morning I woke up and went straight to the grocery store."
|
|
35
|
+
}),
|
|
36
|
+
new TextMessage({
|
|
37
|
+
role: Role.Assistant,
|
|
38
|
+
content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
|
|
39
|
+
}),
|
|
40
|
+
new TextMessage({
|
|
41
|
+
role: Role.User,
|
|
42
|
+
content: "<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>"
|
|
43
|
+
}),
|
|
44
|
+
new TextMessage({
|
|
45
|
+
role: Role.User,
|
|
46
|
+
content: `<TextBeforeCursor>The Optionholder, in the Optionholder's capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an "Equityholder" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an "Equityholder" thereunder;</TextBeforeCursor>`
|
|
47
|
+
}),
|
|
48
|
+
new TextMessage({
|
|
49
|
+
role: Role.Assistant,
|
|
50
|
+
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"; `
|
|
51
|
+
})
|
|
52
|
+
];
|
|
53
|
+
var defaultSuggestionsApiConfig = {
|
|
54
|
+
makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,
|
|
55
|
+
fewShotMessages: defaultSuggestionsFewShotMessages
|
|
56
|
+
};
|
|
7
57
|
export {
|
|
8
58
|
defaultSuggestionsApiConfig,
|
|
9
59
|
defaultSuggestionsFewShotMessages,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/types/autosuggestions-config/suggestions-api-config.tsx"],"sourcesContent":["import { Message, Role, TextMessage } from \"@copilotkit/runtime-client-gql\";\nimport { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\n\nexport interface SuggestionsApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: Message[];\n maxTokens?: number;\n stop?: string[];\n}\n\nexport const defaultSuggestionsMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString,\n) => {\n return `You are a versatile writing assistant.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nYour job is to guess what the user will write next AS BEST YOU CAN.\nOnly guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.\n\nAdjust yourself to the user's style and implied intent.\n\nThe user will provide both the text before and after the cursor. You should use this to infer what the user is likely to write next.\n<TextAfterCursor>\n<TextBeforeCursor>\n<YourSuggestion>\n\nIf we need to add a whitespace character to the suggested text, make sure to explicitly add it in.\n\nThe following external context is also provided. Use it to help you make better suggestions!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n`;\n};\n\nexport const defaultSuggestionsFewShotMessages: Message[] = [\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content: \"This morning I woke up and went straight to the grocery store.\",\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n \" When I arrived I went straight to the produce section and picked out a big watermelon. \",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n '<TextBeforeCursor>The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;</TextBeforeCursor>',\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n }),\n];\n\nexport const defaultSuggestionsApiConfig: SuggestionsApiConfig = {\n makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,\n fewShotMessages: defaultSuggestionsFewShotMessages,\n};\n"],"mappings":";AAAA,SAAkB,MAAM,mBAAmB;AAUpC,IAAM,qCAAuD,CAClE,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBjC,aAAa;AAAA;AAAA;AAGf;AAEO,IAAM,oCAA+C;AAAA,EAC1D,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SAAS;AAAA,EACX,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AACH;AAEO,IAAM,8BAAoD;AAAA,EAC/D,kBAAkB;AAAA,EAClB,iBAAiB;AACnB;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DocumentPointer } from '@copilotkit/react-core';
|
|
2
|
+
|
|
3
|
+
interface InsertionEditorState {
|
|
4
|
+
textBeforeCursor: string;
|
|
5
|
+
textAfterCursor: string;
|
|
6
|
+
}
|
|
7
|
+
interface EditingEditorState extends InsertionEditorState {
|
|
8
|
+
selectedText: string;
|
|
9
|
+
}
|
|
10
|
+
type AutosuggestionsBareFunction = (editorState: InsertionEditorState, abortSignal: AbortSignal) => Promise<string>;
|
|
11
|
+
type Generator_InsertionOrEditingSuggestion = (editorState: EditingEditorState, prompt: string, documents: DocumentPointer[], abortSignal: AbortSignal) => Promise<ReadableStream<string>>;
|
|
12
|
+
interface InsertionEditorApiConfig {
|
|
13
|
+
insertionOrEditingFunction: Generator_InsertionOrEditingSuggestion;
|
|
14
|
+
}
|
|
15
|
+
interface BaseCopilotTextareaApiConfig extends InsertionEditorApiConfig {
|
|
16
|
+
autosuggestionsFunction: AutosuggestionsBareFunction;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type { AutosuggestionsBareFunction, BaseCopilotTextareaApiConfig, EditingEditorState, Generator_InsertionOrEditingSuggestion, InsertionEditorApiConfig, InsertionEditorState };
|
|
@@ -16,4 +16,4 @@ interface BaseCopilotTextareaApiConfig extends InsertionEditorApiConfig {
|
|
|
16
16
|
autosuggestionsFunction: AutosuggestionsBareFunction;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export { AutosuggestionsBareFunction, BaseCopilotTextareaApiConfig, EditingEditorState, Generator_InsertionOrEditingSuggestion, InsertionEditorApiConfig, InsertionEditorState };
|
|
19
|
+
export type { AutosuggestionsBareFunction, BaseCopilotTextareaApiConfig, EditingEditorState, Generator_InsertionOrEditingSuggestion, InsertionEditorApiConfig, InsertionEditorState };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { BaseCopilotTextareaApiConfig } from './autosuggestions-bare-function.mjs';
|
|
2
|
+
import '@copilotkit/react-core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @interface BaseAutosuggestionsConfig
|
|
6
|
+
*
|
|
7
|
+
* @property {string} textareaPurpose - The purpose of the textarea. This is used to guide the autosuggestions.
|
|
8
|
+
*
|
|
9
|
+
* @property {string[]} contextCategories - The categories of context to consider when providing autosuggestions.
|
|
10
|
+
*
|
|
11
|
+
* @property {number} debounceTime - The amount of time (in milliseconds) to wait before triggering autosuggestions after the user has stopped typing.
|
|
12
|
+
*
|
|
13
|
+
* @property {BaseCopilotTextareaApiConfig} apiConfig - The configuration for the API that provides the autosuggestions.
|
|
14
|
+
*
|
|
15
|
+
* @property {boolean} disableWhenEmpty - Whether to disable autosuggestions when the textarea is empty.
|
|
16
|
+
*
|
|
17
|
+
* @property {boolean} disabled - Whether to disable autosuggestions entirely.
|
|
18
|
+
*
|
|
19
|
+
* @property {boolean} temporarilyDisableWhenMovingCursorWithoutChangingText - Whether to temporarily disable autosuggestions when the user moves the cursor without changing the text.
|
|
20
|
+
*
|
|
21
|
+
* @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnKeyPress - A function that determines whether to accept the current autosuggestion based on a key press event. By default, the Tab key is used to accept the autosuggestion. Example code:
|
|
22
|
+
*
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const defaultShouldAcceptAutosuggestionOnKeyPress = (event: React.KeyboardEvent<HTMLDivElement>) => {
|
|
25
|
+
* // if tab, accept the autosuggestion
|
|
26
|
+
* if (event.key === "Tab") {
|
|
27
|
+
* return true;
|
|
28
|
+
* }
|
|
29
|
+
* return false;
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @property {(event: React.TouchEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnTouch - A function that determines whether to accept the current autosuggestion based on a mobile touch event. By default, the touching the end of a suggestion will accept it. Example code:
|
|
34
|
+
*
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const shouldAcceptAutosuggestionOnTouch = (event: React.TouchEvent<HTMLDivElement>) => {
|
|
37
|
+
* // if tab, accept the autosuggestion
|
|
38
|
+
* if (event.type === "touchstart") {
|
|
39
|
+
* return true;
|
|
40
|
+
* }
|
|
41
|
+
* return false;
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldToggleHoveringEditorOnKeyPress - A function that determines whether to toggle the hovering editor based on a key press event. By default, the Command + K key combination is used to toggle the hovering editor. Example code:
|
|
46
|
+
*
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const defaultShouldToggleHoveringEditorOnKeyPress = (event: React.KeyboardEvent<HTMLDivElement>) => {
|
|
49
|
+
* // if command-k, toggle the hovering editor
|
|
50
|
+
* if (event.key === "k" && event.metaKey) {
|
|
51
|
+
* return true;
|
|
52
|
+
* }
|
|
53
|
+
* return false;
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
interface BaseAutosuggestionsConfig {
|
|
58
|
+
textareaPurpose: string;
|
|
59
|
+
contextCategories: string[];
|
|
60
|
+
debounceTime: number;
|
|
61
|
+
apiConfig: BaseCopilotTextareaApiConfig;
|
|
62
|
+
disableWhenEmpty: boolean;
|
|
63
|
+
disabled: boolean;
|
|
64
|
+
temporarilyDisableWhenMovingCursorWithoutChangingText: boolean;
|
|
65
|
+
shouldAcceptAutosuggestionOnKeyPress: (event: React.KeyboardEvent<HTMLDivElement>) => boolean;
|
|
66
|
+
shouldAcceptAutosuggestionOnTouch: (event: React.TouchEvent<HTMLDivElement>) => boolean;
|
|
67
|
+
shouldToggleHoveringEditorOnKeyPress: (event: React.KeyboardEvent<HTMLDivElement>, shortcut: string) => boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Default configuration for the BaseAutosuggestions.
|
|
71
|
+
*
|
|
72
|
+
* @property {number} debounceTime - The amount of time to wait before triggering the autosuggestions API call.
|
|
73
|
+
* @property {string[]} contextCategories - The categories to use for context when making the autosuggestions API call.
|
|
74
|
+
* @property {boolean} disableWhenEmpty - Whether to disable the autosuggestions when the textarea is empty.
|
|
75
|
+
* @property {boolean} disabled - Whether to disable the autosuggestions feature entirely.
|
|
76
|
+
* @property {boolean} temporarilyDisableWhenMovingCursorWithoutChangingText - Whether to temporarily disable the autosuggestions when the cursor is moved without changing the text.
|
|
77
|
+
* @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldToggleHoveringEditorOnKeyPress - A function that determines whether to toggle the hovering editor based on a key press event.
|
|
78
|
+
* @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnKeyPress - A function that determines whether to accept the autosuggestion based on a key press event.
|
|
79
|
+
* @property {() => boolean} defaultShouldAcceptAutosuggestionOnTouch - A function that determines whether to accept the autosuggestion based on a mobile touch event.
|
|
80
|
+
*/
|
|
81
|
+
declare const defaultBaseAutosuggestionsConfig: Omit<BaseAutosuggestionsConfig, "textareaPurpose" | "apiConfig">;
|
|
82
|
+
|
|
83
|
+
export { type BaseAutosuggestionsConfig, defaultBaseAutosuggestionsConfig };
|
|
@@ -80,4 +80,4 @@ interface BaseAutosuggestionsConfig {
|
|
|
80
80
|
*/
|
|
81
81
|
declare const defaultBaseAutosuggestionsConfig: Omit<BaseAutosuggestionsConfig, "textareaPurpose" | "apiConfig">;
|
|
82
82
|
|
|
83
|
-
export { BaseAutosuggestionsConfig, defaultBaseAutosuggestionsConfig };
|
|
83
|
+
export { type BaseAutosuggestionsConfig, defaultBaseAutosuggestionsConfig };
|
|
@@ -1,7 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// src/types/base/base-autosuggestions-config.tsx
|
|
2
|
+
import { defaultCopilotContextCategories } from "@copilotkit/react-core";
|
|
3
|
+
var defaultShouldToggleHoveringEditorOnKeyPress = (event, shortcut) => {
|
|
4
|
+
if (event.key === shortcut && event.metaKey) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
return false;
|
|
8
|
+
};
|
|
9
|
+
var defaultShouldAcceptAutosuggestionOnKeyPress = (event) => {
|
|
10
|
+
if (event.key === "Tab") {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
};
|
|
15
|
+
var defaultShouldAcceptAutosuggestionOnTouch = () => false;
|
|
16
|
+
var defaultBaseAutosuggestionsConfig = {
|
|
17
|
+
debounceTime: 250,
|
|
18
|
+
contextCategories: defaultCopilotContextCategories,
|
|
19
|
+
disableWhenEmpty: true,
|
|
20
|
+
disabled: false,
|
|
21
|
+
temporarilyDisableWhenMovingCursorWithoutChangingText: true,
|
|
22
|
+
shouldToggleHoveringEditorOnKeyPress: defaultShouldToggleHoveringEditorOnKeyPress,
|
|
23
|
+
shouldAcceptAutosuggestionOnKeyPress: defaultShouldAcceptAutosuggestionOnKeyPress,
|
|
24
|
+
shouldAcceptAutosuggestionOnTouch: defaultShouldAcceptAutosuggestionOnTouch
|
|
25
|
+
};
|
|
5
26
|
export {
|
|
6
27
|
defaultBaseAutosuggestionsConfig
|
|
7
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/types/base/base-autosuggestions-config.tsx"],"sourcesContent":["import { BaseCopilotTextareaApiConfig } from \"./autosuggestions-bare-function\";\nimport { defaultCopilotContextCategories } from \"@copilotkit/react-core\";\n\n/**\n * @interface BaseAutosuggestionsConfig\n *\n * @property {string} textareaPurpose - The purpose of the textarea. This is used to guide the autosuggestions.\n *\n * @property {string[]} contextCategories - The categories of context to consider when providing autosuggestions.\n *\n * @property {number} debounceTime - The amount of time (in milliseconds) to wait before triggering autosuggestions after the user has stopped typing.\n *\n * @property {BaseCopilotTextareaApiConfig} apiConfig - The configuration for the API that provides the autosuggestions.\n *\n * @property {boolean} disableWhenEmpty - Whether to disable autosuggestions when the textarea is empty.\n *\n * @property {boolean} disabled - Whether to disable autosuggestions entirely.\n *\n * @property {boolean} temporarilyDisableWhenMovingCursorWithoutChangingText - Whether to temporarily disable autosuggestions when the user moves the cursor without changing the text.\n *\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnKeyPress - A function that determines whether to accept the current autosuggestion based on a key press event. By default, the Tab key is used to accept the autosuggestion. Example code:\n *\n * ```typescript\n * const defaultShouldAcceptAutosuggestionOnKeyPress = (event: React.KeyboardEvent<HTMLDivElement>) => {\n * // if tab, accept the autosuggestion\n * if (event.key === \"Tab\") {\n * return true;\n * }\n * return false;\n * }\n * ```\n *\n * @property {(event: React.TouchEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnTouch - A function that determines whether to accept the current autosuggestion based on a mobile touch event. By default, the touching the end of a suggestion will accept it. Example code:\n *\n * ```typescript\n * const shouldAcceptAutosuggestionOnTouch = (event: React.TouchEvent<HTMLDivElement>) => {\n * // if tab, accept the autosuggestion\n * if (event.type === \"touchstart\") {\n * return true;\n * }\n * return false;\n * }\n * ```\n *\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldToggleHoveringEditorOnKeyPress - A function that determines whether to toggle the hovering editor based on a key press event. By default, the Command + K key combination is used to toggle the hovering editor. Example code:\n *\n * ```typescript\n * const defaultShouldToggleHoveringEditorOnKeyPress = (event: React.KeyboardEvent<HTMLDivElement>) => {\n * // if command-k, toggle the hovering editor\n * if (event.key === \"k\" && event.metaKey) {\n * return true;\n * }\n * return false;\n * }\n * ```\n */\nexport interface BaseAutosuggestionsConfig {\n textareaPurpose: string;\n contextCategories: string[];\n debounceTime: number;\n apiConfig: BaseCopilotTextareaApiConfig;\n\n disableWhenEmpty: boolean;\n disabled: boolean;\n temporarilyDisableWhenMovingCursorWithoutChangingText: boolean;\n shouldAcceptAutosuggestionOnKeyPress: (event: React.KeyboardEvent<HTMLDivElement>) => boolean;\n shouldAcceptAutosuggestionOnTouch: (event: React.TouchEvent<HTMLDivElement>) => boolean;\n shouldToggleHoveringEditorOnKeyPress: (\n event: React.KeyboardEvent<HTMLDivElement>,\n shortcut: string,\n ) => boolean;\n}\n\n// by default, command-k toggles the hovering editor\nconst defaultShouldToggleHoveringEditorOnKeyPress = (\n event: React.KeyboardEvent<HTMLDivElement>,\n shortcut: string,\n) => {\n // if command-k, toggle the hovering editor\n if (event.key === shortcut && event.metaKey) {\n return true;\n }\n return false;\n};\n\nconst defaultShouldAcceptAutosuggestionOnKeyPress = (\n event: React.KeyboardEvent<HTMLDivElement>,\n) => {\n // if tab, accept the autosuggestion\n if (event.key === \"Tab\") {\n return true;\n }\n return false;\n};\n\nconst defaultShouldAcceptAutosuggestionOnTouch = () => false;\n\n/**\n * Default configuration for the BaseAutosuggestions.\n *\n * @property {number} debounceTime - The amount of time to wait before triggering the autosuggestions API call.\n * @property {string[]} contextCategories - The categories to use for context when making the autosuggestions API call.\n * @property {boolean} disableWhenEmpty - Whether to disable the autosuggestions when the textarea is empty.\n * @property {boolean} disabled - Whether to disable the autosuggestions feature entirely.\n * @property {boolean} temporarilyDisableWhenMovingCursorWithoutChangingText - Whether to temporarily disable the autosuggestions when the cursor is moved without changing the text.\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldToggleHoveringEditorOnKeyPress - A function that determines whether to toggle the hovering editor based on a key press event.\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnKeyPress - A function that determines whether to accept the autosuggestion based on a key press event.\n * @property {() => boolean} defaultShouldAcceptAutosuggestionOnTouch - A function that determines whether to accept the autosuggestion based on a mobile touch event.\n */\n\nexport const defaultBaseAutosuggestionsConfig: Omit<\n BaseAutosuggestionsConfig,\n \"textareaPurpose\" | \"apiConfig\"\n> = {\n debounceTime: 250,\n contextCategories: defaultCopilotContextCategories,\n disableWhenEmpty: true,\n disabled: false,\n temporarilyDisableWhenMovingCursorWithoutChangingText: true,\n shouldToggleHoveringEditorOnKeyPress: defaultShouldToggleHoveringEditorOnKeyPress,\n shouldAcceptAutosuggestionOnKeyPress: defaultShouldAcceptAutosuggestionOnKeyPress,\n shouldAcceptAutosuggestionOnTouch: defaultShouldAcceptAutosuggestionOnTouch,\n};\n"],"mappings":";AACA,SAAS,uCAAuC;AAyEhD,IAAM,8CAA8C,CAClD,OACA,aACG;AAEH,MAAI,MAAM,QAAQ,YAAY,MAAM,SAAS;AAC3C,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,IAAM,8CAA8C,CAClD,UACG;AAEH,MAAI,MAAM,QAAQ,OAAO;AACvB,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,IAAM,2CAA2C,MAAM;AAehD,IAAM,mCAGT;AAAA,EACF,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,uDAAuD;AAAA,EACvD,sCAAsC;AAAA,EACtC,sCAAsC;AAAA,EACtC,mCAAmC;AACrC;","names":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BaseEditor } from 'slate';
|
|
2
|
+
import { ReactEditor } from 'slate-react';
|
|
3
|
+
import { HistoryEditor } from 'slate-history';
|
|
4
|
+
|
|
5
|
+
type CustomEditor = BaseEditor & ReactEditor & HistoryEditor;
|
|
6
|
+
type ParagraphElement = {
|
|
7
|
+
type: "paragraph";
|
|
8
|
+
children: CustomText[];
|
|
9
|
+
};
|
|
10
|
+
type SuggestionElement = {
|
|
11
|
+
type: "suggestion";
|
|
12
|
+
inline: boolean;
|
|
13
|
+
content: string;
|
|
14
|
+
children: CustomText[];
|
|
15
|
+
};
|
|
16
|
+
type CustomElement = ParagraphElement | SuggestionElement;
|
|
17
|
+
type SuggestionAwareText = {
|
|
18
|
+
text: string;
|
|
19
|
+
};
|
|
20
|
+
type CustomText = SuggestionAwareText;
|
|
21
|
+
declare module "slate" {
|
|
22
|
+
interface CustomTypes {
|
|
23
|
+
Editor: CustomEditor;
|
|
24
|
+
Element: CustomElement;
|
|
25
|
+
Text: CustomText;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type { CustomEditor, CustomElement, CustomText, ParagraphElement, SuggestionAwareText, SuggestionElement };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BasePoint } from 'slate';
|
|
2
|
+
|
|
3
|
+
interface EditorAutocompleteState {
|
|
4
|
+
cursorPoint: BasePoint;
|
|
5
|
+
textBeforeCursor: string;
|
|
6
|
+
textAfterCursor: string;
|
|
7
|
+
}
|
|
8
|
+
declare function areEqual_autocompleteState(prev: EditorAutocompleteState, next: EditorAutocompleteState): boolean;
|
|
9
|
+
|
|
10
|
+
export { type EditorAutocompleteState, areEqual_autocompleteState };
|
|
@@ -7,4 +7,4 @@ interface EditorAutocompleteState {
|
|
|
7
7
|
}
|
|
8
8
|
declare function areEqual_autocompleteState(prev: EditorAutocompleteState, next: EditorAutocompleteState): boolean;
|
|
9
9
|
|
|
10
|
-
export { EditorAutocompleteState, areEqual_autocompleteState };
|
|
10
|
+
export { type EditorAutocompleteState, areEqual_autocompleteState };
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
} from "
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
// src/lib/utils.ts
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
var arraysAreEqual = (arr1, arr2) => arr1.length === arr2.length && arr1.every((value, index) => value === arr2[index]);
|
|
5
|
+
|
|
6
|
+
// src/types/base/editor-autocomplete-state.ts
|
|
7
|
+
function areEqual_autocompleteState(prev, next) {
|
|
8
|
+
return prev.cursorPoint.offset === next.cursorPoint.offset && arraysAreEqual(prev.cursorPoint.path, next.cursorPoint.path) && prev.textBeforeCursor === next.textBeforeCursor && prev.textAfterCursor === next.textAfterCursor;
|
|
9
|
+
}
|
|
6
10
|
export {
|
|
7
11
|
areEqual_autocompleteState
|
|
8
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/utils.ts","../../../src/types/base/editor-autocomplete-state.ts"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport async function fetcher<JSON = any>(input: RequestInfo, init?: RequestInit): Promise<JSON> {\n const res = await fetch(input, init);\n\n if (!res.ok) {\n const json = await res.json();\n if (json.error) {\n const error = new Error(json.error) as Error & {\n status: number;\n };\n error.status = res.status;\n throw error;\n } else {\n throw new Error(\"An unexpected error occurred\");\n }\n }\n\n return res.json();\n}\n\nexport function formatDate(input: string | number | Date): string {\n const date = new Date(input);\n return date.toLocaleDateString(\"en-US\", {\n month: \"long\",\n day: \"numeric\",\n year: \"numeric\",\n });\n}\n\nexport const arraysAreEqual = (arr1: number[], arr2: number[]): boolean =>\n arr1.length === arr2.length && arr1.every((value, index) => value === arr2[index]);\n\nexport function nullableCompatibleEqualityCheck<T>(\n naiveEqualityCheck: (a: T, b: T) => boolean,\n a: T | null | undefined,\n b: T | null | undefined,\n): boolean {\n if (a === null || a === undefined || b === null || b === undefined) {\n return a === b;\n }\n\n return naiveEqualityCheck(a, b);\n}\n","import { BasePoint } from \"slate\";\nimport { arraysAreEqual } from \"../../lib/utils\";\n\nexport interface EditorAutocompleteState {\n cursorPoint: BasePoint;\n textBeforeCursor: string;\n textAfterCursor: string;\n}\n\nexport function areEqual_autocompleteState(\n prev: EditorAutocompleteState,\n next: EditorAutocompleteState,\n) {\n return (\n prev.cursorPoint.offset === next.cursorPoint.offset &&\n arraysAreEqual(prev.cursorPoint.path, next.cursorPoint.path) &&\n prev.textBeforeCursor === next.textBeforeCursor &&\n prev.textAfterCursor === next.textAfterCursor\n );\n}\n"],"mappings":";AAAA,SAAS,YAA6B;AACtC,SAAS,eAAe;AAkCjB,IAAM,iBAAiB,CAAC,MAAgB,SAC7C,KAAK,WAAW,KAAK,UAAU,KAAK,MAAM,CAAC,OAAO,UAAU,UAAU,KAAK,KAAK,CAAC;;;AC3B5E,SAAS,2BACd,MACA,MACA;AACA,SACE,KAAK,YAAY,WAAW,KAAK,YAAY,UAC7C,eAAe,KAAK,YAAY,MAAM,KAAK,YAAY,IAAI,KAC3D,KAAK,qBAAqB,KAAK,oBAC/B,KAAK,oBAAoB,KAAK;AAElC;","names":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { BaseAutosuggestionsConfig } from './base-autosuggestions-config.mjs';
|
|
2
|
+
export { defaultBaseAutosuggestionsConfig } from './base-autosuggestions-config.mjs';
|
|
3
|
+
import { BaseCopilotTextareaApiConfig } from './autosuggestions-bare-function.mjs';
|
|
4
|
+
export { AutosuggestionsBareFunction } from './autosuggestions-bare-function.mjs';
|
|
5
|
+
import { TextareaHTMLAttributes } from 'react';
|
|
6
|
+
import '@copilotkit/react-core';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* `BaseCopilotTextareaProps` defines the properties for the `BaseCopilotTextarea` component.
|
|
10
|
+
*/
|
|
11
|
+
interface BaseCopilotTextareaProps extends Omit<TextareaHTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
12
|
+
/**
|
|
13
|
+
* Determines whether the CopilotKit branding should be disabled. Default is `false`.
|
|
14
|
+
*/
|
|
15
|
+
disableBranding?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Specifies the CSS styles to apply to the placeholder text.
|
|
18
|
+
*/
|
|
19
|
+
placeholderStyle?: React.CSSProperties;
|
|
20
|
+
/**
|
|
21
|
+
* Specifies the CSS styles to apply to the suggestions list.
|
|
22
|
+
*/
|
|
23
|
+
suggestionsStyle?: React.CSSProperties;
|
|
24
|
+
/**
|
|
25
|
+
* A class name to apply to the editor popover window.
|
|
26
|
+
*/
|
|
27
|
+
hoverMenuClassname?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The initial value of the textarea. Can be controlled via `onValueChange`.
|
|
30
|
+
*/
|
|
31
|
+
value?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Callback invoked when the value of the textarea changes.
|
|
34
|
+
*/
|
|
35
|
+
onValueChange?: (value: string) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Callback invoked when a `change` event is triggered on the textarea element.
|
|
38
|
+
*/
|
|
39
|
+
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
40
|
+
/**
|
|
41
|
+
* The shortcut to use to open the editor popover window. Default is `"Cmd-k"`.
|
|
42
|
+
*/
|
|
43
|
+
shortcut?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Configuration settings for the autosuggestions feature.
|
|
46
|
+
* Includes a mandatory `textareaPurpose` to guide the autosuggestions.
|
|
47
|
+
*/
|
|
48
|
+
baseAutosuggestionsConfig: Partial<BaseAutosuggestionsConfig> & {
|
|
49
|
+
textareaPurpose: string;
|
|
50
|
+
apiConfig: BaseCopilotTextareaApiConfig;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { BaseAutosuggestionsConfig, type BaseCopilotTextareaProps };
|
|
@@ -1,8 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
// src/types/base/base-autosuggestions-config.tsx
|
|
2
|
+
import { defaultCopilotContextCategories } from "@copilotkit/react-core";
|
|
3
|
+
var defaultShouldToggleHoveringEditorOnKeyPress = (event, shortcut) => {
|
|
4
|
+
if (event.key === shortcut && event.metaKey) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
return false;
|
|
8
|
+
};
|
|
9
|
+
var defaultShouldAcceptAutosuggestionOnKeyPress = (event) => {
|
|
10
|
+
if (event.key === "Tab") {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
};
|
|
15
|
+
var defaultShouldAcceptAutosuggestionOnTouch = () => false;
|
|
16
|
+
var defaultBaseAutosuggestionsConfig = {
|
|
17
|
+
debounceTime: 250,
|
|
18
|
+
contextCategories: defaultCopilotContextCategories,
|
|
19
|
+
disableWhenEmpty: true,
|
|
20
|
+
disabled: false,
|
|
21
|
+
temporarilyDisableWhenMovingCursorWithoutChangingText: true,
|
|
22
|
+
shouldToggleHoveringEditorOnKeyPress: defaultShouldToggleHoveringEditorOnKeyPress,
|
|
23
|
+
shouldAcceptAutosuggestionOnKeyPress: defaultShouldAcceptAutosuggestionOnKeyPress,
|
|
24
|
+
shouldAcceptAutosuggestionOnTouch: defaultShouldAcceptAutosuggestionOnTouch
|
|
25
|
+
};
|
|
6
26
|
export {
|
|
7
27
|
defaultBaseAutosuggestionsConfig
|
|
8
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/types/base/base-autosuggestions-config.tsx"],"sourcesContent":["import { BaseCopilotTextareaApiConfig } from \"./autosuggestions-bare-function\";\nimport { defaultCopilotContextCategories } from \"@copilotkit/react-core\";\n\n/**\n * @interface BaseAutosuggestionsConfig\n *\n * @property {string} textareaPurpose - The purpose of the textarea. This is used to guide the autosuggestions.\n *\n * @property {string[]} contextCategories - The categories of context to consider when providing autosuggestions.\n *\n * @property {number} debounceTime - The amount of time (in milliseconds) to wait before triggering autosuggestions after the user has stopped typing.\n *\n * @property {BaseCopilotTextareaApiConfig} apiConfig - The configuration for the API that provides the autosuggestions.\n *\n * @property {boolean} disableWhenEmpty - Whether to disable autosuggestions when the textarea is empty.\n *\n * @property {boolean} disabled - Whether to disable autosuggestions entirely.\n *\n * @property {boolean} temporarilyDisableWhenMovingCursorWithoutChangingText - Whether to temporarily disable autosuggestions when the user moves the cursor without changing the text.\n *\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnKeyPress - A function that determines whether to accept the current autosuggestion based on a key press event. By default, the Tab key is used to accept the autosuggestion. Example code:\n *\n * ```typescript\n * const defaultShouldAcceptAutosuggestionOnKeyPress = (event: React.KeyboardEvent<HTMLDivElement>) => {\n * // if tab, accept the autosuggestion\n * if (event.key === \"Tab\") {\n * return true;\n * }\n * return false;\n * }\n * ```\n *\n * @property {(event: React.TouchEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnTouch - A function that determines whether to accept the current autosuggestion based on a mobile touch event. By default, the touching the end of a suggestion will accept it. Example code:\n *\n * ```typescript\n * const shouldAcceptAutosuggestionOnTouch = (event: React.TouchEvent<HTMLDivElement>) => {\n * // if tab, accept the autosuggestion\n * if (event.type === \"touchstart\") {\n * return true;\n * }\n * return false;\n * }\n * ```\n *\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldToggleHoveringEditorOnKeyPress - A function that determines whether to toggle the hovering editor based on a key press event. By default, the Command + K key combination is used to toggle the hovering editor. Example code:\n *\n * ```typescript\n * const defaultShouldToggleHoveringEditorOnKeyPress = (event: React.KeyboardEvent<HTMLDivElement>) => {\n * // if command-k, toggle the hovering editor\n * if (event.key === \"k\" && event.metaKey) {\n * return true;\n * }\n * return false;\n * }\n * ```\n */\nexport interface BaseAutosuggestionsConfig {\n textareaPurpose: string;\n contextCategories: string[];\n debounceTime: number;\n apiConfig: BaseCopilotTextareaApiConfig;\n\n disableWhenEmpty: boolean;\n disabled: boolean;\n temporarilyDisableWhenMovingCursorWithoutChangingText: boolean;\n shouldAcceptAutosuggestionOnKeyPress: (event: React.KeyboardEvent<HTMLDivElement>) => boolean;\n shouldAcceptAutosuggestionOnTouch: (event: React.TouchEvent<HTMLDivElement>) => boolean;\n shouldToggleHoveringEditorOnKeyPress: (\n event: React.KeyboardEvent<HTMLDivElement>,\n shortcut: string,\n ) => boolean;\n}\n\n// by default, command-k toggles the hovering editor\nconst defaultShouldToggleHoveringEditorOnKeyPress = (\n event: React.KeyboardEvent<HTMLDivElement>,\n shortcut: string,\n) => {\n // if command-k, toggle the hovering editor\n if (event.key === shortcut && event.metaKey) {\n return true;\n }\n return false;\n};\n\nconst defaultShouldAcceptAutosuggestionOnKeyPress = (\n event: React.KeyboardEvent<HTMLDivElement>,\n) => {\n // if tab, accept the autosuggestion\n if (event.key === \"Tab\") {\n return true;\n }\n return false;\n};\n\nconst defaultShouldAcceptAutosuggestionOnTouch = () => false;\n\n/**\n * Default configuration for the BaseAutosuggestions.\n *\n * @property {number} debounceTime - The amount of time to wait before triggering the autosuggestions API call.\n * @property {string[]} contextCategories - The categories to use for context when making the autosuggestions API call.\n * @property {boolean} disableWhenEmpty - Whether to disable the autosuggestions when the textarea is empty.\n * @property {boolean} disabled - Whether to disable the autosuggestions feature entirely.\n * @property {boolean} temporarilyDisableWhenMovingCursorWithoutChangingText - Whether to temporarily disable the autosuggestions when the cursor is moved without changing the text.\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldToggleHoveringEditorOnKeyPress - A function that determines whether to toggle the hovering editor based on a key press event.\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnKeyPress - A function that determines whether to accept the autosuggestion based on a key press event.\n * @property {() => boolean} defaultShouldAcceptAutosuggestionOnTouch - A function that determines whether to accept the autosuggestion based on a mobile touch event.\n */\n\nexport const defaultBaseAutosuggestionsConfig: Omit<\n BaseAutosuggestionsConfig,\n \"textareaPurpose\" | \"apiConfig\"\n> = {\n debounceTime: 250,\n contextCategories: defaultCopilotContextCategories,\n disableWhenEmpty: true,\n disabled: false,\n temporarilyDisableWhenMovingCursorWithoutChangingText: true,\n shouldToggleHoveringEditorOnKeyPress: defaultShouldToggleHoveringEditorOnKeyPress,\n shouldAcceptAutosuggestionOnKeyPress: defaultShouldAcceptAutosuggestionOnKeyPress,\n shouldAcceptAutosuggestionOnTouch: defaultShouldAcceptAutosuggestionOnTouch,\n};\n"],"mappings":";AACA,SAAS,uCAAuC;AAyEhD,IAAM,8CAA8C,CAClD,OACA,aACG;AAEH,MAAI,MAAM,QAAQ,YAAY,MAAM,SAAS;AAC3C,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,IAAM,8CAA8C,CAClD,UACG;AAEH,MAAI,MAAM,QAAQ,OAAO;AACvB,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,IAAM,2CAA2C,MAAM;AAehD,IAAM,mCAGT;AAAA,EACF,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,uDAAuD;AAAA,EACvD,sCAAsC;AAAA,EACtC,sCAAsC;AAAA,EACtC,mCAAmC;AACrC;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { BaseAutosuggestionsConfig, defaultBaseAutosuggestionsConfig } from './base/base-autosuggestions-config.mjs';
|
|
2
|
+
export { AutosuggestionsBareFunction } from './base/autosuggestions-bare-function.mjs';
|
|
3
|
+
export { BaseCopilotTextareaProps } from './base/index.mjs';
|
|
4
|
+
export { HTMLCopilotTextAreaElement } from './html-copilot-textarea-element.mjs';
|
|
5
|
+
export { AutosuggestionsConfig, defaultAutosuggestionsConfig } from './autosuggestions-config/autosuggestions-config.mjs';
|
|
6
|
+
export { MakeSystemPrompt } from './autosuggestions-config/subtypes/make-system-prompt.mjs';
|
|
7
|
+
export { AutosuggestionsConfigUserSpecified, InsertionsApiConfigUserSpecified, SuggestionsApiConfigUserSpecified } from './autosuggestions-config/autosuggestions-config-user-specified.mjs';
|
|
8
|
+
import '@copilotkit/react-core';
|
|
9
|
+
import 'react';
|
|
10
|
+
import './autosuggestions-config/suggestions-api-config.mjs';
|
|
11
|
+
import '@copilotkit/runtime-client-gql';
|
|
12
|
+
import './autosuggestions-config/insertions-api-config.mjs';
|
|
13
|
+
import './autosuggestions-config/editing-api-config.mjs';
|