@vunk/plus 1.3.1 → 1.3.4
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/components/agent-chat-provider/index.mjs +1 -574
- package/components/broadcasting-markdown/index.mjs +47 -18
- package/components/broadcasting-markdown/src/ctx.d.ts +8 -0
- package/components/broadcasting-markdown/src/custom-speech.vue.d.ts +9 -1
- package/components/broadcasting-markdown/src/index.vue.d.ts +39 -0
- package/components/broadcasting-markdown/src/paragraph.vue.d.ts +14 -0
- package/components/broadcasting-markdown/src/web-speech.vue.d.ts +8 -0
- package/components/browser.mjs +575 -0
- package/components/bubble-list/index.mjs +2 -316
- package/components/bubble-list/src/index.vue.d.ts +39 -0
- package/components/bubble-templates/index.mjs +2 -161
- package/components/bubble-templates/src/index.vue.d.ts +39 -0
- package/components/chat-independent/index.mjs +42 -34
- package/components/chat-independent/src/index.vue.d.ts +39 -0
- package/components/tables-v1/src/ctx.d.ts +1 -1
- package/components/tables-v1/src/index.vue.d.ts +1 -1
- package/components/tables-v1-checkbox/src/ctx.d.ts +1 -1
- package/components/tables-v1-checkbox/src/index.vue.d.ts +3 -3
- package/components/typing-markdown/index.mjs +2 -2
- package/index.css +0 -38
- package/package.json +1 -7
- package/components/bubble-list/index.css +0 -18
- package/components/bubble-templates/index.css +0 -18
- package/components/index2.mjs +0 -35980
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { VkTypingMarkdown } from '@vunk/plus/components/typing-markdown';
|
|
2
2
|
import { setData } from '@vunk/core';
|
|
3
3
|
import { defineComponent, createElementBlock, openBlock, createElementVNode, Fragment, createVNode, unref, withCtx, computed, onBeforeUnmount, onMounted, watch, shallowRef, nextTick, renderSlot, createCommentVNode, ref, watchEffect, resolveComponent, renderList, createBlock } from 'vue';
|
|
4
|
-
import markdownIt from 'markdown-it';
|
|
5
4
|
import { useDeferred } from '@vunk/core/composables';
|
|
6
5
|
import { ElIcon } from 'element-plus';
|
|
7
6
|
import { noop } from '@vunk/shared/function';
|
|
8
7
|
import { Deferred } from '@vunk/shared/promise';
|
|
8
|
+
import { c as consola } from '../browser.mjs';
|
|
9
9
|
import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
function markdownToPlainText(md) {
|
|
12
|
+
return md.replace(/!\[.*?\]\(.*?\)/g, "").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/^#{1,6}\s+/gm, "").replace(/\*\*(.*?)\*\*/g, "$1").replace(/__(.*?)__/g, "$1").replace(/\*(.*?)\*/g, "$1").replace(/_(.*?)_/g, "$1").replace(/`(.*?)`/g, "$1").replace(/```[\s\S]*?```/g, "").replace(/\n{2,}/g, "\n").replace(/-{3,}/g, "").replace(/^\s*-\s+/gm, "").replace(/\|/g, "").trim();
|
|
13
|
+
}
|
|
12
14
|
function defaultRender(mdText) {
|
|
13
|
-
|
|
14
|
-
const doc = new DOMParser().parseFromString(html, "text/html");
|
|
15
|
-
return doc.body.textContent || "";
|
|
15
|
+
return markdownToPlainText(mdText);
|
|
16
16
|
}
|
|
17
17
|
var ParagraphStatus = /* @__PURE__ */ ((ParagraphStatus2) => {
|
|
18
18
|
ParagraphStatus2["initial"] = "initial";
|
|
@@ -32,6 +32,13 @@ var Broadcast = /* @__PURE__ */ ((Broadcast2) => {
|
|
|
32
32
|
})(Broadcast || {});
|
|
33
33
|
|
|
34
34
|
const props = {
|
|
35
|
+
/**
|
|
36
|
+
* @description md文本转纯文本的函数
|
|
37
|
+
*/
|
|
38
|
+
render: {
|
|
39
|
+
type: Function,
|
|
40
|
+
default: defaultRender
|
|
41
|
+
},
|
|
35
42
|
/**
|
|
36
43
|
* @description 段落详情
|
|
37
44
|
*/
|
|
@@ -178,10 +185,14 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
178
185
|
url: {
|
|
179
186
|
type: String,
|
|
180
187
|
default: ""
|
|
188
|
+
},
|
|
189
|
+
render: {
|
|
190
|
+
type: Function,
|
|
191
|
+
required: true
|
|
181
192
|
}
|
|
182
193
|
},
|
|
183
194
|
setup(props) {
|
|
184
|
-
const value =
|
|
195
|
+
const value = props.render(props.data.value);
|
|
185
196
|
const theData = computed(() => props.data);
|
|
186
197
|
if (!value.trim()) {
|
|
187
198
|
props.deferred.resolve(true);
|
|
@@ -260,6 +271,10 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
260
271
|
processing: {
|
|
261
272
|
type: Function,
|
|
262
273
|
default: noop
|
|
274
|
+
},
|
|
275
|
+
retryTimes: {
|
|
276
|
+
type: Number,
|
|
277
|
+
default: 10
|
|
263
278
|
}
|
|
264
279
|
},
|
|
265
280
|
emits: ["update:status"],
|
|
@@ -267,6 +282,7 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
267
282
|
const props = __props;
|
|
268
283
|
const emit = __emit;
|
|
269
284
|
const theDef = shallowRef();
|
|
285
|
+
let retryTimes = props.retryTimes;
|
|
270
286
|
const processingDef = useDeferred();
|
|
271
287
|
onMounted(async () => {
|
|
272
288
|
emit("update:status", ParagraphStatus.processing);
|
|
@@ -289,8 +305,15 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
289
305
|
emit("update:status", ParagraphStatus.pending);
|
|
290
306
|
deferred.promise.then(() => {
|
|
291
307
|
emit("update:status", ParagraphStatus.fulfilled);
|
|
292
|
-
}).catch((err) => {
|
|
293
|
-
|
|
308
|
+
}).catch(async (err) => {
|
|
309
|
+
consola.error("error", err);
|
|
310
|
+
if (retryTimes > 0) {
|
|
311
|
+
retryTimes--;
|
|
312
|
+
await props.processing?.();
|
|
313
|
+
consola.info("retryTimes", retryTimes);
|
|
314
|
+
init();
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
294
317
|
emit("update:status", ParagraphStatus.rejected);
|
|
295
318
|
});
|
|
296
319
|
theDef.value = void 0;
|
|
@@ -327,13 +350,15 @@ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
327
350
|
pause: {
|
|
328
351
|
type: Boolean,
|
|
329
352
|
default: false
|
|
353
|
+
},
|
|
354
|
+
render: {
|
|
355
|
+
type: Function,
|
|
356
|
+
required: true
|
|
330
357
|
}
|
|
331
358
|
},
|
|
332
359
|
setup(props) {
|
|
333
|
-
const value =
|
|
334
|
-
const theData = computed(() =>
|
|
335
|
-
return props.data;
|
|
336
|
-
});
|
|
360
|
+
const value = props.render(props.data.value);
|
|
361
|
+
const theData = computed(() => props.data);
|
|
337
362
|
if (!value.trim()) {
|
|
338
363
|
props.deferred.resolve(true);
|
|
339
364
|
theData.value.broadcast = Broadcast.ended;
|
|
@@ -415,7 +440,10 @@ var _sfc_main = defineComponent({
|
|
|
415
440
|
if (!props2.textToSpeech) {
|
|
416
441
|
return;
|
|
417
442
|
}
|
|
418
|
-
const value =
|
|
443
|
+
const value = props2.render(paragraph.value);
|
|
444
|
+
if (!value) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
419
447
|
return props2.textToSpeech(`${value}`).then((url) => {
|
|
420
448
|
paragraph.url = url;
|
|
421
449
|
});
|
|
@@ -597,19 +625,20 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
597
625
|
data: item,
|
|
598
626
|
deferred
|
|
599
627
|
}, () => [
|
|
600
|
-
|
|
601
|
-
|
|
628
|
+
createVNode(_component_CustomSpeechView, {
|
|
629
|
+
render: _ctx.render,
|
|
602
630
|
url: item.url,
|
|
603
631
|
pause: _ctx.pause,
|
|
604
632
|
deferred,
|
|
605
633
|
data: item
|
|
606
|
-
}, null, 8, ["url", "pause", "deferred", "data"])
|
|
634
|
+
}, null, 8, ["render", "url", "pause", "deferred", "data"]),
|
|
607
635
|
_ctx.webSpeech ? (openBlock(), createBlock(_component_WebSpeechView, {
|
|
608
|
-
key:
|
|
636
|
+
key: 0,
|
|
637
|
+
render: _ctx.render,
|
|
609
638
|
pause: _ctx.pause,
|
|
610
639
|
deferred,
|
|
611
640
|
data: item
|
|
612
|
-
}, null, 8, ["pause", "deferred", "data"])) : createCommentVNode("v-if", true)
|
|
641
|
+
}, null, 8, ["render", "pause", "deferred", "data"])) : createCommentVNode("v-if", true)
|
|
613
642
|
])
|
|
614
643
|
]),
|
|
615
644
|
_: 2
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import type { SetDataEvent } from '@vunk/core';
|
|
2
2
|
import type { PropType } from 'vue';
|
|
3
3
|
import type { Paragraph, TextToSpeech } from './types';
|
|
4
|
+
import { defaultRender } from './const';
|
|
4
5
|
export declare const props: {
|
|
6
|
+
/**
|
|
7
|
+
* @description md文本转纯文本的函数
|
|
8
|
+
*/
|
|
9
|
+
render: {
|
|
10
|
+
type: PropType<(text: string) => string>;
|
|
11
|
+
default: typeof defaultRender;
|
|
12
|
+
};
|
|
5
13
|
/**
|
|
6
14
|
* @description 段落详情
|
|
7
15
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { Deferred } from '@vunk/shared/promise';
|
|
1
2
|
import type { PropType } from 'vue';
|
|
2
3
|
import type { Paragraph } from './types';
|
|
3
|
-
import { type Deferred } from '@vunk/shared/promise';
|
|
4
4
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
5
|
data: {
|
|
6
6
|
type: PropType<Paragraph>;
|
|
@@ -21,6 +21,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
21
21
|
type: StringConstructor;
|
|
22
22
|
default: string;
|
|
23
23
|
};
|
|
24
|
+
render: {
|
|
25
|
+
type: PropType<(text: string) => string>;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
24
28
|
}>, (() => null) | (() => JSX.Element), {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
25
29
|
data: {
|
|
26
30
|
type: PropType<Paragraph>;
|
|
@@ -41,6 +45,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
41
45
|
type: StringConstructor;
|
|
42
46
|
default: string;
|
|
43
47
|
};
|
|
48
|
+
render: {
|
|
49
|
+
type: PropType<(text: string) => string>;
|
|
50
|
+
required: true;
|
|
51
|
+
};
|
|
44
52
|
}>> & Readonly<{}>, {
|
|
45
53
|
pause: boolean;
|
|
46
54
|
data: Paragraph;
|
|
@@ -3,6 +3,10 @@ import type { Ref } from 'vue';
|
|
|
3
3
|
import type { Paragraph } from './types';
|
|
4
4
|
import { ParagraphStatus } from './const';
|
|
5
5
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
6
|
+
render: {
|
|
7
|
+
type: import("vue").PropType<(text: string) => string>;
|
|
8
|
+
default: typeof import("./const").defaultRender;
|
|
9
|
+
};
|
|
6
10
|
data: {
|
|
7
11
|
type: {
|
|
8
12
|
(arrayLength: number): Paragraph[];
|
|
@@ -74,6 +78,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
74
78
|
'update:completed': (_: boolean) => boolean;
|
|
75
79
|
'update:error': (_: boolean) => boolean;
|
|
76
80
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
81
|
+
render: {
|
|
82
|
+
type: import("vue").PropType<(text: string) => string>;
|
|
83
|
+
default: typeof import("./const").defaultRender;
|
|
84
|
+
};
|
|
77
85
|
data: {
|
|
78
86
|
type: {
|
|
79
87
|
(arrayLength: number): Paragraph[];
|
|
@@ -141,6 +149,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
141
149
|
source: string;
|
|
142
150
|
delay: number;
|
|
143
151
|
pause: boolean;
|
|
152
|
+
render: (text: string) => string;
|
|
144
153
|
data: Paragraph[];
|
|
145
154
|
separators: string[];
|
|
146
155
|
keepRead: boolean;
|
|
@@ -164,6 +173,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
164
173
|
type: import("vue").PropType<import("@vunk/shared").AnyFunc>;
|
|
165
174
|
default: import("@vunk/shared").AnyFunc;
|
|
166
175
|
};
|
|
176
|
+
retryTimes: {
|
|
177
|
+
type: NumberConstructor;
|
|
178
|
+
default: number;
|
|
179
|
+
};
|
|
167
180
|
}>, {
|
|
168
181
|
props: import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
169
182
|
enable: {
|
|
@@ -182,11 +195,16 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
182
195
|
type: import("vue").PropType<import("@vunk/shared").AnyFunc>;
|
|
183
196
|
default: import("@vunk/shared").AnyFunc;
|
|
184
197
|
};
|
|
198
|
+
retryTimes: {
|
|
199
|
+
type: NumberConstructor;
|
|
200
|
+
default: number;
|
|
201
|
+
};
|
|
185
202
|
}>> & Readonly<{
|
|
186
203
|
"onUpdate:status"?: ((...args: any[]) => any) | undefined;
|
|
187
204
|
}> & {}>;
|
|
188
205
|
emit: (event: "update:status", ...args: any[]) => void;
|
|
189
206
|
theDef: import("vue").ShallowRef<import("@vunk/shared/promise").Deferred<any> | undefined, import("@vunk/shared/promise").Deferred<any> | undefined>;
|
|
207
|
+
retryTimes: number;
|
|
190
208
|
processingDef: {
|
|
191
209
|
_ref: import("vue").ShallowRef<unknown, unknown>;
|
|
192
210
|
readonly value: unknown;
|
|
@@ -212,6 +230,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
212
230
|
type: import("vue").PropType<import("@vunk/shared").AnyFunc>;
|
|
213
231
|
default: import("@vunk/shared").AnyFunc;
|
|
214
232
|
};
|
|
233
|
+
retryTimes: {
|
|
234
|
+
type: NumberConstructor;
|
|
235
|
+
default: number;
|
|
236
|
+
};
|
|
215
237
|
}>> & Readonly<{
|
|
216
238
|
"onUpdate:status"?: ((...args: any[]) => any) | undefined;
|
|
217
239
|
}>, {
|
|
@@ -219,6 +241,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
219
241
|
pause: boolean;
|
|
220
242
|
enable: boolean;
|
|
221
243
|
status: ParagraphStatus;
|
|
244
|
+
retryTimes: number;
|
|
222
245
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
223
246
|
VkTypingMarkdown: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
224
247
|
source: {
|
|
@@ -293,6 +316,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
293
316
|
type: BooleanConstructor;
|
|
294
317
|
default: boolean;
|
|
295
318
|
};
|
|
319
|
+
render: {
|
|
320
|
+
type: import("vue").PropType<(text: string) => string>;
|
|
321
|
+
required: true;
|
|
322
|
+
};
|
|
296
323
|
}>, (() => null) | (() => false | JSX.Element), {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
297
324
|
voice: {
|
|
298
325
|
type: import("vue").PropType<SpeechSynthesisVoice>;
|
|
@@ -310,6 +337,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
310
337
|
type: BooleanConstructor;
|
|
311
338
|
default: boolean;
|
|
312
339
|
};
|
|
340
|
+
render: {
|
|
341
|
+
type: import("vue").PropType<(text: string) => string>;
|
|
342
|
+
required: true;
|
|
343
|
+
};
|
|
313
344
|
}>> & Readonly<{}>, {
|
|
314
345
|
pause: boolean;
|
|
315
346
|
data: Paragraph;
|
|
@@ -391,6 +422,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
391
422
|
type: StringConstructor;
|
|
392
423
|
default: string;
|
|
393
424
|
};
|
|
425
|
+
render: {
|
|
426
|
+
type: import("vue").PropType<(text: string) => string>;
|
|
427
|
+
required: true;
|
|
428
|
+
};
|
|
394
429
|
}>, (() => null) | (() => JSX.Element), {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
395
430
|
data: {
|
|
396
431
|
type: import("vue").PropType<Paragraph>;
|
|
@@ -408,6 +443,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
408
443
|
type: StringConstructor;
|
|
409
444
|
default: string;
|
|
410
445
|
};
|
|
446
|
+
render: {
|
|
447
|
+
type: import("vue").PropType<(text: string) => string>;
|
|
448
|
+
required: true;
|
|
449
|
+
};
|
|
411
450
|
}>> & Readonly<{}>, {
|
|
412
451
|
pause: boolean;
|
|
413
452
|
data: Paragraph;
|
|
@@ -19,6 +19,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
19
19
|
type: PropType<AnyFunc>;
|
|
20
20
|
default: AnyFunc;
|
|
21
21
|
};
|
|
22
|
+
retryTimes: {
|
|
23
|
+
type: NumberConstructor;
|
|
24
|
+
default: number;
|
|
25
|
+
};
|
|
22
26
|
}>, {
|
|
23
27
|
props: import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
24
28
|
enable: {
|
|
@@ -37,11 +41,16 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
37
41
|
type: PropType<AnyFunc>;
|
|
38
42
|
default: AnyFunc;
|
|
39
43
|
};
|
|
44
|
+
retryTimes: {
|
|
45
|
+
type: NumberConstructor;
|
|
46
|
+
default: number;
|
|
47
|
+
};
|
|
40
48
|
}>> & Readonly<{
|
|
41
49
|
"onUpdate:status"?: ((...args: any[]) => any) | undefined;
|
|
42
50
|
}> & {}>;
|
|
43
51
|
emit: (event: "update:status", ...args: any[]) => void;
|
|
44
52
|
theDef: import("vue").ShallowRef<Deferred<any> | undefined, Deferred<any> | undefined>;
|
|
53
|
+
retryTimes: number;
|
|
45
54
|
processingDef: {
|
|
46
55
|
_ref: import("vue").ShallowRef<unknown, unknown>;
|
|
47
56
|
readonly value: unknown;
|
|
@@ -67,6 +76,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
67
76
|
type: PropType<AnyFunc>;
|
|
68
77
|
default: AnyFunc;
|
|
69
78
|
};
|
|
79
|
+
retryTimes: {
|
|
80
|
+
type: NumberConstructor;
|
|
81
|
+
default: number;
|
|
82
|
+
};
|
|
70
83
|
}>> & Readonly<{
|
|
71
84
|
"onUpdate:status"?: ((...args: any[]) => any) | undefined;
|
|
72
85
|
}>, {
|
|
@@ -74,5 +87,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
74
87
|
pause: boolean;
|
|
75
88
|
enable: boolean;
|
|
76
89
|
status: ParagraphStatus;
|
|
90
|
+
retryTimes: number;
|
|
77
91
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
78
92
|
export default _default;
|
|
@@ -18,6 +18,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
18
18
|
type: BooleanConstructor;
|
|
19
19
|
default: boolean;
|
|
20
20
|
};
|
|
21
|
+
render: {
|
|
22
|
+
type: PropType<(text: string) => string>;
|
|
23
|
+
required: true;
|
|
24
|
+
};
|
|
21
25
|
}>, (() => null) | (() => false | JSX.Element), {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
26
|
voice: {
|
|
23
27
|
type: PropType<SpeechSynthesisVoice>;
|
|
@@ -35,6 +39,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
35
39
|
type: BooleanConstructor;
|
|
36
40
|
default: boolean;
|
|
37
41
|
};
|
|
42
|
+
render: {
|
|
43
|
+
type: PropType<(text: string) => string>;
|
|
44
|
+
required: true;
|
|
45
|
+
};
|
|
38
46
|
}>> & Readonly<{}>, {
|
|
39
47
|
pause: boolean;
|
|
40
48
|
data: Paragraph;
|