@vunk/plus 1.3.1 → 1.3.2

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,166 +1,7 @@
1
- import { defineComponent, ref, watch, computed, createElementBlock, openBlock, normalizeStyle, createElementVNode, createVNode, normalizeClass, renderSlot, createBlock, createCommentVNode, withCtx, unref, createTextVNode, toDisplayString, Transition, withDirectives, vShow, Fragment } from 'vue';
1
+ import { defineComponent, createElementBlock, openBlock, Fragment, createVNode, unref, withCtx, createBlock, createCommentVNode } from 'vue';
2
2
  import { VkBroadcastingMarkdown } from '@vunk/plus/components/broadcasting-markdown';
3
3
  import { VkRendererTemplate } from '@vunk/core/components/renderer-template';
4
- import { _ as _export_sfc, E as ElIcon, l as loading_default, o as opportunity_default, s as success_filled_default, c as circle_close_filled_default, a as arrow_up_bold_default, T as Typewriter } from '../index2.mjs';
5
-
6
- const _hoisted_1 = ["disabled"];
7
- const _hoisted_2 = {
8
- class: "status-icon"
9
- };
10
- const _hoisted_3 = {
11
- class: "label"
12
- };
13
- const _hoisted_4 = {
14
- class: "content"
15
- };
16
- const _hoisted_5 = {
17
- class: "error-message"
18
- };
19
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
20
- __name: "index",
21
- props: {
22
- modelValue: {
23
- type: Boolean,
24
- default: true
25
- },
26
- content: {
27
- default: ""
28
- },
29
- status: {
30
- default: "start"
31
- },
32
- disabled: {
33
- type: Boolean,
34
- default: false
35
- },
36
- autoCollapse: {
37
- type: Boolean,
38
- default: false
39
- },
40
- duration: {
41
- default: "0.2s"
42
- },
43
- buttonWidth: {
44
- default: "160px"
45
- },
46
- maxWidth: {
47
- default: "500px"
48
- },
49
- backgroundColor: {
50
- default: "#fcfcfc"
51
- },
52
- color: {
53
- default: "var(--el-color-info)"
54
- }
55
- },
56
- emits: ["change", "update:expanded"],
57
- setup(__props, {
58
- emit: __emit
59
- }) {
60
- const props = __props;
61
- const emit = __emit;
62
- const isExpanded = ref(props.modelValue);
63
- watch(() => props.modelValue, (newVal) => {
64
- isExpanded.value = newVal;
65
- });
66
- function changeExpand() {
67
- if (props.disabled) return;
68
- isExpanded.value = !isExpanded.value;
69
- emit("change", {
70
- value: isExpanded.value,
71
- status: props.status
72
- });
73
- emit("update:expanded", isExpanded.value);
74
- }
75
- const displayedContent = computed(() => {
76
- return props.status === "error" ? "思考过程中出现错误" : props.content;
77
- });
78
- watch(() => props.status, (newVal) => {
79
- if (newVal === "end" && props.autoCollapse) {
80
- isExpanded.value = false;
81
- }
82
- });
83
- return (_ctx, _cache) => {
84
- const _component_el_icon = ElIcon;
85
- return openBlock(), createElementBlock("div", {
86
- class: "el-thinking",
87
- style: normalizeStyle({
88
- "--el-thinking-button-width": props.buttonWidth,
89
- "--el-thinking-animation-duration": props.duration,
90
- "--el-thinking-content-wrapper-width": props.maxWidth,
91
- "--el-thinking-content-wrapper-background-color": props.backgroundColor,
92
- "--el-thinking-content-wrapper-color": props.color
93
- })
94
- }, [createElementVNode("button", {
95
- class: normalizeClass(["trigger", [_ctx.status, {
96
- disabled: !props.disabled
97
- }]]),
98
- disabled: props.disabled,
99
- onClick: changeExpand
100
- }, [createElementVNode("span", _hoisted_2, [renderSlot(_ctx.$slots, "status-icon", {
101
- status: props.status
102
- }, () => [_ctx.status === "thinking" ? (openBlock(), createBlock(_component_el_icon, {
103
- key: 0,
104
- class: "is-loading el-icon-center"
105
- }, {
106
- default: withCtx(() => [createVNode(unref(loading_default))]),
107
- _: 1
108
- })) : createCommentVNode("", true), _ctx.status === "start" ? (openBlock(), createBlock(_component_el_icon, {
109
- key: 1,
110
- class: "el-icon-center start-color"
111
- }, {
112
- default: withCtx(() => [createVNode(unref(opportunity_default))]),
113
- _: 1
114
- })) : createCommentVNode("", true), _ctx.status === "end" ? (openBlock(), createBlock(_component_el_icon, {
115
- key: 2,
116
- class: "el-icon-center end-color"
117
- }, {
118
- default: withCtx(() => [createVNode(unref(success_filled_default))]),
119
- _: 1
120
- })) : createCommentVNode("", true), _ctx.status === "error" ? (openBlock(), createBlock(_component_el_icon, {
121
- key: 3,
122
- class: "el-icon-center error-color"
123
- }, {
124
- default: withCtx(() => [createVNode(unref(circle_close_filled_default))]),
125
- _: 1
126
- })) : createCommentVNode("", true)], true)]), createElementVNode("span", _hoisted_3, [renderSlot(_ctx.$slots, "label", {
127
- status: props.status
128
- }, () => [createTextVNode(toDisplayString(_ctx.status === "thinking" ? "思考中..." : _ctx.status === "error" ? "思考遇到问题" : _ctx.status === "end" ? "思考完成" : "开始思考"), 1)], true)]), createVNode(Transition, {
129
- name: "rotate"
130
- }, {
131
- default: withCtx(() => [!props.disabled ? (openBlock(), createElementBlock("span", {
132
- key: 0,
133
- class: normalizeClass(["arrow el-icon-center", {
134
- expanded: unref(isExpanded)
135
- }])
136
- }, [renderSlot(_ctx.$slots, "arrow", {}, () => [createVNode(_component_el_icon, {
137
- class: "el-icon-center"
138
- }, {
139
- default: withCtx(() => [createVNode(unref(arrow_up_bold_default))]),
140
- _: 1
141
- })], true)], 2)) : createCommentVNode("", true)]),
142
- _: 3
143
- })], 10, _hoisted_1), createVNode(Transition, {
144
- name: "slide"
145
- }, {
146
- default: withCtx(() => [unref(displayedContent) ? withDirectives((openBlock(), createElementBlock("div", {
147
- key: 0,
148
- class: normalizeClass(["content-wrapper", {
149
- "error-state": _ctx.status === "error"
150
- }])
151
- }, [createElementVNode("div", _hoisted_4, [_ctx.status !== "error" ? renderSlot(_ctx.$slots, "content", {
152
- key: 0,
153
- content: unref(displayedContent)
154
- }, () => [createElementVNode("pre", null, toDisplayString(unref(displayedContent)), 1)], true) : renderSlot(_ctx.$slots, "error", {
155
- key: 1,
156
- errorContent: unref(displayedContent)
157
- }, () => [createElementVNode("div", _hoisted_5, toDisplayString(unref(displayedContent)), 1)], true)])], 2)), [[vShow, unref(isExpanded)]]) : createCommentVNode("", true)]),
158
- _: 3
159
- })], 4);
160
- };
161
- }
162
- });
163
- const Thinking = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-5eb92e73"]]);
4
+ import { Thinking, Typewriter } from 'vue-element-plus-x';
164
5
 
