@vunk/plus 1.12.2 → 1.13.1
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/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
- package/components/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
- package/components/agent-chat-provider/index.cjs +1 -0
- package/components/agent-chat-provider/index.mjs +113 -187
- package/components/agent-chat-provider/src/index.vue.d.ts +3 -2
- package/components/avatar/index.cjs +1 -0
- package/components/avatar/index.mjs +25 -31
- package/components/avatar/src/index.vue.d.ts +40 -39
- package/components/broadcasting-markdown/__tests__/const.test.d.ts +1 -0
- package/components/broadcasting-markdown/__tests__/utils.test.d.ts +1 -0
- package/components/broadcasting-markdown/index.cjs +5 -0
- package/components/broadcasting-markdown/index.mjs +346 -4376
- package/components/broadcasting-markdown/src/howler-speech.vue.d.ts +18 -24
- package/components/broadcasting-markdown/src/index.vue.d.ts +101 -51
- package/components/broadcasting-markdown/src/paragraph.vue.d.ts +17 -29
- package/components/broadcasting-markdown/src/speech-error.vue.d.ts +2 -59
- package/components/bubble-list/index.cjs +1 -0
- package/components/bubble-list/index.mjs +220 -302
- package/components/bubble-list/src/core/index.vue.d.ts +40 -885
- package/components/bubble-list/src/core/loading.vue.d.ts +3 -0
- package/components/bubble-list/src/index.vue.d.ts +29 -1321
- package/components/bubble-templates/index.cjs +1 -0
- package/components/bubble-templates/index.mjs +34 -49
- package/components/bubble-templates/src/index.vue.d.ts +3 -224
- package/components/chat-independent/index.cjs +1 -0
- package/components/chat-independent/index.mjs +105 -212
- package/components/chat-independent/src/index.vue.d.ts +20 -2712
- package/components/components.css +1 -0
- package/components/drawer/index.cjs +1 -0
- package/components/drawer/index.mjs +53 -94
- package/components/drawer/src/ctx.d.ts +22 -22
- package/components/drawer/src/index.vue.d.ts +84 -557
- package/components/index.cjs +1 -0
- package/components/index.d.ts +1 -0
- package/components/lottie-animation/index.cjs +1 -0
- package/components/lottie-animation/index.mjs +36 -55
- package/components/lottie-animation/src/index.vue.d.ts +3 -2
- package/components/metahuman-broadcasting/index.cjs +1 -0
- package/components/metahuman-broadcasting/index.mjs +89 -140
- package/components/metahuman-broadcasting/src/index.vue.d.ts +16 -718
- package/components/monaco-editor/index.cjs +1 -0
- package/components/monaco-editor/index.mjs +68 -95
- package/components/monaco-editor/src/index.vue.d.ts +3 -2
- package/components/monaco-environment/index.cjs +1 -0
- package/components/monaco-environment/index.mjs +23 -38
- package/components/monaco-environment/src/index.vue.d.ts +2 -1
- package/components/pixi-frame/index.cjs +1 -0
- package/components/pixi-frame/index.mjs +941 -1969
- package/components/pixi-frame/src/apng.vue.d.ts +17 -73
- package/components/pixi-frame/src/bitmap-generator.vue.d.ts +24 -66
- package/components/pixi-frame/src/bitmap.vue.d.ts +28 -80
- package/components/pixi-frame/src/buffer-image.vue.d.ts +29 -97
- package/components/pixi-frame/src/core.vue.d.ts +20 -75
- package/components/pixi-frame/src/index.vue.d.ts +302 -237
- package/components/pixi-frame/src/provider.vue.d.ts +12 -1
- package/components/pixi-frame/src/video.vue.d.ts +17 -71
- package/components/pixi-frame/src/view.vue.d.ts +4 -16
- package/components/recorder-button/index.cjs +1 -0
- package/components/recorder-button/index.mjs +140 -269
- package/components/recorder-button/src/index.vue.d.ts +67 -66
- package/components/routes-menu-content/index.cjs +1 -0
- package/components/routes-menu-content/index.mjs +150 -229
- package/components/routes-menu-content/src/index.vue.d.ts +27 -26
- package/components/routes-menu-content/src/item/core/index.vue.d.ts +27 -26
- package/components/routes-menu-content/src/item/index.vue.d.ts +27 -26
- package/components/scrollbar/index.cjs +1 -0
- package/components/scrollbar/index.mjs +288 -567
- package/components/scrollbar/src/bar.vue.d.ts +6 -133
- package/components/scrollbar/src/index.vue.d.ts +66 -337
- package/components/scrollbar/src/thumb.vue.d.ts +3 -80
- package/components/sender/index.cjs +1 -0
- package/components/sender/index.mjs +156 -285
- package/components/sender/src/SenderHeader.vue.d.ts +14 -221
- package/components/sender/src/index.vue.d.ts +16 -505
- package/components/speech-button/index.cjs +1 -0
- package/components/speech-button/index.mjs +98 -144
- package/components/speech-button/src/LoadingIcon.vue.d.ts +2 -1
- package/components/speech-button/src/RecordingIcon.vue.d.ts +2 -1
- package/components/speech-button/src/index.vue.d.ts +6 -5
- package/components/table-columns/index.cjs +1 -0
- package/components/table-columns/index.mjs +48 -78
- package/components/table-columns/src/ctx.d.ts +10 -10
- package/components/table-columns/src/el-ctx.d.ts +1 -1
- package/components/table-columns/src/index.vue.d.ts +24 -23
- package/components/tables-v1/index.cjs +1 -0
- package/components/tables-v1/index.mjs +99 -160
- package/components/tables-v1/src/ctx.d.ts +28 -28
- package/components/tables-v1/src/el-ctx.d.ts +2 -2
- package/components/tables-v1/src/index.vue.d.ts +88 -2243
- package/components/tables-v1-checkbox/index.cjs +98 -0
- package/components/tables-v1-checkbox/index.mjs +1594 -3735
- package/components/tables-v1-checkbox/src/ctx.d.ts +26 -26
- package/components/tables-v1-checkbox/src/index.vue.d.ts +176 -2330
- package/components/text/index.cjs +1 -0
- package/components/text/index.mjs +70 -108
- package/components/text/src/ctx.d.ts +31 -31
- package/components/text/src/index.vue.d.ts +92 -1819
- package/components/thinking/index.cjs +1 -0
- package/components/thinking/index.mjs +127 -227
- package/components/thinking/src/index.vue.d.ts +22 -2044
- package/components/typing-markdown/index.cjs +1 -0
- package/components/typing-markdown/index.mjs +61 -201
- package/components/typing-markdown/src/index.vue.d.ts +3 -2
- package/components/vditor/index.cjs +1 -0
- package/components/vditor/index.mjs +121 -195
- package/components/vditor/src/ctx.d.ts +2 -2
- package/components/vditor/src/handle-fullscreen.vue.d.ts +3 -2
- package/components/vditor/src/handle-value.vue.d.ts +3 -2
- package/components/vditor/src/index.vue.d.ts +5 -4
- package/components/xgplayer/index.cjs +1 -0
- package/components/xgplayer/index.mjs +49 -90
- package/components/xgplayer/src/core.vue.d.ts +13 -18
- package/components/xgplayer/src/index.vue.d.ts +13 -67
- package/composables/el-breakpoints/index.cjs +1 -0
- package/composables/el-breakpoints/index.d.ts +10 -10
- package/composables/el-breakpoints/index.mjs +10 -12
- package/composables/index.cjs +1 -0
- package/composables/index.d.ts +1 -0
- package/composables/recorder/index.cjs +1 -0
- package/composables/recorder/index.mjs +9172 -14803
- package/element/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
- package/element/bubble/index.cjs +3 -0
- package/element/bubble/index.d.ts +1 -1
- package/element/bubble/index.mjs +1 -1
- package/element/bubble/src/index.vue.d.ts +22 -22
- package/element/index.css +1 -1
- package/element/thinking/index.cjs +1 -0
- package/element/thinking/index.d.ts +1 -1
- package/element/thinking/index.mjs +1 -1
- package/element/thinking/src/index.vue.d.ts +26 -26
- package/element/thinking/src/types.d.ts +10 -0
- package/icons/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
- package/icons/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
- package/icons/end/index.cjs +1 -0
- package/icons/end/index.mjs +21 -26
- package/icons/end/src/index.vue.d.ts +3 -0
- package/icons/keyboard/index.cjs +1 -0
- package/icons/keyboard/index.mjs +21 -26
- package/icons/keyboard/src/index.vue.d.ts +3 -0
- package/icons/start/index.cjs +1 -0
- package/icons/start/index.mjs +21 -26
- package/icons/start/src/index.vue.d.ts +3 -0
- package/icons/voice/index.cjs +1 -0
- package/icons/voice/index.mjs +26 -44
- package/icons/voice/src/index.vue.d.ts +2 -3
- package/index.css +2 -558
- package/index.d.ts +1 -0
- package/package.json +78 -87
- package/shared/data/index.cjs +1 -0
- package/shared/data/index.mjs +16 -22
- package/shared/types/index.cjs +1 -0
- package/shared/types/index.d.ts +1 -0
- package/components/LinkOutlined.mjs +0 -1321
- package/components/_commonjsHelpers.mjs +0 -7
- package/components/_plugin-vue_export-helper.mjs +0 -9
- package/components/bubble-list/index.css +0 -70
- package/components/bubble-templates/index.css +0 -4
- package/components/chat-independent/index.css +0 -47
- package/components/drawer/index.css +0 -124
- package/components/index2.mjs +0 -78
- package/components/lottie-animation/index.css +0 -4
- package/components/monaco-editor/index.css +0 -4
- package/components/pixi-frame/index.css +0 -4
- package/components/recorder-button/index.css +0 -69
- package/components/sender/index.css +0 -22
- package/components/speech-button/index.css +0 -10
- package/components/tables-v1/index.css +0 -7
- package/components/tables-v1-checkbox/index.css +0 -8
- package/components/thinking/index.css +0 -125
- package/components/typing-markdown/index.css +0 -31
- package/components/vditor/index.css +0 -12
- package/components/xgplayer/index.css +0 -1
- package/icons/_plugin-vue_export-helper.mjs +0 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@vueuse/core"),h=require("@vunk/core/composables"),y=require("@vunk/shared/function"),t=require("vue"),k=require("@vunk/shared/markdown/shiki"),m=require("markdown-it-async"),p=require("../_plugin-vue_export-helper-BHFhmbuH.js"),b=k.highlight({dark:"github-dark",light:"github-light"},{},{warn:c.noop});async function _(){const[e]=await b,a=m({highlight:e});return a.core.ruler.after("inline","add-is-last-class",n=>{const o=n.tokens;let s=-1;for(let i=o.length-1;i>=0;i--){const r=o[i];if(r.nesting===1&&!r.hidden){s=i;break}}s!==-1&&o[s].attrSet("class","is-last")}),a}const w=_(),T={source:{type:String,default:""},delay:{type:Number,default:60},pause:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},markdownItSetup:{type:Function,default:null},finished:{type:Boolean},loading:{type:Boolean,default:!1}},v={typing:null,"update:finished":null},M=t.defineComponent({name:"VkTypingMarkdown",props:T,emits:v,setup(e,{emit:a}){const n=t.ref(0),o=t.computed(()=>e.disabled?e.source:e.source.substring(0,n.value)),s=w.then(l=>(e.markdownItSetup?.(l),l)),i=c.computedAsync(async()=>(y.noop(o.value),(await s).render(o.value)),""),r=t.computed(()=>!e.pause&&!e.disabled&&n.value!==e.source.length),g=c.debouncedRef(r,100),f=h.useModelComputed({default:!1,key:"finished"},e,a);function d(){e.pause||e.disabled||e.source.length===0||(n.value<e.source.length?(n.value++,a("typing"),setTimeout(d,e.delay)):f.value=!0)}return t.watch(()=>e.pause||e.disabled,l=>{l||d()},{flush:"post",immediate:!0}),t.watch(()=>n.value<e.source.length,()=>{f.value=!1,d()}),{htmlText:i,isDebouncedTyping:g}}}),I=["innerHTML"];function S(e,a,n,o,s,i){return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["vk-typing-markdown",{"is-typing":e.isDebouncedTyping,"is-loading":e.loading}]),innerHTML:e.htmlText},null,10,I)}const u=p._export_sfc(M,[["render",S]]),q=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));u.install=e=>{e.component(u.name||"VkTypingMarkdown",u)};exports.VkTypingMarkdown=u;exports.__VkTypingMarkdown=q;exports.default=u;
|
|
@@ -1,135 +1,34 @@
|
|
|
1
|
-
import { noop, computedAsync, debouncedRef } from
|
|
2
|
-
import { useModelComputed } from
|
|
3
|
-
import { noop as
|
|
4
|
-
import { defineComponent, ref, computed, watch
|
|
5
|
-
import { highlight } from
|
|
6
|
-
import
|
|
7
|
-
import { _ as
|
|
8
|
-
|
|
9
|
-
const placeholder = (id, code) => `<pre><!--::markdown-it-async::${id}::--><code>${code}</code></pre>`;
|
|
10
|
-
const placeholderRe = /<pre><!--::markdown-it-async::(\w+)::--><code>[\s\S]*?<\/code><\/pre>/g;
|
|
11
|
-
function randStr() {
|
|
12
|
-
return Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2);
|
|
13
|
-
}
|
|
14
|
-
class MarkdownItAsync extends MarkdownIt {
|
|
15
|
-
placeholderMap;
|
|
16
|
-
disableWarn = false;
|
|
17
|
-
constructor(...args) {
|
|
18
|
-
const map = /* @__PURE__ */ new Map();
|
|
19
|
-
const options = args.length === 2 ? args[1] : args[0];
|
|
20
|
-
if (options && "highlight" in options)
|
|
21
|
-
options.highlight = wrapHightlight(options.highlight, map);
|
|
22
|
-
super(...args);
|
|
23
|
-
this.placeholderMap = map;
|
|
24
|
-
}
|
|
25
|
-
// implementation
|
|
26
|
-
use(plugin, ...params) {
|
|
27
|
-
return super.use(plugin, ...params);
|
|
28
|
-
}
|
|
29
|
-
render(src, env) {
|
|
30
|
-
if (this.options.warnOnSyncRender && !this.disableWarn) {
|
|
31
|
-
console.warn("[markdown-it-async] Please use `md.renderAsync` instead of `md.render`");
|
|
32
|
-
}
|
|
33
|
-
return super.render(src, env);
|
|
34
|
-
}
|
|
35
|
-
async renderAsync(src, env) {
|
|
36
|
-
this.options.highlight = wrapHightlight(this.options.highlight, this.placeholderMap);
|
|
37
|
-
this.disableWarn = true;
|
|
38
|
-
const result = this.render(src, env);
|
|
39
|
-
this.disableWarn = false;
|
|
40
|
-
return replaceAsync(result, placeholderRe, async (match, id) => {
|
|
41
|
-
if (!this.placeholderMap.has(id))
|
|
42
|
-
throw new Error(`Unknown highlight placeholder id: ${id}`);
|
|
43
|
-
const [promise, _str, lang, _attrs] = this.placeholderMap.get(id);
|
|
44
|
-
const result2 = await promise || "";
|
|
45
|
-
this.placeholderMap.delete(id);
|
|
46
|
-
if (result2.startsWith("<pre"))
|
|
47
|
-
return result2;
|
|
48
|
-
else
|
|
49
|
-
return `<pre><code class="language-${lang}">${result2}</code></pre>`;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function createMarkdownItAsync(...args) {
|
|
54
|
-
return new MarkdownItAsync(...args);
|
|
55
|
-
}
|
|
56
|
-
function replaceAsync(string, searchValue, replacer) {
|
|
57
|
-
try {
|
|
58
|
-
if (typeof replacer === "function") {
|
|
59
|
-
const values = [];
|
|
60
|
-
String.prototype.replace.call(string, searchValue, (...args) => {
|
|
61
|
-
values.push(replacer(...args));
|
|
62
|
-
return "";
|
|
63
|
-
});
|
|
64
|
-
return Promise.all(values).then((resolvedValues) => {
|
|
65
|
-
return String.prototype.replace.call(string, searchValue, () => {
|
|
66
|
-
return resolvedValues.shift() || "";
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
} else {
|
|
70
|
-
return Promise.resolve(
|
|
71
|
-
String.prototype.replace.call(string, searchValue, replacer)
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
} catch (error) {
|
|
75
|
-
return Promise.reject(error);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const wrappedSet = /* @__PURE__ */ new WeakSet();
|
|
79
|
-
function escapeHtml(unsafe) {
|
|
80
|
-
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
81
|
-
}
|
|
82
|
-
function wrapHightlight(highlight, map) {
|
|
83
|
-
if (!highlight)
|
|
84
|
-
return void 0;
|
|
85
|
-
if (wrappedSet.has(highlight))
|
|
86
|
-
return highlight;
|
|
87
|
-
const wrapped = (str, lang, attrs) => {
|
|
88
|
-
const promise = highlight(str, lang, attrs);
|
|
89
|
-
if (typeof promise === "string")
|
|
90
|
-
return promise;
|
|
91
|
-
const id = randStr();
|
|
92
|
-
map.set(id, [promise, str, lang, attrs]);
|
|
93
|
-
let code = str;
|
|
94
|
-
if (code.endsWith("\n"))
|
|
95
|
-
code = code.slice(0, -1);
|
|
96
|
-
code = escapeHtml(code);
|
|
97
|
-
return placeholder(id, code);
|
|
98
|
-
};
|
|
99
|
-
wrappedSet.add(wrapped);
|
|
100
|
-
return wrapped;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const highlightInfo = highlight({
|
|
1
|
+
import { noop as g, computedAsync as h, debouncedRef as y } from "@vueuse/core";
|
|
2
|
+
import { useModelComputed as k } from "@vunk/core/composables";
|
|
3
|
+
import { noop as p } from "@vunk/shared/function";
|
|
4
|
+
import { defineComponent as b, ref as w, computed as c, watch as f, createElementBlock as T, openBlock as _, normalizeClass as v } from "vue";
|
|
5
|
+
import { highlight as M } from "@vunk/shared/markdown/shiki";
|
|
6
|
+
import I from "markdown-it-async";
|
|
7
|
+
import { _ as B } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
8
|
+
const S = M({
|
|
104
9
|
dark: "github-dark",
|
|
105
10
|
light: "github-light"
|
|
106
11
|
}, {}, {
|
|
107
|
-
warn:
|
|
12
|
+
warn: g
|
|
108
13
|
});
|
|
109
|
-
async function
|
|
110
|
-
const [
|
|
111
|
-
|
|
112
|
-
highlight
|
|
14
|
+
async function x() {
|
|
15
|
+
const [e] = await S, a = I({
|
|
16
|
+
highlight: e
|
|
113
17
|
});
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
let
|
|
117
|
-
for (let
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
120
|
-
|
|
18
|
+
return a.core.ruler.after("inline", "add-is-last-class", (t) => {
|
|
19
|
+
const n = t.tokens;
|
|
20
|
+
let i = -1;
|
|
21
|
+
for (let o = n.length - 1; o >= 0; o--) {
|
|
22
|
+
const s = n[o];
|
|
23
|
+
if (s.nesting === 1 && !s.hidden) {
|
|
24
|
+
i = o;
|
|
121
25
|
break;
|
|
122
26
|
}
|
|
123
27
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
return md;
|
|
28
|
+
i !== -1 && n[i].attrSet("class", "is-last");
|
|
29
|
+
}), a;
|
|
129
30
|
}
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
const props = {
|
|
31
|
+
const $ = x(), V = {
|
|
133
32
|
source: {
|
|
134
33
|
type: String,
|
|
135
34
|
default: ""
|
|
@@ -141,14 +40,14 @@ const props = {
|
|
|
141
40
|
// 暂停
|
|
142
41
|
pause: {
|
|
143
42
|
type: Boolean,
|
|
144
|
-
default:
|
|
43
|
+
default: !1
|
|
145
44
|
},
|
|
146
45
|
/**
|
|
147
46
|
* 禁用typing
|
|
148
47
|
*/
|
|
149
48
|
disabled: {
|
|
150
49
|
type: Boolean,
|
|
151
|
-
default:
|
|
50
|
+
default: !1
|
|
152
51
|
},
|
|
153
52
|
/**
|
|
154
53
|
* @description markdown-it 配置
|
|
@@ -162,92 +61,53 @@ const props = {
|
|
|
162
61
|
},
|
|
163
62
|
loading: {
|
|
164
63
|
type: Boolean,
|
|
165
|
-
default:
|
|
64
|
+
default: !1
|
|
166
65
|
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
"typing": null,
|
|
66
|
+
}, C = {
|
|
67
|
+
typing: null,
|
|
170
68
|
"update:finished": null
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
var _sfc_main = defineComponent({
|
|
69
|
+
}, j = b({
|
|
174
70
|
name: "VkTypingMarkdown",
|
|
175
|
-
props,
|
|
176
|
-
emits,
|
|
177
|
-
setup(
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
if (props2.disabled) {
|
|
181
|
-
return props2.source;
|
|
182
|
-
}
|
|
183
|
-
return props2.source.substring(0, currentIndex.value);
|
|
184
|
-
});
|
|
185
|
-
const theMarkdownIt = markdownItPromise.then((md) => {
|
|
186
|
-
props2.markdownItSetup?.(md);
|
|
187
|
-
return md;
|
|
188
|
-
});
|
|
189
|
-
const htmlText = computedAsync(async () => {
|
|
190
|
-
noop$1(currentText.value);
|
|
191
|
-
const md = await theMarkdownIt;
|
|
192
|
-
return md.render(currentText.value);
|
|
193
|
-
}, "");
|
|
194
|
-
const isTyping = computed(() => {
|
|
195
|
-
return !props2.pause && !props2.disabled && currentIndex.value !== props2.source.length;
|
|
196
|
-
});
|
|
197
|
-
const isDebouncedTyping = debouncedRef(isTyping, 100);
|
|
198
|
-
const isFinished = useModelComputed({
|
|
199
|
-
default: false,
|
|
71
|
+
props: V,
|
|
72
|
+
emits: C,
|
|
73
|
+
setup(e, { emit: a }) {
|
|
74
|
+
const t = w(0), n = c(() => e.disabled ? e.source : e.source.substring(0, t.value)), i = $.then((l) => (e.markdownItSetup?.(l), l)), o = h(async () => (p(n.value), (await i).render(n.value)), ""), s = c(() => !e.pause && !e.disabled && t.value !== e.source.length), m = y(s, 100), d = k({
|
|
75
|
+
default: !1,
|
|
200
76
|
key: "finished"
|
|
201
|
-
},
|
|
202
|
-
function
|
|
203
|
-
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
if (currentIndex.value < props2.source.length) {
|
|
207
|
-
currentIndex.value++;
|
|
208
|
-
emit("typing");
|
|
209
|
-
setTimeout(typeWriter, props2.delay);
|
|
210
|
-
} else {
|
|
211
|
-
isFinished.value = true;
|
|
212
|
-
}
|
|
77
|
+
}, e, a);
|
|
78
|
+
function r() {
|
|
79
|
+
e.pause || e.disabled || e.source.length === 0 || (t.value < e.source.length ? (t.value++, a("typing"), setTimeout(r, e.delay)) : d.value = !0);
|
|
213
80
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
typeWriter();
|
|
217
|
-
}
|
|
81
|
+
return f(() => e.pause || e.disabled, (l) => {
|
|
82
|
+
l || r();
|
|
218
83
|
}, {
|
|
219
84
|
flush: "post",
|
|
220
|
-
immediate:
|
|
221
|
-
})
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return {
|
|
227
|
-
htmlText,
|
|
228
|
-
isDebouncedTyping
|
|
85
|
+
immediate: !0
|
|
86
|
+
}), f(() => t.value < e.source.length, () => {
|
|
87
|
+
d.value = !1, r();
|
|
88
|
+
}), {
|
|
89
|
+
htmlText: o,
|
|
90
|
+
isDebouncedTyping: m
|
|
229
91
|
};
|
|
230
92
|
}
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
"is-typing": _ctx.isDebouncedTyping,
|
|
238
|
-
"is-loading": _ctx.loading
|
|
93
|
+
}), z = ["innerHTML"];
|
|
94
|
+
function A(e, a, t, n, i, o) {
|
|
95
|
+
return _(), T("div", {
|
|
96
|
+
class: v(["vk-typing-markdown", {
|
|
97
|
+
"is-typing": e.isDebouncedTyping,
|
|
98
|
+
"is-loading": e.loading
|
|
239
99
|
}]),
|
|
240
|
-
innerHTML:
|
|
241
|
-
}, null, 10,
|
|
100
|
+
innerHTML: e.htmlText
|
|
101
|
+
}, null, 10, z);
|
|
242
102
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
var types = /*#__PURE__*/Object.freeze({
|
|
103
|
+
const u = /* @__PURE__ */ B(j, [["render", A]]), N = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
246
104
|
__proto__: null
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
105
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
106
|
+
u.install = (e) => {
|
|
107
|
+
e.component(u.name || "VkTypingMarkdown", u);
|
|
108
|
+
};
|
|
109
|
+
export {
|
|
110
|
+
u as VkTypingMarkdown,
|
|
111
|
+
N as __VkTypingMarkdown,
|
|
112
|
+
u as default
|
|
251
113
|
};
|
|
252
|
-
|
|
253
|
-
export { VkTypingMarkdown, types as __VkTypingMarkdown, VkTypingMarkdown as default };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
4
|
source: {
|
|
3
5
|
type: StringConstructor;
|
|
4
6
|
default: string;
|
|
@@ -72,4 +74,3 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
72
74
|
markdownItSetup: (md: import("markdown-it-async").MarkdownItAsync) => void;
|
|
73
75
|
finished: boolean;
|
|
74
76
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
75
|
-
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const k=require("vditor"),p=require("@vunk/core/shared/utils-vue"),t=require("vue"),y=require("mitt"),V=require("@vueuse/core"),b=require("@vunk/core"),_=require("../_plugin-vue_export-helper-BHFhmbuH.js"),C=["headings","bold","italic","strike","link","|","list","ordered-list","outdent","indent","|","line","code","inline-code","insert-before","insert-after","|","table","|","undo","redo","|","fullscreen","outline","export","|"],f={modelValue:{type:String,default:""},defaultOptions:{type:Object,default:()=>({})},placeholder:{type:String,default:"Crtl + Enter 发送; Enter 换行"},toolbar:{type:Array,default:()=>C},fullscreen:{type:Boolean,default:!1}},O=p.bindPropsFactory(f),m={load:e=>e,"update:modelValue":e=>e,ctrlEnter:e=>e,"update:fullscreen":e=>e},E=p.onEmitsFactory(m),h=Object.freeze(Object.defineProperty({__proto__:null,createBindProps:O,createOnEmits:E,emits:m,props:f},Symbol.toStringTag,{value:"Module"})),v=()=>{const e=t.inject("vkVditorRef",null);if(!e)throw new Error("useVditor must be used after VditorProvider");return t.unref(e)},g=()=>{const e=t.inject("vkVditorMitter",null);if(!e)throw new Error("useVditorMitter must be used after VditorProvider");return e},w=t.defineComponent({props:{modelValue:{type:String,default:""}},emits:{"update:modelValue":null},setup(e,{emit:o}){const u=v(),s=g();e.modelValue&&u.setValue(e.modelValue,!0);const{pause:n,resume:a}=V.watchPausable(()=>e.modelValue,r=>{u.setValue(r,!0)});return s.on("input",r=>{n(),o("update:modelValue",r),t.nextTick(a)}),()=>null}}),B=t.defineComponent({props:{fullscreen:{type:Boolean,default:!1}},emits:{"update:fullscreen":null},setup(e,{emit:o}){const u=v(),s=u.vditor.element,n=t.ref(!1);return V.useMutationObserver(s,()=>{s.classList.contains("vditor--fullscreen")?n.value=!0:n.value=!1},{attributes:!0}),t.watch(()=>e.fullscreen,a=>{if(a!==n.value){const r=u.vditor.ir?.element;if(!r)return;r.dispatchEvent(new KeyboardEvent("keydown",{key:"'",ctrlKey:!0}))}},{immediate:!0}),t.watch(()=>n.value,a=>{o("update:fullscreen",a)}),()=>null}}),S=t.defineComponent({name:"VkVditor",components:{HandleValue:w,HandleFullscreen:B,VkAsyncTeleport:b.VkAsyncTeleport},props:f,emits:m,setup(e,{emit:o}){const u=t.ref(),s=t.ref(!1),n=y(),a=t.shallowRef(),r=t.ref(!1);return t.provide("vkVditorMitter",n),t.provide("vkVditorRef",a),t.onMounted(()=>{const i=new k(u.value,{...e.defaultOptions,placeholder:e.placeholder,cache:{enable:!0,id:"VkVditorCache",...e.defaultOptions.cache||{}},after(){a.value=i,s.value=!0,o("load",i),e.defaultOptions.after?.()},input(l){n.emit("input",l),e.defaultOptions.input?.(l)},ctrlEnter(l){o("update:modelValue",l),o("ctrlEnter",l)},focus(l){r.value=!0,e.defaultOptions.focus?.(l)},blur(l){r.value=!1,e.defaultOptions.blur?.(l)},toolbar:e.toolbar})}),{vditorNode:u,isTextareaFocus:r,ready:s}}}),T={ref:"vditorNode",class:"vkf-vditor"};function $(e,o,u,s,n,a){const r=t.resolveComponent("VkAsyncTeleport"),i=t.resolveComponent("HandleValue"),l=t.resolveComponent("HandleFullscreen");return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",T,null,512),e.ready?(t.openBlock(),t.createBlock(r,{key:0,to:e.vditorNode},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["vkf-vditor-footer",{"is-textarea-focus":e.isTextareaFocus}])},[t.renderSlot(e.$slots,"footer")],2)]),_:3},8,["to"])):t.createCommentVNode("",!0),e.ready?(t.openBlock(),t.createBlock(i,{key:1,"model-value":e.modelValue,"onUpdate:modelValue":o[0]||(o[0]=c=>e.$emit("update:modelValue",c))},null,8,["model-value"])):t.createCommentVNode("",!0),e.ready?(t.openBlock(),t.createBlock(l,{key:2,fullscreen:e.fullscreen,"onUpdate:fullscreen":o[1]||(o[1]=c=>e.$emit("update:fullscreen",c))},null,8,["fullscreen"])):t.createCommentVNode("",!0),e.ready?t.renderSlot(e.$slots,"default",{key:3}):t.createCommentVNode("",!0)],64)}const d=_._export_sfc(S,[["render",$]]),M=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));d.install=e=>{e.component(d.name||"VkVditor",d)};exports.VkVditor=d;exports._VkVditorCtx=h;exports.__VkVditor=M;exports.default=d;
|