@copilotkit/react-textarea 0.28.0-alpha.8 → 0.28.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +341 -379
- package/CHANGELOG.md +12 -0
- package/dist/chunk-224UKA7C.mjs +9 -4
- package/dist/chunk-224UKA7C.mjs.map +1 -1
- package/dist/chunk-2C7O2EVM.mjs +4 -4
- package/dist/chunk-2C7O2EVM.mjs.map +1 -1
- package/dist/chunk-2QDCE7PD.mjs +6 -3
- package/dist/chunk-2QDCE7PD.mjs.map +1 -1
- package/dist/chunk-3PQ7GSFE.mjs +4 -4
- package/dist/chunk-3PQ7GSFE.mjs.map +1 -1
- package/dist/chunk-4NHVQZ67.mjs +6 -5
- package/dist/chunk-4NHVQZ67.mjs.map +1 -1
- package/dist/chunk-4OJ3H65F.mjs +5 -2
- package/dist/chunk-4OJ3H65F.mjs.map +1 -1
- package/dist/chunk-5J3UZV77.mjs +23 -11
- package/dist/chunk-5J3UZV77.mjs.map +1 -1
- package/dist/chunk-5UNJXFUO.mjs +4 -4
- package/dist/chunk-5UNJXFUO.mjs.map +1 -1
- package/dist/chunk-72P3KOHZ.mjs +17 -7
- package/dist/chunk-72P3KOHZ.mjs.map +1 -1
- package/dist/chunk-7LSRNPNI.mjs +4 -4
- package/dist/chunk-7LSRNPNI.mjs.map +1 -1
- package/dist/chunk-7SUZ6CXM.mjs +15 -6
- package/dist/chunk-7SUZ6CXM.mjs.map +1 -1
- package/dist/chunk-AZHILHKM.mjs +21 -8
- package/dist/chunk-AZHILHKM.mjs.map +1 -1
- package/dist/chunk-B6TKVDDY.mjs +58 -22
- package/dist/chunk-B6TKVDDY.mjs.map +1 -1
- package/dist/chunk-BBZ7AWOB.mjs +8 -4
- package/dist/chunk-BBZ7AWOB.mjs.map +1 -1
- package/dist/chunk-DE5K76I2.mjs +0 -2
- package/dist/chunk-DE5K76I2.mjs.map +1 -1
- package/dist/chunk-DRV2FOHZ.mjs +11 -6
- package/dist/chunk-DRV2FOHZ.mjs.map +1 -1
- package/dist/chunk-ECR45NSD.mjs +7 -4
- package/dist/chunk-ECR45NSD.mjs.map +1 -1
- package/dist/chunk-FJNUPSQK.mjs +16 -5
- package/dist/chunk-FJNUPSQK.mjs.map +1 -1
- package/dist/chunk-FP2EKU3L.mjs +4 -4
- package/dist/chunk-FP2EKU3L.mjs.map +1 -1
- package/dist/chunk-GQN2HYFJ.mjs +4 -4
- package/dist/chunk-GQN2HYFJ.mjs.map +1 -1
- package/dist/chunk-H4VKQGVU.mjs +0 -2
- package/dist/chunk-H4VKQGVU.mjs.map +1 -1
- package/dist/chunk-IU3WTXLQ.mjs +0 -2
- package/dist/chunk-IU3WTXLQ.mjs.map +1 -1
- package/dist/chunk-JJLQVT7S.mjs +6 -3
- package/dist/chunk-JJLQVT7S.mjs.map +1 -1
- package/dist/chunk-KDVMG3XF.mjs +5 -2
- package/dist/chunk-KDVMG3XF.mjs.map +1 -1
- package/dist/chunk-KFQZHRPJ.mjs +15 -8
- package/dist/chunk-KFQZHRPJ.mjs.map +1 -1
- package/dist/chunk-KNQIEOFP.mjs +3 -2
- package/dist/chunk-KNQIEOFP.mjs.map +1 -1
- package/dist/chunk-L7VVZH4Q.mjs +0 -2
- package/dist/chunk-L7VVZH4Q.mjs.map +1 -1
- package/dist/chunk-LQ2OWQU7.mjs +11 -7
- package/dist/chunk-LQ2OWQU7.mjs.map +1 -1
- package/dist/chunk-LYB4B6MK.mjs +6 -5
- package/dist/chunk-LYB4B6MK.mjs.map +1 -1
- package/dist/chunk-M2DR4KVB.mjs +6 -3
- package/dist/chunk-M2DR4KVB.mjs.map +1 -1
- package/dist/chunk-MMVDU6DF.mjs +0 -2
- package/dist/chunk-MMVDU6DF.mjs.map +1 -1
- package/dist/chunk-MRXNTQOX.mjs +6 -2
- package/dist/chunk-MRXNTQOX.mjs.map +1 -1
- package/dist/chunk-P4QVFRLY.mjs +17 -7
- package/dist/chunk-P4QVFRLY.mjs.map +1 -1
- package/dist/chunk-PTZVE6NC.mjs +22 -8
- package/dist/chunk-PTZVE6NC.mjs.map +1 -1
- package/dist/chunk-QCPS6IYI.mjs +15 -6
- package/dist/chunk-QCPS6IYI.mjs.map +1 -1
- package/dist/chunk-RKQ6RTZM.mjs +5 -2
- package/dist/chunk-RKQ6RTZM.mjs.map +1 -1
- package/dist/chunk-RT4UTBH3.mjs +15 -6
- package/dist/chunk-RT4UTBH3.mjs.map +1 -1
- package/dist/chunk-RUV6NBIF.mjs +0 -2
- package/dist/chunk-RUV6NBIF.mjs.map +1 -1
- package/dist/chunk-SNQEBH5I.mjs +24 -10
- package/dist/chunk-SNQEBH5I.mjs.map +1 -1
- package/dist/chunk-SX6NY5FW.mjs +11 -6
- package/dist/chunk-SX6NY5FW.mjs.map +1 -1
- package/dist/chunk-T6MTDQZ7.mjs +4 -4
- package/dist/chunk-T6MTDQZ7.mjs.map +1 -1
- package/dist/chunk-VB4VNCIQ.mjs +28 -12
- package/dist/chunk-VB4VNCIQ.mjs.map +1 -1
- package/dist/chunk-VPEH6V7T.mjs +12 -6
- package/dist/chunk-VPEH6V7T.mjs.map +1 -1
- package/dist/chunk-WADHCMPK.mjs +0 -2
- package/dist/chunk-WADHCMPK.mjs.map +1 -1
- package/dist/chunk-WFTAAA7R.mjs +16 -8
- package/dist/chunk-WFTAAA7R.mjs.map +1 -1
- package/dist/chunk-WJHSY5T6.mjs +0 -2
- package/dist/chunk-WJHSY5T6.mjs.map +1 -1
- package/dist/chunk-WTASPE2W.mjs +41 -22
- package/dist/chunk-WTASPE2W.mjs.map +1 -1
- package/dist/chunk-XW3ICO4S.mjs +10 -4
- package/dist/chunk-XW3ICO4S.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js +379 -257
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +39 -35
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-element.js +32 -11
- package/dist/components/base-copilot-textarea/render-element.js.map +1 -1
- package/dist/components/base-copilot-textarea/render-element.mjs +7 -3
- package/dist/components/base-copilot-textarea/render-element.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.js +29 -8
- package/dist/components/base-copilot-textarea/render-placeholder.js.map +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.mjs +7 -3
- package/dist/components/base-copilot-textarea/render-placeholder.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js +44 -17
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js.map +1 -1
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +8 -4
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/use-add-branding-css.js +29 -7
- package/dist/components/base-copilot-textarea/use-add-branding-css.js.map +1 -1
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +7 -3
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.js +414 -272
- package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.mjs +48 -44
- package/dist/components/copilot-textarea/copilot-textarea.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.js +35 -12
- package/dist/components/hovering-toolbar/hovering-editor-provider.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +9 -3
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js +66 -36
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +15 -3
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.js +247 -179
- package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +22 -18
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +180 -129
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +16 -12
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +185 -131
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +17 -13
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js +71 -55
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +11 -5
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +185 -131
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +18 -14
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +1 -1
- package/dist/components/index.js +418 -273
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +52 -45
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/manual-ui/chip-with-icon.js +31 -9
- package/dist/components/manual-ui/chip-with-icon.js.map +1 -1
- package/dist/components/manual-ui/chip-with-icon.mjs +6 -5
- package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -1
- package/dist/components/source-search-box/source-search-box.js +104 -72
- package/dist/components/source-search-box/source-search-box.js.map +1 -1
- package/dist/components/source-search-box/source-search-box.mjs +12 -6
- package/dist/components/source-search-box/source-search-box.mjs.map +1 -1
- package/dist/components/ui/button.js +56 -40
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/button.mjs +10 -4
- package/dist/components/ui/button.mjs.map +1 -1
- package/dist/components/ui/card.js +70 -50
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/card.mjs +18 -7
- package/dist/components/ui/card.mjs.map +1 -1
- package/dist/components/ui/command.js +139 -97
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/command.mjs +26 -5
- package/dist/components/ui/command.mjs.map +1 -1
- package/dist/components/ui/dialog.js +90 -69
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/dialog.mjs +21 -4
- package/dist/components/ui/dialog.mjs.map +1 -1
- package/dist/components/ui/label.js +55 -40
- package/dist/components/ui/label.js.map +1 -1
- package/dist/components/ui/label.mjs +9 -4
- package/dist/components/ui/label.mjs.map +1 -1
- package/dist/components/ui/separator.js +54 -39
- package/dist/components/ui/separator.js.map +1 -1
- package/dist/components/ui/separator.mjs +15 -8
- package/dist/components/ui/separator.mjs.map +1 -1
- package/dist/components/ui/textarea.js +50 -35
- package/dist/components/ui/textarea.js.map +1 -1
- package/dist/components/ui/textarea.mjs +13 -7
- package/dist/components/ui/textarea.mjs.map +1 -1
- package/dist/context/index.js +17 -2
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -2
- package/dist/context/index.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js +43 -18
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +10 -6
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js +50 -25
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +8 -4
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js +62 -29
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +9 -5
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map +1 -1
- package/dist/hooks/index.js +17 -2
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -2
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js +35 -11
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +8 -4
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js +38 -14
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +8 -4
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs.map +1 -1
- package/dist/hooks/misc/use-autosize-textarea.js +25 -7
- package/dist/hooks/misc/use-autosize-textarea.js.map +1 -1
- package/dist/hooks/misc/use-autosize-textarea.mjs +7 -3
- package/dist/hooks/misc/use-autosize-textarea.mjs.map +1 -1
- package/dist/index.js +422 -275
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -49
- package/dist/index.mjs.map +1 -1
- package/dist/lib/debouncer.js +27 -5
- package/dist/lib/debouncer.js.map +1 -1
- package/dist/lib/debouncer.mjs +7 -3
- package/dist/lib/debouncer.mjs.map +1 -1
- package/dist/lib/editor-to-text.js +30 -8
- package/dist/lib/editor-to-text.js.map +1 -1
- package/dist/lib/editor-to-text.mjs +7 -3
- package/dist/lib/editor-to-text.mjs.map +1 -1
- package/dist/lib/get-text-around-cursor.js +49 -24
- package/dist/lib/get-text-around-cursor.js.map +1 -1
- package/dist/lib/get-text-around-cursor.mjs +13 -3
- package/dist/lib/get-text-around-cursor.mjs.map +1 -1
- package/dist/lib/retry.js +27 -4
- package/dist/lib/retry.js.map +1 -1
- package/dist/lib/retry.mjs +7 -3
- package/dist/lib/retry.mjs.map +1 -1
- package/dist/lib/slatejs-edits/add-autocompletions.js +29 -7
- package/dist/lib/slatejs-edits/add-autocompletions.js.map +1 -1
- package/dist/lib/slatejs-edits/add-autocompletions.mjs +7 -3
- package/dist/lib/slatejs-edits/add-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.js +31 -9
- package/dist/lib/slatejs-edits/clear-autocompletions.js.map +1 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs +7 -3
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/replace-text.js +32 -10
- package/dist/lib/slatejs-edits/replace-text.js.map +1 -1
- package/dist/lib/slatejs-edits/replace-text.mjs +7 -3
- package/dist/lib/slatejs-edits/replace-text.mjs.map +1 -1
- package/dist/lib/slatejs-edits/with-partial-history.js +42 -19
- package/dist/lib/slatejs-edits/with-partial-history.js.map +1 -1
- package/dist/lib/slatejs-edits/with-partial-history.mjs +9 -3
- package/dist/lib/slatejs-edits/with-partial-history.mjs.map +1 -1
- package/dist/lib/stream-promise-flatten.js +27 -5
- package/dist/lib/stream-promise-flatten.js.map +1 -1
- package/dist/lib/stream-promise-flatten.mjs +7 -3
- package/dist/lib/stream-promise-flatten.mjs.map +1 -1
- package/dist/lib/utils.js +44 -16
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/utils.mjs +17 -3
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/lib/utils.test.js +1 -2
- package/dist/lib/utils.test.js.map +1 -1
- package/dist/lib/utils.test.mjs +0 -1
- package/dist/lib/utils.test.mjs.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js +17 -2
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs +0 -2
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.js +35 -9
- package/dist/types/autosuggestions-config/autosuggestions-config.js.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +12 -8
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.js +31 -6
- package/dist/types/autosuggestions-config/editing-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.mjs +11 -3
- package/dist/types/autosuggestions-config/editing-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/index.js +35 -9
- package/dist/types/autosuggestions-config/index.js.map +1 -1
- package/dist/types/autosuggestions-config/index.mjs +13 -9
- package/dist/types/autosuggestions-config/index.mjs.map +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.js +31 -6
- package/dist/types/autosuggestions-config/insertions-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.mjs +11 -3
- package/dist/types/autosuggestions-config/insertions-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js +17 -2
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs +0 -2
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js +17 -2
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs +0 -2
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs.map +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.js +31 -6
- package/dist/types/autosuggestions-config/suggestions-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs +11 -3
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs.map +1 -1
- package/dist/types/base/autosuggestion-state.js +17 -2
- package/dist/types/base/autosuggestion-state.js.map +1 -1
- package/dist/types/base/autosuggestion-state.mjs +0 -2
- package/dist/types/base/autosuggestion-state.mjs.map +1 -1
- package/dist/types/base/autosuggestions-bare-function.js +17 -2
- package/dist/types/base/autosuggestions-bare-function.js.map +1 -1
- package/dist/types/base/autosuggestions-bare-function.mjs +0 -2
- package/dist/types/base/autosuggestions-bare-function.mjs.map +1 -1
- package/dist/types/base/base-autosuggestions-config.js +29 -7
- package/dist/types/base/base-autosuggestions-config.js.map +1 -1
- package/dist/types/base/base-autosuggestions-config.mjs +7 -3
- package/dist/types/base/base-autosuggestions-config.mjs.map +1 -1
- package/dist/types/base/base-copilot-textarea-props.js +17 -2
- package/dist/types/base/base-copilot-textarea-props.js.map +1 -1
- package/dist/types/base/base-copilot-textarea-props.mjs +0 -2
- package/dist/types/base/base-copilot-textarea-props.mjs.map +1 -1
- package/dist/types/base/custom-editor.js +17 -2
- package/dist/types/base/custom-editor.js.map +1 -1
- package/dist/types/base/custom-editor.mjs +0 -2
- package/dist/types/base/custom-editor.mjs.map +1 -1
- package/dist/types/base/editor-autocomplete-state.js +32 -8
- package/dist/types/base/editor-autocomplete-state.js.map +1 -1
- package/dist/types/base/editor-autocomplete-state.mjs +8 -4
- package/dist/types/base/editor-autocomplete-state.mjs.map +1 -1
- package/dist/types/base/index.js +30 -6
- package/dist/types/base/index.js.map +1 -1
- package/dist/types/base/index.mjs +8 -4
- package/dist/types/base/index.mjs.map +1 -1
- package/dist/types/html-copilot-textarea-element.js +17 -2
- package/dist/types/html-copilot-textarea-element.js.map +1 -1
- package/dist/types/html-copilot-textarea-element.mjs +1 -2
- package/dist/types/html-copilot-textarea-element.mjs.map +1 -1
- package/dist/types/index.js +37 -10
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +18 -11
- package/dist/types/index.mjs.map +1 -1
- package/package.json +8 -8
|
@@ -1,36 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
|
|
1
|
+
import {
|
|
2
|
+
BaseCopilotTextarea
|
|
3
|
+
} from "../../chunk-B6TKVDDY.mjs";
|
|
4
|
+
import "../../chunk-DRV2FOHZ.mjs";
|
|
5
|
+
import "../../chunk-4NHVQZ67.mjs";
|
|
6
|
+
import "../../chunk-VPEH6V7T.mjs";
|
|
7
|
+
import "../../chunk-2C7O2EVM.mjs";
|
|
8
|
+
import "../../chunk-GQN2HYFJ.mjs";
|
|
9
|
+
import "../../chunk-5UNJXFUO.mjs";
|
|
10
|
+
import "../../chunk-72P3KOHZ.mjs";
|
|
11
|
+
import "../../chunk-JJLQVT7S.mjs";
|
|
12
|
+
import "../../chunk-LQ2OWQU7.mjs";
|
|
13
|
+
import "../../chunk-7LSRNPNI.mjs";
|
|
14
|
+
import "../../chunk-5J3UZV77.mjs";
|
|
15
|
+
import "../../chunk-L7VVZH4Q.mjs";
|
|
16
|
+
import "../../chunk-BBZ7AWOB.mjs";
|
|
17
|
+
import "../../chunk-VB4VNCIQ.mjs";
|
|
18
|
+
import "../../chunk-SX6NY5FW.mjs";
|
|
19
|
+
import "../../chunk-3PQ7GSFE.mjs";
|
|
20
|
+
import "../../chunk-WFTAAA7R.mjs";
|
|
21
|
+
import "../../chunk-KFQZHRPJ.mjs";
|
|
22
|
+
import "../../chunk-LYB4B6MK.mjs";
|
|
23
|
+
import "../../chunk-P4QVFRLY.mjs";
|
|
24
|
+
import "../../chunk-FJNUPSQK.mjs";
|
|
25
|
+
import "../../chunk-WTASPE2W.mjs";
|
|
26
|
+
import "../../chunk-PTZVE6NC.mjs";
|
|
27
|
+
import "../../chunk-2QDCE7PD.mjs";
|
|
28
|
+
import "../../chunk-7SUZ6CXM.mjs";
|
|
29
|
+
import "../../chunk-WJHSY5T6.mjs";
|
|
30
|
+
import "../../chunk-FP2EKU3L.mjs";
|
|
31
|
+
import "../../chunk-224UKA7C.mjs";
|
|
32
|
+
import "../../chunk-XW3ICO4S.mjs";
|
|
33
|
+
import "../../chunk-M2DR4KVB.mjs";
|
|
34
|
+
import "../../chunk-T6MTDQZ7.mjs";
|
|
35
|
+
import "../../chunk-ECR45NSD.mjs";
|
|
36
|
+
import "../../chunk-MRXNTQOX.mjs";
|
|
37
|
+
export {
|
|
38
|
+
BaseCopilotTextarea
|
|
39
|
+
};
|
|
36
40
|
//# sourceMappingURL=base-copilot-textarea.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
5
2
|
var __defProp = Object.defineProperty;
|
|
6
3
|
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
5
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
7
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
9
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -21,21 +20,42 @@ var __spreadValues = (a, b) => {
|
|
|
21
20
|
return a;
|
|
22
21
|
};
|
|
23
22
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __export = (target, all) => {
|
|
24
|
+
for (var name in all)
|
|
25
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
26
|
+
};
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
+
for (let key of __getOwnPropNames(from))
|
|
30
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
31
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
32
|
+
}
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
+
|
|
37
|
+
// src/components/base-copilot-textarea/render-element.tsx
|
|
38
|
+
var render_element_exports = {};
|
|
39
|
+
__export(render_element_exports, {
|
|
40
|
+
makeRenderElementFunction: () => makeRenderElementFunction
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(render_element_exports);
|
|
43
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
44
|
function makeRenderElementFunction(suggestionsStyle) {
|
|
25
45
|
return (props) => {
|
|
26
46
|
switch (props.element.type) {
|
|
27
47
|
case "paragraph":
|
|
28
|
-
return /* @__PURE__ */
|
|
48
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultElement, __spreadValues({}, props));
|
|
29
49
|
case "suggestion":
|
|
30
|
-
return /* @__PURE__ */
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SuggestionElement, __spreadProps(__spreadValues({}, props), { suggestionsStyle }));
|
|
31
51
|
}
|
|
32
52
|
};
|
|
33
53
|
}
|
|
34
54
|
var DefaultElement = (props) => {
|
|
35
|
-
return /* @__PURE__ */
|
|
55
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", __spreadProps(__spreadValues({}, props.attributes), { children: props.children }));
|
|
36
56
|
};
|
|
37
57
|
var SuggestionElement = (props) => {
|
|
38
|
-
return /* @__PURE__ */
|
|
58
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
39
59
|
"span",
|
|
40
60
|
__spreadProps(__spreadValues({}, props.attributes), {
|
|
41
61
|
style: __spreadValues({}, props.suggestionsStyle),
|
|
@@ -47,7 +67,8 @@ var SuggestionElement = (props) => {
|
|
|
47
67
|
})
|
|
48
68
|
);
|
|
49
69
|
};
|
|
50
|
-
|
|
51
|
-
exports
|
|
52
|
-
|
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
+
0 && (module.exports = {
|
|
72
|
+
makeRenderElementFunction
|
|
73
|
+
});
|
|
53
74
|
//# sourceMappingURL=render-element.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/base-copilot-textarea/render-element.tsx"],"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/base-copilot-textarea/render-element.tsx"],"sourcesContent":["import { RenderElementProps } from \"slate-react\";\n\nexport type RenderElementFunction = (props: RenderElementProps) => 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 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUe;AANR,SAAS,0BACd,kBACuB;AACvB,SAAO,CAAC,UAA8B;AACpC,YAAQ,MAAM,QAAQ,MAAM;AAAA,MAC1B,KAAK;AACH,eAAO,4CAAC,mCAAmB,MAAO;AAAA,MACpC,KAAK;AACH,eAAO,4CAAC,oDAAsB,QAAtB,EAA6B,mBAAoC;AAAA,IAC7E;AAAA,EACF;AACF;AAEA,IAAM,iBAAiB,CAAC,UAA8B;AACpD,SAAO,4CAAC,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,iBAAiB;AAAA,MAEhB;AAAA,cAAM;AAAA,QACN,MAAM,QAAQ,SAAS,gBAAgB,MAAM,QAAQ;AAAA;AAAA;AAAA,EACxD;AAEJ;","names":[]}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
makeRenderElementFunction
|
|
3
|
+
} from "../../chunk-224UKA7C.mjs";
|
|
4
|
+
import "../../chunk-MRXNTQOX.mjs";
|
|
5
|
+
export {
|
|
6
|
+
makeRenderElementFunction
|
|
7
|
+
};
|
|
4
8
|
//# sourceMappingURL=render-element.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
5
2
|
var __defProp = Object.defineProperty;
|
|
6
3
|
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
5
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
7
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
9
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -33,10 +32,31 @@ var __objRest = (source, exclude) => {
|
|
|
33
32
|
}
|
|
34
33
|
return target;
|
|
35
34
|
};
|
|
35
|
+
var __export = (target, all) => {
|
|
36
|
+
for (var name in all)
|
|
37
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
38
|
+
};
|
|
39
|
+
var __copyProps = (to, from, except, desc) => {
|
|
40
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
+
for (let key of __getOwnPropNames(from))
|
|
42
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
43
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
|
+
}
|
|
45
|
+
return to;
|
|
46
|
+
};
|
|
47
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
|
+
|
|
49
|
+
// src/components/base-copilot-textarea/render-placeholder.tsx
|
|
50
|
+
var render_placeholder_exports = {};
|
|
51
|
+
__export(render_placeholder_exports, {
|
|
52
|
+
makeRenderPlaceholderFunction: () => makeRenderPlaceholderFunction
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(render_placeholder_exports);
|
|
55
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
56
|
function makeRenderPlaceholderFunction(placeholderStyle) {
|
|
37
57
|
return (props) => {
|
|
38
58
|
const _a = props.attributes, { style } = _a, restAttributes = __objRest(_a, ["style"]);
|
|
39
|
-
return /* @__PURE__ */
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
40
60
|
"div",
|
|
41
61
|
__spreadProps(__spreadValues({}, restAttributes), {
|
|
42
62
|
style: __spreadValues(__spreadValues({}, style), placeholderStyle),
|
|
@@ -45,7 +65,8 @@ function makeRenderPlaceholderFunction(placeholderStyle) {
|
|
|
45
65
|
);
|
|
46
66
|
};
|
|
47
67
|
}
|
|
48
|
-
|
|
49
|
-
exports
|
|
50
|
-
|
|
68
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
+
0 && (module.exports = {
|
|
70
|
+
makeRenderPlaceholderFunction
|
|
71
|
+
});
|
|
51
72
|
//# sourceMappingURL=render-placeholder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/base-copilot-textarea/render-placeholder.tsx"],"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/base-copilot-textarea/render-placeholder.tsx"],"sourcesContent":["import { RenderPlaceholderProps } from \"slate-react\";\n\nexport type RenderPlaceholderFunction = (props: RenderPlaceholderProps) => JSX.Element;\n\nexport function makeRenderPlaceholderFunction(\n placeholderStyle?: React.CSSProperties,\n): RenderPlaceholderFunction {\n return (props: RenderPlaceholderProps) => {\n const { style, ...restAttributes } = props.attributes;\n\n return (\n <div\n {...restAttributes}\n style={{\n ...style,\n ...placeholderStyle,\n }}\n >\n {props.children}\n </div>\n );\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAWM;AAPC,SAAS,8BACd,kBAC2B;AAC3B,SAAO,CAAC,UAAkC;AACxC,UAAqC,WAAM,YAAnC,QARZ,IAQyC,IAAnB,2BAAmB,IAAnB,CAAV;AAER,WACE;AAAA,MAAC;AAAA,uCACK,iBADL;AAAA,QAEC,OAAO,kCACF,QACA;AAAA,QAGJ,gBAAM;AAAA;AAAA,IACT;AAAA,EAEJ;AACF;","names":[]}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
makeRenderPlaceholderFunction
|
|
3
|
+
} from "../../chunk-XW3ICO4S.mjs";
|
|
4
|
+
import "../../chunk-MRXNTQOX.mjs";
|
|
5
|
+
export {
|
|
6
|
+
makeRenderPlaceholderFunction
|
|
7
|
+
};
|
|
4
8
|
//# sourceMappingURL=render-placeholder.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,15 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
7
19
|
|
|
8
20
|
// src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx
|
|
21
|
+
var track_cursor_moved_since_last_text_change_exports = {};
|
|
22
|
+
__export(track_cursor_moved_since_last_text_change_exports, {
|
|
23
|
+
TrackerTextEditedSinceLastCursorMovement: () => TrackerTextEditedSinceLastCursorMovement
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(track_cursor_moved_since_last_text_change_exports);
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_slate_react = require("slate-react");
|
|
28
|
+
var import_slate2 = require("slate");
|
|
29
|
+
|
|
30
|
+
// src/lib/editor-to-text.ts
|
|
31
|
+
var import_slate = require("slate");
|
|
9
32
|
function nodeChildrenToTextComponents(editor, nodes) {
|
|
10
33
|
const indeciesOfInlineElements = new Set(
|
|
11
34
|
nodes.map((node, index) => {
|
|
12
|
-
if (
|
|
35
|
+
if (import_slate.Element.isElement(node) && editor.isInline(node)) {
|
|
13
36
|
return index;
|
|
14
37
|
}
|
|
15
38
|
return -1;
|
|
@@ -27,7 +50,7 @@ function nodeChildrenToTextComponents(editor, nodes) {
|
|
|
27
50
|
return true;
|
|
28
51
|
});
|
|
29
52
|
return nonIgnorableItems.map((node) => {
|
|
30
|
-
if (
|
|
53
|
+
if (import_slate.Element.isElement(node)) {
|
|
31
54
|
switch (node.type) {
|
|
32
55
|
case "paragraph":
|
|
33
56
|
return nodeChildrenToTextComponents(editor, node.children);
|
|
@@ -44,13 +67,16 @@ var editorToText = (editor) => {
|
|
|
44
67
|
const text = flattened.map((textComponent) => textComponent.text).join("\n");
|
|
45
68
|
return text;
|
|
46
69
|
};
|
|
70
|
+
|
|
71
|
+
// src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx
|
|
72
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
47
73
|
function TrackerTextEditedSinceLastCursorMovement(props) {
|
|
48
|
-
const cursorState =
|
|
74
|
+
const cursorState = (0, import_slate_react.useSlateSelector)((state) => ({
|
|
49
75
|
selection: state.selection,
|
|
50
76
|
text: editorToText(state)
|
|
51
77
|
}));
|
|
52
78
|
const previousState = usePrevious(cursorState);
|
|
53
|
-
|
|
79
|
+
(0, import_react.useEffect)(() => {
|
|
54
80
|
if (!previousState) {
|
|
55
81
|
return;
|
|
56
82
|
}
|
|
@@ -58,7 +84,7 @@ function TrackerTextEditedSinceLastCursorMovement(props) {
|
|
|
58
84
|
props.setCursorMovedSinceLastTextChange(true);
|
|
59
85
|
}
|
|
60
86
|
}, [props.setCursorMovedSinceLastTextChange, cursorState]);
|
|
61
|
-
return /* @__PURE__ */
|
|
87
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
62
88
|
}
|
|
63
89
|
var cursorChangedWithoutTextChanged = (prev, next) => {
|
|
64
90
|
const isSelectionChanged = !isSelectionEqual(prev.selection, next.selection);
|
|
@@ -70,16 +96,17 @@ var isSelectionEqual = (a, b) => {
|
|
|
70
96
|
return true;
|
|
71
97
|
if (!a || !b)
|
|
72
98
|
return false;
|
|
73
|
-
return
|
|
99
|
+
return import_slate2.Range.equals(a, b);
|
|
74
100
|
};
|
|
75
101
|
function usePrevious(value) {
|
|
76
|
-
const ref =
|
|
77
|
-
|
|
102
|
+
const ref = (0, import_react.useRef)();
|
|
103
|
+
(0, import_react.useEffect)(() => {
|
|
78
104
|
ref.current = value;
|
|
79
105
|
});
|
|
80
106
|
return ref.current;
|
|
81
107
|
}
|
|
82
|
-
|
|
83
|
-
exports
|
|
84
|
-
|
|
108
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
109
|
+
0 && (module.exports = {
|
|
110
|
+
TrackerTextEditedSinceLastCursorMovement
|
|
111
|
+
});
|
|
85
112
|
//# sourceMappingURL=track-cursor-moved-since-last-text-change.js.map
|
package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx","../../../src/lib/editor-to-text.ts"],"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx","../../../src/lib/editor-to-text.ts"],"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>();\n\n useEffect(() => {\n ref.current = value;\n });\n\n return ref.current;\n}\n","import { BaseEditor, Descendant, Element } from \"slate\";\nimport { HistoryEditor } from \"slate-history\";\nimport { ReactEditor } from \"slate-react\";\nimport { SuggestionAwareText } from \"../types/base/custom-editor\";\n\nfunction nodeChildrenToTextComponents(\n editor: BaseEditor & ReactEditor & HistoryEditor,\n nodes: Descendant[],\n): SuggestionAwareText[] {\n // find inlineable elements\n const indeciesOfInlineElements = new Set(\n nodes\n .map((node, index) => {\n if (Element.isElement(node) && editor.isInline(node)) {\n return index;\n }\n return -1;\n })\n .filter((index) => index !== -1),\n );\n\n // ignorable elements = inline elements,\n // or neighbors of inline elements that are {text: \"\"}\n const nonIgnorableItems = nodes.filter((node, index) => {\n const isInline = indeciesOfInlineElements.has(index);\n if (isInline) {\n return false;\n }\n\n const isNeighbourOfInline =\n indeciesOfInlineElements.has(index - 1) || indeciesOfInlineElements.has(index + 1);\n if (isNeighbourOfInline) {\n return (node as any).text !== \"\";\n }\n\n return true;\n });\n\n return nonIgnorableItems\n .map((node) => {\n if (Element.isElement(node)) {\n switch (node.type) {\n case \"paragraph\":\n return nodeChildrenToTextComponents(editor, node.children);\n case \"suggestion\":\n return [];\n }\n } else {\n return [node];\n }\n })\n .reduce((acc, val) => acc.concat(val), []);\n}\n\nexport const editorToText = (editor: BaseEditor & ReactEditor & HistoryEditor) => {\n const flattened = nodeChildrenToTextComponents(editor, editor.children);\n\n const text = flattened.map((textComponent) => textComponent.text).join(\"\\n\");\n\n return text;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkC;AAElC,yBAAiC;AACjC,IAAAA,gBAAsB;;;ACHtB,mBAAgD;AAKhD,SAAS,6BACP,QACA,OACuB;AAEvB,QAAM,2BAA2B,IAAI;AAAA,IACnC,MACG,IAAI,CAAC,MAAM,UAAU;AACpB,UAAI,qBAAQ,UAAU,IAAI,KAAK,OAAO,SAAS,IAAI,GAAG;AACpD,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT,CAAC,EACA,OAAO,CAAC,UAAU,UAAU,EAAE;AAAA,EACnC;AAIA,QAAM,oBAAoB,MAAM,OAAO,CAAC,MAAM,UAAU;AACtD,UAAM,WAAW,yBAAyB,IAAI,KAAK;AACnD,QAAI,UAAU;AACZ,aAAO;AAAA,IACT;AAEA,UAAM,sBACJ,yBAAyB,IAAI,QAAQ,CAAC,KAAK,yBAAyB,IAAI,QAAQ,CAAC;AACnF,QAAI,qBAAqB;AACvB,aAAQ,KAAa,SAAS;AAAA,IAChC;AAEA,WAAO;AAAA,EACT,CAAC;AAED,SAAO,kBACJ,IAAI,CAAC,SAAS;AACb,QAAI,qBAAQ,UAAU,IAAI,GAAG;AAC3B,cAAQ,KAAK,MAAM;AAAA,QACjB,KAAK;AACH,iBAAO,6BAA6B,QAAQ,KAAK,QAAQ;AAAA,QAC3D,KAAK;AACH,iBAAO,CAAC;AAAA,MACZ;AAAA,IACF,OAAO;AACL,aAAO,CAAC,IAAI;AAAA,IACd;AAAA,EACF,CAAC,EACA,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,GAAG,GAAG,CAAC,CAAC;AAC7C;AAEO,IAAM,eAAe,CAAC,WAAqD;AAChF,QAAM,YAAY,6BAA6B,QAAQ,OAAO,QAAQ;AAEtE,QAAM,OAAO,UAAU,IAAI,CAAC,kBAAkB,cAAc,IAAI,EAAE,KAAK,IAAI;AAE3E,SAAO;AACT;;;AD/BS;AApBF,SAAS,yCACd,OACA;AACA,QAAM,kBAAmC,qCAAiB,CAAC,WAAW;AAAA,IACpE,WAAW,MAAM;AAAA,IACjB,MAAM,aAAa,KAAK;AAAA,EAC1B,EAAE;AAEF,QAAM,gBAAgB,YAAY,WAAW;AAE7C,8BAAU,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,2EAAE;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,oBAAM,OAAO,GAAG,CAAC;AAC1B;AAiBA,SAAS,YAAe,OAAyB;AAC/C,QAAM,UAAM,qBAAU;AAEtB,8BAAU,MAAM;AACd,QAAI,UAAU;AAAA,EAChB,CAAC;AAED,SAAO,IAAI;AACb;","names":["import_slate"]}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
TrackerTextEditedSinceLastCursorMovement
|
|
3
|
+
} from "../../chunk-LQ2OWQU7.mjs";
|
|
4
|
+
import "../../chunk-T6MTDQZ7.mjs";
|
|
5
|
+
import "../../chunk-MRXNTQOX.mjs";
|
|
6
|
+
export {
|
|
7
|
+
TrackerTextEditedSinceLastCursorMovement
|
|
8
|
+
};
|
|
5
9
|
//# sourceMappingURL=track-cursor-moved-since-last-text-change.mjs.map
|
package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,11 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
4
19
|
|
|
5
20
|
// src/components/base-copilot-textarea/use-add-branding-css.tsx
|
|
21
|
+
var use_add_branding_css_exports = {};
|
|
22
|
+
__export(use_add_branding_css_exports, {
|
|
23
|
+
useAddBrandingCss: () => useAddBrandingCss
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(use_add_branding_css_exports);
|
|
26
|
+
var import_react = require("react");
|
|
6
27
|
function useAddBrandingCss(suggestionStyleAugmented, disableBranding) {
|
|
7
28
|
const cssSelector = ".copilot-textarea.with-branding";
|
|
8
|
-
|
|
29
|
+
(0, import_react.useEffect)(() => {
|
|
9
30
|
if (disableBranding) {
|
|
10
31
|
return;
|
|
11
32
|
}
|
|
@@ -55,7 +76,8 @@ function useAddBrandingCss(suggestionStyleAugmented, disableBranding) {
|
|
|
55
76
|
};
|
|
56
77
|
}, [disableBranding, suggestionStyleAugmented]);
|
|
57
78
|
}
|
|
58
|
-
|
|
59
|
-
exports
|
|
60
|
-
|
|
79
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
+
0 && (module.exports = {
|
|
81
|
+
useAddBrandingCss
|
|
82
|
+
});
|
|
61
83
|
//# sourceMappingURL=use-add-branding-css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/base-copilot-textarea/use-add-branding-css.tsx"],"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/base-copilot-textarea/use-add-branding-css.tsx"],"sourcesContent":["import { useEffect } from \"react\";\n\nexport function useAddBrandingCss(\n suggestionStyleAugmented: React.CSSProperties,\n disableBranding: boolean | undefined,\n) {\n const cssSelector = \".copilot-textarea.with-branding\";\n useEffect(() => {\n if (disableBranding) {\n return;\n }\n\n // ---\n // 1: Add the CSS to the DOM\n const styleEl = document.createElement(\"style\");\n styleEl.id = \"dynamic-styles\";\n\n // Build the CSS string dynamically\n let dynamicStyles = Object.entries(suggestionStyleAugmented)\n .map(([key, value]) => {\n const kebabCaseKey = key.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, \"$1-$2\").toLowerCase();\n return `${kebabCaseKey}: ${value};`;\n })\n .join(\" \");\n\n // Append overrides for italics and font-size\n dynamicStyles += `font-style: normal; font-size: x-small;`;\n dynamicStyles += `content: \"CopilotKit\";`;\n dynamicStyles += `bottom: 6px;`;\n dynamicStyles += `right: 6px;`;\n dynamicStyles += `pointer-events: none;`;\n dynamicStyles += `font-weight: 200;`;\n dynamicStyles += `padding: 0;`;\n dynamicStyles += `margin: 0;`;\n dynamicStyles += `border: 0;`;\n dynamicStyles += `line-height: 1;`;\n dynamicStyles += `position: absolute;`;\n\n // Append it to the ::after class\n styleEl.innerHTML = `\n ${cssSelector}::after {\n ${dynamicStyles}\n }\n `;\n\n document.head.appendChild(styleEl);\n\n // ---\n // 2: Add the scroll listener (to keep the branding in the bottom right as the textarea scrolls)\n const textarea = document.querySelector(cssSelector);\n const handleScroll = () => {\n const styleEl = document.getElementById(\"dynamic-styles\");\n if (styleEl && textarea) {\n const offsetFromBottom = -textarea.scrollTop + 6;\n const offsetFromRight = -textarea.scrollLeft + 6;\n styleEl.innerHTML = `\n ${cssSelector}::after {\n ${dynamicStyles}\n bottom: ${offsetFromBottom}px;\n right: ${offsetFromRight}px;\n }\n `;\n }\n };\n\n textarea?.addEventListener(\"scroll\", handleScroll);\n\n // Cleanup\n return () => {\n document.getElementById(\"dynamic-styles\")?.remove();\n textarea?.removeEventListener(\"scroll\", handleScroll);\n };\n }, [disableBranding, suggestionStyleAugmented]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAEnB,SAAS,kBACd,0BACA,iBACA;AACA,QAAM,cAAc;AACpB,8BAAU,MAAM;AACd,QAAI,iBAAiB;AACnB;AAAA,IACF;AAIA,UAAM,UAAU,SAAS,cAAc,OAAO;AAC9C,YAAQ,KAAK;AAGb,QAAI,gBAAgB,OAAO,QAAQ,wBAAwB,EACxD,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AACrB,YAAM,eAAe,IAAI,QAAQ,gCAAgC,OAAO,EAAE,YAAY;AACtF,aAAO,GAAG,iBAAiB;AAAA,IAC7B,CAAC,EACA,KAAK,GAAG;AAGX,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AACjB,qBAAiB;AAGjB,YAAQ,YAAY;AAAA,QAChB;AAAA,UACE;AAAA;AAAA;AAIN,aAAS,KAAK,YAAY,OAAO;AAIjC,UAAM,WAAW,SAAS,cAAc,WAAW;AACnD,UAAM,eAAe,MAAM;AACzB,YAAMA,WAAU,SAAS,eAAe,gBAAgB;AACxD,UAAIA,YAAW,UAAU;AACvB,cAAM,mBAAmB,CAAC,SAAS,YAAY;AAC/C,cAAM,kBAAkB,CAAC,SAAS,aAAa;AAC/C,QAAAA,SAAQ,YAAY;AAAA,YAChB;AAAA,cACE;AAAA,sBACQ;AAAA,qBACD;AAAA;AAAA;AAAA,MAGf;AAAA,IACF;AAEA,yCAAU,iBAAiB,UAAU;AAGrC,WAAO,MAAM;AApEjB;AAqEM,qBAAS,eAAe,gBAAgB,MAAxC,mBAA2C;AAC3C,2CAAU,oBAAoB,UAAU;AAAA,IAC1C;AAAA,EACF,GAAG,CAAC,iBAAiB,wBAAwB,CAAC;AAChD;","names":["styleEl"]}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
useAddBrandingCss
|
|
3
|
+
} from "../../chunk-7LSRNPNI.mjs";
|
|
4
|
+
import "../../chunk-MRXNTQOX.mjs";
|
|
5
|
+
export {
|
|
6
|
+
useAddBrandingCss
|
|
7
|
+
};
|
|
4
8
|
//# sourceMappingURL=use-add-branding-css.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|