@vunk/plus 1.10.2 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/WebGLRenderer.mjs +1 -1
- package/components/WebGPURenderer.mjs +1 -1
- package/components/broadcasting-markdown/index.mjs +21 -9
- package/components/broadcasting-markdown/src/ctx.d.ts +7 -0
- package/components/broadcasting-markdown/src/index.vue.d.ts +55 -46
- package/components/browserAll.mjs +1 -1
- package/components/index2.mjs +127 -69
- package/components/metahuman-broadcasting/index.d.ts +0 -1
- package/components/metahuman-broadcasting/index.mjs +58 -68
- package/components/metahuman-broadcasting/src/ctx.d.ts +4 -0
- package/components/metahuman-broadcasting/src/index.vue.d.ts +144 -167
- package/components/pixi-frame/index.d.ts +4 -1
- package/components/pixi-frame/index.mjs +2 -2
- package/components/pixi-frame/src/bitmap-generator.vue.d.ts +146 -0
- package/components/pixi-frame/src/bitmap.vue.d.ts +4 -5
- package/components/pixi-frame/src/index.vue.d.ts +4 -5
- package/components/webworkerAll.mjs +1 -1
- package/package.json +4 -20
- package/shared/data/blobToAudioBuffer.d.ts +1 -0
- package/shared/data/imgUrlToBitmap.d.ts +1 -0
- package/shared/data/index.d.ts +2 -0
- package/shared/data/index.mjs +25 -0
- package/shared/StreamingInferenceService.mjs +0 -204
- package/shared/audioToFrames/index.d.ts +0 -19
- package/shared/audioToFrames/index.mjs +0 -44
- package/shared/audioToFrames/src/assets/mask.d.ts +0 -2
- package/shared/audioToFrames/src/audio/StreamingFeatureExtractorService.d.ts +0 -125
- package/shared/audioToFrames/src/audio/index.d.ts +0 -5
- package/shared/audioToFrames/src/audio/index.mjs +0 -375
- package/shared/audioToFrames/src/config.d.ts +0 -4
- package/shared/audioToFrames/src/core/constants.d.ts +0 -17
- package/shared/audioToFrames/src/core/index.d.ts +0 -6
- package/shared/audioToFrames/src/core/index.mjs +0 -24
- package/shared/audioToFrames/src/core/utils.d.ts +0 -26
- package/shared/audioToFrames/src/inference/StreamingInferenceService.d.ts +0 -189
- package/shared/audioToFrames/src/inference/index.d.ts +0 -5
- package/shared/audioToFrames/src/inference/index.mjs +0 -3
- package/shared/audioToFrames/src/media/DataLoaderService.d.ts +0 -59
- package/shared/audioToFrames/src/media/PredictiveFrameLoader.d.ts +0 -81
- package/shared/audioToFrames/src/media/index.d.ts +0 -6
- package/shared/audioToFrames/src/media/index.mjs +0 -236
- package/shared/config.mjs +0 -5
- package/shared/constants.mjs +0 -7
|
@@ -6,8 +6,8 @@ import '@vunk/shared/enum';
|
|
|
6
6
|
import '@vunk/shared/promise';
|
|
7
7
|
import './_commonjsHelpers.mjs';
|
|
8
8
|
import './_plugin-vue_export-helper.mjs';
|
|
9
|
-
import '@vunk/core/composables';
|
|
10
9
|
import '@vunk/shared/object';
|
|
10
|
+
import '@vunk/core/composables';
|
|
11
11
|
|
|
12
12
|
class GlBatchAdaptor {
|
|
13
13
|
constructor() {
|
|
@@ -6,8 +6,8 @@ import '@vunk/shared/enum';
|
|
|
6
6
|
import '@vunk/shared/promise';
|
|
7
7
|
import './_commonjsHelpers.mjs';
|
|
8
8
|
import './_plugin-vue_export-helper.mjs';
|
|
9
|
-
import '@vunk/core/composables';
|
|
10
9
|
import '@vunk/shared/object';
|
|
10
|
+
import '@vunk/core/composables';
|
|
11
11
|
|
|
12
12
|
const tempState = State.for2d();
|
|
13
13
|
class GpuBatchAdaptor {
|
|
@@ -89,6 +89,13 @@ const props = {
|
|
|
89
89
|
paragraphMinlength: {
|
|
90
90
|
type: Number,
|
|
91
91
|
default: 20
|
|
92
|
+
},
|
|
93
|
+
/**
|
|
94
|
+
* @description 禁用, 即不产出段落
|
|
95
|
+
*/
|
|
96
|
+
disabled: {
|
|
97
|
+
type: Boolean,
|
|
98
|
+
default: false
|
|
92
99
|
}
|
|
93
100
|
};
|
|
94
101
|
const emits = {
|
|
@@ -4054,8 +4061,8 @@ var _sfc_main = defineComponent({
|
|
|
4054
4061
|
name: "VkBroadcastingMarkdown",
|
|
4055
4062
|
components: {
|
|
4056
4063
|
ParagraphView,
|
|
4057
|
-
|
|
4058
|
-
|
|
4064
|
+
HowlerSpeechView,
|
|
4065
|
+
VkTypingMarkdown
|
|
4059
4066
|
},
|
|
4060
4067
|
props,
|
|
4061
4068
|
emits,
|
|
@@ -4077,10 +4084,10 @@ var _sfc_main = defineComponent({
|
|
|
4077
4084
|
if (!props2.textToSpeech) {
|
|
4078
4085
|
return;
|
|
4079
4086
|
}
|
|
4080
|
-
|
|
4087
|
+
const value = props2.render(paragraph.value);
|
|
4088
|
+
if (props2.separators.includes(value)) {
|
|
4081
4089
|
return;
|
|
4082
4090
|
}
|
|
4083
|
-
const value = props2.render(paragraph.value);
|
|
4084
4091
|
if (!value) {
|
|
4085
4092
|
return;
|
|
4086
4093
|
}
|
|
@@ -4104,6 +4111,9 @@ var _sfc_main = defineComponent({
|
|
|
4104
4111
|
return props2.source.substring(0, currentIndex.value);
|
|
4105
4112
|
});
|
|
4106
4113
|
const fulfilledTextValue = computed(() => {
|
|
4114
|
+
if (props2.disabled) {
|
|
4115
|
+
return props2.source;
|
|
4116
|
+
}
|
|
4107
4117
|
return theData.value.filter(
|
|
4108
4118
|
(item) => item.status === ParagraphStatus.fulfilled || item.status === ParagraphStatus.pending
|
|
4109
4119
|
).map((item) => item.value).join("");
|
|
@@ -4114,6 +4124,9 @@ var _sfc_main = defineComponent({
|
|
|
4114
4124
|
});
|
|
4115
4125
|
});
|
|
4116
4126
|
watch(isFinished, (val) => {
|
|
4127
|
+
if (props2.disabled) {
|
|
4128
|
+
return;
|
|
4129
|
+
}
|
|
4117
4130
|
!val && write();
|
|
4118
4131
|
}, { immediate: true });
|
|
4119
4132
|
function write() {
|
|
@@ -4201,7 +4214,9 @@ var _sfc_main = defineComponent({
|
|
|
4201
4214
|
watch(() => props2.status, () => {
|
|
4202
4215
|
if (props2.status === TickerStatus.stop) {
|
|
4203
4216
|
theData.value.forEach((item) => {
|
|
4204
|
-
item.broadcast
|
|
4217
|
+
if (item.broadcast !== TickerStatus.stopped) {
|
|
4218
|
+
item.broadcast = Broadcast.stop;
|
|
4219
|
+
}
|
|
4205
4220
|
});
|
|
4206
4221
|
}
|
|
4207
4222
|
if (!currentPragraph.value) {
|
|
@@ -4239,10 +4254,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
4239
4254
|
null,
|
|
4240
4255
|
[
|
|
4241
4256
|
renderSlot(_ctx.$slots, "default", { paragraphs: _ctx.theData }, () => [
|
|
4242
|
-
createVNode(_component_VkTypingMarkdown, {
|
|
4243
|
-
source: _ctx.fulfilledTextValue,
|
|
4244
|
-
pause: _ctx.status === _ctx.TickerStatus.stopped
|
|
4245
|
-
}, null, 8, ["source", "pause"])
|
|
4257
|
+
createVNode(_component_VkTypingMarkdown, { source: _ctx.fulfilledTextValue }, null, 8, ["source"])
|
|
4246
4258
|
]),
|
|
4247
4259
|
(openBlock(true), createElementBlock(
|
|
4248
4260
|
Fragment,
|
|
@@ -99,6 +99,13 @@ export declare const props: {
|
|
|
99
99
|
type: NumberConstructor;
|
|
100
100
|
default: number;
|
|
101
101
|
};
|
|
102
|
+
/**
|
|
103
|
+
* @description 禁用, 即不产出段落
|
|
104
|
+
*/
|
|
105
|
+
disabled: {
|
|
106
|
+
type: BooleanConstructor;
|
|
107
|
+
default: boolean;
|
|
108
|
+
};
|
|
102
109
|
};
|
|
103
110
|
export declare const emits: {
|
|
104
111
|
setData: (e: SetDataEvent) => SetDataEvent;
|
|
@@ -72,6 +72,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
72
72
|
type: NumberConstructor;
|
|
73
73
|
default: number;
|
|
74
74
|
};
|
|
75
|
+
disabled: {
|
|
76
|
+
type: BooleanConstructor;
|
|
77
|
+
default: boolean;
|
|
78
|
+
};
|
|
75
79
|
}>, {
|
|
76
80
|
theData: import("vue").ComputedRef<Paragraph[]>;
|
|
77
81
|
ParagraphStatus: typeof ParagraphStatus;
|
|
@@ -158,6 +162,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
158
162
|
type: NumberConstructor;
|
|
159
163
|
default: number;
|
|
160
164
|
};
|
|
165
|
+
disabled: {
|
|
166
|
+
type: BooleanConstructor;
|
|
167
|
+
default: boolean;
|
|
168
|
+
};
|
|
161
169
|
}>> & Readonly<{
|
|
162
170
|
onComplete?: (() => any) | undefined;
|
|
163
171
|
"onUpdate:status"?: ((_: TickerStatus) => any) | undefined;
|
|
@@ -167,6 +175,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
167
175
|
data: Paragraph[];
|
|
168
176
|
source: string;
|
|
169
177
|
render: (text: string) => string;
|
|
178
|
+
disabled: boolean;
|
|
170
179
|
processing: (paragraph: Paragraph) => void;
|
|
171
180
|
delay: number;
|
|
172
181
|
status: TickerStatus;
|
|
@@ -249,6 +258,52 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
249
258
|
enable: boolean;
|
|
250
259
|
retryTimes: number;
|
|
251
260
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
261
|
+
HowlerSpeechView: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
262
|
+
source: {
|
|
263
|
+
type: StringConstructor;
|
|
264
|
+
default: string;
|
|
265
|
+
};
|
|
266
|
+
status: {
|
|
267
|
+
type: import("vue").PropType<TickerStatus>;
|
|
268
|
+
default: TickerStatus;
|
|
269
|
+
};
|
|
270
|
+
}>, {
|
|
271
|
+
props: import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
272
|
+
source: {
|
|
273
|
+
type: StringConstructor;
|
|
274
|
+
default: string;
|
|
275
|
+
};
|
|
276
|
+
status: {
|
|
277
|
+
type: import("vue").PropType<TickerStatus>;
|
|
278
|
+
default: TickerStatus;
|
|
279
|
+
};
|
|
280
|
+
}>> & Readonly<{
|
|
281
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
282
|
+
onLoad?: ((...args: any[]) => any) | undefined;
|
|
283
|
+
"onUpdate:status"?: ((...args: any[]) => any) | undefined;
|
|
284
|
+
}> & {}>;
|
|
285
|
+
emit: ((event: "error", ...args: any[]) => void) & ((event: "load", ...args: any[]) => void) & ((event: "update:status", ...args: any[]) => void);
|
|
286
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
287
|
+
'update:status': null;
|
|
288
|
+
load: null;
|
|
289
|
+
error: null;
|
|
290
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
291
|
+
source: {
|
|
292
|
+
type: StringConstructor;
|
|
293
|
+
default: string;
|
|
294
|
+
};
|
|
295
|
+
status: {
|
|
296
|
+
type: import("vue").PropType<TickerStatus>;
|
|
297
|
+
default: TickerStatus;
|
|
298
|
+
};
|
|
299
|
+
}>> & Readonly<{
|
|
300
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
301
|
+
onLoad?: ((...args: any[]) => any) | undefined;
|
|
302
|
+
"onUpdate:status"?: ((...args: any[]) => any) | undefined;
|
|
303
|
+
}>, {
|
|
304
|
+
source: string;
|
|
305
|
+
status: TickerStatus;
|
|
306
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
252
307
|
VkTypingMarkdown: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
253
308
|
source: {
|
|
254
309
|
type: StringConstructor;
|
|
@@ -323,51 +378,5 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
323
378
|
markdownItSetup: (md: import("markdown-it-async").MarkdownItAsync) => void;
|
|
324
379
|
finished: boolean;
|
|
325
380
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
326
|
-
HowlerSpeechView: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
327
|
-
source: {
|
|
328
|
-
type: StringConstructor;
|
|
329
|
-
default: string;
|
|
330
|
-
};
|
|
331
|
-
status: {
|
|
332
|
-
type: import("vue").PropType<TickerStatus>;
|
|
333
|
-
default: TickerStatus;
|
|
334
|
-
};
|
|
335
|
-
}>, {
|
|
336
|
-
props: import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
337
|
-
source: {
|
|
338
|
-
type: StringConstructor;
|
|
339
|
-
default: string;
|
|
340
|
-
};
|
|
341
|
-
status: {
|
|
342
|
-
type: import("vue").PropType<TickerStatus>;
|
|
343
|
-
default: TickerStatus;
|
|
344
|
-
};
|
|
345
|
-
}>> & Readonly<{
|
|
346
|
-
onError?: ((...args: any[]) => any) | undefined;
|
|
347
|
-
onLoad?: ((...args: any[]) => any) | undefined;
|
|
348
|
-
"onUpdate:status"?: ((...args: any[]) => any) | undefined;
|
|
349
|
-
}> & {}>;
|
|
350
|
-
emit: ((event: "error", ...args: any[]) => void) & ((event: "load", ...args: any[]) => void) & ((event: "update:status", ...args: any[]) => void);
|
|
351
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
352
|
-
'update:status': null;
|
|
353
|
-
load: null;
|
|
354
|
-
error: null;
|
|
355
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
356
|
-
source: {
|
|
357
|
-
type: StringConstructor;
|
|
358
|
-
default: string;
|
|
359
|
-
};
|
|
360
|
-
status: {
|
|
361
|
-
type: import("vue").PropType<TickerStatus>;
|
|
362
|
-
default: TickerStatus;
|
|
363
|
-
};
|
|
364
|
-
}>> & Readonly<{
|
|
365
|
-
onError?: ((...args: any[]) => any) | undefined;
|
|
366
|
-
onLoad?: ((...args: any[]) => any) | undefined;
|
|
367
|
-
"onUpdate:status"?: ((...args: any[]) => any) | undefined;
|
|
368
|
-
}>, {
|
|
369
|
-
source: string;
|
|
370
|
-
status: TickerStatus;
|
|
371
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
372
381
|
}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
373
382
|
export default _default;
|
|
@@ -5,8 +5,8 @@ import '@vunk/shared/enum';
|
|
|
5
5
|
import '@vunk/shared/promise';
|
|
6
6
|
import './_commonjsHelpers.mjs';
|
|
7
7
|
import './_plugin-vue_export-helper.mjs';
|
|
8
|
-
import '@vunk/core/composables';
|
|
9
8
|
import '@vunk/shared/object';
|
|
9
|
+
import '@vunk/core/composables';
|
|
10
10
|
import './colorToUniform.mjs';
|
|
11
11
|
|
|
12
12
|
class FederatedEvent {
|
package/components/index2.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { provide, inject, watchEffect, onBeforeUnmount, defineComponent, useId, ref, onMounted, renderSlot,
|
|
1
|
+
import { provide, inject, watchEffect, onBeforeUnmount, defineComponent, useId, ref, onMounted, renderSlot, watch, computed, openBlock, createElementBlock, resolveComponent, createBlock, withCtx, createVNode } from 'vue';
|
|
2
2
|
import { TickerStatus } from '@vunk/shared/enum';
|
|
3
3
|
import { Deferred, sleep } from '@vunk/shared/promise';
|
|
4
4
|
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers.mjs';
|
|
5
5
|
import { _ as _export_sfc } from './_plugin-vue_export-helper.mjs';
|
|
6
|
-
import { useModelComputed, useDeferred } from '@vunk/core/composables';
|
|
7
6
|
import { pickObject } from '@vunk/shared/object';
|
|
7
|
+
import { useModelComputed, useDeferred } from '@vunk/core/composables';
|
|
8
8
|
|
|
9
9
|
var lib = {exports: {}};
|
|
10
10
|
|
|
@@ -25564,7 +25564,7 @@ function useSprite(props) {
|
|
|
25564
25564
|
};
|
|
25565
25565
|
}
|
|
25566
25566
|
|
|
25567
|
-
var _sfc_main$
|
|
25567
|
+
var _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
25568
25568
|
__name: "apng",
|
|
25569
25569
|
props: {
|
|
25570
25570
|
...props,
|
|
@@ -25757,10 +25757,92 @@ var _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
25757
25757
|
}
|
|
25758
25758
|
});
|
|
25759
25759
|
|
|
25760
|
+
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
25761
|
+
return renderSlot(_ctx.$slots, "default");
|
|
25762
|
+
}
|
|
25763
|
+
var ApngComp = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/apng.vue"]]);
|
|
25764
|
+
|
|
25765
|
+
var _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
25766
|
+
__name: "bitmap-generator",
|
|
25767
|
+
props: {
|
|
25768
|
+
...pickObject(props, {
|
|
25769
|
+
excludes: ["loop"]
|
|
25770
|
+
}),
|
|
25771
|
+
generator: {
|
|
25772
|
+
type: Object,
|
|
25773
|
+
required: true
|
|
25774
|
+
}
|
|
25775
|
+
},
|
|
25776
|
+
emits: {
|
|
25777
|
+
"update:status": null,
|
|
25778
|
+
"load": (e) => e
|
|
25779
|
+
},
|
|
25780
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
25781
|
+
__expose();
|
|
25782
|
+
const props = __props;
|
|
25783
|
+
const emit = __emit;
|
|
25784
|
+
const { sprite, resizeSprite, application } = useSprite(props);
|
|
25785
|
+
const texture = new Texture({
|
|
25786
|
+
dynamic: true
|
|
25787
|
+
});
|
|
25788
|
+
sprite.texture = texture;
|
|
25789
|
+
function updateTextureFromBitmap(bitmap) {
|
|
25790
|
+
texture.source.destroy();
|
|
25791
|
+
const source = new ImageSource({
|
|
25792
|
+
resource: bitmap
|
|
25793
|
+
});
|
|
25794
|
+
texture.source = source;
|
|
25795
|
+
texture.update();
|
|
25796
|
+
resizeSprite();
|
|
25797
|
+
}
|
|
25798
|
+
emit("load", {
|
|
25799
|
+
application,
|
|
25800
|
+
sprite
|
|
25801
|
+
});
|
|
25802
|
+
watch(() => props.status, (newStatus) => {
|
|
25803
|
+
newStatus === TickerStatus.play && play();
|
|
25804
|
+
newStatus === TickerStatus.pause && pause();
|
|
25805
|
+
newStatus === TickerStatus.stop && stop();
|
|
25806
|
+
}, { immediate: true });
|
|
25807
|
+
function drawFrame() {
|
|
25808
|
+
if (props.status !== TickerStatus.playing) {
|
|
25809
|
+
return;
|
|
25810
|
+
}
|
|
25811
|
+
props.generator.next().then(({ value, done }) => {
|
|
25812
|
+
if (done) {
|
|
25813
|
+
return emit("update:status", TickerStatus.stopped);
|
|
25814
|
+
}
|
|
25815
|
+
updateTextureFromBitmap(value);
|
|
25816
|
+
});
|
|
25817
|
+
}
|
|
25818
|
+
function play() {
|
|
25819
|
+
application.ticker.minFPS = props.frameRate;
|
|
25820
|
+
application.ticker.maxFPS = props.frameRate;
|
|
25821
|
+
emit("update:status", TickerStatus.playing);
|
|
25822
|
+
application.ticker.add(drawFrame);
|
|
25823
|
+
}
|
|
25824
|
+
function pause() {
|
|
25825
|
+
application.ticker.remove(drawFrame);
|
|
25826
|
+
emit("update:status", TickerStatus.paused);
|
|
25827
|
+
}
|
|
25828
|
+
function stop() {
|
|
25829
|
+
application.ticker.remove(drawFrame);
|
|
25830
|
+
emit("update:status", TickerStatus.stopped);
|
|
25831
|
+
}
|
|
25832
|
+
onBeforeUnmount(() => {
|
|
25833
|
+
stop();
|
|
25834
|
+
texture.destroy();
|
|
25835
|
+
});
|
|
25836
|
+
const __returned__ = { props, emit, sprite, resizeSprite, application, texture, updateTextureFromBitmap, drawFrame, play, pause, stop };
|
|
25837
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
25838
|
+
return __returned__;
|
|
25839
|
+
}
|
|
25840
|
+
});
|
|
25841
|
+
|
|
25760
25842
|
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
25761
25843
|
return renderSlot(_ctx.$slots, "default");
|
|
25762
25844
|
}
|
|
25763
|
-
var
|
|
25845
|
+
var bitmapGenerator = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/bitmap-generator.vue"]]);
|
|
25764
25846
|
|
|
25765
25847
|
var _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
25766
25848
|
__name: "bitmap",
|
|
@@ -25786,42 +25868,20 @@ var _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
25786
25868
|
__expose();
|
|
25787
25869
|
const props = __props;
|
|
25788
25870
|
const emit = __emit;
|
|
25789
|
-
const compId = useId();
|
|
25790
|
-
const getAlias = (key) => `${compId}-${key}`;
|
|
25791
25871
|
const { sprite, resizeSprite, application } = useSprite(props);
|
|
25792
|
-
const
|
|
25793
|
-
|
|
25794
|
-
const enabledData = computed(() => {
|
|
25795
|
-
return props.data.slice(completedIndex.value);
|
|
25796
|
-
});
|
|
25797
|
-
watchEffect(() => {
|
|
25798
|
-
for (const key in enabledData.value) {
|
|
25799
|
-
const theKey = +key + completedIndex.value;
|
|
25800
|
-
const alias = `${compId}-${theKey}`;
|
|
25801
|
-
const image = enabledData.value[key];
|
|
25802
|
-
if (!image) {
|
|
25803
|
-
continue;
|
|
25804
|
-
}
|
|
25805
|
-
if (textureMap.has(alias)) {
|
|
25806
|
-
continue;
|
|
25807
|
-
}
|
|
25808
|
-
const source = new ImageSource({
|
|
25809
|
-
resource: image
|
|
25810
|
-
});
|
|
25811
|
-
const texture = new Texture({
|
|
25812
|
-
source
|
|
25813
|
-
});
|
|
25814
|
-
textureMap.set(alias, void 0);
|
|
25815
|
-
nextTick(() => {
|
|
25816
|
-
texture._meta = enabledData.value[key];
|
|
25817
|
-
textureMap.set(alias, texture);
|
|
25818
|
-
if (props.prerender && theKey === 0) {
|
|
25819
|
-
sprite.texture = texture;
|
|
25820
|
-
resizeSprite();
|
|
25821
|
-
}
|
|
25822
|
-
});
|
|
25823
|
-
}
|
|
25872
|
+
const texture = new Texture({
|
|
25873
|
+
dynamic: true
|
|
25824
25874
|
});
|
|
25875
|
+
sprite.texture = texture;
|
|
25876
|
+
function updateTextureFromBitmap(bitmap) {
|
|
25877
|
+
texture.source?.destroy();
|
|
25878
|
+
const source = new ImageSource({
|
|
25879
|
+
resource: bitmap
|
|
25880
|
+
});
|
|
25881
|
+
texture.source = source;
|
|
25882
|
+
texture.update();
|
|
25883
|
+
resizeSprite();
|
|
25884
|
+
}
|
|
25825
25885
|
emit("load", {
|
|
25826
25886
|
application,
|
|
25827
25887
|
sprite
|
|
@@ -25830,40 +25890,42 @@ var _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
25830
25890
|
default: 0,
|
|
25831
25891
|
key: "frameIndex"
|
|
25832
25892
|
}, props, emit);
|
|
25893
|
+
const lastScheduledClearIndex = ref(-1);
|
|
25894
|
+
function scheduleClearFrame(frameIndex) {
|
|
25895
|
+
if (frameIndex <= lastScheduledClearIndex.value)
|
|
25896
|
+
return;
|
|
25897
|
+
lastScheduledClearIndex.value = frameIndex;
|
|
25898
|
+
Promise.resolve(sleep(500)).then(() => {
|
|
25899
|
+
emit("setData", {
|
|
25900
|
+
k: frameIndex,
|
|
25901
|
+
v: null
|
|
25902
|
+
});
|
|
25903
|
+
});
|
|
25904
|
+
}
|
|
25833
25905
|
function drawFrame() {
|
|
25834
25906
|
if (props.data.length === 0 || props.status !== TickerStatus.playing) {
|
|
25835
25907
|
return;
|
|
25836
25908
|
}
|
|
25837
|
-
const
|
|
25838
|
-
|
|
25839
|
-
);
|
|
25840
|
-
if (currentTexture) {
|
|
25841
|
-
const originTexture = sprite.texture;
|
|
25909
|
+
const bitmap = props.data[index.value];
|
|
25910
|
+
if (bitmap) {
|
|
25842
25911
|
const originIndex = index.value - 1;
|
|
25843
|
-
if (
|
|
25844
|
-
|
|
25845
|
-
originTexture.destroy(true);
|
|
25846
|
-
textureMap.set(
|
|
25847
|
-
getAlias(originIndex),
|
|
25848
|
-
void 0
|
|
25849
|
-
);
|
|
25850
|
-
emit("setData", {
|
|
25851
|
-
k: originIndex,
|
|
25852
|
-
v: null
|
|
25853
|
-
});
|
|
25854
|
-
completedIndex.value = originIndex;
|
|
25855
|
-
});
|
|
25912
|
+
if (originIndex >= 0) {
|
|
25913
|
+
scheduleClearFrame(originIndex);
|
|
25856
25914
|
}
|
|
25857
|
-
|
|
25858
|
-
resizeSprite();
|
|
25915
|
+
updateTextureFromBitmap(bitmap);
|
|
25859
25916
|
index.value = index.value + 1;
|
|
25860
25917
|
} else {
|
|
25861
25918
|
console.warn(
|
|
25862
|
-
`
|
|
25919
|
+
`Bitmap for index ${index.value} not found. Ensure the data is loaded.`
|
|
25863
25920
|
);
|
|
25864
25921
|
emit("notFound", index.value);
|
|
25865
25922
|
}
|
|
25866
25923
|
}
|
|
25924
|
+
watchEffect(() => {
|
|
25925
|
+
if (props.prerender && index.value === 0 && props.data.length > 0 && props.data[0]) {
|
|
25926
|
+
updateTextureFromBitmap(props.data[0]);
|
|
25927
|
+
}
|
|
25928
|
+
});
|
|
25867
25929
|
watch(() => props.status, (newStatus) => {
|
|
25868
25930
|
newStatus === TickerStatus.play && play();
|
|
25869
25931
|
newStatus === TickerStatus.pause && pause();
|
|
@@ -25880,25 +25942,21 @@ var _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
25880
25942
|
}
|
|
25881
25943
|
}
|
|
25882
25944
|
function pause() {
|
|
25945
|
+
application.ticker.remove(drawFrame);
|
|
25883
25946
|
emit("update:status", TickerStatus.paused);
|
|
25884
25947
|
}
|
|
25885
25948
|
function stop() {
|
|
25886
|
-
emit("update:status", TickerStatus.stopped);
|
|
25887
25949
|
application.ticker.remove(drawFrame);
|
|
25950
|
+
emit("update:status", TickerStatus.stopped);
|
|
25888
25951
|
emit("update:data", []);
|
|
25889
|
-
textureMap.clear();
|
|
25890
25952
|
index.value = 0;
|
|
25953
|
+
lastScheduledClearIndex.value = -1;
|
|
25891
25954
|
}
|
|
25892
25955
|
onBeforeUnmount(() => {
|
|
25893
|
-
const entries = Array.from(textureMap.entries());
|
|
25894
|
-
entries.forEach(([_, texture]) => {
|
|
25895
|
-
if (texture) {
|
|
25896
|
-
texture.destroy(true);
|
|
25897
|
-
}
|
|
25898
|
-
});
|
|
25899
25956
|
stop();
|
|
25957
|
+
texture.destroy();
|
|
25900
25958
|
});
|
|
25901
|
-
const __returned__ = { props, emit,
|
|
25959
|
+
const __returned__ = { props, emit, sprite, resizeSprite, application, texture, updateTextureFromBitmap, index, lastScheduledClearIndex, scheduleClearFrame, drawFrame, play, pause, stop };
|
|
25902
25960
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
25903
25961
|
return __returned__;
|
|
25904
25962
|
}
|
|
@@ -26376,4 +26434,4 @@ VkPixiFrame.install = (app) => {
|
|
|
26376
26434
|
app.component(VkPixiFrame.name || "VkPixiFrame", VkPixiFrame);
|
|
26377
26435
|
};
|
|
26378
26436
|
|
|
26379
|
-
export { deprecation as $, AbstractRenderer as A, BufferUsage as B, Container as C, DOMAdapter as D, ExtensionType as E, Bounds as F, GpuProgram as G, FilterEffect as H, Sprite as I, getAttributeInfoFromFormat as J, unsafeEvalSupported as K, uid as L, Matrix as M, Rectangle as N, SystemRunner as O, Point as P, multiplyColors as Q, RendererType as R, STENCIL_MODES as S, Ticker as T, UPDATE_PRIORITY as U, UPDATE_COLOR as V, UPDATE_BLEND as W, UPDATE_VISIBLE as X, Color as Y, getLocalBounds as Z, VERSION as _, EventEmitter as a, v8_0_0 as a0, RendererInitHook as a1, Geometry as a2, checkMaxIfStatementsInShader as a3, compileHighShaderGlProgram as a4, colorBitGl as a5, generateTextureBatchBitGl as a6, roundPixelsBitGl as a7, getBatchSamplersUniformGroup as a8, ViewContainer as a9, GraphicsContext as aa, nextPow2 as ab, CanvasTextMetrics as ac, fontStringFromTextStyle as ad, getCanvasFillStyle as ae, TextStyle as af, BatchableGraphics as ag, getAdjustedBlendModeBlend as ah, ViewableBuffer as ai, TextureStyle as aj, BitmapFontManager as ak, getBitmapTextLayout as al, Cache as am, updateQuadBounds as an, GraphicsContextSystem as ao, VkPixiFrame as ap, ApngComp as aq, Bitmap as ar,
|
|
26437
|
+
export { deprecation as $, AbstractRenderer as A, BufferUsage as B, Container as C, DOMAdapter as D, ExtensionType as E, Bounds as F, GpuProgram as G, FilterEffect as H, Sprite as I, getAttributeInfoFromFormat as J, unsafeEvalSupported as K, uid as L, Matrix as M, Rectangle as N, SystemRunner as O, Point as P, multiplyColors as Q, RendererType as R, STENCIL_MODES as S, Ticker as T, UPDATE_PRIORITY as U, UPDATE_COLOR as V, UPDATE_BLEND as W, UPDATE_VISIBLE as X, Color as Y, getLocalBounds as Z, VERSION as _, EventEmitter as a, v8_0_0 as a0, RendererInitHook as a1, Geometry as a2, checkMaxIfStatementsInShader as a3, compileHighShaderGlProgram as a4, colorBitGl as a5, generateTextureBatchBitGl as a6, roundPixelsBitGl as a7, getBatchSamplersUniformGroup as a8, ViewContainer as a9, GraphicsContext as aa, nextPow2 as ab, CanvasTextMetrics as ac, fontStringFromTextStyle as ad, getCanvasFillStyle as ae, TextStyle as af, BatchableGraphics as ag, getAdjustedBlendModeBlend as ah, ViewableBuffer as ai, TextureStyle as aj, BitmapFontManager as ak, getBitmapTextLayout as al, Cache as am, updateQuadBounds as an, GraphicsContextSystem as ao, VkPixiFrame as ap, ApngComp as aq, Bitmap as ar, bitmapGenerator as as, core as at, ProviderComp as au, VideoComp as av, ViewComp as aw, types as ax, usePixiApp as ay, useSprite as az, Buffer as b, BindGroup as c, createIdFromString as d, extensions as e, fastCopy as f, getTextureBatchBindGroup as g, CLEAR as h, CanvasSource as i, TextureSource as j, UniformGroup as k, CanvasPool as l, compileHighShaderGpuProgram as m, colorBit as n, generateTextureBatchBit as o, roundPixelsBit as p, Shader as q, removeItems as r, Texture as s, GlProgram as t, TextureMatrix as u, DefaultBatcher as v, warn as w, BigPool as x, getGlobalBounds as y, TexturePool as z };
|