@lobehub/editor 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +635 -0
- package/es/common/canUseDOM.d.ts +8 -0
- package/es/common/canUseDOM.js +9 -0
- package/es/common/sys.d.ts +17 -0
- package/es/common/sys.js +30 -0
- package/es/editor-kernel/data-source.d.ts +8 -0
- package/es/editor-kernel/data-source.js +30 -0
- package/es/editor-kernel/event.d.ts +3 -0
- package/es/editor-kernel/event.js +11 -0
- package/es/editor-kernel/index.d.ts +11 -0
- package/es/editor-kernel/index.js +14 -0
- package/es/editor-kernel/inode/helper.d.ts +11 -0
- package/es/editor-kernel/inode/helper.js +48 -0
- package/es/editor-kernel/inode/i-element-node.d.ts +5 -0
- package/es/editor-kernel/inode/i-element-node.js +1 -0
- package/es/editor-kernel/inode/i-node.d.ts +6 -0
- package/es/editor-kernel/inode/i-node.js +1 -0
- package/es/editor-kernel/inode/index.d.ts +5 -0
- package/es/editor-kernel/inode/index.js +5 -0
- package/es/editor-kernel/inode/paragraph-node.d.ts +6 -0
- package/es/editor-kernel/inode/paragraph-node.js +1 -0
- package/es/editor-kernel/inode/root-node.d.ts +7 -0
- package/es/editor-kernel/inode/root-node.js +1 -0
- package/es/editor-kernel/inode/text-node.d.ts +12 -0
- package/es/editor-kernel/inode/text-node.js +1 -0
- package/es/editor-kernel/kernel.d.ts +46 -0
- package/es/editor-kernel/kernel.js +273 -0
- package/es/editor-kernel/plugin.d.ts +7 -0
- package/es/editor-kernel/plugin.js +54 -0
- package/es/editor-kernel/react/LexicalErrorBoundary.d.ts +13 -0
- package/es/editor-kernel/react/LexicalErrorBoundary.js +26 -0
- package/es/editor-kernel/react/index.d.ts +5 -0
- package/es/editor-kernel/react/index.js +5 -0
- package/es/editor-kernel/react/react-context.d.ts +10 -0
- package/es/editor-kernel/react/react-context.js +25 -0
- package/es/editor-kernel/react/react-editor.d.ts +12 -0
- package/es/editor-kernel/react/react-editor.js +57 -0
- package/es/editor-kernel/react/useDecorators.d.ts +9 -0
- package/es/editor-kernel/react/useDecorators.js +69 -0
- package/es/editor-kernel/react/useLexicalEditor.d.ts +2 -0
- package/es/editor-kernel/react/useLexicalEditor.js +31 -0
- package/es/editor-kernel/react/useLexicalNodeSelection.d.ts +17 -0
- package/es/editor-kernel/react/useLexicalNodeSelection.js +99 -0
- package/es/editor-kernel/react/useToolbarState.d.ts +31 -0
- package/es/editor-kernel/react/useToolbarState.js +302 -0
- package/es/editor-kernel/react/useTranslation.d.ts +3 -0
- package/es/editor-kernel/react/useTranslation.js +19 -0
- package/es/editor-kernel/types.d.ts +189 -0
- package/es/editor-kernel/types.js +1 -0
- package/es/editor-kernel/utils.d.ts +25 -0
- package/es/editor-kernel/utils.js +69 -0
- package/es/index.d.ts +14 -0
- package/es/index.js +14 -0
- package/es/locale/index.d.ts +25 -0
- package/es/locale/index.js +24 -0
- package/es/plugins/codeblock/command/index.d.ts +20 -0
- package/es/plugins/codeblock/command/index.js +84 -0
- package/es/plugins/codeblock/index.d.ts +4 -0
- package/es/plugins/codeblock/index.js +4 -0
- package/es/plugins/codeblock/plugin/CodeHighlighterShiki.d.ts +24 -0
- package/es/plugins/codeblock/plugin/CodeHighlighterShiki.js +680 -0
- package/es/plugins/codeblock/plugin/FacadeShiki.d.ts +51 -0
- package/es/plugins/codeblock/plugin/FacadeShiki.js +348 -0
- package/es/plugins/codeblock/plugin/index.d.ts +18 -0
- package/es/plugins/codeblock/plugin/index.js +90 -0
- package/es/plugins/codeblock/plugin/invariant.d.ts +8 -0
- package/es/plugins/codeblock/plugin/invariant.js +17 -0
- package/es/plugins/codeblock/react/ReactCodeblockPlugin.d.ts +4 -0
- package/es/plugins/codeblock/react/ReactCodeblockPlugin.js +51 -0
- package/es/plugins/codeblock/react/index.d.ts +2 -0
- package/es/plugins/codeblock/react/index.js +1 -0
- package/es/plugins/codeblock/react/style.d.ts +6 -0
- package/es/plugins/codeblock/react/style.js +38 -0
- package/es/plugins/codeblock/react/type.d.ts +5 -0
- package/es/plugins/codeblock/react/type.js +1 -0
- package/es/plugins/codeblock/utils/language.d.ts +1 -0
- package/es/plugins/codeblock/utils/language.js +12 -0
- package/es/plugins/common/command/index.d.ts +7 -0
- package/es/plugins/common/command/index.js +31 -0
- package/es/plugins/common/data-source/json-data-source.d.ts +7 -0
- package/es/plugins/common/data-source/json-data-source.js +39 -0
- package/es/plugins/common/data-source/text-data-source.d.ts +6 -0
- package/es/plugins/common/data-source/text-data-source.js +54 -0
- package/es/plugins/common/index.d.ts +3 -0
- package/es/plugins/common/index.js +3 -0
- package/es/plugins/common/node/ElementDOMSlot.d.ts +5 -0
- package/es/plugins/common/node/ElementDOMSlot.js +59 -0
- package/es/plugins/common/node/LexicalLineBreakNode.d.ts +31 -0
- package/es/plugins/common/node/LexicalLineBreakNode.js +140 -0
- package/es/plugins/common/node/ParagraphNode.d.ts +7 -0
- package/es/plugins/common/node/ParagraphNode.js +47 -0
- package/es/plugins/common/plugin/index.d.ts +16 -0
- package/es/plugins/common/plugin/index.js +245 -0
- package/es/plugins/common/plugin/register.d.ts +4 -0
- package/es/plugins/common/plugin/register.js +230 -0
- package/es/plugins/common/react/Placeholder/index.d.ts +7 -0
- package/es/plugins/common/react/Placeholder/index.js +53 -0
- package/es/plugins/common/react/Placeholder/style.d.ts +4 -0
- package/es/plugins/common/react/Placeholder/style.js +12 -0
- package/es/plugins/common/react/ReactEditorContent.d.ts +4 -0
- package/es/plugins/common/react/ReactEditorContent.js +7 -0
- package/es/plugins/common/react/ReactPlainText.d.ts +4 -0
- package/es/plugins/common/react/ReactPlainText.js +100 -0
- package/es/plugins/common/react/index.d.ts +3 -0
- package/es/plugins/common/react/index.js +3 -0
- package/es/plugins/common/react/style.d.ts +18 -0
- package/es/plugins/common/react/style.js +38 -0
- package/es/plugins/common/react/type.d.ts +21 -0
- package/es/plugins/common/react/type.js +1 -0
- package/es/plugins/common/utils/index.d.ts +28 -0
- package/es/plugins/common/utils/index.js +96 -0
- package/es/plugins/file/command/index.d.ts +7 -0
- package/es/plugins/file/command/index.js +28 -0
- package/es/plugins/file/index.d.ts +3 -0
- package/es/plugins/file/index.js +3 -0
- package/es/plugins/file/node/FileNode.d.ts +36 -0
- package/es/plugins/file/node/FileNode.js +177 -0
- package/es/plugins/file/plugin/index.d.ts +14 -0
- package/es/plugins/file/plugin/index.js +116 -0
- package/es/plugins/file/react/ReactFilePlugin.d.ts +4 -0
- package/es/plugins/file/react/ReactFilePlugin.js +74 -0
- package/es/plugins/file/react/components/ReactFile.d.ts +10 -0
- package/es/plugins/file/react/components/ReactFile.js +65 -0
- package/es/plugins/file/react/index.d.ts +2 -0
- package/es/plugins/file/react/index.js +1 -0
- package/es/plugins/file/react/style.d.ts +3 -0
- package/es/plugins/file/react/style.js +11 -0
- package/es/plugins/file/react/type.d.ts +13 -0
- package/es/plugins/file/react/type.js +1 -0
- package/es/plugins/file/utils/index.d.ts +2 -0
- package/es/plugins/file/utils/index.js +45 -0
- package/es/plugins/hr/command/index.d.ts +3 -0
- package/es/plugins/hr/command/index.js +13 -0
- package/es/plugins/hr/index.d.ts +3 -0
- package/es/plugins/hr/index.js +3 -0
- package/es/plugins/hr/node/HorizontalRuleNode.d.ts +16 -0
- package/es/plugins/hr/node/HorizontalRuleNode.js +100 -0
- package/es/plugins/hr/plugin/index.d.ts +8 -0
- package/es/plugins/hr/plugin/index.js +70 -0
- package/es/plugins/hr/react/ReactHRPlugin.d.ts +4 -0
- package/es/plugins/hr/react/ReactHRPlugin.js +36 -0
- package/es/plugins/hr/react/components/HRNode.d.ts +10 -0
- package/es/plugins/hr/react/components/HRNode.js +45 -0
- package/es/plugins/hr/react/index.d.ts +2 -0
- package/es/plugins/hr/react/index.js +1 -0
- package/es/plugins/hr/react/style.d.ts +1 -0
- package/es/plugins/hr/react/style.js +8 -0
- package/es/plugins/hr/react/type.d.ts +3 -0
- package/es/plugins/hr/react/type.js +1 -0
- package/es/plugins/image/command/index.d.ts +8 -0
- package/es/plugins/image/command/index.js +46 -0
- package/es/plugins/image/index.d.ts +3 -0
- package/es/plugins/image/index.js +3 -0
- package/es/plugins/image/node/basie-image-node.d.ts +44 -0
- package/es/plugins/image/node/basie-image-node.js +151 -0
- package/es/plugins/image/node/image-node.d.ts +26 -0
- package/es/plugins/image/node/image-node.js +176 -0
- package/es/plugins/image/plugin/index.d.ts +13 -0
- package/es/plugins/image/plugin/index.js +74 -0
- package/es/plugins/image/react/ReactImagePlugin.d.ts +4 -0
- package/es/plugins/image/react/ReactImagePlugin.js +48 -0
- package/es/plugins/image/react/components/BrokenImage.d.ts +3 -0
- package/es/plugins/image/react/components/BrokenImage.js +18 -0
- package/es/plugins/image/react/components/Image.d.ts +7 -0
- package/es/plugins/image/react/components/Image.js +71 -0
- package/es/plugins/image/react/components/LazyImage.d.ts +8 -0
- package/es/plugins/image/react/components/LazyImage.js +99 -0
- package/es/plugins/image/react/components/useSupenseImage.d.ts +2 -0
- package/es/plugins/image/react/components/useSupenseImage.js +24 -0
- package/es/plugins/image/react/index.d.ts +2 -0
- package/es/plugins/image/react/index.js +1 -0
- package/es/plugins/image/react/style.d.ts +12 -0
- package/es/plugins/image/react/style.js +17 -0
- package/es/plugins/image/react/type.d.ts +6 -0
- package/es/plugins/image/react/type.js +1 -0
- package/es/plugins/link/command/index.d.ts +6 -0
- package/es/plugins/link/command/index.js +20 -0
- package/es/plugins/link/index.d.ts +3 -0
- package/es/plugins/link/index.js +3 -0
- package/es/plugins/link/node/LinkNode.d.ts +126 -0
- package/es/plugins/link/node/LinkNode.js +721 -0
- package/es/plugins/link/plugin/index.d.ts +8 -0
- package/es/plugins/link/plugin/index.js +94 -0
- package/es/plugins/link/react/ReactLinkPlugin.d.ts +4 -0
- package/es/plugins/link/react/ReactLinkPlugin.js +168 -0
- package/es/plugins/link/react/components/LinkEdit.d.ts +7 -0
- package/es/plugins/link/react/components/LinkEdit.js +138 -0
- package/es/plugins/link/react/components/Toolbar.d.ts +7 -0
- package/es/plugins/link/react/components/Toolbar.js +63 -0
- package/es/plugins/link/react/index.d.ts +2 -0
- package/es/plugins/link/react/index.js +1 -0
- package/es/plugins/link/react/style.d.ts +5 -0
- package/es/plugins/link/react/style.js +12 -0
- package/es/plugins/link/react/type.d.ts +9 -0
- package/es/plugins/link/react/type.js +1 -0
- package/es/plugins/link/utils/index.d.ts +4 -0
- package/es/plugins/link/utils/index.js +37 -0
- package/es/plugins/list/command/index.d.ts +1 -0
- package/es/plugins/list/command/index.js +1 -0
- package/es/plugins/list/index.d.ts +3 -0
- package/es/plugins/list/index.js +3 -0
- package/es/plugins/list/plugin/index.d.ts +5 -0
- package/es/plugins/list/plugin/index.js +193 -0
- package/es/plugins/list/react/ReactListPlugin.d.ts +4 -0
- package/es/plugins/list/react/ReactListPlugin.js +29 -0
- package/es/plugins/list/react/index.d.ts +2 -0
- package/es/plugins/list/react/index.js +1 -0
- package/es/plugins/list/react/style.d.ts +1 -0
- package/es/plugins/list/react/style.js +7 -0
- package/es/plugins/list/react/type.d.ts +3 -0
- package/es/plugins/list/react/type.js +1 -0
- package/es/plugins/list/utils/index.d.ts +5 -0
- package/es/plugins/list/utils/index.js +88 -0
- package/es/plugins/markdown/data-source/markdown-data-source.d.ts +10 -0
- package/es/plugins/markdown/data-source/markdown-data-source.js +64 -0
- package/es/plugins/markdown/data-source/markdown-writer-context.d.ts +12 -0
- package/es/plugins/markdown/data-source/markdown-writer-context.js +51 -0
- package/es/plugins/markdown/index.d.ts +2 -0
- package/es/plugins/markdown/index.js +2 -0
- package/es/plugins/markdown/plugin/index.d.ts +4 -0
- package/es/plugins/markdown/plugin/index.js +122 -0
- package/es/plugins/markdown/service/shortcut.d.ts +139 -0
- package/es/plugins/markdown/service/shortcut.js +401 -0
- package/es/plugins/markdown/utils/index.d.ts +12 -0
- package/es/plugins/markdown/utils/index.js +61 -0
- package/es/plugins/mention/command/index.d.ts +6 -0
- package/es/plugins/mention/command/index.js +19 -0
- package/es/plugins/mention/index.d.ts +3 -0
- package/es/plugins/mention/index.js +3 -0
- package/es/plugins/mention/node/MentionNode.d.ts +26 -0
- package/es/plugins/mention/node/MentionNode.js +143 -0
- package/es/plugins/mention/plugin/index.d.ts +11 -0
- package/es/plugins/mention/plugin/index.js +61 -0
- package/es/plugins/mention/plugin/register.d.ts +2 -0
- package/es/plugins/mention/plugin/register.js +46 -0
- package/es/plugins/mention/react/ReactMentionPlugin.d.ts +4 -0
- package/es/plugins/mention/react/ReactMentionPlugin.js +42 -0
- package/es/plugins/mention/react/components/Mention.d.ts +9 -0
- package/es/plugins/mention/react/components/Mention.js +39 -0
- package/es/plugins/mention/react/index.d.ts +2 -0
- package/es/plugins/mention/react/index.js +1 -0
- package/es/plugins/mention/react/style.d.ts +3 -0
- package/es/plugins/mention/react/style.js +11 -0
- package/es/plugins/mention/react/type.d.ts +8 -0
- package/es/plugins/mention/react/type.js +1 -0
- package/es/plugins/slash/index.d.ts +3 -0
- package/es/plugins/slash/index.js +3 -0
- package/es/plugins/slash/plugin/index.d.ts +23 -0
- package/es/plugins/slash/plugin/index.js +132 -0
- package/es/plugins/slash/react/ReactSlashOption.d.ts +4 -0
- package/es/plugins/slash/react/ReactSlashOption.js +7 -0
- package/es/plugins/slash/react/ReactSlashPlugin.d.ts +4 -0
- package/es/plugins/slash/react/ReactSlashPlugin.js +228 -0
- package/es/plugins/slash/react/components/SlashMenu.d.ts +8 -0
- package/es/plugins/slash/react/components/SlashMenu.js +72 -0
- package/es/plugins/slash/react/index.d.ts +4 -0
- package/es/plugins/slash/react/index.js +3 -0
- package/es/plugins/slash/react/style.d.ts +1 -0
- package/es/plugins/slash/react/style.js +9 -0
- package/es/plugins/slash/react/type.d.ts +82 -0
- package/es/plugins/slash/react/type.js +1 -0
- package/es/plugins/slash/react/utils.d.ts +5 -0
- package/es/plugins/slash/react/utils.js +20 -0
- package/es/plugins/slash/service/i-slash-service.d.ts +38 -0
- package/es/plugins/slash/service/i-slash-service.js +64 -0
- package/es/plugins/slash/utils/utils.d.ts +38 -0
- package/es/plugins/slash/utils/utils.js +192 -0
- package/es/plugins/table/command/index.d.ts +13 -0
- package/es/plugins/table/command/index.js +73 -0
- package/es/plugins/table/index.d.ts +3 -0
- package/es/plugins/table/index.js +3 -0
- package/es/plugins/table/node/index.d.ts +2 -0
- package/es/plugins/table/node/index.js +16 -0
- package/es/plugins/table/plugin/index.d.ts +5 -0
- package/es/plugins/table/plugin/index.js +85 -0
- package/es/plugins/table/react/TableActionMenu/index.d.ts +8 -0
- package/es/plugins/table/react/TableActionMenu/index.js +481 -0
- package/es/plugins/table/react/TableActionMenu/style.d.ts +1 -0
- package/es/plugins/table/react/TableActionMenu/style.js +7 -0
- package/es/plugins/table/react/TableActionMenu/utils.d.ts +9 -0
- package/es/plugins/table/react/TableActionMenu/utils.js +49 -0
- package/es/plugins/table/react/TableHoverActions/index.d.ts +7 -0
- package/es/plugins/table/react/TableHoverActions/index.js +268 -0
- package/es/plugins/table/react/TableHoverActions/style.d.ts +5 -0
- package/es/plugins/table/react/TableHoverActions/style.js +11 -0
- package/es/plugins/table/react/TableHoverActions/utils.d.ts +8 -0
- package/es/plugins/table/react/TableHoverActions/utils.js +43 -0
- package/es/plugins/table/react/TableResize/index.d.ts +10 -0
- package/es/plugins/table/react/TableResize/index.js +378 -0
- package/es/plugins/table/react/TableResize/style.d.ts +3 -0
- package/es/plugins/table/react/TableResize/style.js +10 -0
- package/es/plugins/table/react/TableResize/utils.d.ts +4 -0
- package/es/plugins/table/react/TableResize/utils.js +40 -0
- package/es/plugins/table/react/hooks.d.ts +1 -0
- package/es/plugins/table/react/hooks.js +22 -0
- package/es/plugins/table/react/index.d.ts +3 -0
- package/es/plugins/table/react/index.js +77 -0
- package/es/plugins/table/react/style.d.ts +1 -0
- package/es/plugins/table/react/style.js +8 -0
- package/es/plugins/table/react/type.d.ts +5 -0
- package/es/plugins/table/react/type.js +1 -0
- package/es/plugins/table/utils/index.d.ts +8 -0
- package/es/plugins/table/utils/index.js +83 -0
- package/es/plugins/upload/index.d.ts +3 -0
- package/es/plugins/upload/index.js +3 -0
- package/es/plugins/upload/plugin/index.d.ts +4 -0
- package/es/plugins/upload/plugin/index.js +82 -0
- package/es/plugins/upload/service/i-upload-service.d.ts +15 -0
- package/es/plugins/upload/service/i-upload-service.js +115 -0
- package/es/plugins/upload/utils/index.d.ts +1 -0
- package/es/plugins/upload/utils/index.js +20 -0
- package/es/react/ChatInput/ChatInput.d.ts +4 -0
- package/es/react/ChatInput/ChatInput.js +41 -0
- package/es/react/ChatInput/index.d.ts +2 -0
- package/es/react/ChatInput/index.js +2 -0
- package/es/react/ChatInput/style.d.ts +4 -0
- package/es/react/ChatInput/style.js +11 -0
- package/es/react/ChatInput/type.d.ts +10 -0
- package/es/react/ChatInput/type.js +1 -0
- package/es/react/ChatInputActionBar/ChatInputActionBar.d.ts +4 -0
- package/es/react/ChatInputActionBar/ChatInputActionBar.js +27 -0
- package/es/react/ChatInputActionBar/index.d.ts +2 -0
- package/es/react/ChatInputActionBar/index.js +2 -0
- package/es/react/ChatInputActionBar/style.d.ts +3 -0
- package/es/react/ChatInputActionBar/style.js +9 -0
- package/es/react/ChatInputActionBar/type.d.ts +7 -0
- package/es/react/ChatInputActionBar/type.js +1 -0
- package/es/react/ChatInputActions/ChatInputActions.d.ts +4 -0
- package/es/react/ChatInputActions/ChatInputActions.js +187 -0
- package/es/react/ChatInputActions/components/ChatInputActionsCollapse.d.ts +4 -0
- package/es/react/ChatInputActions/components/ChatInputActionsCollapse.js +97 -0
- package/es/react/ChatInputActions/index.d.ts +2 -0
- package/es/react/ChatInputActions/index.js +1 -0
- package/es/react/ChatInputActions/style.d.ts +4 -0
- package/es/react/ChatInputActions/style.js +10 -0
- package/es/react/ChatInputActions/type.d.ts +38 -0
- package/es/react/ChatInputActions/type.js +1 -0
- package/es/react/CodeLanguageSelect/CodeLanguageSelect.d.ts +4 -0
- package/es/react/CodeLanguageSelect/CodeLanguageSelect.js +96 -0
- package/es/react/CodeLanguageSelect/index.d.ts +2 -0
- package/es/react/CodeLanguageSelect/index.js +2 -0
- package/es/react/CodeLanguageSelect/style.d.ts +3 -0
- package/es/react/CodeLanguageSelect/style.js +9 -0
- package/es/react/CodeLanguageSelect/type.d.ts +2 -0
- package/es/react/CodeLanguageSelect/type.js +1 -0
- package/es/react/Editor/Editor.d.ts +4 -0
- package/es/react/Editor/Editor.js +78 -0
- package/es/react/Editor/index.d.ts +14 -0
- package/es/react/Editor/index.js +10 -0
- package/es/react/Editor/type.d.ts +24 -0
- package/es/react/Editor/type.js +1 -0
- package/es/react/Editor/useEditor.d.ts +3 -0
- package/es/react/Editor/useEditor.js +4 -0
- package/es/react/Editor/utils.d.ts +2 -0
- package/es/react/Editor/utils.js +3 -0
- package/es/react/EditorProvider/index.d.ts +20 -0
- package/es/react/EditorProvider/index.js +25 -0
- package/es/react/SendButton/SendButton.d.ts +4 -0
- package/es/react/SendButton/SendButton.js +77 -0
- package/es/react/SendButton/components/SendIcon.d.ts +6 -0
- package/es/react/SendButton/components/SendIcon.js +32 -0
- package/es/react/SendButton/components/StopIcon.d.ts +6 -0
- package/es/react/SendButton/components/StopIcon.js +61 -0
- package/es/react/SendButton/index.d.ts +2 -0
- package/es/react/SendButton/index.js +2 -0
- package/es/react/SendButton/style.d.ts +6 -0
- package/es/react/SendButton/style.js +15 -0
- package/es/react/SendButton/type.d.ts +6 -0
- package/es/react/SendButton/type.js +1 -0
- package/es/react/SlashMenu/SlashMenu.d.ts +4 -0
- package/es/react/SlashMenu/SlashMenu.js +68 -0
- package/es/react/SlashMenu/index.d.ts +2 -0
- package/es/react/SlashMenu/index.js +2 -0
- package/es/react/SlashMenu/style.d.ts +4 -0
- package/es/react/SlashMenu/style.js +11 -0
- package/es/react/SlashMenu/type.d.ts +8 -0
- package/es/react/SlashMenu/type.js +1 -0
- package/es/react/index.d.ts +8 -0
- package/es/react/index.js +8 -0
- package/es/types/global.d.ts +20 -0
- package/es/types/index.d.ts +2 -0
- package/es/types/index.js +2 -0
- package/es/types/kernel.d.ts +180 -0
- package/es/types/kernel.js +1 -0
- package/es/types/locale.d.ts +10 -0
- package/es/types/locale.js +1 -0
- package/package.json +66 -0
- package/patches/lexical+0.33.1.patch +88 -0
- package/react.d.ts +1 -0
- package/react.js +1 -0
- package/scripts/patch-lexical-package-json.js +20 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
var _excluded = ["gap", "disabled", "items", "onActionClick", "className"],
|
|
5
|
+
_excluded2 = ["wrapper", "icon", "key", "label", "onClick", "danger", "loading"];
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
12
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
14
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
15
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
19
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
20
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
22
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
23
|
+
import { ActionIcon, Dropdown } from '@lobehub/ui';
|
|
24
|
+
import { useSize } from 'ahooks';
|
|
25
|
+
import { Divider } from 'antd';
|
|
26
|
+
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
27
|
+
import { Flexbox } from 'react-layout-kit';
|
|
28
|
+
import ChatInputActionsCollapse from "./components/ChatInputActionsCollapse";
|
|
29
|
+
import { useStyles } from "./style";
|
|
30
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
31
|
+
var ChatInputActions = /*#__PURE__*/memo(function (_ref) {
|
|
32
|
+
var _ref$gap = _ref.gap,
|
|
33
|
+
gap = _ref$gap === void 0 ? 2 : _ref$gap,
|
|
34
|
+
disabled = _ref.disabled,
|
|
35
|
+
_ref$items = _ref.items,
|
|
36
|
+
items = _ref$items === void 0 ? [] : _ref$items,
|
|
37
|
+
onActionClick = _ref.onActionClick,
|
|
38
|
+
className = _ref.className,
|
|
39
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
40
|
+
var _useStyles = useStyles(),
|
|
41
|
+
cx = _useStyles.cx,
|
|
42
|
+
styles = _useStyles.styles;
|
|
43
|
+
var _useState = useState(items.length),
|
|
44
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
45
|
+
maxCount = _useState2[0],
|
|
46
|
+
setMaxCount = _useState2[1];
|
|
47
|
+
var _useState3 = useState(false),
|
|
48
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
49
|
+
collapsed = _useState4[0],
|
|
50
|
+
setCollapsed = _useState4[1];
|
|
51
|
+
var ref = useRef(null);
|
|
52
|
+
var size = useSize(ref);
|
|
53
|
+
var flatItems = useMemo(function () {
|
|
54
|
+
return items.flatMap(function (item) {
|
|
55
|
+
if (item.type === 'collapse' && item.children) {
|
|
56
|
+
return item.children;
|
|
57
|
+
}
|
|
58
|
+
return item;
|
|
59
|
+
}).filter(function (item) {
|
|
60
|
+
return item.type !== 'divider';
|
|
61
|
+
});
|
|
62
|
+
}, [items]);
|
|
63
|
+
useEffect(function () {
|
|
64
|
+
if (!(size !== null && size !== void 0 && size.width)) return;
|
|
65
|
+
var length = flatItems.length + 1;
|
|
66
|
+
var calcMaxCount = Math.floor(size.width / 48);
|
|
67
|
+
setMaxCount(calcMaxCount);
|
|
68
|
+
if (calcMaxCount < length) {
|
|
69
|
+
setCollapsed(true);
|
|
70
|
+
} else {
|
|
71
|
+
setCollapsed(false);
|
|
72
|
+
}
|
|
73
|
+
}, [size, flatItems.length]);
|
|
74
|
+
var calcItem = useMemo(function () {
|
|
75
|
+
if (!collapsed) return items;
|
|
76
|
+
var alwaysDisplayItems = items.filter(function (item) {
|
|
77
|
+
return item.alwaysDisplay;
|
|
78
|
+
});
|
|
79
|
+
var normalItems = items.filter(function (item) {
|
|
80
|
+
return item.type !== 'collapse' && !item.alwaysDisplay;
|
|
81
|
+
});
|
|
82
|
+
var collapseItems = items.find(function (item) {
|
|
83
|
+
return item.type === 'collapse' && item.children;
|
|
84
|
+
}) || {
|
|
85
|
+
children: [],
|
|
86
|
+
type: 'collapse'
|
|
87
|
+
};
|
|
88
|
+
var sliceCount = maxCount - alwaysDisplayItems.length - 1;
|
|
89
|
+
return [].concat(_toConsumableArray(normalItems.slice(0, sliceCount)), [_objectSpread(_objectSpread({}, collapseItems), {}, {
|
|
90
|
+
children: [].concat(_toConsumableArray(normalItems.filter(function (item) {
|
|
91
|
+
return item.type !== 'divider';
|
|
92
|
+
}).slice(sliceCount)), _toConsumableArray(collapseItems.children))
|
|
93
|
+
})], _toConsumableArray(alwaysDisplayItems)).filter(Boolean);
|
|
94
|
+
}, [collapsed, items, flatItems, maxCount]);
|
|
95
|
+
var mapActions = useCallback(function (item, i) {
|
|
96
|
+
if (item.type === 'divider') {
|
|
97
|
+
return /*#__PURE__*/_jsx(Divider, {
|
|
98
|
+
className: styles.divider,
|
|
99
|
+
style: {
|
|
100
|
+
height: 20
|
|
101
|
+
},
|
|
102
|
+
type: 'vertical'
|
|
103
|
+
}, i);
|
|
104
|
+
}
|
|
105
|
+
var wrapper = item.wrapper,
|
|
106
|
+
icon = item.icon,
|
|
107
|
+
key = item.key,
|
|
108
|
+
label = item.label,
|
|
109
|
+
_onClick = item.onClick,
|
|
110
|
+
danger = item.danger,
|
|
111
|
+
loading = item.loading,
|
|
112
|
+
itemRest = _objectWithoutProperties(item, _excluded2);
|
|
113
|
+
var node = item.children || /*#__PURE__*/_jsx(ActionIcon, {
|
|
114
|
+
active: item.active,
|
|
115
|
+
danger: danger,
|
|
116
|
+
disabled: disabled || loading || (itemRest === null || itemRest === void 0 ? void 0 : itemRest.disabled),
|
|
117
|
+
icon: icon,
|
|
118
|
+
loading: loading,
|
|
119
|
+
onClick: function onClick(e) {
|
|
120
|
+
onActionClick === null || onActionClick === void 0 || onActionClick({
|
|
121
|
+
domEvent: e,
|
|
122
|
+
key: String(key),
|
|
123
|
+
keyPath: [String(key)]
|
|
124
|
+
});
|
|
125
|
+
_onClick === null || _onClick === void 0 || _onClick(e);
|
|
126
|
+
},
|
|
127
|
+
size: {
|
|
128
|
+
blockSize: 36,
|
|
129
|
+
size: 20
|
|
130
|
+
},
|
|
131
|
+
title: label,
|
|
132
|
+
tooltipProps: {
|
|
133
|
+
placement: 'top'
|
|
134
|
+
}
|
|
135
|
+
}, key);
|
|
136
|
+
if (!wrapper) return node;
|
|
137
|
+
return wrapper(node, String(key));
|
|
138
|
+
}, [disabled, onActionClick, styles.divider]);
|
|
139
|
+
return /*#__PURE__*/_jsx(Flexbox, _objectSpread(_objectSpread({
|
|
140
|
+
align: 'center',
|
|
141
|
+
className: cx(styles.container, className),
|
|
142
|
+
flex: 'none',
|
|
143
|
+
gap: gap,
|
|
144
|
+
horizontal: true,
|
|
145
|
+
ref: ref
|
|
146
|
+
}, rest), {}, {
|
|
147
|
+
children: calcItem.map(function (item, index) {
|
|
148
|
+
if (item.type === 'collapse') {
|
|
149
|
+
return /*#__PURE__*/_jsx(ChatInputActionsCollapse, {
|
|
150
|
+
defaultExpand: item.defaultExpand,
|
|
151
|
+
expand: item.expand,
|
|
152
|
+
gap: gap,
|
|
153
|
+
mode: collapsed ? 'popup' : 'default',
|
|
154
|
+
onChange: item.onChange,
|
|
155
|
+
children: item.children.map(function (child, childIndex) {
|
|
156
|
+
return mapActions(child, childIndex);
|
|
157
|
+
})
|
|
158
|
+
}, index);
|
|
159
|
+
}
|
|
160
|
+
if (item.type === 'dropdown') {
|
|
161
|
+
return /*#__PURE__*/_jsx(Dropdown, {
|
|
162
|
+
menu: {
|
|
163
|
+
items: item.children
|
|
164
|
+
},
|
|
165
|
+
children: /*#__PURE__*/_jsx(ActionIcon, {
|
|
166
|
+
active: item.active,
|
|
167
|
+
danger: item.danger,
|
|
168
|
+
disabled: disabled || item.loading || (item === null || item === void 0 ? void 0 : item.disabled),
|
|
169
|
+
icon: item.icon,
|
|
170
|
+
loading: item.loading,
|
|
171
|
+
size: {
|
|
172
|
+
blockSize: 36,
|
|
173
|
+
size: 20
|
|
174
|
+
},
|
|
175
|
+
title: item.label,
|
|
176
|
+
tooltipProps: {
|
|
177
|
+
placement: 'top'
|
|
178
|
+
}
|
|
179
|
+
})
|
|
180
|
+
}, item.key);
|
|
181
|
+
}
|
|
182
|
+
return mapActions(item, index);
|
|
183
|
+
})
|
|
184
|
+
}));
|
|
185
|
+
});
|
|
186
|
+
ChatInputActions.displayName = 'ChatInputActions';
|
|
187
|
+
export default ChatInputActions;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
import { ActionIcon } from '@lobehub/ui';
|
|
10
|
+
import { Popover } from 'antd';
|
|
11
|
+
import { motion } from 'framer-motion';
|
|
12
|
+
import { CircleChevronLeftIcon, CircleChevronRightIcon, CircleChevronUpIcon } from 'lucide-react';
|
|
13
|
+
import { memo } from 'react';
|
|
14
|
+
import { Flexbox } from 'react-layout-kit';
|
|
15
|
+
import useMergeState from 'use-merge-value';
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
var ChatInputActionsCollapse = /*#__PURE__*/memo(function (_ref) {
|
|
19
|
+
var children = _ref.children,
|
|
20
|
+
expand = _ref.expand,
|
|
21
|
+
_ref$defaultExpand = _ref.defaultExpand,
|
|
22
|
+
defaultExpand = _ref$defaultExpand === void 0 ? true : _ref$defaultExpand,
|
|
23
|
+
onChange = _ref.onChange,
|
|
24
|
+
gap = _ref.gap,
|
|
25
|
+
mode = _ref.mode;
|
|
26
|
+
var _useMergeState = useMergeState(defaultExpand, {
|
|
27
|
+
defaultValue: defaultExpand,
|
|
28
|
+
onChange: onChange,
|
|
29
|
+
value: expand
|
|
30
|
+
}),
|
|
31
|
+
_useMergeState2 = _slicedToArray(_useMergeState, 2),
|
|
32
|
+
expanded = _useMergeState2[0],
|
|
33
|
+
setExpaned = _useMergeState2[1];
|
|
34
|
+
if (mode === 'popup') {
|
|
35
|
+
return /*#__PURE__*/_jsx(Popover, {
|
|
36
|
+
arrow: false,
|
|
37
|
+
content: /*#__PURE__*/_jsx(Flexbox, {
|
|
38
|
+
align: 'center',
|
|
39
|
+
gap: gap,
|
|
40
|
+
horizontal: true,
|
|
41
|
+
children: children
|
|
42
|
+
}),
|
|
43
|
+
styles: {
|
|
44
|
+
body: {
|
|
45
|
+
padding: 4
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
children: /*#__PURE__*/_jsx(ActionIcon, {
|
|
49
|
+
icon: CircleChevronUpIcon,
|
|
50
|
+
size: {
|
|
51
|
+
blockSize: 36,
|
|
52
|
+
size: 20
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
58
|
+
align: 'center',
|
|
59
|
+
flex: 'none',
|
|
60
|
+
gap: gap,
|
|
61
|
+
horizontal: true,
|
|
62
|
+
children: [/*#__PURE__*/_jsx(motion.div, {
|
|
63
|
+
animate: expanded ? 'open' : 'closed',
|
|
64
|
+
style: {
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
display: 'flex',
|
|
67
|
+
gap: gap,
|
|
68
|
+
overflow: 'hidden'
|
|
69
|
+
},
|
|
70
|
+
transition: {
|
|
71
|
+
duration: 0.2
|
|
72
|
+
},
|
|
73
|
+
variants: {
|
|
74
|
+
closed: {
|
|
75
|
+
opacity: 0,
|
|
76
|
+
width: 0
|
|
77
|
+
},
|
|
78
|
+
open: {
|
|
79
|
+
opacity: 1,
|
|
80
|
+
width: 'auto'
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
children: children
|
|
84
|
+
}), /*#__PURE__*/_jsx(ActionIcon, {
|
|
85
|
+
icon: expanded ? CircleChevronLeftIcon : CircleChevronRightIcon,
|
|
86
|
+
onClick: function onClick() {
|
|
87
|
+
return setExpaned(!expanded);
|
|
88
|
+
},
|
|
89
|
+
size: {
|
|
90
|
+
blockSize: 36,
|
|
91
|
+
size: 20
|
|
92
|
+
}
|
|
93
|
+
})]
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
ChatInputActionsCollapse.displayName = 'ChatInputActionsCollapse';
|
|
97
|
+
export default ChatInputActionsCollapse;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ChatInputActions";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var _templateObject, _templateObject2;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css;
|
|
6
|
+
return {
|
|
7
|
+
container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n flex: 1;\n "]))),
|
|
8
|
+
divider: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-inline: 4px;\n "])))
|
|
9
|
+
};
|
|
10
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { MenuInfo, MenuItemType } from '@lobehub/ui';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { FlexboxProps } from 'react-layout-kit';
|
|
4
|
+
export type ChatInputActionEvent = Pick<MenuInfo, 'key' | 'keyPath' | 'domEvent'>;
|
|
5
|
+
export type ActionItem = MenuItemType & {
|
|
6
|
+
active?: boolean;
|
|
7
|
+
alwaysDisplay?: boolean;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
wrapper?: (dom: ReactNode, key: string) => ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export type DividerItem = {
|
|
12
|
+
type: 'divider';
|
|
13
|
+
};
|
|
14
|
+
export type CollapseItem = {
|
|
15
|
+
children: (ActionItem | DividerItem)[];
|
|
16
|
+
defaultExpand?: boolean;
|
|
17
|
+
expand?: boolean;
|
|
18
|
+
onChange?: (expand: boolean) => void;
|
|
19
|
+
type: 'collapse';
|
|
20
|
+
};
|
|
21
|
+
export type DropdownItem = Omit<ActionItem, 'children' | 'type'> & {
|
|
22
|
+
children: MenuItemType[];
|
|
23
|
+
type: 'dropdown';
|
|
24
|
+
};
|
|
25
|
+
export type ChatInputActionItem = ActionItem | DividerItem | CollapseItem | DropdownItem;
|
|
26
|
+
export interface ChatInputActionsProps extends Omit<FlexboxProps, 'children'> {
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
items?: ChatInputActionItem[];
|
|
29
|
+
onActionClick?: (action: ChatInputActionEvent) => void;
|
|
30
|
+
}
|
|
31
|
+
export interface ChatInputActionsCollapseProps {
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
defaultExpand?: boolean;
|
|
34
|
+
expand?: boolean;
|
|
35
|
+
gap?: FlexboxProps['gap'];
|
|
36
|
+
mode?: 'default' | 'popup';
|
|
37
|
+
onChange?: (expand: boolean) => void;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
var _excluded = ["className"];
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
11
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
14
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
15
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
16
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
17
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
|
+
import { MaterialFileTypeIcon, Select, Text } from '@lobehub/ui';
|
|
19
|
+
import { memo, useMemo } from 'react';
|
|
20
|
+
import { Flexbox } from 'react-layout-kit';
|
|
21
|
+
import { bundledLanguagesInfo } from 'shiki';
|
|
22
|
+
import { useStyles } from "./style";
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
+
var CodeLanguageSelect = /*#__PURE__*/memo(function (_ref) {
|
|
26
|
+
var className = _ref.className,
|
|
27
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
+
var _useStyles = useStyles(),
|
|
29
|
+
cx = _useStyles.cx,
|
|
30
|
+
styles = _useStyles.styles;
|
|
31
|
+
var options = useMemo(function () {
|
|
32
|
+
return [{
|
|
33
|
+
aliases: ['text', 'txt'],
|
|
34
|
+
label: /*#__PURE__*/_jsxs(Flexbox, {
|
|
35
|
+
align: 'center',
|
|
36
|
+
gap: 4,
|
|
37
|
+
horizontal: true,
|
|
38
|
+
children: [/*#__PURE__*/_jsx(MaterialFileTypeIcon, {
|
|
39
|
+
fallbackUnknownType: false,
|
|
40
|
+
filename: "*.txt",
|
|
41
|
+
size: 18,
|
|
42
|
+
type: 'file',
|
|
43
|
+
variant: 'raw'
|
|
44
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
45
|
+
ellipsis: true,
|
|
46
|
+
fontSize: 13,
|
|
47
|
+
children: "Plaintext"
|
|
48
|
+
})]
|
|
49
|
+
}),
|
|
50
|
+
value: 'plaintext'
|
|
51
|
+
}].concat(_toConsumableArray(bundledLanguagesInfo.map(function (item) {
|
|
52
|
+
var _item$aliases;
|
|
53
|
+
return {
|
|
54
|
+
aliases: item.aliases,
|
|
55
|
+
label: /*#__PURE__*/_jsxs(Flexbox, {
|
|
56
|
+
align: 'center',
|
|
57
|
+
gap: 4,
|
|
58
|
+
horizontal: true,
|
|
59
|
+
children: [/*#__PURE__*/_jsx(MaterialFileTypeIcon, {
|
|
60
|
+
fallbackUnknownType: false,
|
|
61
|
+
filename: "*.".concat((item === null || item === void 0 || (_item$aliases = item.aliases) === null || _item$aliases === void 0 ? void 0 : _item$aliases[0]) || item.id),
|
|
62
|
+
size: 18,
|
|
63
|
+
type: 'file',
|
|
64
|
+
variant: 'raw'
|
|
65
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
66
|
+
ellipsis: true,
|
|
67
|
+
fontSize: 13,
|
|
68
|
+
children: item.name
|
|
69
|
+
})]
|
|
70
|
+
}),
|
|
71
|
+
title: (item.aliases || [item.id]).filter(Boolean).map(function (item) {
|
|
72
|
+
return "*.".concat(item);
|
|
73
|
+
}).join(','),
|
|
74
|
+
value: item.id
|
|
75
|
+
};
|
|
76
|
+
})));
|
|
77
|
+
}, []);
|
|
78
|
+
return /*#__PURE__*/_jsx(Select, _objectSpread({
|
|
79
|
+
className: cx(styles.container, className),
|
|
80
|
+
defaultValue: 'plaintext',
|
|
81
|
+
filterOption: function filterOption(input, option) {
|
|
82
|
+
var _option$value, _option$aliases;
|
|
83
|
+
var lang = input.toLowerCase();
|
|
84
|
+
if (option !== null && option !== void 0 && (_option$value = option.value) !== null && _option$value !== void 0 && _option$value.startsWith(lang)) return true;
|
|
85
|
+
if (option !== null && option !== void 0 && (_option$aliases = option.aliases) !== null && _option$aliases !== void 0 && _option$aliases.some(function (item) {
|
|
86
|
+
return item.startsWith(lang);
|
|
87
|
+
})) return true;
|
|
88
|
+
return false;
|
|
89
|
+
},
|
|
90
|
+
options: options,
|
|
91
|
+
showSearch: true,
|
|
92
|
+
variant: 'filled'
|
|
93
|
+
}, rest));
|
|
94
|
+
});
|
|
95
|
+
CodeLanguageSelect.displayName = 'CodeLanguageSelect';
|
|
96
|
+
export default CodeLanguageSelect;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var _templateObject;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css;
|
|
6
|
+
return {
|
|
7
|
+
container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 160px;\n "])))
|
|
8
|
+
};
|
|
9
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
var _excluded = ["markdownWriter"];
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
11
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
|
+
import { createElement, memo } from 'react';
|
|
13
|
+
import { ReactEditor } from "../../editor-kernel/react/react-editor";
|
|
14
|
+
import { ReactEditorContent, ReactPlainText } from "../../plugins/common";
|
|
15
|
+
import { ReactMentionPlugin } from "../../plugins/mention";
|
|
16
|
+
import { ReactSlashOption, ReactSlashPlugin } from "../../plugins/slash";
|
|
17
|
+
import { useEditorContent } from "../EditorProvider";
|
|
18
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
var Editor = /*#__PURE__*/memo(function (_ref) {
|
|
21
|
+
var content = _ref.content,
|
|
22
|
+
style = _ref.style,
|
|
23
|
+
className = _ref.className,
|
|
24
|
+
editorRef = _ref.editorRef,
|
|
25
|
+
onChange = _ref.onChange,
|
|
26
|
+
placeholder = _ref.placeholder,
|
|
27
|
+
_ref$plugins = _ref.plugins,
|
|
28
|
+
plugins = _ref$plugins === void 0 ? [] : _ref$plugins,
|
|
29
|
+
_ref$slashOption = _ref.slashOption,
|
|
30
|
+
slashOption = _ref$slashOption === void 0 ? {} : _ref$slashOption,
|
|
31
|
+
_ref$mentionOption = _ref.mentionOption,
|
|
32
|
+
mentionOption = _ref$mentionOption === void 0 ? {} : _ref$mentionOption,
|
|
33
|
+
variant = _ref.variant,
|
|
34
|
+
theme = _ref.theme,
|
|
35
|
+
children = _ref.children;
|
|
36
|
+
var _useEditorContent = useEditorContent(),
|
|
37
|
+
config = _useEditorContent.config;
|
|
38
|
+
var enableSlash = Boolean((slashOption === null || slashOption === void 0 ? void 0 : slashOption.items) && slashOption.items.length > 0);
|
|
39
|
+
var enableMention = Boolean((mentionOption === null || mentionOption === void 0 ? void 0 : mentionOption.items) && mentionOption.items.length > 0);
|
|
40
|
+
var markdownWriter = mentionOption.markdownWriter,
|
|
41
|
+
restMentionOption = _objectWithoutProperties(mentionOption, _excluded);
|
|
42
|
+
return /*#__PURE__*/_jsxs(ReactEditor, {
|
|
43
|
+
config: config,
|
|
44
|
+
editorRef: editorRef,
|
|
45
|
+
children: [/*#__PURE__*/_jsx(ReactPlainText, {
|
|
46
|
+
className: className,
|
|
47
|
+
onChange: onChange,
|
|
48
|
+
style: style,
|
|
49
|
+
theme: theme,
|
|
50
|
+
variant: variant,
|
|
51
|
+
children: /*#__PURE__*/_jsx(ReactEditorContent, {
|
|
52
|
+
content: content,
|
|
53
|
+
placeholder: placeholder,
|
|
54
|
+
type: "json"
|
|
55
|
+
})
|
|
56
|
+
}), plugins.map(function (plugin, index) {
|
|
57
|
+
var withNoProps = typeof plugin === 'function';
|
|
58
|
+
if (withNoProps) return /*#__PURE__*/createElement(plugin, {
|
|
59
|
+
key: index
|
|
60
|
+
});
|
|
61
|
+
return /*#__PURE__*/createElement(plugin[0], _objectSpread({
|
|
62
|
+
key: index
|
|
63
|
+
}, plugin[1]));
|
|
64
|
+
}), enableMention && /*#__PURE__*/_jsx(ReactMentionPlugin, {
|
|
65
|
+
markdownWriter: markdownWriter
|
|
66
|
+
}), (enableSlash || enableMention) && /*#__PURE__*/_jsxs(ReactSlashPlugin, {
|
|
67
|
+
children: [enableSlash ? /*#__PURE__*/_jsx(ReactSlashOption, _objectSpread({
|
|
68
|
+
maxLength: 1,
|
|
69
|
+
trigger: "/"
|
|
70
|
+
}, slashOption)) : undefined, enableMention ? /*#__PURE__*/_jsx(ReactSlashOption, _objectSpread({
|
|
71
|
+
maxLength: 6,
|
|
72
|
+
trigger: "@"
|
|
73
|
+
}, restMentionOption)) : undefined]
|
|
74
|
+
}), children]
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
Editor.displayName = 'Editor';
|
|
78
|
+
export default Editor;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { EditorProps } from './type';
|
|
3
|
+
import { useEditor } from './useEditor';
|
|
4
|
+
import { withProps } from './utils';
|
|
5
|
+
interface IEditor {
|
|
6
|
+
(props: EditorProps): ReactNode;
|
|
7
|
+
useEditor: typeof useEditor;
|
|
8
|
+
withProps: typeof withProps;
|
|
9
|
+
}
|
|
10
|
+
declare const Editor: IEditor;
|
|
11
|
+
export default Editor;
|
|
12
|
+
export * from './type';
|
|
13
|
+
export { useEditor } from './useEditor';
|
|
14
|
+
export * from './utils';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import EditorParent from "./Editor";
|
|
2
|
+
import { useEditor } from "./useEditor";
|
|
3
|
+
import { withProps } from "./utils";
|
|
4
|
+
var Editor = EditorParent;
|
|
5
|
+
Editor.useEditor = useEditor;
|
|
6
|
+
Editor.withProps = withProps;
|
|
7
|
+
export default Editor;
|
|
8
|
+
export * from "./type";
|
|
9
|
+
export { useEditor } from "./useEditor";
|
|
10
|
+
export * from "./utils";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CSSProperties, FC, ReactNode, Ref } from 'react';
|
|
2
|
+
import type { ReactEditorContentProps, ReactPlainTextProps } from "../../plugins/common/react";
|
|
3
|
+
import type { ReactMentionPluginProps } from "../../plugins/mention/react";
|
|
4
|
+
import type { ReactSlashOptionProps } from "../../plugins/slash/react";
|
|
5
|
+
import type { IEditor } from "../../types";
|
|
6
|
+
export type EditorPlugin = FC<any> | [FC<any>, Record<string, any>];
|
|
7
|
+
interface MentionOption extends Partial<ReactSlashOptionProps> {
|
|
8
|
+
markdownWriter?: ReactMentionPluginProps['markdownWriter'];
|
|
9
|
+
}
|
|
10
|
+
export interface EditorProps {
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
content?: ReactEditorContentProps['content'];
|
|
14
|
+
editorRef?: Ref<IEditor>;
|
|
15
|
+
mentionOption?: MentionOption;
|
|
16
|
+
onChange?: (editor: IEditor) => void;
|
|
17
|
+
placeholder?: ReactNode;
|
|
18
|
+
plugins?: EditorPlugin[];
|
|
19
|
+
slashOption?: Partial<ReactSlashOptionProps>;
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
theme?: ReactPlainTextProps['theme'];
|
|
22
|
+
variant?: ReactPlainTextProps['variant'];
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|