@copilotkit/react-textarea 1.5.8 → 1.5.10-next.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/CHANGELOG.md +41 -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-2VMZ5ZWT.mjs +229 -0
- package/dist/chunk-2VMZ5ZWT.mjs.map +1 -0
- package/dist/chunk-3PQ7GSFE.mjs +17 -0
- package/dist/chunk-3PQ7GSFE.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-4XXU5BSA.mjs +125 -0
- package/dist/chunk-4XXU5BSA.mjs.map +1 -0
- package/dist/chunk-5UNJXFUO.mjs +29 -0
- package/dist/chunk-5UNJXFUO.mjs.map +1 -0
- package/dist/chunk-7L6GIHDM.mjs +39 -0
- package/dist/chunk-7L6GIHDM.mjs.map +1 -0
- package/dist/chunk-7LSRNPNI.mjs +59 -0
- package/dist/chunk-7LSRNPNI.mjs.map +1 -0
- package/dist/chunk-ABYCGF77.mjs +31 -0
- package/dist/chunk-ABYCGF77.mjs.map +1 -0
- package/dist/chunk-AJ5OMEXM.mjs +13 -0
- package/dist/chunk-AJ5OMEXM.mjs.map +1 -0
- package/dist/chunk-BNBGJBBM.mjs +60 -0
- package/dist/chunk-BNBGJBBM.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-F6GMWOLE.mjs +93 -0
- package/dist/chunk-F6GMWOLE.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-HDBI2WN5.mjs +113 -0
- package/dist/chunk-HDBI2WN5.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-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-MGYT7RNL.mjs +32 -0
- package/dist/chunk-MGYT7RNL.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-PZYM7K4Y.mjs +265 -0
- package/dist/chunk-PZYM7K4Y.mjs.map +1 -0
- package/dist/chunk-QFXR6DOA.mjs +64 -0
- package/dist/chunk-QFXR6DOA.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-RXV67GJN.mjs +168 -0
- package/dist/chunk-RXV67GJN.mjs.map +1 -0
- package/dist/chunk-T6MTDQZ7.mjs +45 -0
- package/dist/chunk-T6MTDQZ7.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 +43 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js +1795 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +40 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/render-element.d.ts +6 -0
- package/dist/components/base-copilot-textarea/render-element.js +75 -0
- package/dist/components/base-copilot-textarea/render-element.js.map +1 -0
- package/dist/components/base-copilot-textarea/render-element.mjs +8 -0
- package/dist/components/base-copilot-textarea/render-element.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/render-placeholder.d.ts +6 -0
- package/dist/components/base-copilot-textarea/render-placeholder.js +72 -0
- package/dist/components/base-copilot-textarea/render-placeholder.js.map +1 -0
- package/dist/components/base-copilot-textarea/render-placeholder.mjs +8 -0
- package/dist/components/base-copilot-textarea/render-placeholder.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.d.ts +8 -0
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js +112 -0
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js.map +1 -0
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +9 -0
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/use-add-branding-css.d.ts +3 -0
- package/dist/components/base-copilot-textarea/use-add-branding-css.js +83 -0
- package/dist/components/base-copilot-textarea/use-add-branding-css.js.map +1 -0
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +8 -0
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs.map +1 -0
- 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 +171 -0
- package/dist/components/copilot-textarea/copilot-textarea.js +2289 -0
- package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -0
- package/dist/components/copilot-textarea/copilot-textarea.mjs +49 -0
- package/dist/components/copilot-textarea/copilot-textarea.mjs.map +1 -0
- package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +18 -0
- package/dist/components/hovering-toolbar/hovering-editor-provider.js +44 -0
- package/dist/components/hovering-toolbar/hovering-editor-provider.js.map +1 -0
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +10 -0
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs.map +1 -0
- package/dist/components/hovering-toolbar/hovering-toolbar-components.d.ts +18 -0
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js +174 -0
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js.map +1 -0
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +16 -0
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs.map +1 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.d.ts +12 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.js +912 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +23 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.d.ts +16 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +606 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +18 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.d.ts +14 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +629 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +19 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs.map +1 -0
- 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.d.ts +4 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +629 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js.map +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +20 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +1 -0
- package/dist/components/index.css +9 -0
- package/dist/components/index.css.map +1 -0
- package/dist/components/index.d.ts +15 -0
- package/dist/components/index.js +2293 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +53 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/components/manual-ui/chip-with-icon.d.ts +10 -0
- package/dist/components/manual-ui/chip-with-icon.js +38 -0
- package/dist/components/manual-ui/chip-with-icon.js.map +1 -0
- package/dist/components/manual-ui/chip-with-icon.mjs +15 -0
- package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -0
- package/dist/components/source-search-box/source-search-box.d.ts +16 -0
- package/dist/components/source-search-box/source-search-box.js +240 -0
- package/dist/components/source-search-box/source-search-box.js.map +1 -0
- package/dist/components/source-search-box/source-search-box.mjs +13 -0
- package/dist/components/source-search-box/source-search-box.mjs.map +1 -0
- package/dist/components/ui/button.d.ts +14 -0
- package/dist/components/ui/button.js +114 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/button.mjs +11 -0
- package/dist/components/ui/button.mjs.map +1 -0
- package/dist/components/ui/command.d.ts +53 -0
- package/dist/components/ui/command.js +285 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/command.mjs +26 -0
- package/dist/components/ui/command.mjs.map +1 -0
- package/dist/components/ui/dialog.d.ts +19 -0
- package/dist/components/ui/dialog.js +183 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/dialog.mjs +21 -0
- package/dist/components/ui/dialog.mjs.map +1 -0
- package/dist/components/ui/label.d.ts +8 -0
- package/dist/components/ui/label.js +87 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/label.mjs +9 -0
- package/dist/components/ui/label.mjs.map +1 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.js +19 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/index.mjs +2 -0
- package/dist/context/index.mjs.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.ts +15 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js +180 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +11 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.d.ts +8 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js +194 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +9 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.d.ts +7 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js +180 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js.map +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +10 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +19 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +2 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +22 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js +153 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js.map +1 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +9 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs.map +1 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.d.ts +23 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js +228 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js.map +1 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +9 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs.map +1 -0
- package/dist/hooks/misc/use-autosize-textarea.d.ts +5 -0
- package/dist/hooks/misc/use-autosize-textarea.js +37 -0
- package/dist/hooks/misc/use-autosize-textarea.js.map +1 -0
- package/dist/hooks/misc/use-autosize-textarea.mjs +8 -0
- package/dist/hooks/misc/use-autosize-textarea.mjs.map +1 -0
- package/dist/index.css +644 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +2298 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +64 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/debouncer.d.ts +11 -0
- package/dist/lib/debouncer.js +76 -0
- package/dist/lib/debouncer.js.map +1 -0
- package/dist/lib/debouncer.mjs +8 -0
- package/dist/lib/debouncer.mjs.map +1 -0
- package/dist/lib/editor-to-text.d.ts +7 -0
- package/dist/lib/editor-to-text.js +69 -0
- package/dist/lib/editor-to-text.js.map +1 -0
- package/dist/lib/editor-to-text.mjs +8 -0
- package/dist/lib/editor-to-text.mjs.map +1 -0
- package/dist/lib/get-text-around-cursor.d.ts +15 -0
- package/dist/lib/get-text-around-cursor.js +131 -0
- package/dist/lib/get-text-around-cursor.js.map +1 -0
- package/dist/lib/get-text-around-cursor.mjs +14 -0
- package/dist/lib/get-text-around-cursor.mjs.map +1 -0
- package/dist/lib/retry.d.ts +3 -0
- package/dist/lib/retry.js +43 -0
- package/dist/lib/retry.js.map +1 -0
- package/dist/lib/retry.mjs +8 -0
- package/dist/lib/retry.mjs.map +1 -0
- package/dist/lib/slatejs-edits/add-autocompletions.d.ts +8 -0
- package/dist/lib/slatejs-edits/add-autocompletions.js +51 -0
- package/dist/lib/slatejs-edits/add-autocompletions.js.map +1 -0
- package/dist/lib/slatejs-edits/add-autocompletions.mjs +8 -0
- package/dist/lib/slatejs-edits/add-autocompletions.mjs.map +1 -0
- package/dist/lib/slatejs-edits/clear-autocompletions.d.ts +8 -0
- package/dist/lib/slatejs-edits/clear-autocompletions.js +46 -0
- package/dist/lib/slatejs-edits/clear-autocompletions.js.map +1 -0
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs +8 -0
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs.map +1 -0
- package/dist/lib/slatejs-edits/replace-text.d.ts +5 -0
- package/dist/lib/slatejs-edits/replace-text.js +53 -0
- package/dist/lib/slatejs-edits/replace-text.js.map +1 -0
- package/dist/lib/slatejs-edits/replace-text.mjs +8 -0
- package/dist/lib/slatejs-edits/replace-text.mjs.map +1 -0
- package/dist/lib/slatejs-edits/with-partial-history.d.ts +8 -0
- package/dist/lib/slatejs-edits/with-partial-history.js +133 -0
- package/dist/lib/slatejs-edits/with-partial-history.js.map +1 -0
- package/dist/lib/slatejs-edits/with-partial-history.mjs +10 -0
- package/dist/lib/slatejs-edits/with-partial-history.mjs.map +1 -0
- package/dist/lib/stream-promise-flatten.d.ts +12 -0
- package/dist/lib/stream-promise-flatten.js +72 -0
- package/dist/lib/stream-promise-flatten.js.map +1 -0
- package/dist/lib/stream-promise-flatten.mjs +8 -0
- package/dist/lib/stream-promise-flatten.mjs.map +1 -0
- package/dist/lib/utils.d.ts +9 -0
- package/dist/lib/utils.js +94 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/utils.mjs +16 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/dist/lib/utils.test.d.ts +2 -0
- package/dist/lib/utils.test.js +9 -0
- package/dist/lib/utils.test.js.map +1 -0
- package/dist/lib/utils.test.mjs +7 -0
- package/dist/lib/utils.test.mjs.map +1 -0
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.ts +23 -0
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js +19 -0
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js.map +1 -0
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs +1 -0
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs.map +1 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.d.ts +20 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.js +287 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.js.map +1 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +13 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +1 -0
- package/dist/types/autosuggestions-config/editing-api-config.d.ts +15 -0
- package/dist/types/autosuggestions-config/editing-api-config.js +108 -0
- package/dist/types/autosuggestions-config/editing-api-config.js.map +1 -0
- package/dist/types/autosuggestions-config/editing-api-config.mjs +12 -0
- package/dist/types/autosuggestions-config/editing-api-config.mjs.map +1 -0
- package/dist/types/autosuggestions-config/index.d.ts +10 -0
- package/dist/types/autosuggestions-config/index.js +287 -0
- package/dist/types/autosuggestions-config/index.js.map +1 -0
- package/dist/types/autosuggestions-config/index.mjs +14 -0
- package/dist/types/autosuggestions-config/index.mjs.map +1 -0
- package/dist/types/autosuggestions-config/insertions-api-config.d.ts +15 -0
- package/dist/types/autosuggestions-config/insertions-api-config.js +101 -0
- package/dist/types/autosuggestions-config/insertions-api-config.js.map +1 -0
- package/dist/types/autosuggestions-config/insertions-api-config.mjs +12 -0
- package/dist/types/autosuggestions-config/insertions-api-config.mjs.map +1 -0
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.d.ts +3 -0
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js +19 -0
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js.map +1 -0
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs +1 -0
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs.map +1 -0
- package/dist/types/autosuggestions-config/suggestions-api-config.d.ts +15 -0
- package/dist/types/autosuggestions-config/suggestions-api-config.js +90 -0
- package/dist/types/autosuggestions-config/suggestions-api-config.js.map +1 -0
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs +12 -0
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs.map +1 -0
- package/dist/types/base/autosuggestion-state.d.ts +8 -0
- package/dist/types/base/autosuggestion-state.js +19 -0
- package/dist/types/base/autosuggestion-state.js.map +1 -0
- package/dist/types/base/autosuggestion-state.mjs +1 -0
- package/dist/types/base/autosuggestion-state.mjs.map +1 -0
- package/dist/types/base/autosuggestions-bare-function.d.ts +19 -0
- package/dist/types/base/autosuggestions-bare-function.js +19 -0
- package/dist/types/base/autosuggestions-bare-function.js.map +1 -0
- package/dist/types/base/autosuggestions-bare-function.mjs +1 -0
- package/dist/types/base/autosuggestions-bare-function.mjs.map +1 -0
- package/dist/types/base/base-autosuggestions-config.d.ts +83 -0
- package/dist/types/base/base-autosuggestions-config.js +54 -0
- package/dist/types/base/base-autosuggestions-config.js.map +1 -0
- package/dist/types/base/base-autosuggestions-config.mjs +8 -0
- package/dist/types/base/base-autosuggestions-config.mjs.map +1 -0
- package/dist/types/base/base-copilot-textarea-props.d.ts +5 -0
- package/dist/types/base/base-copilot-textarea-props.js +19 -0
- package/dist/types/base/base-copilot-textarea-props.js.map +1 -0
- package/dist/types/base/base-copilot-textarea-props.mjs +1 -0
- package/dist/types/base/base-copilot-textarea-props.mjs.map +1 -0
- package/dist/types/base/custom-editor.d.ts +29 -0
- package/dist/types/base/custom-editor.js +19 -0
- package/dist/types/base/custom-editor.js.map +1 -0
- package/dist/types/base/custom-editor.mjs +1 -0
- package/dist/types/base/custom-editor.mjs.map +1 -0
- package/dist/types/base/editor-autocomplete-state.d.ts +10 -0
- package/dist/types/base/editor-autocomplete-state.js +40 -0
- package/dist/types/base/editor-autocomplete-state.js.map +1 -0
- package/dist/types/base/editor-autocomplete-state.mjs +9 -0
- package/dist/types/base/editor-autocomplete-state.mjs.map +1 -0
- package/dist/types/base/index.d.ts +54 -0
- package/dist/types/base/index.js +56 -0
- package/dist/types/base/index.js.map +1 -0
- package/dist/types/base/index.mjs +9 -0
- package/dist/types/base/index.mjs.map +1 -0
- package/dist/types/html-copilot-textarea-element.d.ts +7 -0
- package/dist/types/html-copilot-textarea-element.js +19 -0
- package/dist/types/html-copilot-textarea-element.js.map +1 -0
- package/dist/types/html-copilot-textarea-element.mjs +2 -0
- package/dist/types/html-copilot-textarea-element.mjs.map +1 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.js +289 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +19 -0
- package/dist/types/index.mjs.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,912 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
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);
|
|
58
|
+
var __async = (__this, __arguments, generator) => {
|
|
59
|
+
return new Promise((resolve, reject) => {
|
|
60
|
+
var fulfilled = (value) => {
|
|
61
|
+
try {
|
|
62
|
+
step(generator.next(value));
|
|
63
|
+
} catch (e) {
|
|
64
|
+
reject(e);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var rejected = (value) => {
|
|
68
|
+
try {
|
|
69
|
+
step(generator.throw(value));
|
|
70
|
+
} catch (e) {
|
|
71
|
+
reject(e);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
75
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// src/components/hovering-toolbar/hovering-toolbar.tsx
|
|
80
|
+
var hovering_toolbar_exports = {};
|
|
81
|
+
__export(hovering_toolbar_exports, {
|
|
82
|
+
HoveringToolbar: () => HoveringToolbar
|
|
83
|
+
});
|
|
84
|
+
module.exports = __toCommonJS(hovering_toolbar_exports);
|
|
85
|
+
var import_react6 = require("react");
|
|
86
|
+
var import_slate2 = require("slate");
|
|
87
|
+
var import_slate_react = require("slate-react");
|
|
88
|
+
|
|
89
|
+
// src/hooks/misc/use-autosize-textarea.tsx
|
|
90
|
+
var import_react = require("react");
|
|
91
|
+
var useAutosizeTextArea = (textAreaRef, value) => {
|
|
92
|
+
(0, import_react.useEffect)(() => {
|
|
93
|
+
if (textAreaRef.current !== null) {
|
|
94
|
+
textAreaRef.current.style.height = "0px";
|
|
95
|
+
const scrollHeight = textAreaRef.current.scrollHeight;
|
|
96
|
+
textAreaRef.current.style.height = scrollHeight + "px";
|
|
97
|
+
}
|
|
98
|
+
}, [textAreaRef, value]);
|
|
99
|
+
};
|
|
100
|
+
var use_autosize_textarea_default = useAutosizeTextArea;
|
|
101
|
+
|
|
102
|
+
// src/components/source-search-box/source-search-box.tsx
|
|
103
|
+
var import_react2 = require("react");
|
|
104
|
+
|
|
105
|
+
// src/components/ui/command.tsx
|
|
106
|
+
var React = __toESM(require("react"));
|
|
107
|
+
var import_cmdk = require("cmdk");
|
|
108
|
+
|
|
109
|
+
// src/lib/utils.ts
|
|
110
|
+
var import_clsx = require("clsx");
|
|
111
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
112
|
+
function cn(...inputs) {
|
|
113
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// src/components/ui/command.tsx
|
|
117
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
118
|
+
var Command = React.forwardRef((_a, ref) => {
|
|
119
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
121
|
+
import_cmdk.Command,
|
|
122
|
+
__spreadValues({
|
|
123
|
+
ref,
|
|
124
|
+
className: cn(
|
|
125
|
+
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
126
|
+
className
|
|
127
|
+
)
|
|
128
|
+
}, props)
|
|
129
|
+
);
|
|
130
|
+
});
|
|
131
|
+
Command.displayName = import_cmdk.Command.displayName;
|
|
132
|
+
var CommandInput = React.forwardRef((_a, ref) => {
|
|
133
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
134
|
+
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)(
|
|
135
|
+
import_cmdk.Command.Input,
|
|
136
|
+
__spreadValues({
|
|
137
|
+
ref,
|
|
138
|
+
className: cn(
|
|
139
|
+
"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",
|
|
140
|
+
className
|
|
141
|
+
)
|
|
142
|
+
}, props)
|
|
143
|
+
) });
|
|
144
|
+
});
|
|
145
|
+
CommandInput.displayName = import_cmdk.Command.Input.displayName;
|
|
146
|
+
var CommandList = React.forwardRef((_a, ref) => {
|
|
147
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
149
|
+
import_cmdk.Command.List,
|
|
150
|
+
__spreadValues({
|
|
151
|
+
ref,
|
|
152
|
+
className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden pb-2", className)
|
|
153
|
+
}, props)
|
|
154
|
+
);
|
|
155
|
+
});
|
|
156
|
+
CommandList.displayName = import_cmdk.Command.List.displayName;
|
|
157
|
+
var CommandEmpty = React.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_cmdk.Command.Empty, __spreadValues({ ref, className: "py-6 text-center text-sm" }, props)));
|
|
158
|
+
CommandEmpty.displayName = import_cmdk.Command.Empty.displayName;
|
|
159
|
+
var CommandGroup = React.forwardRef((_a, ref) => {
|
|
160
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
162
|
+
import_cmdk.Command.Group,
|
|
163
|
+
__spreadValues({
|
|
164
|
+
ref,
|
|
165
|
+
className: cn(
|
|
166
|
+
"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",
|
|
167
|
+
className
|
|
168
|
+
)
|
|
169
|
+
}, props)
|
|
170
|
+
);
|
|
171
|
+
});
|
|
172
|
+
CommandGroup.displayName = import_cmdk.Command.Group.displayName;
|
|
173
|
+
var CommandSeparator = React.forwardRef((_a, ref) => {
|
|
174
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
176
|
+
import_cmdk.Command.Separator,
|
|
177
|
+
__spreadValues({
|
|
178
|
+
ref,
|
|
179
|
+
className: cn("-mx-1 h-px bg-border", className)
|
|
180
|
+
}, props)
|
|
181
|
+
);
|
|
182
|
+
});
|
|
183
|
+
CommandSeparator.displayName = import_cmdk.Command.Separator.displayName;
|
|
184
|
+
var CommandItem = React.forwardRef((_a, ref) => {
|
|
185
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
187
|
+
import_cmdk.Command.Item,
|
|
188
|
+
__spreadValues({
|
|
189
|
+
ref,
|
|
190
|
+
className: cn(
|
|
191
|
+
"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",
|
|
192
|
+
className
|
|
193
|
+
)
|
|
194
|
+
}, props)
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
CommandItem.displayName = import_cmdk.Command.Item.displayName;
|
|
198
|
+
var CommandShortcut = (_a) => {
|
|
199
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
201
|
+
"span",
|
|
202
|
+
__spreadValues({
|
|
203
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className)
|
|
204
|
+
}, props)
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
CommandShortcut.displayName = "CommandShortcut";
|
|
208
|
+
|
|
209
|
+
// src/components/source-search-box/source-search-box.tsx
|
|
210
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
211
|
+
function SourceSearchBox(props) {
|
|
212
|
+
const [selectedValue, setSelectedValue] = (0, import_react2.useState)("");
|
|
213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
214
|
+
Command,
|
|
215
|
+
{
|
|
216
|
+
className: "rounded-lg border shadow-md",
|
|
217
|
+
value: selectedValue,
|
|
218
|
+
onValueChange: (value) => {
|
|
219
|
+
setSelectedValue(value);
|
|
220
|
+
},
|
|
221
|
+
filter: (value, search) => {
|
|
222
|
+
if (props.searchTerm === "")
|
|
223
|
+
return 1;
|
|
224
|
+
if (value.startsWith(props.searchTerm))
|
|
225
|
+
return 1;
|
|
226
|
+
return 0;
|
|
227
|
+
},
|
|
228
|
+
children: [
|
|
229
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
230
|
+
CommandInput,
|
|
231
|
+
{
|
|
232
|
+
value: props.searchTerm,
|
|
233
|
+
className: "rounded-t-lg hidden",
|
|
234
|
+
placeholder: "Search for a command..."
|
|
235
|
+
}
|
|
236
|
+
),
|
|
237
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(CommandList, { children: [
|
|
238
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CommandEmpty, { children: "No results found." }),
|
|
239
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CommandGroup, { heading: "Available resources", children: props.suggestedFiles.map((filePointer) => {
|
|
240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
241
|
+
CommandItem,
|
|
242
|
+
{
|
|
243
|
+
value: filePointer.name,
|
|
244
|
+
onSelect: (value) => {
|
|
245
|
+
props.onSelectedFile(filePointer);
|
|
246
|
+
},
|
|
247
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: " px-3 flex flex-row gap-1 items-center", children: [
|
|
248
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Logo, { width: "20px", height: "20px", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
249
|
+
"img",
|
|
250
|
+
{
|
|
251
|
+
src: filePointer.iconImageUri,
|
|
252
|
+
alt: filePointer.sourceApplication,
|
|
253
|
+
className: "w-full h-full"
|
|
254
|
+
}
|
|
255
|
+
) }),
|
|
256
|
+
filePointer.name
|
|
257
|
+
] })
|
|
258
|
+
},
|
|
259
|
+
`word-${filePointer.sourceApplication}.${filePointer.name}`
|
|
260
|
+
);
|
|
261
|
+
}) }),
|
|
262
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CommandSeparator, {})
|
|
263
|
+
] })
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
function Logo({
|
|
269
|
+
children,
|
|
270
|
+
width,
|
|
271
|
+
height
|
|
272
|
+
}) {
|
|
273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex items-center justify-center", style: { width, height }, children });
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
277
|
+
var import_react_core = require("@copilotkit/react-core");
|
|
278
|
+
|
|
279
|
+
// src/components/ui/button.tsx
|
|
280
|
+
var React2 = __toESM(require("react"));
|
|
281
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
282
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
283
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
284
|
+
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
285
|
+
"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",
|
|
286
|
+
{
|
|
287
|
+
variants: {
|
|
288
|
+
variant: {
|
|
289
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
290
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
291
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
292
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
293
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
294
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
295
|
+
},
|
|
296
|
+
size: {
|
|
297
|
+
default: "h-10 px-4 py-2",
|
|
298
|
+
sm: "h-9 rounded-md px-3",
|
|
299
|
+
lg: "h-11 rounded-md px-8",
|
|
300
|
+
icon: "h-10 w-10"
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
defaultVariants: {
|
|
304
|
+
variant: "default",
|
|
305
|
+
size: "default"
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
);
|
|
309
|
+
var Button = React2.forwardRef(
|
|
310
|
+
(_a, ref) => {
|
|
311
|
+
var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest(_b, ["className", "variant", "size", "asChild"]);
|
|
312
|
+
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Comp, __spreadValues({ className: cn(buttonVariants({ variant, size, className })), ref }, props));
|
|
314
|
+
}
|
|
315
|
+
);
|
|
316
|
+
Button.displayName = "Button";
|
|
317
|
+
|
|
318
|
+
// src/components/ui/label.tsx
|
|
319
|
+
var React3 = __toESM(require("react"));
|
|
320
|
+
var LabelPrimitive = __toESM(require("@radix-ui/react-label"));
|
|
321
|
+
var import_class_variance_authority2 = require("class-variance-authority");
|
|
322
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
323
|
+
var labelVariants = (0, import_class_variance_authority2.cva)(
|
|
324
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
325
|
+
);
|
|
326
|
+
var Label = React3.forwardRef((_a, ref) => {
|
|
327
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LabelPrimitive.Root, __spreadValues({ ref, className: cn(labelVariants(), className) }, props));
|
|
329
|
+
});
|
|
330
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
331
|
+
|
|
332
|
+
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
333
|
+
var import_react4 = require("react");
|
|
334
|
+
|
|
335
|
+
// src/lib/stream-promise-flatten.ts
|
|
336
|
+
function streamPromiseFlatten(promise) {
|
|
337
|
+
return new ReadableStream({
|
|
338
|
+
start(controller) {
|
|
339
|
+
return __async(this, null, function* () {
|
|
340
|
+
try {
|
|
341
|
+
const stream = yield promise;
|
|
342
|
+
const reader = stream.getReader();
|
|
343
|
+
while (true) {
|
|
344
|
+
const { done, value } = yield reader.read();
|
|
345
|
+
if (done) {
|
|
346
|
+
controller.close();
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
controller.enqueue(value);
|
|
350
|
+
}
|
|
351
|
+
} catch (error) {
|
|
352
|
+
controller.error(error);
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx
|
|
360
|
+
var import_Chip = __toESM(require("@mui/material/Chip/Chip.js"));
|
|
361
|
+
var import_Avatar = __toESM(require("@mui/material/Avatar/Avatar.js"));
|
|
362
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
363
|
+
var IncludedFilesPreview = ({
|
|
364
|
+
includedFiles,
|
|
365
|
+
setIncludedFiles
|
|
366
|
+
}) => {
|
|
367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col gap-2 mt-2", children: [
|
|
368
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Label, { className: "", children: "Included context:" }),
|
|
369
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex flex-wrap gap-2", children: includedFiles.map((filePointer, index) => {
|
|
370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
371
|
+
FileChipPreview,
|
|
372
|
+
{
|
|
373
|
+
filePointer,
|
|
374
|
+
onDelete: () => {
|
|
375
|
+
setIncludedFiles((prev) => prev.filter((fp) => fp !== filePointer));
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
`file-${filePointer.sourceApplication}.${filePointer.name}`
|
|
379
|
+
);
|
|
380
|
+
}) })
|
|
381
|
+
] });
|
|
382
|
+
};
|
|
383
|
+
var FileChipPreview = ({ filePointer, onDelete }) => {
|
|
384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
385
|
+
import_Chip.default,
|
|
386
|
+
{
|
|
387
|
+
label: filePointer.name,
|
|
388
|
+
onDelete,
|
|
389
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
390
|
+
import_Avatar.default,
|
|
391
|
+
{
|
|
392
|
+
src: filePointer.iconImageUri,
|
|
393
|
+
alt: filePointer.sourceApplication,
|
|
394
|
+
sx: { backgroundColor: "transparent" }
|
|
395
|
+
}
|
|
396
|
+
)
|
|
397
|
+
}
|
|
398
|
+
);
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
// src/components/hovering-toolbar/hovering-editor-provider.tsx
|
|
402
|
+
var import_react3 = require("react");
|
|
403
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
404
|
+
var HoveringEditorContext = (0, import_react3.createContext)({
|
|
405
|
+
isDisplayed: false,
|
|
406
|
+
setIsDisplayed: () => {
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
var useHoveringEditorContext = () => (0, import_react3.useContext)(HoveringEditorContext);
|
|
410
|
+
|
|
411
|
+
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
412
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
413
|
+
var HoveringInsertionPromptBoxCore = ({
|
|
414
|
+
performInsertion,
|
|
415
|
+
state,
|
|
416
|
+
insertionOrEditingFunction,
|
|
417
|
+
contextCategories
|
|
418
|
+
}) => {
|
|
419
|
+
const { getDocumentsContext } = (0, import_react_core.useCopilotContext)();
|
|
420
|
+
const [editSuggestion, setEditSuggestion] = (0, import_react4.useState)("");
|
|
421
|
+
const [suggestionIsLoading, setSuggestionIsLoading] = (0, import_react4.useState)(false);
|
|
422
|
+
const [adjustmentPrompt, setAdjustmentPrompt] = (0, import_react4.useState)("");
|
|
423
|
+
const [generatingSuggestion, setGeneratingSuggestion] = (0, import_react4.useState)(
|
|
424
|
+
null
|
|
425
|
+
);
|
|
426
|
+
const adjustmentTextAreaRef = (0, import_react4.useRef)(null);
|
|
427
|
+
const suggestionTextAreaRef = (0, import_react4.useRef)(null);
|
|
428
|
+
const [filePointers, setFilePointers] = (0, import_react4.useState)([]);
|
|
429
|
+
const [suggestedFiles, setSuggestedFiles] = (0, import_react4.useState)([]);
|
|
430
|
+
(0, import_react4.useEffect)(() => {
|
|
431
|
+
setSuggestedFiles(getDocumentsContext(contextCategories));
|
|
432
|
+
}, [contextCategories, getDocumentsContext]);
|
|
433
|
+
use_autosize_textarea_default(suggestionTextAreaRef, editSuggestion || "");
|
|
434
|
+
use_autosize_textarea_default(adjustmentTextAreaRef, adjustmentPrompt || "");
|
|
435
|
+
(0, import_react4.useEffect)(() => {
|
|
436
|
+
var _a;
|
|
437
|
+
(_a = adjustmentTextAreaRef.current) == null ? void 0 : _a.focus();
|
|
438
|
+
}, []);
|
|
439
|
+
(0, import_react4.useEffect)(() => {
|
|
440
|
+
if (!generatingSuggestion) {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
if (generatingSuggestion.locked) {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
setEditSuggestion("");
|
|
447
|
+
const reader = generatingSuggestion.getReader();
|
|
448
|
+
const read = () => __async(void 0, null, function* () {
|
|
449
|
+
setSuggestionIsLoading(true);
|
|
450
|
+
while (true) {
|
|
451
|
+
const { done, value } = yield reader.read();
|
|
452
|
+
if (done) {
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
setEditSuggestion((prev) => {
|
|
456
|
+
const newSuggestion = prev + value;
|
|
457
|
+
if (suggestionTextAreaRef.current) {
|
|
458
|
+
suggestionTextAreaRef.current.scrollTop = suggestionTextAreaRef.current.scrollHeight;
|
|
459
|
+
}
|
|
460
|
+
return newSuggestion;
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
setSuggestionIsLoading(false);
|
|
464
|
+
});
|
|
465
|
+
read();
|
|
466
|
+
return () => {
|
|
467
|
+
const releaseLockIfNotClosed = () => __async(void 0, null, function* () {
|
|
468
|
+
try {
|
|
469
|
+
yield reader.closed;
|
|
470
|
+
} catch (e) {
|
|
471
|
+
reader.releaseLock();
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
releaseLockIfNotClosed();
|
|
475
|
+
};
|
|
476
|
+
}, [generatingSuggestion]);
|
|
477
|
+
const beginGeneratingAdjustment = (0, import_react4.useCallback)(() => __async(void 0, null, function* () {
|
|
478
|
+
if (!adjustmentPrompt.trim()) {
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
let modificationState = state.editorState;
|
|
482
|
+
if (editSuggestion !== "") {
|
|
483
|
+
modificationState.selectedText = editSuggestion;
|
|
484
|
+
}
|
|
485
|
+
const adjustmentSuggestionTextStreamPromise = insertionOrEditingFunction(
|
|
486
|
+
modificationState,
|
|
487
|
+
adjustmentPrompt,
|
|
488
|
+
filePointers,
|
|
489
|
+
new AbortController().signal
|
|
490
|
+
);
|
|
491
|
+
const adjustmentSuggestionTextStream = streamPromiseFlatten(
|
|
492
|
+
adjustmentSuggestionTextStreamPromise
|
|
493
|
+
);
|
|
494
|
+
setGeneratingSuggestion(adjustmentSuggestionTextStream);
|
|
495
|
+
}), [
|
|
496
|
+
adjustmentPrompt,
|
|
497
|
+
editSuggestion,
|
|
498
|
+
state.editorState,
|
|
499
|
+
insertionOrEditingFunction,
|
|
500
|
+
filePointers
|
|
501
|
+
]);
|
|
502
|
+
const isLoading = suggestionIsLoading;
|
|
503
|
+
const textToEdit = editSuggestion || state.editorState.selectedText;
|
|
504
|
+
const adjustmentLabel = textToEdit === "" ? "Describe the text you want to insert" : "Describe adjustments to the suggested text";
|
|
505
|
+
const placeholder = textToEdit === "" ? "e.g. 'summarize the client's top 3 pain-points from @CallTranscript'" : "e.g. 'make it more formal', 'be more specific', ...";
|
|
506
|
+
const { setIsDisplayed } = useHoveringEditorContext();
|
|
507
|
+
const AdjustmentPromptComponent = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
508
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Label, { className: "", children: adjustmentLabel }),
|
|
509
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative w-full flex items-center", children: [
|
|
510
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
511
|
+
"textarea",
|
|
512
|
+
{
|
|
513
|
+
"data-testid": "adjustment-prompt",
|
|
514
|
+
disabled: suggestionIsLoading,
|
|
515
|
+
ref: adjustmentTextAreaRef,
|
|
516
|
+
value: adjustmentPrompt,
|
|
517
|
+
onChange: (e) => setAdjustmentPrompt(e.target.value),
|
|
518
|
+
onKeyDown: (e) => {
|
|
519
|
+
if (e.key === "Enter" && e.shiftKey) {
|
|
520
|
+
e.preventDefault();
|
|
521
|
+
setAdjustmentPrompt(adjustmentPrompt + "\n");
|
|
522
|
+
} else if (e.key === "Enter") {
|
|
523
|
+
e.preventDefault();
|
|
524
|
+
beginGeneratingAdjustment();
|
|
525
|
+
} else if (e.key == "Escape") {
|
|
526
|
+
e.preventDefault();
|
|
527
|
+
setIsDisplayed(false);
|
|
528
|
+
}
|
|
529
|
+
},
|
|
530
|
+
placeholder,
|
|
531
|
+
style: { minHeight: "3rem" },
|
|
532
|
+
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]",
|
|
533
|
+
rows: 1
|
|
534
|
+
}
|
|
535
|
+
),
|
|
536
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
537
|
+
"button",
|
|
538
|
+
{
|
|
539
|
+
onClick: beginGeneratingAdjustment,
|
|
540
|
+
className: "absolute right-2 bg-blue-500 text-white w-8 h-8 rounded-full flex items-center justify-center",
|
|
541
|
+
"data-testid": "generate-button",
|
|
542
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("i", { className: "material-icons", children: "arrow_forward" })
|
|
543
|
+
}
|
|
544
|
+
)
|
|
545
|
+
] })
|
|
546
|
+
] });
|
|
547
|
+
const SuggestionComponent = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
548
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex justify-between items-end w-full", children: [
|
|
549
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Label, { className: "mt-4", children: "Suggested:" }),
|
|
550
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "ml-auto", children: isLoading && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
551
|
+
"div",
|
|
552
|
+
{
|
|
553
|
+
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]",
|
|
554
|
+
role: "status",
|
|
555
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.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..." })
|
|
556
|
+
}
|
|
557
|
+
) }) })
|
|
558
|
+
] }),
|
|
559
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
560
|
+
"textarea",
|
|
561
|
+
{
|
|
562
|
+
"data-testid": "suggestion-result",
|
|
563
|
+
ref: suggestionTextAreaRef,
|
|
564
|
+
value: editSuggestion,
|
|
565
|
+
disabled: suggestionIsLoading,
|
|
566
|
+
onChange: (e) => setEditSuggestion(e.target.value),
|
|
567
|
+
className: "w-full text-base p-2 border border-gray-300 rounded-md resize-none bg-green-50",
|
|
568
|
+
style: { overflow: "auto", maxHeight: "10em" }
|
|
569
|
+
}
|
|
570
|
+
)
|
|
571
|
+
] });
|
|
572
|
+
const SubmitComponent = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex w-full gap-4 justify-start", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
573
|
+
Button,
|
|
574
|
+
{
|
|
575
|
+
"data-testid": "insert-button",
|
|
576
|
+
className: " bg-green-700 text-white",
|
|
577
|
+
onClick: () => {
|
|
578
|
+
performInsertion(editSuggestion);
|
|
579
|
+
},
|
|
580
|
+
children: [
|
|
581
|
+
"Insert ",
|
|
582
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("i", { className: "material-icons", children: "check" })
|
|
583
|
+
]
|
|
584
|
+
}
|
|
585
|
+
) });
|
|
586
|
+
const sourceSearchCandidate = adjustmentPrompt.split(" ").pop();
|
|
587
|
+
const sourceSearchWord = (sourceSearchCandidate == null ? void 0 : sourceSearchCandidate.startsWith("@")) ? sourceSearchCandidate.slice(1) : void 0;
|
|
588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w-full flex flex-col items-start relative gap-2", children: [
|
|
589
|
+
AdjustmentPromptComponent,
|
|
590
|
+
filePointers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IncludedFilesPreview, { includedFiles: filePointers, setIncludedFiles: setFilePointers }),
|
|
591
|
+
sourceSearchWord !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
592
|
+
SourceSearchBox,
|
|
593
|
+
{
|
|
594
|
+
searchTerm: sourceSearchWord,
|
|
595
|
+
suggestedFiles,
|
|
596
|
+
onSelectedFile: (filePointer) => {
|
|
597
|
+
var _a;
|
|
598
|
+
setAdjustmentPrompt(adjustmentPrompt.replace(new RegExp(`@${sourceSearchWord}$`), ""));
|
|
599
|
+
setFilePointers((prev) => [...prev, filePointer]);
|
|
600
|
+
(_a = adjustmentTextAreaRef.current) == null ? void 0 : _a.focus();
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
),
|
|
604
|
+
generatingSuggestion ? SuggestionComponent : null,
|
|
605
|
+
generatingSuggestion ? SubmitComponent : null
|
|
606
|
+
] });
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx
|
|
610
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
611
|
+
var HoveringInsertionPromptBox = (props) => {
|
|
612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
613
|
+
"div",
|
|
614
|
+
{
|
|
615
|
+
className: "flex flex-col justify-center items-center space-y-4 rounded-md border shadow-lg p-4 border-gray- bg-white",
|
|
616
|
+
style: { width: "35rem" },
|
|
617
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
618
|
+
HoveringInsertionPromptBoxCore,
|
|
619
|
+
{
|
|
620
|
+
state: {
|
|
621
|
+
editorState: props.editorState
|
|
622
|
+
},
|
|
623
|
+
insertionOrEditingFunction: props.apiConfig.insertionOrEditingFunction,
|
|
624
|
+
performInsertion: props.performInsertion,
|
|
625
|
+
contextCategories: props.contextCategories
|
|
626
|
+
}
|
|
627
|
+
)
|
|
628
|
+
}
|
|
629
|
+
);
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
// src/components/hovering-toolbar/hovering-toolbar-components.tsx
|
|
633
|
+
var import_css = require("@emotion/css");
|
|
634
|
+
var import_react5 = __toESM(require("react"));
|
|
635
|
+
var import_react_dom = __toESM(require("react-dom"));
|
|
636
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
637
|
+
var Button2 = import_react5.default.forwardRef(
|
|
638
|
+
(_a, ref) => {
|
|
639
|
+
var _b = _a, {
|
|
640
|
+
className,
|
|
641
|
+
active,
|
|
642
|
+
reversed
|
|
643
|
+
} = _b, props = __objRest(_b, [
|
|
644
|
+
"className",
|
|
645
|
+
"active",
|
|
646
|
+
"reversed"
|
|
647
|
+
]);
|
|
648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
649
|
+
"span",
|
|
650
|
+
__spreadProps(__spreadValues({}, props), {
|
|
651
|
+
ref,
|
|
652
|
+
className: (0, import_css.cx)(
|
|
653
|
+
className,
|
|
654
|
+
import_css.css`
|
|
655
|
+
cursor: pointer;
|
|
656
|
+
color: ${reversed ? active ? "white" : "#aaa" : active ? "black" : "#ccc"};
|
|
657
|
+
`
|
|
658
|
+
)
|
|
659
|
+
})
|
|
660
|
+
);
|
|
661
|
+
}
|
|
662
|
+
);
|
|
663
|
+
var Icon = import_react5.default.forwardRef(
|
|
664
|
+
(_a, ref) => {
|
|
665
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
667
|
+
"span",
|
|
668
|
+
__spreadProps(__spreadValues({}, props), {
|
|
669
|
+
ref,
|
|
670
|
+
className: (0, import_css.cx)(
|
|
671
|
+
"material-icons",
|
|
672
|
+
className,
|
|
673
|
+
import_css.css`
|
|
674
|
+
font-size: 18px;
|
|
675
|
+
vertical-align: text-bottom;
|
|
676
|
+
`
|
|
677
|
+
)
|
|
678
|
+
})
|
|
679
|
+
);
|
|
680
|
+
}
|
|
681
|
+
);
|
|
682
|
+
var Menu = import_react5.default.forwardRef(
|
|
683
|
+
(_a, ref) => {
|
|
684
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
686
|
+
"div",
|
|
687
|
+
__spreadProps(__spreadValues({}, props), {
|
|
688
|
+
"data-testid": "menu",
|
|
689
|
+
ref,
|
|
690
|
+
className: (0, import_css.cx)(
|
|
691
|
+
className,
|
|
692
|
+
import_css.css`
|
|
693
|
+
& > * {
|
|
694
|
+
display: inline-block;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
& > * + * {
|
|
698
|
+
margin-left: 15px;
|
|
699
|
+
}
|
|
700
|
+
`
|
|
701
|
+
)
|
|
702
|
+
})
|
|
703
|
+
);
|
|
704
|
+
}
|
|
705
|
+
);
|
|
706
|
+
var Portal = ({ children }) => {
|
|
707
|
+
return typeof document === "object" ? import_react_dom.default.createPortal(children, document.body) : null;
|
|
708
|
+
};
|
|
709
|
+
var Toolbar = import_react5.default.forwardRef(
|
|
710
|
+
(_a, ref) => {
|
|
711
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
713
|
+
Menu,
|
|
714
|
+
__spreadProps(__spreadValues({}, props), {
|
|
715
|
+
ref,
|
|
716
|
+
className: (0, import_css.cx)(
|
|
717
|
+
className,
|
|
718
|
+
import_css.css`
|
|
719
|
+
position: relative;
|
|
720
|
+
padding: 1px 18px 17px;
|
|
721
|
+
margin: 0 -20px;
|
|
722
|
+
border-bottom: 2px solid #eee;
|
|
723
|
+
margin-bottom: 20px;
|
|
724
|
+
`
|
|
725
|
+
)
|
|
726
|
+
})
|
|
727
|
+
);
|
|
728
|
+
}
|
|
729
|
+
);
|
|
730
|
+
|
|
731
|
+
// src/lib/get-text-around-cursor.ts
|
|
732
|
+
var import_slate = require("slate");
|
|
733
|
+
function getTextAroundSelection(editor) {
|
|
734
|
+
const { selection } = editor;
|
|
735
|
+
if (!selection) {
|
|
736
|
+
return null;
|
|
737
|
+
}
|
|
738
|
+
const wellOrderedSelection = wellOrderedRange(selection);
|
|
739
|
+
const beforeRange = {
|
|
740
|
+
anchor: import_slate.Editor.start(editor, []),
|
|
741
|
+
focus: wellOrderedSelection.anchor
|
|
742
|
+
};
|
|
743
|
+
const afterRange = {
|
|
744
|
+
anchor: wellOrderedSelection.focus,
|
|
745
|
+
focus: import_slate.Editor.end(editor, [])
|
|
746
|
+
};
|
|
747
|
+
const before = extractTextWithNewlines(editor, beforeRange);
|
|
748
|
+
const after = extractTextWithNewlines(editor, afterRange);
|
|
749
|
+
const selectedText = extractTextWithNewlines(editor, wellOrderedSelection);
|
|
750
|
+
return {
|
|
751
|
+
selection: wellOrderedSelection,
|
|
752
|
+
textBeforeCursor: before,
|
|
753
|
+
selectedText,
|
|
754
|
+
textAfterCursor: after
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
function getFullEditorTextWithNewlines(editor) {
|
|
758
|
+
const fullDocumentRange = {
|
|
759
|
+
anchor: import_slate.Editor.start(editor, []),
|
|
760
|
+
focus: import_slate.Editor.end(editor, [])
|
|
761
|
+
};
|
|
762
|
+
return extractTextWithNewlines(editor, fullDocumentRange);
|
|
763
|
+
}
|
|
764
|
+
function extractTextWithNewlines(editor, range) {
|
|
765
|
+
const voids = false;
|
|
766
|
+
const [start, end] = import_slate.Range.edges(range);
|
|
767
|
+
let text = "";
|
|
768
|
+
let lastBlock = null;
|
|
769
|
+
for (const [node, path] of import_slate.Editor.nodes(editor, {
|
|
770
|
+
at: range,
|
|
771
|
+
match: import_slate.Text.isText,
|
|
772
|
+
voids
|
|
773
|
+
})) {
|
|
774
|
+
let t = node.text;
|
|
775
|
+
const [block] = import_slate.Editor.above(editor, {
|
|
776
|
+
at: path,
|
|
777
|
+
match: (n) => import_slate.Element.isElement(n) && n.type === "paragraph"
|
|
778
|
+
}) || [null];
|
|
779
|
+
if (lastBlock !== block && block) {
|
|
780
|
+
if (lastBlock) {
|
|
781
|
+
text += "\n";
|
|
782
|
+
}
|
|
783
|
+
lastBlock = block;
|
|
784
|
+
}
|
|
785
|
+
if (import_slate.Path.equals(path, end.path)) {
|
|
786
|
+
t = t.slice(0, end.offset);
|
|
787
|
+
}
|
|
788
|
+
if (import_slate.Path.equals(path, start.path)) {
|
|
789
|
+
t = t.slice(start.offset);
|
|
790
|
+
}
|
|
791
|
+
text += t;
|
|
792
|
+
}
|
|
793
|
+
return text;
|
|
794
|
+
}
|
|
795
|
+
function wellOrderedRange(range) {
|
|
796
|
+
const { anchor, focus } = range;
|
|
797
|
+
if (import_slate.Point.isBefore(anchor, focus)) {
|
|
798
|
+
return range;
|
|
799
|
+
}
|
|
800
|
+
return {
|
|
801
|
+
anchor: focus,
|
|
802
|
+
focus: anchor
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
// src/components/hovering-toolbar/hovering-toolbar.tsx
|
|
807
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
808
|
+
var HoveringToolbar = (props) => {
|
|
809
|
+
const ref = (0, import_react6.useRef)(null);
|
|
810
|
+
const editor = (0, import_slate_react.useSlate)();
|
|
811
|
+
const selection = (0, import_slate_react.useSlateSelection)();
|
|
812
|
+
const { isDisplayed, setIsDisplayed } = useHoveringEditorContext();
|
|
813
|
+
const [isClient, setIsClient] = (0, import_react6.useState)(false);
|
|
814
|
+
(0, import_react6.useEffect)(() => {
|
|
815
|
+
setIsClient(true);
|
|
816
|
+
}, []);
|
|
817
|
+
(0, import_react6.useEffect)(() => {
|
|
818
|
+
const el = ref.current;
|
|
819
|
+
const { selection: selection2 } = editor;
|
|
820
|
+
if (!el) {
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
if (!selection2) {
|
|
824
|
+
el.removeAttribute("style");
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
827
|
+
const domSelection = window.getSelection();
|
|
828
|
+
if (!domSelection || domSelection.rangeCount === 0) {
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
const domRange = domSelection.getRangeAt(0);
|
|
832
|
+
const rect = domRange.getBoundingClientRect();
|
|
833
|
+
if (rect.top === 0 && rect.left === 0 && rect.width === 0 && rect.height === 0) {
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
836
|
+
const minGapFromEdge = 60;
|
|
837
|
+
const verticalOffsetFromCorner = 35;
|
|
838
|
+
const horizontalOffsetFromCorner = 15;
|
|
839
|
+
let top = rect.top + window.scrollY - el.offsetHeight + verticalOffsetFromCorner;
|
|
840
|
+
if (top < minGapFromEdge) {
|
|
841
|
+
top = rect.bottom + window.scrollY + minGapFromEdge;
|
|
842
|
+
} else if (top + el.offsetHeight > window.innerHeight - minGapFromEdge) {
|
|
843
|
+
top = rect.top + window.scrollY - el.offsetHeight - minGapFromEdge;
|
|
844
|
+
}
|
|
845
|
+
let left = rect.left + window.scrollX - el.offsetWidth / 2 + rect.width / 2 + horizontalOffsetFromCorner;
|
|
846
|
+
if (left < minGapFromEdge) {
|
|
847
|
+
left = minGapFromEdge;
|
|
848
|
+
} else if (left + el.offsetWidth > window.innerWidth - minGapFromEdge) {
|
|
849
|
+
left = window.innerWidth - el.offsetWidth - minGapFromEdge;
|
|
850
|
+
}
|
|
851
|
+
el.style.opacity = "1";
|
|
852
|
+
el.style.position = "absolute";
|
|
853
|
+
el.style.top = `${top}px`;
|
|
854
|
+
el.style.left = `${left}px`;
|
|
855
|
+
});
|
|
856
|
+
(0, import_react6.useEffect)(() => {
|
|
857
|
+
const handleClickOutside = (event) => {
|
|
858
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
859
|
+
setIsDisplayed(false);
|
|
860
|
+
}
|
|
861
|
+
};
|
|
862
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
863
|
+
return () => {
|
|
864
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
865
|
+
};
|
|
866
|
+
}, [ref, setIsDisplayed]);
|
|
867
|
+
if (!isClient) {
|
|
868
|
+
return null;
|
|
869
|
+
}
|
|
870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
871
|
+
Menu,
|
|
872
|
+
{
|
|
873
|
+
ref,
|
|
874
|
+
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"),
|
|
875
|
+
"data-testid": "hovering-toolbar",
|
|
876
|
+
children: isDisplayed && selection && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
877
|
+
HoveringInsertionPromptBox,
|
|
878
|
+
{
|
|
879
|
+
editorState: editorState(editor, selection),
|
|
880
|
+
apiConfig: props.apiConfig,
|
|
881
|
+
closeWindow: () => {
|
|
882
|
+
setIsDisplayed(false);
|
|
883
|
+
},
|
|
884
|
+
performInsertion: (insertedText) => {
|
|
885
|
+
import_slate2.Transforms.delete(editor, { at: selection });
|
|
886
|
+
import_slate2.Transforms.insertText(editor, insertedText, {
|
|
887
|
+
at: selection
|
|
888
|
+
});
|
|
889
|
+
setIsDisplayed(false);
|
|
890
|
+
},
|
|
891
|
+
contextCategories: props.contextCategories
|
|
892
|
+
}
|
|
893
|
+
)
|
|
894
|
+
}
|
|
895
|
+
) });
|
|
896
|
+
};
|
|
897
|
+
function editorState(editor, selection) {
|
|
898
|
+
const textAroundCursor = getTextAroundSelection(editor);
|
|
899
|
+
if (textAroundCursor) {
|
|
900
|
+
return textAroundCursor;
|
|
901
|
+
}
|
|
902
|
+
return {
|
|
903
|
+
textBeforeCursor: getFullEditorTextWithNewlines(editor),
|
|
904
|
+
textAfterCursor: "",
|
|
905
|
+
selectedText: ""
|
|
906
|
+
};
|
|
907
|
+
}
|
|
908
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
909
|
+
0 && (module.exports = {
|
|
910
|
+
HoveringToolbar
|
|
911
|
+
});
|
|
912
|
+
//# sourceMappingURL=hovering-toolbar.js.map
|