@naersen/tts-rich-text 0.1.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.
Files changed (72) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +166 -0
  3. package/dist/components/cx-button/index.d.ts +9 -0
  4. package/dist/components/cx-button/index.vue.d.ts +20 -0
  5. package/dist/components/cx-empty/index.d.ts +2 -0
  6. package/dist/components/cx-empty/index.vue.d.ts +26 -0
  7. package/dist/components/cx-radio-group/index.d.ts +3 -0
  8. package/dist/components/cx-radio-group/index.vue.d.ts +19 -0
  9. package/dist/components/cx-radio-group/type/index.d.ts +25 -0
  10. package/dist/components/cx-spin/index.d.ts +3 -0
  11. package/dist/components/cx-spin/index.vue.d.ts +26 -0
  12. package/dist/components/cx-upload/index.d.ts +3 -0
  13. package/dist/components/cx-upload/index.vue.d.ts +43 -0
  14. package/dist/components/cx-upload/type/index.d.ts +15 -0
  15. package/dist/components/index.d.ts +8 -0
  16. package/dist/components/svg-icon/index.d.ts +44 -0
  17. package/dist/components/svg-icon/index.vue.d.ts +12 -0
  18. package/dist/components/tts-rich-text/components/ai-rewrite-modal.vue.d.ts +10 -0
  19. package/dist/components/tts-rich-text/components/editor-footer.vue.d.ts +2 -0
  20. package/dist/components/tts-rich-text/components/editor-tool-button.vue.d.ts +67 -0
  21. package/dist/components/tts-rich-text/components/editor-toolbar.vue.d.ts +193 -0
  22. package/dist/components/tts-rich-text/components/formula-modal.vue.d.ts +10 -0
  23. package/dist/components/tts-rich-text/components/mark-pinyin-modal.vue.d.ts +8 -0
  24. package/dist/components/tts-rich-text/components/replace-text-modal.vue.d.ts +8 -0
  25. package/dist/components/tts-rich-text/components/selection-menu.vue.d.ts +4 -0
  26. package/dist/components/tts-rich-text/components/tag-node-view.vue.d.ts +92 -0
  27. package/dist/components/tts-rich-text/components/toolbar-popovers/language-popover.vue.d.ts +18 -0
  28. package/dist/components/tts-rich-text/components/toolbar-popovers/number-reading-popover.vue.d.ts +18 -0
  29. package/dist/components/tts-rich-text/components/toolbar-popovers/stop-popover.vue.d.ts +14 -0
  30. package/dist/components/tts-rich-text/components/type/index.d.ts +18 -0
  31. package/dist/components/tts-rich-text/components/upload-modal.vue.d.ts +101 -0
  32. package/dist/components/tts-rich-text/editor/config.d.ts +93 -0
  33. package/dist/components/tts-rich-text/editor/index.d.ts +5 -0
  34. package/dist/components/tts-rich-text/editor/nodes/tag-node.d.ts +13 -0
  35. package/dist/components/tts-rich-text/editor/plugins/tts-character-count.d.ts +17 -0
  36. package/dist/components/tts-rich-text/editor/type.d.ts +8 -0
  37. package/dist/components/tts-rich-text/editor/useEditorToolbar.d.ts +33 -0
  38. package/dist/components/tts-rich-text/editor/useOverflowToolbar.d.ts +13 -0
  39. package/dist/components/tts-rich-text/editor/useRichTextEditor.d.ts +91 -0
  40. package/dist/components/tts-rich-text/editor/useSSETool.d.ts +16 -0
  41. package/dist/components/tts-rich-text/editor/useTestAudioTool.d.ts +4 -0
  42. package/dist/components/tts-rich-text/editor/utils/index.d.ts +3 -0
  43. package/dist/components/tts-rich-text/editor/utils/number-to-text.d.ts +31 -0
  44. package/dist/components/tts-rich-text/editor/utils/sanitize-pasted-text.d.ts +2 -0
  45. package/dist/components/tts-rich-text/editor/utils/split-sentence.d.ts +7 -0
  46. package/dist/components/tts-rich-text/editor/utils/transform-data.d.ts +24 -0
  47. package/dist/components/tts-rich-text/hooks/useGlobalAudioControl.d.ts +4 -0
  48. package/dist/components/tts-rich-text/hooks/useSynthesizeAudioTool.d.ts +248 -0
  49. package/dist/components/tts-rich-text/hooks/useVoiceChangeConfirm.d.ts +6 -0
  50. package/dist/components/tts-rich-text/index.d.ts +9 -0
  51. package/dist/components/tts-rich-text-editor/index.d.ts +1 -0
  52. package/dist/components/tts-rich-text-editor/index.vue.d.ts +57 -0
  53. package/dist/core/config.d.ts +67 -0
  54. package/dist/core/index.d.ts +6 -0
  55. package/dist/core/number-to-text.d.ts +31 -0
  56. package/dist/core/sanitize-pasted-text.d.ts +2 -0
  57. package/dist/core/split-sentence.d.ts +7 -0
  58. package/dist/core/transform-data.d.ts +13 -0
  59. package/dist/core.d.ts +2 -0
  60. package/dist/core.js +509 -0
  61. package/dist/editor/index.d.ts +4 -0
  62. package/dist/hooks/index.d.ts +2 -0
  63. package/dist/hooks/useControlValue.d.ts +4 -0
  64. package/dist/hooks/useRenderSlots.d.ts +6 -0
  65. package/dist/index.d.ts +5 -0
  66. package/dist/index.js +31916 -0
  67. package/dist/services/index.d.ts +1 -0
  68. package/dist/style/index.d.ts +0 -0
  69. package/dist/style.css +1 -0
  70. package/dist/type/index.d.ts +102 -0
  71. package/dist/utils/index.d.ts +7 -0
  72. package/package.json +82 -0
