@naersen/tts-rich-text 0.2.0 → 0.4.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.
@@ -4,20 +4,20 @@ declare function __VLS_template(): {
4
4
  attrs: Partial<{}>;
5
5
  slots: {
6
6
  'toolbar-before'?(_: {
7
- editor: Editor | undefined;
7
+ editor: import('@tiptap/vue-3').Editor | undefined;
8
8
  }): any;
9
9
  'toolbar-after'?(_: {
10
- editor: Editor | undefined;
10
+ editor: import('@tiptap/vue-3').Editor | undefined;
11
11
  }): any;
12
12
  'editor-after'?(_: {
13
- editor: Editor | undefined;
13
+ editor: import('@tiptap/vue-3').Editor | undefined;
14
14
  }): any;
15
15
  'footer-before'?(_: {
16
- editor: Editor | undefined;
16
+ editor: import('@tiptap/vue-3').Editor | undefined;
17
17
  textLength: number;
18
18
  }): any;
19
19
  'footer-after'?(_: {
20
- editor: Editor | undefined;
20
+ editor: import('@tiptap/vue-3').Editor | undefined;
21
21
  textLength: number;
22
22
  }): any;
23
23
  };
@@ -28,15 +28,14 @@ declare function __VLS_template(): {
28
28
  $props: {
29
29
  readonly disabled?: boolean | undefined;
30
30
  readonly placeholder?: string | undefined;
31
- readonly modelValue?: JSONContent | undefined;
32
31
  readonly textLimit?: number | undefined;
33
32
  readonly voiceVersion?: number | undefined;
34
33
  readonly features?: import('../../type').TtsEditorFeatures | undefined;
35
34
  readonly services?: import('../../type').TtsRichTextServices | undefined;
36
35
  readonly getPreviewParams?: (() => Record<string, unknown>) | undefined;
37
36
  readonly showSelectionMenu?: boolean | undefined;
38
- readonly "onUpdate:modelValue"?: ((value: JSONContent) => any) | undefined;
39
- readonly onChange?: ((value: JSONContent) => any) | undefined;
37
+ readonly initialContent?: JSONContent | undefined;
38
+ readonly onChange?: (() => any) | undefined;
40
39
  readonly onReady?: ((editor: Editor) => any) | undefined;
41
40
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
42
41
  $attrs: import('vue').Attrs;
@@ -49,11 +48,10 @@ declare function __VLS_template(): {
49
48
  $root: import('vue').ComponentPublicInstance | null;
50
49
  $parent: import('vue').ComponentPublicInstance | null;
51
50
  $host: Element | null;
52
- $emit: ((event: "update:modelValue", value: JSONContent) => void) & ((event: "change", value: JSONContent) => void) & ((event: "ready", editor: Editor) => void);
51
+ $emit: ((event: "change") => void) & ((event: "ready", editor: Editor) => void);
53
52
  $el: any;
54
53
  $options: import('vue').ComponentOptionsBase<Readonly<import('../../type').TtsEditorRootProps> & Readonly<{
55
- "onUpdate:modelValue"?: ((value: JSONContent) => any) | undefined;
56
- onChange?: ((value: JSONContent) => any) | undefined;
54
+ onChange?: (() => any) | undefined;
57
55
  onReady?: ((editor: Editor) => any) | undefined;
58
56
  }>, {
59
57
  clear: () => void;
@@ -61,19 +59,61 @@ declare function __VLS_template(): {
61
59
  getJson: () => JSONContent;
62
60
  getTtsData: () => TtsInputData;
63
61
  replaceText: (text: string) => void;
62
+ handleChangeVoice: (currentModel: number, nextModel: number) => Promise<boolean>;
63
+ editor: import('vue').ShallowRef<import('@tiptap/vue-3').Editor | undefined, import('@tiptap/vue-3').Editor | undefined>;
64
+ driveMode: import('vue').Ref<import('../tts-rich-text/editor').DriveModeEnum, import('../tts-rich-text/editor').DriveModeEnum>;
65
+ insertToken: (data: {
66
+ categ: import('../tts-rich-text/editor').CustomTagType;
67
+ payload: Record<string, any>;
68
+ }) => void;
69
+ insertWrappedToken: (data: {
70
+ categ: import('../tts-rich-text/editor').CustomTagType;
71
+ payload: Record<string, any>;
72
+ }) => void;
73
+ clearContent: () => void;
74
+ setContent: (content: JSONContent) => void;
75
+ getSelectedText: () => string;
76
+ getSelectedJson: () => JSONContent | null;
77
+ selectedText: import('vue').Ref<string, string>;
78
+ hasSelectedText: import('vue').ComputedRef<boolean>;
79
+ isSelectedPureNumber: import('vue').ComputedRef<boolean>;
80
+ textLimitLength: number;
81
+ getGenerateAudioParams: () => {
82
+ pitch?: number;
83
+ speed?: number;
84
+ timberId?: string;
85
+ volume?: number;
86
+ };
87
+ services: import('vue').Ref<import('../../type').TtsRichTextServices, import('../../type').TtsRichTextServices>;
88
+ features: import('vue').Ref<import('../../type').TtsEditorFeatures, import('../../type').TtsEditorFeatures>;
89
+ notify: (type: import('../../type').NotificationType, message: string) => void;
90
+ getReferencedVirtualElement: () => {
91
+ getBoundingClientRect(): {
92
+ x: number;
93
+ y: number;
94
+ left: number;
95
+ top: number;
96
+ right: number;
97
+ bottom: number;
98
+ width: number;
99
+ height: number;
100
+ };
101
+ } | null;
102
+ replaceContentWithText: (text: string) => void;
103
+ textLength: import('vue').ComputedRef<number>;
104
+ voiceVersion: import('vue').Ref<number, number>;
64
105
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
65
- "update:modelValue": (value: JSONContent) => any;
66
- change: (value: JSONContent) => any;
106
+ change: () => any;
67
107
  ready: (editor: Editor) => any;
68
108
  }, string, {
69
109
  disabled: boolean;
70
110
  placeholder: string;
71
- modelValue: JSONContent;
72
111
  textLimit: number;
73
112
  voiceVersion: number;
74
113
  features: import('../../type').TtsEditorFeatures;
75
114
  services: import('../../type').TtsRichTextServices;
76
115
  showSelectionMenu: boolean;
116
+ initialContent: JSONContent;
77
117
  }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
78
118
  beforeCreate?: (() => void) | (() => void)[];
79
119
  created?: (() => void) | (() => void)[];
@@ -97,27 +137,69 @@ declare function __VLS_template(): {
97
137
  } & Readonly<{
98
138
  disabled: boolean;
99
139
  placeholder: string;
100
- modelValue: JSONContent;
101
140
  textLimit: number;
102
141
  voiceVersion: number;
103
142
  features: import('../../type').TtsEditorFeatures;
104
143
  services: import('../../type').TtsRichTextServices;
105
144
  showSelectionMenu: boolean;
145
+ initialContent: JSONContent;
106
146
  }> & Omit<Readonly<import('../../type').TtsEditorRootProps> & Readonly<{
107
- "onUpdate:modelValue"?: ((value: JSONContent) => any) | undefined;
108
- onChange?: ((value: JSONContent) => any) | undefined;
147
+ onChange?: (() => any) | undefined;
109
148
  onReady?: ((editor: Editor) => any) | undefined;
110
- }>, "clear" | "focus" | ("disabled" | "placeholder" | "modelValue" | "textLimit" | "voiceVersion" | "features" | "services" | "showSelectionMenu") | "getJson" | "getTtsData" | "replaceText"> & {
149
+ }>, "clear" | "editor" | "focus" | "textLimitLength" | "notify" | "getGenerateAudioParams" | "clearContent" | "setContent" | "insertToken" | "insertWrappedToken" | "getSelectedText" | "getSelectedJson" | "selectedText" | "hasSelectedText" | "isSelectedPureNumber" | "driveMode" | "getReferencedVirtualElement" | "replaceContentWithText" | "textLength" | "handleChangeVoice" | ("disabled" | "placeholder" | "textLimit" | "voiceVersion" | "features" | "services" | "showSelectionMenu" | "initialContent") | "getJson" | "getTtsData" | "replaceText"> & {
111
150
  clear: () => void;
112
151
  focus: () => void;
113
152
  getJson: () => JSONContent;
114
153
  getTtsData: () => TtsInputData;
115
154
  replaceText: (text: string) => void;
155
+ handleChangeVoice: (currentModel: number, nextModel: number) => Promise<boolean>;
156
+ editor: import('@tiptap/vue-3').Editor | undefined;
157
+ driveMode: import('../tts-rich-text/editor').DriveModeEnum;
158
+ insertToken: (data: {
159
+ categ: import('../tts-rich-text/editor').CustomTagType;
160
+ payload: Record<string, any>;
161
+ }) => void;
162
+ insertWrappedToken: (data: {
163
+ categ: import('../tts-rich-text/editor').CustomTagType;
164
+ payload: Record<string, any>;
165
+ }) => void;
166
+ clearContent: () => void;
167
+ setContent: (content: JSONContent) => void;
168
+ getSelectedText: () => string;
169
+ getSelectedJson: () => JSONContent | null;
170
+ selectedText: string;
171
+ hasSelectedText: boolean;
172
+ isSelectedPureNumber: boolean;
173
+ textLimitLength: number;
174
+ getGenerateAudioParams: () => {
175
+ pitch?: number;
176
+ speed?: number;
177
+ timberId?: string;
178
+ volume?: number;
179
+ };
180
+ services: import('../../type').TtsRichTextServices;
181
+ features: import('../../type').TtsEditorFeatures;
182
+ notify: (type: import('../../type').NotificationType, message: string) => void;
183
+ getReferencedVirtualElement: () => {
184
+ getBoundingClientRect(): {
185
+ x: number;
186
+ y: number;
187
+ left: number;
188
+ top: number;
189
+ right: number;
190
+ bottom: number;
191
+ width: number;
192
+ height: number;
193
+ };
194
+ } | null;
195
+ replaceContentWithText: (text: string) => void;
196
+ textLength: number;
197
+ voiceVersion: number;
116
198
  } & {} & import('vue').ComponentCustomProperties & {} & {
117
199
  $slots: Readonly<{
118
- default(props: import('../tts-editor-root').TtsEditorRootSlotProps): unknown;
200
+ default(): unknown;
119
201
  }> & {
120
- default(props: import('../tts-editor-root').TtsEditorRootSlotProps): unknown;
202
+ default(): unknown;
121
203
  };
122
204
  }) | null;
123
205
  };
@@ -130,6 +212,7 @@ declare const __VLS_component: import('vue').DefineComponent<TtsRichTextEditorPr
130
212
  getJson: () => JSONContent;
131
213
  getTtsData: () => TtsInputData;
132
214
  replaceText: (text: string) => void;
215
+ handleChangeVoice: (currentModel: number, nextModel: number) => Promise<boolean>;
133
216
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
134
217
  "update:modelValue": (value: JSONContent) => any;
135
218
  change: (value: JSONContent) => any;
@@ -155,15 +238,14 @@ declare const __VLS_component: import('vue').DefineComponent<TtsRichTextEditorPr
155
238
  $props: {
156
239
  readonly disabled?: boolean | undefined;
157
240
  readonly placeholder?: string | undefined;
158
- readonly modelValue?: JSONContent | undefined;
159
241
  readonly textLimit?: number | undefined;
160
242
  readonly voiceVersion?: number | undefined;
161
243
  readonly features?: import('../../type').TtsEditorFeatures | undefined;
162
244
  readonly services?: import('../../type').TtsRichTextServices | undefined;
163
245
  readonly getPreviewParams?: (() => Record<string, unknown>) | undefined;
164
246
  readonly showSelectionMenu?: boolean | undefined;
165
- readonly "onUpdate:modelValue"?: ((value: JSONContent) => any) | undefined;
166
- readonly onChange?: ((value: JSONContent) => any) | undefined;
247
+ readonly initialContent?: JSONContent | undefined;
248
+ readonly onChange?: (() => any) | undefined;
167
249
  readonly onReady?: ((editor: Editor) => any) | undefined;
168
250
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
169
251
  $attrs: import('vue').Attrs;
@@ -176,11 +258,10 @@ declare const __VLS_component: import('vue').DefineComponent<TtsRichTextEditorPr
176
258
  $root: import('vue').ComponentPublicInstance | null;
177
259
  $parent: import('vue').ComponentPublicInstance | null;
178
260
  $host: Element | null;
179
- $emit: ((event: "update:modelValue", value: JSONContent) => void) & ((event: "change", value: JSONContent) => void) & ((event: "ready", editor: Editor) => void);
261
+ $emit: ((event: "change") => void) & ((event: "ready", editor: Editor) => void);
180
262
  $el: any;
181
263
  $options: import('vue').ComponentOptionsBase<Readonly<import('../../type').TtsEditorRootProps> & Readonly<{
182
- "onUpdate:modelValue"?: ((value: JSONContent) => any) | undefined;
183
- onChange?: ((value: JSONContent) => any) | undefined;
264
+ onChange?: (() => any) | undefined;
184
265
  onReady?: ((editor: Editor) => any) | undefined;
185
266
  }>, {
186
267
  clear: () => void;
@@ -188,19 +269,61 @@ declare const __VLS_component: import('vue').DefineComponent<TtsRichTextEditorPr
188
269
  getJson: () => JSONContent;
189
270
  getTtsData: () => TtsInputData;
190
271
  replaceText: (text: string) => void;
272
+ handleChangeVoice: (currentModel: number, nextModel: number) => Promise<boolean>;
273
+ editor: import('vue').ShallowRef<import('@tiptap/vue-3').Editor | undefined, import('@tiptap/vue-3').Editor | undefined>;
274
+ driveMode: import('vue').Ref<import('../tts-rich-text/editor').DriveModeEnum, import('../tts-rich-text/editor').DriveModeEnum>;
275
+ insertToken: (data: {
276
+ categ: import('../tts-rich-text/editor').CustomTagType;
277
+ payload: Record<string, any>;
278
+ }) => void;
279
+ insertWrappedToken: (data: {
280
+ categ: import('../tts-rich-text/editor').CustomTagType;
281
+ payload: Record<string, any>;
282
+ }) => void;
283
+ clearContent: () => void;
284
+ setContent: (content: JSONContent) => void;
285
+ getSelectedText: () => string;
286
+ getSelectedJson: () => JSONContent | null;
287
+ selectedText: import('vue').Ref<string, string>;
288
+ hasSelectedText: import('vue').ComputedRef<boolean>;
289
+ isSelectedPureNumber: import('vue').ComputedRef<boolean>;
290
+ textLimitLength: number;
291
+ getGenerateAudioParams: () => {
292
+ pitch?: number;
293
+ speed?: number;
294
+ timberId?: string;
295
+ volume?: number;
296
+ };
297
+ services: import('vue').Ref<import('../../type').TtsRichTextServices, import('../../type').TtsRichTextServices>;
298
+ features: import('vue').Ref<import('../../type').TtsEditorFeatures, import('../../type').TtsEditorFeatures>;
299
+ notify: (type: import('../../type').NotificationType, message: string) => void;
300
+ getReferencedVirtualElement: () => {
301
+ getBoundingClientRect(): {
302
+ x: number;
303
+ y: number;
304
+ left: number;
305
+ top: number;
306
+ right: number;
307
+ bottom: number;
308
+ width: number;
309
+ height: number;
310
+ };
311
+ } | null;
312
+ replaceContentWithText: (text: string) => void;
313
+ textLength: import('vue').ComputedRef<number>;
314
+ voiceVersion: import('vue').Ref<number, number>;
191
315
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
192
- "update:modelValue": (value: JSONContent) => any;
193
- change: (value: JSONContent) => any;
316
+ change: () => any;
194
317
  ready: (editor: Editor) => any;
195
318
  }, string, {
196
319
  disabled: boolean;
197
320
  placeholder: string;
198
- modelValue: JSONContent;
199
321
  textLimit: number;
200
322
  voiceVersion: number;
201
323
  features: import('../../type').TtsEditorFeatures;
202
324
  services: import('../../type').TtsRichTextServices;
203
325
  showSelectionMenu: boolean;
326
+ initialContent: JSONContent;
204
327
  }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
205
328
  beforeCreate?: (() => void) | (() => void)[];
206
329
  created?: (() => void) | (() => void)[];
@@ -224,27 +347,69 @@ declare const __VLS_component: import('vue').DefineComponent<TtsRichTextEditorPr
224
347
  } & Readonly<{
225
348
  disabled: boolean;
226
349
  placeholder: string;
227
- modelValue: JSONContent;
228
350
  textLimit: number;
229
351
  voiceVersion: number;
230
352
  features: import('../../type').TtsEditorFeatures;
231
353
  services: import('../../type').TtsRichTextServices;
232
354
  showSelectionMenu: boolean;
355
+ initialContent: JSONContent;
233
356
  }> & Omit<Readonly<import('../../type').TtsEditorRootProps> & Readonly<{
234
- "onUpdate:modelValue"?: ((value: JSONContent) => any) | undefined;
235
- onChange?: ((value: JSONContent) => any) | undefined;
357
+ onChange?: (() => any) | undefined;
236
358
  onReady?: ((editor: Editor) => any) | undefined;
237
- }>, "clear" | "focus" | ("disabled" | "placeholder" | "modelValue" | "textLimit" | "voiceVersion" | "features" | "services" | "showSelectionMenu") | "getJson" | "getTtsData" | "replaceText"> & {
359
+ }>, "clear" | "editor" | "focus" | "textLimitLength" | "notify" | "getGenerateAudioParams" | "clearContent" | "setContent" | "insertToken" | "insertWrappedToken" | "getSelectedText" | "getSelectedJson" | "selectedText" | "hasSelectedText" | "isSelectedPureNumber" | "driveMode" | "getReferencedVirtualElement" | "replaceContentWithText" | "textLength" | "handleChangeVoice" | ("disabled" | "placeholder" | "textLimit" | "voiceVersion" | "features" | "services" | "showSelectionMenu" | "initialContent") | "getJson" | "getTtsData" | "replaceText"> & {
238
360
  clear: () => void;
239
361
  focus: () => void;
240
362
  getJson: () => JSONContent;
241
363
  getTtsData: () => TtsInputData;
242
364
  replaceText: (text: string) => void;
365
+ handleChangeVoice: (currentModel: number, nextModel: number) => Promise<boolean>;
366
+ editor: import('@tiptap/vue-3').Editor | undefined;
367
+ driveMode: import('../tts-rich-text/editor').DriveModeEnum;
368
+ insertToken: (data: {
369
+ categ: import('../tts-rich-text/editor').CustomTagType;
370
+ payload: Record<string, any>;
371
+ }) => void;
372
+ insertWrappedToken: (data: {
373
+ categ: import('../tts-rich-text/editor').CustomTagType;
374
+ payload: Record<string, any>;
375
+ }) => void;
376
+ clearContent: () => void;
377
+ setContent: (content: JSONContent) => void;
378
+ getSelectedText: () => string;
379
+ getSelectedJson: () => JSONContent | null;
380
+ selectedText: string;
381
+ hasSelectedText: boolean;
382
+ isSelectedPureNumber: boolean;
383
+ textLimitLength: number;
384
+ getGenerateAudioParams: () => {
385
+ pitch?: number;
386
+ speed?: number;
387
+ timberId?: string;
388
+ volume?: number;
389
+ };
390
+ services: import('../../type').TtsRichTextServices;
391
+ features: import('../../type').TtsEditorFeatures;
392
+ notify: (type: import('../../type').NotificationType, message: string) => void;
393
+ getReferencedVirtualElement: () => {
394
+ getBoundingClientRect(): {
395
+ x: number;
396
+ y: number;
397
+ left: number;
398
+ top: number;
399
+ right: number;
400
+ bottom: number;
401
+ width: number;
402
+ height: number;
403
+ };
404
+ } | null;
405
+ replaceContentWithText: (text: string) => void;
406
+ textLength: number;
407
+ voiceVersion: number;
243
408
  } & {} & import('vue').ComponentCustomProperties & {} & {
244
409
  $slots: Readonly<{
245
- default(props: import('../tts-editor-root').TtsEditorRootSlotProps): unknown;
410
+ default(): unknown;
246
411
  }> & {
247
- default(props: import('../tts-editor-root').TtsEditorRootSlotProps): unknown;
412
+ default(): unknown;
248
413
  };
249
414
  }) | null;
250
415
  }, any>;
@@ -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';