@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 y=require("@vueuse/core"),g=require("monaco-editor"),e=require("vue"),m=require("@vunk/core/shared/utils-vue"),h=require("../_plugin-vue_export-helper-BHFhmbuH.js"),u={modelValue:{type:String,default:""},defaultOptions:{type:Object,default:()=>({})},readOnly:{type:Boolean,default:!1},autoHeight:{type:Boolean,default:!1}},v=m.bindPropsFactory(u),c={"update:modelValue":null,load:o=>!0},b=m.onEmitsFactory(c),O=Object.freeze(Object.defineProperty({__proto__:null,createBindProps:v,createOnEmits:b,emits:c,props:u},Symbol.toStringTag,{value:"Module"})),V=e.defineComponent({name:"VkMonacoEditor",props:u,emits:c,setup(o,{emit:l}){const a=e.ref(),n=e.ref(""),s=e.computed(()=>{if(!(!o.autoHeight||!n.value))return{height:n.value}});return e.onMounted(()=>{const t=g.editor.create(a.value,o.defaultOptions);l("load",t);function d(){if(!o.autoHeight)return;const i=`${Math.ceil(t.getContentHeight())}px`;n.value!==i&&(n.value=i,e.nextTick(()=>{t.layout()}))}const f=y.watchPausable(()=>o.modelValue,i=>{t.setValue(i)},{immediate:!0});t.onDidChangeModelContent(()=>{f.pause(),l("update:modelValue",t.getValue()),e.nextTick(()=>{f.resume()})});const _=t.onDidContentSizeChange(d);e.watchEffect(d),e.watchEffect(()=>{t.updateOptions({readOnly:o.readOnly})});const p=new ResizeObserver(()=>{t.layout()});p.observe(a.value),e.onBeforeUnmount(()=>{_.dispose(),p.disconnect(),t.dispose()})}),{editorNode:a,editorStyle:s}}});function M(o,l,a,n,s,t){return e.openBlock(),e.createElementBlock("div",{ref:"editorNode",class:"vk-monaco-editor",style:e.normalizeStyle(o.editorStyle)},null,4)}const r=h._export_sfc(V,[["render",M]]),E=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));r.install=o=>{o.component(r.name||"VkMonacoEditor",r)};exports.VkMonacoEditor=r;exports._VkMonacoEditorCtx=O;exports.__VkMonacoEditor=E;exports.default=r;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { watchPausable } from
|
|
2
|
-
import { editor } from
|
|
3
|
-
import { defineComponent, ref, computed, onMounted, nextTick, watchEffect, onBeforeUnmount
|
|
4
|
-
import { bindPropsFactory, onEmitsFactory } from
|
|
5
|
-
import { _ as
|
|
6
|
-
|
|
7
|
-
const props = {
|
|
1
|
+
import { watchPausable as g } from "@vueuse/core";
|
|
2
|
+
import { editor as h } from "monaco-editor";
|
|
3
|
+
import { defineComponent as b, ref as p, computed as v, onMounted as O, nextTick as m, watchEffect as y, onBeforeUnmount as V, createElementBlock as M, openBlock as S, normalizeStyle as k } from "vue";
|
|
4
|
+
import { bindPropsFactory as E, onEmitsFactory as x } from "@vunk/core/shared/utils-vue";
|
|
5
|
+
import { _ as z } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
6
|
+
const i = {
|
|
8
7
|
modelValue: {
|
|
9
8
|
type: String,
|
|
10
9
|
default: ""
|
|
@@ -15,117 +14,91 @@ const props = {
|
|
|
15
14
|
},
|
|
16
15
|
readOnly: {
|
|
17
16
|
type: Boolean,
|
|
18
|
-
default:
|
|
17
|
+
default: !1
|
|
19
18
|
},
|
|
20
19
|
autoHeight: {
|
|
21
20
|
type: Boolean,
|
|
22
|
-
default:
|
|
21
|
+
default: !1
|
|
23
22
|
}
|
|
24
|
-
}
|
|
25
|
-
const createBindProps = bindPropsFactory(props);
|
|
26
|
-
const emits = {
|
|
23
|
+
}, C = E(i), c = {
|
|
27
24
|
"update:modelValue": null,
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
const createOnEmits = onEmitsFactory(emits);
|
|
31
|
-
|
|
32
|
-
var ctx = /*#__PURE__*/Object.freeze({
|
|
25
|
+
load: (t) => !0
|
|
26
|
+
}, H = x(c), F = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
33
27
|
__proto__: null,
|
|
34
|
-
createBindProps:
|
|
35
|
-
createOnEmits:
|
|
36
|
-
emits:
|
|
37
|
-
props:
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
var _sfc_main = defineComponent({
|
|
28
|
+
createBindProps: C,
|
|
29
|
+
createOnEmits: H,
|
|
30
|
+
emits: c,
|
|
31
|
+
props: i
|
|
32
|
+
}, Symbol.toStringTag, { value: "Module" })), j = b({
|
|
41
33
|
name: "VkMonacoEditor",
|
|
42
|
-
props,
|
|
43
|
-
emits,
|
|
44
|
-
setup(
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
height: autoHeight.value
|
|
52
|
-
};
|
|
34
|
+
props: i,
|
|
35
|
+
emits: c,
|
|
36
|
+
setup(t, { emit: r }) {
|
|
37
|
+
const n = p(), o = p(""), s = v(() => {
|
|
38
|
+
if (!(!t.autoHeight || !o.value))
|
|
39
|
+
return {
|
|
40
|
+
height: o.value
|
|
41
|
+
};
|
|
53
42
|
});
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
function
|
|
58
|
-
if (!
|
|
59
|
-
return;
|
|
60
|
-
const nextHeight = `${Math.ceil(editor$1.getContentHeight())}px`;
|
|
61
|
-
if (autoHeight.value === nextHeight)
|
|
43
|
+
return O(() => {
|
|
44
|
+
const e = h.create(n.value, t.defaultOptions);
|
|
45
|
+
r("load", e);
|
|
46
|
+
function u() {
|
|
47
|
+
if (!t.autoHeight)
|
|
62
48
|
return;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
});
|
|
49
|
+
const a = `${Math.ceil(e.getContentHeight())}px`;
|
|
50
|
+
o.value !== a && (o.value = a, m(() => {
|
|
51
|
+
e.layout();
|
|
52
|
+
}));
|
|
67
53
|
}
|
|
68
|
-
const
|
|
69
|
-
() =>
|
|
70
|
-
(
|
|
71
|
-
|
|
54
|
+
const d = g(
|
|
55
|
+
() => t.modelValue,
|
|
56
|
+
(a) => {
|
|
57
|
+
e.setValue(a);
|
|
72
58
|
},
|
|
73
59
|
{
|
|
74
|
-
immediate:
|
|
60
|
+
immediate: !0
|
|
75
61
|
}
|
|
76
62
|
);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
nextTick(() => {
|
|
81
|
-
subjectModelValueWatcher.resume();
|
|
63
|
+
e.onDidChangeModelContent(() => {
|
|
64
|
+
d.pause(), r("update:modelValue", e.getValue()), m(() => {
|
|
65
|
+
d.resume();
|
|
82
66
|
});
|
|
83
67
|
});
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
readOnly: props2.readOnly
|
|
68
|
+
const _ = e.onDidContentSizeChange(u);
|
|
69
|
+
y(u), y(() => {
|
|
70
|
+
e.updateOptions({
|
|
71
|
+
readOnly: t.readOnly
|
|
89
72
|
});
|
|
90
73
|
});
|
|
91
|
-
const
|
|
92
|
-
|
|
74
|
+
const f = new ResizeObserver(() => {
|
|
75
|
+
e.layout();
|
|
93
76
|
});
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
contentSizeDisposable.dispose();
|
|
97
|
-
resizeObserver.disconnect();
|
|
98
|
-
editor$1.dispose();
|
|
77
|
+
f.observe(n.value), V(() => {
|
|
78
|
+
_.dispose(), f.disconnect(), e.dispose();
|
|
99
79
|
});
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
editorStyle
|
|
80
|
+
}), {
|
|
81
|
+
editorNode: n,
|
|
82
|
+
editorStyle: s
|
|
104
83
|
};
|
|
105
84
|
}
|
|
106
85
|
});
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
class: "vk-monaco-editor",
|
|
114
|
-
style: normalizeStyle(_ctx.editorStyle)
|
|
115
|
-
},
|
|
116
|
-
null,
|
|
117
|
-
4
|
|
118
|
-
/* STYLE */
|
|
119
|
-
);
|
|
86
|
+
function B(t, r, n, o, s, e) {
|
|
87
|
+
return S(), M("div", {
|
|
88
|
+
ref: "editorNode",
|
|
89
|
+
class: "vk-monaco-editor",
|
|
90
|
+
style: k(t.editorStyle)
|
|
91
|
+
}, null, 4);
|
|
120
92
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
var types = /*#__PURE__*/Object.freeze({
|
|
93
|
+
const l = /* @__PURE__ */ z(j, [["render", B]]), N = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
124
94
|
__proto__: null
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
95
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
96
|
+
l.install = (t) => {
|
|
97
|
+
t.component(l.name || "VkMonacoEditor", l);
|
|
98
|
+
};
|
|
99
|
+
export {
|
|
100
|
+
l as VkMonacoEditor,
|
|
101
|
+
F as _VkMonacoEditorCtx,
|
|
102
|
+
N as __VkMonacoEditor,
|
|
103
|
+
l as default
|
|
129
104
|
};
|
|
130
|
-
|
|
131
|
-
export { VkMonacoEditor, ctx as _VkMonacoEditorCtx, types as __VkMonacoEditor, VkMonacoEditor as default };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Ref } from 'vue';
|
|
2
2
|
import { editor as mEditor } from 'monaco-editor';
|
|
3
|
-
declare const _default:
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
6
|
modelValue: {
|
|
5
7
|
type: StringConstructor;
|
|
6
8
|
default: string;
|
|
@@ -51,4 +53,3 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
51
53
|
defaultOptions: mEditor.IStandaloneEditorConstructionOptions;
|
|
52
54
|
autoHeight: boolean;
|
|
53
55
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
54
|
-
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("monaco-editor/esm/vs/editor/editor.worker?worker"),s=require("monaco-editor/esm/vs/language/css/css.worker?worker"),i=require("monaco-editor/esm/vs/language/html/html.worker?worker"),c=require("monaco-editor/esm/vs/language/json/json.worker?worker"),u=require("monaco-editor/esm/vs/language/typescript/ts.worker?worker"),o=require("vue"),a=require("../_plugin-vue_export-helper-BHFhmbuH.js"),p=o.defineComponent({name:"VkMonacoEnvironment",setup(){return globalThis.MonacoEnvironment={getWorker(n,e){return e==="json"?new c:e==="css"||e==="scss"||e==="less"?new s:e==="html"||e==="handlebars"||e==="razor"?new i:["typescript","javascript"].includes(e)?new u:new t}},{}}});function _(n,e,m,f,k,l){return o.renderSlot(n.$slots,"default")}const r=a._export_sfc(p,[["render",_]]),d=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));r.install=n=>{n.component(r.name||"VkMonacoEnvironment",r)};exports.VkMonacoEnvironment=r;exports.__VkMonacoEnvironment=d;exports.default=r;
|
|
@@ -1,46 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { defineComponent, renderSlot } from
|
|
7
|
-
import { _ as
|
|
8
|
-
|
|
9
|
-
var _sfc_main = defineComponent({
|
|
1
|
+
import e from "monaco-editor/esm/vs/editor/editor.worker?worker";
|
|
2
|
+
import t from "monaco-editor/esm/vs/language/css/css.worker?worker";
|
|
3
|
+
import s from "monaco-editor/esm/vs/language/html/html.worker?worker";
|
|
4
|
+
import i from "monaco-editor/esm/vs/language/json/json.worker?worker";
|
|
5
|
+
import m from "monaco-editor/esm/vs/language/typescript/ts.worker?worker";
|
|
6
|
+
import { defineComponent as c, renderSlot as p } from "vue";
|
|
7
|
+
import { _ as f } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
8
|
+
const a = c({
|
|
10
9
|
name: "VkMonacoEnvironment",
|
|
11
10
|
setup() {
|
|
12
|
-
globalThis.MonacoEnvironment = {
|
|
13
|
-
getWorker(
|
|
14
|
-
|
|
15
|
-
return new JsonWorker();
|
|
16
|
-
}
|
|
17
|
-
if (label === "css" || label === "scss" || label === "less") {
|
|
18
|
-
return new CssWorker();
|
|
19
|
-
}
|
|
20
|
-
if (label === "html" || label === "handlebars" || label === "razor") {
|
|
21
|
-
return new HtmlWorker();
|
|
22
|
-
}
|
|
23
|
-
if (["typescript", "javascript"].includes(label)) {
|
|
24
|
-
return new TsWorker();
|
|
25
|
-
}
|
|
26
|
-
return new EditorWorker();
|
|
11
|
+
return globalThis.MonacoEnvironment = {
|
|
12
|
+
getWorker(o, r) {
|
|
13
|
+
return r === "json" ? new i() : r === "css" || r === "scss" || r === "less" ? new t() : r === "html" || r === "handlebars" || r === "razor" ? new s() : ["typescript", "javascript"].includes(r) ? new m() : new e();
|
|
27
14
|
}
|
|
28
|
-
};
|
|
29
|
-
return {};
|
|
15
|
+
}, {};
|
|
30
16
|
}
|
|
31
17
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return renderSlot(_ctx.$slots, "default");
|
|
18
|
+
function u(o, r, _, d, k, v) {
|
|
19
|
+
return p(o.$slots, "default");
|
|
35
20
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var types = /*#__PURE__*/Object.freeze({
|
|
21
|
+
const n = /* @__PURE__ */ f(a, [["render", u]]), j = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
39
22
|
__proto__: null
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
23
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
24
|
+
n.install = (o) => {
|
|
25
|
+
o.component(n.name || "VkMonacoEnvironment", n);
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
n as VkMonacoEnvironment,
|
|
29
|
+
j as __VkMonacoEnvironment,
|
|
30
|
+
n as default
|
|
44
31
|
};
|
|
45
|
-
|
|
46
|
-
export { VkMonacoEnvironment, types as __VkMonacoEnvironment, VkMonacoEnvironment as default };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
2
|
export default _default;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),m=require("@vunk/shared/enum"),j=require("@vunk/shared/promise"),I=require("pixi.js"),W=require("@vunk/shared/object"),H=require("@vunk/core/composables"),ae=require("../_plugin-vue_export-helper-BHFhmbuH.js");function se(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var z={exports:{}},ie=z.exports,X;function ue(){return X||(X=1,(function(l,S){(function(r,f){l.exports=f()})(ie,function(){return(function(t){var r={};function f(c){if(r[c])return r[c].exports;var g=r[c]={exports:{},id:c,loaded:!1};return t[c].call(g.exports,g,g.exports,f),g.loaded=!0,g.exports}return f.m=t,f.c=r,f.p="",f(0)})([(function(t,r,f){Object.defineProperty(r,"__esModule",{value:!0}),r.isNotPNG=a,r.isNotAPNG=u,r.default=s;var c=f(1),g=w(c),y=f(2);function w(d){return d&&d.__esModule?d:{default:d}}var e=new Error("Not a PNG"),n=new Error("Not an animated PNG");function a(d){return d===e}function u(d){return d===n}var i=new Uint8Array([137,80,78,71,13,10,26,10]);function s(d){var _=new Uint8Array(d);if(Array.prototype.some.call(i,function(L,C){return L!==_[C]}))return e;var p=!1;if(b(_,function(L){return!(p=L==="acTL")}),!p)return n;var x=[],E=[],N=null,F=null,O=0,R=new y.APNG;if(b(_,function(L,C,A,U){var D=new DataView(C.buffer);switch(L){case"IHDR":N=C.subarray(A+8,A+8+U),R.width=D.getUint32(A+8),R.height=D.getUint32(A+12);break;case"acTL":R.numPlays=D.getUint32(A+8+4);break;case"fcTL":F&&(R.frames.push(F),O++),F=new y.Frame,F.width=D.getUint32(A+8+4),F.height=D.getUint32(A+8+8),F.left=D.getUint32(A+8+12),F.top=D.getUint32(A+8+16);var ne=D.getUint16(A+8+20),K=D.getUint16(A+8+22);K===0&&(K=100),F.delay=1e3*ne/K,F.delay<=10&&(F.delay=100),R.playTime+=F.delay,F.disposeOp=D.getUint8(A+8+24),F.blendOp=D.getUint8(A+8+25),F.dataParts=[],O===0&&F.disposeOp===2&&(F.disposeOp=1);break;case"fdAT":F&&F.dataParts.push(C.subarray(A+8+4,A+8+U));break;case"IDAT":F&&F.dataParts.push(C.subarray(A+8,A+8+U));break;case"IEND":E.push(k(C,A,12+U));break;default:x.push(k(C,A,12+U))}}),F&&R.frames.push(F),R.frames.length==0)return n;var V=new Blob(x),G=new Blob(E);return R.frames.forEach(function(L){var C=[];C.push(i),N.set(h(L.width),0),N.set(h(L.height),4),C.push(T("IHDR",N)),C.push(V),L.dataParts.forEach(function(A){return C.push(T("IDAT",A))}),C.push(G),L.imageData=new Blob(C,{type:"image/png"}),delete L.dataParts,C=null}),R}function b(d,_){var p=new DataView(d.buffer),x=8,E=void 0,N=void 0,F=void 0;do N=p.getUint32(x),E=v(d,x+4,4),F=_(E,d,x,N),x+=12+N;while(F!==!1&&E!="IEND"&&x<d.length)}function v(d,_,p){var x=Array.prototype.slice.call(d.subarray(_,_+p));return String.fromCharCode.apply(String,x)}function P(d){for(var _=new Uint8Array(d.length),p=0;p<d.length;p++)_[p]=d.charCodeAt(p);return _}function k(d,_,p){var x=new Uint8Array(p);return x.set(d.subarray(_,_+p)),x}var T=function(_,p){var x=_.length+p.length,E=new Uint8Array(x+8),N=new DataView(E.buffer);N.setUint32(0,p.length),E.set(P(_),4),E.set(p,8);var F=(0,g.default)(E,4,x);return N.setUint32(x+4,F),E},h=function(_){return new Uint8Array([_>>>24&255,_>>>16&255,_>>>8&255,_&255])}}),(function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(w){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:w.length-e,a=-1,u=e,i=e+n;u<i;u++)a=a>>>8^f[(a^w[u])&255];return a^-1};for(var f=new Uint32Array(256),c=0;c<256;c++){for(var g=c,y=0;y<8;y++)g=(g&1)!==0?3988292384^g>>>1:g>>>1;f[c]=g}}),(function(t,r,f){Object.defineProperty(r,"__esModule",{value:!0}),r.Frame=r.APNG=void 0;var c=(function(){function n(a,u){for(var i=0;i<u.length;i++){var s=u[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(a,s.key,s)}}return function(a,u,i){return u&&n(a.prototype,u),i&&n(a,i),a}})(),g=f(3),y=w(g);function w(n){return n&&n.__esModule?n:{default:n}}function e(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}r.APNG=(function(){function n(){e(this,n),this.width=0,this.height=0,this.numPlays=0,this.playTime=0,this.frames=[]}return c(n,[{key:"createImages",value:function(){return Promise.all(this.frames.map(function(u){return u.createImage()}))}},{key:"getPlayer",value:function(u){var i=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.createImages().then(function(){return new y.default(i,u,s)})}}]),n})(),r.Frame=(function(){function n(){e(this,n),this.left=0,this.top=0,this.width=0,this.height=0,this.delay=0,this.disposeOp=0,this.blendOp=0,this.imageData=null,this.imageElement=null}return c(n,[{key:"createImage",value:function(){var u=this;return this.imageElement?Promise.resolve():new Promise(function(i,s){var b=URL.createObjectURL(u.imageData);u.imageElement=document.createElement("img"),u.imageElement.onload=function(){URL.revokeObjectURL(b),i()},u.imageElement.onerror=function(){URL.revokeObjectURL(b),u.imageElement=null,s(new Error("Image creation error"))},u.imageElement.src=b})}}]),n})()}),(function(t,r,f){Object.defineProperty(r,"__esModule",{value:!0});var c=(function(){function i(s,b){for(var v=0;v<b.length;v++){var P=b[v];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(s,P.key,P)}}return function(s,b,v){return b&&i(s.prototype,b),v&&i(s,v),s}})(),g=f(4),y=w(g);function w(i){return i&&i.__esModule?i:{default:i}}function e(i,s){if(!(i instanceof s))throw new TypeError("Cannot call a class as a function")}function n(i,s){if(!i)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:i}function a(i,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);i.prototype=Object.create(s&&s.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(i,s):i.__proto__=s)}var u=(function(i){a(s,i);function s(b,v,P){e(this,s);var k=n(this,(s.__proto__||Object.getPrototypeOf(s)).call(this));return k.playbackRate=1,k._currentFrameNumber=0,k._ended=!1,k._paused=!0,k._numPlays=0,k._rafId=null,k._apng=b,k.context=v,k.stop(),P&&k.play(),k}return c(s,[{key:"renderNextFrame",value:function(){this._currentFrameNumber=(this._currentFrameNumber+1)%this._apng.frames.length,this._currentFrameNumber===this._apng.frames.length-1&&(this._numPlays++,this._apng.numPlays!==0&&this._numPlays>=this._apng.numPlays&&(this._ended=!0,this._paused=!0)),this._prevFrame&&this._prevFrame.disposeOp==1?this.context.clearRect(this._prevFrame.left,this._prevFrame.top,this._prevFrame.width,this._prevFrame.height):this._prevFrame&&this._prevFrame.disposeOp==2&&this.context.putImageData(this._prevFrameData,this._prevFrame.left,this._prevFrame.top);var v=this.currentFrame;this._prevFrame=v,this._prevFrameData=null,v.disposeOp==2&&(this._prevFrameData=this.context.getImageData(v.left,v.top,v.width,v.height)),v.blendOp==0&&this.context.clearRect(v.left,v.top,v.width,v.height),this.context.drawImage(v.imageElement,v.left,v.top),this.emit("frame",this._currentFrameNumber),this._ended&&this.emit("end")}},{key:"play",value:function(){var v=this;this._rafId&&cancelAnimationFrame(this._rafId),this.emit("play"),this._ended&&this.stop(),this._paused=!1;var P=performance.now()+this.currentFrame.delay/this.playbackRate,k=function T(h){if(!(v._ended||v._paused)){if(h>=P){for(;h-P>=v._apng.playTime/v.playbackRate;)P+=v._apng.playTime/v.playbackRate,v._numPlays++;do v.renderNextFrame(),P+=v.currentFrame.delay/v.playbackRate;while(!v._ended&&!v._paused&&h>P)}v._rafId=requestAnimationFrame(T)}};this._rafId=requestAnimationFrame(k)}},{key:"pause",value:function(){this._paused||(this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this.emit("pause"),this._paused=!0)}},{key:"stop",value:function(){this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this.emit("stop"),this._numPlays=0,this._ended=!1,this._paused=!0,this._currentFrameNumber=-1,this.context.clearRect(0,0,this._apng.width,this._apng.height),this.renderNextFrame()}},{key:"currentFrameNumber",get:function(){return this._currentFrameNumber}},{key:"currentFrame",get:function(){return this._apng.frames[this._currentFrameNumber]}},{key:"paused",get:function(){return this._paused}},{key:"ended",get:function(){return this._ended}}]),s})(y.default);r.default=u}),(function(t,r){function f(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}t.exports=f,f.EventEmitter=f,f.prototype._events=void 0,f.prototype._maxListeners=void 0,f.defaultMaxListeners=10,f.prototype.setMaxListeners=function(e){if(!g(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},f.prototype.emit=function(e){var n,a,u,i,s,b;if(this._events||(this._events={}),e==="error"&&(!this._events.error||y(this._events.error)&&!this._events.error.length)){if(n=arguments[1],n instanceof Error)throw n;var v=new Error('Uncaught, unspecified "error" event. ('+n+")");throw v.context=n,v}if(a=this._events[e],w(a))return!1;if(c(a))switch(arguments.length){case 1:a.call(this);break;case 2:a.call(this,arguments[1]);break;case 3:a.call(this,arguments[1],arguments[2]);break;default:i=Array.prototype.slice.call(arguments,1),a.apply(this,i)}else if(y(a))for(i=Array.prototype.slice.call(arguments,1),b=a.slice(),u=b.length,s=0;s<u;s++)b[s].apply(this,i);return!0},f.prototype.addListener=function(e,n){var a;if(!c(n))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,c(n.listener)?n.listener:n),this._events[e]?y(this._events[e])?this._events[e].push(n):this._events[e]=[this._events[e],n]:this._events[e]=n,y(this._events[e])&&!this._events[e].warned&&(w(this._maxListeners)?a=f.defaultMaxListeners:a=this._maxListeners,a&&a>0&&this._events[e].length>a&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),typeof console.trace=="function"&&console.trace())),this},f.prototype.on=f.prototype.addListener,f.prototype.once=function(e,n){if(!c(n))throw TypeError("listener must be a function");var a=!1;function u(){this.removeListener(e,u),a||(a=!0,n.apply(this,arguments))}return u.listener=n,this.on(e,u),this},f.prototype.removeListener=function(e,n){var a,u,i,s;if(!c(n))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(a=this._events[e],i=a.length,u=-1,a===n||c(a.listener)&&a.listener===n)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,n);else if(y(a)){for(s=i;s-- >0;)if(a[s]===n||a[s].listener&&a[s].listener===n){u=s;break}if(u<0)return this;a.length===1?(a.length=0,delete this._events[e]):a.splice(u,1),this._events.removeListener&&this.emit("removeListener",e,n)}return this},f.prototype.removeAllListeners=function(e){var n,a;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[e]&&delete this._events[e],this;if(arguments.length===0){for(n in this._events)n!=="removeListener"&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events={},this}if(a=this._events[e],c(a))this.removeListener(e,a);else if(a)for(;a.length;)this.removeListener(e,a[a.length-1]);return delete this._events[e],this},f.prototype.listeners=function(e){var n;return!this._events||!this._events[e]?n=[]:c(this._events[e])?n=[this._events[e]]:n=this._events[e].slice(),n},f.prototype.listenerCount=function(e){if(this._events){var n=this._events[e];if(c(n))return 1;if(n)return n.length}return 0},f.listenerCount=function(e,n){return e.listenerCount(n)};function c(e){return typeof e=="function"}function g(e){return typeof e=="number"}function y(e){return typeof e=="object"&&e!==null}function w(e){return e===void 0}})])})})(z)),z.exports}var oe=ue();const le=se(oe),B={url:{type:String,requierd:!1},data:{type:Array,default:()=>[]},loop:{type:Boolean,default:!1},status:{type:String,default:m.TickerStatus.pending},frameRate:{type:Number,default:25},label:{type:String,default:""},resize:{type:Function,default:void 0},prerender:{type:Boolean,default:!1},visible:{type:Boolean,default:!0}},$={"update:status":null,"update:data":null,setData:null},J=Symbol("appInjectKey");function ce(){const l=new I.Application,S=new j.Deferred,t={whenDef:S,when:()=>S.promise};return o.provide(J,{application:l,context:t}),{application:l,context:t}}function Y(){const l=o.inject(J);if(!l)throw new Error("Pixi app not provided");return l}function M(l){const S=l.autoResize??!0,t=l.resize??y,{application:r,context:f}=Y(),c=new I.Sprite;r.stage.addChild(c),o.watchEffect(()=>{c.visible=l.visible??!0}),o.watchEffect(()=>{l.label&&(c.label=l.label)}),S&&f.when().then(w=>{c.texture&&(g(),w.renderer.on("resize",g))});function g(){if(!r.renderer?.screen)return;const w=c.texture._meta;t({application:r,sprite:c,meta:w})}o.onBeforeUnmount(()=>{r.renderer.off("resize",g),r.stage.removeChild(c)});function y(){const w=r.screen.width/c.texture.width,e=r.screen.height/c.texture.height,n=Math.min(w,e);c.scale.set(n),c.x=(r.screen.width-c.width)/2,c.y=(r.screen.height-c.height)/2}return{sprite:c,resizeSprite:g,application:r}}const Q=o.defineComponent({__name:"apng",props:{...B,url:{type:String,required:!0}},emits:$,setup(l,{emit:S}){const t=l,r=S,f=o.useId(),c=p=>`${f}-apng-frame-${p}`,{sprite:g,resizeSprite:y}=M(t),w=o.ref([]),e=o.ref(0),n=o.ref(!1),a=o.ref(""),u=new Map;let i=null,s=null,b=null;o.onMounted(()=>P(t.url));function v(p,x){return s||(s=document.createElement("canvas"),b=s.getContext("2d",{willReadFrequently:!0})),(s.width!==p||s.height!==x)&&(s.width=p,s.height=x),{canvas:s,ctx:b}}async function P(p){try{a.value="",n.value=!1,await _();const x=await fetch(p);if(!x.ok)throw new Error(`加载APNG失败: ${x.status}`);const E=await x.arrayBuffer(),N=le(E);if(N instanceof Error)throw new TypeError(`APNG解析失败: ${N.message}`);const{canvas:F,ctx:O}=v(N.width,N.height),R=N.frames.map(async(V,G)=>{O.clearRect(0,0,F.width,F.height),await V.createImage();const L=V.imageElement;O.drawImage(L,V.left,V.top);const C=O.getImageData(0,0,F.width,F.height),A=c(G);u.set(A,void 0),O.putImageData(C,0,0);const U=F.toDataURL();I.Assets.add({alias:A,src:U});const D=await I.Assets.load(A);return u.set(A,D),G===0&&(g.texture=D,y()),A});w.value=await Promise.all(R),n.value=!0}catch(x){console.error("加载APNG失败:",x),a.value=x instanceof Error?x.message:"加载APNG失败",r("update:status",m.TickerStatus.stopped)}}function k(){i===null&&(i=window.setInterval(()=>{if(w.value.length===0||t.status!==m.TickerStatus.playing)return;const p=u.get(c(e.value));if(p){const x=e.value-1;x>=0&&!t.loop&&Promise.resolve().then(()=>j.sleep(500)).then(()=>{I.Assets.unload(c(x)),u.delete(c(x))}),g.texture=p,y(),e.value=t.loop?(e.value+1)%w.value.length:e.value+1}else t.loop||r("update:status",m.TickerStatus.paused)},1e3/t.frameRate))}function T(){!n.value||w.value.length<=1||(r("update:status",m.TickerStatus.playing),k())}function h(){i!==null&&(clearInterval(i),i=null),r("update:status",m.TickerStatus.paused)}function d(){i!==null&&(clearInterval(i),i=null),e.value=0;const p=u.get(c(0));p&&(g.texture=p,y()),r("update:status",m.TickerStatus.stopped)}async function _(){i!==null&&(clearInterval(i),i=null);const p=[];for(const[x,E]of u)E&&E!==I.Texture.EMPTY&&p.push(I.Assets.unload(x));await Promise.all(p),u.clear(),w.value=[],e.value=0,n.value=!1,a.value="",s&&(s.width=0,s.height=0)}return o.watchEffect(()=>{switch(t.status){case m.TickerStatus.play:T();break;case m.TickerStatus.pause:h();break;case m.TickerStatus.stop:d();break}}),o.onBeforeUnmount(async()=>{await _(),s=null,b=null}),(p,x)=>o.renderSlot(p.$slots,"default")}}),pe=o.defineComponent({__name:"bitmap-generator",props:{...W.pickObject(B,{excludes:["loop"]}),generator:{type:Object,required:!0}},emits:{"update:status":null,load:l=>l},setup(l,{emit:S}){const t=l,r=S,{sprite:f,resizeSprite:c,application:g}=M(t),y=new I.Texture({dynamic:!0});f.texture=y;function w(i){y.source.destroy();const s=new I.ImageSource({resource:i});y.source=s,y.update(),c()}r("load",{application:g,sprite:f}),o.watch(()=>t.status,i=>{i===m.TickerStatus.play&&n(),i===m.TickerStatus.pause&&a(),i===m.TickerStatus.stop&&u()},{immediate:!0});function e(){t.status===m.TickerStatus.playing&&t.generator.next().then(({value:i,done:s})=>{if(s)return r("update:status",m.TickerStatus.stopped);w(i)})}function n(){g.ticker.minFPS=t.frameRate,g.ticker.maxFPS=t.frameRate,r("update:status",m.TickerStatus.playing),g.ticker.add(e)}function a(){g.ticker.remove(e),r("update:status",m.TickerStatus.paused)}function u(){g.ticker.remove(e),r("update:status",m.TickerStatus.stopped)}return o.onBeforeUnmount(()=>{u(),y.destroy()}),(i,s)=>o.renderSlot(i.$slots,"default")}}),Z=o.defineComponent({__name:"bitmap",props:{...W.pickObject(B,{excludes:["loop"]}),data:{type:void 0,required:!0},frameIndex:{type:Number}},emits:{...$,load:l=>l,"update:frameIndex":null,notFound:l=>!0},setup(l,{emit:S}){const t=l,r=S,{sprite:f,resizeSprite:c,application:g}=M(t),y=new I.Texture({dynamic:!0});f.texture=y;function w(h){y.source?.resource?.close(),y.source?.destroy();const d=new I.ImageSource({resource:h});y.source=d,y.update(),c()}r("load",{application:g,sprite:f});const e=H.useModelComputed({default:0,key:"frameIndex"},t,r),n=o.ref(-1);function a(h){h<=n.value||(n.value=h,j.sleep(0).then(()=>{r("setData",{k:h,v:null})}))}let u=null,i=0,s=0,b=0;function v(){if(u!==null)return;i=performance.now(),b=i,s=0;function h(){const _=performance.now(),p=1e3/t.frameRate,x=_-i;if(x>=p){i=_-x%p,d(),s++;const E=_-b;if(E>=1e3){const N=Math.round(s*1e3/E);console.log(`[Bitmap] FPS: ${N}`),s=0,b=_}}t.status===m.TickerStatus.playing?u=requestAnimationFrame(h):u=null}function d(){if(t.data.length===0||t.status!==m.TickerStatus.playing)return;const _=t.data[e.value];if(_){const p=e.value-1;p>=0&&a(p),w(_),e.value=e.value+1}else console.warn(`Bitmap for index ${e.value} not found. Ensure the data is loaded.`),r("notFound",e.value)}u=requestAnimationFrame(h)}o.watchEffect(()=>{t.prerender&&e.value===0&&t.data.length>0&&t.data[0]&&w(t.data[0])}),o.watch(()=>t.status,h=>{h===m.TickerStatus.play&&P(),h===m.TickerStatus.pause&&k(),h===m.TickerStatus.stop&&T()},{immediate:!0});function P(){t.data.length>0?(r("update:status",m.TickerStatus.playing),v()):r("update:status",m.TickerStatus.stopped)}function k(){r("update:status",m.TickerStatus.paused)}function T(){r("update:status",m.TickerStatus.stopped),u!==null&&(cancelAnimationFrame(u),u=null),r("update:data",[]),e.value=0,n.value=-1}return o.onBeforeUnmount(()=>{T(),y.destroy()}),(h,d)=>o.renderSlot(h.$slots,"default")}}),fe=o.defineComponent({__name:"buffer-image",props:{...W.pickObject(B,{excludes:["loop"]}),data:{type:Array,required:!0},format:{type:String,default:"rgba8unorm"},frameIndex:{type:Number},height:{type:Number,required:!0},width:{type:Number,required:!0}},emits:{...$,load:l=>l,"update:frameIndex":null,notFound:l=>!0},setup(l,{emit:S}){const t=l,r=S,{sprite:f,resizeSprite:c,application:g}=M(t),y=new I.Texture({dynamic:!0});f.texture=y;function w(h){y.source?.destroy();const d=new I.BufferImageSource({resource:h,height:t.height,width:t.width,format:t.format});y.source=d,y.update(),c()}r("load",{application:g,sprite:f});const e=H.useModelComputed({default:0,key:"frameIndex"},t,r),n=o.ref(-1);function a(h){h<=n.value||(n.value=h,j.sleep(0).then(()=>{r("setData",{k:h,v:null})}))}let u=null,i=0,s=0,b=0;function v(){if(u!==null)return;i=performance.now(),b=i,s=0;function h(){const _=performance.now(),p=1e3/t.frameRate,x=_-i;if(x>=p){i=_-x%p,d(),s++;const E=_-b;if(E>=1e3){const N=Math.round(s*1e3/E);console.log(`[Bitmap] FPS: ${N}`),s=0,b=_}}t.status===m.TickerStatus.playing?u=requestAnimationFrame(h):u=null}function d(){if(t.data.length===0||t.status!==m.TickerStatus.playing)return;const _=t.data[e.value];if(_){const p=e.value-1;p>=0&&a(p),w(_),e.value=e.value+1}else console.warn(`Bitmap for index ${e.value} not found. Ensure the data is loaded.`),r("notFound",e.value)}u=requestAnimationFrame(h)}o.watchEffect(()=>{t.prerender&&e.value===0&&t.data.length>0&&t.data[0]&&w(t.data[0])}),o.watch(()=>t.status,h=>{h===m.TickerStatus.play&&P(),h===m.TickerStatus.pause&&k(),h===m.TickerStatus.stop&&T()},{immediate:!0});function P(){t.data.length>0?(r("update:status",m.TickerStatus.playing),v()):r("update:status",m.TickerStatus.stopped)}function k(){r("update:status",m.TickerStatus.paused)}function T(){r("update:status",m.TickerStatus.stopped),u!==null&&(cancelAnimationFrame(u),u=null),r("update:data",[]),e.value=0,n.value=-1}return o.onBeforeUnmount(()=>{T(),y.destroy()}),(h,d)=>o.renderSlot(h.$slots,"default")}}),de=o.defineComponent({__name:"core",props:{...B,data:{type:void 0,required:!0},frameIndex:{type:Number}},emits:{...$,load:l=>l,"update:frameIndex":null,notFound:l=>!0},setup(l,{emit:S}){const t=l,r=S,f=o.useId(),c=T=>`${f}-${T}`,{sprite:g,resizeSprite:y,application:w}=M(t),e=new Map,n=o.ref(0),a=o.computed(()=>t.data.slice(n.value));o.watchEffect(()=>{for(const T in a.value){const h=+T+n.value,d=`${f}-${h}`,_=typeof a.value[T]=="string"?a.value[T]:a.value[T]?.src;_&&(e.has(d)||(I.Assets.add({alias:d,src:_,loadParser:"loadTextures"}),e.set(d,void 0),I.Assets.load(d).then(p=>{p._meta=a.value[T],e.set(d,p),t.prerender&&h===0&&(g.texture=p,y())})))}}),r("load",{application:w,sprite:g});const u=H.useModelComputed({default:0,key:"frameIndex"},t,r);let i=null,s=0;function b(){if(i!==null)return;s=performance.now();function T(){const d=performance.now(),_=1e3/t.frameRate,p=d-s;p>=_&&(s=d-p%_,h()),t.status===m.TickerStatus.playing?i=requestAnimationFrame(T):i=null}function h(){if(t.data.length===0||t.status!==m.TickerStatus.playing)return;const d=e.get(c(u.value));if(d){const _=g.texture,p=u.value-1;_&&p>=0&&!t.loop&&Promise.resolve(j.sleep(500)).then(()=>I.Assets.unload(c(p))).then(()=>{e.set(c(p),void 0),r("setData",{k:p,v:""}),n.value=p}),g.texture=d,y(),u.value=t.loop?(u.value+1)%t.data.length:u.value+1}else console.warn(`Texture for index ${u.value} not found. Ensure the texture is loaded.`),r("notFound",u.value),t.loop||r("update:status",m.TickerStatus.paused)}i=requestAnimationFrame(T)}o.watch(()=>t.status,T=>{T===m.TickerStatus.play&&v(),T===m.TickerStatus.pause&&P(),T===m.TickerStatus.stop&&k()},{immediate:!0});function v(){t.data.length>0?(r("update:status",m.TickerStatus.playing),b()):r("update:status",m.TickerStatus.stopped)}function P(){r("update:status",m.TickerStatus.paused)}function k(){r("update:status",m.TickerStatus.stopped),i!==null&&(cancelAnimationFrame(i),i=null),r("update:data",[]),e.clear(),u.value=0}return o.onBeforeUnmount(()=>{Array.from(e.entries()).forEach(([h,d])=>{d&&I.Assets.unload(h)}),k()}),(T,h)=>o.renderSlot(T.$slots,"default")}}),ee=o.defineComponent({__name:"provider",setup(l){return ce(),(S,t)=>o.renderSlot(S.$slots,"default")}}),te=o.defineComponent({__name:"video",props:{...B,url:{type:String,required:!0}},emits:$,setup(l,{emit:S}){const t=l,r=S,f=o.useId(),c=()=>`${f}-video`,{sprite:g,resizeSprite:y}=M(t),w=o.ref(),e=o.computed(()=>{if(w.value?.source&&w.value.source.resource){const k=w.value.source.resource;if(k instanceof HTMLVideoElement)return k}return null}),n=H.useDeferred(),a=o.ref("");n.promise.then(()=>{t.status===m.TickerStatus.play&&b()}),o.watchEffect(()=>{e.value&&(e.value.loop=t.loop)}),o.onMounted(()=>u(t.url));async function u(k){try{a.value="";const T=c();I.Assets.cache.has(T)&&await I.Assets.unload(T),I.Assets.add({alias:T,src:k});const h=await I.Assets.load(T);return w.value=h,g.texture=h,e.value&&(e.value.loop=t.loop,e.value.muted=!0,e.value.crossOrigin="anonymous",i(e.value),n.resolve()),y(),h}catch(T){return console.error("加载视频纹理失败:",T),a.value="视频加载失败",null}}function i(k){k.addEventListener("play",()=>{t.status!==m.TickerStatus.playing&&r("update:status",m.TickerStatus.playing)}),k.addEventListener("pause",()=>{t.status!==m.TickerStatus.paused&&r("update:status",m.TickerStatus.paused)}),k.addEventListener("ended",()=>{t.loop?(k.currentTime=0,k.play()):r("update:status",m.TickerStatus.stopped)}),k.addEventListener("error",T=>{const h=k.error;let d="视频播放失败";if(h)switch(h.code){case h.MEDIA_ERR_ABORTED:d="视频播放被中止";break;case h.MEDIA_ERR_NETWORK:d="网络错误导致视频播放失败";break;case h.MEDIA_ERR_DECODE:d="视频解码失败";break;case h.MEDIA_ERR_SRC_NOT_SUPPORTED:d="不支持的视频格式";break}console.error("视频播放错误:",d,T),a.value=d,r("update:status",m.TickerStatus.stopped)})}async function s(){if(w.value){const k=c();w.value.destroy(!0),w.value=void 0,I.Assets.cache.has(k)&&await I.Assets.unload(k)}a.value=""}o.watchEffect(()=>{t.status===m.TickerStatus.play&&b(),t.status===m.TickerStatus.pause&&v(),t.status===m.TickerStatus.stop&&P()}),o.onBeforeUnmount(()=>{s()});function b(){e.value&&e.value.play().catch(k=>{console.error("视频播放失败:",k),a.value="视频播放失败"})}function v(){e.value?.pause()}function P(){e.value&&(e.value.pause(),e.value.currentTime=0),r("update:status",m.TickerStatus.stopped)}return(k,T)=>o.renderSlot(k.$slots,"default")}}),re=o.defineComponent({__name:"view",props:{defaultOptions:{type:Object,default:()=>({})}},setup(l){const S=l,{application:t,context:r}=Y(),f=o.ref();return o.onMounted(async()=>{await t.init({resizeTo:f.value,...S.defaultOptions}),r.whenDef.resolve(t),f.value.appendChild(t.canvas)}),(c,g)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"appRef",ref:f,class:"vk-pixi-frame"},null,512))}}),me=o.defineComponent({name:"VkPixiFrame",components:{ApngComp:Q,ProviderComp:ee,ViewComp:re,VideoComp:te,Bitmap:Z},props:B,emits:$,setup(l){const S=o.computed(()=>{if(!l.url)return!1;const r=l.url.toLowerCase();return r.includes(".png")&&!r.includes(".mp4")&&!r.includes(".webm")}),t=o.computed(()=>{if(!l.url)return!1;const r=l.url.toLowerCase();return r.includes(".mp4")||r.includes(".webm")||r.includes(".mov")});return{isApng:S,isVideo:t}}});function he(l,S,t,r,f,c){const g=o.resolveComponent("ViewComp"),y=o.resolveComponent("ApngComp"),w=o.resolveComponent("VideoComp"),e=o.resolveComponent("Bitmap"),n=o.resolveComponent("ProviderComp");return o.openBlock(),o.createBlock(n,null,{default:o.withCtx(()=>[o.createVNode(g),l.isApng&&l.url?(o.openBlock(),o.createBlock(y,{key:0,url:l.url,loop:l.loop,status:l.status,"onUpdate:status":S[0]||(S[0]=a=>l.$emit("update:status",a))},null,8,["url","loop","status"])):l.isVideo&&l.url?(o.openBlock(),o.createBlock(w,{key:1,url:l.url,loop:l.loop,status:l.status,"onUpdate:status":S[1]||(S[1]=a=>l.$emit("update:status",a))},null,8,["url","loop","status"])):(o.openBlock(),o.createBlock(e,{key:2,data:l.data,loop:l.loop,status:l.status,onSetData:S[2]||(S[2]=a=>l.$emit("setData",a)),"onUpdate:status":S[3]||(S[3]=a=>l.$emit("update:status",a))},null,8,["data","loop","status"]))]),_:1})}const q=ae._export_sfc(me,[["render",he]]),ve=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));q.install=l=>{l.component(q.name||"VkPixiFrame",q)};Object.defineProperty(exports,"TickerStatus",{enumerable:!0,get:()=>m.TickerStatus});exports.VkPixiFrame=q;exports.VkPixiFrameApng=Q;exports.VkPixiFrameBitmap=Z;exports.VkPixiFrameBitmapGenerator=pe;exports.VkPixiFrameBufferImage=fe;exports.VkPixiFrameCore=de;exports.VkPixiFrameProvider=ee;exports.VkPixiFrameVideo=te;exports.VkPixiFrameView=re;exports.__VkPixiFrame=ve;exports.default=q;exports.usePixiApp=Y;exports.useSprite=M;
|