@copilotkit/react-textarea 0.0.0-0.0.0-max-changeset-10101010101010-20260109191632
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 +4665 -0
- package/LICENSE +21 -0
- package/README.md +141 -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-2IWVZ4PP.mjs +103 -0
- package/dist/chunk-2IWVZ4PP.mjs.map +1 -0
- package/dist/chunk-2QDCE7PD.mjs +32 -0
- package/dist/chunk-2QDCE7PD.mjs.map +1 -0
- package/dist/chunk-3QJOFG3V.mjs +25 -0
- package/dist/chunk-3QJOFG3V.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-5GYFXESG.mjs +31 -0
- package/dist/chunk-5GYFXESG.mjs.map +1 -0
- package/dist/chunk-5UNJXFUO.mjs +29 -0
- package/dist/chunk-5UNJXFUO.mjs.map +1 -0
- package/dist/chunk-63LEUA5A.mjs +269 -0
- package/dist/chunk-63LEUA5A.mjs.map +1 -0
- package/dist/chunk-65XYKSXZ.mjs +226 -0
- package/dist/chunk-65XYKSXZ.mjs.map +1 -0
- package/dist/chunk-6SGWO63I.mjs +32 -0
- package/dist/chunk-6SGWO63I.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-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-DL3JWL2E.mjs +170 -0
- package/dist/chunk-DL3JWL2E.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-F2ULK22F.mjs +39 -0
- package/dist/chunk-F2ULK22F.mjs.map +1 -0
- package/dist/chunk-F6RLSVG3.mjs +30 -0
- package/dist/chunk-F6RLSVG3.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-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-JLOABKLH.mjs +49 -0
- package/dist/chunk-JLOABKLH.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-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-NAFNY4FL.mjs +17 -0
- package/dist/chunk-NAFNY4FL.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-T4HVUB4T.mjs +60 -0
- package/dist/chunk-T4HVUB4T.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-X2QR2YGZ.mjs +120 -0
- package/dist/chunk-X2QR2YGZ.mjs.map +1 -0
- package/dist/chunk-YLFAIYRY.mjs +50 -0
- package/dist/chunk-YLFAIYRY.mjs.map +1 -0
- package/dist/chunk-ZQSEYPNN.mjs +74 -0
- package/dist/chunk-ZQSEYPNN.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 +1781 -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 +7 -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 +7 -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 +2261 -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 +164 -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 +894 -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 +603 -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 +13 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +626 -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 +626 -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 +2265 -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 +137 -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 +230 -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 +643 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +2270 -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/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 +87 -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/jest.config.js +5 -0
- package/package.json +99 -0
- package/postcss.config.js +12 -0
- package/src/components/base-copilot-textarea/base-copilot-textarea.css +9 -0
- package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +323 -0
- package/src/components/base-copilot-textarea/render-element.tsx +40 -0
- package/src/components/base-copilot-textarea/render-placeholder.tsx +24 -0
- package/src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx +80 -0
- package/src/components/base-copilot-textarea/use-add-branding-css.tsx +74 -0
- package/src/components/copilot-textarea/copilot-textarea.tsx +210 -0
- package/src/components/hovering-toolbar/hovering-editor-provider.tsx +31 -0
- package/src/components/hovering-toolbar/hovering-toolbar-components.tsx +88 -0
- package/src/components/hovering-toolbar/hovering-toolbar.tsx +154 -0
- package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +273 -0
- package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx +30 -0
- package/src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx +55 -0
- package/src/components/hovering-toolbar/text-insertion-prompt-box/index.ts +2 -0
- package/src/components/index.ts +4 -0
- package/src/components/manual-ui/chip-with-icon.tsx +17 -0
- package/src/components/source-search-box/source-search-box.tsx +117 -0
- package/src/components/ui/button.tsx +49 -0
- package/src/components/ui/command.tsx +141 -0
- package/src/components/ui/dialog.tsx +107 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/context/index.ts +1 -0
- package/src/hooks/base-copilot-textarea-implementation/use-autosuggestions.ts +142 -0
- package/src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx +100 -0
- package/src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts +93 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +116 -0
- package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +215 -0
- package/src/hooks/misc/use-autosize-textarea.tsx +18 -0
- package/src/index.tsx +7 -0
- package/src/lib/debouncer.ts +36 -0
- package/src/lib/editor-to-text.ts +61 -0
- package/src/lib/get-text-around-cursor.ts +135 -0
- package/src/lib/retry.tsx +23 -0
- package/src/lib/slatejs-edits/add-autocompletions.ts +30 -0
- package/src/lib/slatejs-edits/clear-autocompletions.ts +19 -0
- package/src/lib/slatejs-edits/replace-text.ts +28 -0
- package/src/lib/slatejs-edits/with-partial-history.ts +149 -0
- package/src/lib/stream-promise-flatten.ts +33 -0
- package/src/lib/utils.test.ts +7 -0
- package/src/lib/utils.ts +49 -0
- package/src/styles.css +3 -0
- package/src/types/autosuggestions-config/autosuggestions-config-user-specified.tsx +19 -0
- package/src/types/autosuggestions-config/autosuggestions-config.tsx +30 -0
- package/src/types/autosuggestions-config/editing-api-config.tsx +96 -0
- package/src/types/autosuggestions-config/index.ts +8 -0
- package/src/types/autosuggestions-config/insertions-api-config.tsx +87 -0
- package/src/types/autosuggestions-config/subtypes/make-system-prompt.ts +1 -0
- package/src/types/autosuggestions-config/suggestions-api-config.tsx +76 -0
- package/src/types/base/autosuggestion-state.ts +6 -0
- package/src/types/base/autosuggestions-bare-function.ts +30 -0
- package/src/types/base/base-autosuggestions-config.tsx +128 -0
- package/src/types/base/base-copilot-textarea-props.tsx +58 -0
- package/src/types/base/custom-editor.tsx +29 -0
- package/src/types/base/editor-autocomplete-state.ts +20 -0
- package/src/types/base/index.ts +6 -0
- package/src/types/html-copilot-textarea-element.ts +5 -0
- package/src/types/index.ts +3 -0
- package/tailwind.config.js +9 -0
- package/tsconfig.json +12 -0
- package/tsup.config.ts +11 -0
- package/typedoc.json +4 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// src/types/autosuggestions-config/editing-api-config.tsx
|
|
2
|
+
import { Role, TextMessage } from "@copilotkit/runtime-client-gql";
|
|
3
|
+
var defaultEditingMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
4
|
+
return `You are a versatile writing assistant helping the user edit a portion of their text.
|
|
5
|
+
|
|
6
|
+
The user is writing some text.
|
|
7
|
+
The purpose is: "${textareaPurpose}"
|
|
8
|
+
|
|
9
|
+
The following external context is also provided. Use it when relevant.
|
|
10
|
+
\`\`\`
|
|
11
|
+
${contextString}
|
|
12
|
+
\`\`\`
|
|
13
|
+
|
|
14
|
+
The user has provided you with a PROMPT for EDITING a PORTION of the text.
|
|
15
|
+
Your job is to come up with a new EDITED version OF THE SEGMENT IN QUESTION - AS BEST YOU CAN.
|
|
16
|
+
Only rewrite the portion of the text that the user has marked as "TextToEdit"!!!
|
|
17
|
+
|
|
18
|
+
Adjust yourself to the user's style and implied intent.
|
|
19
|
+
|
|
20
|
+
The conversation will be structured as follows:
|
|
21
|
+
<TextBeforeCursor>
|
|
22
|
+
<TextToEdit>
|
|
23
|
+
<TextAfterCursor>
|
|
24
|
+
<EditingPrompt>
|
|
25
|
+
|
|
26
|
+
<YourEditSuggestion>
|
|
27
|
+
`;
|
|
28
|
+
};
|
|
29
|
+
var defaultEditingFewShotMessages = [
|
|
30
|
+
new TextMessage({
|
|
31
|
+
role: Role.User,
|
|
32
|
+
content: "<TextBeforeCursor>This morning I woke up and went straight to the grocery store. </TextBeforeCursor>"
|
|
33
|
+
}),
|
|
34
|
+
new TextMessage({
|
|
35
|
+
role: Role.User,
|
|
36
|
+
content: "<TextToEdit>While I was there I picked up some apples, oranges, and bananas. </TextToEdit>"
|
|
37
|
+
}),
|
|
38
|
+
new TextMessage({
|
|
39
|
+
role: Role.User,
|
|
40
|
+
content: "<TextAfterCursor>The grocery store was having a sale on fruit, so I decided to stock up.</TextAfterCursor>"
|
|
41
|
+
}),
|
|
42
|
+
new TextMessage({
|
|
43
|
+
role: Role.User,
|
|
44
|
+
content: "<EditingPrompt>I also bought a big watermelon</EditingPrompt>"
|
|
45
|
+
}),
|
|
46
|
+
new TextMessage({
|
|
47
|
+
role: Role.Assistant,
|
|
48
|
+
content: "While I was there I picked up some apples, oranges, and bananas, and a big watermelon."
|
|
49
|
+
}),
|
|
50
|
+
new TextMessage({
|
|
51
|
+
role: Role.User,
|
|
52
|
+
content: "<TextBeforeCursor>Yesterday, I spent the afternoon working on my new project.</TextBeforeCursor>"
|
|
53
|
+
}),
|
|
54
|
+
new TextMessage({
|
|
55
|
+
role: Role.User,
|
|
56
|
+
content: "<TextToEdit>It's quite challenging and requires a lot of focus.</TextToEdit>"
|
|
57
|
+
}),
|
|
58
|
+
new TextMessage({
|
|
59
|
+
role: Role.User,
|
|
60
|
+
content: "<TextAfterCursor>I'm really excited about the potential outcomes of this project.</TextAfterCursor>"
|
|
61
|
+
}),
|
|
62
|
+
new TextMessage({
|
|
63
|
+
role: Role.User,
|
|
64
|
+
content: "<EditingPrompt>emphasize the complexity and my enthusiasm for the project</EditingPrompt>"
|
|
65
|
+
}),
|
|
66
|
+
new TextMessage({
|
|
67
|
+
role: Role.Assistant,
|
|
68
|
+
content: "It's a highly complex task that demands intense concentration, but I'm incredibly enthusiastic about the promising prospects of this project."
|
|
69
|
+
})
|
|
70
|
+
];
|
|
71
|
+
var defaultEditingApiConfig = {
|
|
72
|
+
makeSystemPrompt: defaultEditingMakeSystemPrompt,
|
|
73
|
+
fewShotMessages: defaultEditingFewShotMessages,
|
|
74
|
+
forwardedParams: void 0
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export {
|
|
78
|
+
defaultEditingMakeSystemPrompt,
|
|
79
|
+
defaultEditingFewShotMessages,
|
|
80
|
+
defaultEditingApiConfig
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=chunk-EJGGLWWR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/autosuggestions-config/editing-api-config.tsx"],"sourcesContent":["import { Message, Role, TextMessage } from \"@copilotkit/runtime-client-gql\";\nimport { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\n\nexport interface EditingApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: Message[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultEditingMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString,\n) => {\n return `You are a versatile writing assistant helping the user edit a portion of their text.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nThe following external context is also provided. Use it when relevant.\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThe user has provided you with a PROMPT for EDITING a PORTION of the text. \nYour job is to come up with a new EDITED version OF THE SEGMENT IN QUESTION - AS BEST YOU CAN.\nOnly rewrite the portion of the text that the user has marked as \"TextToEdit\"!!!\n\nAdjust yourself to the user's style and implied intent.\n\nThe conversation will be structured as follows:\n<TextBeforeCursor>\n<TextToEdit>\n<TextAfterCursor>\n<EditingPrompt>\n\n<YourEditSuggestion>\n`;\n};\n\nexport const defaultEditingFewShotMessages: Message[] = [\n new TextMessage({\n role: Role.User,\n content:\n \"<TextBeforeCursor>This morning I woke up and went straight to the grocery store. </TextBeforeCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextToEdit>While I was there I picked up some apples, oranges, and bananas. </TextToEdit>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>The grocery store was having a sale on fruit, so I decided to stock up.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content: \"<EditingPrompt>I also bought a big watermelon</EditingPrompt>\",\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n \"While I was there I picked up some apples, oranges, and bananas, and a big watermelon.\",\n }),\n\n new TextMessage({\n role: Role.User,\n content:\n \"<TextBeforeCursor>Yesterday, I spent the afternoon working on my new project.</TextBeforeCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content: \"<TextToEdit>It's quite challenging and requires a lot of focus.</TextToEdit>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>I'm really excited about the potential outcomes of this project.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<EditingPrompt>emphasize the complexity and my enthusiasm for the project</EditingPrompt>\",\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n \"It's a highly complex task that demands intense concentration, but I'm incredibly enthusiastic about the promising prospects of this project.\",\n }),\n];\n\nexport const defaultEditingApiConfig: EditingApiConfig = {\n makeSystemPrompt: defaultEditingMakeSystemPrompt,\n fewShotMessages: defaultEditingFewShotMessages,\n forwardedParams: undefined,\n};\n"],"mappings":";AAAA,SAAkB,MAAM,mBAAmB;AASpC,IAAM,iCAAmD,CAC9D,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW;AAAA;AAAA;AAAA;AAAA,EAIlB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBF;AAEO,IAAM,gCAA2C;AAAA,EACtD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SAAS;AAAA,EACX,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EAED,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SAAS;AAAA,EACX,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AACH;AAEO,IAAM,0BAA4C;AAAA,EACvD,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB;","names":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__spreadProps,
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "./chunk-MRXNTQOX.mjs";
|
|
5
|
+
|
|
6
|
+
// src/components/base-copilot-textarea/render-element.tsx
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
function makeRenderElementFunction(suggestionsStyle) {
|
|
9
|
+
return (props) => {
|
|
10
|
+
switch (props.element.type) {
|
|
11
|
+
case "paragraph":
|
|
12
|
+
return /* @__PURE__ */ jsx(DefaultElement, __spreadValues({}, props));
|
|
13
|
+
case "suggestion":
|
|
14
|
+
return /* @__PURE__ */ jsx(SuggestionElement, __spreadProps(__spreadValues({}, props), { suggestionsStyle }));
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
var DefaultElement = (props) => {
|
|
19
|
+
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({}, props.attributes), { children: props.children }));
|
|
20
|
+
};
|
|
21
|
+
var SuggestionElement = (props) => {
|
|
22
|
+
return /* @__PURE__ */ jsxs(
|
|
23
|
+
"span",
|
|
24
|
+
__spreadProps(__spreadValues({}, props.attributes), {
|
|
25
|
+
style: __spreadValues({}, props.suggestionsStyle),
|
|
26
|
+
"data-testid": "suggestion",
|
|
27
|
+
contentEditable: false,
|
|
28
|
+
children: [
|
|
29
|
+
props.children,
|
|
30
|
+
props.element.type === "suggestion" && props.element.content
|
|
31
|
+
]
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
makeRenderElementFunction
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=chunk-F2ULK22F.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/base-copilot-textarea/render-element.tsx"],"sourcesContent":["import { RenderElementProps } from \"slate-react\";\nimport React from \"react\";\n\nexport type RenderElementFunction = (props: RenderElementProps) => React.JSX.Element;\n\nexport function makeRenderElementFunction(\n suggestionsStyle: React.CSSProperties,\n): RenderElementFunction {\n return (props: RenderElementProps) => {\n switch (props.element.type) {\n case \"paragraph\":\n return <DefaultElement {...props} />;\n case \"suggestion\":\n return <SuggestionElement {...props} suggestionsStyle={suggestionsStyle} />;\n }\n };\n}\n\nconst DefaultElement = (props: RenderElementProps) => {\n return <div {...props.attributes}>{props.children}</div>;\n};\nconst SuggestionElement = (\n props: RenderElementProps & {\n suggestionsStyle: React.CSSProperties;\n },\n) => {\n return (\n <span\n {...props.attributes}\n style={{\n ...props.suggestionsStyle,\n }}\n data-testid=\"suggestion\"\n contentEditable={false}\n >\n {props.children /* https://github.com/ianstormtaylor/slate/issues/3930 */}\n {props.element.type === \"suggestion\" && props.element.content}\n </span>\n );\n};\n"],"mappings":";;;;;;AAWe,cAgBX,YAhBW;AANR,SAAS,0BACd,kBACuB;AACvB,SAAO,CAAC,UAA8B;AACpC,YAAQ,MAAM,QAAQ,MAAM;AAAA,MAC1B,KAAK;AACH,eAAO,oBAAC,mCAAmB,MAAO;AAAA,MACpC,KAAK;AACH,eAAO,oBAAC,oDAAsB,QAAtB,EAA6B,mBAAoC;AAAA,IAC7E;AAAA,EACF;AACF;AAEA,IAAM,iBAAiB,CAAC,UAA8B;AACpD,SAAO,oBAAC,wCAAQ,MAAM,aAAd,EAA2B,gBAAM,WAAS;AACpD;AACA,IAAM,oBAAoB,CACxB,UAGG;AACH,SACE;AAAA,IAAC;AAAA,qCACK,MAAM,aADX;AAAA,MAEC,OAAO,mBACF,MAAM;AAAA,MAEX,eAAY;AAAA,MACZ,iBAAiB;AAAA,MAEhB;AAAA,cAAM;AAAA,QACN,MAAM,QAAQ,SAAS,gBAAgB,MAAM,QAAQ;AAAA;AAAA;AAAA,EACxD;AAEJ;","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// src/types/base/base-autosuggestions-config.tsx
|
|
2
|
+
import { defaultCopilotContextCategories } from "@copilotkit/react-core";
|
|
3
|
+
import { isMacOS } from "@copilotkit/shared";
|
|
4
|
+
var defaultShouldToggleHoveringEditorOnKeyPress = (event, shortcut) => {
|
|
5
|
+
const isMetaKey = isMacOS() ? event.metaKey : event.ctrlKey;
|
|
6
|
+
return event.key === shortcut && isMetaKey;
|
|
7
|
+
};
|
|
8
|
+
var defaultShouldAcceptAutosuggestionOnKeyPress = (event) => {
|
|
9
|
+
if (event.key === "Tab") {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
};
|
|
14
|
+
var defaultShouldAcceptAutosuggestionOnTouch = () => false;
|
|
15
|
+
var defaultBaseAutosuggestionsConfig = {
|
|
16
|
+
debounceTime: 250,
|
|
17
|
+
contextCategories: defaultCopilotContextCategories,
|
|
18
|
+
disableWhenEmpty: true,
|
|
19
|
+
disabled: false,
|
|
20
|
+
temporarilyDisableWhenMovingCursorWithoutChangingText: true,
|
|
21
|
+
temporarilyDisableNotTrustedEvents: true,
|
|
22
|
+
shouldToggleHoveringEditorOnKeyPress: defaultShouldToggleHoveringEditorOnKeyPress,
|
|
23
|
+
shouldAcceptAutosuggestionOnKeyPress: defaultShouldAcceptAutosuggestionOnKeyPress,
|
|
24
|
+
shouldAcceptAutosuggestionOnTouch: defaultShouldAcceptAutosuggestionOnTouch
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
defaultBaseAutosuggestionsConfig
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=chunk-F6RLSVG3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/base/base-autosuggestions-config.tsx"],"sourcesContent":["import { BaseCopilotTextareaApiConfig } from \"./autosuggestions-bare-function\";\nimport { defaultCopilotContextCategories } from \"@copilotkit/react-core\";\nimport { isMacOS } from \"@copilotkit/shared\";\n\n/**\n * @interface BaseAutosuggestionsConfig\n *\n * @property {string} textareaPurpose - The purpose of the textarea. This is used to guide the autosuggestions.\n *\n * @property {string[]} contextCategories - The categories of context to consider when providing autosuggestions.\n *\n * @property {number} debounceTime - The amount of time (in milliseconds) to wait before triggering autosuggestions after the user has stopped typing.\n *\n * @property {BaseCopilotTextareaApiConfig} apiConfig - The configuration for the API that provides the autosuggestions.\n *\n * @property {boolean} disableWhenEmpty - Whether to disable autosuggestions when the textarea is empty.\n *\n * @property {boolean} disabled - Whether to disable autosuggestions entirely.\n *\n * @property {boolean} temporarilyDisableWhenMovingCursorWithoutChangingText - Whether to temporarily disable autosuggestions when the user moves the cursor without changing the text.\n *\n * @property {boolean} temporarilyDisableNotTrustedEvents - Temporarily disable autosuggestions after change event from non-trusted sources (like text insertion from autocomplete plugins)\n *\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnKeyPress - A function that determines whether to accept the current autosuggestion based on a key press event. By default, the Tab key is used to accept the autosuggestion. Example code:\n *\n * ```typescript\n * const defaultShouldAcceptAutosuggestionOnKeyPress = (event: React.KeyboardEvent<HTMLDivElement>) => {\n * // if tab, accept the autosuggestion\n * if (event.key === \"Tab\") {\n * return true;\n * }\n * return false;\n * }\n * ```\n *\n * @property {(event: React.TouchEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnTouch - A function that determines whether to accept the current autosuggestion based on a mobile touch event. By default, the touching the end of a suggestion will accept it. Example code:\n *\n * ```typescript\n * const shouldAcceptAutosuggestionOnTouch = (event: React.TouchEvent<HTMLDivElement>) => {\n * // if tab, accept the autosuggestion\n * if (event.type === \"touchstart\") {\n * return true;\n * }\n * return false;\n * }\n * ```\n *\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldToggleHoveringEditorOnKeyPress - A function that determines whether to toggle the hovering editor based on a key press event. By default, the Command + K key combination is used to toggle the hovering editor. Example code:\n *\n * ```typescript\n * const defaultShouldToggleHoveringEditorOnKeyPress = (event: React.KeyboardEvent<HTMLDivElement>) => {\n * // if command-k, toggle the hovering editor\n * if (event.key === \"k\" && event.metaKey) {\n * return true;\n * }\n * return false;\n * }\n * ```\n */\nexport interface BaseAutosuggestionsConfig {\n textareaPurpose: string;\n contextCategories: string[];\n debounceTime: number;\n apiConfig: BaseCopilotTextareaApiConfig;\n\n disableWhenEmpty: boolean;\n disabled: boolean;\n temporarilyDisableWhenMovingCursorWithoutChangingText: boolean;\n temporarilyDisableNotTrustedEvents: boolean;\n shouldAcceptAutosuggestionOnKeyPress: (event: React.KeyboardEvent<HTMLDivElement>) => boolean;\n shouldAcceptAutosuggestionOnTouch: (event: React.TouchEvent<HTMLDivElement>) => boolean;\n shouldToggleHoveringEditorOnKeyPress: (\n event: React.KeyboardEvent<HTMLDivElement>,\n shortcut: string,\n ) => boolean;\n}\n\n// by default, command-k toggles the hovering editor\nconst defaultShouldToggleHoveringEditorOnKeyPress = (\n event: React.KeyboardEvent<HTMLDivElement>,\n shortcut: string,\n) => {\n const isMetaKey = isMacOS() ? event.metaKey : event.ctrlKey;\n\n // if command-k, toggle the hovering editor\n return event.key === shortcut && isMetaKey;\n};\n\nconst defaultShouldAcceptAutosuggestionOnKeyPress = (\n event: React.KeyboardEvent<HTMLDivElement>,\n) => {\n // if tab, accept the autosuggestion\n if (event.key === \"Tab\") {\n return true;\n }\n return false;\n};\n\nconst defaultShouldAcceptAutosuggestionOnTouch = () => false;\n\n/**\n * Default configuration for the BaseAutosuggestions.\n *\n * @property {number} debounceTime - The amount of time to wait before triggering the autosuggestions API call.\n * @property {string[]} contextCategories - The categories to use for context when making the autosuggestions API call.\n * @property {boolean} disableWhenEmpty - Whether to disable the autosuggestions when the textarea is empty.\n * @property {boolean} disabled - Whether to disable the autosuggestions feature entirely.\n * @property {boolean} temporarilyDisableWhenMovingCursorWithoutChangingText - Whether to temporarily disable the autosuggestions when the cursor is moved without changing the text.\n * @property {boolean} temporarilyDisableNotTrustedEvents - Temporarily disable the autosuggestions after change event from non-trusted sources (like text insertion from autocomplete plugins)\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldToggleHoveringEditorOnKeyPress - A function that determines whether to toggle the hovering editor based on a key press event.\n * @property {(event: React.KeyboardEvent<HTMLDivElement>) => boolean} shouldAcceptAutosuggestionOnKeyPress - A function that determines whether to accept the autosuggestion based on a key press event.\n * @property {() => boolean} defaultShouldAcceptAutosuggestionOnTouch - A function that determines whether to accept the autosuggestion based on a mobile touch event.\n */\n\nexport const defaultBaseAutosuggestionsConfig: Omit<\n BaseAutosuggestionsConfig,\n \"textareaPurpose\" | \"apiConfig\"\n> = {\n debounceTime: 250,\n contextCategories: defaultCopilotContextCategories,\n disableWhenEmpty: true,\n disabled: false,\n temporarilyDisableWhenMovingCursorWithoutChangingText: true,\n temporarilyDisableNotTrustedEvents: true,\n shouldToggleHoveringEditorOnKeyPress: defaultShouldToggleHoveringEditorOnKeyPress,\n shouldAcceptAutosuggestionOnKeyPress: defaultShouldAcceptAutosuggestionOnKeyPress,\n shouldAcceptAutosuggestionOnTouch: defaultShouldAcceptAutosuggestionOnTouch,\n};\n"],"mappings":";AACA,SAAS,uCAAuC;AAChD,SAAS,eAAe;AA4ExB,IAAM,8CAA8C,CAClD,OACA,aACG;AACH,QAAM,YAAY,QAAQ,IAAI,MAAM,UAAU,MAAM;AAGpD,SAAO,MAAM,QAAQ,YAAY;AACnC;AAEA,IAAM,8CAA8C,CAClD,UACG;AAEH,MAAI,MAAM,QAAQ,OAAO;AACvB,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,IAAM,2CAA2C,MAAM;AAgBhD,IAAM,mCAGT;AAAA,EACF,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,uDAAuD;AAAA,EACvD,oCAAoC;AAAA,EACpC,sCAAsC;AAAA,EACtC,sCAAsC;AAAA,EACtC,mCAAmC;AACrC;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/lib/slatejs-edits/clear-autocompletions.ts
|
|
2
|
+
import { Element, Node, Transforms } from "slate";
|
|
3
|
+
function clearAutocompletionsFromEditor(editor) {
|
|
4
|
+
const paths = [];
|
|
5
|
+
for (const [node, path] of Node.nodes(editor)) {
|
|
6
|
+
if (Element.isElement(node) && node.type === "suggestion") {
|
|
7
|
+
paths.push(path);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
for (const path of paths) {
|
|
11
|
+
try {
|
|
12
|
+
Transforms.removeNodes(editor, { at: path });
|
|
13
|
+
} catch (e) {
|
|
14
|
+
console.log("CopilotTextarea.clearAutocompletionsFromEditor: error removing node", e);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
clearAutocompletionsFromEditor
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=chunk-GQN2HYFJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/slatejs-edits/clear-autocompletions.ts"],"sourcesContent":["import { Element, Node, Path, Transforms } from \"slate\";\nimport { CustomEditor } from \"../../types/base/custom-editor\";\n\nexport function clearAutocompletionsFromEditor(editor: CustomEditor) {\n // clear previous suggestion\n const paths: Path[] = [];\n for (const [node, path] of Node.nodes(editor)) {\n if (Element.isElement(node) && node.type === \"suggestion\") {\n paths.push(path);\n }\n }\n for (const path of paths) {\n try {\n Transforms.removeNodes(editor, { at: path });\n } catch (e) {\n console.log(\"CopilotTextarea.clearAutocompletionsFromEditor: error removing node\", e);\n }\n }\n}\n"],"mappings":";AAAA,SAAS,SAAS,MAAY,kBAAkB;AAGzC,SAAS,+BAA+B,QAAsB;AAEnE,QAAM,QAAgB,CAAC;AACvB,aAAW,CAAC,MAAM,IAAI,KAAK,KAAK,MAAM,MAAM,GAAG;AAC7C,QAAI,QAAQ,UAAU,IAAI,KAAK,KAAK,SAAS,cAAc;AACzD,YAAM,KAAK,IAAI;AAAA,IACjB;AAAA,EACF;AACA,aAAW,QAAQ,OAAO;AACxB,QAAI;AACF,iBAAW,YAAY,QAAQ,EAAE,IAAI,KAAK,CAAC;AAAA,IAC7C,SAAS,GAAP;AACA,cAAQ,IAAI,uEAAuE,CAAC;AAAA,IACtF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-H4VKQGVU.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-YLFAIYRY.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__objRest,
|
|
6
|
+
__spreadProps,
|
|
7
|
+
__spreadValues
|
|
8
|
+
} from "./chunk-MRXNTQOX.mjs";
|
|
9
|
+
|
|
10
|
+
// src/components/ui/dialog.tsx
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
13
|
+
import { X } from "lucide-react";
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var Dialog = DialogPrimitive.Root;
|
|
16
|
+
var DialogTrigger = DialogPrimitive.Trigger;
|
|
17
|
+
var DialogPortal = (_a) => {
|
|
18
|
+
var _b = _a, {
|
|
19
|
+
className,
|
|
20
|
+
children
|
|
21
|
+
} = _b, props = __objRest(_b, [
|
|
22
|
+
"className",
|
|
23
|
+
"children"
|
|
24
|
+
]);
|
|
25
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Portal, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx("div", { className: cn(className), children }) }));
|
|
26
|
+
};
|
|
27
|
+
DialogPortal.displayName = DialogPrimitive.Portal.displayName;
|
|
28
|
+
var DialogOverlay = React.forwardRef((_a, ref) => {
|
|
29
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
DialogPrimitive.Overlay,
|
|
32
|
+
__spreadValues({
|
|
33
|
+
ref,
|
|
34
|
+
className: cn(
|
|
35
|
+
"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
36
|
+
className
|
|
37
|
+
)
|
|
38
|
+
}, props)
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
42
|
+
var DialogContent = React.forwardRef((_a, ref) => {
|
|
43
|
+
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
44
|
+
return /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
45
|
+
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
46
|
+
/* @__PURE__ */ jsxs(
|
|
47
|
+
DialogPrimitive.Content,
|
|
48
|
+
__spreadProps(__spreadValues({
|
|
49
|
+
ref,
|
|
50
|
+
className: cn(
|
|
51
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",
|
|
52
|
+
className
|
|
53
|
+
)
|
|
54
|
+
}, props), {
|
|
55
|
+
children: [
|
|
56
|
+
children,
|
|
57
|
+
/* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
58
|
+
/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
|
|
59
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
60
|
+
] })
|
|
61
|
+
]
|
|
62
|
+
})
|
|
63
|
+
)
|
|
64
|
+
] });
|
|
65
|
+
});
|
|
66
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
67
|
+
var DialogHeader = (_a) => {
|
|
68
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
69
|
+
return /* @__PURE__ */ jsx("div", __spreadValues({ className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className) }, props));
|
|
70
|
+
};
|
|
71
|
+
DialogHeader.displayName = "DialogHeader";
|
|
72
|
+
var DialogFooter = (_a) => {
|
|
73
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
74
|
+
return /* @__PURE__ */ jsx(
|
|
75
|
+
"div",
|
|
76
|
+
__spreadValues({
|
|
77
|
+
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)
|
|
78
|
+
}, props)
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
DialogFooter.displayName = "DialogFooter";
|
|
82
|
+
var DialogTitle = React.forwardRef((_a, ref) => {
|
|
83
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
84
|
+
return /* @__PURE__ */ jsx(
|
|
85
|
+
DialogPrimitive.Title,
|
|
86
|
+
__spreadValues({
|
|
87
|
+
ref,
|
|
88
|
+
className: cn("text-lg font-semibold leading-none tracking-tight", className)
|
|
89
|
+
}, props)
|
|
90
|
+
);
|
|
91
|
+
});
|
|
92
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
93
|
+
var DialogDescription = React.forwardRef((_a, ref) => {
|
|
94
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
95
|
+
return /* @__PURE__ */ jsx(
|
|
96
|
+
DialogPrimitive.Description,
|
|
97
|
+
__spreadValues({
|
|
98
|
+
ref,
|
|
99
|
+
className: cn("text-sm text-muted-foreground", className)
|
|
100
|
+
}, props)
|
|
101
|
+
);
|
|
102
|
+
});
|
|
103
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
104
|
+
|
|
105
|
+
export {
|
|
106
|
+
Dialog,
|
|
107
|
+
DialogTrigger,
|
|
108
|
+
DialogContent,
|
|
109
|
+
DialogHeader,
|
|
110
|
+
DialogFooter,
|
|
111
|
+
DialogTitle,
|
|
112
|
+
DialogDescription
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=chunk-I72DKFHD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ui/dialog.tsx"],"sourcesContent":["import * as React from \"react\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { X } from \"lucide-react\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst Dialog = DialogPrimitive.Root;\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = ({\n className,\n children,\n ...props\n}: DialogPrimitive.DialogPortalProps & { className?: string }) => (\n <DialogPrimitive.Portal {...props}>\n <div className={cn(className)}>{children}</div>\n </DialogPrimitive.Portal>\n);\n\nDialogPortal.displayName = DialogPrimitive.Portal.displayName;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n \"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n className,\n )}\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n \"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full\",\n className,\n )}\n {...props}\n >\n {children}\n <DialogPrimitive.Close className=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground\">\n <X className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n </DialogPrimitive.Content>\n </DialogPortal>\n));\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div className={cn(\"flex flex-col space-y-1.5 text-center sm:text-left\", className)} {...props} />\n);\nDialogHeader.displayName = \"DialogHeader\";\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\", className)}\n {...props}\n />\n);\nDialogFooter.displayName = \"DialogFooter\";\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\"text-lg font-semibold leading-none tracking-tight\", className)}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogTrigger,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n};\n"],"mappings":";;;;;;;;;;AAAA,YAAY,WAAW;AACvB,YAAY,qBAAqB;AACjC,SAAS,SAAS;AAcd,cAoCE,YApCF;AAVJ,IAAM,SAAyB;AAE/B,IAAM,gBAAgC;AAEtC,IAAM,eAAe,CAAC,OAIyC;AAJzC,eACpB;AAAA;AAAA,IACA;AAAA,EAZF,IAUsB,IAGjB,kBAHiB,IAGjB;AAAA,IAFH;AAAA,IACA;AAAA;AAGA,6BAAiB,wBAAhB,iCAA2B,QAA3B,EACC,8BAAC,SAAI,WAAW,GAAG,SAAS,GAAI,UAAS,IAC3C;AAAA;AAGF,aAAa,cAA8B,uBAAO;AAElD,IAAM,gBAAsB,iBAG1B,CAAC,IAAyB,QAAK;AAA9B,eAAE,YAzBL,IAyBG,IAAgB,kBAAhB,IAAgB,CAAd;AACH;AAAA,IAAiB;AAAA,IAAhB;AAAA,MACC;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,OACI;AAAA,EACN;AAAA,CACD;AACD,cAAc,cAA8B,wBAAQ;AAEpD,IAAM,gBAAsB,iBAG1B,CAAC,IAAmC,QAAK;AAAxC,eAAE,aAAW,SAxChB,IAwCG,IAA0B,kBAA1B,IAA0B,CAAxB,aAAW;AACd,8BAAC,gBACC;AAAA,wBAAC,iBAAc;AAAA,IACf;AAAA,MAAiB;AAAA,MAAhB;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA;AAAA,QACF;AAAA,SACI,QANL;AAAA,QAQE;AAAA;AAAA,UACD,qBAAiB,uBAAhB,EAAsB,WAAU,iRAC/B;AAAA,gCAAC,KAAE,WAAU,WAAU;AAAA,YACvB,oBAAC,UAAK,WAAU,WAAU,mBAAK;AAAA,aACjC;AAAA;AAAA;AAAA,IACF;AAAA,KACF;AAAA,CACD;AACD,cAAc,cAA8B,wBAAQ;AAEpD,IAAM,eAAe,CAAC,OAA+D;AAA/D,eAAE,YA7DxB,IA6DsB,IAAgB,kBAAhB,IAAgB,CAAd;AACtB,6BAAC,wBAAI,WAAW,GAAG,sDAAsD,SAAS,KAAO,MAAO;AAAA;AAElG,aAAa,cAAc;AAE3B,IAAM,eAAe,CAAC,OAA+D;AAA/D,eAAE,YAlExB,IAkEsB,IAAgB,kBAAhB,IAAgB,CAAd;AACtB;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,iEAAiE,SAAS;AAAA,OACpF;AAAA,EACN;AAAA;AAEF,aAAa,cAAc;AAE3B,IAAM,cAAoB,iBAGxB,CAAC,IAAyB,QAAK;AAA9B,eAAE,YA7EL,IA6EG,IAAgB,kBAAhB,IAAgB,CAAd;AACH;AAAA,IAAiB;AAAA,IAAhB;AAAA,MACC;AAAA,MACA,WAAW,GAAG,qDAAqD,SAAS;AAAA,OACxE;AAAA,EACN;AAAA,CACD;AACD,YAAY,cAA8B,sBAAM;AAEhD,IAAM,oBAA0B,iBAG9B,CAAC,IAAyB,QAAK;AAA9B,eAAE,YAzFL,IAyFG,IAAgB,kBAAhB,IAAgB,CAAd;AACH;AAAA,IAAiB;AAAA,IAAhB;AAAA,MACC;AAAA,MACA,WAAW,GAAG,iCAAiC,SAAS;AAAA,OACpD;AAAA,EACN;AAAA,CACD;AACD,kBAAkB,cAA8B,4BAAY;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-IU3WTXLQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
editorToText
|
|
3
|
+
} from "./chunk-T6MTDQZ7.mjs";
|
|
4
|
+
|
|
5
|
+
// src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx
|
|
6
|
+
import { useEffect, useRef } from "react";
|
|
7
|
+
import { useSlateSelector } from "slate-react";
|
|
8
|
+
import { Range } from "slate";
|
|
9
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
10
|
+
function TrackerTextEditedSinceLastCursorMovement(props) {
|
|
11
|
+
const cursorState = useSlateSelector((state) => ({
|
|
12
|
+
selection: state.selection,
|
|
13
|
+
text: editorToText(state)
|
|
14
|
+
}));
|
|
15
|
+
const previousState = usePrevious(cursorState);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (!previousState) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (cursorChangedWithoutTextChanged(previousState, cursorState)) {
|
|
21
|
+
props.setCursorMovedSinceLastTextChange(true);
|
|
22
|
+
}
|
|
23
|
+
}, [props.setCursorMovedSinceLastTextChange, cursorState]);
|
|
24
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
25
|
+
}
|
|
26
|
+
var cursorChangedWithoutTextChanged = (prev, next) => {
|
|
27
|
+
const isSelectionChanged = !isSelectionEqual(prev.selection, next.selection);
|
|
28
|
+
const isTextSame = prev.text === next.text;
|
|
29
|
+
return isSelectionChanged && isTextSame;
|
|
30
|
+
};
|
|
31
|
+
var isSelectionEqual = (a, b) => {
|
|
32
|
+
if (!a && !b)
|
|
33
|
+
return true;
|
|
34
|
+
if (!a || !b)
|
|
35
|
+
return false;
|
|
36
|
+
return Range.equals(a, b);
|
|
37
|
+
};
|
|
38
|
+
function usePrevious(value) {
|
|
39
|
+
const ref = useRef(void 0);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
ref.current = value;
|
|
42
|
+
});
|
|
43
|
+
return ref.current;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
TrackerTextEditedSinceLastCursorMovement
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=chunk-JLOABKLH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { BaseSelection } from \"slate\";\nimport { useSlateSelector } from \"slate-react\";\nimport { Range } from \"slate\";\nimport { editorToText } from \"../../lib/editor-to-text\";\n\ninterface TrackerTextEditedSinceLastCursorMovementProps {\n setCursorMovedSinceLastTextChange: (value: boolean) => void;\n}\nexport function TrackerTextEditedSinceLastCursorMovement(\n props: TrackerTextEditedSinceLastCursorMovementProps,\n) {\n const cursorState: RelevantEditorState = useSlateSelector((state) => ({\n selection: state.selection,\n text: editorToText(state),\n }));\n\n const previousState = usePrevious(cursorState);\n\n useEffect(() => {\n if (!previousState) {\n return;\n }\n\n if (cursorChangedWithoutTextChanged(previousState, cursorState)) {\n props.setCursorMovedSinceLastTextChange(true);\n }\n }, [props.setCursorMovedSinceLastTextChange, cursorState]);\n\n return <></>;\n}\n\ntype RelevantEditorState = {\n selection: BaseSelection;\n text: string;\n};\n\nconst cursorChangedWithoutTextChanged = (\n prev: RelevantEditorState,\n next: RelevantEditorState,\n): boolean => {\n // Check if the selection has changed\n const isSelectionChanged = !isSelectionEqual(prev.selection, next.selection);\n\n // Check if the text content remains the same\n const isTextSame = prev.text === next.text;\n\n return isSelectionChanged && isTextSame;\n};\n\nconst isSelectionEqual = (a: BaseSelection, b: BaseSelection) => {\n if (!a && !b) return true;\n if (!a || !b) return false;\n return Range.equals(a, b);\n};\n\n/**\n * Easily keep track of the *previous* value of a variable.\n *\n * Example:\n * ```\n * const [count, setCount] = useState(0);\n * const prevCount = usePrevious(count);\n *\n * useEffect(() => {\n * if (count > prevCount) {\n * console.log('Now I know that count is bigger than before');\n * }\n * }, [count, prevCount]);\n * ```\n */\nfunction usePrevious<T>(value: T): T | undefined {\n const ref = useRef<T>(undefined!);\n\n useEffect(() => {\n ref.current = value;\n });\n\n return ref.current;\n}\n"],"mappings":";;;;;AAAA,SAAS,WAAW,cAAc;AAElC,SAAS,wBAAwB;AACjC,SAAS,aAAa;AA0Bb;AApBF,SAAS,yCACd,OACA;AACA,QAAM,cAAmC,iBAAiB,CAAC,WAAW;AAAA,IACpE,WAAW,MAAM;AAAA,IACjB,MAAM,aAAa,KAAK;AAAA,EAC1B,EAAE;AAEF,QAAM,gBAAgB,YAAY,WAAW;AAE7C,YAAU,MAAM;AACd,QAAI,CAAC,eAAe;AAClB;AAAA,IACF;AAEA,QAAI,gCAAgC,eAAe,WAAW,GAAG;AAC/D,YAAM,kCAAkC,IAAI;AAAA,IAC9C;AAAA,EACF,GAAG,CAAC,MAAM,mCAAmC,WAAW,CAAC;AAEzD,SAAO,gCAAE;AACX;AAOA,IAAM,kCAAkC,CACtC,MACA,SACY;AAEZ,QAAM,qBAAqB,CAAC,iBAAiB,KAAK,WAAW,KAAK,SAAS;AAG3E,QAAM,aAAa,KAAK,SAAS,KAAK;AAEtC,SAAO,sBAAsB;AAC/B;AAEA,IAAM,mBAAmB,CAAC,GAAkB,MAAqB;AAC/D,MAAI,CAAC,KAAK,CAAC;AAAG,WAAO;AACrB,MAAI,CAAC,KAAK,CAAC;AAAG,WAAO;AACrB,SAAO,MAAM,OAAO,GAAG,CAAC;AAC1B;AAiBA,SAAS,YAAe,OAAyB;AAC/C,QAAM,MAAM,OAAU,MAAU;AAEhC,YAAU,MAAM;AACd,QAAI,UAAU;AAAA,EAChB,CAAC;AAED,SAAO,IAAI;AACb;","names":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Label
|
|
3
|
+
} from "./chunk-D47EKHIF.mjs";
|
|
4
|
+
|
|
5
|
+
// src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx
|
|
6
|
+
import Chip from "@mui/material/Chip/Chip.js";
|
|
7
|
+
import Avatar from "@mui/material/Avatar/Avatar.js";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
var IncludedFilesPreview = ({
|
|
10
|
+
includedFiles,
|
|
11
|
+
setIncludedFiles
|
|
12
|
+
}) => {
|
|
13
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 mt-2", children: [
|
|
14
|
+
/* @__PURE__ */ jsx(Label, { className: "", children: "Included context:" }),
|
|
15
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: includedFiles.map((filePointer, index) => {
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
FileChipPreview,
|
|
18
|
+
{
|
|
19
|
+
filePointer,
|
|
20
|
+
onDelete: () => {
|
|
21
|
+
setIncludedFiles((prev) => prev.filter((fp) => fp !== filePointer));
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
`file-${filePointer.sourceApplication}.${filePointer.name}`
|
|
25
|
+
);
|
|
26
|
+
}) })
|
|
27
|
+
] });
|
|
28
|
+
};
|
|
29
|
+
var FileChipPreview = ({ filePointer, onDelete }) => {
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
Chip,
|
|
32
|
+
{
|
|
33
|
+
label: filePointer.name,
|
|
34
|
+
onDelete,
|
|
35
|
+
avatar: /* @__PURE__ */ jsx(
|
|
36
|
+
Avatar,
|
|
37
|
+
{
|
|
38
|
+
src: filePointer.iconImageUri,
|
|
39
|
+
alt: filePointer.sourceApplication,
|
|
40
|
+
sx: { backgroundColor: "transparent" }
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export {
|
|
48
|
+
IncludedFilesPreview,
|
|
49
|
+
FileChipPreview
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=chunk-KMVGEY7Q.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx"],"sourcesContent":["import { DocumentPointer } from \"@copilotkit/react-core\";\nimport { Label } from \"../../ui/label\";\nimport React from \"react\";\nimport Chip from \"@mui/material/Chip/Chip.js\";\nimport Avatar from \"@mui/material/Avatar/Avatar.js\";\n\nexport interface IncludedFilesPreviewProps {\n includedFiles: DocumentPointer[];\n setIncludedFiles: React.Dispatch<React.SetStateAction<DocumentPointer[]>>;\n}\n\nexport const IncludedFilesPreview = ({\n includedFiles,\n setIncludedFiles,\n}: IncludedFilesPreviewProps) => {\n return (\n <div className=\"flex flex-col gap-2 mt-2\">\n <Label className=\"\">Included context:</Label>\n <div className=\"flex flex-wrap gap-2\">\n {includedFiles.map((filePointer, index) => {\n return (\n <FileChipPreview\n key={`file-${filePointer.sourceApplication}.${filePointer.name}`}\n filePointer={filePointer}\n onDelete={() => {\n setIncludedFiles((prev) => prev.filter((fp) => fp !== filePointer));\n }}\n />\n );\n })}\n </div>\n </div>\n );\n};\n\nexport interface FileChipPreviewProps {\n filePointer: DocumentPointer;\n onDelete: () => void;\n}\n\nexport const FileChipPreview = ({ filePointer, onDelete }: FileChipPreviewProps) => {\n return (\n <Chip\n label={filePointer.name}\n onDelete={onDelete}\n avatar={\n <Avatar\n src={filePointer.iconImageUri}\n alt={filePointer.sourceApplication}\n sx={{ backgroundColor: \"transparent\" }}\n ></Avatar>\n }\n />\n );\n};\n"],"mappings":";;;;;AAGA,OAAO,UAAU;AACjB,OAAO,YAAY;AAYf,SACE,KADF;AALG,IAAM,uBAAuB,CAAC;AAAA,EACnC;AAAA,EACA;AACF,MAAiC;AAC/B,SACE,qBAAC,SAAI,WAAU,4BACb;AAAA,wBAAC,SAAM,WAAU,IAAG,+BAAiB;AAAA,IACrC,oBAAC,SAAI,WAAU,wBACZ,wBAAc,IAAI,CAAC,aAAa,UAAU;AACzC,aACE;AAAA,QAAC;AAAA;AAAA,UAEC;AAAA,UACA,UAAU,MAAM;AACd,6BAAiB,CAAC,SAAS,KAAK,OAAO,CAAC,OAAO,OAAO,WAAW,CAAC;AAAA,UACpE;AAAA;AAAA,QAJK,QAAQ,YAAY,qBAAqB,YAAY;AAAA,MAK5D;AAAA,IAEJ,CAAC,GACH;AAAA,KACF;AAEJ;AAOO,IAAM,kBAAkB,CAAC,EAAE,aAAa,SAAS,MAA4B;AAClF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,YAAY;AAAA,MACnB;AAAA,MACA,QACE;AAAA,QAAC;AAAA;AAAA,UACC,KAAK,YAAY;AAAA,UACjB,KAAK,YAAY;AAAA,UACjB,IAAI,EAAE,iBAAiB,cAAc;AAAA;AAAA,MACtC;AAAA;AAAA,EAEL;AAEJ;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/lib/retry.tsx
|
|
2
|
+
function retry(fn, retriesLeft = 2, interval = 200, backoff = 1.5) {
|
|
3
|
+
return new Promise((resolve, reject) => {
|
|
4
|
+
fn().then(resolve).catch((error) => {
|
|
5
|
+
if (retriesLeft === 1) {
|
|
6
|
+
reject(error);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
setTimeout(() => {
|
|
10
|
+
retry(fn, retriesLeft - 1, interval * backoff, backoff).then(resolve).catch(reject);
|
|
11
|
+
}, interval);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
retry
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=chunk-KNQIEOFP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/retry.tsx"],"sourcesContent":["export function retry<T>(\n fn: () => Promise<T>,\n retriesLeft: number = 2,\n interval: number = 200,\n backoff: number = 1.5,\n): Promise<T> {\n return new Promise((resolve, reject) => {\n fn()\n .then(resolve)\n .catch((error) => {\n if (retriesLeft === 1) {\n reject(error);\n return;\n }\n\n setTimeout(() => {\n retry(fn, retriesLeft - 1, interval * backoff, backoff)\n .then(resolve)\n .catch(reject);\n }, interval);\n });\n });\n}\n"],"mappings":";AAAO,SAAS,MACd,IACA,cAAsB,GACtB,WAAmB,KACnB,UAAkB,KACN;AACZ,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,OAAG,EACA,KAAK,OAAO,EACZ,MAAM,CAAC,UAAU;AAChB,UAAI,gBAAgB,GAAG;AACrB,eAAO,KAAK;AACZ;AAAA,MACF;AAEA,iBAAW,MAAM;AACf,cAAM,IAAI,cAAc,GAAG,WAAW,SAAS,OAAO,EACnD,KAAK,OAAO,EACZ,MAAM,MAAM;AAAA,MACjB,GAAG,QAAQ;AAAA,IACb,CAAC;AAAA,EACL,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-L7VVZH4Q.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/components/hovering-toolbar/hovering-editor-provider.tsx
|
|
2
|
+
import { createContext, useState, useContext } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var HoveringEditorContext = createContext({
|
|
5
|
+
isDisplayed: false,
|
|
6
|
+
setIsDisplayed: () => {
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
var HoveringEditorProvider = ({ children }) => {
|
|
10
|
+
const [isDisplayed, setIsDisplayed] = useState(false);
|
|
11
|
+
return /* @__PURE__ */ jsx(HoveringEditorContext.Provider, { value: { isDisplayed, setIsDisplayed }, children });
|
|
12
|
+
};
|
|
13
|
+
var useHoveringEditorContext = () => useContext(HoveringEditorContext);
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
HoveringEditorProvider,
|
|
17
|
+
useHoveringEditorContext
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=chunk-LYB4B6MK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/hovering-toolbar/hovering-editor-provider.tsx"],"sourcesContent":["import { createContext, useState, useContext, ReactNode } from \"react\";\n\ninterface HoveringEditorContextProps {\n isDisplayed: boolean;\n setIsDisplayed: (value: boolean) => void;\n}\n\nconst HoveringEditorContext = createContext<HoveringEditorContextProps>({\n isDisplayed: false,\n setIsDisplayed: () => {},\n});\n\nexport interface HoveringEditorProviderProps {\n children: ReactNode;\n}\n\n/**\n * A context provider for the hovering editor over the `CopilotTextarea`\n * (used to edit and insert text into the `CopilotTextarea`).\n */\nexport const HoveringEditorProvider = ({ children }: HoveringEditorProviderProps) => {\n const [isDisplayed, setIsDisplayed] = useState<boolean>(false);\n\n return (\n <HoveringEditorContext.Provider value={{ isDisplayed, setIsDisplayed }}>\n {children}\n </HoveringEditorContext.Provider>\n );\n};\n\nexport const useHoveringEditorContext = () => useContext(HoveringEditorContext);\n"],"mappings":";AAAA,SAAS,eAAe,UAAU,kBAA6B;AAwB3D;AAjBJ,IAAM,wBAAwB,cAA0C;AAAA,EACtE,aAAa;AAAA,EACb,gBAAgB,MAAM;AAAA,EAAC;AACzB,CAAC;AAUM,IAAM,yBAAyB,CAAC,EAAE,SAAS,MAAmC;AACnF,QAAM,CAAC,aAAa,cAAc,IAAI,SAAkB,KAAK;AAE7D,SACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAAO,EAAE,aAAa,eAAe,GAClE,UACH;AAEJ;AAEO,IAAM,2BAA2B,MAAM,WAAW,qBAAqB;","names":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// src/types/autosuggestions-config/insertions-api-config.tsx
|
|
2
|
+
import { Role, TextMessage } from "@copilotkit/runtime-client-gql";
|
|
3
|
+
var defaultInsertionsMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
4
|
+
return `You are a versatile writing assistant helping the user insert new text into their existing work.
|
|
5
|
+
|
|
6
|
+
The user is writing some text.
|
|
7
|
+
The purpose is: "${textareaPurpose}"
|
|
8
|
+
|
|
9
|
+
The following external context is also provided. Use it to inform your suggestions when relevant!!!
|
|
10
|
+
\`\`\`
|
|
11
|
+
${contextString}
|
|
12
|
+
\`\`\`
|
|
13
|
+
|
|
14
|
+
The user will provide you with a prompt for an INSERTION into the text they are writing.
|
|
15
|
+
Your job is to come up with an INSERTION into the text that the user would like to use, AS BEST YOU CAN.
|
|
16
|
+
Only insert a SHORT segment. Usually 1 sentence, or at most 1 paragraph.
|
|
17
|
+
|
|
18
|
+
Adjust yourself to the user's style and implied intent.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
The user will provide the text before and after the cursor, as well as the INSERTION prompt. You should use this to infer the best relevant insertion.
|
|
22
|
+
The conversation will be structured as follows:
|
|
23
|
+
<TextAfterCursor>
|
|
24
|
+
<TextBeforeCursor>
|
|
25
|
+
<InsertionPrompt>
|
|
26
|
+
|
|
27
|
+
<YourInsertionSuggestion>
|
|
28
|
+
`;
|
|
29
|
+
};
|
|
30
|
+
var defaultInsertionsFewShotMessages = [
|
|
31
|
+
new TextMessage({
|
|
32
|
+
role: Role.User,
|
|
33
|
+
content: "<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>"
|
|
34
|
+
}),
|
|
35
|
+
new TextMessage({
|
|
36
|
+
role: Role.User,
|
|
37
|
+
content: "<TextBeforeCursor>This morning I woke up and went straight to the grocery store.</TextBeforeCursor>"
|
|
38
|
+
}),
|
|
39
|
+
new TextMessage({
|
|
40
|
+
role: Role.User,
|
|
41
|
+
content: "<InsertionPrompt>I bought a big watermelon</InsertionPrompt>"
|
|
42
|
+
}),
|
|
43
|
+
new TextMessage({
|
|
44
|
+
role: Role.Assistant,
|
|
45
|
+
content: "When I arrived I went straight to the produce section and picked out a big watermelon."
|
|
46
|
+
}),
|
|
47
|
+
new TextMessage({
|
|
48
|
+
role: Role.User,
|
|
49
|
+
content: "<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>"
|
|
50
|
+
}),
|
|
51
|
+
new TextMessage({
|
|
52
|
+
role: Role.User,
|
|
53
|
+
content: `<TextBeforeCursor>The Optionholder, in the Optionholder's capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an "Equityholder" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an "Equityholder" thereunder;</TextBeforeCursor>`
|
|
54
|
+
}),
|
|
55
|
+
new TextMessage({
|
|
56
|
+
role: Role.User,
|
|
57
|
+
content: "<InsertionPrompt>add section about the optionholder's pro rata share</InsertionPrompt>"
|
|
58
|
+
}),
|
|
59
|
+
new TextMessage({
|
|
60
|
+
role: Role.Assistant,
|
|
61
|
+
content: ` (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder's "Pro Rata Share"; `
|
|
62
|
+
})
|
|
63
|
+
];
|
|
64
|
+
var defaultInsertionsApiConfig = {
|
|
65
|
+
makeSystemPrompt: defaultInsertionsMakeSystemPrompt,
|
|
66
|
+
fewShotMessages: defaultInsertionsFewShotMessages,
|
|
67
|
+
forwardedParams: void 0
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
defaultInsertionsMakeSystemPrompt,
|
|
72
|
+
defaultInsertionsFewShotMessages,
|
|
73
|
+
defaultInsertionsApiConfig
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=chunk-MCNXIA4Q.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/autosuggestions-config/insertions-api-config.tsx"],"sourcesContent":["import { Message, Role, TextMessage } from \"@copilotkit/runtime-client-gql\";\nimport { MakeSystemPrompt } from \"./subtypes/make-system-prompt\";\n\nexport interface InsertionsApiConfig {\n makeSystemPrompt: MakeSystemPrompt;\n fewShotMessages: Message[];\n forwardedParams: { [key: string]: any } | undefined;\n}\n\nexport const defaultInsertionsMakeSystemPrompt: MakeSystemPrompt = (\n textareaPurpose,\n contextString,\n) => {\n return `You are a versatile writing assistant helping the user insert new text into their existing work.\n \nThe user is writing some text.\nThe purpose is: \\\"${textareaPurpose}\\\"\n\nThe following external context is also provided. Use it to inform your suggestions when relevant!!!\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThe user will provide you with a prompt for an INSERTION into the text they are writing. \nYour job is to come up with an INSERTION into the text that the user would like to use, AS BEST YOU CAN.\nOnly insert a SHORT segment. Usually 1 sentence, or at most 1 paragraph.\n\nAdjust yourself to the user's style and implied intent.\n\n\nThe user will provide the text before and after the cursor, as well as the INSERTION prompt. You should use this to infer the best relevant insertion.\nThe conversation will be structured as follows:\n<TextAfterCursor>\n<TextBeforeCursor>\n<InsertionPrompt>\n\n<YourInsertionSuggestion>\n`;\n};\n\nexport const defaultInsertionsFewShotMessages: Message[] = [\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextBeforeCursor>This morning I woke up and went straight to the grocery store.</TextBeforeCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content: \"<InsertionPrompt>I bought a big watermelon</InsertionPrompt>\",\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n \"When I arrived I went straight to the produce section and picked out a big watermelon.\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>\",\n }),\n new TextMessage({\n role: Role.User,\n content:\n '<TextBeforeCursor>The Optionholder, in the Optionholder\\'s capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an \"Equityholder\" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an \"Equityholder\" thereunder;</TextBeforeCursor>',\n }),\n new TextMessage({\n role: Role.User,\n content:\n \"<InsertionPrompt>add section about the optionholder's pro rata share</InsertionPrompt>\",\n }),\n new TextMessage({\n role: Role.Assistant,\n content:\n ' (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder\\'s \"Pro Rata Share\"; ',\n }),\n];\n\nexport const defaultInsertionsApiConfig: InsertionsApiConfig = {\n makeSystemPrompt: defaultInsertionsMakeSystemPrompt,\n fewShotMessages: defaultInsertionsFewShotMessages,\n forwardedParams: undefined,\n};\n"],"mappings":";AAAA,SAAkB,MAAM,mBAAmB;AASpC,IAAM,oCAAsD,CACjE,iBACA,kBACG;AACH,SAAO;AAAA;AAAA;AAAA,mBAGW;AAAA;AAAA;AAAA;AAAA,EAIlB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBF;AAEO,IAAM,mCAA8C;AAAA,EACzD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SAAS;AAAA,EACX,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AAAA,EACD,IAAI,YAAY;AAAA,IACd,MAAM,KAAK;AAAA,IACX,SACE;AAAA,EACJ,CAAC;AACH;AAEO,IAAM,6BAAkD;AAAA,EAC7D,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,iBAAiB;AACnB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-MMVDU6DF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|