@copilotkit/react-textarea 0.28.0-alpha.8 → 0.28.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 +429 -467
- package/CHANGELOG.md +45 -0
- package/dist/chunk-224UKA7C.mjs +9 -4
- package/dist/chunk-224UKA7C.mjs.map +1 -1
- package/dist/chunk-2C7O2EVM.mjs +4 -4
- package/dist/chunk-2C7O2EVM.mjs.map +1 -1
- package/dist/chunk-2QDCE7PD.mjs +6 -3
- package/dist/chunk-2QDCE7PD.mjs.map +1 -1
- package/dist/chunk-3PQ7GSFE.mjs +4 -4
- package/dist/chunk-3PQ7GSFE.mjs.map +1 -1
- package/dist/chunk-4NHVQZ67.mjs +6 -5
- package/dist/chunk-4NHVQZ67.mjs.map +1 -1
- package/dist/chunk-4OJ3H65F.mjs +5 -2
- package/dist/chunk-4OJ3H65F.mjs.map +1 -1
- package/dist/chunk-5J3UZV77.mjs +23 -11
- package/dist/chunk-5J3UZV77.mjs.map +1 -1
- package/dist/chunk-5UNJXFUO.mjs +4 -4
- package/dist/chunk-5UNJXFUO.mjs.map +1 -1
- package/dist/chunk-72P3KOHZ.mjs +17 -7
- package/dist/chunk-72P3KOHZ.mjs.map +1 -1
- package/dist/chunk-7LSRNPNI.mjs +4 -4
- package/dist/chunk-7LSRNPNI.mjs.map +1 -1
- package/dist/chunk-7SUZ6CXM.mjs +15 -6
- package/dist/chunk-7SUZ6CXM.mjs.map +1 -1
- package/dist/chunk-AZHILHKM.mjs +21 -8
- package/dist/chunk-AZHILHKM.mjs.map +1 -1
- package/dist/chunk-B6TKVDDY.mjs +58 -22
- package/dist/chunk-B6TKVDDY.mjs.map +1 -1
- package/dist/chunk-BBZ7AWOB.mjs +8 -4
- package/dist/chunk-BBZ7AWOB.mjs.map +1 -1
- package/dist/chunk-DE5K76I2.mjs +0 -2
- package/dist/chunk-DE5K76I2.mjs.map +1 -1
- package/dist/chunk-DRV2FOHZ.mjs +11 -6
- package/dist/chunk-DRV2FOHZ.mjs.map +1 -1
- package/dist/chunk-ECR45NSD.mjs +7 -4
- package/dist/chunk-ECR45NSD.mjs.map +1 -1
- package/dist/chunk-FJNUPSQK.mjs +16 -5
- package/dist/chunk-FJNUPSQK.mjs.map +1 -1
- package/dist/chunk-FP2EKU3L.mjs +4 -4
- package/dist/chunk-FP2EKU3L.mjs.map +1 -1
- package/dist/chunk-GQN2HYFJ.mjs +4 -4
- package/dist/chunk-GQN2HYFJ.mjs.map +1 -1
- package/dist/chunk-H4VKQGVU.mjs +0 -2
- package/dist/chunk-H4VKQGVU.mjs.map +1 -1
- package/dist/chunk-IU3WTXLQ.mjs +0 -2
- package/dist/chunk-IU3WTXLQ.mjs.map +1 -1
- package/dist/chunk-JJLQVT7S.mjs +6 -3
- package/dist/chunk-JJLQVT7S.mjs.map +1 -1
- package/dist/chunk-KDVMG3XF.mjs +5 -2
- package/dist/chunk-KDVMG3XF.mjs.map +1 -1
- package/dist/chunk-KFQZHRPJ.mjs +15 -8
- package/dist/chunk-KFQZHRPJ.mjs.map +1 -1
- package/dist/chunk-KNQIEOFP.mjs +3 -2
- package/dist/chunk-KNQIEOFP.mjs.map +1 -1
- package/dist/chunk-L7VVZH4Q.mjs +0 -2
- package/dist/chunk-L7VVZH4Q.mjs.map +1 -1
- package/dist/chunk-LQ2OWQU7.mjs +11 -7
- package/dist/chunk-LQ2OWQU7.mjs.map +1 -1
- package/dist/chunk-LYB4B6MK.mjs +6 -5
- package/dist/chunk-LYB4B6MK.mjs.map +1 -1
- package/dist/chunk-M2DR4KVB.mjs +6 -3
- package/dist/chunk-M2DR4KVB.mjs.map +1 -1
- package/dist/chunk-MMVDU6DF.mjs +0 -2
- package/dist/chunk-MMVDU6DF.mjs.map +1 -1
- package/dist/chunk-MRXNTQOX.mjs +6 -2
- package/dist/chunk-MRXNTQOX.mjs.map +1 -1
- package/dist/chunk-P4QVFRLY.mjs +17 -7
- package/dist/chunk-P4QVFRLY.mjs.map +1 -1
- package/dist/chunk-PTZVE6NC.mjs +22 -8
- package/dist/chunk-PTZVE6NC.mjs.map +1 -1
- package/dist/chunk-QCPS6IYI.mjs +15 -6
- package/dist/chunk-QCPS6IYI.mjs.map +1 -1
- package/dist/chunk-RKQ6RTZM.mjs +5 -2
- package/dist/chunk-RKQ6RTZM.mjs.map +1 -1
- package/dist/chunk-RT4UTBH3.mjs +15 -6
- package/dist/chunk-RT4UTBH3.mjs.map +1 -1
- package/dist/chunk-RUV6NBIF.mjs +0 -2
- package/dist/chunk-RUV6NBIF.mjs.map +1 -1
- package/dist/chunk-SNQEBH5I.mjs +24 -10
- package/dist/chunk-SNQEBH5I.mjs.map +1 -1
- package/dist/chunk-SX6NY5FW.mjs +11 -6
- package/dist/chunk-SX6NY5FW.mjs.map +1 -1
- package/dist/chunk-T6MTDQZ7.mjs +4 -4
- package/dist/chunk-T6MTDQZ7.mjs.map +1 -1
- package/dist/chunk-VB4VNCIQ.mjs +28 -12
- package/dist/chunk-VB4VNCIQ.mjs.map +1 -1
- package/dist/chunk-VPEH6V7T.mjs +12 -6
- package/dist/chunk-VPEH6V7T.mjs.map +1 -1
- package/dist/chunk-WADHCMPK.mjs +0 -2
- package/dist/chunk-WADHCMPK.mjs.map +1 -1
- package/dist/chunk-WFTAAA7R.mjs +16 -8
- package/dist/chunk-WFTAAA7R.mjs.map +1 -1
- package/dist/chunk-WJHSY5T6.mjs +0 -2
- package/dist/chunk-WJHSY5T6.mjs.map +1 -1
- package/dist/chunk-WTASPE2W.mjs +41 -22
- package/dist/chunk-WTASPE2W.mjs.map +1 -1
- package/dist/chunk-XW3ICO4S.mjs +10 -4
- package/dist/chunk-XW3ICO4S.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js +379 -257
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +39 -35
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-element.js +32 -11
- package/dist/components/base-copilot-textarea/render-element.js.map +1 -1
- package/dist/components/base-copilot-textarea/render-element.mjs +7 -3
- package/dist/components/base-copilot-textarea/render-element.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.js +29 -8
- package/dist/components/base-copilot-textarea/render-placeholder.js.map +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.mjs +7 -3
- package/dist/components/base-copilot-textarea/render-placeholder.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js +44 -17
- 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 +8 -4
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/use-add-branding-css.js +29 -7
- 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 +7 -3
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.js +414 -272
- package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.mjs +48 -44
- package/dist/components/copilot-textarea/copilot-textarea.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.js +35 -12
- package/dist/components/hovering-toolbar/hovering-editor-provider.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +9 -3
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js +66 -36
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +15 -3
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.js +247 -179
- package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +22 -18
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +180 -129
- 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 +16 -12
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +185 -131
- 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 +17 -13
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js +71 -55
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +11 -5
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +185 -131
- 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 +18 -14
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +1 -1
- package/dist/components/index.js +418 -273
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +52 -45
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/manual-ui/chip-with-icon.js +31 -9
- package/dist/components/manual-ui/chip-with-icon.js.map +1 -1
- package/dist/components/manual-ui/chip-with-icon.mjs +6 -5
- package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -1
- package/dist/components/source-search-box/source-search-box.js +104 -72
- package/dist/components/source-search-box/source-search-box.js.map +1 -1
- package/dist/components/source-search-box/source-search-box.mjs +12 -6
- package/dist/components/source-search-box/source-search-box.mjs.map +1 -1
- package/dist/components/ui/button.js +56 -40
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/button.mjs +10 -4
- package/dist/components/ui/button.mjs.map +1 -1
- package/dist/components/ui/card.js +70 -50
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/card.mjs +18 -7
- package/dist/components/ui/card.mjs.map +1 -1
- package/dist/components/ui/command.js +139 -97
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/command.mjs +26 -5
- package/dist/components/ui/command.mjs.map +1 -1
- package/dist/components/ui/dialog.js +90 -69
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/dialog.mjs +21 -4
- package/dist/components/ui/dialog.mjs.map +1 -1
- package/dist/components/ui/label.js +55 -40
- package/dist/components/ui/label.js.map +1 -1
- package/dist/components/ui/label.mjs +9 -4
- package/dist/components/ui/label.mjs.map +1 -1
- package/dist/components/ui/separator.js +54 -39
- package/dist/components/ui/separator.js.map +1 -1
- package/dist/components/ui/separator.mjs +15 -8
- package/dist/components/ui/separator.mjs.map +1 -1
- package/dist/components/ui/textarea.js +50 -35
- package/dist/components/ui/textarea.js.map +1 -1
- package/dist/components/ui/textarea.mjs +13 -7
- package/dist/components/ui/textarea.mjs.map +1 -1
- package/dist/context/index.js +17 -2
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -2
- package/dist/context/index.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js +43 -18
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +10 -6
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js +50 -25
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +8 -4
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js +62 -29
- 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 +9 -5
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map +1 -1
- package/dist/hooks/index.js +17 -2
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -2
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js +35 -11
- 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 +8 -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.js +38 -14
- 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 +8 -4
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs.map +1 -1
- package/dist/hooks/misc/use-autosize-textarea.js +25 -7
- package/dist/hooks/misc/use-autosize-textarea.js.map +1 -1
- package/dist/hooks/misc/use-autosize-textarea.mjs +7 -3
- package/dist/hooks/misc/use-autosize-textarea.mjs.map +1 -1
- package/dist/index.js +422 -275
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -49
- package/dist/index.mjs.map +1 -1
- package/dist/lib/debouncer.js +27 -5
- package/dist/lib/debouncer.js.map +1 -1
- package/dist/lib/debouncer.mjs +7 -3
- package/dist/lib/debouncer.mjs.map +1 -1
- package/dist/lib/editor-to-text.js +30 -8
- package/dist/lib/editor-to-text.js.map +1 -1
- package/dist/lib/editor-to-text.mjs +7 -3
- package/dist/lib/editor-to-text.mjs.map +1 -1
- package/dist/lib/get-text-around-cursor.js +49 -24
- package/dist/lib/get-text-around-cursor.js.map +1 -1
- package/dist/lib/get-text-around-cursor.mjs +13 -3
- package/dist/lib/get-text-around-cursor.mjs.map +1 -1
- package/dist/lib/retry.js +27 -4
- package/dist/lib/retry.js.map +1 -1
- package/dist/lib/retry.mjs +7 -3
- package/dist/lib/retry.mjs.map +1 -1
- package/dist/lib/slatejs-edits/add-autocompletions.js +29 -7
- package/dist/lib/slatejs-edits/add-autocompletions.js.map +1 -1
- package/dist/lib/slatejs-edits/add-autocompletions.mjs +7 -3
- package/dist/lib/slatejs-edits/add-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.js +31 -9
- package/dist/lib/slatejs-edits/clear-autocompletions.js.map +1 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs +7 -3
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/replace-text.js +32 -10
- package/dist/lib/slatejs-edits/replace-text.js.map +1 -1
- package/dist/lib/slatejs-edits/replace-text.mjs +7 -3
- package/dist/lib/slatejs-edits/replace-text.mjs.map +1 -1
- package/dist/lib/slatejs-edits/with-partial-history.js +42 -19
- package/dist/lib/slatejs-edits/with-partial-history.js.map +1 -1
- package/dist/lib/slatejs-edits/with-partial-history.mjs +9 -3
- package/dist/lib/slatejs-edits/with-partial-history.mjs.map +1 -1
- package/dist/lib/stream-promise-flatten.js +27 -5
- package/dist/lib/stream-promise-flatten.js.map +1 -1
- package/dist/lib/stream-promise-flatten.mjs +7 -3
- package/dist/lib/stream-promise-flatten.mjs.map +1 -1
- package/dist/lib/utils.js +44 -16
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/utils.mjs +17 -3
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/lib/utils.test.js +1 -2
- package/dist/lib/utils.test.js.map +1 -1
- package/dist/lib/utils.test.mjs +0 -1
- package/dist/lib/utils.test.mjs.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js +17 -2
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs +0 -2
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.js +35 -9
- package/dist/types/autosuggestions-config/autosuggestions-config.js.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +12 -8
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.js +31 -6
- package/dist/types/autosuggestions-config/editing-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.mjs +11 -3
- package/dist/types/autosuggestions-config/editing-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/index.js +35 -9
- package/dist/types/autosuggestions-config/index.js.map +1 -1
- package/dist/types/autosuggestions-config/index.mjs +13 -9
- package/dist/types/autosuggestions-config/index.mjs.map +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.js +31 -6
- package/dist/types/autosuggestions-config/insertions-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.mjs +11 -3
- package/dist/types/autosuggestions-config/insertions-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js +17 -2
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs +0 -2
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js +17 -2
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs +0 -2
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs.map +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.js +31 -6
- package/dist/types/autosuggestions-config/suggestions-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs +11 -3
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs.map +1 -1
- package/dist/types/base/autosuggestion-state.js +17 -2
- package/dist/types/base/autosuggestion-state.js.map +1 -1
- package/dist/types/base/autosuggestion-state.mjs +0 -2
- package/dist/types/base/autosuggestion-state.mjs.map +1 -1
- package/dist/types/base/autosuggestions-bare-function.js +17 -2
- package/dist/types/base/autosuggestions-bare-function.js.map +1 -1
- package/dist/types/base/autosuggestions-bare-function.mjs +0 -2
- package/dist/types/base/autosuggestions-bare-function.mjs.map +1 -1
- package/dist/types/base/base-autosuggestions-config.js +29 -7
- package/dist/types/base/base-autosuggestions-config.js.map +1 -1
- package/dist/types/base/base-autosuggestions-config.mjs +7 -3
- package/dist/types/base/base-autosuggestions-config.mjs.map +1 -1
- package/dist/types/base/base-copilot-textarea-props.js +17 -2
- package/dist/types/base/base-copilot-textarea-props.js.map +1 -1
- package/dist/types/base/base-copilot-textarea-props.mjs +0 -2
- package/dist/types/base/base-copilot-textarea-props.mjs.map +1 -1
- package/dist/types/base/custom-editor.js +17 -2
- package/dist/types/base/custom-editor.js.map +1 -1
- package/dist/types/base/custom-editor.mjs +0 -2
- package/dist/types/base/custom-editor.mjs.map +1 -1
- package/dist/types/base/editor-autocomplete-state.js +32 -8
- package/dist/types/base/editor-autocomplete-state.js.map +1 -1
- package/dist/types/base/editor-autocomplete-state.mjs +8 -4
- package/dist/types/base/editor-autocomplete-state.mjs.map +1 -1
- package/dist/types/base/index.js +30 -6
- package/dist/types/base/index.js.map +1 -1
- package/dist/types/base/index.mjs +8 -4
- package/dist/types/base/index.mjs.map +1 -1
- package/dist/types/html-copilot-textarea-element.js +17 -2
- package/dist/types/html-copilot-textarea-element.js.map +1 -1
- package/dist/types/html-copilot-textarea-element.mjs +1 -2
- package/dist/types/html-copilot-textarea-element.mjs.map +1 -1
- package/dist/types/index.js +37 -10
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +18 -11
- package/dist/types/index.mjs.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1,55 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var React2 = require('react');
|
|
4
|
-
var slate = require('slate');
|
|
5
|
-
var slateReact = require('slate-react');
|
|
6
|
-
var tailwindMerge = require('tailwind-merge');
|
|
7
|
-
var clsx = require('clsx');
|
|
8
|
-
var nanoid = require('nanoid');
|
|
9
|
-
var slateHistory = require('slate-history');
|
|
10
|
-
var reactCore = require('@copilotkit/react-core');
|
|
11
|
-
var cmdk = require('cmdk');
|
|
12
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
13
|
-
var reactSlot = require('@radix-ui/react-slot');
|
|
14
|
-
var classVarianceAuthority = require('class-variance-authority');
|
|
15
|
-
var LabelPrimitive = require('@radix-ui/react-label');
|
|
16
|
-
var Chip = require('@mui/material/Chip/Chip.js');
|
|
17
|
-
var Avatar = require('@mui/material/Avatar/Avatar.js');
|
|
18
|
-
var css = require('@emotion/css');
|
|
19
|
-
var ReactDOM = require('react-dom');
|
|
20
|
-
var merge = require('lodash.merge');
|
|
21
|
-
|
|
22
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
-
|
|
24
|
-
function _interopNamespace(e) {
|
|
25
|
-
if (e && e.__esModule) return e;
|
|
26
|
-
var n = Object.create(null);
|
|
27
|
-
if (e) {
|
|
28
|
-
Object.keys(e).forEach(function (k) {
|
|
29
|
-
if (k !== 'default') {
|
|
30
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
31
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function () { return e[k]; }
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
n.default = e;
|
|
39
|
-
return Object.freeze(n);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
43
|
-
var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
|
|
44
|
-
var Chip__default = /*#__PURE__*/_interopDefault(Chip);
|
|
45
|
-
var Avatar__default = /*#__PURE__*/_interopDefault(Avatar);
|
|
46
|
-
var ReactDOM__default = /*#__PURE__*/_interopDefault(ReactDOM);
|
|
47
|
-
var merge__default = /*#__PURE__*/_interopDefault(merge);
|
|
48
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
49
3
|
var __defProp = Object.defineProperty;
|
|
50
4
|
var __defProps = Object.defineProperties;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
51
6
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
52
8
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
53
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
54
11
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
55
12
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -77,6 +34,27 @@ var __objRest = (source, exclude) => {
|
|
|
77
34
|
}
|
|
78
35
|
return target;
|
|
79
36
|
};
|
|
37
|
+
var __export = (target, all) => {
|
|
38
|
+
for (var name in all)
|
|
39
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
+
};
|
|
41
|
+
var __copyProps = (to, from, except, desc) => {
|
|
42
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
+
for (let key of __getOwnPropNames(from))
|
|
44
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
|
+
}
|
|
47
|
+
return to;
|
|
48
|
+
};
|
|
49
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
+
mod
|
|
56
|
+
));
|
|
57
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
80
58
|
var __async = (__this, __arguments, generator) => {
|
|
81
59
|
return new Promise((resolve, reject) => {
|
|
82
60
|
var fulfilled = (value) => {
|
|
@@ -98,6 +76,25 @@ var __async = (__this, __arguments, generator) => {
|
|
|
98
76
|
});
|
|
99
77
|
};
|
|
100
78
|
|
|
79
|
+
// src/index.tsx
|
|
80
|
+
var src_exports = {};
|
|
81
|
+
__export(src_exports, {
|
|
82
|
+
BaseCopilotTextarea: () => BaseCopilotTextarea,
|
|
83
|
+
CopilotTextarea: () => CopilotTextarea,
|
|
84
|
+
defaultAutosuggestionsConfig: () => defaultAutosuggestionsConfig,
|
|
85
|
+
defaultBaseAutosuggestionsConfig: () => defaultBaseAutosuggestionsConfig
|
|
86
|
+
});
|
|
87
|
+
module.exports = __toCommonJS(src_exports);
|
|
88
|
+
|
|
89
|
+
// src/components/base-copilot-textarea/base-copilot-textarea.tsx
|
|
90
|
+
var import_react12 = __toESM(require("react"));
|
|
91
|
+
var import_slate10 = require("slate");
|
|
92
|
+
var import_slate_react5 = require("slate-react");
|
|
93
|
+
var import_tailwind_merge2 = require("tailwind-merge");
|
|
94
|
+
|
|
95
|
+
// src/hooks/base-copilot-textarea-implementation/use-autosuggestions.ts
|
|
96
|
+
var import_react = require("react");
|
|
97
|
+
|
|
101
98
|
// src/lib/debouncer.ts
|
|
102
99
|
var Debouncer = class {
|
|
103
100
|
constructor(wait) {
|
|
@@ -125,10 +122,15 @@ var Debouncer = class {
|
|
|
125
122
|
};
|
|
126
123
|
}
|
|
127
124
|
};
|
|
125
|
+
|
|
126
|
+
// src/lib/utils.ts
|
|
127
|
+
var import_clsx = require("clsx");
|
|
128
|
+
var import_nanoid = require("nanoid");
|
|
129
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
128
130
|
function cn(...inputs) {
|
|
129
|
-
return
|
|
131
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
130
132
|
}
|
|
131
|
-
nanoid.customAlphabet(
|
|
133
|
+
var nanoid = (0, import_nanoid.customAlphabet)(
|
|
132
134
|
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
133
135
|
7
|
|
134
136
|
);
|
|
@@ -147,9 +149,9 @@ function areEqual_autocompleteState(prev, next) {
|
|
|
147
149
|
|
|
148
150
|
// src/hooks/base-copilot-textarea-implementation/use-autosuggestions.ts
|
|
149
151
|
function useAutosuggestions(debounceTime, shouldAcceptAutosuggestionOnKeyPress, autosuggestionFunction, insertAutocompleteSuggestion, disableWhenEmpty, disabled) {
|
|
150
|
-
const [previousAutocompleteState, setPreviousAutocompleteState] =
|
|
151
|
-
const [currentAutocompleteSuggestion, setCurrentAutocompleteSuggestion] =
|
|
152
|
-
const awaitForAndAppendSuggestion =
|
|
152
|
+
const [previousAutocompleteState, setPreviousAutocompleteState] = (0, import_react.useState)(null);
|
|
153
|
+
const [currentAutocompleteSuggestion, setCurrentAutocompleteSuggestion] = (0, import_react.useState)(null);
|
|
154
|
+
const awaitForAndAppendSuggestion = (0, import_react.useCallback)(
|
|
153
155
|
(editorAutocompleteState, abortSignal) => __async(this, null, function* () {
|
|
154
156
|
if (disabled) {
|
|
155
157
|
return;
|
|
@@ -168,17 +170,17 @@ function useAutosuggestions(debounceTime, shouldAcceptAutosuggestionOnKeyPress,
|
|
|
168
170
|
}),
|
|
169
171
|
[autosuggestionFunction, setCurrentAutocompleteSuggestion, disableWhenEmpty, disabled]
|
|
170
172
|
);
|
|
171
|
-
const debouncedFunction =
|
|
173
|
+
const debouncedFunction = (0, import_react.useMemo)(
|
|
172
174
|
() => new Debouncer(debounceTime),
|
|
173
175
|
[debounceTime]
|
|
174
176
|
);
|
|
175
|
-
|
|
177
|
+
(0, import_react.useEffect)(() => {
|
|
176
178
|
return () => {
|
|
177
179
|
debouncedFunction.cancel();
|
|
178
180
|
setCurrentAutocompleteSuggestion(null);
|
|
179
181
|
};
|
|
180
182
|
}, [debouncedFunction, disabled]);
|
|
181
|
-
const onChange =
|
|
183
|
+
const onChange = (0, import_react.useCallback)(
|
|
182
184
|
(newEditorState) => {
|
|
183
185
|
const editorStateHasChanged = !nullableCompatibleEqualityCheck(
|
|
184
186
|
areEqual_autocompleteState,
|
|
@@ -204,7 +206,7 @@ function useAutosuggestions(debounceTime, shouldAcceptAutosuggestionOnKeyPress,
|
|
|
204
206
|
setCurrentAutocompleteSuggestion
|
|
205
207
|
]
|
|
206
208
|
);
|
|
207
|
-
const keyDownHandler =
|
|
209
|
+
const keyDownHandler = (0, import_react.useCallback)(
|
|
208
210
|
(event) => {
|
|
209
211
|
if (currentAutocompleteSuggestion) {
|
|
210
212
|
if (shouldAcceptAutosuggestionOnKeyPress(event)) {
|
|
@@ -227,6 +229,15 @@ function useAutosuggestions(debounceTime, shouldAcceptAutosuggestionOnKeyPress,
|
|
|
227
229
|
onKeyDownHandler: keyDownHandler
|
|
228
230
|
};
|
|
229
231
|
}
|
|
232
|
+
|
|
233
|
+
// src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx
|
|
234
|
+
var import_react2 = require("react");
|
|
235
|
+
var import_slate2 = require("slate");
|
|
236
|
+
var import_slate_react = require("slate-react");
|
|
237
|
+
|
|
238
|
+
// src/lib/slatejs-edits/with-partial-history.ts
|
|
239
|
+
var import_slate = require("slate");
|
|
240
|
+
var import_slate_history = require("slate-history");
|
|
230
241
|
var withPartialHistory = (editor, shouldSave2) => {
|
|
231
242
|
const e = editor;
|
|
232
243
|
const { apply } = e;
|
|
@@ -237,10 +248,10 @@ var withPartialHistory = (editor, shouldSave2) => {
|
|
|
237
248
|
if (redos.length > 0) {
|
|
238
249
|
const batch = redos[redos.length - 1];
|
|
239
250
|
if (batch.selectionBefore) {
|
|
240
|
-
|
|
251
|
+
import_slate.Transforms.setSelection(e, batch.selectionBefore);
|
|
241
252
|
}
|
|
242
|
-
|
|
243
|
-
|
|
253
|
+
import_slate_history.HistoryEditor.withoutSaving(e, () => {
|
|
254
|
+
import_slate.Editor.withoutNormalizing(e, () => {
|
|
244
255
|
for (const op of batch.operations) {
|
|
245
256
|
e.apply(op);
|
|
246
257
|
}
|
|
@@ -255,14 +266,14 @@ var withPartialHistory = (editor, shouldSave2) => {
|
|
|
255
266
|
const { undos } = history;
|
|
256
267
|
if (undos.length > 0) {
|
|
257
268
|
const batch = undos[undos.length - 1];
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
const inverseOps = batch.operations.map(
|
|
269
|
+
import_slate_history.HistoryEditor.withoutSaving(e, () => {
|
|
270
|
+
import_slate.Editor.withoutNormalizing(e, () => {
|
|
271
|
+
const inverseOps = batch.operations.map(import_slate.Operation.inverse).reverse();
|
|
261
272
|
for (const op of inverseOps) {
|
|
262
273
|
e.apply(op);
|
|
263
274
|
}
|
|
264
275
|
if (batch.selectionBefore) {
|
|
265
|
-
|
|
276
|
+
import_slate.Transforms.setSelection(e, batch.selectionBefore);
|
|
266
277
|
}
|
|
267
278
|
});
|
|
268
279
|
});
|
|
@@ -275,8 +286,8 @@ var withPartialHistory = (editor, shouldSave2) => {
|
|
|
275
286
|
const { undos } = history;
|
|
276
287
|
const lastBatch = undos[undos.length - 1];
|
|
277
288
|
const lastOp = lastBatch && lastBatch.operations[lastBatch.operations.length - 1];
|
|
278
|
-
let save =
|
|
279
|
-
let merge2 =
|
|
289
|
+
let save = import_slate_history.HistoryEditor.isSaving(e);
|
|
290
|
+
let merge2 = import_slate_history.HistoryEditor.isMerging(e);
|
|
280
291
|
if (save == null) {
|
|
281
292
|
save = shouldSave2(op, lastOp);
|
|
282
293
|
}
|
|
@@ -312,10 +323,10 @@ var withPartialHistory = (editor, shouldSave2) => {
|
|
|
312
323
|
return e;
|
|
313
324
|
};
|
|
314
325
|
var shouldMerge = (op, prev) => {
|
|
315
|
-
if (prev && op.type === "insert_text" && prev.type === "insert_text" && op.offset === prev.offset + prev.text.length &&
|
|
326
|
+
if (prev && op.type === "insert_text" && prev.type === "insert_text" && op.offset === prev.offset + prev.text.length && import_slate.Path.equals(op.path, prev.path)) {
|
|
316
327
|
return true;
|
|
317
328
|
}
|
|
318
|
-
if (prev && op.type === "remove_text" && prev.type === "remove_text" && op.offset + op.text.length === prev.offset &&
|
|
329
|
+
if (prev && op.type === "remove_text" && prev.type === "remove_text" && op.offset + op.text.length === prev.offset && import_slate.Path.equals(op.path, prev.path)) {
|
|
319
330
|
return true;
|
|
320
331
|
}
|
|
321
332
|
return false;
|
|
@@ -330,10 +341,10 @@ var defaultShouldSave = (op, prev) => {
|
|
|
330
341
|
// src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx
|
|
331
342
|
var shouldSave = (op, prev) => {
|
|
332
343
|
const excludedNodeType = "suggestion";
|
|
333
|
-
if (op.type === "insert_node" &&
|
|
344
|
+
if (op.type === "insert_node" && import_slate2.Element.isElement(op.node) && op.node.type === excludedNodeType) {
|
|
334
345
|
return false;
|
|
335
346
|
}
|
|
336
|
-
if (op.type === "remove_node" &&
|
|
347
|
+
if (op.type === "remove_node" && import_slate2.Element.isElement(op.node) && op.node.type === excludedNodeType) {
|
|
337
348
|
return false;
|
|
338
349
|
}
|
|
339
350
|
if (op.type === "set_node" && "type" in op.newProperties && op.newProperties.type === excludedNodeType) {
|
|
@@ -348,11 +359,11 @@ var shouldSave = (op, prev) => {
|
|
|
348
359
|
if (op.type === "split_node" && "type" in op.properties && op.properties.type === excludedNodeType) {
|
|
349
360
|
return false;
|
|
350
361
|
}
|
|
351
|
-
return defaultShouldSave(op);
|
|
362
|
+
return defaultShouldSave(op, prev);
|
|
352
363
|
};
|
|
353
364
|
function useCopilotTextareaEditor() {
|
|
354
|
-
const editor =
|
|
355
|
-
const editor2 = withPartialHistory(
|
|
365
|
+
const editor = (0, import_react2.useMemo)(() => {
|
|
366
|
+
const editor2 = withPartialHistory((0, import_slate_react.withReact)((0, import_slate2.createEditor)()), shouldSave);
|
|
356
367
|
const { isVoid } = editor2;
|
|
357
368
|
editor2.isVoid = (element) => {
|
|
358
369
|
switch (element.type) {
|
|
@@ -384,19 +395,26 @@ function useCopilotTextareaEditor() {
|
|
|
384
395
|
}, []);
|
|
385
396
|
return editor;
|
|
386
397
|
}
|
|
398
|
+
|
|
399
|
+
// src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts
|
|
400
|
+
var import_react3 = __toESM(require("react"));
|
|
401
|
+
var import_slate_react2 = require("slate-react");
|
|
402
|
+
|
|
403
|
+
// src/lib/get-text-around-cursor.ts
|
|
404
|
+
var import_slate3 = require("slate");
|
|
387
405
|
function getTextAroundCollapsedCursor(editor) {
|
|
388
406
|
const { selection } = editor;
|
|
389
|
-
if (!selection || !
|
|
407
|
+
if (!selection || !import_slate3.Range.isCollapsed(selection)) {
|
|
390
408
|
return null;
|
|
391
409
|
}
|
|
392
410
|
const cursorPoint = selection.anchor;
|
|
393
411
|
const beforeRange = {
|
|
394
|
-
anchor:
|
|
412
|
+
anchor: import_slate3.Editor.start(editor, []),
|
|
395
413
|
focus: cursorPoint
|
|
396
414
|
};
|
|
397
415
|
const afterRange = {
|
|
398
416
|
anchor: cursorPoint,
|
|
399
|
-
focus:
|
|
417
|
+
focus: import_slate3.Editor.end(editor, [])
|
|
400
418
|
};
|
|
401
419
|
const before = extractTextWithNewlines(editor, beforeRange);
|
|
402
420
|
const after = extractTextWithNewlines(editor, afterRange);
|
|
@@ -413,12 +431,12 @@ function getTextAroundSelection(editor) {
|
|
|
413
431
|
}
|
|
414
432
|
const wellOrderedSelection = wellOrderedRange(selection);
|
|
415
433
|
const beforeRange = {
|
|
416
|
-
anchor:
|
|
434
|
+
anchor: import_slate3.Editor.start(editor, []),
|
|
417
435
|
focus: wellOrderedSelection.anchor
|
|
418
436
|
};
|
|
419
437
|
const afterRange = {
|
|
420
438
|
anchor: wellOrderedSelection.focus,
|
|
421
|
-
focus:
|
|
439
|
+
focus: import_slate3.Editor.end(editor, [])
|
|
422
440
|
};
|
|
423
441
|
const before = extractTextWithNewlines(editor, beforeRange);
|
|
424
442
|
const after = extractTextWithNewlines(editor, afterRange);
|
|
@@ -432,25 +450,25 @@ function getTextAroundSelection(editor) {
|
|
|
432
450
|
}
|
|
433
451
|
function getFullEditorTextWithNewlines(editor) {
|
|
434
452
|
const fullDocumentRange = {
|
|
435
|
-
anchor:
|
|
436
|
-
focus:
|
|
453
|
+
anchor: import_slate3.Editor.start(editor, []),
|
|
454
|
+
focus: import_slate3.Editor.end(editor, [])
|
|
437
455
|
};
|
|
438
456
|
return extractTextWithNewlines(editor, fullDocumentRange);
|
|
439
457
|
}
|
|
440
458
|
function extractTextWithNewlines(editor, range) {
|
|
441
459
|
const voids = false;
|
|
442
|
-
const [start, end] =
|
|
460
|
+
const [start, end] = import_slate3.Range.edges(range);
|
|
443
461
|
let text = "";
|
|
444
462
|
let lastBlock = null;
|
|
445
|
-
for (const [node, path] of
|
|
463
|
+
for (const [node, path] of import_slate3.Editor.nodes(editor, {
|
|
446
464
|
at: range,
|
|
447
|
-
match:
|
|
465
|
+
match: import_slate3.Text.isText,
|
|
448
466
|
voids
|
|
449
467
|
})) {
|
|
450
468
|
let t = node.text;
|
|
451
|
-
const [block] =
|
|
469
|
+
const [block] = import_slate3.Editor.above(editor, {
|
|
452
470
|
at: path,
|
|
453
|
-
match: (n) =>
|
|
471
|
+
match: (n) => import_slate3.Element.isElement(n) && n.type === "paragraph"
|
|
454
472
|
}) || [null];
|
|
455
473
|
if (lastBlock !== block && block) {
|
|
456
474
|
if (lastBlock) {
|
|
@@ -458,10 +476,10 @@ function extractTextWithNewlines(editor, range) {
|
|
|
458
476
|
}
|
|
459
477
|
lastBlock = block;
|
|
460
478
|
}
|
|
461
|
-
if (
|
|
479
|
+
if (import_slate3.Path.equals(path, end.path)) {
|
|
462
480
|
t = t.slice(0, end.offset);
|
|
463
481
|
}
|
|
464
|
-
if (
|
|
482
|
+
if (import_slate3.Path.equals(path, start.path)) {
|
|
465
483
|
t = t.slice(start.offset);
|
|
466
484
|
}
|
|
467
485
|
text += t;
|
|
@@ -470,7 +488,7 @@ function extractTextWithNewlines(editor, range) {
|
|
|
470
488
|
}
|
|
471
489
|
function wellOrderedRange(range) {
|
|
472
490
|
const { anchor, focus } = range;
|
|
473
|
-
if (
|
|
491
|
+
if (import_slate3.Point.isBefore(anchor, focus)) {
|
|
474
492
|
return range;
|
|
475
493
|
}
|
|
476
494
|
return {
|
|
@@ -478,15 +496,18 @@ function wellOrderedRange(range) {
|
|
|
478
496
|
focus: anchor
|
|
479
497
|
};
|
|
480
498
|
}
|
|
499
|
+
|
|
500
|
+
// src/lib/slatejs-edits/replace-text.ts
|
|
501
|
+
var import_slate4 = require("slate");
|
|
481
502
|
function replaceEditorText(editor, newText) {
|
|
482
|
-
|
|
503
|
+
import_slate4.Transforms.delete(editor, {
|
|
483
504
|
at: {
|
|
484
|
-
anchor:
|
|
485
|
-
focus:
|
|
505
|
+
anchor: import_slate4.Editor.start(editor, []),
|
|
506
|
+
focus: import_slate4.Editor.end(editor, [])
|
|
486
507
|
}
|
|
487
508
|
});
|
|
488
509
|
if (newText && newText !== "") {
|
|
489
|
-
|
|
510
|
+
import_slate4.Transforms.insertNodes(
|
|
490
511
|
editor,
|
|
491
512
|
[
|
|
492
513
|
{
|
|
@@ -503,7 +524,7 @@ function replaceEditorText(editor, newText) {
|
|
|
503
524
|
|
|
504
525
|
// src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts
|
|
505
526
|
function usePopulateCopilotTextareaRef(editor, ref) {
|
|
506
|
-
|
|
527
|
+
import_react3.default.useImperativeHandle(
|
|
507
528
|
ref,
|
|
508
529
|
() => {
|
|
509
530
|
class Combined {
|
|
@@ -556,10 +577,10 @@ function usePopulateCopilotTextareaRef(editor, ref) {
|
|
|
556
577
|
this.editor = editor2;
|
|
557
578
|
}
|
|
558
579
|
focus() {
|
|
559
|
-
|
|
580
|
+
import_slate_react2.ReactEditor.focus(this.editor);
|
|
560
581
|
}
|
|
561
582
|
blur() {
|
|
562
|
-
|
|
583
|
+
import_slate_react2.ReactEditor.blur(this.editor);
|
|
563
584
|
}
|
|
564
585
|
get value() {
|
|
565
586
|
return getFullEditorTextWithNewlines(this.editor);
|
|
@@ -568,7 +589,7 @@ function usePopulateCopilotTextareaRef(editor, ref) {
|
|
|
568
589
|
replaceEditorText(this.editor, value);
|
|
569
590
|
}
|
|
570
591
|
}
|
|
571
|
-
const editorHtmlElement =
|
|
592
|
+
const editorHtmlElement = import_slate_react2.ReactEditor.toDOMNode(editor, editor);
|
|
572
593
|
const customMethods = new CustomMethods(editor);
|
|
573
594
|
const combined = new Combined(customMethods, editorHtmlElement);
|
|
574
595
|
return new Proxy(combined, handler);
|
|
@@ -576,9 +597,12 @@ function usePopulateCopilotTextareaRef(editor, ref) {
|
|
|
576
597
|
[editor]
|
|
577
598
|
);
|
|
578
599
|
}
|
|
600
|
+
|
|
601
|
+
// src/lib/slatejs-edits/add-autocompletions.ts
|
|
602
|
+
var import_slate5 = require("slate");
|
|
579
603
|
function addAutocompletionsToEditor(editor, newSuggestion, point) {
|
|
580
604
|
const editorPosition = editor.selection;
|
|
581
|
-
|
|
605
|
+
import_slate5.Transforms.insertNodes(
|
|
582
606
|
editor,
|
|
583
607
|
[
|
|
584
608
|
{
|
|
@@ -596,21 +620,27 @@ function addAutocompletionsToEditor(editor, newSuggestion, point) {
|
|
|
596
620
|
editor.selection = editorPosition;
|
|
597
621
|
}
|
|
598
622
|
}
|
|
623
|
+
|
|
624
|
+
// src/lib/slatejs-edits/clear-autocompletions.ts
|
|
625
|
+
var import_slate6 = require("slate");
|
|
599
626
|
function clearAutocompletionsFromEditor(editor) {
|
|
600
627
|
const paths = [];
|
|
601
|
-
for (const [node, path] of
|
|
602
|
-
if (
|
|
628
|
+
for (const [node, path] of import_slate6.Node.nodes(editor)) {
|
|
629
|
+
if (import_slate6.Element.isElement(node) && node.type === "suggestion") {
|
|
603
630
|
paths.push(path);
|
|
604
631
|
}
|
|
605
632
|
}
|
|
606
633
|
for (const path of paths) {
|
|
607
634
|
try {
|
|
608
|
-
|
|
635
|
+
import_slate6.Transforms.removeNodes(editor, { at: path });
|
|
609
636
|
} catch (e) {
|
|
610
637
|
console.log("CopilotTextarea.clearAutocompletionsFromEditor: error removing node", e);
|
|
611
638
|
}
|
|
612
639
|
}
|
|
613
640
|
}
|
|
641
|
+
|
|
642
|
+
// src/types/base/base-autosuggestions-config.tsx
|
|
643
|
+
var import_react_core = require("@copilotkit/react-core");
|
|
614
644
|
var defaultShouldToggleHoveringEditorOnKeyPress = (event) => {
|
|
615
645
|
if (event.key === "k" && event.metaKey) {
|
|
616
646
|
return true;
|
|
@@ -625,15 +655,23 @@ var defaultShouldAcceptAutosuggestionOnKeyPress = (event) => {
|
|
|
625
655
|
};
|
|
626
656
|
var defaultBaseAutosuggestionsConfig = {
|
|
627
657
|
debounceTime: 250,
|
|
628
|
-
contextCategories:
|
|
658
|
+
contextCategories: import_react_core.defaultCopilotContextCategories,
|
|
629
659
|
disableWhenEmpty: true,
|
|
630
660
|
disabled: false,
|
|
631
661
|
temporarilyDisableWhenMovingCursorWithoutChangingText: true,
|
|
632
662
|
shouldToggleHoveringEditorOnKeyPress: defaultShouldToggleHoveringEditorOnKeyPress,
|
|
633
663
|
shouldAcceptAutosuggestionOnKeyPress: defaultShouldAcceptAutosuggestionOnKeyPress
|
|
634
664
|
};
|
|
665
|
+
|
|
666
|
+
// src/components/hovering-toolbar/hovering-toolbar.tsx
|
|
667
|
+
var import_react9 = require("react");
|
|
668
|
+
var import_slate7 = require("slate");
|
|
669
|
+
var import_slate_react3 = require("slate-react");
|
|
670
|
+
|
|
671
|
+
// src/hooks/misc/use-autosize-textarea.tsx
|
|
672
|
+
var import_react4 = require("react");
|
|
635
673
|
var useAutosizeTextArea = (textAreaRef, value) => {
|
|
636
|
-
|
|
674
|
+
(0, import_react4.useEffect)(() => {
|
|
637
675
|
if (textAreaRef.current !== null) {
|
|
638
676
|
textAreaRef.current.style.height = "0px";
|
|
639
677
|
const scrollHeight = textAreaRef.current.scrollHeight;
|
|
@@ -642,10 +680,18 @@ var useAutosizeTextArea = (textAreaRef, value) => {
|
|
|
642
680
|
}, [textAreaRef, value]);
|
|
643
681
|
};
|
|
644
682
|
var use_autosize_textarea_default = useAutosizeTextArea;
|
|
645
|
-
|
|
683
|
+
|
|
684
|
+
// src/components/source-search-box/source-search-box.tsx
|
|
685
|
+
var import_react5 = require("react");
|
|
686
|
+
|
|
687
|
+
// src/components/ui/command.tsx
|
|
688
|
+
var React2 = __toESM(require("react"));
|
|
689
|
+
var import_cmdk = require("cmdk");
|
|
690
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
691
|
+
var Command = React2.forwardRef((_a, ref) => {
|
|
646
692
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
647
|
-
return /* @__PURE__ */
|
|
648
|
-
|
|
693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
694
|
+
import_cmdk.Command,
|
|
649
695
|
__spreadValues({
|
|
650
696
|
ref,
|
|
651
697
|
className: cn(
|
|
@@ -655,11 +701,11 @@ var Command = React2__namespace.forwardRef((_a, ref) => {
|
|
|
655
701
|
}, props)
|
|
656
702
|
);
|
|
657
703
|
});
|
|
658
|
-
Command.displayName =
|
|
659
|
-
var CommandInput =
|
|
704
|
+
Command.displayName = import_cmdk.Command.displayName;
|
|
705
|
+
var CommandInput = React2.forwardRef((_a, ref) => {
|
|
660
706
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
661
|
-
return /* @__PURE__ */
|
|
662
|
-
|
|
707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
708
|
+
import_cmdk.Command.Input,
|
|
663
709
|
__spreadValues({
|
|
664
710
|
ref,
|
|
665
711
|
className: cn(
|
|
@@ -669,24 +715,24 @@ var CommandInput = React2__namespace.forwardRef((_a, ref) => {
|
|
|
669
715
|
}, props)
|
|
670
716
|
) });
|
|
671
717
|
});
|
|
672
|
-
CommandInput.displayName =
|
|
673
|
-
var CommandList =
|
|
718
|
+
CommandInput.displayName = import_cmdk.Command.Input.displayName;
|
|
719
|
+
var CommandList = React2.forwardRef((_a, ref) => {
|
|
674
720
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
675
|
-
return /* @__PURE__ */
|
|
676
|
-
|
|
721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
722
|
+
import_cmdk.Command.List,
|
|
677
723
|
__spreadValues({
|
|
678
724
|
ref,
|
|
679
725
|
className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden pb-2", className)
|
|
680
726
|
}, props)
|
|
681
727
|
);
|
|
682
728
|
});
|
|
683
|
-
CommandList.displayName =
|
|
684
|
-
var CommandEmpty =
|
|
685
|
-
CommandEmpty.displayName =
|
|
686
|
-
var CommandGroup =
|
|
729
|
+
CommandList.displayName = import_cmdk.Command.List.displayName;
|
|
730
|
+
var CommandEmpty = React2.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_cmdk.Command.Empty, __spreadValues({ ref, className: "py-6 text-center text-sm" }, props)));
|
|
731
|
+
CommandEmpty.displayName = import_cmdk.Command.Empty.displayName;
|
|
732
|
+
var CommandGroup = React2.forwardRef((_a, ref) => {
|
|
687
733
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
688
|
-
return /* @__PURE__ */
|
|
689
|
-
|
|
734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
735
|
+
import_cmdk.Command.Group,
|
|
690
736
|
__spreadValues({
|
|
691
737
|
ref,
|
|
692
738
|
className: cn(
|
|
@@ -696,22 +742,22 @@ var CommandGroup = React2__namespace.forwardRef((_a, ref) => {
|
|
|
696
742
|
}, props)
|
|
697
743
|
);
|
|
698
744
|
});
|
|
699
|
-
CommandGroup.displayName =
|
|
700
|
-
var CommandSeparator =
|
|
745
|
+
CommandGroup.displayName = import_cmdk.Command.Group.displayName;
|
|
746
|
+
var CommandSeparator = React2.forwardRef((_a, ref) => {
|
|
701
747
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
702
|
-
return /* @__PURE__ */
|
|
703
|
-
|
|
748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
749
|
+
import_cmdk.Command.Separator,
|
|
704
750
|
__spreadValues({
|
|
705
751
|
ref,
|
|
706
752
|
className: cn("-mx-1 h-px bg-border", className)
|
|
707
753
|
}, props)
|
|
708
754
|
);
|
|
709
755
|
});
|
|
710
|
-
CommandSeparator.displayName =
|
|
711
|
-
var CommandItem =
|
|
756
|
+
CommandSeparator.displayName = import_cmdk.Command.Separator.displayName;
|
|
757
|
+
var CommandItem = React2.forwardRef((_a, ref) => {
|
|
712
758
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
713
|
-
return /* @__PURE__ */
|
|
714
|
-
|
|
759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
760
|
+
import_cmdk.Command.Item,
|
|
715
761
|
__spreadValues({
|
|
716
762
|
ref,
|
|
717
763
|
className: cn(
|
|
@@ -721,10 +767,23 @@ var CommandItem = React2__namespace.forwardRef((_a, ref) => {
|
|
|
721
767
|
}, props)
|
|
722
768
|
);
|
|
723
769
|
});
|
|
724
|
-
CommandItem.displayName =
|
|
770
|
+
CommandItem.displayName = import_cmdk.Command.Item.displayName;
|
|
771
|
+
var CommandShortcut = (_a) => {
|
|
772
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
774
|
+
"span",
|
|
775
|
+
__spreadValues({
|
|
776
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className)
|
|
777
|
+
}, props)
|
|
778
|
+
);
|
|
779
|
+
};
|
|
780
|
+
CommandShortcut.displayName = "CommandShortcut";
|
|
781
|
+
|
|
782
|
+
// src/components/source-search-box/source-search-box.tsx
|
|
783
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
725
784
|
function SourceSearchBox(props) {
|
|
726
|
-
const [selectedValue, setSelectedValue] =
|
|
727
|
-
return /* @__PURE__ */
|
|
785
|
+
const [selectedValue, setSelectedValue] = (0, import_react5.useState)("");
|
|
786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
728
787
|
Command,
|
|
729
788
|
{
|
|
730
789
|
className: "rounded-lg border shadow-md",
|
|
@@ -740,7 +799,7 @@ function SourceSearchBox(props) {
|
|
|
740
799
|
return 0;
|
|
741
800
|
},
|
|
742
801
|
children: [
|
|
743
|
-
/* @__PURE__ */
|
|
802
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
744
803
|
CommandInput,
|
|
745
804
|
{
|
|
746
805
|
value: props.searchTerm,
|
|
@@ -748,18 +807,18 @@ function SourceSearchBox(props) {
|
|
|
748
807
|
placeholder: "Search for a command..."
|
|
749
808
|
}
|
|
750
809
|
),
|
|
751
|
-
/* @__PURE__ */
|
|
752
|
-
/* @__PURE__ */
|
|
753
|
-
/* @__PURE__ */
|
|
754
|
-
return /* @__PURE__ */
|
|
810
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(CommandList, { children: [
|
|
811
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CommandEmpty, { children: "No results found." }),
|
|
812
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CommandGroup, { heading: "Available resources", children: props.suggestedFiles.map((filePointer) => {
|
|
813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
755
814
|
CommandItem,
|
|
756
815
|
{
|
|
757
816
|
value: filePointer.name,
|
|
758
817
|
onSelect: (value) => {
|
|
759
818
|
props.onSelectedFile(filePointer);
|
|
760
819
|
},
|
|
761
|
-
children: /* @__PURE__ */
|
|
762
|
-
/* @__PURE__ */
|
|
820
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: " px-3 flex flex-row gap-1 items-center", children: [
|
|
821
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Logo, { width: "20px", height: "20px", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
763
822
|
"img",
|
|
764
823
|
{
|
|
765
824
|
src: filePointer.iconImageUri,
|
|
@@ -773,7 +832,7 @@ function SourceSearchBox(props) {
|
|
|
773
832
|
`word-${filePointer.sourceApplication}.${filePointer.name}`
|
|
774
833
|
);
|
|
775
834
|
}) }),
|
|
776
|
-
/* @__PURE__ */
|
|
835
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CommandSeparator, {})
|
|
777
836
|
] })
|
|
778
837
|
]
|
|
779
838
|
}
|
|
@@ -784,9 +843,15 @@ function Logo({
|
|
|
784
843
|
width,
|
|
785
844
|
height
|
|
786
845
|
}) {
|
|
787
|
-
return /* @__PURE__ */
|
|
846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex items-center justify-center", style: { width, height }, children });
|
|
788
847
|
}
|
|
789
|
-
|
|
848
|
+
|
|
849
|
+
// src/components/ui/button.tsx
|
|
850
|
+
var React3 = __toESM(require("react"));
|
|
851
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
852
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
853
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
854
|
+
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
790
855
|
"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
791
856
|
{
|
|
792
857
|
variants: {
|
|
@@ -811,22 +876,31 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
811
876
|
}
|
|
812
877
|
}
|
|
813
878
|
);
|
|
814
|
-
var Button =
|
|
879
|
+
var Button = React3.forwardRef(
|
|
815
880
|
(_a, ref) => {
|
|
816
881
|
var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest(_b, ["className", "variant", "size", "asChild"]);
|
|
817
|
-
const Comp = asChild ?
|
|
818
|
-
return /* @__PURE__ */
|
|
882
|
+
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Comp, __spreadValues({ className: cn(buttonVariants({ variant, size, className })), ref }, props));
|
|
819
884
|
}
|
|
820
885
|
);
|
|
821
886
|
Button.displayName = "Button";
|
|
822
|
-
|
|
887
|
+
|
|
888
|
+
// src/components/ui/label.tsx
|
|
889
|
+
var React4 = __toESM(require("react"));
|
|
890
|
+
var LabelPrimitive = __toESM(require("@radix-ui/react-label"));
|
|
891
|
+
var import_class_variance_authority2 = require("class-variance-authority");
|
|
892
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
893
|
+
var labelVariants = (0, import_class_variance_authority2.cva)(
|
|
823
894
|
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
824
895
|
);
|
|
825
|
-
var Label =
|
|
896
|
+
var Label = React4.forwardRef((_a, ref) => {
|
|
826
897
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
827
|
-
return /* @__PURE__ */
|
|
898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LabelPrimitive.Root, __spreadValues({ ref, className: cn(labelVariants(), className) }, props));
|
|
828
899
|
});
|
|
829
|
-
Label.displayName =
|
|
900
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
901
|
+
|
|
902
|
+
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
903
|
+
var import_react6 = require("react");
|
|
830
904
|
|
|
831
905
|
// src/lib/stream-promise-flatten.ts
|
|
832
906
|
function streamPromiseFlatten(promise) {
|
|
@@ -851,14 +925,22 @@ function streamPromiseFlatten(promise) {
|
|
|
851
925
|
}
|
|
852
926
|
});
|
|
853
927
|
}
|
|
928
|
+
|
|
929
|
+
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
930
|
+
var import_react_core2 = require("@copilotkit/react-core");
|
|
931
|
+
|
|
932
|
+
// src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx
|
|
933
|
+
var import_Chip = __toESM(require("@mui/material/Chip/Chip.js"));
|
|
934
|
+
var import_Avatar = __toESM(require("@mui/material/Avatar/Avatar.js"));
|
|
935
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
854
936
|
var IncludedFilesPreview = ({
|
|
855
937
|
includedFiles,
|
|
856
938
|
setIncludedFiles
|
|
857
939
|
}) => {
|
|
858
|
-
return /* @__PURE__ */
|
|
859
|
-
/* @__PURE__ */
|
|
860
|
-
/* @__PURE__ */
|
|
861
|
-
return /* @__PURE__ */
|
|
940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col gap-2 mt-2", children: [
|
|
941
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Label, { className: "", children: "Included context:" }),
|
|
942
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex flex-wrap gap-2", children: includedFiles.map((filePointer, index) => {
|
|
943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
862
944
|
FileChipPreview,
|
|
863
945
|
{
|
|
864
946
|
filePointer,
|
|
@@ -872,13 +954,13 @@ var IncludedFilesPreview = ({
|
|
|
872
954
|
] });
|
|
873
955
|
};
|
|
874
956
|
var FileChipPreview = ({ filePointer, onDelete }) => {
|
|
875
|
-
return /* @__PURE__ */
|
|
876
|
-
|
|
957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
958
|
+
import_Chip.default,
|
|
877
959
|
{
|
|
878
960
|
label: filePointer.name,
|
|
879
961
|
onDelete,
|
|
880
|
-
avatar: /* @__PURE__ */
|
|
881
|
-
|
|
962
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
963
|
+
import_Avatar.default,
|
|
882
964
|
{
|
|
883
965
|
src: filePointer.iconImageUri,
|
|
884
966
|
alt: filePointer.sourceApplication,
|
|
@@ -888,35 +970,38 @@ var FileChipPreview = ({ filePointer, onDelete }) => {
|
|
|
888
970
|
}
|
|
889
971
|
);
|
|
890
972
|
};
|
|
973
|
+
|
|
974
|
+
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
975
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
891
976
|
var HoveringInsertionPromptBoxCore = ({
|
|
892
977
|
performInsertion,
|
|
893
978
|
state,
|
|
894
979
|
insertionOrEditingFunction,
|
|
895
980
|
contextCategories
|
|
896
981
|
}) => {
|
|
897
|
-
const { getDocumentsContext } =
|
|
898
|
-
const [editSuggestion, setEditSuggestion] =
|
|
899
|
-
const [suggestionIsLoading, setSuggestionIsLoading] =
|
|
900
|
-
const [adjustmentPrompt, setAdjustmentPrompt] =
|
|
901
|
-
const [generatingSuggestion, setGeneratingSuggestion] =
|
|
982
|
+
const { getDocumentsContext } = (0, import_react6.useContext)(import_react_core2.CopilotContext);
|
|
983
|
+
const [editSuggestion, setEditSuggestion] = (0, import_react6.useState)("");
|
|
984
|
+
const [suggestionIsLoading, setSuggestionIsLoading] = (0, import_react6.useState)(false);
|
|
985
|
+
const [adjustmentPrompt, setAdjustmentPrompt] = (0, import_react6.useState)("");
|
|
986
|
+
const [generatingSuggestion, setGeneratingSuggestion] = (0, import_react6.useState)(
|
|
902
987
|
null
|
|
903
988
|
);
|
|
904
|
-
const adjustmentTextAreaRef =
|
|
905
|
-
const suggestionTextAreaRef =
|
|
906
|
-
const [filePointers, setFilePointers] =
|
|
907
|
-
const [suggestedFiles, setSuggestedFiles] =
|
|
908
|
-
|
|
989
|
+
const adjustmentTextAreaRef = (0, import_react6.useRef)(null);
|
|
990
|
+
const suggestionTextAreaRef = (0, import_react6.useRef)(null);
|
|
991
|
+
const [filePointers, setFilePointers] = (0, import_react6.useState)([]);
|
|
992
|
+
const [suggestedFiles, setSuggestedFiles] = (0, import_react6.useState)([]);
|
|
993
|
+
(0, import_react6.useEffect)(() => {
|
|
909
994
|
setSuggestedFiles(getDocumentsContext(contextCategories));
|
|
910
995
|
}, [contextCategories, getDocumentsContext]);
|
|
911
996
|
use_autosize_textarea_default(suggestionTextAreaRef, editSuggestion || "");
|
|
912
997
|
use_autosize_textarea_default(adjustmentTextAreaRef, adjustmentPrompt || "");
|
|
913
|
-
|
|
998
|
+
(0, import_react6.useEffect)(() => {
|
|
914
999
|
setTimeout(() => {
|
|
915
1000
|
var _a;
|
|
916
1001
|
(_a = adjustmentTextAreaRef.current) == null ? void 0 : _a.focus();
|
|
917
1002
|
}, 0);
|
|
918
1003
|
}, []);
|
|
919
|
-
|
|
1004
|
+
(0, import_react6.useEffect)(() => {
|
|
920
1005
|
if (!generatingSuggestion) {
|
|
921
1006
|
return;
|
|
922
1007
|
}
|
|
@@ -954,7 +1039,7 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
954
1039
|
releaseLockIfNotClosed();
|
|
955
1040
|
};
|
|
956
1041
|
}, [generatingSuggestion]);
|
|
957
|
-
const beginGeneratingAdjustment =
|
|
1042
|
+
const beginGeneratingAdjustment = (0, import_react6.useCallback)(() => __async(void 0, null, function* () {
|
|
958
1043
|
if (!adjustmentPrompt.trim()) {
|
|
959
1044
|
return;
|
|
960
1045
|
}
|
|
@@ -983,10 +1068,10 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
983
1068
|
const textToEdit = editSuggestion || state.editorState.selectedText;
|
|
984
1069
|
const adjustmentLabel = textToEdit === "" ? "Describe the text you want to insert" : "Describe adjustments to the suggested text";
|
|
985
1070
|
const placeholder = textToEdit === "" ? "e.g. 'summarize the client's top 3 pain-points from @CallTranscript'" : "e.g. 'make it more formal', 'be more specific', ...";
|
|
986
|
-
const AdjustmentPromptComponent = /* @__PURE__ */
|
|
987
|
-
/* @__PURE__ */
|
|
988
|
-
/* @__PURE__ */
|
|
989
|
-
/* @__PURE__ */
|
|
1071
|
+
const AdjustmentPromptComponent = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1072
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Label, { className: "", children: adjustmentLabel }),
|
|
1073
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative w-full flex items-center", children: [
|
|
1074
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
990
1075
|
"textarea",
|
|
991
1076
|
{
|
|
992
1077
|
disabled: suggestionIsLoading,
|
|
@@ -1008,29 +1093,29 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1008
1093
|
rows: 1
|
|
1009
1094
|
}
|
|
1010
1095
|
),
|
|
1011
|
-
/* @__PURE__ */
|
|
1096
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1012
1097
|
"button",
|
|
1013
1098
|
{
|
|
1014
1099
|
onClick: beginGeneratingAdjustment,
|
|
1015
1100
|
className: "absolute right-2 bg-blue-500 text-white w-8 h-8 rounded-full flex items-center justify-center",
|
|
1016
|
-
children: /* @__PURE__ */
|
|
1101
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("i", { className: "material-icons", children: "arrow_forward" })
|
|
1017
1102
|
}
|
|
1018
1103
|
)
|
|
1019
1104
|
] })
|
|
1020
1105
|
] });
|
|
1021
|
-
const SuggestionComponent = /* @__PURE__ */
|
|
1022
|
-
/* @__PURE__ */
|
|
1023
|
-
/* @__PURE__ */
|
|
1024
|
-
/* @__PURE__ */
|
|
1106
|
+
const SuggestionComponent = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1107
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex justify-between items-end w-full", children: [
|
|
1108
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Label, { className: "mt-4", children: "Suggested:" }),
|
|
1109
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ml-auto", children: isLoading && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1025
1110
|
"div",
|
|
1026
1111
|
{
|
|
1027
1112
|
className: "inline-block h-4 w-4 animate-spin rounded-full border-4 border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite]",
|
|
1028
1113
|
role: "status",
|
|
1029
|
-
children: /* @__PURE__ */
|
|
1114
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]", children: "Loading..." })
|
|
1030
1115
|
}
|
|
1031
1116
|
) }) })
|
|
1032
1117
|
] }),
|
|
1033
|
-
/* @__PURE__ */
|
|
1118
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1034
1119
|
"textarea",
|
|
1035
1120
|
{
|
|
1036
1121
|
ref: suggestionTextAreaRef,
|
|
@@ -1042,7 +1127,7 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1042
1127
|
}
|
|
1043
1128
|
)
|
|
1044
1129
|
] });
|
|
1045
|
-
const SubmitComponent = /* @__PURE__ */
|
|
1130
|
+
const SubmitComponent = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex w-full gap-4 justify-start", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1046
1131
|
Button,
|
|
1047
1132
|
{
|
|
1048
1133
|
className: " bg-green-700 text-white",
|
|
@@ -1051,16 +1136,16 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1051
1136
|
},
|
|
1052
1137
|
children: [
|
|
1053
1138
|
"Insert ",
|
|
1054
|
-
/* @__PURE__ */
|
|
1139
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("i", { className: "material-icons", children: "check" })
|
|
1055
1140
|
]
|
|
1056
1141
|
}
|
|
1057
1142
|
) });
|
|
1058
1143
|
const sourceSearchCandidate = adjustmentPrompt.split(" ").pop();
|
|
1059
1144
|
const sourceSearchWord = (sourceSearchCandidate == null ? void 0 : sourceSearchCandidate.startsWith("@")) ? sourceSearchCandidate.slice(1) : void 0;
|
|
1060
|
-
return /* @__PURE__ */
|
|
1145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "w-full flex flex-col items-start relative gap-2", children: [
|
|
1061
1146
|
AdjustmentPromptComponent,
|
|
1062
|
-
filePointers.length > 0 && /* @__PURE__ */
|
|
1063
|
-
sourceSearchWord !== void 0 && /* @__PURE__ */
|
|
1147
|
+
filePointers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IncludedFilesPreview, { includedFiles: filePointers, setIncludedFiles: setFilePointers }),
|
|
1148
|
+
sourceSearchWord !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1064
1149
|
SourceSearchBox,
|
|
1065
1150
|
{
|
|
1066
1151
|
searchTerm: sourceSearchWord,
|
|
@@ -1077,13 +1162,16 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1077
1162
|
generatingSuggestion ? SubmitComponent : null
|
|
1078
1163
|
] });
|
|
1079
1164
|
};
|
|
1165
|
+
|
|
1166
|
+
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx
|
|
1167
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1080
1168
|
var HoveringInsertionPromptBox = (props) => {
|
|
1081
|
-
return /* @__PURE__ */
|
|
1169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1082
1170
|
"div",
|
|
1083
1171
|
{
|
|
1084
1172
|
className: "flex flex-col justify-center items-center space-y-4 rounded-md border shadow-lg p-4 border-gray- bg-white",
|
|
1085
1173
|
style: { width: "35rem" },
|
|
1086
|
-
children: /* @__PURE__ */
|
|
1174
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1087
1175
|
HoveringInsertionPromptBoxCore,
|
|
1088
1176
|
{
|
|
1089
1177
|
state: {
|
|
@@ -1097,7 +1185,13 @@ var HoveringInsertionPromptBox = (props) => {
|
|
|
1097
1185
|
}
|
|
1098
1186
|
);
|
|
1099
1187
|
};
|
|
1100
|
-
|
|
1188
|
+
|
|
1189
|
+
// src/components/hovering-toolbar/hovering-toolbar-components.tsx
|
|
1190
|
+
var import_css = require("@emotion/css");
|
|
1191
|
+
var import_react7 = __toESM(require("react"));
|
|
1192
|
+
var import_react_dom = __toESM(require("react-dom"));
|
|
1193
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1194
|
+
var Button2 = import_react7.default.forwardRef(
|
|
1101
1195
|
(_a, ref) => {
|
|
1102
1196
|
var _b = _a, {
|
|
1103
1197
|
className,
|
|
@@ -1108,13 +1202,13 @@ React2__namespace.default.forwardRef(
|
|
|
1108
1202
|
"active",
|
|
1109
1203
|
"reversed"
|
|
1110
1204
|
]);
|
|
1111
|
-
return /* @__PURE__ */
|
|
1205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1112
1206
|
"span",
|
|
1113
1207
|
__spreadProps(__spreadValues({}, props), {
|
|
1114
1208
|
ref,
|
|
1115
|
-
className:
|
|
1209
|
+
className: (0, import_css.cx)(
|
|
1116
1210
|
className,
|
|
1117
|
-
|
|
1211
|
+
import_css.css`
|
|
1118
1212
|
cursor: pointer;
|
|
1119
1213
|
color: ${reversed ? active ? "white" : "#aaa" : active ? "black" : "#ccc"};
|
|
1120
1214
|
`
|
|
@@ -1123,17 +1217,17 @@ React2__namespace.default.forwardRef(
|
|
|
1123
1217
|
);
|
|
1124
1218
|
}
|
|
1125
1219
|
);
|
|
1126
|
-
|
|
1220
|
+
var Icon = import_react7.default.forwardRef(
|
|
1127
1221
|
(_a, ref) => {
|
|
1128
1222
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1129
|
-
return /* @__PURE__ */
|
|
1223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1130
1224
|
"span",
|
|
1131
1225
|
__spreadProps(__spreadValues({}, props), {
|
|
1132
1226
|
ref,
|
|
1133
|
-
className:
|
|
1227
|
+
className: (0, import_css.cx)(
|
|
1134
1228
|
"material-icons",
|
|
1135
1229
|
className,
|
|
1136
|
-
|
|
1230
|
+
import_css.css`
|
|
1137
1231
|
font-size: 18px;
|
|
1138
1232
|
vertical-align: text-bottom;
|
|
1139
1233
|
`
|
|
@@ -1142,17 +1236,17 @@ React2__namespace.default.forwardRef(
|
|
|
1142
1236
|
);
|
|
1143
1237
|
}
|
|
1144
1238
|
);
|
|
1145
|
-
var Menu =
|
|
1239
|
+
var Menu = import_react7.default.forwardRef(
|
|
1146
1240
|
(_a, ref) => {
|
|
1147
1241
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1148
|
-
return /* @__PURE__ */
|
|
1242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1149
1243
|
"div",
|
|
1150
1244
|
__spreadProps(__spreadValues({}, props), {
|
|
1151
1245
|
"data-test-id": "menu",
|
|
1152
1246
|
ref,
|
|
1153
|
-
className:
|
|
1247
|
+
className: (0, import_css.cx)(
|
|
1154
1248
|
className,
|
|
1155
|
-
|
|
1249
|
+
import_css.css`
|
|
1156
1250
|
& > * {
|
|
1157
1251
|
display: inline-block;
|
|
1158
1252
|
}
|
|
@@ -1167,18 +1261,18 @@ var Menu = React2__namespace.default.forwardRef(
|
|
|
1167
1261
|
}
|
|
1168
1262
|
);
|
|
1169
1263
|
var Portal = ({ children }) => {
|
|
1170
|
-
return typeof document === "object" ?
|
|
1264
|
+
return typeof document === "object" ? import_react_dom.default.createPortal(children, document.body) : null;
|
|
1171
1265
|
};
|
|
1172
|
-
|
|
1266
|
+
var Toolbar = import_react7.default.forwardRef(
|
|
1173
1267
|
(_a, ref) => {
|
|
1174
1268
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1175
|
-
return /* @__PURE__ */
|
|
1269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1176
1270
|
Menu,
|
|
1177
1271
|
__spreadProps(__spreadValues({}, props), {
|
|
1178
1272
|
ref,
|
|
1179
|
-
className:
|
|
1273
|
+
className: (0, import_css.cx)(
|
|
1180
1274
|
className,
|
|
1181
|
-
|
|
1275
|
+
import_css.css`
|
|
1182
1276
|
position: relative;
|
|
1183
1277
|
padding: 1px 18px 17px;
|
|
1184
1278
|
margin: 0 -20px;
|
|
@@ -1190,26 +1284,33 @@ React2__namespace.default.forwardRef(
|
|
|
1190
1284
|
);
|
|
1191
1285
|
}
|
|
1192
1286
|
);
|
|
1193
|
-
|
|
1287
|
+
|
|
1288
|
+
// src/components/hovering-toolbar/hovering-editor-provider.tsx
|
|
1289
|
+
var import_react8 = require("react");
|
|
1290
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1291
|
+
var HoveringEditorContext = (0, import_react8.createContext)({
|
|
1194
1292
|
isDisplayed: false,
|
|
1195
1293
|
setIsDisplayed: () => {
|
|
1196
1294
|
}
|
|
1197
1295
|
});
|
|
1198
1296
|
var HoveringEditorProvider = ({ children }) => {
|
|
1199
|
-
const [isDisplayed, setIsDisplayed] =
|
|
1200
|
-
return /* @__PURE__ */
|
|
1297
|
+
const [isDisplayed, setIsDisplayed] = (0, import_react8.useState)(false);
|
|
1298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(HoveringEditorContext.Provider, { value: { isDisplayed, setIsDisplayed }, children });
|
|
1201
1299
|
};
|
|
1202
|
-
var useHoveringEditorContext = () =>
|
|
1300
|
+
var useHoveringEditorContext = () => (0, import_react8.useContext)(HoveringEditorContext);
|
|
1301
|
+
|
|
1302
|
+
// src/components/hovering-toolbar/hovering-toolbar.tsx
|
|
1303
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1203
1304
|
var HoveringToolbar = (props) => {
|
|
1204
|
-
const ref =
|
|
1205
|
-
const editor =
|
|
1206
|
-
const selection =
|
|
1305
|
+
const ref = (0, import_react9.useRef)(null);
|
|
1306
|
+
const editor = (0, import_slate_react3.useSlate)();
|
|
1307
|
+
const selection = (0, import_slate_react3.useSlateSelection)();
|
|
1207
1308
|
const { isDisplayed, setIsDisplayed } = useHoveringEditorContext();
|
|
1208
|
-
const [isClient, setIsClient] =
|
|
1209
|
-
|
|
1309
|
+
const [isClient, setIsClient] = (0, import_react9.useState)(false);
|
|
1310
|
+
(0, import_react9.useEffect)(() => {
|
|
1210
1311
|
setIsClient(true);
|
|
1211
1312
|
}, []);
|
|
1212
|
-
|
|
1313
|
+
(0, import_react9.useEffect)(() => {
|
|
1213
1314
|
const el = ref.current;
|
|
1214
1315
|
const { selection: selection2 } = editor;
|
|
1215
1316
|
if (!el) {
|
|
@@ -1247,7 +1348,7 @@ var HoveringToolbar = (props) => {
|
|
|
1247
1348
|
el.style.top = `${top}px`;
|
|
1248
1349
|
el.style.left = `${left}px`;
|
|
1249
1350
|
});
|
|
1250
|
-
|
|
1351
|
+
(0, import_react9.useEffect)(() => {
|
|
1251
1352
|
const handleClickOutside = (event) => {
|
|
1252
1353
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
1253
1354
|
setIsDisplayed(false);
|
|
@@ -1261,23 +1362,23 @@ var HoveringToolbar = (props) => {
|
|
|
1261
1362
|
if (!isClient) {
|
|
1262
1363
|
return null;
|
|
1263
1364
|
}
|
|
1264
|
-
return /* @__PURE__ */
|
|
1365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1265
1366
|
Menu,
|
|
1266
1367
|
{
|
|
1267
1368
|
ref,
|
|
1268
1369
|
className: props.hoverMenuClassname || "p-2 absolute z-10 top-[-10000px] left-[-10000px] mt-[-6px] opacity-0 transition-opacity duration-700",
|
|
1269
|
-
children: isDisplayed && selection && /* @__PURE__ */
|
|
1370
|
+
children: isDisplayed && selection && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1270
1371
|
HoveringInsertionPromptBox,
|
|
1271
1372
|
{
|
|
1272
|
-
editorState: editorState(editor),
|
|
1373
|
+
editorState: editorState(editor, selection),
|
|
1273
1374
|
apiConfig: props.apiConfig,
|
|
1274
1375
|
closeWindow: () => {
|
|
1275
1376
|
setIsDisplayed(false);
|
|
1276
1377
|
},
|
|
1277
1378
|
performInsertion: (insertedText) => {
|
|
1278
1379
|
console.log("inserted text", insertedText);
|
|
1279
|
-
|
|
1280
|
-
|
|
1380
|
+
import_slate7.Transforms.delete(editor, { at: selection });
|
|
1381
|
+
import_slate7.Transforms.insertText(editor, insertedText, {
|
|
1281
1382
|
at: selection
|
|
1282
1383
|
});
|
|
1283
1384
|
setIsDisplayed(false);
|
|
@@ -1299,21 +1400,24 @@ function editorState(editor, selection) {
|
|
|
1299
1400
|
selectedText: ""
|
|
1300
1401
|
};
|
|
1301
1402
|
}
|
|
1403
|
+
|
|
1404
|
+
// src/components/base-copilot-textarea/render-element.tsx
|
|
1405
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1302
1406
|
function makeRenderElementFunction(suggestionsStyle) {
|
|
1303
1407
|
return (props) => {
|
|
1304
1408
|
switch (props.element.type) {
|
|
1305
1409
|
case "paragraph":
|
|
1306
|
-
return /* @__PURE__ */
|
|
1410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DefaultElement, __spreadValues({}, props));
|
|
1307
1411
|
case "suggestion":
|
|
1308
|
-
return /* @__PURE__ */
|
|
1412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SuggestionElement, __spreadProps(__spreadValues({}, props), { suggestionsStyle }));
|
|
1309
1413
|
}
|
|
1310
1414
|
};
|
|
1311
1415
|
}
|
|
1312
1416
|
var DefaultElement = (props) => {
|
|
1313
|
-
return /* @__PURE__ */
|
|
1417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", __spreadProps(__spreadValues({}, props.attributes), { children: props.children }));
|
|
1314
1418
|
};
|
|
1315
1419
|
var SuggestionElement = (props) => {
|
|
1316
|
-
return /* @__PURE__ */
|
|
1420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1317
1421
|
"span",
|
|
1318
1422
|
__spreadProps(__spreadValues({}, props.attributes), {
|
|
1319
1423
|
style: __spreadValues({}, props.suggestionsStyle),
|
|
@@ -1325,10 +1429,13 @@ var SuggestionElement = (props) => {
|
|
|
1325
1429
|
})
|
|
1326
1430
|
);
|
|
1327
1431
|
};
|
|
1432
|
+
|
|
1433
|
+
// src/components/base-copilot-textarea/render-placeholder.tsx
|
|
1434
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1328
1435
|
function makeRenderPlaceholderFunction(placeholderStyle) {
|
|
1329
1436
|
return (props) => {
|
|
1330
1437
|
const _a = props.attributes, { style } = _a, restAttributes = __objRest(_a, ["style"]);
|
|
1331
|
-
return /* @__PURE__ */
|
|
1438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1332
1439
|
"div",
|
|
1333
1440
|
__spreadProps(__spreadValues({}, restAttributes), {
|
|
1334
1441
|
style: __spreadValues(__spreadValues({}, style), placeholderStyle),
|
|
@@ -1337,9 +1444,12 @@ function makeRenderPlaceholderFunction(placeholderStyle) {
|
|
|
1337
1444
|
);
|
|
1338
1445
|
};
|
|
1339
1446
|
}
|
|
1447
|
+
|
|
1448
|
+
// src/components/base-copilot-textarea/use-add-branding-css.tsx
|
|
1449
|
+
var import_react10 = require("react");
|
|
1340
1450
|
function useAddBrandingCss(suggestionStyleAugmented, disableBranding) {
|
|
1341
1451
|
const cssSelector = ".copilot-textarea.with-branding";
|
|
1342
|
-
|
|
1452
|
+
(0, import_react10.useEffect)(() => {
|
|
1343
1453
|
if (disableBranding) {
|
|
1344
1454
|
return;
|
|
1345
1455
|
}
|
|
@@ -1389,10 +1499,18 @@ function useAddBrandingCss(suggestionStyleAugmented, disableBranding) {
|
|
|
1389
1499
|
};
|
|
1390
1500
|
}, [disableBranding, suggestionStyleAugmented]);
|
|
1391
1501
|
}
|
|
1502
|
+
|
|
1503
|
+
// src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx
|
|
1504
|
+
var import_react11 = require("react");
|
|
1505
|
+
var import_slate_react4 = require("slate-react");
|
|
1506
|
+
var import_slate9 = require("slate");
|
|
1507
|
+
|
|
1508
|
+
// src/lib/editor-to-text.ts
|
|
1509
|
+
var import_slate8 = require("slate");
|
|
1392
1510
|
function nodeChildrenToTextComponents(editor, nodes) {
|
|
1393
1511
|
const indeciesOfInlineElements = new Set(
|
|
1394
1512
|
nodes.map((node, index) => {
|
|
1395
|
-
if (
|
|
1513
|
+
if (import_slate8.Element.isElement(node) && editor.isInline(node)) {
|
|
1396
1514
|
return index;
|
|
1397
1515
|
}
|
|
1398
1516
|
return -1;
|
|
@@ -1410,7 +1528,7 @@ function nodeChildrenToTextComponents(editor, nodes) {
|
|
|
1410
1528
|
return true;
|
|
1411
1529
|
});
|
|
1412
1530
|
return nonIgnorableItems.map((node) => {
|
|
1413
|
-
if (
|
|
1531
|
+
if (import_slate8.Element.isElement(node)) {
|
|
1414
1532
|
switch (node.type) {
|
|
1415
1533
|
case "paragraph":
|
|
1416
1534
|
return nodeChildrenToTextComponents(editor, node.children);
|
|
@@ -1427,13 +1545,16 @@ var editorToText = (editor) => {
|
|
|
1427
1545
|
const text = flattened.map((textComponent) => textComponent.text).join("\n");
|
|
1428
1546
|
return text;
|
|
1429
1547
|
};
|
|
1548
|
+
|
|
1549
|
+
// src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx
|
|
1550
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1430
1551
|
function TrackerTextEditedSinceLastCursorMovement(props) {
|
|
1431
|
-
const cursorState =
|
|
1552
|
+
const cursorState = (0, import_slate_react4.useSlateSelector)((state) => ({
|
|
1432
1553
|
selection: state.selection,
|
|
1433
1554
|
text: editorToText(state)
|
|
1434
1555
|
}));
|
|
1435
1556
|
const previousState = usePrevious(cursorState);
|
|
1436
|
-
|
|
1557
|
+
(0, import_react11.useEffect)(() => {
|
|
1437
1558
|
if (!previousState) {
|
|
1438
1559
|
return;
|
|
1439
1560
|
}
|
|
@@ -1441,7 +1562,7 @@ function TrackerTextEditedSinceLastCursorMovement(props) {
|
|
|
1441
1562
|
props.setCursorMovedSinceLastTextChange(true);
|
|
1442
1563
|
}
|
|
1443
1564
|
}, [props.setCursorMovedSinceLastTextChange, cursorState]);
|
|
1444
|
-
return /* @__PURE__ */
|
|
1565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, {});
|
|
1445
1566
|
}
|
|
1446
1567
|
var cursorChangedWithoutTextChanged = (prev, next) => {
|
|
1447
1568
|
const isSelectionChanged = !isSelectionEqual(prev.selection, next.selection);
|
|
@@ -1453,30 +1574,33 @@ var isSelectionEqual = (a, b) => {
|
|
|
1453
1574
|
return true;
|
|
1454
1575
|
if (!a || !b)
|
|
1455
1576
|
return false;
|
|
1456
|
-
return
|
|
1577
|
+
return import_slate9.Range.equals(a, b);
|
|
1457
1578
|
};
|
|
1458
1579
|
function usePrevious(value) {
|
|
1459
|
-
const ref =
|
|
1460
|
-
|
|
1580
|
+
const ref = (0, import_react11.useRef)();
|
|
1581
|
+
(0, import_react11.useEffect)(() => {
|
|
1461
1582
|
ref.current = value;
|
|
1462
1583
|
});
|
|
1463
1584
|
return ref.current;
|
|
1464
1585
|
}
|
|
1465
|
-
|
|
1586
|
+
|
|
1587
|
+
// src/components/base-copilot-textarea/base-copilot-textarea.tsx
|
|
1588
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1589
|
+
var BaseCopilotTextarea = import_react12.default.forwardRef(
|
|
1466
1590
|
(props, ref) => {
|
|
1467
|
-
return /* @__PURE__ */
|
|
1591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(HoveringEditorProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BaseCopilotTextareaWithHoveringContext, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
1468
1592
|
}
|
|
1469
1593
|
);
|
|
1470
|
-
var BaseCopilotTextareaWithHoveringContext =
|
|
1594
|
+
var BaseCopilotTextareaWithHoveringContext = import_react12.default.forwardRef(
|
|
1471
1595
|
(props, ref) => {
|
|
1472
1596
|
const autosuggestionsConfig = __spreadValues(__spreadValues({}, defaultBaseAutosuggestionsConfig), props.baseAutosuggestionsConfig);
|
|
1473
|
-
const valueOnInitialRender =
|
|
1597
|
+
const valueOnInitialRender = (0, import_react12.useMemo)(() => {
|
|
1474
1598
|
var _a2;
|
|
1475
1599
|
return (_a2 = props.value) != null ? _a2 : "";
|
|
1476
1600
|
}, []);
|
|
1477
|
-
const [lastKnownFullEditorText, setLastKnownFullEditorText] =
|
|
1478
|
-
const [cursorMovedSinceLastTextChange, setCursorMovedSinceLastTextChange] =
|
|
1479
|
-
const initialValue =
|
|
1601
|
+
const [lastKnownFullEditorText, setLastKnownFullEditorText] = (0, import_react12.useState)(valueOnInitialRender);
|
|
1602
|
+
const [cursorMovedSinceLastTextChange, setCursorMovedSinceLastTextChange] = (0, import_react12.useState)(false);
|
|
1603
|
+
const initialValue = (0, import_react12.useMemo)(() => {
|
|
1480
1604
|
return [
|
|
1481
1605
|
{
|
|
1482
1606
|
type: "paragraph",
|
|
@@ -1486,9 +1610,9 @@ var BaseCopilotTextareaWithHoveringContext = React2__namespace.default.forwardRe
|
|
|
1486
1610
|
}, [valueOnInitialRender]);
|
|
1487
1611
|
const editor = useCopilotTextareaEditor();
|
|
1488
1612
|
const { isDisplayed: hoveringEditorIsDisplayed, setIsDisplayed: setHoveringEditorIsDisplayed } = useHoveringEditorContext();
|
|
1489
|
-
const insertText =
|
|
1613
|
+
const insertText = (0, import_react12.useCallback)(
|
|
1490
1614
|
(autosuggestion) => {
|
|
1491
|
-
|
|
1615
|
+
import_slate10.Editor.insertText(editor, autosuggestion.text, {
|
|
1492
1616
|
at: autosuggestion.point
|
|
1493
1617
|
});
|
|
1494
1618
|
},
|
|
@@ -1512,7 +1636,7 @@ var BaseCopilotTextareaWithHoveringContext = React2__namespace.default.forwardRe
|
|
|
1512
1636
|
autosuggestionsConfig.disableWhenEmpty,
|
|
1513
1637
|
shouldDisableAutosuggestions
|
|
1514
1638
|
);
|
|
1515
|
-
const onKeyDownHandlerForHoveringEditor =
|
|
1639
|
+
const onKeyDownHandlerForHoveringEditor = (0, import_react12.useCallback)(
|
|
1516
1640
|
(event) => {
|
|
1517
1641
|
if (autosuggestionsConfig.shouldToggleHoveringEditorOnKeyPress(event)) {
|
|
1518
1642
|
event.preventDefault();
|
|
@@ -1525,7 +1649,7 @@ var BaseCopilotTextareaWithHoveringContext = React2__namespace.default.forwardRe
|
|
|
1525
1649
|
autosuggestionsConfig.shouldToggleHoveringEditorOnKeyPress
|
|
1526
1650
|
]
|
|
1527
1651
|
);
|
|
1528
|
-
|
|
1652
|
+
(0, import_react12.useEffect)(() => {
|
|
1529
1653
|
clearAutocompletionsFromEditor(editor);
|
|
1530
1654
|
if (currentAutocompleteSuggestion) {
|
|
1531
1655
|
addAutocompletionsToEditor(
|
|
@@ -1535,23 +1659,23 @@ var BaseCopilotTextareaWithHoveringContext = React2__namespace.default.forwardRe
|
|
|
1535
1659
|
);
|
|
1536
1660
|
}
|
|
1537
1661
|
}, [currentAutocompleteSuggestion]);
|
|
1538
|
-
const suggestionStyleAugmented =
|
|
1662
|
+
const suggestionStyleAugmented = (0, import_react12.useMemo)(() => {
|
|
1539
1663
|
return __spreadValues({
|
|
1540
1664
|
fontStyle: "italic",
|
|
1541
1665
|
color: "gray"
|
|
1542
1666
|
}, props.suggestionsStyle);
|
|
1543
1667
|
}, [props.suggestionsStyle]);
|
|
1544
|
-
const renderElementMemoized =
|
|
1668
|
+
const renderElementMemoized = (0, import_react12.useMemo)(() => {
|
|
1545
1669
|
return makeRenderElementFunction(suggestionStyleAugmented);
|
|
1546
1670
|
}, [suggestionStyleAugmented]);
|
|
1547
|
-
const renderPlaceholderMemoized =
|
|
1671
|
+
const renderPlaceholderMemoized = (0, import_react12.useMemo)(() => {
|
|
1548
1672
|
const placeholderStyleSlatejsOverrides = {
|
|
1549
1673
|
top: void 0
|
|
1550
1674
|
};
|
|
1551
1675
|
const placeholderStyleAugmented = __spreadValues(__spreadValues({}, placeholderStyleSlatejsOverrides), props.placeholderStyle);
|
|
1552
1676
|
return makeRenderPlaceholderFunction(placeholderStyleAugmented);
|
|
1553
1677
|
}, [props.placeholderStyle]);
|
|
1554
|
-
|
|
1678
|
+
(0, import_react12.useEffect)(() => {
|
|
1555
1679
|
var _a2, _b;
|
|
1556
1680
|
if (props.value === lastKnownFullEditorText) {
|
|
1557
1681
|
return;
|
|
@@ -1586,11 +1710,11 @@ var BaseCopilotTextareaWithHoveringContext = React2__namespace.default.forwardRe
|
|
|
1586
1710
|
const baseClassName = "copilot-textarea";
|
|
1587
1711
|
const brandingClass = disableBranding ? "no-branding" : "with-branding";
|
|
1588
1712
|
const defaultTailwindClassName = "bg-white overflow-y-auto resize-y";
|
|
1589
|
-
const mergedClassName =
|
|
1713
|
+
const mergedClassName = (0, import_tailwind_merge2.twMerge)(defaultTailwindClassName, className != null ? className : "");
|
|
1590
1714
|
return `${baseClassName} ${brandingClass} ${mergedClassName}`;
|
|
1591
1715
|
})();
|
|
1592
|
-
return /* @__PURE__ */
|
|
1593
|
-
|
|
1716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1717
|
+
import_slate_react5.Slate,
|
|
1594
1718
|
{
|
|
1595
1719
|
editor,
|
|
1596
1720
|
initialValue,
|
|
@@ -1609,13 +1733,13 @@ var BaseCopilotTextareaWithHoveringContext = React2__namespace.default.forwardRe
|
|
|
1609
1733
|
(_b = props.onChange) == null ? void 0 : _b.call(props, makeSemiFakeReactTextAreaEvent(fullEditorText));
|
|
1610
1734
|
},
|
|
1611
1735
|
children: [
|
|
1612
|
-
/* @__PURE__ */
|
|
1736
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1613
1737
|
TrackerTextEditedSinceLastCursorMovement,
|
|
1614
1738
|
{
|
|
1615
1739
|
setCursorMovedSinceLastTextChange
|
|
1616
1740
|
}
|
|
1617
1741
|
),
|
|
1618
|
-
/* @__PURE__ */
|
|
1742
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1619
1743
|
HoveringToolbar,
|
|
1620
1744
|
{
|
|
1621
1745
|
apiConfig: autosuggestionsConfig.apiConfig,
|
|
@@ -1623,8 +1747,8 @@ var BaseCopilotTextareaWithHoveringContext = React2__namespace.default.forwardRe
|
|
|
1623
1747
|
hoverMenuClassname
|
|
1624
1748
|
}
|
|
1625
1749
|
),
|
|
1626
|
-
/* @__PURE__ */
|
|
1627
|
-
|
|
1750
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1751
|
+
import_slate_react5.Editable,
|
|
1628
1752
|
__spreadValues({
|
|
1629
1753
|
renderElement: renderElementMemoized,
|
|
1630
1754
|
renderPlaceholder: renderPlaceholderMemoized,
|
|
@@ -1655,6 +1779,13 @@ function makeSemiFakeReactTextAreaEvent(currentText) {
|
|
|
1655
1779
|
};
|
|
1656
1780
|
}
|
|
1657
1781
|
|
|
1782
|
+
// src/components/copilot-textarea/copilot-textarea.tsx
|
|
1783
|
+
var import_react15 = __toESM(require("react"));
|
|
1784
|
+
|
|
1785
|
+
// src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx
|
|
1786
|
+
var import_react_core3 = require("@copilotkit/react-core");
|
|
1787
|
+
var import_react13 = require("react");
|
|
1788
|
+
|
|
1658
1789
|
// src/lib/retry.tsx
|
|
1659
1790
|
function retry(fn, retriesLeft = 2, interval = 200, backoff = 1.5) {
|
|
1660
1791
|
return new Promise((resolve, reject) => {
|
|
@@ -1669,9 +1800,12 @@ function retry(fn, retriesLeft = 2, interval = 200, backoff = 1.5) {
|
|
|
1669
1800
|
});
|
|
1670
1801
|
});
|
|
1671
1802
|
}
|
|
1803
|
+
|
|
1804
|
+
// src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx
|
|
1805
|
+
var import_react_core4 = require("@copilotkit/react-core");
|
|
1672
1806
|
function useMakeStandardAutosuggestionFunction(textareaPurpose, contextCategories, apiConfig) {
|
|
1673
|
-
const { getContextString, copilotApiConfig } =
|
|
1674
|
-
return
|
|
1807
|
+
const { getContextString, copilotApiConfig } = (0, import_react13.useContext)(import_react_core3.CopilotContext);
|
|
1808
|
+
return (0, import_react13.useCallback)(
|
|
1675
1809
|
(editorState2, abortSignal) => __async(this, null, function* () {
|
|
1676
1810
|
const res = yield retry(() => __async(this, null, function* () {
|
|
1677
1811
|
const messages = [
|
|
@@ -1694,7 +1828,7 @@ function useMakeStandardAutosuggestionFunction(textareaPurpose, contextCategorie
|
|
|
1694
1828
|
content: editorState2.textBeforeCursor
|
|
1695
1829
|
}
|
|
1696
1830
|
];
|
|
1697
|
-
const response = yield
|
|
1831
|
+
const response = yield (0, import_react_core4.fetchAndDecodeChatCompletionAsText)(__spreadProps(__spreadValues({
|
|
1698
1832
|
messages
|
|
1699
1833
|
}, apiConfig.forwardedParams), {
|
|
1700
1834
|
copilotConfig: copilotApiConfig,
|
|
@@ -1936,17 +2070,25 @@ var defaultEditingApiConfig = {
|
|
|
1936
2070
|
fewShotMessages: defaultEditingFewShotMessages,
|
|
1937
2071
|
forwardedParams: void 0
|
|
1938
2072
|
};
|
|
2073
|
+
|
|
2074
|
+
// src/types/autosuggestions-config/autosuggestions-config.tsx
|
|
2075
|
+
var import_react_core5 = require("@copilotkit/react-core");
|
|
1939
2076
|
var defaultAutosuggestionsConfig = __spreadProps(__spreadValues({}, defaultBaseAutosuggestionsConfig), {
|
|
1940
|
-
contextCategories:
|
|
2077
|
+
contextCategories: import_react_core5.defaultCopilotContextCategories,
|
|
1941
2078
|
chatApiConfigs: {
|
|
1942
2079
|
suggestionsApiConfig: defaultSuggestionsApiConfig,
|
|
1943
2080
|
insertionApiConfig: defaultInsertionsApiConfig,
|
|
1944
2081
|
editingApiConfig: defaultEditingApiConfig
|
|
1945
2082
|
}
|
|
1946
2083
|
});
|
|
2084
|
+
|
|
2085
|
+
// src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx
|
|
2086
|
+
var import_react_core6 = require("@copilotkit/react-core");
|
|
2087
|
+
var import_react14 = require("react");
|
|
2088
|
+
var import_react_core7 = require("@copilotkit/react-core");
|
|
1947
2089
|
function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCategories, insertionApiConfig, editingApiConfig) {
|
|
1948
|
-
const { getContextString, copilotApiConfig } =
|
|
1949
|
-
const insertionFunction =
|
|
2090
|
+
const { getContextString, copilotApiConfig } = (0, import_react14.useContext)(import_react_core6.CopilotContext);
|
|
2091
|
+
const insertionFunction = (0, import_react14.useCallback)(
|
|
1950
2092
|
(editorState2, insertionPrompt, documents, abortSignal) => __async(this, null, function* () {
|
|
1951
2093
|
const res = yield retry(() => __async(this, null, function* () {
|
|
1952
2094
|
const messages = [
|
|
@@ -1974,7 +2116,7 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
1974
2116
|
content: insertionPrompt
|
|
1975
2117
|
}
|
|
1976
2118
|
];
|
|
1977
|
-
const stream = yield
|
|
2119
|
+
const stream = yield (0, import_react_core7.fetchAndDecodeChatCompletionAsText)(__spreadProps(__spreadValues({
|
|
1978
2120
|
messages
|
|
1979
2121
|
}, insertionApiConfig.forwardedParams), {
|
|
1980
2122
|
copilotConfig: copilotApiConfig,
|
|
@@ -1986,7 +2128,7 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
1986
2128
|
}),
|
|
1987
2129
|
[insertionApiConfig, getContextString, contextCategories, textareaPurpose]
|
|
1988
2130
|
);
|
|
1989
|
-
const editingFunction =
|
|
2131
|
+
const editingFunction = (0, import_react14.useCallback)(
|
|
1990
2132
|
(editorState2, editingPrompt, documents, abortSignal) => __async(this, null, function* () {
|
|
1991
2133
|
const res = yield retry(() => __async(this, null, function* () {
|
|
1992
2134
|
const messages = [
|
|
@@ -2019,7 +2161,7 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
2019
2161
|
content: editingPrompt
|
|
2020
2162
|
}
|
|
2021
2163
|
];
|
|
2022
|
-
const stream = yield
|
|
2164
|
+
const stream = yield (0, import_react_core7.fetchAndDecodeChatCompletionAsText)(__spreadProps(__spreadValues({
|
|
2023
2165
|
messages
|
|
2024
2166
|
}, editingApiConfig.forwardedParams), {
|
|
2025
2167
|
copilotConfig: copilotApiConfig,
|
|
@@ -2031,7 +2173,7 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
2031
2173
|
}),
|
|
2032
2174
|
[editingApiConfig, getContextString, contextCategories, textareaPurpose]
|
|
2033
2175
|
);
|
|
2034
|
-
const insertionOrEditingFunction =
|
|
2176
|
+
const insertionOrEditingFunction = (0, import_react14.useCallback)(
|
|
2035
2177
|
(editorState2, insertionPrompt, documents, abortSignal) => __async(this, null, function* () {
|
|
2036
2178
|
if (editorState2.selectedText === "") {
|
|
2037
2179
|
return yield insertionFunction(editorState2, insertionPrompt, documents, abortSignal);
|
|
@@ -2043,10 +2185,14 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
2043
2185
|
);
|
|
2044
2186
|
return insertionOrEditingFunction;
|
|
2045
2187
|
}
|
|
2046
|
-
|
|
2188
|
+
|
|
2189
|
+
// src/components/copilot-textarea/copilot-textarea.tsx
|
|
2190
|
+
var import_lodash = __toESM(require("lodash.merge"));
|
|
2191
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2192
|
+
var CopilotTextarea = import_react15.default.forwardRef(
|
|
2047
2193
|
(props, ref) => {
|
|
2048
2194
|
const _a = props, { autosuggestionsConfig: autosuggestionsConfigUserSpecified } = _a, forwardedProps = __objRest(_a, ["autosuggestionsConfig"]);
|
|
2049
|
-
const autosuggestionsConfig =
|
|
2195
|
+
const autosuggestionsConfig = (0, import_lodash.default)(
|
|
2050
2196
|
defaultAutosuggestionsConfig,
|
|
2051
2197
|
autosuggestionsConfigUserSpecified
|
|
2052
2198
|
);
|
|
@@ -2061,7 +2207,7 @@ var CopilotTextarea = React2__namespace.default.forwardRef(
|
|
|
2061
2207
|
autosuggestionsConfig.chatApiConfigs.insertionApiConfig,
|
|
2062
2208
|
autosuggestionsConfig.chatApiConfigs.editingApiConfig
|
|
2063
2209
|
);
|
|
2064
|
-
return /* @__PURE__ */
|
|
2210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2065
2211
|
BaseCopilotTextarea,
|
|
2066
2212
|
__spreadProps(__spreadValues({
|
|
2067
2213
|
ref
|
|
@@ -2076,10 +2222,11 @@ var CopilotTextarea = React2__namespace.default.forwardRef(
|
|
|
2076
2222
|
) });
|
|
2077
2223
|
}
|
|
2078
2224
|
);
|
|
2079
|
-
|
|
2080
|
-
exports
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2225
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2226
|
+
0 && (module.exports = {
|
|
2227
|
+
BaseCopilotTextarea,
|
|
2228
|
+
CopilotTextarea,
|
|
2229
|
+
defaultAutosuggestionsConfig,
|
|
2230
|
+
defaultBaseAutosuggestionsConfig
|
|
2231
|
+
});
|
|
2085
2232
|
//# sourceMappingURL=index.js.map
|