@copilotkit/react-textarea 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/chunk-224UKA7C.mjs +38 -0
- package/dist/chunk-224UKA7C.mjs.map +1 -0
- package/dist/chunk-23Q6A46J.mjs +103 -0
- package/dist/chunk-23Q6A46J.mjs.map +1 -0
- package/dist/chunk-2C7O2EVM.mjs +27 -0
- package/dist/chunk-2C7O2EVM.mjs.map +1 -0
- package/dist/chunk-2QDCE7PD.mjs +32 -0
- package/dist/chunk-2QDCE7PD.mjs.map +1 -0
- package/dist/chunk-2XDYLKPH.mjs +181 -0
- package/dist/chunk-2XDYLKPH.mjs.map +1 -0
- package/dist/chunk-3PQ7GSFE.mjs +17 -0
- package/dist/chunk-3PQ7GSFE.mjs.map +1 -0
- package/dist/chunk-4AMCUMC7.mjs +124 -0
- package/dist/chunk-4AMCUMC7.mjs.map +1 -0
- package/dist/chunk-4CVSOOJY.mjs +30 -0
- package/dist/chunk-4CVSOOJY.mjs.map +1 -0
- package/dist/chunk-4NHVQZ67.mjs +108 -0
- package/dist/chunk-4NHVQZ67.mjs.map +1 -0
- package/dist/chunk-4PDYALMP.mjs +52 -0
- package/dist/chunk-4PDYALMP.mjs.map +1 -0
- package/dist/chunk-5UNJXFUO.mjs +29 -0
- package/dist/chunk-5UNJXFUO.mjs.map +1 -0
- package/dist/chunk-7LSRNPNI.mjs +59 -0
- package/dist/chunk-7LSRNPNI.mjs.map +1 -0
- package/dist/chunk-AJ5OMEXM.mjs +13 -0
- package/dist/chunk-AJ5OMEXM.mjs.map +1 -0
- package/dist/chunk-CF5GISTC.mjs +113 -0
- package/dist/chunk-CF5GISTC.mjs.map +1 -0
- package/dist/chunk-D2SUDM2O.mjs +99 -0
- package/dist/chunk-D2SUDM2O.mjs.map +1 -0
- package/dist/chunk-D47EKHIF.mjs +26 -0
- package/dist/chunk-D47EKHIF.mjs.map +1 -0
- package/dist/chunk-DE5K76I2.mjs +1 -0
- package/dist/chunk-DE5K76I2.mjs.map +1 -0
- package/dist/chunk-DFTV4TST.mjs +36 -0
- package/dist/chunk-DFTV4TST.mjs.map +1 -0
- package/dist/chunk-DRV2FOHZ.mjs +70 -0
- package/dist/chunk-DRV2FOHZ.mjs.map +1 -0
- package/dist/chunk-ECR45NSD.mjs +104 -0
- package/dist/chunk-ECR45NSD.mjs.map +1 -0
- package/dist/chunk-EJGGLWWR.mjs +82 -0
- package/dist/chunk-EJGGLWWR.mjs.map +1 -0
- package/dist/chunk-FYCQE57K.mjs +60 -0
- package/dist/chunk-FYCQE57K.mjs.map +1 -0
- package/dist/chunk-GQN2HYFJ.mjs +22 -0
- package/dist/chunk-GQN2HYFJ.mjs.map +1 -0
- package/dist/chunk-H4VKQGVU.mjs +1 -0
- package/dist/chunk-H4VKQGVU.mjs.map +1 -0
- package/dist/chunk-HL7EF7KA.mjs +32 -0
- package/dist/chunk-HL7EF7KA.mjs.map +1 -0
- package/dist/chunk-I3SPIGAI.mjs +31 -0
- package/dist/chunk-I3SPIGAI.mjs.map +1 -0
- package/dist/chunk-I72DKFHD.mjs +114 -0
- package/dist/chunk-I72DKFHD.mjs.map +1 -0
- package/dist/chunk-IU3WTXLQ.mjs +1 -0
- package/dist/chunk-IU3WTXLQ.mjs.map +1 -0
- package/dist/chunk-J62KUPFZ.mjs +264 -0
- package/dist/chunk-J62KUPFZ.mjs.map +1 -0
- package/dist/chunk-KMVGEY7Q.mjs +51 -0
- package/dist/chunk-KMVGEY7Q.mjs.map +1 -0
- package/dist/chunk-KNQIEOFP.mjs +19 -0
- package/dist/chunk-KNQIEOFP.mjs.map +1 -0
- package/dist/chunk-L7VVZH4Q.mjs +1 -0
- package/dist/chunk-L7VVZH4Q.mjs.map +1 -0
- package/dist/chunk-LQ2OWQU7.mjs +49 -0
- package/dist/chunk-LQ2OWQU7.mjs.map +1 -0
- package/dist/chunk-LYB4B6MK.mjs +19 -0
- package/dist/chunk-LYB4B6MK.mjs.map +1 -0
- package/dist/chunk-MCNXIA4Q.mjs +75 -0
- package/dist/chunk-MCNXIA4Q.mjs.map +1 -0
- package/dist/chunk-MMVDU6DF.mjs +1 -0
- package/dist/chunk-MMVDU6DF.mjs.map +1 -0
- package/dist/chunk-MRXNTQOX.mjs +59 -0
- package/dist/chunk-MRXNTQOX.mjs.map +1 -0
- package/dist/chunk-QJNFNPWH.mjs +85 -0
- package/dist/chunk-QJNFNPWH.mjs.map +1 -0
- package/dist/chunk-RUV6NBIF.mjs +1 -0
- package/dist/chunk-RUV6NBIF.mjs.map +1 -0
- package/dist/chunk-SDHH6DI6.mjs +63 -0
- package/dist/chunk-SDHH6DI6.mjs.map +1 -0
- package/dist/chunk-T6MTDQZ7.mjs +45 -0
- package/dist/chunk-T6MTDQZ7.mjs.map +1 -0
- package/dist/chunk-UGEKMSRR.mjs +225 -0
- package/dist/chunk-UGEKMSRR.mjs.map +1 -0
- package/dist/chunk-VSVQZUPW.mjs +124 -0
- package/dist/chunk-VSVQZUPW.mjs.map +1 -0
- package/dist/chunk-WADHCMPK.mjs +1 -0
- package/dist/chunk-WADHCMPK.mjs.map +1 -0
- package/dist/chunk-WGWQRALG.mjs +83 -0
- package/dist/chunk-WGWQRALG.mjs.map +1 -0
- package/dist/chunk-WJHSY5T6.mjs +1 -0
- package/dist/chunk-WJHSY5T6.mjs.map +1 -0
- package/dist/chunk-XW3ICO4S.mjs +25 -0
- package/dist/chunk-XW3ICO4S.mjs.map +1 -0
- package/dist/chunk-YLFAIYRY.mjs +50 -0
- package/dist/chunk-YLFAIYRY.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.css +9 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.css.map +1 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.d.ts +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js +114 -49
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +36 -1687
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-element.d.ts +1 -1
- package/dist/components/base-copilot-textarea/render-element.mjs +4 -48
- package/dist/components/base-copilot-textarea/render-element.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.d.ts +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.mjs +4 -46
- 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 +4 -2
- 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 +5 -81
- 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.map +1 -1
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +4 -54
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.css +9 -0
- package/dist/components/copilot-textarea/copilot-textarea.css.map +1 -0
- package/dist/components/copilot-textarea/copilot-textarea.d.ts +9 -3
- package/dist/components/copilot-textarea/copilot-textarea.js +116 -51
- package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.mjs +44 -2212
- package/dist/components/copilot-textarea/copilot-textarea.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +5 -13
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.d.ts +2 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js +21 -0
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +9 -111
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.d.ts +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.js +94 -31
- package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +19 -808
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.d.ts +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +65 -21
- 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 +14 -520
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.d.ts +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +68 -24
- 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 +15 -543
- 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.d.ts +16 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js +133 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +12 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +68 -24
- 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 +16 -543
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +1 -1
- package/dist/components/index.css +9 -0
- package/dist/components/index.css.map +1 -0
- package/dist/components/index.js +116 -51
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +46 -2211
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/manual-ui/chip-with-icon.d.ts +1 -1
- package/dist/components/manual-ui/chip-with-icon.mjs +2 -0
- package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -1
- package/dist/components/source-search-box/source-search-box.d.ts +1 -1
- package/dist/components/source-search-box/source-search-box.js +4 -2
- package/dist/components/source-search-box/source-search-box.js.map +1 -1
- package/dist/components/source-search-box/source-search-box.mjs +8 -200
- package/dist/components/source-search-box/source-search-box.mjs.map +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/button.mjs +6 -76
- package/dist/components/ui/button.mjs.map +1 -1
- package/dist/components/ui/command.mjs +14 -233
- package/dist/components/ui/command.mjs.map +1 -1
- package/dist/components/ui/dialog.mjs +11 -135
- package/dist/components/ui/dialog.mjs.map +1 -1
- package/dist/components/ui/label.mjs +5 -51
- package/dist/components/ui/label.mjs.map +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.mjs +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.ts +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +7 -152
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +5 -165
- 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.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +6 -141
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.mjs +1 -0
- 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 +4 -139
- 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.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +4 -221
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs.map +1 -1
- package/dist/hooks/misc/use-autosize-textarea.mjs +4 -12
- package/dist/hooks/misc/use-autosize-textarea.mjs.map +1 -1
- package/dist/index.css +644 -1
- package/dist/index.css.map +1 -0
- package/dist/index.js +116 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -2218
- package/dist/index.mjs.map +1 -1
- package/dist/lib/debouncer.d.ts +1 -1
- package/dist/lib/debouncer.js.map +1 -1
- package/dist/lib/debouncer.mjs +4 -48
- package/dist/lib/debouncer.mjs.map +1 -1
- package/dist/lib/editor-to-text.mjs +4 -40
- package/dist/lib/editor-to-text.mjs.map +1 -1
- package/dist/lib/get-text-around-cursor.d.ts +1 -1
- package/dist/lib/get-text-around-cursor.mjs +7 -96
- package/dist/lib/get-text-around-cursor.mjs.map +1 -1
- package/dist/lib/retry.mjs +4 -14
- package/dist/lib/retry.mjs.map +1 -1
- package/dist/lib/slatejs-edits/add-autocompletions.mjs +4 -22
- package/dist/lib/slatejs-edits/add-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.js.map +1 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs +4 -17
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/replace-text.mjs +4 -24
- package/dist/lib/slatejs-edits/replace-text.mjs.map +1 -1
- package/dist/lib/slatejs-edits/with-partial-history.d.ts +1 -1
- package/dist/lib/slatejs-edits/with-partial-history.mjs +5 -102
- package/dist/lib/slatejs-edits/with-partial-history.mjs.map +1 -1
- package/dist/lib/stream-promise-flatten.js.map +1 -1
- package/dist/lib/stream-promise-flatten.mjs +4 -44
- package/dist/lib/stream-promise-flatten.mjs.map +1 -1
- package/dist/lib/utils.mjs +8 -58
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/lib/utils.test.d.ts +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.ts +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.d.ts +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.js.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +9 -258
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.d.ts +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.mjs +6 -75
- package/dist/types/autosuggestions-config/editing-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/index.js.map +1 -1
- package/dist/types/autosuggestions-config/index.mjs +10 -258
- package/dist/types/autosuggestions-config/index.mjs.map +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.d.ts +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.mjs +6 -68
- package/dist/types/autosuggestions-config/insertions-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.d.ts +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.d.ts +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs +6 -56
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs.map +1 -1
- package/dist/types/base/autosuggestion-state.d.ts +1 -1
- package/dist/types/base/autosuggestions-bare-function.d.ts +1 -1
- package/dist/types/base/base-autosuggestions-config.d.ts +1 -1
- package/dist/types/base/base-autosuggestions-config.mjs +4 -25
- package/dist/types/base/base-autosuggestions-config.mjs.map +1 -1
- package/dist/types/base/custom-editor.d.ts +1 -1
- package/dist/types/base/editor-autocomplete-state.d.ts +1 -1
- package/dist/types/base/editor-autocomplete-state.mjs +5 -9
- package/dist/types/base/editor-autocomplete-state.mjs.map +1 -1
- package/dist/types/base/index.d.ts +1 -1
- package/dist/types/base/index.mjs +5 -25
- package/dist/types/base/index.mjs.map +1 -1
- package/dist/types/html-copilot-textarea-element.d.ts +1 -1
- package/dist/types/html-copilot-textarea-element.mjs +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +14 -258
- package/dist/types/index.mjs.map +1 -1
- package/package.json +11 -17
- package/src/components/base-copilot-textarea/base-copilot-textarea.css +9 -0
- package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +1 -0
- package/src/components/copilot-textarea/copilot-textarea.tsx +8 -2
- package/src/components/hovering-toolbar/hovering-toolbar-components.tsx +17 -0
- package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +7 -4
- package/src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx +55 -0
- package/src/styles.css +2 -9
- package/tsup.config.ts +15 -63
- package/dist/components/base-copilot-textarea/base-copilot-textarea.d.mts +0 -43
- package/dist/components/base-copilot-textarea/render-element.d.mts +0 -6
- package/dist/components/base-copilot-textarea/render-placeholder.d.mts +0 -6
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.d.mts +0 -8
- package/dist/components/base-copilot-textarea/use-add-branding-css.d.mts +0 -3
- package/dist/components/copilot-textarea/copilot-textarea.d.mts +0 -165
- package/dist/components/hovering-toolbar/hovering-editor-provider.d.mts +0 -18
- package/dist/components/hovering-toolbar/hovering-toolbar-components.d.mts +0 -17
- package/dist/components/hovering-toolbar/hovering-toolbar.d.mts +0 -12
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.d.mts +0 -16
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.d.mts +0 -14
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.d.mts +0 -4
- package/dist/components/index.d.mts +0 -15
- package/dist/components/manual-ui/chip-with-icon.d.mts +0 -10
- package/dist/components/source-search-box/source-search-box.d.mts +0 -16
- package/dist/components/ui/button.d.mts +0 -14
- package/dist/components/ui/command.d.mts +0 -53
- package/dist/components/ui/dialog.d.mts +0 -19
- package/dist/components/ui/label.d.mts +0 -8
- package/dist/context/index.d.mts +0 -2
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.mts +0 -15
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.d.mts +0 -8
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.d.mts +0 -7
- package/dist/hooks/index.d.mts +0 -2
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.mts +0 -22
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.d.mts +0 -23
- package/dist/hooks/misc/use-autosize-textarea.d.mts +0 -5
- package/dist/index.d.mts +0 -15
- package/dist/lib/debouncer.d.mts +0 -11
- package/dist/lib/editor-to-text.d.mts +0 -7
- package/dist/lib/get-text-around-cursor.d.mts +0 -15
- package/dist/lib/retry.d.mts +0 -3
- package/dist/lib/slatejs-edits/add-autocompletions.d.mts +0 -8
- package/dist/lib/slatejs-edits/clear-autocompletions.d.mts +0 -8
- package/dist/lib/slatejs-edits/replace-text.d.mts +0 -5
- package/dist/lib/slatejs-edits/with-partial-history.d.mts +0 -8
- package/dist/lib/stream-promise-flatten.d.mts +0 -12
- package/dist/lib/utils.d.mts +0 -9
- package/dist/lib/utils.test.d.mts +0 -2
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.mts +0 -23
- package/dist/types/autosuggestions-config/autosuggestions-config.d.mts +0 -20
- package/dist/types/autosuggestions-config/editing-api-config.d.mts +0 -15
- package/dist/types/autosuggestions-config/index.d.mts +0 -10
- package/dist/types/autosuggestions-config/insertions-api-config.d.mts +0 -15
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.d.mts +0 -3
- package/dist/types/autosuggestions-config/suggestions-api-config.d.mts +0 -14
- package/dist/types/base/autosuggestion-state.d.mts +0 -8
- package/dist/types/base/autosuggestions-bare-function.d.mts +0 -19
- package/dist/types/base/base-autosuggestions-config.d.mts +0 -83
- package/dist/types/base/base-copilot-textarea-props.d.mts +0 -5
- package/dist/types/base/custom-editor.d.mts +0 -29
- package/dist/types/base/editor-autocomplete-state.d.mts +0 -10
- package/dist/types/base/index.d.mts +0 -54
- package/dist/types/html-copilot-textarea-element.d.mts +0 -7
- package/dist/types/index.d.mts +0 -13
|
@@ -1,811 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
var __async = (__this, __arguments, generator) => {
|
|
33
|
-
return new Promise((resolve, reject) => {
|
|
34
|
-
var fulfilled = (value) => {
|
|
35
|
-
try {
|
|
36
|
-
step(generator.next(value));
|
|
37
|
-
} catch (e) {
|
|
38
|
-
reject(e);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
var rejected = (value) => {
|
|
42
|
-
try {
|
|
43
|
-
step(generator.throw(value));
|
|
44
|
-
} catch (e) {
|
|
45
|
-
reject(e);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// src/components/hovering-toolbar/hovering-toolbar.tsx
|
|
54
|
-
import { useEffect as useEffect3, useRef as useRef2, useState as useState4 } from "react";
|
|
55
|
-
import { Transforms } from "slate";
|
|
56
|
-
import { useSlate, useSlateSelection } from "slate-react";
|
|
57
|
-
|
|
58
|
-
// src/hooks/misc/use-autosize-textarea.tsx
|
|
59
|
-
import { useEffect } from "react";
|
|
60
|
-
var useAutosizeTextArea = (textAreaRef, value) => {
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
if (textAreaRef.current !== null) {
|
|
63
|
-
textAreaRef.current.style.height = "0px";
|
|
64
|
-
const scrollHeight = textAreaRef.current.scrollHeight;
|
|
65
|
-
textAreaRef.current.style.height = scrollHeight + "px";
|
|
66
|
-
}
|
|
67
|
-
}, [textAreaRef, value]);
|
|
68
|
-
};
|
|
69
|
-
var use_autosize_textarea_default = useAutosizeTextArea;
|
|
70
|
-
|
|
71
|
-
// src/components/source-search-box/source-search-box.tsx
|
|
72
|
-
import { useState } from "react";
|
|
73
|
-
|
|
74
|
-
// src/components/ui/command.tsx
|
|
75
|
-
import * as React from "react";
|
|
76
|
-
import { Command as CommandPrimitive } from "cmdk";
|
|
77
|
-
|
|
78
|
-
// src/lib/utils.ts
|
|
79
|
-
import { clsx } from "clsx";
|
|
80
|
-
import { twMerge } from "tailwind-merge";
|
|
81
|
-
function cn(...inputs) {
|
|
82
|
-
return twMerge(clsx(inputs));
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// src/components/ui/command.tsx
|
|
86
|
-
import { jsx } from "react/jsx-runtime";
|
|
87
|
-
var Command = React.forwardRef((_a, ref) => {
|
|
88
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
89
|
-
return /* @__PURE__ */ jsx(
|
|
90
|
-
CommandPrimitive,
|
|
91
|
-
__spreadValues({
|
|
92
|
-
ref,
|
|
93
|
-
className: cn(
|
|
94
|
-
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
95
|
-
className
|
|
96
|
-
)
|
|
97
|
-
}, props)
|
|
98
|
-
);
|
|
99
|
-
});
|
|
100
|
-
Command.displayName = CommandPrimitive.displayName;
|
|
101
|
-
var CommandInput = React.forwardRef((_a, ref) => {
|
|
102
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
103
|
-
return /* @__PURE__ */ jsx("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: /* @__PURE__ */ jsx(
|
|
104
|
-
CommandPrimitive.Input,
|
|
105
|
-
__spreadValues({
|
|
106
|
-
ref,
|
|
107
|
-
className: cn(
|
|
108
|
-
"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
109
|
-
className
|
|
110
|
-
)
|
|
111
|
-
}, props)
|
|
112
|
-
) });
|
|
113
|
-
});
|
|
114
|
-
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
115
|
-
var CommandList = React.forwardRef((_a, ref) => {
|
|
116
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
117
|
-
return /* @__PURE__ */ jsx(
|
|
118
|
-
CommandPrimitive.List,
|
|
119
|
-
__spreadValues({
|
|
120
|
-
ref,
|
|
121
|
-
className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden pb-2", className)
|
|
122
|
-
}, props)
|
|
123
|
-
);
|
|
124
|
-
});
|
|
125
|
-
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
126
|
-
var CommandEmpty = React.forwardRef((props, ref) => /* @__PURE__ */ jsx(CommandPrimitive.Empty, __spreadValues({ ref, className: "py-6 text-center text-sm" }, props)));
|
|
127
|
-
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
128
|
-
var CommandGroup = React.forwardRef((_a, ref) => {
|
|
129
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
130
|
-
return /* @__PURE__ */ jsx(
|
|
131
|
-
CommandPrimitive.Group,
|
|
132
|
-
__spreadValues({
|
|
133
|
-
ref,
|
|
134
|
-
className: cn(
|
|
135
|
-
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
136
|
-
className
|
|
137
|
-
)
|
|
138
|
-
}, props)
|
|
139
|
-
);
|
|
140
|
-
});
|
|
141
|
-
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
142
|
-
var CommandSeparator = React.forwardRef((_a, ref) => {
|
|
143
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
144
|
-
return /* @__PURE__ */ jsx(
|
|
145
|
-
CommandPrimitive.Separator,
|
|
146
|
-
__spreadValues({
|
|
147
|
-
ref,
|
|
148
|
-
className: cn("-mx-1 h-px bg-border", className)
|
|
149
|
-
}, props)
|
|
150
|
-
);
|
|
151
|
-
});
|
|
152
|
-
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
153
|
-
var CommandItem = React.forwardRef((_a, ref) => {
|
|
154
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
155
|
-
return /* @__PURE__ */ jsx(
|
|
156
|
-
CommandPrimitive.Item,
|
|
157
|
-
__spreadValues({
|
|
158
|
-
ref,
|
|
159
|
-
className: cn(
|
|
160
|
-
"relative flex cursor-default select-none items-center rounded-sm text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
161
|
-
className
|
|
162
|
-
)
|
|
163
|
-
}, props)
|
|
164
|
-
);
|
|
165
|
-
});
|
|
166
|
-
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
167
|
-
var CommandShortcut = (_a) => {
|
|
168
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
169
|
-
return /* @__PURE__ */ jsx(
|
|
170
|
-
"span",
|
|
171
|
-
__spreadValues({
|
|
172
|
-
className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className)
|
|
173
|
-
}, props)
|
|
174
|
-
);
|
|
175
|
-
};
|
|
176
|
-
CommandShortcut.displayName = "CommandShortcut";
|
|
177
|
-
|
|
178
|
-
// src/components/source-search-box/source-search-box.tsx
|
|
179
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
180
|
-
function SourceSearchBox(props) {
|
|
181
|
-
const [selectedValue, setSelectedValue] = useState("");
|
|
182
|
-
return /* @__PURE__ */ jsxs(
|
|
183
|
-
Command,
|
|
184
|
-
{
|
|
185
|
-
className: "rounded-lg border shadow-md",
|
|
186
|
-
value: selectedValue,
|
|
187
|
-
onValueChange: (value) => {
|
|
188
|
-
setSelectedValue(value);
|
|
189
|
-
},
|
|
190
|
-
filter: (value, search) => {
|
|
191
|
-
if (props.searchTerm === "") return 1;
|
|
192
|
-
if (value.startsWith(props.searchTerm)) return 1;
|
|
193
|
-
return 0;
|
|
194
|
-
},
|
|
195
|
-
children: [
|
|
196
|
-
/* @__PURE__ */ jsx2(
|
|
197
|
-
CommandInput,
|
|
198
|
-
{
|
|
199
|
-
value: props.searchTerm,
|
|
200
|
-
className: "rounded-t-lg hidden",
|
|
201
|
-
placeholder: "Search for a command..."
|
|
202
|
-
}
|
|
203
|
-
),
|
|
204
|
-
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
205
|
-
/* @__PURE__ */ jsx2(CommandEmpty, { children: "No results found." }),
|
|
206
|
-
/* @__PURE__ */ jsx2(CommandGroup, { heading: "Available resources", children: props.suggestedFiles.map((filePointer) => {
|
|
207
|
-
return /* @__PURE__ */ jsx2(
|
|
208
|
-
CommandItem,
|
|
209
|
-
{
|
|
210
|
-
value: filePointer.name,
|
|
211
|
-
onSelect: (value) => {
|
|
212
|
-
props.onSelectedFile(filePointer);
|
|
213
|
-
},
|
|
214
|
-
children: /* @__PURE__ */ jsxs("div", { className: " px-3 flex flex-row gap-1 items-center", children: [
|
|
215
|
-
/* @__PURE__ */ jsx2(Logo, { width: "20px", height: "20px", children: /* @__PURE__ */ jsx2(
|
|
216
|
-
"img",
|
|
217
|
-
{
|
|
218
|
-
src: filePointer.iconImageUri,
|
|
219
|
-
alt: filePointer.sourceApplication,
|
|
220
|
-
className: "w-full h-full"
|
|
221
|
-
}
|
|
222
|
-
) }),
|
|
223
|
-
filePointer.name
|
|
224
|
-
] })
|
|
225
|
-
},
|
|
226
|
-
`word-${filePointer.sourceApplication}.${filePointer.name}`
|
|
227
|
-
);
|
|
228
|
-
}) }),
|
|
229
|
-
/* @__PURE__ */ jsx2(CommandSeparator, {})
|
|
230
|
-
] })
|
|
231
|
-
]
|
|
232
|
-
}
|
|
233
|
-
);
|
|
234
|
-
}
|
|
235
|
-
function Logo({
|
|
236
|
-
children,
|
|
237
|
-
width,
|
|
238
|
-
height
|
|
239
|
-
}) {
|
|
240
|
-
return /* @__PURE__ */ jsx2("div", { className: "flex items-center justify-center", style: { width, height }, children });
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
244
|
-
import { useCopilotContext } from "@copilotkit/react-core";
|
|
245
|
-
|
|
246
|
-
// src/components/ui/button.tsx
|
|
247
|
-
import * as React2 from "react";
|
|
248
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
249
|
-
import { cva } from "class-variance-authority";
|
|
250
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
251
|
-
var buttonVariants = cva(
|
|
252
|
-
"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",
|
|
253
|
-
{
|
|
254
|
-
variants: {
|
|
255
|
-
variant: {
|
|
256
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
257
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
258
|
-
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
259
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
260
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
261
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
262
|
-
},
|
|
263
|
-
size: {
|
|
264
|
-
default: "h-10 px-4 py-2",
|
|
265
|
-
sm: "h-9 rounded-md px-3",
|
|
266
|
-
lg: "h-11 rounded-md px-8",
|
|
267
|
-
icon: "h-10 w-10"
|
|
268
|
-
}
|
|
269
|
-
},
|
|
270
|
-
defaultVariants: {
|
|
271
|
-
variant: "default",
|
|
272
|
-
size: "default"
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
);
|
|
276
|
-
var Button = React2.forwardRef(
|
|
277
|
-
(_a, ref) => {
|
|
278
|
-
var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest(_b, ["className", "variant", "size", "asChild"]);
|
|
279
|
-
const Comp = asChild ? Slot : "button";
|
|
280
|
-
return /* @__PURE__ */ jsx3(Comp, __spreadValues({ className: cn(buttonVariants({ variant, size, className })), ref }, props));
|
|
281
|
-
}
|
|
282
|
-
);
|
|
283
|
-
Button.displayName = "Button";
|
|
284
|
-
|
|
285
|
-
// src/components/ui/label.tsx
|
|
286
|
-
import * as React3 from "react";
|
|
287
|
-
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
288
|
-
import { cva as cva2 } from "class-variance-authority";
|
|
289
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
290
|
-
var labelVariants = cva2(
|
|
291
|
-
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
292
|
-
);
|
|
293
|
-
var Label = React3.forwardRef((_a, ref) => {
|
|
294
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
295
|
-
return /* @__PURE__ */ jsx4(LabelPrimitive.Root, __spreadValues({ ref, className: cn(labelVariants(), className) }, props));
|
|
296
|
-
});
|
|
297
|
-
Label.displayName = LabelPrimitive.Root.displayName;
|
|
298
|
-
|
|
299
|
-
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
300
|
-
import { useCallback, useEffect as useEffect2, useRef, useState as useState3 } from "react";
|
|
301
|
-
|
|
302
|
-
// src/lib/stream-promise-flatten.ts
|
|
303
|
-
function streamPromiseFlatten(promise) {
|
|
304
|
-
return new ReadableStream({
|
|
305
|
-
start(controller) {
|
|
306
|
-
return __async(this, null, function* () {
|
|
307
|
-
try {
|
|
308
|
-
const stream = yield promise;
|
|
309
|
-
const reader = stream.getReader();
|
|
310
|
-
while (true) {
|
|
311
|
-
const { done, value } = yield reader.read();
|
|
312
|
-
if (done) {
|
|
313
|
-
controller.close();
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
controller.enqueue(value);
|
|
317
|
-
}
|
|
318
|
-
} catch (error) {
|
|
319
|
-
controller.error(error);
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
// src/components/hovering-toolbar/hovering-editor-provider.tsx
|
|
327
|
-
import { createContext, useState as useState2, useContext } from "react";
|
|
328
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
329
|
-
var HoveringEditorContext = createContext({
|
|
330
|
-
isDisplayed: false,
|
|
331
|
-
setIsDisplayed: () => {
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
var useHoveringEditorContext = () => useContext(HoveringEditorContext);
|
|
335
|
-
|
|
336
|
-
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
337
|
-
import { MdArrowForward, MdCheck } from "react-icons/md";
|
|
338
|
-
import { Fragment, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
339
|
-
var HoveringInsertionPromptBoxCore = ({
|
|
340
|
-
performInsertion,
|
|
341
|
-
state,
|
|
342
|
-
insertionOrEditingFunction,
|
|
343
|
-
contextCategories
|
|
344
|
-
}) => {
|
|
345
|
-
const { getDocumentsContext } = useCopilotContext();
|
|
346
|
-
const [editSuggestion, setEditSuggestion] = useState3("");
|
|
347
|
-
const [suggestionIsLoading, setSuggestionIsLoading] = useState3(false);
|
|
348
|
-
const [adjustmentPrompt, setAdjustmentPrompt] = useState3("");
|
|
349
|
-
const [generatingSuggestion, setGeneratingSuggestion] = useState3(
|
|
350
|
-
null
|
|
351
|
-
);
|
|
352
|
-
const adjustmentTextAreaRef = useRef(null);
|
|
353
|
-
const suggestionTextAreaRef = useRef(null);
|
|
354
|
-
const [filePointers, setFilePointers] = useState3([]);
|
|
355
|
-
const [suggestedFiles, setSuggestedFiles] = useState3([]);
|
|
356
|
-
useEffect2(() => {
|
|
357
|
-
setSuggestedFiles(getDocumentsContext(contextCategories));
|
|
358
|
-
}, [contextCategories, getDocumentsContext]);
|
|
359
|
-
use_autosize_textarea_default(suggestionTextAreaRef, editSuggestion || "");
|
|
360
|
-
use_autosize_textarea_default(adjustmentTextAreaRef, adjustmentPrompt || "");
|
|
361
|
-
useEffect2(() => {
|
|
362
|
-
var _a;
|
|
363
|
-
(_a = adjustmentTextAreaRef.current) == null ? void 0 : _a.focus();
|
|
364
|
-
}, []);
|
|
365
|
-
useEffect2(() => {
|
|
366
|
-
if (!generatingSuggestion) {
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
if (generatingSuggestion.locked) {
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
|
-
setEditSuggestion("");
|
|
373
|
-
const reader = generatingSuggestion.getReader();
|
|
374
|
-
const read = () => __async(void 0, null, function* () {
|
|
375
|
-
setSuggestionIsLoading(true);
|
|
376
|
-
while (true) {
|
|
377
|
-
const { done, value } = yield reader.read();
|
|
378
|
-
if (done) {
|
|
379
|
-
break;
|
|
380
|
-
}
|
|
381
|
-
setEditSuggestion((prev) => {
|
|
382
|
-
const newSuggestion = prev + value;
|
|
383
|
-
if (suggestionTextAreaRef.current) {
|
|
384
|
-
suggestionTextAreaRef.current.scrollTop = suggestionTextAreaRef.current.scrollHeight;
|
|
385
|
-
}
|
|
386
|
-
return newSuggestion;
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
setSuggestionIsLoading(false);
|
|
390
|
-
});
|
|
391
|
-
read();
|
|
392
|
-
return () => {
|
|
393
|
-
const releaseLockIfNotClosed = () => __async(void 0, null, function* () {
|
|
394
|
-
try {
|
|
395
|
-
yield reader.closed;
|
|
396
|
-
} catch (e) {
|
|
397
|
-
reader.releaseLock();
|
|
398
|
-
}
|
|
399
|
-
});
|
|
400
|
-
releaseLockIfNotClosed();
|
|
401
|
-
};
|
|
402
|
-
}, [generatingSuggestion]);
|
|
403
|
-
const beginGeneratingAdjustment = useCallback(() => __async(void 0, null, function* () {
|
|
404
|
-
if (!adjustmentPrompt.trim()) {
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
let modificationState = state.editorState;
|
|
408
|
-
if (editSuggestion !== "") {
|
|
409
|
-
modificationState.selectedText = editSuggestion;
|
|
410
|
-
}
|
|
411
|
-
const adjustmentSuggestionTextStreamPromise = insertionOrEditingFunction(
|
|
412
|
-
modificationState,
|
|
413
|
-
adjustmentPrompt,
|
|
414
|
-
filePointers,
|
|
415
|
-
new AbortController().signal
|
|
416
|
-
);
|
|
417
|
-
const adjustmentSuggestionTextStream = streamPromiseFlatten(
|
|
418
|
-
adjustmentSuggestionTextStreamPromise
|
|
419
|
-
);
|
|
420
|
-
setGeneratingSuggestion(adjustmentSuggestionTextStream);
|
|
421
|
-
}), [
|
|
422
|
-
adjustmentPrompt,
|
|
423
|
-
editSuggestion,
|
|
424
|
-
state.editorState,
|
|
425
|
-
insertionOrEditingFunction,
|
|
426
|
-
filePointers
|
|
427
|
-
]);
|
|
428
|
-
const isLoading = suggestionIsLoading;
|
|
429
|
-
const textToEdit = editSuggestion || state.editorState.selectedText;
|
|
430
|
-
const adjustmentLabel = textToEdit === "" ? "Describe the text you want to insert" : "Describe adjustments to the suggested text";
|
|
431
|
-
const placeholder = textToEdit === "" ? "e.g. 'summarize the client's top 3 pain-points from @CallTranscript'" : "e.g. 'make it more formal', 'be more specific', ...";
|
|
432
|
-
const { setIsDisplayed } = useHoveringEditorContext();
|
|
433
|
-
const AdjustmentPromptComponent = /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
434
|
-
/* @__PURE__ */ jsx6(Label, { className: "", children: adjustmentLabel }),
|
|
435
|
-
/* @__PURE__ */ jsxs2("div", { className: "relative w-full flex items-center", children: [
|
|
436
|
-
/* @__PURE__ */ jsx6(
|
|
437
|
-
"textarea",
|
|
438
|
-
{
|
|
439
|
-
disabled: suggestionIsLoading,
|
|
440
|
-
ref: adjustmentTextAreaRef,
|
|
441
|
-
value: adjustmentPrompt,
|
|
442
|
-
onChange: (e) => setAdjustmentPrompt(e.target.value),
|
|
443
|
-
onKeyDown: (e) => {
|
|
444
|
-
if (e.key === "Enter" && e.shiftKey) {
|
|
445
|
-
e.preventDefault();
|
|
446
|
-
setAdjustmentPrompt(adjustmentPrompt + "\n");
|
|
447
|
-
} else if (e.key === "Enter") {
|
|
448
|
-
e.preventDefault();
|
|
449
|
-
beginGeneratingAdjustment();
|
|
450
|
-
} else if (e.key == "Escape") {
|
|
451
|
-
e.preventDefault();
|
|
452
|
-
setIsDisplayed(false);
|
|
453
|
-
}
|
|
454
|
-
},
|
|
455
|
-
placeholder,
|
|
456
|
-
style: { minHeight: "3rem" },
|
|
457
|
-
className: "w-full bg-slate-100 h-auto h-min-14 text-sm p-2 rounded-md resize-none overflow-visible focus:outline-none focus:ring-0 focus:border-non pr-[3rem]",
|
|
458
|
-
rows: 1
|
|
459
|
-
}
|
|
460
|
-
),
|
|
461
|
-
/* @__PURE__ */ jsx6(
|
|
462
|
-
"button",
|
|
463
|
-
{
|
|
464
|
-
onClick: beginGeneratingAdjustment,
|
|
465
|
-
className: "absolute right-2 bg-blue-500 text-white w-8 h-8 rounded-full flex items-center justify-center",
|
|
466
|
-
children: /* @__PURE__ */ jsx6(MdArrowForward, { className: "text-2xl" })
|
|
467
|
-
}
|
|
468
|
-
)
|
|
469
|
-
] })
|
|
470
|
-
] });
|
|
471
|
-
const SuggestionComponent = /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
472
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex justify-between items-end w-full", children: [
|
|
473
|
-
/* @__PURE__ */ jsx6(Label, { className: "mt-4", children: "Suggested:" }),
|
|
474
|
-
/* @__PURE__ */ jsx6("div", { className: "ml-auto", children: isLoading && /* @__PURE__ */ jsx6("div", { className: "flex justify-center items-center", children: /* @__PURE__ */ jsx6(
|
|
475
|
-
"div",
|
|
476
|
-
{
|
|
477
|
-
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]",
|
|
478
|
-
role: "status",
|
|
479
|
-
children: /* @__PURE__ */ jsx6("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..." })
|
|
480
|
-
}
|
|
481
|
-
) }) })
|
|
482
|
-
] }),
|
|
483
|
-
/* @__PURE__ */ jsx6(
|
|
484
|
-
"textarea",
|
|
485
|
-
{
|
|
486
|
-
ref: suggestionTextAreaRef,
|
|
487
|
-
value: editSuggestion,
|
|
488
|
-
disabled: suggestionIsLoading,
|
|
489
|
-
onChange: (e) => setEditSuggestion(e.target.value),
|
|
490
|
-
className: "w-full text-base p-2 border border-gray-300 rounded-md resize-none bg-green-50",
|
|
491
|
-
style: { overflow: "auto", maxHeight: "10em" }
|
|
492
|
-
}
|
|
493
|
-
)
|
|
494
|
-
] });
|
|
495
|
-
const SubmitComponent = /* @__PURE__ */ jsx6("div", { className: "flex w-full gap-4 justify-start", children: /* @__PURE__ */ jsxs2(
|
|
496
|
-
Button,
|
|
497
|
-
{
|
|
498
|
-
className: " bg-green-700 text-white",
|
|
499
|
-
onClick: () => {
|
|
500
|
-
performInsertion(editSuggestion);
|
|
501
|
-
},
|
|
502
|
-
children: [
|
|
503
|
-
"Insert ",
|
|
504
|
-
/* @__PURE__ */ jsx6(MdCheck, { className: "text-2xl" })
|
|
505
|
-
]
|
|
506
|
-
}
|
|
507
|
-
) });
|
|
508
|
-
const sourceSearchCandidate = adjustmentPrompt.split(" ").pop();
|
|
509
|
-
const sourceSearchWord = (sourceSearchCandidate == null ? void 0 : sourceSearchCandidate.startsWith("@")) ? sourceSearchCandidate.slice(1) : void 0;
|
|
510
|
-
return /* @__PURE__ */ jsxs2("div", { className: "w-full flex flex-col items-start relative gap-2", children: [
|
|
511
|
-
AdjustmentPromptComponent,
|
|
512
|
-
sourceSearchWord !== void 0 && /* @__PURE__ */ jsx6(
|
|
513
|
-
SourceSearchBox,
|
|
514
|
-
{
|
|
515
|
-
searchTerm: sourceSearchWord,
|
|
516
|
-
suggestedFiles,
|
|
517
|
-
onSelectedFile: (filePointer) => {
|
|
518
|
-
var _a;
|
|
519
|
-
setAdjustmentPrompt(adjustmentPrompt.replace(new RegExp(`@${sourceSearchWord}$`), ""));
|
|
520
|
-
setFilePointers((prev) => [...prev, filePointer]);
|
|
521
|
-
(_a = adjustmentTextAreaRef.current) == null ? void 0 : _a.focus();
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
),
|
|
525
|
-
generatingSuggestion ? SuggestionComponent : null,
|
|
526
|
-
generatingSuggestion ? SubmitComponent : null
|
|
527
|
-
] });
|
|
528
|
-
};
|
|
529
|
-
|
|
530
|
-
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx
|
|
531
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
532
|
-
var HoveringInsertionPromptBox = (props) => {
|
|
533
|
-
return /* @__PURE__ */ jsx7(
|
|
534
|
-
"div",
|
|
535
|
-
{
|
|
536
|
-
className: "flex flex-col justify-center items-center space-y-4 rounded-md border shadow-lg p-4 border-gray- bg-white",
|
|
537
|
-
style: { width: "35rem" },
|
|
538
|
-
children: /* @__PURE__ */ jsx7(
|
|
539
|
-
HoveringInsertionPromptBoxCore,
|
|
540
|
-
{
|
|
541
|
-
state: {
|
|
542
|
-
editorState: props.editorState
|
|
543
|
-
},
|
|
544
|
-
insertionOrEditingFunction: props.apiConfig.insertionOrEditingFunction,
|
|
545
|
-
performInsertion: props.performInsertion,
|
|
546
|
-
contextCategories: props.contextCategories
|
|
547
|
-
}
|
|
548
|
-
)
|
|
549
|
-
}
|
|
550
|
-
);
|
|
551
|
-
};
|
|
552
|
-
|
|
553
|
-
// src/components/hovering-toolbar/hovering-toolbar-components.tsx
|
|
554
|
-
import { css, cx } from "@emotion/css";
|
|
555
|
-
import React4 from "react";
|
|
556
|
-
import ReactDOM from "react-dom";
|
|
557
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
558
|
-
var Button2 = React4.forwardRef(
|
|
559
|
-
(_a, ref) => {
|
|
560
|
-
var _b = _a, {
|
|
561
|
-
className,
|
|
562
|
-
active,
|
|
563
|
-
reversed
|
|
564
|
-
} = _b, props = __objRest(_b, [
|
|
565
|
-
"className",
|
|
566
|
-
"active",
|
|
567
|
-
"reversed"
|
|
568
|
-
]);
|
|
569
|
-
return /* @__PURE__ */ jsx8(
|
|
570
|
-
"span",
|
|
571
|
-
__spreadProps(__spreadValues({}, props), {
|
|
572
|
-
ref,
|
|
573
|
-
className: cx(
|
|
574
|
-
className,
|
|
575
|
-
css`
|
|
576
|
-
cursor: pointer;
|
|
577
|
-
color: ${reversed ? active ? "white" : "#aaa" : active ? "black" : "#ccc"};
|
|
578
|
-
`
|
|
579
|
-
)
|
|
580
|
-
})
|
|
581
|
-
);
|
|
582
|
-
}
|
|
583
|
-
);
|
|
584
|
-
var Menu = React4.forwardRef(
|
|
585
|
-
(_a, ref) => {
|
|
586
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
587
|
-
return /* @__PURE__ */ jsx8(
|
|
588
|
-
"div",
|
|
589
|
-
__spreadProps(__spreadValues({}, props), {
|
|
590
|
-
"data-test-id": "menu",
|
|
591
|
-
ref,
|
|
592
|
-
className: cx(
|
|
593
|
-
className,
|
|
594
|
-
css`
|
|
595
|
-
& > * {
|
|
596
|
-
display: inline-block;
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
& > * + * {
|
|
600
|
-
margin-left: 15px;
|
|
601
|
-
}
|
|
602
|
-
`
|
|
603
|
-
)
|
|
604
|
-
})
|
|
605
|
-
);
|
|
606
|
-
}
|
|
607
|
-
);
|
|
608
|
-
var Portal = ({ children }) => {
|
|
609
|
-
return typeof document === "object" ? ReactDOM.createPortal(children, document.body) : null;
|
|
610
|
-
};
|
|
611
|
-
var Toolbar = React4.forwardRef(
|
|
612
|
-
(_a, ref) => {
|
|
613
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
614
|
-
return /* @__PURE__ */ jsx8(
|
|
615
|
-
Menu,
|
|
616
|
-
__spreadProps(__spreadValues({}, props), {
|
|
617
|
-
ref,
|
|
618
|
-
className: cx(
|
|
619
|
-
className,
|
|
620
|
-
css`
|
|
621
|
-
position: relative;
|
|
622
|
-
padding: 1px 18px 17px;
|
|
623
|
-
margin: 0 -20px;
|
|
624
|
-
border-bottom: 2px solid #eee;
|
|
625
|
-
margin-bottom: 20px;
|
|
626
|
-
`
|
|
627
|
-
)
|
|
628
|
-
})
|
|
629
|
-
);
|
|
630
|
-
}
|
|
631
|
-
);
|
|
632
|
-
|
|
633
|
-
// src/lib/get-text-around-cursor.ts
|
|
634
|
-
import { Editor, Path, Range, Text, Element, Point } from "slate";
|
|
635
|
-
function getTextAroundSelection(editor) {
|
|
636
|
-
const { selection } = editor;
|
|
637
|
-
if (!selection) {
|
|
638
|
-
return null;
|
|
639
|
-
}
|
|
640
|
-
const wellOrderedSelection = wellOrderedRange(selection);
|
|
641
|
-
const beforeRange = {
|
|
642
|
-
anchor: Editor.start(editor, []),
|
|
643
|
-
focus: wellOrderedSelection.anchor
|
|
644
|
-
};
|
|
645
|
-
const afterRange = {
|
|
646
|
-
anchor: wellOrderedSelection.focus,
|
|
647
|
-
focus: Editor.end(editor, [])
|
|
648
|
-
};
|
|
649
|
-
const before = extractTextWithNewlines(editor, beforeRange);
|
|
650
|
-
const after = extractTextWithNewlines(editor, afterRange);
|
|
651
|
-
const selectedText = extractTextWithNewlines(editor, wellOrderedSelection);
|
|
652
|
-
return {
|
|
653
|
-
selection: wellOrderedSelection,
|
|
654
|
-
textBeforeCursor: before,
|
|
655
|
-
selectedText,
|
|
656
|
-
textAfterCursor: after
|
|
657
|
-
};
|
|
658
|
-
}
|
|
659
|
-
function getFullEditorTextWithNewlines(editor) {
|
|
660
|
-
const fullDocumentRange = {
|
|
661
|
-
anchor: Editor.start(editor, []),
|
|
662
|
-
focus: Editor.end(editor, [])
|
|
663
|
-
};
|
|
664
|
-
return extractTextWithNewlines(editor, fullDocumentRange);
|
|
665
|
-
}
|
|
666
|
-
function extractTextWithNewlines(editor, range) {
|
|
667
|
-
const voids = false;
|
|
668
|
-
const [start, end] = Range.edges(range);
|
|
669
|
-
let text = "";
|
|
670
|
-
let lastBlock = null;
|
|
671
|
-
for (const [node, path] of Editor.nodes(editor, {
|
|
672
|
-
at: range,
|
|
673
|
-
match: Text.isText,
|
|
674
|
-
voids
|
|
675
|
-
})) {
|
|
676
|
-
let t = node.text;
|
|
677
|
-
const [block] = Editor.above(editor, {
|
|
678
|
-
at: path,
|
|
679
|
-
match: (n) => Element.isElement(n) && n.type === "paragraph"
|
|
680
|
-
}) || [null];
|
|
681
|
-
if (lastBlock !== block && block) {
|
|
682
|
-
if (lastBlock) {
|
|
683
|
-
text += "\n";
|
|
684
|
-
}
|
|
685
|
-
lastBlock = block;
|
|
686
|
-
}
|
|
687
|
-
if (Path.equals(path, end.path)) {
|
|
688
|
-
t = t.slice(0, end.offset);
|
|
689
|
-
}
|
|
690
|
-
if (Path.equals(path, start.path)) {
|
|
691
|
-
t = t.slice(start.offset);
|
|
692
|
-
}
|
|
693
|
-
text += t;
|
|
694
|
-
}
|
|
695
|
-
return text;
|
|
696
|
-
}
|
|
697
|
-
function wellOrderedRange(range) {
|
|
698
|
-
const { anchor, focus } = range;
|
|
699
|
-
if (Point.isBefore(anchor, focus)) {
|
|
700
|
-
return range;
|
|
701
|
-
}
|
|
702
|
-
return {
|
|
703
|
-
anchor: focus,
|
|
704
|
-
focus: anchor
|
|
705
|
-
};
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
// src/components/hovering-toolbar/hovering-toolbar.tsx
|
|
709
|
-
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
710
|
-
var HoveringToolbar = (props) => {
|
|
711
|
-
const ref = useRef2(null);
|
|
712
|
-
const editor = useSlate();
|
|
713
|
-
const selection = useSlateSelection();
|
|
714
|
-
const { isDisplayed, setIsDisplayed } = useHoveringEditorContext();
|
|
715
|
-
const [isClient, setIsClient] = useState4(false);
|
|
716
|
-
useEffect3(() => {
|
|
717
|
-
setIsClient(true);
|
|
718
|
-
}, []);
|
|
719
|
-
useEffect3(() => {
|
|
720
|
-
const el = ref.current;
|
|
721
|
-
const { selection: selection2 } = editor;
|
|
722
|
-
if (!el) {
|
|
723
|
-
return;
|
|
724
|
-
}
|
|
725
|
-
if (!selection2) {
|
|
726
|
-
el.removeAttribute("style");
|
|
727
|
-
return;
|
|
728
|
-
}
|
|
729
|
-
const domSelection = window.getSelection();
|
|
730
|
-
if (!domSelection || domSelection.rangeCount === 0) {
|
|
731
|
-
return;
|
|
732
|
-
}
|
|
733
|
-
const domRange = domSelection.getRangeAt(0);
|
|
734
|
-
const rect = domRange.getBoundingClientRect();
|
|
735
|
-
if (rect.top === 0 && rect.left === 0 && rect.width === 0 && rect.height === 0) {
|
|
736
|
-
return;
|
|
737
|
-
}
|
|
738
|
-
const minGapFromEdge = 60;
|
|
739
|
-
const verticalOffsetFromCorner = 35;
|
|
740
|
-
const horizontalOffsetFromCorner = 15;
|
|
741
|
-
let top = rect.top + window.scrollY - el.offsetHeight + verticalOffsetFromCorner;
|
|
742
|
-
if (top < minGapFromEdge) {
|
|
743
|
-
top = rect.bottom + window.scrollY + minGapFromEdge;
|
|
744
|
-
} else if (top + el.offsetHeight > window.innerHeight - minGapFromEdge) {
|
|
745
|
-
top = rect.top + window.scrollY - el.offsetHeight - minGapFromEdge;
|
|
746
|
-
}
|
|
747
|
-
let left = rect.left + window.scrollX - el.offsetWidth / 2 + rect.width / 2 + horizontalOffsetFromCorner;
|
|
748
|
-
if (left < minGapFromEdge) {
|
|
749
|
-
left = minGapFromEdge;
|
|
750
|
-
} else if (left + el.offsetWidth > window.innerWidth - minGapFromEdge) {
|
|
751
|
-
left = window.innerWidth - el.offsetWidth - minGapFromEdge;
|
|
752
|
-
}
|
|
753
|
-
el.style.opacity = "1";
|
|
754
|
-
el.style.position = "absolute";
|
|
755
|
-
el.style.top = `${top}px`;
|
|
756
|
-
el.style.left = `${left}px`;
|
|
757
|
-
});
|
|
758
|
-
useEffect3(() => {
|
|
759
|
-
const handleClickOutside = (event) => {
|
|
760
|
-
if (ref.current && !ref.current.contains(event.target)) {
|
|
761
|
-
setIsDisplayed(false);
|
|
762
|
-
}
|
|
763
|
-
};
|
|
764
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
765
|
-
return () => {
|
|
766
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
767
|
-
};
|
|
768
|
-
}, [ref, setIsDisplayed]);
|
|
769
|
-
if (!isClient) {
|
|
770
|
-
return null;
|
|
771
|
-
}
|
|
772
|
-
return /* @__PURE__ */ jsx9(Portal, { children: /* @__PURE__ */ jsx9(
|
|
773
|
-
Menu,
|
|
774
|
-
{
|
|
775
|
-
ref,
|
|
776
|
-
className: "copilot-kit-textarea-css-scope " + (props.hoverMenuClassname || "p-2 absolute z-10 top-[-10000px] left-[-10000px] mt-[-6px] opacity-0 transition-opacity duration-700"),
|
|
777
|
-
children: isDisplayed && selection && /* @__PURE__ */ jsx9(
|
|
778
|
-
HoveringInsertionPromptBox,
|
|
779
|
-
{
|
|
780
|
-
editorState: editorState(editor, selection),
|
|
781
|
-
apiConfig: props.apiConfig,
|
|
782
|
-
closeWindow: () => {
|
|
783
|
-
setIsDisplayed(false);
|
|
784
|
-
},
|
|
785
|
-
performInsertion: (insertedText) => {
|
|
786
|
-
Transforms.delete(editor, { at: selection });
|
|
787
|
-
Transforms.insertText(editor, insertedText, {
|
|
788
|
-
at: selection
|
|
789
|
-
});
|
|
790
|
-
setIsDisplayed(false);
|
|
791
|
-
},
|
|
792
|
-
contextCategories: props.contextCategories
|
|
793
|
-
}
|
|
794
|
-
)
|
|
795
|
-
}
|
|
796
|
-
) });
|
|
797
|
-
};
|
|
798
|
-
function editorState(editor, selection) {
|
|
799
|
-
const textAroundCursor = getTextAroundSelection(editor);
|
|
800
|
-
if (textAroundCursor) {
|
|
801
|
-
return textAroundCursor;
|
|
802
|
-
}
|
|
803
|
-
return {
|
|
804
|
-
textBeforeCursor: getFullEditorTextWithNewlines(editor),
|
|
805
|
-
textAfterCursor: "",
|
|
806
|
-
selectedText: ""
|
|
807
|
-
};
|
|
808
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
HoveringToolbar
|
|
3
|
+
} from "../../chunk-4AMCUMC7.mjs";
|
|
4
|
+
import "../../chunk-L7VVZH4Q.mjs";
|
|
5
|
+
import "../../chunk-I3SPIGAI.mjs";
|
|
6
|
+
import "../../chunk-UGEKMSRR.mjs";
|
|
7
|
+
import "../../chunk-KMVGEY7Q.mjs";
|
|
8
|
+
import "../../chunk-3PQ7GSFE.mjs";
|
|
9
|
+
import "../../chunk-4PDYALMP.mjs";
|
|
10
|
+
import "../../chunk-D47EKHIF.mjs";
|
|
11
|
+
import "../../chunk-LYB4B6MK.mjs";
|
|
12
|
+
import "../../chunk-CF5GISTC.mjs";
|
|
13
|
+
import "../../chunk-WGWQRALG.mjs";
|
|
14
|
+
import "../../chunk-VSVQZUPW.mjs";
|
|
15
|
+
import "../../chunk-I72DKFHD.mjs";
|
|
16
|
+
import "../../chunk-2QDCE7PD.mjs";
|
|
17
|
+
import "../../chunk-YLFAIYRY.mjs";
|
|
18
|
+
import "../../chunk-ECR45NSD.mjs";
|
|
19
|
+
import "../../chunk-MRXNTQOX.mjs";
|
|
809
20
|
export {
|
|
810
21
|
HoveringToolbar
|
|
811
22
|
};
|