@naersen/tts-rich-text 0.1.0 → 0.3.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.
@@ -1,4 +1,5 @@
1
- import { TtsEditorFeatures, TtsRichTextEditorProps, TtsRichTextServices } from '../../type';
1
+ import { Editor, JSONContent } from '@tiptap/core';
2
+ import { TtsInputData, TtsRichTextEditorProps } from '../../type';
2
3
  declare function __VLS_template(): {
3
4
  attrs: Partial<{}>;
4
5
  slots: {
@@ -20,34 +21,393 @@ declare function __VLS_template(): {
20
21
  textLength: number;
21
22
  }): any;
22
23
  };
23
- refs: {};
24
- rootEl: HTMLDivElement;
24
+ refs: {
25
+ rootRef: ({
26
+ $: import('vue').ComponentInternalInstance;
27
+ $data: {};
28
+ $props: {
29
+ readonly disabled?: boolean | undefined;
30
+ readonly placeholder?: string | undefined;
31
+ readonly textLimit?: number | undefined;
32
+ readonly voiceVersion?: number | undefined;
33
+ readonly features?: import('../../type').TtsEditorFeatures | undefined;
34
+ readonly services?: import('../../type').TtsRichTextServices | undefined;
35
+ readonly getPreviewParams?: (() => Record<string, unknown>) | undefined;
36
+ readonly showSelectionMenu?: boolean | undefined;
37
+ readonly initialContent?: JSONContent | undefined;
38
+ readonly onChange?: (() => any) | undefined;
39
+ readonly onReady?: ((editor: Editor) => any) | undefined;
40
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
41
+ $attrs: import('vue').Attrs;
42
+ $refs: {
43
+ [x: string]: unknown;
44
+ };
45
+ $slots: Readonly<{
46
+ [name: string]: import('vue').Slot<any> | undefined;
47
+ }>;
48
+ $root: import('vue').ComponentPublicInstance | null;
49
+ $parent: import('vue').ComponentPublicInstance | null;
50
+ $host: Element | null;
51
+ $emit: ((event: "change") => void) & ((event: "ready", editor: Editor) => void);
52
+ $el: any;
53
+ $options: import('vue').ComponentOptionsBase<Readonly<import('../../type').TtsEditorRootProps> & Readonly<{
54
+ onChange?: (() => any) | undefined;
55
+ onReady?: ((editor: Editor) => any) | undefined;
56
+ }>, {
57
+ clear: () => void;
58
+ focus: () => void;
59
+ getJson: () => JSONContent;
60
+ getTtsData: () => TtsInputData;
61
+ replaceText: (text: string) => void;
62
+ editor: import('vue').ShallowRef<import('@tiptap/vue-3').Editor | undefined, import('@tiptap/vue-3').Editor | undefined>;
63
+ driveMode: import('vue').Ref<import('../tts-rich-text/editor').DriveModeEnum, import('../tts-rich-text/editor').DriveModeEnum>;
64
+ insertToken: (data: {
65
+ categ: import('../tts-rich-text/editor').CustomTagType;
66
+ payload: Record<string, any>;
67
+ }) => void;
68
+ insertWrappedToken: (data: {
69
+ categ: import('../tts-rich-text/editor').CustomTagType;
70
+ payload: Record<string, any>;
71
+ }) => void;
72
+ clearContent: () => void;
73
+ setContent: (content: JSONContent) => void;
74
+ getSelectedText: () => string;
75
+ getSelectedJson: () => JSONContent | null;
76
+ selectedText: import('vue').Ref<string, string>;
77
+ hasSelectedText: import('vue').ComputedRef<boolean>;
78
+ isSelectedPureNumber: import('vue').ComputedRef<boolean>;
79
+ textLimitLength: number;
80
+ getGenerateAudioParams: () => {
81
+ pitch?: number;
82
+ speed?: number;
83
+ timberId?: string;
84
+ volume?: number;
85
+ };
86
+ services: import('vue').Ref<import('../../type').TtsRichTextServices, import('../../type').TtsRichTextServices>;
87
+ features: import('vue').Ref<import('../../type').TtsEditorFeatures, import('../../type').TtsEditorFeatures>;
88
+ notify: (type: import('../../type').NotificationType, message: string) => void;
89
+ getReferencedVirtualElement: () => {
90
+ getBoundingClientRect(): {
91
+ x: number;
92
+ y: number;
93
+ left: number;
94
+ top: number;
95
+ right: number;
96
+ bottom: number;
97
+ width: number;
98
+ height: number;
99
+ };
100
+ } | null;
101
+ replaceContentWithText: (text: string) => void;
102
+ textLength: import('vue').ComputedRef<number>;
103
+ voiceVersion: import('vue').Ref<number, number>;
104
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
105
+ change: () => any;
106
+ ready: (editor: Editor) => any;
107
+ }, string, {
108
+ disabled: boolean;
109
+ placeholder: string;
110
+ textLimit: number;
111
+ voiceVersion: number;
112
+ features: import('../../type').TtsEditorFeatures;
113
+ services: import('../../type').TtsRichTextServices;
114
+ showSelectionMenu: boolean;
115
+ initialContent: JSONContent;
116
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
117
+ beforeCreate?: (() => void) | (() => void)[];
118
+ created?: (() => void) | (() => void)[];
119
+ beforeMount?: (() => void) | (() => void)[];
120
+ mounted?: (() => void) | (() => void)[];
121
+ beforeUpdate?: (() => void) | (() => void)[];
122
+ updated?: (() => void) | (() => void)[];
123
+ activated?: (() => void) | (() => void)[];
124
+ deactivated?: (() => void) | (() => void)[];
125
+ beforeDestroy?: (() => void) | (() => void)[];
126
+ beforeUnmount?: (() => void) | (() => void)[];
127
+ destroyed?: (() => void) | (() => void)[];
128
+ unmounted?: (() => void) | (() => void)[];
129
+ renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
130
+ renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
131
+ errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
132
+ };
133
+ $forceUpdate: () => void;
134
+ $nextTick: typeof import('vue').nextTick;
135
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
136
+ } & Readonly<{
137
+ disabled: boolean;
138
+ placeholder: string;
139
+ textLimit: number;
140
+ voiceVersion: number;
141
+ features: import('../../type').TtsEditorFeatures;
142
+ services: import('../../type').TtsRichTextServices;
143
+ showSelectionMenu: boolean;
144
+ initialContent: JSONContent;
145
+ }> & Omit<Readonly<import('../../type').TtsEditorRootProps> & Readonly<{
146
+ onChange?: (() => any) | undefined;
147
+ onReady?: ((editor: Editor) => any) | undefined;
148
+ }>, "clear" | "editor" | "focus" | "textLimitLength" | "notify" | "getGenerateAudioParams" | "clearContent" | "setContent" | "insertToken" | "insertWrappedToken" | "getSelectedText" | "getSelectedJson" | "selectedText" | "hasSelectedText" | "isSelectedPureNumber" | "driveMode" | "getReferencedVirtualElement" | "replaceContentWithText" | "textLength" | ("disabled" | "placeholder" | "textLimit" | "voiceVersion" | "features" | "services" | "showSelectionMenu" | "initialContent") | "getJson" | "getTtsData" | "replaceText"> & {
149
+ clear: () => void;
150
+ focus: () => void;
151
+ getJson: () => JSONContent;
152
+ getTtsData: () => TtsInputData;
153
+ replaceText: (text: string) => void;
154
+ editor: import('@tiptap/vue-3').Editor | undefined;
155
+ driveMode: import('../tts-rich-text/editor').DriveModeEnum;
156
+ insertToken: (data: {
157
+ categ: import('../tts-rich-text/editor').CustomTagType;
158
+ payload: Record<string, any>;
159
+ }) => void;
160
+ insertWrappedToken: (data: {
161
+ categ: import('../tts-rich-text/editor').CustomTagType;
162
+ payload: Record<string, any>;
163
+ }) => void;
164
+ clearContent: () => void;
165
+ setContent: (content: JSONContent) => void;
166
+ getSelectedText: () => string;
167
+ getSelectedJson: () => JSONContent | null;
168
+ selectedText: string;
169
+ hasSelectedText: boolean;
170
+ isSelectedPureNumber: boolean;
171
+ textLimitLength: number;
172
+ getGenerateAudioParams: () => {
173
+ pitch?: number;
174
+ speed?: number;
175
+ timberId?: string;
176
+ volume?: number;
177
+ };
178
+ services: import('../../type').TtsRichTextServices;
179
+ features: import('../../type').TtsEditorFeatures;
180
+ notify: (type: import('../../type').NotificationType, message: string) => void;
181
+ getReferencedVirtualElement: () => {
182
+ getBoundingClientRect(): {
183
+ x: number;
184
+ y: number;
185
+ left: number;
186
+ top: number;
187
+ right: number;
188
+ bottom: number;
189
+ width: number;
190
+ height: number;
191
+ };
192
+ } | null;
193
+ replaceContentWithText: (text: string) => void;
194
+ textLength: number;
195
+ voiceVersion: number;
196
+ } & {} & import('vue').ComponentCustomProperties & {} & {
197
+ $slots: Readonly<{
198
+ default(): unknown;
199
+ }> & {
200
+ default(): unknown;
201
+ };
202
+ }) | null;
203
+ };
204
+ rootEl: any;
25
205
  };
