@copilotkit/react-textarea 0.28.0-alpha.7 → 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 +24 -0
- package/dist/chunk-224UKA7C.mjs +9 -4
- package/dist/chunk-224UKA7C.mjs.map +1 -1
- package/dist/chunk-2C7O2EVM.mjs +4 -4
- package/dist/chunk-2C7O2EVM.mjs.map +1 -1
- package/dist/chunk-2QDCE7PD.mjs +6 -3
- package/dist/chunk-2QDCE7PD.mjs.map +1 -1
- package/dist/chunk-3PQ7GSFE.mjs +4 -4
- package/dist/chunk-3PQ7GSFE.mjs.map +1 -1
- package/dist/chunk-4NHVQZ67.mjs +6 -5
- package/dist/chunk-4NHVQZ67.mjs.map +1 -1
- package/dist/chunk-4OJ3H65F.mjs +5 -2
- package/dist/chunk-4OJ3H65F.mjs.map +1 -1
- package/dist/chunk-5J3UZV77.mjs +23 -11
- package/dist/chunk-5J3UZV77.mjs.map +1 -1
- package/dist/chunk-5UNJXFUO.mjs +4 -4
- package/dist/chunk-5UNJXFUO.mjs.map +1 -1
- package/dist/chunk-72P3KOHZ.mjs +17 -7
- package/dist/chunk-72P3KOHZ.mjs.map +1 -1
- package/dist/chunk-7LSRNPNI.mjs +4 -4
- package/dist/chunk-7LSRNPNI.mjs.map +1 -1
- package/dist/chunk-7SUZ6CXM.mjs +15 -6
- package/dist/chunk-7SUZ6CXM.mjs.map +1 -1
- package/dist/chunk-AZHILHKM.mjs +21 -8
- package/dist/chunk-AZHILHKM.mjs.map +1 -1
- package/dist/chunk-B6TKVDDY.mjs +58 -22
- package/dist/chunk-B6TKVDDY.mjs.map +1 -1
- package/dist/chunk-BBZ7AWOB.mjs +8 -4
- package/dist/chunk-BBZ7AWOB.mjs.map +1 -1
- package/dist/chunk-DE5K76I2.mjs +0 -2
- package/dist/chunk-DE5K76I2.mjs.map +1 -1
- package/dist/chunk-DRV2FOHZ.mjs +11 -6
- package/dist/chunk-DRV2FOHZ.mjs.map +1 -1
- package/dist/chunk-ECR45NSD.mjs +7 -4
- package/dist/chunk-ECR45NSD.mjs.map +1 -1
- package/dist/chunk-FJNUPSQK.mjs +16 -5
- package/dist/chunk-FJNUPSQK.mjs.map +1 -1
- package/dist/chunk-FP2EKU3L.mjs +4 -4
- package/dist/chunk-FP2EKU3L.mjs.map +1 -1
- package/dist/chunk-GQN2HYFJ.mjs +4 -4
- package/dist/chunk-GQN2HYFJ.mjs.map +1 -1
- package/dist/chunk-H4VKQGVU.mjs +0 -2
- package/dist/chunk-H4VKQGVU.mjs.map +1 -1
- package/dist/chunk-IU3WTXLQ.mjs +0 -2
- package/dist/chunk-IU3WTXLQ.mjs.map +1 -1
- package/dist/chunk-JJLQVT7S.mjs +6 -3
- package/dist/chunk-JJLQVT7S.mjs.map +1 -1
- package/dist/chunk-KDVMG3XF.mjs +5 -2
- package/dist/chunk-KDVMG3XF.mjs.map +1 -1
- package/dist/chunk-KFQZHRPJ.mjs +15 -8
- package/dist/chunk-KFQZHRPJ.mjs.map +1 -1
- package/dist/chunk-KNQIEOFP.mjs +3 -2
- package/dist/chunk-KNQIEOFP.mjs.map +1 -1
- package/dist/chunk-L7VVZH4Q.mjs +0 -2
- package/dist/chunk-L7VVZH4Q.mjs.map +1 -1
- package/dist/chunk-LQ2OWQU7.mjs +11 -7
- package/dist/chunk-LQ2OWQU7.mjs.map +1 -1
- package/dist/chunk-LYB4B6MK.mjs +6 -5
- package/dist/chunk-LYB4B6MK.mjs.map +1 -1
- package/dist/chunk-M2DR4KVB.mjs +6 -3
- package/dist/chunk-M2DR4KVB.mjs.map +1 -1
- package/dist/chunk-MMVDU6DF.mjs +0 -2
- package/dist/chunk-MMVDU6DF.mjs.map +1 -1
- package/dist/chunk-MRXNTQOX.mjs +6 -2
- package/dist/chunk-MRXNTQOX.mjs.map +1 -1
- package/dist/chunk-P4QVFRLY.mjs +17 -7
- package/dist/chunk-P4QVFRLY.mjs.map +1 -1
- package/dist/chunk-PTZVE6NC.mjs +22 -8
- package/dist/chunk-PTZVE6NC.mjs.map +1 -1
- package/dist/chunk-QCPS6IYI.mjs +15 -6
- package/dist/chunk-QCPS6IYI.mjs.map +1 -1
- package/dist/chunk-RKQ6RTZM.mjs +5 -2
- package/dist/chunk-RKQ6RTZM.mjs.map +1 -1
- package/dist/chunk-RT4UTBH3.mjs +15 -6
- package/dist/chunk-RT4UTBH3.mjs.map +1 -1
- package/dist/chunk-RUV6NBIF.mjs +0 -2
- package/dist/chunk-RUV6NBIF.mjs.map +1 -1
- package/dist/chunk-SNQEBH5I.mjs +24 -10
- package/dist/chunk-SNQEBH5I.mjs.map +1 -1
- package/dist/chunk-SX6NY5FW.mjs +11 -6
- package/dist/chunk-SX6NY5FW.mjs.map +1 -1
- package/dist/chunk-T6MTDQZ7.mjs +4 -4
- package/dist/chunk-T6MTDQZ7.mjs.map +1 -1
- package/dist/chunk-VB4VNCIQ.mjs +28 -12
- package/dist/chunk-VB4VNCIQ.mjs.map +1 -1
- package/dist/chunk-VPEH6V7T.mjs +12 -6
- package/dist/chunk-VPEH6V7T.mjs.map +1 -1
- package/dist/chunk-WADHCMPK.mjs +0 -2
- package/dist/chunk-WADHCMPK.mjs.map +1 -1
- package/dist/chunk-WFTAAA7R.mjs +16 -8
- package/dist/chunk-WFTAAA7R.mjs.map +1 -1
- package/dist/chunk-WJHSY5T6.mjs +0 -2
- package/dist/chunk-WJHSY5T6.mjs.map +1 -1
- package/dist/chunk-WTASPE2W.mjs +41 -22
- package/dist/chunk-WTASPE2W.mjs.map +1 -1
- package/dist/chunk-XW3ICO4S.mjs +10 -4
- package/dist/chunk-XW3ICO4S.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js +379 -257
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +39 -35
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-element.js +32 -11
- package/dist/components/base-copilot-textarea/render-element.js.map +1 -1
- package/dist/components/base-copilot-textarea/render-element.mjs +7 -3
- package/dist/components/base-copilot-textarea/render-element.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.js +29 -8
- package/dist/components/base-copilot-textarea/render-placeholder.js.map +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.mjs +7 -3
- package/dist/components/base-copilot-textarea/render-placeholder.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js +44 -17
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js.map +1 -1
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +8 -4
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/use-add-branding-css.js +29 -7
- package/dist/components/base-copilot-textarea/use-add-branding-css.js.map +1 -1
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +7 -3
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.js +414 -272
- package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.mjs +48 -44
- package/dist/components/copilot-textarea/copilot-textarea.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.js +35 -12
- package/dist/components/hovering-toolbar/hovering-editor-provider.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +9 -3
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js +66 -36
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +15 -3
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.js +247 -179
- package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +22 -18
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +180 -129
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +16 -12
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +185 -131
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +17 -13
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js +71 -55
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +11 -5
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +185 -131
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +18 -14
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +1 -1
- package/dist/components/index.js +418 -273
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +52 -45
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/manual-ui/chip-with-icon.js +31 -9
- package/dist/components/manual-ui/chip-with-icon.js.map +1 -1
- package/dist/components/manual-ui/chip-with-icon.mjs +6 -5
- package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -1
- package/dist/components/source-search-box/source-search-box.js +104 -72
- package/dist/components/source-search-box/source-search-box.js.map +1 -1
- package/dist/components/source-search-box/source-search-box.mjs +12 -6
- package/dist/components/source-search-box/source-search-box.mjs.map +1 -1
- package/dist/components/ui/button.js +56 -40
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/button.mjs +10 -4
- package/dist/components/ui/button.mjs.map +1 -1
- package/dist/components/ui/card.js +70 -50
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/card.mjs +18 -7
- package/dist/components/ui/card.mjs.map +1 -1
- package/dist/components/ui/command.js +139 -97
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/command.mjs +26 -5
- package/dist/components/ui/command.mjs.map +1 -1
- package/dist/components/ui/dialog.js +90 -69
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/dialog.mjs +21 -4
- package/dist/components/ui/dialog.mjs.map +1 -1
- package/dist/components/ui/label.js +55 -40
- package/dist/components/ui/label.js.map +1 -1
- package/dist/components/ui/label.mjs +9 -4
- package/dist/components/ui/label.mjs.map +1 -1
- package/dist/components/ui/separator.js +54 -39
- package/dist/components/ui/separator.js.map +1 -1
- package/dist/components/ui/separator.mjs +15 -8
- package/dist/components/ui/separator.mjs.map +1 -1
- package/dist/components/ui/textarea.js +50 -35
- package/dist/components/ui/textarea.js.map +1 -1
- package/dist/components/ui/textarea.mjs +13 -7
- package/dist/components/ui/textarea.mjs.map +1 -1
- package/dist/context/index.js +17 -2
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -2
- package/dist/context/index.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js +43 -18
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +10 -6
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js +50 -25
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +8 -4
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js +62 -29
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +9 -5
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map +1 -1
- package/dist/hooks/index.js +17 -2
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -2
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js +35 -11
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +8 -4
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js +38 -14
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +8 -4
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs.map +1 -1
- package/dist/hooks/misc/use-autosize-textarea.js +25 -7
- package/dist/hooks/misc/use-autosize-textarea.js.map +1 -1
- package/dist/hooks/misc/use-autosize-textarea.mjs +7 -3
- package/dist/hooks/misc/use-autosize-textarea.mjs.map +1 -1
- package/dist/index.js +422 -275
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -49
- package/dist/index.mjs.map +1 -1
- package/dist/lib/debouncer.js +27 -5
- package/dist/lib/debouncer.js.map +1 -1
- package/dist/lib/debouncer.mjs +7 -3
- package/dist/lib/debouncer.mjs.map +1 -1
- package/dist/lib/editor-to-text.js +30 -8
- package/dist/lib/editor-to-text.js.map +1 -1
- package/dist/lib/editor-to-text.mjs +7 -3
- package/dist/lib/editor-to-text.mjs.map +1 -1
- package/dist/lib/get-text-around-cursor.js +49 -24
- package/dist/lib/get-text-around-cursor.js.map +1 -1
- package/dist/lib/get-text-around-cursor.mjs +13 -3
- package/dist/lib/get-text-around-cursor.mjs.map +1 -1
- package/dist/lib/retry.js +27 -4
- package/dist/lib/retry.js.map +1 -1
- package/dist/lib/retry.mjs +7 -3
- package/dist/lib/retry.mjs.map +1 -1
- package/dist/lib/slatejs-edits/add-autocompletions.js +29 -7
- package/dist/lib/slatejs-edits/add-autocompletions.js.map +1 -1
- package/dist/lib/slatejs-edits/add-autocompletions.mjs +7 -3
- package/dist/lib/slatejs-edits/add-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.js +31 -9
- package/dist/lib/slatejs-edits/clear-autocompletions.js.map +1 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs +7 -3
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/replace-text.js +32 -10
- package/dist/lib/slatejs-edits/replace-text.js.map +1 -1
- package/dist/lib/slatejs-edits/replace-text.mjs +7 -3
- package/dist/lib/slatejs-edits/replace-text.mjs.map +1 -1
- package/dist/lib/slatejs-edits/with-partial-history.js +42 -19
- package/dist/lib/slatejs-edits/with-partial-history.js.map +1 -1
- package/dist/lib/slatejs-edits/with-partial-history.mjs +9 -3
- package/dist/lib/slatejs-edits/with-partial-history.mjs.map +1 -1
- package/dist/lib/stream-promise-flatten.js +27 -5
- package/dist/lib/stream-promise-flatten.js.map +1 -1
- package/dist/lib/stream-promise-flatten.mjs +7 -3
- package/dist/lib/stream-promise-flatten.mjs.map +1 -1
- package/dist/lib/utils.js +44 -16
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/utils.mjs +17 -3
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/lib/utils.test.js +1 -2
- package/dist/lib/utils.test.js.map +1 -1
- package/dist/lib/utils.test.mjs +0 -1
- package/dist/lib/utils.test.mjs.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js +17 -2
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs +0 -2
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.mjs.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.js +35 -9
- package/dist/types/autosuggestions-config/autosuggestions-config.js.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +12 -8
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.js +31 -6
- package/dist/types/autosuggestions-config/editing-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.mjs +11 -3
- package/dist/types/autosuggestions-config/editing-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/index.js +35 -9
- package/dist/types/autosuggestions-config/index.js.map +1 -1
- package/dist/types/autosuggestions-config/index.mjs +13 -9
- package/dist/types/autosuggestions-config/index.mjs.map +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.js +31 -6
- package/dist/types/autosuggestions-config/insertions-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.mjs +11 -3
- package/dist/types/autosuggestions-config/insertions-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js +17 -2
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs +0 -2
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.mjs.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js +17 -2
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.js.map +1 -1
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs +0 -2
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.mjs.map +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.js +31 -6
- package/dist/types/autosuggestions-config/suggestions-api-config.js.map +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs +11 -3
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs.map +1 -1
- package/dist/types/base/autosuggestion-state.js +17 -2
- package/dist/types/base/autosuggestion-state.js.map +1 -1
- package/dist/types/base/autosuggestion-state.mjs +0 -2
- package/dist/types/base/autosuggestion-state.mjs.map +1 -1
- package/dist/types/base/autosuggestions-bare-function.js +17 -2
- package/dist/types/base/autosuggestions-bare-function.js.map +1 -1
- package/dist/types/base/autosuggestions-bare-function.mjs +0 -2
- package/dist/types/base/autosuggestions-bare-function.mjs.map +1 -1
- package/dist/types/base/base-autosuggestions-config.js +29 -7
- package/dist/types/base/base-autosuggestions-config.js.map +1 -1
- package/dist/types/base/base-autosuggestions-config.mjs +7 -3
- package/dist/types/base/base-autosuggestions-config.mjs.map +1 -1
- package/dist/types/base/base-copilot-textarea-props.js +17 -2
- package/dist/types/base/base-copilot-textarea-props.js.map +1 -1
- package/dist/types/base/base-copilot-textarea-props.mjs +0 -2
- package/dist/types/base/base-copilot-textarea-props.mjs.map +1 -1
- package/dist/types/base/custom-editor.js +17 -2
- package/dist/types/base/custom-editor.js.map +1 -1
- package/dist/types/base/custom-editor.mjs +0 -2
- package/dist/types/base/custom-editor.mjs.map +1 -1
- package/dist/types/base/editor-autocomplete-state.js +32 -8
- package/dist/types/base/editor-autocomplete-state.js.map +1 -1
- package/dist/types/base/editor-autocomplete-state.mjs +8 -4
- package/dist/types/base/editor-autocomplete-state.mjs.map +1 -1
- package/dist/types/base/index.js +30 -6
- package/dist/types/base/index.js.map +1 -1
- package/dist/types/base/index.mjs +8 -4
- package/dist/types/base/index.mjs.map +1 -1
- package/dist/types/html-copilot-textarea-element.js +17 -2
- package/dist/types/html-copilot-textarea-element.js.map +1 -1
- package/dist/types/html-copilot-textarea-element.mjs +1 -2
- package/dist/types/html-copilot-textarea-element.mjs.map +1 -1
- package/dist/types/index.js +37 -10
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +18 -11
- package/dist/types/index.mjs.map +1 -1
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -1,50 +1,63 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
import
|
|
49
|
-
|
|
1
|
+
import "./chunk-DE5K76I2.mjs";
|
|
2
|
+
import "./chunk-WADHCMPK.mjs";
|
|
3
|
+
import "./chunk-MMVDU6DF.mjs";
|
|
4
|
+
import {
|
|
5
|
+
CopilotTextarea
|
|
6
|
+
} from "./chunk-SNQEBH5I.mjs";
|
|
7
|
+
import "./chunk-RT4UTBH3.mjs";
|
|
8
|
+
import "./chunk-QCPS6IYI.mjs";
|
|
9
|
+
import "./chunk-RUV6NBIF.mjs";
|
|
10
|
+
import {
|
|
11
|
+
defaultAutosuggestionsConfig
|
|
12
|
+
} from "./chunk-AZHILHKM.mjs";
|
|
13
|
+
import "./chunk-4OJ3H65F.mjs";
|
|
14
|
+
import "./chunk-RKQ6RTZM.mjs";
|
|
15
|
+
import "./chunk-KDVMG3XF.mjs";
|
|
16
|
+
import {
|
|
17
|
+
BaseCopilotTextarea
|
|
18
|
+
} from "./chunk-B6TKVDDY.mjs";
|
|
19
|
+
import "./chunk-DRV2FOHZ.mjs";
|
|
20
|
+
import "./chunk-4NHVQZ67.mjs";
|
|
21
|
+
import "./chunk-VPEH6V7T.mjs";
|
|
22
|
+
import "./chunk-2C7O2EVM.mjs";
|
|
23
|
+
import "./chunk-GQN2HYFJ.mjs";
|
|
24
|
+
import "./chunk-5UNJXFUO.mjs";
|
|
25
|
+
import "./chunk-72P3KOHZ.mjs";
|
|
26
|
+
import "./chunk-JJLQVT7S.mjs";
|
|
27
|
+
import "./chunk-LQ2OWQU7.mjs";
|
|
28
|
+
import "./chunk-7LSRNPNI.mjs";
|
|
29
|
+
import "./chunk-5J3UZV77.mjs";
|
|
30
|
+
import "./chunk-L7VVZH4Q.mjs";
|
|
31
|
+
import "./chunk-BBZ7AWOB.mjs";
|
|
32
|
+
import "./chunk-VB4VNCIQ.mjs";
|
|
33
|
+
import "./chunk-SX6NY5FW.mjs";
|
|
34
|
+
import "./chunk-3PQ7GSFE.mjs";
|
|
35
|
+
import "./chunk-WFTAAA7R.mjs";
|
|
36
|
+
import "./chunk-KFQZHRPJ.mjs";
|
|
37
|
+
import "./chunk-LYB4B6MK.mjs";
|
|
38
|
+
import "./chunk-P4QVFRLY.mjs";
|
|
39
|
+
import "./chunk-FJNUPSQK.mjs";
|
|
40
|
+
import "./chunk-WTASPE2W.mjs";
|
|
41
|
+
import "./chunk-PTZVE6NC.mjs";
|
|
42
|
+
import "./chunk-2QDCE7PD.mjs";
|
|
43
|
+
import "./chunk-7SUZ6CXM.mjs";
|
|
44
|
+
import "./chunk-WJHSY5T6.mjs";
|
|
45
|
+
import {
|
|
46
|
+
defaultBaseAutosuggestionsConfig
|
|
47
|
+
} from "./chunk-FP2EKU3L.mjs";
|
|
48
|
+
import "./chunk-224UKA7C.mjs";
|
|
49
|
+
import "./chunk-XW3ICO4S.mjs";
|
|
50
|
+
import "./chunk-IU3WTXLQ.mjs";
|
|
51
|
+
import "./chunk-H4VKQGVU.mjs";
|
|
52
|
+
import "./chunk-M2DR4KVB.mjs";
|
|
53
|
+
import "./chunk-T6MTDQZ7.mjs";
|
|
54
|
+
import "./chunk-ECR45NSD.mjs";
|
|
55
|
+
import "./chunk-KNQIEOFP.mjs";
|
|
56
|
+
import "./chunk-MRXNTQOX.mjs";
|
|
57
|
+
export {
|
|
58
|
+
BaseCopilotTextarea,
|
|
59
|
+
CopilotTextarea,
|
|
60
|
+
defaultAutosuggestionsConfig,
|
|
61
|
+
defaultBaseAutosuggestionsConfig
|
|
62
|
+
};
|
|
50
63
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/lib/debouncer.js
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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);
|
|
3
19
|
var __async = (__this, __arguments, generator) => {
|
|
4
20
|
return new Promise((resolve, reject) => {
|
|
5
21
|
var fulfilled = (value) => {
|
|
@@ -22,6 +38,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
22
38
|
};
|
|
23
39
|
|
|
24
40
|
// src/lib/debouncer.ts
|
|
41
|
+
var debouncer_exports = {};
|
|
42
|
+
__export(debouncer_exports, {
|
|
43
|
+
Debouncer: () => Debouncer
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(debouncer_exports);
|
|
25
46
|
var Debouncer = class {
|
|
26
47
|
constructor(wait) {
|
|
27
48
|
this.wait = wait;
|
|
@@ -48,7 +69,8 @@ var Debouncer = class {
|
|
|
48
69
|
};
|
|
49
70
|
}
|
|
50
71
|
};
|
|
51
|
-
|
|
52
|
-
exports
|
|
53
|
-
|
|
72
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
+
0 && (module.exports = {
|
|
74
|
+
Debouncer
|
|
75
|
+
});
|
|
54
76
|
//# sourceMappingURL=debouncer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/debouncer.ts"],"
|
|
1
|
+
{"version":3,"sources":["../../src/lib/debouncer.ts"],"sourcesContent":["export type AsyncFunction<T extends any[]> = (...args: [...T, AbortSignal]) => Promise<void>;\n\nexport class Debouncer<T extends any[]> {\n private timeoutId?: number;\n private activeAbortController?: AbortController;\n\n constructor(private wait: number) {}\n\n debounce = async (func: AsyncFunction<T>, ...args: T) => {\n // Abort the previous promise immediately\n this.cancel();\n\n this.timeoutId = setTimeout(async () => {\n try {\n this.activeAbortController = new AbortController();\n\n // Pass the signal to the async function, assuming it supports it\n await func(...args, this.activeAbortController.signal);\n\n this.activeAbortController = undefined;\n } catch (error) {}\n }, this.wait);\n };\n\n cancel = () => {\n if (this.activeAbortController) {\n this.activeAbortController.abort();\n this.activeAbortController = undefined;\n }\n\n if (this.timeoutId !== undefined) {\n clearTimeout(this.timeoutId);\n this.timeoutId = undefined;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAM,YAAN,MAAiC;AAAA,EAItC,YAAoB,MAAc;AAAd;AAEpB,oBAAW,CAAO,SAA2B,SAAY;AAEvD,WAAK,OAAO;AAEZ,WAAK,YAAY,WAAW,MAAY;AACtC,YAAI;AACF,eAAK,wBAAwB,IAAI,gBAAgB;AAGjD,gBAAM,KAAK,GAAG,MAAM,KAAK,sBAAsB,MAAM;AAErD,eAAK,wBAAwB;AAAA,QAC/B,SAAS,OAAP;AAAA,QAAe;AAAA,MACnB,IAAG,KAAK,IAAI;AAAA,IACd;AAEA,kBAAS,MAAM;AACb,UAAI,KAAK,uBAAuB;AAC9B,aAAK,sBAAsB,MAAM;AACjC,aAAK,wBAAwB;AAAA,MAC/B;AAEA,UAAI,KAAK,cAAc,QAAW;AAChC,qBAAa,KAAK,SAAS;AAC3B,aAAK,YAAY;AAAA,MACnB;AAAA,IACF;AAAA,EA5BmC;AA6BrC;","names":[]}
|
package/dist/lib/debouncer.mjs
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
Debouncer
|
|
3
|
+
} from "../chunk-M2DR4KVB.mjs";
|
|
4
|
+
import "../chunk-MRXNTQOX.mjs";
|
|
5
|
+
export {
|
|
6
|
+
Debouncer
|
|
7
|
+
};
|
|
4
8
|
//# sourceMappingURL=debouncer.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,12 +1,33 @@
|
|
|
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/lib/editor-to-text.ts
|
|
21
|
+
var editor_to_text_exports = {};
|
|
22
|
+
__export(editor_to_text_exports, {
|
|
23
|
+
editorToText: () => editorToText
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(editor_to_text_exports);
|
|
26
|
+
var import_slate = require("slate");
|
|
6
27
|
function nodeChildrenToTextComponents(editor, nodes) {
|
|
7
28
|
const indeciesOfInlineElements = new Set(
|
|
8
29
|
nodes.map((node, index) => {
|
|
9
|
-
if (
|
|
30
|
+
if (import_slate.Element.isElement(node) && editor.isInline(node)) {
|
|
10
31
|
return index;
|
|
11
32
|
}
|
|
12
33
|
return -1;
|
|
@@ -24,7 +45,7 @@ function nodeChildrenToTextComponents(editor, nodes) {
|
|
|
24
45
|
return true;
|
|
25
46
|
});
|
|
26
47
|
return nonIgnorableItems.map((node) => {
|
|
27
|
-
if (
|
|
48
|
+
if (import_slate.Element.isElement(node)) {
|
|
28
49
|
switch (node.type) {
|
|
29
50
|
case "paragraph":
|
|
30
51
|
return nodeChildrenToTextComponents(editor, node.children);
|
|
@@ -41,7 +62,8 @@ var editorToText = (editor) => {
|
|
|
41
62
|
const text = flattened.map((textComponent) => textComponent.text).join("\n");
|
|
42
63
|
return text;
|
|
43
64
|
};
|
|
44
|
-
|
|
45
|
-
exports
|
|
46
|
-
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
editorToText
|
|
68
|
+
});
|
|
47
69
|
//# sourceMappingURL=editor-to-text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/editor-to-text.ts"],"
|
|
1
|
+
{"version":3,"sources":["../../src/lib/editor-to-text.ts"],"sourcesContent":["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,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;","names":[]}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
editorToText
|
|
3
|
+
} from "../chunk-T6MTDQZ7.mjs";
|
|
4
|
+
import "../chunk-MRXNTQOX.mjs";
|
|
5
|
+
export {
|
|
6
|
+
editorToText
|
|
7
|
+
};
|
|
4
8
|
//# sourceMappingURL=editor-to-text.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,21 +1,45 @@
|
|
|
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/lib/get-text-around-cursor.ts
|
|
21
|
+
var get_text_around_cursor_exports = {};
|
|
22
|
+
__export(get_text_around_cursor_exports, {
|
|
23
|
+
extractTextWithNewlines: () => extractTextWithNewlines,
|
|
24
|
+
getFullEditorTextWithNewlines: () => getFullEditorTextWithNewlines,
|
|
25
|
+
getTextAroundCollapsedCursor: () => getTextAroundCollapsedCursor,
|
|
26
|
+
getTextAroundSelection: () => getTextAroundSelection
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(get_text_around_cursor_exports);
|
|
29
|
+
var import_slate = require("slate");
|
|
6
30
|
function getTextAroundCollapsedCursor(editor) {
|
|
7
31
|
const { selection } = editor;
|
|
8
|
-
if (!selection || !
|
|
32
|
+
if (!selection || !import_slate.Range.isCollapsed(selection)) {
|
|
9
33
|
return null;
|
|
10
34
|
}
|
|
11
35
|
const cursorPoint = selection.anchor;
|
|
12
36
|
const beforeRange = {
|
|
13
|
-
anchor:
|
|
37
|
+
anchor: import_slate.Editor.start(editor, []),
|
|
14
38
|
focus: cursorPoint
|
|
15
39
|
};
|
|
16
40
|
const afterRange = {
|
|
17
41
|
anchor: cursorPoint,
|
|
18
|
-
focus:
|
|
42
|
+
focus: import_slate.Editor.end(editor, [])
|
|
19
43
|
};
|
|
20
44
|
const before = extractTextWithNewlines(editor, beforeRange);
|
|
21
45
|
const after = extractTextWithNewlines(editor, afterRange);
|
|
@@ -32,12 +56,12 @@ function getTextAroundSelection(editor) {
|
|
|
32
56
|
}
|
|
33
57
|
const wellOrderedSelection = wellOrderedRange(selection);
|
|
34
58
|
const beforeRange = {
|
|
35
|
-
anchor:
|
|
59
|
+
anchor: import_slate.Editor.start(editor, []),
|
|
36
60
|
focus: wellOrderedSelection.anchor
|
|
37
61
|
};
|
|
38
62
|
const afterRange = {
|
|
39
63
|
anchor: wellOrderedSelection.focus,
|
|
40
|
-
focus:
|
|
64
|
+
focus: import_slate.Editor.end(editor, [])
|
|
41
65
|
};
|
|
42
66
|
const before = extractTextWithNewlines(editor, beforeRange);
|
|
43
67
|
const after = extractTextWithNewlines(editor, afterRange);
|
|
@@ -51,25 +75,25 @@ function getTextAroundSelection(editor) {
|
|
|
51
75
|
}
|
|
52
76
|
function getFullEditorTextWithNewlines(editor) {
|
|
53
77
|
const fullDocumentRange = {
|
|
54
|
-
anchor:
|
|
55
|
-
focus:
|
|
78
|
+
anchor: import_slate.Editor.start(editor, []),
|
|
79
|
+
focus: import_slate.Editor.end(editor, [])
|
|
56
80
|
};
|
|
57
81
|
return extractTextWithNewlines(editor, fullDocumentRange);
|
|
58
82
|
}
|
|
59
83
|
function extractTextWithNewlines(editor, range) {
|
|
60
84
|
const voids = false;
|
|
61
|
-
const [start, end] =
|
|
85
|
+
const [start, end] = import_slate.Range.edges(range);
|
|
62
86
|
let text = "";
|
|
63
87
|
let lastBlock = null;
|
|
64
|
-
for (const [node, path] of
|
|
88
|
+
for (const [node, path] of import_slate.Editor.nodes(editor, {
|
|
65
89
|
at: range,
|
|
66
|
-
match:
|
|
90
|
+
match: import_slate.Text.isText,
|
|
67
91
|
voids
|
|
68
92
|
})) {
|
|
69
93
|
let t = node.text;
|
|
70
|
-
const [block] =
|
|
94
|
+
const [block] = import_slate.Editor.above(editor, {
|
|
71
95
|
at: path,
|
|
72
|
-
match: (n) =>
|
|
96
|
+
match: (n) => import_slate.Element.isElement(n) && n.type === "paragraph"
|
|
73
97
|
}) || [null];
|
|
74
98
|
if (lastBlock !== block && block) {
|
|
75
99
|
if (lastBlock) {
|
|
@@ -77,10 +101,10 @@ function extractTextWithNewlines(editor, range) {
|
|
|
77
101
|
}
|
|
78
102
|
lastBlock = block;
|
|
79
103
|
}
|
|
80
|
-
if (
|
|
104
|
+
if (import_slate.Path.equals(path, end.path)) {
|
|
81
105
|
t = t.slice(0, end.offset);
|
|
82
106
|
}
|
|
83
|
-
if (
|
|
107
|
+
if (import_slate.Path.equals(path, start.path)) {
|
|
84
108
|
t = t.slice(start.offset);
|
|
85
109
|
}
|
|
86
110
|
text += t;
|
|
@@ -89,7 +113,7 @@ function extractTextWithNewlines(editor, range) {
|
|
|
89
113
|
}
|
|
90
114
|
function wellOrderedRange(range) {
|
|
91
115
|
const { anchor, focus } = range;
|
|
92
|
-
if (
|
|
116
|
+
if (import_slate.Point.isBefore(anchor, focus)) {
|
|
93
117
|
return range;
|
|
94
118
|
}
|
|
95
119
|
return {
|
|
@@ -97,10 +121,11 @@ function wellOrderedRange(range) {
|
|
|
97
121
|
focus: anchor
|
|
98
122
|
};
|
|
99
123
|
}
|
|
100
|
-
|
|
101
|
-
exports
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
124
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
125
|
+
0 && (module.exports = {
|
|
126
|
+
extractTextWithNewlines,
|
|
127
|
+
getFullEditorTextWithNewlines,
|
|
128
|
+
getTextAroundCollapsedCursor,
|
|
129
|
+
getTextAroundSelection
|
|
130
|
+
});
|
|
106
131
|
//# sourceMappingURL=get-text-around-cursor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/get-text-around-cursor.ts"],"
|
|
1
|
+
{"version":3,"sources":["../../src/lib/get-text-around-cursor.ts"],"sourcesContent":["import { Editor, Node, Path, Range, Text, Element, BasePoint, BaseRange, Point } from \"slate\";\nimport { EditorAutocompleteState } from \"../types/base/editor-autocomplete-state\";\n\nexport interface EditorTextState {\n selection: BaseRange;\n\n textBeforeCursor: string;\n selectedText: string;\n textAfterCursor: string;\n}\n\nexport function getTextAroundCollapsedCursor(editor: Editor): EditorAutocompleteState | null {\n const { selection } = editor;\n if (!selection || !Range.isCollapsed(selection)) {\n return null;\n }\n\n const cursorPoint = selection.anchor;\n\n // Create two ranges: one before the anchor and one after\n const beforeRange: Range = {\n anchor: Editor.start(editor, []),\n focus: cursorPoint,\n };\n const afterRange: Range = {\n anchor: cursorPoint,\n focus: Editor.end(editor, []),\n };\n\n // Extract text for these ranges\n const before = extractTextWithNewlines(editor, beforeRange);\n const after = extractTextWithNewlines(editor, afterRange);\n\n return {\n cursorPoint: cursorPoint,\n textBeforeCursor: before,\n textAfterCursor: after,\n };\n}\n\nexport function getTextAroundSelection(editor: Editor): EditorTextState | null {\n const { selection } = editor;\n if (!selection) {\n return null;\n }\n\n const wellOrderedSelection = wellOrderedRange(selection);\n\n // Create two ranges: one before the anchor and one after\n const beforeRange: Range = {\n anchor: Editor.start(editor, []),\n focus: wellOrderedSelection.anchor,\n };\n const afterRange: Range = {\n anchor: wellOrderedSelection.focus,\n focus: Editor.end(editor, []),\n };\n\n // Extract text for these ranges\n const before = extractTextWithNewlines(editor, beforeRange);\n const after = extractTextWithNewlines(editor, afterRange);\n const selectedText = extractTextWithNewlines(editor, wellOrderedSelection);\n\n return {\n selection: wellOrderedSelection,\n textBeforeCursor: before,\n selectedText,\n textAfterCursor: after,\n };\n}\n\nexport function getFullEditorTextWithNewlines(editor: Editor): string {\n const fullDocumentRange: Range = {\n anchor: Editor.start(editor, []),\n focus: Editor.end(editor, []),\n };\n return extractTextWithNewlines(editor, fullDocumentRange);\n}\n\n// Helper function to extract text with newlines\nexport function extractTextWithNewlines(editor: Editor, range: Range): string {\n const voids = false;\n const [start, end] = Range.edges(range);\n let text = \"\";\n let lastBlock: Node | null = null;\n\n for (const [node, path] of Editor.nodes(editor, {\n at: range,\n match: Text.isText,\n voids,\n })) {\n let t = node.text;\n\n // Determine the parent block of the current text node\n const [block] = Editor.above(editor, {\n at: path,\n match: (n) => Element.isElement(n) && n.type === \"paragraph\",\n }) || [null];\n\n // If we encounter a new block, prepend a newline\n if (lastBlock !== block && block) {\n // check that lastBlock is not null to avoid adding a newline at the beginning\n if (lastBlock) {\n text += \"\\n\";\n }\n lastBlock = block;\n }\n\n if (Path.equals(path, end.path)) {\n t = t.slice(0, end.offset);\n }\n\n if (Path.equals(path, start.path)) {\n t = t.slice(start.offset);\n }\n\n text += t;\n }\n\n return text;\n}\n\nfunction wellOrderedRange(range: BaseRange): BaseRange {\n const { anchor, focus } = range;\n // if anchor is before focus, return range as is\n if (Point.isBefore(anchor, focus)) {\n return range;\n }\n\n // if focus is before anchor, return range with anchor and focus swapped\n return {\n anchor: focus,\n focus: anchor,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsF;AAW/E,SAAS,6BAA6B,QAAgD;AAC3F,QAAM,EAAE,UAAU,IAAI;AACtB,MAAI,CAAC,aAAa,CAAC,mBAAM,YAAY,SAAS,GAAG;AAC/C,WAAO;AAAA,EACT;AAEA,QAAM,cAAc,UAAU;AAG9B,QAAM,cAAqB;AAAA,IACzB,QAAQ,oBAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC/B,OAAO;AAAA,EACT;AACA,QAAM,aAAoB;AAAA,IACxB,QAAQ;AAAA,IACR,OAAO,oBAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,EAC9B;AAGA,QAAM,SAAS,wBAAwB,QAAQ,WAAW;AAC1D,QAAM,QAAQ,wBAAwB,QAAQ,UAAU;AAExD,SAAO;AAAA,IACL;AAAA,IACA,kBAAkB;AAAA,IAClB,iBAAiB;AAAA,EACnB;AACF;AAEO,SAAS,uBAAuB,QAAwC;AAC7E,QAAM,EAAE,UAAU,IAAI;AACtB,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,EACT;AAEA,QAAM,uBAAuB,iBAAiB,SAAS;AAGvD,QAAM,cAAqB;AAAA,IACzB,QAAQ,oBAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC/B,OAAO,qBAAqB;AAAA,EAC9B;AACA,QAAM,aAAoB;AAAA,IACxB,QAAQ,qBAAqB;AAAA,IAC7B,OAAO,oBAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,EAC9B;AAGA,QAAM,SAAS,wBAAwB,QAAQ,WAAW;AAC1D,QAAM,QAAQ,wBAAwB,QAAQ,UAAU;AACxD,QAAM,eAAe,wBAAwB,QAAQ,oBAAoB;AAEzE,SAAO;AAAA,IACL,WAAW;AAAA,IACX,kBAAkB;AAAA,IAClB;AAAA,IACA,iBAAiB;AAAA,EACnB;AACF;AAEO,SAAS,8BAA8B,QAAwB;AACpE,QAAM,oBAA2B;AAAA,IAC/B,QAAQ,oBAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC/B,OAAO,oBAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,EAC9B;AACA,SAAO,wBAAwB,QAAQ,iBAAiB;AAC1D;AAGO,SAAS,wBAAwB,QAAgB,OAAsB;AAC5E,QAAM,QAAQ;AACd,QAAM,CAAC,OAAO,GAAG,IAAI,mBAAM,MAAM,KAAK;AACtC,MAAI,OAAO;AACX,MAAI,YAAyB;AAE7B,aAAW,CAAC,MAAM,IAAI,KAAK,oBAAO,MAAM,QAAQ;AAAA,IAC9C,IAAI;AAAA,IACJ,OAAO,kBAAK;AAAA,IACZ;AAAA,EACF,CAAC,GAAG;AACF,QAAI,IAAI,KAAK;AAGb,UAAM,CAAC,KAAK,IAAI,oBAAO,MAAM,QAAQ;AAAA,MACnC,IAAI;AAAA,MACJ,OAAO,CAAC,MAAM,qBAAQ,UAAU,CAAC,KAAK,EAAE,SAAS;AAAA,IACnD,CAAC,KAAK,CAAC,IAAI;AAGX,QAAI,cAAc,SAAS,OAAO;AAEhC,UAAI,WAAW;AACb,gBAAQ;AAAA,MACV;AACA,kBAAY;AAAA,IACd;AAEA,QAAI,kBAAK,OAAO,MAAM,IAAI,IAAI,GAAG;AAC/B,UAAI,EAAE,MAAM,GAAG,IAAI,MAAM;AAAA,IAC3B;AAEA,QAAI,kBAAK,OAAO,MAAM,MAAM,IAAI,GAAG;AACjC,UAAI,EAAE,MAAM,MAAM,MAAM;AAAA,IAC1B;AAEA,YAAQ;AAAA,EACV;AAEA,SAAO;AACT;AAEA,SAAS,iBAAiB,OAA6B;AACrD,QAAM,EAAE,QAAQ,MAAM,IAAI;AAE1B,MAAI,mBAAM,SAAS,QAAQ,KAAK,GAAG;AACjC,WAAO;AAAA,EACT;AAGA,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,OAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
extractTextWithNewlines,
|
|
3
|
+
getFullEditorTextWithNewlines,
|
|
4
|
+
getTextAroundCollapsedCursor,
|
|
5
|
+
getTextAroundSelection
|
|
6
|
+
} from "../chunk-ECR45NSD.mjs";
|
|
7
|
+
import "../chunk-MRXNTQOX.mjs";
|
|
8
|
+
export {
|
|
9
|
+
extractTextWithNewlines,
|
|
10
|
+
getFullEditorTextWithNewlines,
|
|
11
|
+
getTextAroundCollapsedCursor,
|
|
12
|
+
getTextAroundSelection
|
|
13
|
+
};
|
|
4
14
|
//# sourceMappingURL=get-text-around-cursor.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/lib/retry.js
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
|
-
|
|
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);
|
|
2
19
|
|
|
3
20
|
// src/lib/retry.tsx
|
|
21
|
+
var retry_exports = {};
|
|
22
|
+
__export(retry_exports, {
|
|
23
|
+
retry: () => retry
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(retry_exports);
|
|
4
26
|
function retry(fn, retriesLeft = 2, interval = 200, backoff = 1.5) {
|
|
5
27
|
return new Promise((resolve, reject) => {
|
|
6
28
|
fn().then(resolve).catch((error) => {
|
|
@@ -14,7 +36,8 @@ function retry(fn, retriesLeft = 2, interval = 200, backoff = 1.5) {
|
|
|
14
36
|
});
|
|
15
37
|
});
|
|
16
38
|
}
|
|
17
|
-
|
|
18
|
-
exports
|
|
19
|
-
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
retry
|
|
42
|
+
});
|
|
20
43
|
//# sourceMappingURL=retry.js.map
|
package/dist/lib/retry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/retry.tsx"],"
|
|
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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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":[]}
|
package/dist/lib/retry.mjs
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
retry
|
|
3
|
+
} from "../chunk-KNQIEOFP.mjs";
|
|
4
|
+
import "../chunk-MRXNTQOX.mjs";
|
|
5
|
+
export {
|
|
6
|
+
retry
|
|
7
|
+
};
|
|
4
8
|
//# sourceMappingURL=retry.mjs.map
|
package/dist/lib/retry.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/lib/slatejs-edits/add-autocompletions.ts
|
|
21
|
+
var add_autocompletions_exports = {};
|
|
22
|
+
__export(add_autocompletions_exports, {
|
|
23
|
+
addAutocompletionsToEditor: () => addAutocompletionsToEditor
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(add_autocompletions_exports);
|
|
26
|
+
var import_slate = require("slate");
|
|
6
27
|
function addAutocompletionsToEditor(editor, newSuggestion, point) {
|
|
7
28
|
const editorPosition = editor.selection;
|
|
8
|
-
|
|
29
|
+
import_slate.Transforms.insertNodes(
|
|
9
30
|
editor,
|
|
10
31
|
[
|
|
11
32
|
{
|
|
@@ -23,7 +44,8 @@ function addAutocompletionsToEditor(editor, newSuggestion, point) {
|
|
|
23
44
|
editor.selection = editorPosition;
|
|
24
45
|
}
|
|
25
46
|
}
|
|
26
|
-
|
|
27
|
-
exports
|
|
28
|
-
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
addAutocompletionsToEditor
|
|
50
|
+
});
|
|
29
51
|
//# sourceMappingURL=add-autocompletions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/slatejs-edits/add-autocompletions.ts"],"
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/slatejs-edits/add-autocompletions.ts"],"sourcesContent":["import { BasePoint, Transforms } from \"slate\";\nimport { CustomEditor } from \"../../types/base/custom-editor\";\n\nexport function addAutocompletionsToEditor(\n editor: CustomEditor,\n newSuggestion: string,\n point: BasePoint,\n) {\n const editorPosition = editor.selection;\n\n Transforms.insertNodes(\n editor,\n [\n {\n type: \"suggestion\",\n inline: true,\n content: newSuggestion,\n children: [{ text: \"\" }],\n },\n ],\n {\n at: point,\n },\n );\n\n // restore cursor position\n if (editorPosition) {\n editor.selection = editorPosition;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsC;AAG/B,SAAS,2BACd,QACA,eACA,OACA;AACA,QAAM,iBAAiB,OAAO;AAE9B,0BAAW;AAAA,IACT;AAAA,IACA;AAAA,MACE;AAAA,QACE,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,UAAU,CAAC,EAAE,MAAM,GAAG,CAAC;AAAA,MACzB;AAAA,IACF;AAAA,IACA;AAAA,MACE,IAAI;AAAA,IACN;AAAA,EACF;AAGA,MAAI,gBAAgB;AAClB,WAAO,YAAY;AAAA,EACrB;AACF;","names":[]}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
addAutocompletionsToEditor
|
|
3
|
+
} from "../../chunk-2C7O2EVM.mjs";
|
|
4
|
+
import "../../chunk-MRXNTQOX.mjs";
|
|
5
|
+
export {
|
|
6
|
+
addAutocompletionsToEditor
|
|
7
|
+
};
|
|
4
8
|
//# sourceMappingURL=add-autocompletions.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|