@@ -0,0 +1,33 @@
1
+ import { ComputedRef } from 'vue';
2
+ import { ToolConfig } from './config';
3
+ import { RichTextEditor } from './useRichTextEditor';
4
+ type ToolbarTool = (typeof ToolConfig)[keyof typeof ToolConfig];
5
+ export type ToolbarItem = {
6
+ tool: ToolbarTool;
7
+ disabled?: () => boolean;
8
+ onClick?: () => void;
9
+ };
10
+ type UseEditorToolbarOptions = {
11
+ editorContext: RichTextEditor;
12
+ openModal: {
13
+ pinyin: (text: string) => void;
14
+ replace: (text: string) => void;
15
+ formula: (text: string) => void;
16
+ aiRewrite: () => void;
17
+ upload: () => void;
18
+ };
19
+ };
20
+ export declare const useEditorToolbar: ({ editorContext, openModal }: UseEditorToolbarOptions) => {
21
+ toolList: ComputedRef<ToolbarItem[]>;
22
+ languageOptions: ComputedRef<readonly import('../../..').LanguageOption[]>;
23
+ numberToTextList: ComputedRef<{
24
+ label: string;
25
+ value: string;
26
+ }[]>;
27
+ isToolDisabled: (toolItem: ToolbarItem) => boolean;
28
+ insertCustomStop: (time: number) => void;
29
+ setLanguage: (code: string) => boolean;
30
+ replaceText: (text: string) => void;
31
+ markPinyin: (text: string) => void;
32
+ };
33
+ export {};
@@ -0,0 +1,13 @@
1
+ import { MaybeRefOrGetter, Ref } from 'vue';
2
+ type UseOverflowToolbarOptions<T> = {
3
+ list: MaybeRefOrGetter<readonly T[]>;
4
+ toolbarRef: Ref<HTMLElement | undefined>;
5
+ measureRef: Ref<HTMLElement | undefined>;
6
+ itemSelector?: string;
7
+ gap?: number;
8
+ };
9
+ export declare const useOverflowToolbar: <T>({ list, toolbarRef, measureRef, itemSelector, gap }: UseOverflowToolbarOptions<T>) => {
10
+ visibleList: import('vue').ComputedRef<T[]>;
11
+ hiddenList: import('vue').ComputedRef<T[]>;
12
+ };
13
+ export {};
@@ -0,0 +1,91 @@
1
+ import { Ref } from 'vue';
2
+ import { Editor, JSONContent } from '@tiptap/core';
3
+ import { NotificationType, TtsEditorFeatures, TtsRichTextServices } from '../../../type';
4
+ import { CustomTagType, DriveModeEnum } from './config';
5
+ export interface UseRichTextEditorOptions {
6
+ content?: JSONContent;
7
+ textLimitLength?: number;
8
+ getGenerateAudioParams?: () => {
9
+ /**
10
+ * 音调,范围 0-100,默认 50。
11
+ */
12
+ pitch?: number;
13
+ /**
14
+ * 语速,范围 0-100,默认 50。
15
+ */
16
+ speed?: number;
17
+ /**
18
+ * 选中的音色 ID(对应 t_voice_timbre.id)
19
+ */
20
+ timberId?: string;
21
+ /**
22
+ * 音量,范围 0-100,默认 50。
23
+ */
24
+ volume?: number;
25
+ };
26
+ voiceVersion?: Ref<number>;
27
+ placeholder?: string;
28
+ editable?: Ref<boolean>;
29
+ services?: Ref<TtsRichTextServices>;
30
+ features?: Ref<TtsEditorFeatures>;
31
+ onCreate?: (editor: Editor) => void;
32
+ onUpdate?: (content: JSONContent, editor: Editor) => void;
33
+ }
34
+ export declare function useRichTextEditor(options?: UseRichTextEditorOptions): {
35
+ editor: import('vue').ShallowRef<import('@tiptap/vue-3').Editor | undefined, import('@tiptap/vue-3').Editor | undefined>;
36
+ driveMode: Ref<DriveModeEnum, DriveModeEnum>;
37
+ insertToken: (data: {
38
+ categ: CustomTagType;
39
+ payload: Record<string, any>;
40
+ }) => void;
41
+ insertWrappedToken: (data: {
42
+ categ: CustomTagType;
43
+ payload: Record<string, any>;
44
+ }) => void;
45
+ clearContent: () => void;
46
+ getSelectedText: () => string;
47
+ getSelectedJson: () => JSONContent | null;
48
+ selectedText: Ref<string, string>;
49
+ hasSelectedText: import('vue').ComputedRef<boolean>;
50
+ isSelectedPureNumber: import('vue').ComputedRef<boolean>;
51
+ textLimitLength: number;
52
+ getGenerateAudioParams: () => {
53
+ /**
54
+ * 音调,范围 0-100,默认 50。
55
+ */
56
+ pitch?: number;
57
+ /**
58
+ * 语速,范围 0-100,默认 50。
59
+ */
60
+ speed?: number;
61
+ /**
62
+ * 选中的音色 ID(对应 t_voice_timbre.id)
63
+ */
64
+ timberId?: string;
65
+ /**
66
+ * 音量,范围 0-100,默认 50。
67
+ */
68
+ volume?: number;
69
+ };
70
+ services: Ref<TtsRichTextServices, TtsRichTextServices>;
71
+ features: Ref<TtsEditorFeatures, TtsEditorFeatures>;
72
+ notify: (type: NotificationType, message: string) => void;
73
+ getReferencedVirtualElement: () => {
74
+ getBoundingClientRect(): {
75
+ x: number;
76
+ y: number;
77
+ left: number;
78
+ top: number;
79
+ right: number;
80
+ bottom: number;
81
+ width: number;
82
+ height: number;
83
+ };
84
+ } | null;
85
+ replaceContentWithText: (text: string) => void;
86
+ textLength: import('vue').ComputedRef<number>;
87
+ voiceVersion: Ref<number, number>;
88
+ };
89
+ export type RichTextEditor = ReturnType<typeof useRichTextEditor>;
90
+ export declare const useEditorProvider: (context: RichTextEditor) => void;
91
+ export declare const useEditorContext: () => RichTextEditor;
@@ -0,0 +1,16 @@
1
+ import { Ref } from 'vue';
2
+ import { TtsServiceContext } from '../../../type';
3
+ type ScrollTarget = Ref<HTMLElement | null | undefined> | (() => HTMLElement | null | undefined);
4
+ type StreamRunner = (data: Record<string, unknown>, context: TtsServiceContext) => Promise<string | void>;
5
+ interface UseSseToolOptions {
6
+ runner?: StreamRunner;
7
+ onChange?: (text: string) => void;
8
+ scrollTarget?: ScrollTarget;
9
+ }
10
+ export declare const useSSETool: (options: UseSseToolOptions) => {
11
+ exec: (data?: Record<string, unknown>) => Promise<void>;
12
+ result: Ref<string, string>;
13
+ loading: Ref<boolean, boolean>;
14
+ abort: () => void;
15
+ };
16
+ export {};
@@ -0,0 +1,4 @@
1
+ import { TtsPreviewRequest } from '../../../type';
2
+ export declare const useTestAudioTool: () => {
3
+ testAudio: (data: TtsPreviewRequest) => Promise<string | null>;
4
+ };
@@ -0,0 +1,3 @@
1
+ export * from './split-sentence';
2
+ export * from './transform-data';
3
+ export * from './number-to-text';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * 数字转文字工具类
3
+ */
4
+ /**
5
+ * 基数读法:逐字转换
6
+ * 示例: 123 -> "一二三"
7
+ * @param numStr 数字字符串
8
+ */
9
+ export declare function toCardinal(numStr: string): string;
10
+ /**
11
+ * 电话号读法:逐位用电话专用读音
12
+ * 示例: 13800138000 -> "幺三八洞洞幺三八洞洞洞"
13
+ * @param numStr 数字字符串
14
+ */
15
+ export declare function toPhoneReading(numStr: string): string;
16
+ /**
17
+ * 位数读法 / 口语读法:按中文习惯读取
18
+ * 示例: 123 -> "一百二十三", 10000 -> "一万"
19
+ * @param numStr 数字字符串
20
+ */
21
+ export declare function toPositional(numStr: string): string;
22
+ /**
23
+ * 口语读法:目前逻辑与位数读法一致
24
+ * 如果需要区分(例如口语中更倾向于省略某些“零”),可以在此处修改逻辑
25
+ * @param numStr 数字字符串
26
+ */
27
+ export declare function toColloquial(numStr: string): string;
28
+ export declare const NumberToTextTools: {
29
+ label: string;
30
+ func: typeof toCardinal;
31
+ }[];
@@ -0,0 +1,2 @@
1
+ export declare const sanitizePastedText: (text: string) => string;
2
+ export declare const sanitizePastedHtml: (html: string) => string;
@@ -0,0 +1,7 @@
1
+ export interface SentenceSplitOptions {
2
+ minSegmentLength?: number;
3
+ maxSegmentLength?: number;
4
+ rebalanceRatio?: number;
5
+ }
6
+ export declare const getVisualLength: (text: string) => number;
7
+ export declare const splitTextToSentences: (text: string, options?: SentenceSplitOptions) => string[];
@@ -0,0 +1,24 @@
1
+ import { JSONContent } from '@tiptap/core';
2
+ import { CustomTagType } from '../config';
3
+ interface SentenceResult {
4
+ text: string;
5
+ protectedRanges?: Array<{
6
+ start: number;
7
+ end: number;
8
+ }>;
9
+ playments: Array<{
10
+ action: string;
11
+ model: string;
12
+ payload: string;
13
+ position: number;
14
+ text: string;
15
+ actionCode: CustomTagType;
16
+ }>;
17
+ }
18
+ export interface TtsInputData {
19
+ sentences: string[];
20
+ playments: SentenceResult['playments'][];
21
+ }
22
+ export declare const transformParagraph: (paragraphNode: JSONContent) => SentenceResult;
23
+ export declare const convertToTtsFormat: (data: JSONContent) => TtsInputData;
24
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const globalAudioControlKey: unique symbol;
2
+ export declare const useGlobalAudioControl: (options: {
3
+ on: () => void;
4
+ }) => import('@vueuse/core').UseEventBusReturn<unknown, any>;
@@ -0,0 +1,248 @@
1
+ import { Ref } from 'vue';
2
+ import { TtsPreviewRequest } from '../../../type';
3
+ export declare const useSynthesizeAudioTool: (audioRef?: Ref<HTMLAudioElement | undefined>) => {
4
+ execute: (data: TtsPreviewRequest) => Promise<unknown>;
5
+ loading: Ref<boolean, boolean>;
6
+ abort: () => void;
7
+ resume: () => Promise<void>;
8
+ stop: () => void;
9
+ playing: import('vue').WritableComputedRef<boolean, boolean>;
10
+ mediaControls: {
11
+ playing: import('vue').WritableComputedRef<boolean, boolean>;
12
+ currentTime: import('vue').WritableComputedRef<number, number>;
13
+ duration: import('vue').ComputedRef<number>;
14
+ waiting: Ref<boolean, boolean>;
15
+ seeking: Ref<boolean, boolean>;
16
+ ended: Ref<boolean, boolean>;
17
+ stalled: Ref<boolean, boolean>;
18
+ buffered: Ref<[number, number][], [number, number][]>;
19
+ rate: Ref<number, number>;
20
+ volume: Ref<number, number>;
21
+ muted: Ref<boolean, boolean>;
22
+ tracks: Ref<{
23
+ id: number;
24
+ label: string;
25
+ language: string;
26
+ mode: TextTrackMode;
27
+ kind: TextTrackKind;
28
+ inBandMetadataTrackDispatchType: string;
29
+ cues: {
30
+ [x: number]: {
31
+ endTime: number;
32
+ id: string;
33
+ onenter: ((this: TextTrackCue, ev: Event) => any) | null;
34
+ onexit: ((this: TextTrackCue, ev: Event) => any) | null;
35
+ pauseOnExit: boolean;
36
+ startTime: number;
37
+ readonly track: {
38
+ readonly activeCues: any | null;
39
+ readonly cues: any | null;
40
+ readonly id: string;
41
+ readonly inBandMetadataTrackDispatchType: string;
42
+ readonly kind: TextTrackKind;
43
+ readonly label: string;
44
+ readonly language: string;
45
+ mode: TextTrackMode;
46
+ oncuechange: ((this: TextTrack, ev: Event) => any) | null;
47
+ addCue: (cue: TextTrackCue) => void;
48
+ removeCue: (cue: TextTrackCue) => void;
49
+ addEventListener: {
50
+ <K extends keyof TextTrackEventMap>(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
51
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
52
+ };
53
+ removeEventListener: {
54
+ <K extends keyof TextTrackEventMap>(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
55
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
56
+ };
57
+ dispatchEvent: {
58
+ (event: Event): boolean;
59
+ (event: Event): boolean;
60
+ };
61
+ } | null;
62
+ addEventListener: {
63
+ <K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
64
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
65
+ };
66
+ removeEventListener: {
67
+ <K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
68
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
69
+ };
70
+ dispatchEvent: {
71
+ (event: Event): boolean;
72
+ (event: Event): boolean;
73
+ };
74
+ };
75
+ readonly length: number;
76
+ getCueById: (id: string) => TextTrackCue | null;
77
+ [Symbol.iterator]: () => ArrayIterator<TextTrackCue>;
78
+ } | null;
79
+ activeCues: {
80
+ [x: number]: {
81
+ endTime: number;
82
+ id: string;
83
+ onenter: ((this: TextTrackCue, ev: Event) => any) | null;
84
+ onexit: ((this: TextTrackCue, ev: Event) => any) | null;
85
+ pauseOnExit: boolean;
86
+ startTime: number;
87
+ readonly track: {
88
+ readonly activeCues: any | null;
89
+ readonly cues: any | null;
90
+ readonly id: string;
91
+ readonly inBandMetadataTrackDispatchType: string;
92
+ readonly kind: TextTrackKind;
93
+ readonly label: string;
94
+ readonly language: string;
95
+ mode: TextTrackMode;
96
+ oncuechange: ((this: TextTrack, ev: Event) => any) | null;
97
+ addCue: (cue: TextTrackCue) => void;
98
+ removeCue: (cue: TextTrackCue) => void;
99
+ addEventListener: {
100
+ <K extends keyof TextTrackEventMap>(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
101
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
102
+ };
103
+ removeEventListener: {
104
+ <K extends keyof TextTrackEventMap>(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
105
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
106
+ };
107
+ dispatchEvent: {
108
+ (event: Event): boolean;
109
+ (event: Event): boolean;
110
+ };
111
+ } | null;
112
+ addEventListener: {
113
+ <K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
114
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
115
+ };
116
+ removeEventListener: {
117
+ <K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
118
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
119
+ };
120
+ dispatchEvent: {
121
+ (event: Event): boolean;
122
+ (event: Event): boolean;
123
+ };
124
+ };
125
+ readonly length: number;
126
+ getCueById: (id: string) => TextTrackCue | null;
127
+ [Symbol.iterator]: () => ArrayIterator<TextTrackCue>;
128
+ } | null;
129
+ }[], import('@vueuse/core').UseMediaTextTrack[] | {
130
+ id: number;
131
+ label: string;
132
+ language: string;
133
+ mode: TextTrackMode;
134
+ kind: TextTrackKind;
135
+ inBandMetadataTrackDispatchType: string;
136
+ cues: {
137
+ [x: number]: {
138
+ endTime: number;
139
+ id: string;
140
+ onenter: ((this: TextTrackCue, ev: Event) => any) | null;
141
+ onexit: ((this: TextTrackCue, ev: Event) => any) | null;
142
+ pauseOnExit: boolean;
143
+ startTime: number;
144
+ readonly track: {
145
+ readonly activeCues: any | null;
146
+ readonly cues: any | null;
147
+ readonly id: string;
148
+ readonly inBandMetadataTrackDispatchType: string;
149
+ readonly kind: TextTrackKind;
150
+ readonly label: string;
151
+ readonly language: string;
152
+ mode: TextTrackMode;
153
+ oncuechange: ((this: TextTrack, ev: Event) => any) | null;
154
+ addCue: (cue: TextTrackCue) => void;
155
+ removeCue: (cue: TextTrackCue) => void;
156
+ addEventListener: {
157
+ <K extends keyof TextTrackEventMap>(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
158
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
159
+ };
160
+ removeEventListener: {
161
+ <K extends keyof TextTrackEventMap>(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
162
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
163
+ };
164
+ dispatchEvent: {
165
+ (event: Event): boolean;
166
+ (event: Event): boolean;
167
+ };
168
+ } | null;
169
+ addEventListener: {
170
+ <K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
171
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
172
+ };
173
+ removeEventListener: {
174
+ <K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
175
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
176
+ };
177
+ dispatchEvent: {
178
+ (event: Event): boolean;
179
+ (event: Event): boolean;
180
+ };
181
+ };
182
+ readonly length: number;
183
+ getCueById: (id: string) => TextTrackCue | null;
184
+ [Symbol.iterator]: () => ArrayIterator<TextTrackCue>;
185
+ } | null;
186
+ activeCues: {
187
+ [x: number]: {
188
+ endTime: number;
189
+ id: string;
190
+ onenter: ((this: TextTrackCue, ev: Event) => any) | null;
191
+ onexit: ((this: TextTrackCue, ev: Event) => any) | null;
192
+ pauseOnExit: boolean;
193
+ startTime: number;
194
+ readonly track: {
195
+ readonly activeCues: any | null;
196
+ readonly cues: any | null;
197
+ readonly id: string;
198
+ readonly inBandMetadataTrackDispatchType: string;
199
+ readonly kind: TextTrackKind;
200
+ readonly label: string;
201
+ readonly language: string;
202
+ mode: TextTrackMode;
203
+ oncuechange: ((this: TextTrack, ev: Event) => any) | null;
204
+ addCue: (cue: TextTrackCue) => void;
205
+ removeCue: (cue: TextTrackCue) => void;
206
+ addEventListener: {
207
+ <K extends keyof TextTrackEventMap>(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
208
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
209
+ };
210
+ removeEventListener: {
211
+ <K extends keyof TextTrackEventMap>(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
212
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
213
+ };
214
+ dispatchEvent: {
215
+ (event: Event): boolean;
216
+ (event: Event): boolean;
217
+ };
218
+ } | null;
219
+ addEventListener: {
220
+ <K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
221
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
222
+ };
223
+ removeEventListener: {
224
+ <K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
225
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
226
+ };
227
+ dispatchEvent: {
228
+ (event: Event): boolean;
229
+ (event: Event): boolean;
230
+ };
231
+ };
232
+ readonly length: number;
233
+ getCueById: (id: string) => TextTrackCue | null;
234
+ [Symbol.iterator]: () => ArrayIterator<TextTrackCue>;
235
+ } | null;
236
+ }[]>;
237
+ selectedTrack: Ref<number, number>;
238
+ enableTrack: (track: number | import('@vueuse/core').UseMediaTextTrack, disableTracks?: boolean) => void;
239
+ disableTrack: (track?: number | import('@vueuse/core').UseMediaTextTrack) => void;
240
+ supportsPictureInPicture: boolean | undefined;
241
+ togglePictureInPicture: () => Promise<unknown>;
242
+ isPictureInPicture: Ref<boolean, boolean>;
243
+ onSourceError: import('@vueuse/core').EventHookOn<Event>;
244
+ onPlaybackError: import('@vueuse/core').EventHookOn<Event>;
245
+ };
246
+ shouldAutoPlay: import('vue').ComputedRef<boolean>;
247
+ hasAudio: import('vue').ComputedRef<boolean>;
248
+ };
@@ -0,0 +1,6 @@
1
+ import { RichTextEditor } from '../editor';
2
+ export declare const useVoiceChangeConfirm: (options: {
3
+ richTextEditor: RichTextEditor;
4
+ }) => {
5
+ handleChangeVoice: (currentModel: number, nextModel: number) => Promise<boolean>;
6
+ };
@@ -0,0 +1,9 @@
1
+ export { default as TtsAiRewriteModal } from './components/ai-rewrite-modal.vue';
2
+ export { default as TtsEditorFooter } from './components/editor-footer.vue';
3
+ export { default as TtsEditorToolbar } from './components/editor-toolbar.vue';
4
+ export { default as TtsFormulaModal } from './components/formula-modal.vue';
5
+ export { default as TtsMarkPinyinModal } from './components/mark-pinyin-modal.vue';
6
+ export { default as TtsReplaceTextModal } from './components/replace-text-modal.vue';
7
+ export { default as TtsSelectionMenu } from './components/selection-menu.vue';
8
+ export { default as TtsTagNodeView } from './components/tag-node-view.vue';
9
+ export { default as TtsUploadModal } from './components/upload-modal.vue';
@@ -0,0 +1 @@
1
+ export { default } from './index.vue';
@@ -0,0 +1,57 @@
1
+ import { TtsEditorFeatures, TtsRichTextEditorProps, TtsRichTextServices } from '../../type';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: {
5
+ 'toolbar-before'?(_: {
6
+ editor: import('@tiptap/vue-3').Editor | undefined;
7
+ }): any;
8
+ 'toolbar-after'?(_: {
9
+ editor: import('@tiptap/vue-3').Editor | undefined;
10
+ }): any;
11
+ 'editor-after'?(_: {
12
+ editor: import('@tiptap/vue-3').Editor | undefined;
13
+ }): any;
14
+ 'footer-before'?(_: {
15
+ editor: import('@tiptap/vue-3').Editor | undefined;
16
+ textLength: number;
17
+ }): any;
18
+ 'footer-after'?(_: {
19
+ editor: import('@tiptap/vue-3').Editor | undefined;
20
+ textLength: number;
21
+ }): any;
22
+ };
23
+ refs: {};
24
+ rootEl: HTMLDivElement;
25
+ };
26
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
27
+ declare const __VLS_component: import('vue').DefineComponent<TtsRichTextEditorProps, {
28
+ clear: () => void;
29
+ focus: () => void;
30
+ getJson: () => import('@tiptap/core').JSONContent;
31
+ getTtsData: () => import('../../type').TtsInputData;
32
+ replaceText: (text: string) => void;
33
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
34
+ "update:modelValue": (value: import('@tiptap/core').JSONContent) => any;
35
+ change: (value: import('@tiptap/core').JSONContent) => any;
36
+ ready: (editor: import('@tiptap/core').Editor) => any;
37
+ }, string, import('vue').PublicProps, Readonly<TtsRichTextEditorProps> & Readonly<{
38
+ "onUpdate:modelValue"?: ((value: import('@tiptap/core').JSONContent) => any) | undefined;
39
+ onChange?: ((value: import('@tiptap/core').JSONContent) => any) | undefined;
40
+ onReady?: ((editor: import('@tiptap/core').Editor) => any) | undefined;
41
+ }>, {
42
+ disabled: boolean;
43
+ placeholder: string;
44
+ modelValue: import('@tiptap/core').JSONContent;
45
+ voiceVersion: number;
46
+ services: TtsRichTextServices;
47
+ features: TtsEditorFeatures;
48
+ textLimit: number;
49
+ showFullscreen: boolean;
50
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
51
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
52
+ export default _default;
53
+ type __VLS_WithTemplateSlots<T, S> = T & {
54
+ new (): {
55
+ $slots: S;
56
+ };
57
+ };
@@ -0,0 +1,67 @@
1
+ import { JSONContent } from '@tiptap/core';
2
+ import { LanguageOption, ResolvedTtsEditorFeatures, TtsEditorFeatures, TtsToolType } from '../type';
3
+ export declare const DeleteMode: {
4
+ readonly DELETE_NODE: "deleteNode";
5
+ readonly CONVERT_TO_TEXT: "convertToText";
6
+ };
7
+ export type DeleteMode = (typeof DeleteMode)[keyof typeof DeleteMode];
8
+ export declare const ToolConfig: {
9
+ readonly stop: {
10
+ readonly label: "停顿";
11
+ readonly type: "stop";
12
+ readonly deleteMode: "deleteNode";
13
+ };
14
+ readonly customStop: {
15
+ readonly label: "长停顿";
16
+ readonly type: "customStop";
17
+ readonly deleteMode: "deleteNode";
18
+ };
19
+ readonly continue: {
20
+ readonly label: "连续";
21
+ readonly type: "continue";
22
+ readonly deleteMode: "convertToText";
23
+ };
24
+ readonly pinyin: {
25
+ readonly label: "拼音标注";
26
+ readonly type: "pinyin";
27
+ readonly deleteMode: "convertToText";
28
+ };
29
+ readonly replace: {
30
+ readonly label: "替换";
31
+ readonly type: "replace";
32
+ readonly deleteMode: "convertToText";
33
+ };
34
+ readonly language: {
35
+ readonly label: "语种标记";
36
+ readonly type: "language";
37
+ readonly deleteMode: "convertToText";
38
+ };
39
+ readonly number: {
40
+ readonly label: "数字读法";
41
+ readonly type: "number";
42
+ };
43
+ readonly formula: {
44
+ readonly label: "读公式";
45
+ readonly type: "formula";
46
+ };
47
+ readonly aiRewrite: {
48
+ readonly label: "AI 改写";
49
+ readonly type: "aiRewrite";
50
+ };
51
+ readonly upload: {
52
+ readonly label: "上传文稿";
53
+ readonly type: "upload";
54
+ };
55
+ };
56
+ export type CustomTagType = 'stop' | 'customStop' | 'continue' | 'pinyin' | 'replace' | 'language';
57
+ export declare const LanguageOptions: readonly LanguageOption[];
58
+ export declare const StopOptions: readonly [{
59
+ readonly label: "停顿 0.5 秒";
60
+ readonly value: 0.5;
61
+ }, {
62
+ readonly label: "停顿 1 秒";
63
+ readonly value: 1;
64
+ }];
65
+ export declare const allToolTypes: TtsToolType[];
66
+ export declare const resolveTtsEditorFeatures: (voiceVersion: number, overrides?: TtsEditorFeatures) => ResolvedTtsEditorFeatures;
67
+ export declare const getInitContent: () => JSONContent;
@@ -0,0 +1,6 @@
1
+ export * from './config';
2
+ export * from './number-to-text';
3
+ export * from './sanitize-pasted-text';
4
+ export * from './split-sentence';
5
+ export * from './transform-data';
6
+ export type { TtsInputData, TtsPlayment } from '../type';