26
206
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
27
207
  declare const __VLS_component: import('vue').DefineComponent<TtsRichTextEditorProps, {
28
208
  clear: () => void;
29
209
  focus: () => void;
30
- getJson: () => import('@tiptap/core').JSONContent;
31
- getTtsData: () => import('../../type').TtsInputData;
210
+ getJson: () => JSONContent;
211
+ getTtsData: () => TtsInputData;
32
212
  replaceText: (text: string) => void;
33
213
  }, {}, {}, {}, 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;
214
+ "update:modelValue": (value: JSONContent) => any;
215
+ change: (value: JSONContent) => any;
216
+ ready: (editor: Editor) => any;
37
217
  }, 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;
218
+ "onUpdate:modelValue"?: ((value: JSONContent) => any) | undefined;
219
+ onChange?: ((value: JSONContent) => any) | undefined;
220
+ onReady?: ((editor: Editor) => any) | undefined;
41
221
  }>, {
42
222
  disabled: boolean;
43
223
  placeholder: string;
44
- modelValue: import('@tiptap/core').JSONContent;
45
- voiceVersion: number;
46
- services: TtsRichTextServices;
47
- features: TtsEditorFeatures;
48
- textLimit: number;
224
+ modelValue: JSONContent;
49
225
  showFullscreen: boolean;
50
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
226
+ textLimit: number;
227
+ voiceVersion: number;
228
+ features: import('../../type').TtsEditorFeatures;
229
+ services: import('../../type').TtsRichTextServices;
230
+ showSelectionMenu: boolean;
231
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
232
+ rootRef: ({
233
+ $: import('vue').ComponentInternalInstance;
234
+ $data: {};
235
+ $props: {
236
+ readonly disabled?: boolean | undefined;
237
+ readonly placeholder?: string | undefined;
238
+ readonly textLimit?: number | undefined;
239
+ readonly voiceVersion?: number | undefined;
240
+ readonly features?: import('../../type').TtsEditorFeatures | undefined;
241
+ readonly services?: import('../../type').TtsRichTextServices | undefined;
242
+ readonly getPreviewParams?: (() => Record<string, unknown>) | undefined;
243
+ readonly showSelectionMenu?: boolean | undefined;
244
+ readonly initialContent?: JSONContent | undefined;
245
+ readonly onChange?: (() => any) | undefined;
246
+ readonly onReady?: ((editor: Editor) => any) | undefined;
247
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
248
+ $attrs: import('vue').Attrs;
249
+ $refs: {
250
+ [x: string]: unknown;
251
+ };
252
+ $slots: Readonly<{
253
+ [name: string]: import('vue').Slot<any> | undefined;
254
+ }>;
255
+ $root: import('vue').ComponentPublicInstance | null;
256
+ $parent: import('vue').ComponentPublicInstance | null;
257
+ $host: Element | null;
258
+ $emit: ((event: "change") => void) & ((event: "ready", editor: Editor) => void);
259
+ $el: any;
260
+ $options: import('vue').ComponentOptionsBase<Readonly<import('../../type').TtsEditorRootProps> & Readonly<{
261
+ onChange?: (() => any) | undefined;
262
+ onReady?: ((editor: Editor) => any) | undefined;
263
+ }>, {
264
+ clear: () => void;
265
+ focus: () => void;
266
+ getJson: () => JSONContent;
267
+ getTtsData: () => TtsInputData;
268
+ replaceText: (text: string) => void;
269
+ editor: import('vue').ShallowRef<import('@tiptap/vue-3').Editor | undefined, import('@tiptap/vue-3').Editor | undefined>;
270
+ driveMode: import('vue').Ref<import('../tts-rich-text/editor').DriveModeEnum, import('../tts-rich-text/editor').DriveModeEnum>;
271
+ insertToken: (data: {
272
+ categ: import('../tts-rich-text/editor').CustomTagType;
273
+ payload: Record<string, any>;
274
+ }) => void;
275
+ insertWrappedToken: (data: {
276
+ categ: import('../tts-rich-text/editor').CustomTagType;
277
+ payload: Record<string, any>;
278
+ }) => void;
279
+ clearContent: () => void;
280
+ setContent: (content: JSONContent) => void;
281
+ getSelectedText: () => string;
282
+ getSelectedJson: () => JSONContent | null;
283
+ selectedText: import('vue').Ref<string, string>;
284
+ hasSelectedText: import('vue').ComputedRef<boolean>;
285
+ isSelectedPureNumber: import('vue').ComputedRef<boolean>;
286
+ textLimitLength: number;
287
+ getGenerateAudioParams: () => {
288
+ pitch?: number;
289
+ speed?: number;
290
+ timberId?: string;
291
+ volume?: number;
292
+ };
293
+ services: import('vue').Ref<import('../../type').TtsRichTextServices, import('../../type').TtsRichTextServices>;
294
+ features: import('vue').Ref<import('../../type').TtsEditorFeatures, import('../../type').TtsEditorFeatures>;
295
+ notify: (type: import('../../type').NotificationType, message: string) => void;
296
+ getReferencedVirtualElement: () => {
297
+ getBoundingClientRect(): {
298
+ x: number;
299
+ y: number;
300
+ left: number;
301
+ top: number;
302
+ right: number;
303
+ bottom: number;
304
+ width: number;
305
+ height: number;
306
+ };
307
+ } | null;
308
+ replaceContentWithText: (text: string) => void;
309
+ textLength: import('vue').ComputedRef<number>;
310
+ voiceVersion: import('vue').Ref<number, number>;
311
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
312
+ change: () => any;
313
+ ready: (editor: Editor) => any;
314
+ }, string, {
315
+ disabled: boolean;
316
+ placeholder: string;
317
+ textLimit: number;
318
+ voiceVersion: number;
319
+ features: import('../../type').TtsEditorFeatures;
320
+ services: import('../../type').TtsRichTextServices;
321
+ showSelectionMenu: boolean;
322
+ initialContent: JSONContent;
323
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
324
+ beforeCreate?: (() => void) | (() => void)[];
325
+ created?: (() => void) | (() => void)[];
326
+ beforeMount?: (() => void) | (() => void)[];
327
+ mounted?: (() => void) | (() => void)[];
328
+ beforeUpdate?: (() => void) | (() => void)[];
329
+ updated?: (() => void) | (() => void)[];
330
+ activated?: (() => void) | (() => void)[];
331
+ deactivated?: (() => void) | (() => void)[];
332
+ beforeDestroy?: (() => void) | (() => void)[];
333
+ beforeUnmount?: (() => void) | (() => void)[];
334
+ destroyed?: (() => void) | (() => void)[];
335
+ unmounted?: (() => void) | (() => void)[];
336
+ renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
337
+ renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
338
+ errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
339
+ };
340
+ $forceUpdate: () => void;
341
+ $nextTick: typeof import('vue').nextTick;
342
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
343
+ } & Readonly<{
344
+ disabled: boolean;
345
+ placeholder: string;
346
+ textLimit: number;
347
+ voiceVersion: number;
348
+ features: import('../../type').TtsEditorFeatures;
349
+ services: import('../../type').TtsRichTextServices;
350
+ showSelectionMenu: boolean;
351
+ initialContent: JSONContent;
352
+ }> & Omit<Readonly<import('../../type').TtsEditorRootProps> & Readonly<{
353
+ onChange?: (() => any) | undefined;
354
+ onReady?: ((editor: Editor) => any) | undefined;
355
+ }>, "clear" | "editor" | "focus" | "textLimitLength" | "notify" | "getGenerateAudioParams" | "clearContent" | "setContent" | "insertToken" | "insertWrappedToken" | "getSelectedText" | "getSelectedJson" | "selectedText" | "hasSelectedText" | "isSelectedPureNumber" | "driveMode" | "getReferencedVirtualElement" | "replaceContentWithText" | "textLength" | ("disabled" | "placeholder" | "textLimit" | "voiceVersion" | "features" | "services" | "showSelectionMenu" | "initialContent") | "getJson" | "getTtsData" | "replaceText"> & {
356
+ clear: () => void;
357
+ focus: () => void;
358
+ getJson: () => JSONContent;
359
+ getTtsData: () => TtsInputData;
360
+ replaceText: (text: string) => void;
361
+ editor: import('@tiptap/vue-3').Editor | undefined;
362
+ driveMode: import('../tts-rich-text/editor').DriveModeEnum;
363
+ insertToken: (data: {
364
+ categ: import('../tts-rich-text/editor').CustomTagType;
365
+ payload: Record<string, any>;
366
+ }) => void;
367
+ insertWrappedToken: (data: {
368
+ categ: import('../tts-rich-text/editor').CustomTagType;
369
+ payload: Record<string, any>;
370
+ }) => void;
371
+ clearContent: () => void;
372
+ setContent: (content: JSONContent) => void;
373
+ getSelectedText: () => string;
374
+ getSelectedJson: () => JSONContent | null;
375
+ selectedText: string;
376
+ hasSelectedText: boolean;
377
+ isSelectedPureNumber: boolean;
378
+ textLimitLength: number;
379
+ getGenerateAudioParams: () => {
380
+ pitch?: number;
381
+ speed?: number;
382
+ timberId?: string;
383
+ volume?: number;
384
+ };
385
+ services: import('../../type').TtsRichTextServices;
386
+ features: import('../../type').TtsEditorFeatures;
387
+ notify: (type: import('../../type').NotificationType, message: string) => void;
388
+ getReferencedVirtualElement: () => {
389
+ getBoundingClientRect(): {
390
+ x: number;
391
+ y: number;
392
+ left: number;
393
+ top: number;
394
+ right: number;
395
+ bottom: number;
396
+ width: number;
397
+ height: number;
398
+ };
399
+ } | null;
400
+ replaceContentWithText: (text: string) => void;
401
+ textLength: number;
402
+ voiceVersion: number;
403
+ } & {} & import('vue').ComponentCustomProperties & {} & {
404
+ $slots: Readonly<{
405
+ default(): unknown;
406
+ }> & {
407
+ default(): unknown;
408
+ };
409
+ }) | null;
410
+ }, any>;
51
411
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
52
412
  export default _default;
53
413
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -1,4 +1,4 @@
1
- export { useEditorContext, useEditorProvider, useRichTextEditor, type UseRichTextEditorOptions } from '../components/tts-rich-text/editor/useRichTextEditor';
1
+ export { useEditorContext, useEditorProvider, useRichTextEditor, type RichTextEditor, type UseRichTextEditorOptions } from '../components/tts-rich-text/editor/useRichTextEditor';
2
2
  export { createCustomTagNode, CustomTagName } from '../components/tts-rich-text/editor/nodes/tag-node';
3
3
  export { createTtsCharacterCount } from '../components/tts-rich-text/editor/plugins/tts-character-count';
4
4
  export { useVoiceChangeConfirm } from '../components/tts-rich-text/hooks/useVoiceChangeConfirm';