165
6
  var _sfc_main = /* @__PURE__ */ defineComponent({
166
7
  ...{
@@ -14,6 +14,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
14
14
  initRenderData: (emitSetData: any, props: any) => void;
15
15
  typed: (e: __VkBubbleList.Item) => __VkAgentChatProvider.BubbleItem;
16
16
  readonly VkBroadcastingMarkdown: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
17
+ render: {
18
+ type: PropType<(text: string) => string>;
19
+ default: typeof import("@vunk/plus/components/broadcasting-markdown").defaultRender;
20
+ };
17
21
  data: {
18
22
  type: {
19
23
  (arrayLength: number): __VkBroadcastingMarkdown.Paragraph[];
@@ -85,6 +89,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
85
89
  'update:completed': (_: boolean) => boolean;
86
90
  'update:error': (_: boolean) => boolean;
87
91
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
92
+ render: {
93
+ type: PropType<(text: string) => string>;
94
+ default: typeof import("@vunk/plus/components/broadcasting-markdown").defaultRender;
95
+ };
88
96
  data: {
89
97
  type: {
90
98
  (arrayLength: number): __VkBroadcastingMarkdown.Paragraph[];
@@ -152,6 +160,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
152
160
  source: string;
153
161
  delay: number;
154
162
  pause: boolean;
163
+ render: (text: string) => string;
155
164
  data: __VkBroadcastingMarkdown.Paragraph[];
156
165
  separators: string[];
157
166
  keepRead: boolean;
@@ -304,6 +313,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
304
313
  type: BooleanConstructor;
305
314
  default: boolean;
306
315
  };
316
+ render: {
317
+ type: PropType<(text: string) => string>;
318
+ required: true;
319
+ };
307
320
  }>, (() => null) | (() => false | JSX.Element), {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
308
321
  voice: {
309
322
  type: PropType<SpeechSynthesisVoice>;
@@ -321,6 +334,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
321
334
  type: BooleanConstructor;
322
335
  default: boolean;
323
336
  };
337
+ render: {
338
+ type: PropType<(text: string) => string>;
339
+ required: true;
340
+ };
324
341
  }>> & Readonly<{}>, {
325
342
  pause: boolean;
326
343
  data: __VkBroadcastingMarkdown.Paragraph;
@@ -402,6 +419,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
402
419
  type: StringConstructor;
403
420
  default: string;
404
421
  };
422
+ render: {
423
+ type: PropType<(text: string) => string>;
424
+ required: true;
425
+ };
405
426
  }>, (() => null) | (() => JSX.Element), {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
406
427
  data: {
407
428
  type: PropType<__VkBroadcastingMarkdown.Paragraph>;
@@ -419,6 +440,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
419
440
  type: StringConstructor;
420
441
  default: string;
421
442
  };
443
+ render: {
444
+ type: PropType<(text: string) => string>;
445
+ required: true;
446
+ };
422
447
  }>> & Readonly<{}>, {
423
448
  pause: boolean;
424
449
  data: __VkBroadcastingMarkdown.Paragraph;
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, computed, createElementBlock, openBlock, createElementVNode, createVNode, unref, withCtx, withDirectives, vShow, renderSlot, nextTick } from 'vue';
1
+ import { defineComponent, ref, computed, createElementBlock, openBlock, createElementVNode, createVNode, unref, withCtx, createCommentVNode, withDirectives, Fragment, vShow, renderSlot, nextTick } from 'vue';
2
2
  import { useAgentChat } from '@vunk/plus/components/agent-chat-provider';
3
3
  import { VkBubbleList } from '@vunk/plus/components/bubble-list';
4
4
  import { VkRecorderButton } from '@vunk/plus/components/recorder-button';
@@ -113,39 +113,47 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
113
113
  ]),
114
114
  two: withCtx(() => [
115
115
  createElementVNode("div", _hoisted_3, [
116
- withDirectives(createVNode(
117
- unref(VkKeyboardAvatar),
118
- {
119
- size: 40,
120
- onClick: _cache[0] || (_cache[0] = ($event) => inputType.value = unref(InputType).Text)
121
- },
122
- null,
123
- 512
124
- /* NEED_PATCH */
125
- ), [
126
- [vShow, inputType.value === unref(InputType).Voice]
127
- ]),
128
- withDirectives(createVNode(
129
- unref(VkVoiceAvatar),
130
- {
131
- size: 40,
132
- onClick: _cache[1] || (_cache[1] = ($event) => inputType.value = unref(InputType).Voice)
133
- },
134
- null,
135
- 512
136
- /* NEED_PATCH */
137
- ), [
138
- [vShow, inputType.value === unref(InputType).Text]
139
- ]),
140
- withDirectives(createVNode(unref(VkRecorderButton), {
141
- "append-to": mainRef.value,
142
- disabled: senderDisabled.value,
143
- "speech-to-text": _ctx.speechToText,
144
- "submit-to-text": true,
145
- onSubmitText: onSubmit
146
- }, null, 8, ["append-to", "disabled", "speech-to-text"]), [
147
- [vShow, inputType.value === unref(InputType).Voice]
148
- ]),
116
+ _ctx.speechToText ? (openBlock(), createElementBlock(
117
+ Fragment,
118
+ { key: 0 },
119
+ [
120
+ withDirectives(createVNode(
121
+ unref(VkKeyboardAvatar),
122
+ {
123
+ size: 40,
124
+ onClick: _cache[0] || (_cache[0] = ($event) => inputType.value = unref(InputType).Text)
125
+ },
126
+ null,
127
+ 512
128
+ /* NEED_PATCH */
129
+ ), [
130
+ [vShow, inputType.value === unref(InputType).Voice]
131
+ ]),
132
+ withDirectives(createVNode(unref(VkRecorderButton), {
133
+ "append-to": mainRef.value,
134
+ disabled: senderDisabled.value,
135
+ "speech-to-text": _ctx.speechToText,
136
+ "submit-to-text": true,
137
+ onSubmitText: onSubmit
138
+ }, null, 8, ["append-to", "disabled", "speech-to-text"]), [
139
+ [vShow, inputType.value === unref(InputType).Voice]
140
+ ]),
141
+ withDirectives(createVNode(
142
+ unref(VkVoiceAvatar),
143
+ {
144
+ size: 40,
145
+ onClick: _cache[1] || (_cache[1] = ($event) => inputType.value = unref(InputType).Voice)
146
+ },
147
+ null,
148
+ 512
149
+ /* NEED_PATCH */
150
+ ), [
151
+ [vShow, inputType.value === unref(InputType).Text]
152
+ ])
153
+ ],
154
+ 64
155
+ /* STABLE_FRAGMENT */
156
+ )) : createCommentVNode("v-if", true),
149
157
  withDirectives(createVNode(unref(VkSender), {
150
158
  modelValue: content.value,
151
159
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => content.value = $event),
@@ -93,6 +93,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
93
93
  initRenderData: (emitSetData: any, props: any) => void;
94
94
  typed: (e: import("../../agent-chat-provider/src/types").BubbleItem) => import("../../agent-chat-provider/src/types").BubbleItem;
95
95
  readonly VkBroadcastingMarkdown: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
96
+ render: {
97
+ type: import("vue").PropType<(text: string) => string>;
98
+ default: typeof import("../../broadcasting-markdown").defaultRender;
99
+ };
96
100
  data: {
97
101
  type: {
98
102
  (arrayLength: number): import("../../broadcasting-markdown/src/types").Paragraph[];
@@ -164,6 +168,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
164
168
  'update:completed': (_: boolean) => boolean;
165
169
  'update:error': (_: boolean) => boolean;
166
170
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
171
+ render: {
172
+ type: import("vue").PropType<(text: string) => string>;
173
+ default: typeof import("../../broadcasting-markdown").defaultRender;
174
+ };
167
175
  data: {
168
176
  type: {
169
177
  (arrayLength: number): import("../../broadcasting-markdown/src/types").Paragraph[];
@@ -231,6 +239,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
231
239
  source: string;
232
240
  delay: number;
233
241
  pause: boolean;
242
+ render: (text: string) => string;
234
243
  data: import("../../broadcasting-markdown/src/types").Paragraph[];
235
244
  separators: string[];
236
245
  keepRead: boolean;
@@ -383,6 +392,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
383
392
  type: BooleanConstructor;
384
393
  default: boolean;
385
394
  };
395
+ render: {
396
+ type: import("vue").PropType<(text: string) => string>;
397
+ required: true;
398
+ };
386
399
  }>, (() => null) | (() => false | JSX.Element), {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
387
400
  voice: {
388
401
  type: import("vue").PropType<SpeechSynthesisVoice>;
@@ -400,6 +413,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
400
413
  type: BooleanConstructor;
401
414
  default: boolean;
402
415
  };
416
+ render: {
417
+ type: import("vue").PropType<(text: string) => string>;
418
+ required: true;
419
+ };
403
420
  }>> & Readonly<{}>, {
404
421
  pause: boolean;
405
422
  data: import("../../broadcasting-markdown/src/types").Paragraph;
@@ -481,6 +498,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
481
498
  type: StringConstructor;
482
499
  default: string;
483
500
  };
501
+ render: {
502
+ type: import("vue").PropType<(text: string) => string>;
503
+ required: true;
504
+ };
484
505
  }>, (() => null) | (() => JSX.Element), {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
485
506
  data: {
486
507
  type: import("vue").PropType<import("../../broadcasting-markdown/src/types").Paragraph>;
@@ -498,6 +519,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
498
519
  type: StringConstructor;
499
520
  default: string;
500
521
  };
522
+ render: {
523
+ type: import("vue").PropType<(text: string) => string>;
524
+ required: true;
525
+ };
501
526
  }>> & Readonly<{}>, {
502
527
  pause: boolean;
503
528
  data: import("../../broadcasting-markdown/src/types").Paragraph;
@@ -2,7 +2,7 @@ import { noop, computedAsync, debouncedRef } from '@vueuse/core';
2
2
  import { noop as noop$1 } from '@vunk/shared/function';
3
3
  import { defineComponent, ref, computed, watch, createElementBlock, openBlock, normalizeClass } from 'vue';
4
4
  import { highlight } from '@vunk/shared/markdown/shiki';
5
- import markdownIt from 'markdown-it';
5
+ import MarkdownIt from 'markdown-it';
6
6
  import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
7
7
 
8
8
  const placeholder = (id, code) => `<pre><!--::markdown-it-async::${id}::--><code>${code}</code></pre>`;
@@ -10,7 +10,7 @@ const placeholderRe = /<pre><!--::markdown-it-async::(\w+)::--><code>[\s\S]*?<\/
10
10
  function randStr() {
11
11
  return Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2);
12
12
  }
13
- class MarkdownItAsync extends markdownIt {
13
+ class MarkdownItAsync extends MarkdownIt {
14
14
  placeholderMap;
15
15
  disableWarn = false;
16
16
  constructor(...args) {