@opentiny/tiny-robot 0.4.2-alpha.4 → 0.4.2-alpha.5
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/dist/action-group/ActionGroup.vue.d.ts +26 -0
- package/dist/action-group/ActionGroupItem.vue.d.ts +18 -0
- package/dist/action-group/index.d.ts +12 -0
- package/dist/action-group/index.type.d.ts +17 -0
- package/dist/anchor/components/AnchorItem.vue.d.ts +24 -0
- package/dist/anchor/components/AnchorList.vue.d.ts +20 -0
- package/dist/anchor/components/AnchorOverlay.vue.d.ts +33 -0
- package/dist/anchor/components/AnchorSearch.vue.d.ts +7 -0
- package/dist/anchor/composables/index.d.ts +5 -0
- package/dist/anchor/composables/useActiveSync.d.ts +10 -0
- package/dist/anchor/composables/useFloatingOffset.d.ts +6 -0
- package/dist/anchor/composables/useNavController.d.ts +12 -0
- package/dist/anchor/composables/useOverlayInteractions.d.ts +6 -0
- package/dist/anchor/composables/useTargetFeedback.d.ts +5 -0
- package/dist/anchor/defaults.d.ts +16 -0
- package/dist/anchor/index.d.ts +7 -0
- package/dist/anchor/index.type.d.ts +60 -0
- package/dist/anchor/index.vue.d.ts +159 -0
- package/dist/anchor/internal.type.d.ts +103 -0
- package/dist/anchor/utils/scroll.d.ts +7 -0
- package/dist/anchor/utils/target.d.ts +6 -0
- package/dist/attachments/components/FileCard.vue.d.ts +18 -0
- package/dist/attachments/components/ImagePreview.vue.d.ts +17 -0
- package/dist/attachments/components/index.d.ts +2 -0
- package/dist/attachments/composables/index.d.ts +5 -0
- package/dist/attachments/composables/useFileCard.d.ts +15 -0
- package/dist/attachments/composables/useFileType.d.ts +20 -0
- package/dist/attachments/composables/useImagePreview.d.ts +18 -0
- package/dist/attachments/composables/useListType.d.ts +11 -0
- package/dist/attachments/index.d.ts +7 -0
- package/dist/attachments/index.js +2 -2
- package/dist/attachments/index.type.d.ts +70 -0
- package/dist/attachments/index.vue.d.ts +27 -0
- package/dist/attachments/utils.d.ts +3 -0
- package/dist/base-popper/components/Popper.vue.d.ts +28 -0
- package/dist/base-popper/index.d.ts +2 -0
- package/dist/base-popper/index.vue.d.ts +41 -0
- package/dist/bubble/Bubble.vue.d.ts +39 -0
- package/dist/bubble/BubbleBoxWrapper.vue.d.ts +22 -0
- package/dist/bubble/BubbleContentWrapper.vue.d.ts +16 -0
- package/dist/bubble/BubbleItem.vue.d.ts +36 -0
- package/dist/bubble/BubbleList.vue.d.ts +41 -0
- package/dist/bubble/BubbleProvider.vue.d.ts +18 -0
- package/dist/bubble/composables/index.d.ts +10 -0
- package/dist/bubble/composables/useBubbleBoxRenderer.d.ts +18 -0
- package/dist/bubble/composables/useBubbleContentRenderer.d.ts +18 -0
- package/dist/bubble/composables/useBubbleStateChange.d.ts +2 -0
- package/dist/bubble/composables/useBubbleStore.d.ts +16 -0
- package/dist/bubble/composables/useContentResolver.d.ts +5 -0
- package/dist/bubble/composables/useCopyCleanup.d.ts +6 -0
- package/dist/bubble/composables/useMessageContent.d.ts +5 -0
- package/dist/bubble/composables/useMessageGroup.d.ts +4 -0
- package/dist/bubble/composables/useOmitMessageFields.d.ts +12 -0
- package/dist/bubble/composables/useToolCall.d.ts +25 -0
- package/dist/bubble/constants.d.ts +42 -0
- package/dist/bubble/index.d.ts +19 -0
- package/dist/bubble/index.type.d.ts +171 -0
- package/dist/bubble/renderers/Box.vue.d.ts +18 -0
- package/dist/bubble/renderers/Image.vue.d.ts +4 -0
- package/dist/bubble/renderers/Loading.vue.d.ts +4 -0
- package/dist/bubble/renderers/Markdown.vue.d.ts +4 -0
- package/dist/bubble/renderers/Reasoning.vue.d.ts +9 -0
- package/dist/bubble/renderers/Text.vue.d.ts +4 -0
- package/dist/bubble/renderers/Tool.vue.d.ts +14 -0
- package/dist/bubble/renderers/ToolRole.vue.d.ts +4 -0
- package/dist/bubble/renderers/Tools.vue.d.ts +4 -0
- package/dist/bubble/renderers/allRenderers.d.ts +93 -0
- package/dist/bubble/renderers/defaultRenderers.d.ts +27 -0
- package/dist/bubble/utils.d.ts +7 -0
- package/dist/chat/components/ChatConversation.vue.d.ts +70 -0
- package/dist/chat/components/ChatLauncherButton.vue.d.ts +12 -0
- package/dist/chat/components/ChatMcpTrigger.vue.d.ts +30 -0
- package/dist/chat/components/ChatThemeToggleButton.vue.d.ts +2 -0
- package/dist/chat/components/ChatWelcome.vue.d.ts +13 -0
- package/dist/chat/composables/useChatConversation.d.ts +37 -0
- package/dist/chat/composables/useChatMcp.d.ts +29 -0
- package/dist/chat/composables/useChatModel.d.ts +27 -0
- package/dist/chat/index.d.ts +9 -0
- package/dist/chat/index.js +13701 -0
- package/dist/chat/index.type.d.ts +88 -0
- package/dist/chat/index.vue.d.ts +58 -0
- package/dist/container/index.d.ts +7 -0
- package/dist/container/index.type.d.ts +20 -0
- package/dist/container/index.vue.d.ts +32 -0
- package/dist/conversations/index.d.ts +7 -0
- package/dist/conversations/index.vue.d.ts +2 -0
- package/dist/drag-overlay/constants.d.ts +17 -0
- package/dist/drag-overlay/directives/vDropzone.d.ts +14 -0
- package/dist/drag-overlay/index.d.ts +7 -0
- package/dist/drag-overlay/index.type.d.ts +105 -0
- package/dist/drag-overlay/index.vue.d.ts +20 -0
- package/dist/dropdown-menu/composables/usePopperHover.d.ts +6 -0
- package/dist/dropdown-menu/index.d.ts +7 -0
- package/dist/dropdown-menu/index.js +17 -17
- package/dist/dropdown-menu/index.type.d.ts +42 -0
- package/dist/dropdown-menu/index.vue.d.ts +217 -0
- package/dist/feedback/components/SourceList.vue.d.ts +11 -0
- package/dist/feedback/components/index.d.ts +1 -0
- package/dist/feedback/index.d.ts +7 -0
- package/dist/feedback/index.type.d.ts +25 -0
- package/dist/feedback/index.vue.d.ts +13 -0
- package/dist/flow-layout-buttons/index.d.ts +7 -0
- package/dist/flow-layout-buttons/index.js +1 -1
- package/dist/flow-layout-buttons/index.type.d.ts +35 -0
- package/dist/flow-layout-buttons/index.vue.d.ts +22 -0
- package/dist/history/components/Empty.vue.d.ts +7 -0
- package/dist/history/components/MenuList.vue.d.ts +24 -0
- package/dist/history/composables/useRenameEditor.d.ts +22 -0
- package/dist/history/constants.d.ts +1 -0
- package/dist/history/index.d.ts +7 -0
- package/dist/history/index.type.d.ts +33 -0
- package/dist/history/index.vue.d.ts +18 -0
- package/dist/icon-button/index.d.ts +7 -0
- package/dist/icon-button/index.type.d.ts +7 -0
- package/dist/icon-button/index.vue.d.ts +6 -0
- package/dist/index.d.ts +49 -5018
- package/dist/index.js +1 -1
- package/dist/mcp-add-form/components/CodeEditor.vue.d.ts +9 -0
- package/dist/mcp-add-form/components/FormEditor.vue.d.ts +10 -0
- package/dist/mcp-add-form/components/index.d.ts +2 -0
- package/dist/mcp-add-form/index.d.ts +7 -0
- package/dist/mcp-add-form/index.type.d.ts +19 -0
- package/dist/mcp-add-form/index.vue.d.ts +13 -0
- package/dist/mcp-server-picker/components/NoData.vue.d.ts +7 -0
- package/dist/mcp-server-picker/components/PluginCard.vue.d.ts +40 -0
- package/dist/mcp-server-picker/components/PluginModal.vue.d.ts +15 -0
- package/dist/mcp-server-picker/components/index.d.ts +3 -0
- package/dist/mcp-server-picker/index.d.ts +7 -0
- package/dist/mcp-server-picker/index.js +83 -80
- package/dist/mcp-server-picker/index.type.d.ts +99 -0
- package/dist/mcp-server-picker/index.vue.d.ts +71 -0
- package/dist/prompts/index.d.ts +12 -0
- package/dist/prompts/index.type.d.ts +59 -0
- package/dist/prompts/prompt.vue.d.ts +5 -0
- package/dist/prompts/prompts.vue.d.ts +20 -0
- package/dist/sender/components/editor-content/index.vue.d.ts +4 -0
- package/dist/sender/components/footer/index.vue.d.ts +38 -0
- package/dist/sender/components/layouts/MultiLineLayout.vue.d.ts +43 -0
- package/dist/sender/components/layouts/SingleLineLayout.vue.d.ts +32 -0
- package/dist/sender/composables/index.d.ts +7 -0
- package/dist/sender/composables/useAutoSize.d.ts +5 -0
- package/dist/sender/composables/useEditor.d.ts +13 -0
- package/dist/sender/composables/useKeyboardShortcuts.d.ts +7 -0
- package/dist/sender/composables/useModeSwitch.d.ts +4 -0
- package/dist/sender/composables/useSenderCore.d.ts +31 -0
- package/dist/sender/composables/useSlotScope.d.ts +10 -0
- package/dist/sender/context/index.d.ts +6 -0
- package/dist/sender/context/types.d.ts +7 -0
- package/dist/sender/extensions/constants.d.ts +94 -0
- package/dist/sender/extensions/index.d.ts +12 -0
- package/dist/sender/extensions/mention/commands.d.ts +20 -0
- package/dist/sender/extensions/mention/components/mention-list.vue.d.ts +18 -0
- package/dist/sender/extensions/mention/components/mention-view.vue.d.ts +19 -0
- package/dist/sender/extensions/mention/extension.d.ts +6 -0
- package/dist/sender/extensions/mention/index.d.ts +22 -0
- package/dist/sender/extensions/mention/plugin.d.ts +16 -0
- package/dist/sender/extensions/mention/types.d.ts +126 -0
- package/dist/sender/extensions/mention/utils.d.ts +34 -0
- package/dist/sender/extensions/suggestion/extension.d.ts +8 -0
- package/dist/sender/extensions/suggestion/index.d.ts +20 -0
- package/dist/sender/extensions/suggestion/plugin.d.ts +21 -0
- package/dist/sender/extensions/suggestion/suggestion-list.vue.d.ts +46 -0
- package/dist/sender/extensions/suggestion/types.d.ts +254 -0
- package/dist/sender/extensions/suggestion/utils/filter.d.ts +29 -0
- package/dist/sender/extensions/suggestion/utils/highlight.d.ts +73 -0
- package/dist/sender/extensions/template/block/extension.d.ts +6 -0
- package/dist/sender/extensions/template/block/plugins.d.ts +13 -0
- package/dist/sender/extensions/template/block/template-block-view.vue.d.ts +14 -0
- package/dist/sender/extensions/template/commands.d.ts +31 -0
- package/dist/sender/extensions/template/extension.d.ts +6 -0
- package/dist/sender/extensions/template/index.d.ts +21 -0
- package/dist/sender/extensions/template/select/dropdown-manager.d.ts +23 -0
- package/dist/sender/extensions/template/select/extension.d.ts +5 -0
- package/dist/sender/extensions/template/select/plugins.d.ts +34 -0
- package/dist/sender/extensions/template/select/template-select-view.vue.d.ts +20 -0
- package/dist/sender/extensions/template/types.d.ts +100 -0
- package/dist/sender/extensions/template/utils.d.ts +20 -0
- package/dist/sender/extensions/utils/id-generator.d.ts +16 -0
- package/dist/sender/extensions/utils/index.d.ts +7 -0
- package/dist/sender/extensions/utils/keyboard.d.ts +49 -0
- package/dist/sender/extensions/utils/position.d.ts +25 -0
- package/dist/sender/index.d.ts +136 -0
- package/dist/sender/index.type.d.ts +302 -0
- package/dist/sender/index.vue.d.ts +90 -0
- package/dist/sender/types/base.d.ts +239 -0
- package/dist/sender/types/components.d.ts +68 -0
- package/dist/sender/types/composables.d.ts +122 -0
- package/dist/sender/types/context.d.ts +132 -0
- package/dist/sender/types/slots.d.ts +67 -0
- package/dist/sender/utils/countGraphemes.d.ts +1 -0
- package/dist/sender-actions/action-button/index.vue.d.ts +23 -0
- package/dist/sender-actions/clear-button/index.vue.d.ts +2 -0
- package/dist/sender-actions/clear-button/useClearButtonState.d.ts +6 -0
- package/dist/sender-actions/default-actions/index.vue.d.ts +17 -0
- package/dist/sender-actions/index.d.ts +21 -0
- package/dist/sender-actions/index.type.d.ts +7 -0
- package/dist/sender-actions/submit-button/index.vue.d.ts +2 -0
- package/dist/sender-actions/types/common.d.ts +40 -0
- package/dist/sender-actions/types/index.d.ts +5 -0
- package/dist/sender-actions/types/tooltip.d.ts +7 -0
- package/dist/sender-actions/upload-button/index.type.d.ts +57 -0
- package/dist/sender-actions/upload-button/index.vue.d.ts +16 -0
- package/dist/sender-actions/utils/tooltip.d.ts +8 -0
- package/dist/sender-actions/voice-button/index.type.d.ts +78 -0
- package/dist/sender-actions/voice-button/index.vue.d.ts +43 -0
- package/dist/sender-actions/voice-button/speech.types.d.ts +40 -0
- package/dist/sender-actions/voice-button/useSpeechHandler.d.ts +10 -0
- package/dist/sender-actions/voice-button/webSpeechHandler.d.ts +40 -0
- package/dist/sender-actions/word-counter/index.vue.d.ts +2 -0
- package/dist/sender-compat/index.d.ts +7 -0
- package/dist/sender-compat/index.type.d.ts +91 -0
- package/dist/sender-compat/index.vue.d.ts +532 -0
- package/dist/shared/composables/createTeleport.d.ts +2 -0
- package/dist/shared/composables/index.d.ts +5 -0
- package/dist/shared/composables/useAutoScroll.d.ts +25 -0
- package/dist/shared/composables/useSlotRefs.d.ts +12 -0
- package/dist/shared/composables/useTeleportTarget.d.ts +11 -0
- package/dist/shared/composables/useTouchDevice.d.ts +3 -0
- package/dist/shared/utils.d.ts +7 -0
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/components/PillButton.vue.d.ts +16 -0
- package/dist/suggestion-pills/components/index.d.ts +1 -0
- package/dist/suggestion-pills/index.d.ts +13 -0
- package/dist/suggestion-pills/index.js +12 -12
- package/dist/suggestion-pills/index.type.d.ts +45 -0
- package/dist/suggestion-pills/index.vue.d.ts +44 -0
- package/dist/suggestion-popover/components/Backdrop.vue.d.ts +5 -0
- package/dist/suggestion-popover/components/Header.vue.d.ts +4 -0
- package/dist/suggestion-popover/components/Loading.vue.d.ts +17 -0
- package/dist/suggestion-popover/components/NoData.vue.d.ts +17 -0
- package/dist/suggestion-popover/components/Tooltip.vue.d.ts +19 -0
- package/dist/suggestion-popover/index.d.ts +7 -0
- package/dist/suggestion-popover/index.js +35 -35
- package/dist/suggestion-popover/index.type.d.ts +80 -0
- package/dist/suggestion-popover/index.vue.d.ts +262 -0
- package/dist/theme-provider/constants.d.ts +6 -0
- package/dist/theme-provider/index.d.ts +9 -0
- package/dist/theme-provider/index.js +32 -41
- package/dist/theme-provider/index.type.d.ts +18 -0
- package/dist/theme-provider/index.vue.d.ts +32 -0
- package/dist/theme-provider/useTheme.d.ts +11 -0
- package/dist/useTheme.js +22 -0
- package/dist/welcome/index.d.ts +7 -0
- package/dist/welcome/index.type.d.ts +10 -0
- package/dist/welcome/index.vue.d.ts +18 -0
- package/package.json +22 -3
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface NodeAttrs {
|
|
2
|
+
id: string;
|
|
3
|
+
content: string;
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}
|
|
6
|
+
interface Props {
|
|
7
|
+
node: {
|
|
8
|
+
attrs: NodeAttrs;
|
|
9
|
+
textContent?: string;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { TemplateItem, TemplateAttrs, TemplateSelectAttrs } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Template 命令集合
|
|
5
|
+
*/
|
|
6
|
+
export declare const templateCommands: {
|
|
7
|
+
/**
|
|
8
|
+
* 设置模板数据(批量)
|
|
9
|
+
*/
|
|
10
|
+
setTemplateData: (items: TemplateItem[]) => ({ commands }: {
|
|
11
|
+
commands: Editor["commands"];
|
|
12
|
+
}) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* 插入模板块
|
|
15
|
+
*/
|
|
16
|
+
insertTemplate: (attrs: Partial<TemplateAttrs>) => ({ commands }: {
|
|
17
|
+
commands: Editor["commands"];
|
|
18
|
+
}) => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 聚焦到第一个模板块
|
|
21
|
+
*/
|
|
22
|
+
focusFirstTemplate: () => ({ editor }: {
|
|
23
|
+
editor: Editor;
|
|
24
|
+
}) => boolean;
|
|
25
|
+
/**
|
|
26
|
+
* 插入选择器
|
|
27
|
+
*/
|
|
28
|
+
insertTemplateSelect: (attrs: Partial<TemplateSelectAttrs>) => ({ commands }: {
|
|
29
|
+
commands: Editor["commands"];
|
|
30
|
+
}) => boolean;
|
|
31
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { TemplateItem, TemplateOptions } from './types';
|
|
3
|
+
export { Template } from './extension';
|
|
4
|
+
export { TemplateSelect } from './select/extension';
|
|
5
|
+
export { templateCommands } from './commands';
|
|
6
|
+
export * from './types';
|
|
7
|
+
export { getTextWithTemplates, getTemplateStructuredData } from './utils';
|
|
8
|
+
export { TemplateSelectDropdownPluginKey } from './select/plugins';
|
|
9
|
+
/**
|
|
10
|
+
* 创建 Template 扩展的便捷函数
|
|
11
|
+
*
|
|
12
|
+
* @param items - 模板项列表
|
|
13
|
+
* @param options - 其他配置项
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const extensions = [template(templates)]
|
|
18
|
+
* const extensions = [template(templates, { HTMLAttributes: { class: 'custom' } })]
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function template(items: TemplateItem[] | Ref<TemplateItem[]>, options?: Partial<Omit<TemplateOptions, 'items'>>): import('@tiptap/core').Extension<TemplateOptions, any>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 下拉菜单管理器(单例模式)
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* 打开下拉菜单
|
|
6
|
+
*/
|
|
7
|
+
export declare function openDropdown(selectId: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* 关闭下拉菜单
|
|
10
|
+
*/
|
|
11
|
+
export declare function closeDropdown(selectId: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* 获取当前打开的下拉菜单 ID
|
|
14
|
+
*/
|
|
15
|
+
export declare function getCurrentOpenDropdown(): string | null;
|
|
16
|
+
/**
|
|
17
|
+
* 关闭所有下拉菜单
|
|
18
|
+
*/
|
|
19
|
+
export declare function closeAllDropdowns(): void;
|
|
20
|
+
/**
|
|
21
|
+
* 设置点击外部关闭监听
|
|
22
|
+
*/
|
|
23
|
+
export declare function setupClickOutside(selectElement: HTMLElement, dropdownElement: HTMLElement, onClose: () => void): () => void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Plugin, PluginKey } from '@tiptap/pm/state';
|
|
2
|
+
/**
|
|
3
|
+
* Template Select 下拉菜单状态
|
|
4
|
+
*/
|
|
5
|
+
interface TemplateSelectDropdownState {
|
|
6
|
+
/**
|
|
7
|
+
* 是否有下拉菜单打开
|
|
8
|
+
*/
|
|
9
|
+
isOpen: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* 当前打开的下拉菜单 ID
|
|
12
|
+
*/
|
|
13
|
+
selectId: string | null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Template Select 下拉菜单状态插件 Key
|
|
17
|
+
*/
|
|
18
|
+
export declare const TemplateSelectDropdownPluginKey: PluginKey<TemplateSelectDropdownState>;
|
|
19
|
+
/**
|
|
20
|
+
* 下拉菜单状态管理插件
|
|
21
|
+
* 用于在 ProseMirror 插件状态中跟踪下拉菜单的打开/关闭状态
|
|
22
|
+
*/
|
|
23
|
+
export declare function selectDropdownStatePlugin(): Plugin<TemplateSelectDropdownState>;
|
|
24
|
+
/**
|
|
25
|
+
* 零宽字符管理插件
|
|
26
|
+
* 注意:零宽字符现在由 Vue 组件直接渲染,不需要插件动态插入
|
|
27
|
+
* 这个插件保留用于清理孤立的零宽字符
|
|
28
|
+
*/
|
|
29
|
+
export declare function selectZeroWidthPlugin(): Plugin<any>;
|
|
30
|
+
/**
|
|
31
|
+
* 键盘导航插件
|
|
32
|
+
*/
|
|
33
|
+
export declare function selectKeyboardPlugin(): Plugin<any>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { SelectOption } from '../types';
|
|
3
|
+
interface NodeAttrs {
|
|
4
|
+
id: string;
|
|
5
|
+
placeholder: string;
|
|
6
|
+
options: SelectOption[];
|
|
7
|
+
value?: string;
|
|
8
|
+
}
|
|
9
|
+
interface Props {
|
|
10
|
+
node: {
|
|
11
|
+
attrs: NodeAttrs;
|
|
12
|
+
};
|
|
13
|
+
updateAttributes: (attrs: Record<string, unknown>) => void;
|
|
14
|
+
editor: Editor;
|
|
15
|
+
}
|
|
16
|
+
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
17
|
+
triggerRef: HTMLSpanElement;
|
|
18
|
+
dropdownRef: HTMLDivElement;
|
|
19
|
+
}, any>;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { TemplateItem, SelectOption } from '../../index.type';
|
|
3
|
+
export type { TemplateItem, SelectOption };
|
|
4
|
+
/**
|
|
5
|
+
* TemplateSelect 节点属性
|
|
6
|
+
*/
|
|
7
|
+
export interface TemplateSelectAttrs {
|
|
8
|
+
/**
|
|
9
|
+
* 唯一标识
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
/**
|
|
13
|
+
* 占位文字(未选择时显示)
|
|
14
|
+
*/
|
|
15
|
+
placeholder: string;
|
|
16
|
+
/**
|
|
17
|
+
* 选项列表
|
|
18
|
+
*/
|
|
19
|
+
options: SelectOption[];
|
|
20
|
+
/**
|
|
21
|
+
* 当前选中的值(可选)
|
|
22
|
+
*/
|
|
23
|
+
value?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Template 节点属性
|
|
27
|
+
*/
|
|
28
|
+
export interface TemplateAttrs {
|
|
29
|
+
/**
|
|
30
|
+
* 模板块 ID
|
|
31
|
+
*/
|
|
32
|
+
id: string;
|
|
33
|
+
/**
|
|
34
|
+
* 模板块内容
|
|
35
|
+
*/
|
|
36
|
+
content: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Template 配置选项
|
|
40
|
+
*/
|
|
41
|
+
export interface TemplateOptions {
|
|
42
|
+
/**
|
|
43
|
+
* 模板数据列表(推荐使用 ref 实现响应式)
|
|
44
|
+
*
|
|
45
|
+
* 支持两种配置方式:
|
|
46
|
+
* 1. 传入 ref(推荐):自动双向绑定,解决时序问题
|
|
47
|
+
* 2. 传入数组:仅用于静态初始化
|
|
48
|
+
*
|
|
49
|
+
* @example 响应式配置(推荐)
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const items = ref<TemplateItem[]>([
|
|
52
|
+
* { type: 'text', content: '帮我分析' },
|
|
53
|
+
* { type: 'template', content: '' }
|
|
54
|
+
* ])
|
|
55
|
+
* Template.configure({ items }) // 传入 ref,自动双向绑定
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @example 静态配置
|
|
59
|
+
* ```typescript
|
|
60
|
+
* Template.configure({
|
|
61
|
+
* items: [
|
|
62
|
+
* { type: 'text', content: '帮我分析' },
|
|
63
|
+
* { type: 'template', content: '' }
|
|
64
|
+
* ]
|
|
65
|
+
* })
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
items?: TemplateItem[] | Ref<TemplateItem[]>;
|
|
69
|
+
/**
|
|
70
|
+
* HTML 属性
|
|
71
|
+
*/
|
|
72
|
+
HTMLAttributes?: Record<string, unknown>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 扩展 Tiptap Commands 接口
|
|
76
|
+
*
|
|
77
|
+
* 使 TypeScript 能够识别自定义命令
|
|
78
|
+
*/
|
|
79
|
+
declare module '@tiptap/core' {
|
|
80
|
+
interface Commands<ReturnType> {
|
|
81
|
+
template: {
|
|
82
|
+
/**
|
|
83
|
+
* 设置模板数据(批量)
|
|
84
|
+
*/
|
|
85
|
+
setTemplateData: (items: TemplateItem[]) => ReturnType;
|
|
86
|
+
/**
|
|
87
|
+
* 插入模板块
|
|
88
|
+
*/
|
|
89
|
+
insertTemplate: (attrs: Partial<TemplateAttrs>) => ReturnType;
|
|
90
|
+
/**
|
|
91
|
+
* 聚焦到第一个模板块
|
|
92
|
+
*/
|
|
93
|
+
focusFirstTemplate: () => ReturnType;
|
|
94
|
+
/**
|
|
95
|
+
* 插入选择器
|
|
96
|
+
*/
|
|
97
|
+
insertTemplateSelect: (attrs: Partial<TemplateSelectAttrs>) => ReturnType;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { TemplateItem } from '../../index.type';
|
|
3
|
+
/**
|
|
4
|
+
* 零宽字符常量
|
|
5
|
+
* Unicode: U+200B (Zero Width Space)
|
|
6
|
+
* HTML Entity: ​
|
|
7
|
+
*/
|
|
8
|
+
export declare const ZERO_WIDTH_CHAR = "\u200B";
|
|
9
|
+
/**
|
|
10
|
+
* 获取包含 template 的完整文本
|
|
11
|
+
*
|
|
12
|
+
* 例如:请帮我分析 [模板内容1] 和 [模板内容2]
|
|
13
|
+
*/
|
|
14
|
+
export declare function getTextWithTemplates(editor: Editor): string;
|
|
15
|
+
/**
|
|
16
|
+
* 获取结构化数据(辅助函数)
|
|
17
|
+
*
|
|
18
|
+
* 返回包含文本和模板块的结构化数组
|
|
19
|
+
*/
|
|
20
|
+
export declare function getTemplateStructuredData(editor: Editor): TemplateItem[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 生成唯一 ID
|
|
3
|
+
*
|
|
4
|
+
* 用于所有扩展生成唯一标识符
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* 生成唯一 ID
|
|
8
|
+
*
|
|
9
|
+
* @param prefix - ID 前缀
|
|
10
|
+
* @returns 唯一 ID 字符串
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* generateId('mention') // mention_1701234567890_abc123def
|
|
14
|
+
* generateId('template') // template_1701234567890_xyz789uvw
|
|
15
|
+
*/
|
|
16
|
+
export declare function generateId(prefix: string): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { KEYBOARD_KEYS } from '../constants';
|
|
2
|
+
/**
|
|
3
|
+
* 键盘按键类型
|
|
4
|
+
*/
|
|
5
|
+
export type KeyboardKey = keyof typeof KEYBOARD_KEYS;
|
|
6
|
+
/**
|
|
7
|
+
* 检查是否按下指定按键
|
|
8
|
+
*
|
|
9
|
+
* @param event - 键盘事件
|
|
10
|
+
* @param key - 按键名称
|
|
11
|
+
* @returns 是否按下指定按键
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* if (isKey(event, 'ENTER')) { ... }
|
|
15
|
+
* if (isKey(event, 'ARROW_UP')) { ... }
|
|
16
|
+
*/
|
|
17
|
+
export declare const isKey: (event: KeyboardEvent, key: KeyboardKey) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 检查是否按下多个按键中的任意一个
|
|
20
|
+
*
|
|
21
|
+
* @param event - 键盘事件
|
|
22
|
+
* @param keys - 按键名称数组
|
|
23
|
+
* @returns 是否按下指定按键之一
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* if (isAnyKey(event, ['ARROW_UP', 'ARROW_DOWN'])) { ... }
|
|
27
|
+
* if (isAnyKey(event, ['ENTER', 'TAB'])) { ... }
|
|
28
|
+
*/
|
|
29
|
+
export declare const isAnyKey: (event: KeyboardEvent, keys: KeyboardKey[]) => boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 检查是否按下方向键
|
|
32
|
+
*
|
|
33
|
+
* @param event - 键盘事件
|
|
34
|
+
* @returns 是否按下方向键
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* if (isArrowKey(event)) { ... }
|
|
38
|
+
*/
|
|
39
|
+
export declare const isArrowKey: (event: KeyboardEvent) => boolean;
|
|
40
|
+
/**
|
|
41
|
+
* 检查是否按下删除键(Backspace 或 Delete)
|
|
42
|
+
*
|
|
43
|
+
* @param event - 键盘事件
|
|
44
|
+
* @returns 是否按下删除键
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* if (isDeleteKey(event)) { ... }
|
|
48
|
+
*/
|
|
49
|
+
export declare const isDeleteKey: (event: KeyboardEvent) => boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Selection } from '@tiptap/pm/state';
|
|
2
|
+
/**
|
|
3
|
+
* 查找触发字符的位置和查询文本
|
|
4
|
+
*
|
|
5
|
+
* 用于 mention 和 suggestion 扩展
|
|
6
|
+
*
|
|
7
|
+
* @param selection - 当前光标位置
|
|
8
|
+
* @param char - 触发字符
|
|
9
|
+
* @param allowSpaces - 是否允许空格
|
|
10
|
+
* @returns 触发范围和查询文本,未找到返回 null
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const result = findTextRange(selection, '@', false)
|
|
14
|
+
* if (result) {
|
|
15
|
+
* console.log(result.range) // { from: 10, to: 20 }
|
|
16
|
+
* console.log(result.query) // 'user'
|
|
17
|
+
* }
|
|
18
|
+
*/
|
|
19
|
+
export declare function findTextRange(selection: Selection, char: string, allowSpaces?: boolean): {
|
|
20
|
+
range: {
|
|
21
|
+
from: number;
|
|
22
|
+
to: number;
|
|
23
|
+
};
|
|
24
|
+
query: string;
|
|
25
|
+
} | null;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
import { mention, suggestion, template } from './extensions';
|
|
3
|
+
declare const Sender: {
|
|
4
|
+
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./index.type').SenderProps> & Readonly<{
|
|
5
|
+
onClear?: (() => any) | undefined;
|
|
6
|
+
onInput?: ((value: string) => any) | undefined;
|
|
7
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
8
|
+
onCancel?: (() => any) | undefined;
|
|
9
|
+
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
10
|
+
onSubmit?: ((textContent: string, structuredData?: import('./index.type').StructuredData | undefined) => any) | undefined;
|
|
11
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
12
|
+
}>, {
|
|
13
|
+
submit: () => void;
|
|
14
|
+
clear: () => void;
|
|
15
|
+
cancel: () => void;
|
|
16
|
+
focus: () => void;
|
|
17
|
+
blur: () => void;
|
|
18
|
+
setContent: (content: string) => void;
|
|
19
|
+
getContent: () => string;
|
|
20
|
+
editor: import('./index.type').SenderContext["editor"];
|
|
21
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
22
|
+
clear: () => any;
|
|
23
|
+
input: (value: string) => any;
|
|
24
|
+
blur: (event: FocusEvent) => any;
|
|
25
|
+
cancel: () => any;
|
|
26
|
+
focus: (event: FocusEvent) => any;
|
|
27
|
+
submit: (textContent: string, structuredData?: import('./index.type').StructuredData | undefined) => any;
|
|
28
|
+
"update:modelValue": (value: string) => any;
|
|
29
|
+
}, import('vue').PublicProps, {
|
|
30
|
+
size: "normal" | "small";
|
|
31
|
+
placeholder: string;
|
|
32
|
+
mode: import('./index.type').InputMode;
|
|
33
|
+
enterkeyhint: import('./index.type').EnterKeyHint;
|
|
34
|
+
autoSize: import('./index.type').AutoSize;
|
|
35
|
+
extensions: import('@tiptap/core').Extension[] | any[];
|
|
36
|
+
submitType: import('./index.type').SubmitTrigger;
|
|
37
|
+
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
38
|
+
P: {};
|
|
39
|
+
B: {};
|
|
40
|
+
D: {};
|
|
41
|
+
C: {};
|
|
42
|
+
M: {};
|
|
43
|
+
Defaults: {};
|
|
44
|
+
}, Readonly<import('./index.type').SenderProps> & Readonly<{
|
|
45
|
+
onClear?: (() => any) | undefined;
|
|
46
|
+
onInput?: ((value: string) => any) | undefined;
|
|
47
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
48
|
+
onCancel?: (() => any) | undefined;
|
|
49
|
+
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
50
|
+
onSubmit?: ((textContent: string, structuredData?: import('./index.type').StructuredData | undefined) => any) | undefined;
|
|
51
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
52
|
+
}>, {
|
|
53
|
+
submit: () => void;
|
|
54
|
+
clear: () => void;
|
|
55
|
+
cancel: () => void;
|
|
56
|
+
focus: () => void;
|
|
57
|
+
blur: () => void;
|
|
58
|
+
setContent: (content: string) => void;
|
|
59
|
+
getContent: () => string;
|
|
60
|
+
editor: import('./index.type').SenderContext["editor"];
|
|
61
|
+
}, {}, {}, {}, {
|
|
62
|
+
size: "normal" | "small";
|
|
63
|
+
placeholder: string;
|
|
64
|
+
mode: import('./index.type').InputMode;
|
|
65
|
+
enterkeyhint: import('./index.type').EnterKeyHint;
|
|
66
|
+
autoSize: import('./index.type').AutoSize;
|
|
67
|
+
extensions: import('@tiptap/core').Extension[] | any[];
|
|
68
|
+
submitType: import('./index.type').SubmitTrigger;
|
|
69
|
+
}>;
|
|
70
|
+
__isFragment?: never;
|
|
71
|
+
__isTeleport?: never;
|
|
72
|
+
__isSuspense?: never;
|
|
73
|
+
} & import('vue').ComponentOptionsBase<Readonly<import('./index.type').SenderProps> & Readonly<{
|
|
74
|
+
onClear?: (() => any) | undefined;
|
|
75
|
+
onInput?: ((value: string) => any) | undefined;
|
|
76
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
77
|
+
onCancel?: (() => any) | undefined;
|
|
78
|
+
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
79
|
+
onSubmit?: ((textContent: string, structuredData?: import('./index.type').StructuredData | undefined) => any) | undefined;
|
|
80
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
81
|
+
}>, {
|
|
82
|
+
submit: () => void;
|
|
83
|
+
clear: () => void;
|
|
84
|
+
cancel: () => void;
|
|
85
|
+
focus: () => void;
|
|
86
|
+
blur: () => void;
|
|
87
|
+
setContent: (content: string) => void;
|
|
88
|
+
getContent: () => string;
|
|
89
|
+
editor: import('./index.type').SenderContext["editor"];
|
|
90
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
91
|
+
clear: () => any;
|
|
92
|
+
input: (value: string) => any;
|
|
93
|
+
blur: (event: FocusEvent) => any;
|
|
94
|
+
cancel: () => any;
|
|
95
|
+
focus: (event: FocusEvent) => any;
|
|
96
|
+
submit: (textContent: string, structuredData?: import('./index.type').StructuredData | undefined) => any;
|
|
97
|
+
"update:modelValue": (value: string) => any;
|
|
98
|
+
}, string, {
|
|
99
|
+
size: "normal" | "small";
|
|
100
|
+
placeholder: string;
|
|
101
|
+
mode: import('./index.type').InputMode;
|
|
102
|
+
enterkeyhint: import('./index.type').EnterKeyHint;
|
|
103
|
+
autoSize: import('./index.type').AutoSize;
|
|
104
|
+
extensions: import('@tiptap/core').Extension[] | any[];
|
|
105
|
+
submitType: import('./index.type').SubmitTrigger;
|
|
106
|
+
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
107
|
+
$slots: {
|
|
108
|
+
header?(_: {}): any;
|
|
109
|
+
header?(_: {}): any;
|
|
110
|
+
prefix?(_: {}): any;
|
|
111
|
+
prefix?(_: {}): any;
|
|
112
|
+
content?(_: {
|
|
113
|
+
editor: import('@tiptap/vue-3').Editor | undefined;
|
|
114
|
+
}): any;
|
|
115
|
+
content?(_: {
|
|
116
|
+
editor: import('vue').Ref<import('@tiptap/vue-3').Editor | undefined, import('@tiptap/vue-3').Editor | undefined>;
|
|
117
|
+
}): any;
|
|
118
|
+
'actions-inline'?(_: {}): any;
|
|
119
|
+
footer?(_: {}): any;
|
|
120
|
+
'footer-right'?(_: {}): any;
|
|
121
|
+
};
|
|
122
|
+
}) & {
|
|
123
|
+
install: <T>(app: App<T>) => void;
|
|
124
|
+
Mention: import('@tiptap/core').Node<import('./extensions').MentionOptions, any>;
|
|
125
|
+
Suggestion: import('@tiptap/core').Extension<import('./index.type').SuggestionOptions, any>;
|
|
126
|
+
Template: import('@tiptap/core').Extension<import('./extensions').TemplateOptions, any>;
|
|
127
|
+
mention: typeof mention;
|
|
128
|
+
suggestion: typeof suggestion;
|
|
129
|
+
template: typeof template;
|
|
130
|
+
};
|
|
131
|
+
export default Sender;
|
|
132
|
+
export type { SenderProps, SenderEmits, SenderSlots, SenderContext, UseEditorReturn, UseModeSwitchReturn, UseSuggestionReturn, UseKeyboardShortcutsReturn, TemplateItem, MentionItem, DefaultActions, } from './index.type';
|
|
133
|
+
export { useSenderContext } from './context';
|
|
134
|
+
export type { TemplateAttrs, TemplateOptions } from './extensions/template';
|
|
135
|
+
export type { MentionAttrs, MentionOptions } from './extensions/mention';
|
|
136
|
+
export type { SenderSuggestionItem, SuggestionOptions, SuggestionState, SuggestionTextPart, HighlightFunction, } from './extensions/suggestion';
|