@vunk/plus 1.12.1 → 1.13.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/_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 +75 -73
- package/components/monaco-editor/src/ctx.d.ts +10 -4
- package/components/monaco-editor/src/index.vue.d.ts +17 -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 +501 -1978
- 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 +12 -12
- package/components/table-columns/src/el-ctx.d.ts +3 -3
- package/components/table-columns/src/index.vue.d.ts +28 -27
- package/components/tables-v1/index.cjs +1 -0
- package/components/tables-v1/index.mjs +99 -160
- package/components/tables-v1/src/ctx.d.ts +38 -38
- package/components/tables-v1/src/el-ctx.d.ts +7 -7
- package/components/tables-v1/src/index.vue.d.ts +111 -2266
- package/components/tables-v1-checkbox/index.cjs +1 -0
- package/components/tables-v1-checkbox/index.mjs +116 -4043
- package/components/tables-v1-checkbox/src/ctx.d.ts +36 -36
- package/components/tables-v1-checkbox/src/index.vue.d.ts +224 -2378
- package/components/text/index.cjs +1 -0
- package/components/text/index.mjs +70 -108
- package/components/text/src/ctx.d.ts +32 -32
- 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 +23 -2045
- 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
|
@@ -1,1003 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TickerStatus } from
|
|
3
|
-
|
|
4
|
-
import { Deferred, sleep } from
|
|
5
|
-
import
|
|
6
|
-
import { Application, Sprite, Assets, Texture, ImageSource, BufferImageSource } from
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
var lib = {exports: {}};
|
|
12
|
-
|
|
13
|
-
(function (module, exports) {
|
|
14
|
-
(function webpackUniversalModuleDefinition(root, factory) {
|
|
15
|
-
module.exports = factory();
|
|
16
|
-
})(commonjsGlobal, function() {
|
|
17
|
-
return /******/ (function(modules) { // webpackBootstrap
|
|
18
|
-
/******/ // The module cache
|
|
19
|
-
/******/ var installedModules = {};
|
|
20
|
-
|
|
21
|
-
/******/ // The require function
|
|
22
|
-
/******/ function __webpack_require__(moduleId) {
|
|
23
|
-
|
|
24
|
-
/******/ // Check if module is in cache
|
|
25
|
-
/******/ if(installedModules[moduleId])
|
|
26
|
-
/******/ return installedModules[moduleId].exports;
|
|
27
|
-
|
|
28
|
-
/******/ // Create a new module (and put it into the cache)
|
|
29
|
-
/******/ var module = installedModules[moduleId] = {
|
|
30
|
-
/******/ exports: {},
|
|
31
|
-
/******/ id: moduleId,
|
|
32
|
-
/******/ loaded: false
|
|
33
|
-
/******/ };
|
|
34
|
-
|
|
35
|
-
/******/ // Execute the module function
|
|
36
|
-
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
37
|
-
|
|
38
|
-
/******/ // Flag the module as loaded
|
|
39
|
-
/******/ module.loaded = true;
|
|
40
|
-
|
|
41
|
-
/******/ // Return the exports of the module
|
|
42
|
-
/******/ return module.exports;
|
|
43
|
-
/******/ }
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/******/ // expose the modules object (__webpack_modules__)
|
|
47
|
-
/******/ __webpack_require__.m = modules;
|
|
48
|
-
|
|
49
|
-
/******/ // expose the module cache
|
|
50
|
-
/******/ __webpack_require__.c = installedModules;
|
|
51
|
-
|
|
52
|
-
/******/ // __webpack_public_path__
|
|
53
|
-
/******/ __webpack_require__.p = "";
|
|
54
|
-
|
|
55
|
-
/******/ // Load entry module and return exports
|
|
56
|
-
/******/ return __webpack_require__(0);
|
|
57
|
-
/******/ })
|
|
58
|
-
/************************************************************************/
|
|
59
|
-
/******/ ([
|
|
60
|
-
/* 0 */
|
|
61
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
62
|
-
|
|
63
|
-
Object.defineProperty(exports, "__esModule", {
|
|
64
|
-
value: true
|
|
65
|
-
});
|
|
66
|
-
exports.isNotPNG = isNotPNG;
|
|
67
|
-
exports.isNotAPNG = isNotAPNG;
|
|
68
|
-
exports.default = parseAPNG;
|
|
69
|
-
|
|
70
|
-
var _crc = __webpack_require__(1);
|
|
71
|
-
|
|
72
|
-
var _crc2 = _interopRequireDefault(_crc);
|
|
73
|
-
|
|
74
|
-
var _structs = __webpack_require__(2);
|
|
75
|
-
|
|
76
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
77
|
-
|
|
78
|
-
var errNotPNG = new Error('Not a PNG');
|
|
79
|
-
var errNotAPNG = new Error('Not an animated PNG');
|
|
80
|
-
|
|
81
|
-
function isNotPNG(err) {
|
|
82
|
-
return err === errNotPNG;
|
|
83
|
-
}
|
|
84
|
-
function isNotAPNG(err) {
|
|
85
|
-
return err === errNotAPNG;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// '\x89PNG\x0d\x0a\x1a\x0a'
|
|
89
|
-
var PNGSignature = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Parse APNG data
|
|
93
|
-
* @param {ArrayBuffer} buffer
|
|
94
|
-
* @return {APNG|Error}
|
|
95
|
-
*/
|
|
96
|
-
function parseAPNG(buffer) {
|
|
97
|
-
var bytes = new Uint8Array(buffer);
|
|
98
|
-
|
|
99
|
-
if (Array.prototype.some.call(PNGSignature, function (b, i) {
|
|
100
|
-
return b !== bytes[i];
|
|
101
|
-
})) {
|
|
102
|
-
return errNotPNG;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// fast animation test
|
|
106
|
-
var isAnimated = false;
|
|
107
|
-
eachChunk(bytes, function (type) {
|
|
108
|
-
return !(isAnimated = type === 'acTL');
|
|
109
|
-
});
|
|
110
|
-
if (!isAnimated) {
|
|
111
|
-
return errNotAPNG;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
var preDataParts = [],
|
|
115
|
-
postDataParts = [];
|
|
116
|
-
var headerDataBytes = null,
|
|
117
|
-
frame = null,
|
|
118
|
-
frameNumber = 0,
|
|
119
|
-
apng = new _structs.APNG();
|
|
120
|
-
|
|
121
|
-
eachChunk(bytes, function (type, bytes, off, length) {
|
|
122
|
-
var dv = new DataView(bytes.buffer);
|
|
123
|
-
switch (type) {
|
|
124
|
-
case 'IHDR':
|
|
125
|
-
headerDataBytes = bytes.subarray(off + 8, off + 8 + length);
|
|
126
|
-
apng.width = dv.getUint32(off + 8);
|
|
127
|
-
apng.height = dv.getUint32(off + 12);
|
|
128
|
-
break;
|
|
129
|
-
case 'acTL':
|
|
130
|
-
apng.numPlays = dv.getUint32(off + 8 + 4);
|
|
131
|
-
break;
|
|
132
|
-
case 'fcTL':
|
|
133
|
-
if (frame) {
|
|
134
|
-
apng.frames.push(frame);
|
|
135
|
-
frameNumber++;
|
|
136
|
-
}
|
|
137
|
-
frame = new _structs.Frame();
|
|
138
|
-
frame.width = dv.getUint32(off + 8 + 4);
|
|
139
|
-
frame.height = dv.getUint32(off + 8 + 8);
|
|
140
|
-
frame.left = dv.getUint32(off + 8 + 12);
|
|
141
|
-
frame.top = dv.getUint32(off + 8 + 16);
|
|
142
|
-
var delayN = dv.getUint16(off + 8 + 20);
|
|
143
|
-
var delayD = dv.getUint16(off + 8 + 22);
|
|
144
|
-
if (delayD === 0) {
|
|
145
|
-
delayD = 100;
|
|
146
|
-
}
|
|
147
|
-
frame.delay = 1000 * delayN / delayD;
|
|
148
|
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=125137
|
|
149
|
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=139677
|
|
150
|
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=207059
|
|
151
|
-
if (frame.delay <= 10) {
|
|
152
|
-
frame.delay = 100;
|
|
153
|
-
}
|
|
154
|
-
apng.playTime += frame.delay;
|
|
155
|
-
frame.disposeOp = dv.getUint8(off + 8 + 24);
|
|
156
|
-
frame.blendOp = dv.getUint8(off + 8 + 25);
|
|
157
|
-
frame.dataParts = [];
|
|
158
|
-
if (frameNumber === 0 && frame.disposeOp === 2) {
|
|
159
|
-
frame.disposeOp = 1;
|
|
160
|
-
}
|
|
161
|
-
break;
|
|
162
|
-
case 'fdAT':
|
|
163
|
-
if (frame) {
|
|
164
|
-
frame.dataParts.push(bytes.subarray(off + 8 + 4, off + 8 + length));
|
|
165
|
-
}
|
|
166
|
-
break;
|
|
167
|
-
case 'IDAT':
|
|
168
|
-
if (frame) {
|
|
169
|
-
frame.dataParts.push(bytes.subarray(off + 8, off + 8 + length));
|
|
170
|
-
}
|
|
171
|
-
break;
|
|
172
|
-
case 'IEND':
|
|
173
|
-
postDataParts.push(subBuffer(bytes, off, 12 + length));
|
|
174
|
-
break;
|
|
175
|
-
default:
|
|
176
|
-
preDataParts.push(subBuffer(bytes, off, 12 + length));
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
if (frame) {
|
|
181
|
-
apng.frames.push(frame);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
if (apng.frames.length == 0) {
|
|
185
|
-
return errNotAPNG;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
var preBlob = new Blob(preDataParts),
|
|
189
|
-
postBlob = new Blob(postDataParts);
|
|
190
|
-
|
|
191
|
-
apng.frames.forEach(function (frame) {
|
|
192
|
-
var bb = [];
|
|
193
|
-
bb.push(PNGSignature);
|
|
194
|
-
headerDataBytes.set(makeDWordArray(frame.width), 0);
|
|
195
|
-
headerDataBytes.set(makeDWordArray(frame.height), 4);
|
|
196
|
-
bb.push(makeChunkBytes('IHDR', headerDataBytes));
|
|
197
|
-
bb.push(preBlob);
|
|
198
|
-
frame.dataParts.forEach(function (p) {
|
|
199
|
-
return bb.push(makeChunkBytes('IDAT', p));
|
|
200
|
-
});
|
|
201
|
-
bb.push(postBlob);
|
|
202
|
-
frame.imageData = new Blob(bb, { 'type': 'image/png' });
|
|
203
|
-
delete frame.dataParts;
|
|
204
|
-
bb = null;
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
return apng;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* @param {Uint8Array} bytes
|
|
212
|
-
* @param {function(string, Uint8Array, int, int): boolean} callback
|
|
213
|
-
*/
|
|
214
|
-
function eachChunk(bytes, callback) {
|
|
215
|
-
var dv = new DataView(bytes.buffer);
|
|
216
|
-
var off = 8,
|
|
217
|
-
type = void 0,
|
|
218
|
-
length = void 0,
|
|
219
|
-
res = void 0;
|
|
220
|
-
do {
|
|
221
|
-
length = dv.getUint32(off);
|
|
222
|
-
type = readString(bytes, off + 4, 4);
|
|
223
|
-
res = callback(type, bytes, off, length);
|
|
224
|
-
off += 12 + length;
|
|
225
|
-
} while (res !== false && type != 'IEND' && off < bytes.length);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
*
|
|
230
|
-
* @param {Uint8Array} bytes
|
|
231
|
-
* @param {number} off
|
|
232
|
-
* @param {number} length
|
|
233
|
-
* @return {string}
|
|
234
|
-
*/
|
|
235
|
-
function readString(bytes, off, length) {
|
|
236
|
-
var chars = Array.prototype.slice.call(bytes.subarray(off, off + length));
|
|
237
|
-
return String.fromCharCode.apply(String, chars);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
*
|
|
242
|
-
* @param {string} x
|
|
243
|
-
* @return {Uint8Array}
|
|
244
|
-
*/
|
|
245
|
-
function makeStringArray(x) {
|
|
246
|
-
var res = new Uint8Array(x.length);
|
|
247
|
-
for (var i = 0; i < x.length; i++) {
|
|
248
|
-
res[i] = x.charCodeAt(i);
|
|
249
|
-
}
|
|
250
|
-
return res;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* @param {Uint8Array} bytes
|
|
255
|
-
* @param {int} start
|
|
256
|
-
* @param {int} length
|
|
257
|
-
* @return {Uint8Array}
|
|
258
|
-
*/
|
|
259
|
-
function subBuffer(bytes, start, length) {
|
|
260
|
-
var a = new Uint8Array(length);
|
|
261
|
-
a.set(bytes.subarray(start, start + length));
|
|
262
|
-
return a;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* @param {string} type
|
|
267
|
-
* @param {Uint8Array} dataBytes
|
|
268
|
-
* @return {Uint8Array}
|
|
269
|
-
*/
|
|
270
|
-
var makeChunkBytes = function makeChunkBytes(type, dataBytes) {
|
|
271
|
-
var crcLen = type.length + dataBytes.length;
|
|
272
|
-
var bytes = new Uint8Array(crcLen + 8);
|
|
273
|
-
var dv = new DataView(bytes.buffer);
|
|
274
|
-
|
|
275
|
-
dv.setUint32(0, dataBytes.length);
|
|
276
|
-
bytes.set(makeStringArray(type), 4);
|
|
277
|
-
bytes.set(dataBytes, 8);
|
|
278
|
-
var crc = (0, _crc2.default)(bytes, 4, crcLen);
|
|
279
|
-
dv.setUint32(crcLen + 4, crc);
|
|
280
|
-
return bytes;
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
var makeDWordArray = function makeDWordArray(x) {
|
|
284
|
-
return new Uint8Array([x >>> 24 & 0xff, x >>> 16 & 0xff, x >>> 8 & 0xff, x & 0xff]);
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
/***/ }),
|
|
288
|
-
/* 1 */
|
|
289
|
-
/***/ (function(module, exports) {
|
|
290
|
-
|
|
291
|
-
Object.defineProperty(exports, "__esModule", {
|
|
292
|
-
value: true
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
exports.default = function (bytes) {
|
|
296
|
-
var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
297
|
-
var length = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : bytes.length - start;
|
|
298
|
-
|
|
299
|
-
var crc = -1;
|
|
300
|
-
for (var _i = start, l = start + length; _i < l; _i++) {
|
|
301
|
-
crc = crc >>> 8 ^ table[(crc ^ bytes[_i]) & 0xFF];
|
|
302
|
-
}
|
|
303
|
-
return crc ^ -1;
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
var table = new Uint32Array(256);
|
|
307
|
-
|
|
308
|
-
for (var i = 0; i < 256; i++) {
|
|
309
|
-
var c = i;
|
|
310
|
-
for (var k = 0; k < 8; k++) {
|
|
311
|
-
c = (c & 1) !== 0 ? 0xEDB88320 ^ c >>> 1 : c >>> 1;
|
|
312
|
-
}
|
|
313
|
-
table[i] = c;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
*
|
|
318
|
-
* @param {Uint8Array} bytes
|
|
319
|
-
* @param {number} start
|
|
320
|
-
* @param {number} length
|
|
321
|
-
* @return {number}
|
|
322
|
-
*/
|
|
323
|
-
|
|
324
|
-
/***/ }),
|
|
325
|
-
/* 2 */
|
|
326
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
327
|
-
|
|
328
|
-
Object.defineProperty(exports, "__esModule", {
|
|
329
|
-
value: true
|
|
330
|
-
});
|
|
331
|
-
exports.Frame = exports.APNG = undefined;
|
|
332
|
-
|
|
333
|
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
334
|
-
|
|
335
|
-
var _player = __webpack_require__(3);
|
|
336
|
-
|
|
337
|
-
var _player2 = _interopRequireDefault(_player);
|
|
338
|
-
|
|
339
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
340
|
-
|
|
341
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* @property {number} currFrameNumber
|
|
345
|
-
* @property {Frame} currFrame
|
|
346
|
-
* @property {boolean} paused
|
|
347
|
-
* @property {boolean} ended
|
|
348
|
-
*/
|
|
349
|
-
exports.APNG = function () {
|
|
350
|
-
function APNG() {
|
|
351
|
-
_classCallCheck(this, APNG);
|
|
352
|
-
|
|
353
|
-
this.width = 0;
|
|
354
|
-
this.height = 0;
|
|
355
|
-
this.numPlays = 0;
|
|
356
|
-
this.playTime = 0;
|
|
357
|
-
this.frames = [];
|
|
358
|
-
}
|
|
359
|
-
/** @type {number} */
|
|
360
|
-
|
|
361
|
-
/** @type {number} */
|
|
362
|
-
|
|
363
|
-
/** @type {number} */
|
|
364
|
-
|
|
365
|
-
/** @type {number} */
|
|
366
|
-
|
|
367
|
-
/** @type {Frame[]} */
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
_createClass(APNG, [{
|
|
371
|
-
key: 'createImages',
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
*
|
|
376
|
-
* @return {Promise.<*>}
|
|
377
|
-
*/
|
|
378
|
-
value: function createImages() {
|
|
379
|
-
return Promise.all(this.frames.map(function (f) {
|
|
380
|
-
return f.createImage();
|
|
381
|
-
}));
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
*
|
|
386
|
-
* @param {CanvasRenderingContext2D} context
|
|
387
|
-
* @param {boolean} autoPlay
|
|
388
|
-
* @return {Promise.<Player>}
|
|
389
|
-
*/
|
|
390
|
-
|
|
391
|
-
}, {
|
|
392
|
-
key: 'getPlayer',
|
|
393
|
-
value: function getPlayer(context) {
|
|
394
|
-
var _this = this;
|
|
395
|
-
|
|
396
|
-
var autoPlay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
397
|
-
|
|
398
|
-
return this.createImages().then(function () {
|
|
399
|
-
return new _player2.default(_this, context, autoPlay);
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
}]);
|
|
403
|
-
|
|
404
|
-
return APNG;
|
|
405
|
-
}();
|
|
406
|
-
|
|
407
|
-
exports.Frame = function () {
|
|
408
|
-
function Frame() {
|
|
409
|
-
_classCallCheck(this, Frame);
|
|
410
|
-
|
|
411
|
-
this.left = 0;
|
|
412
|
-
this.top = 0;
|
|
413
|
-
this.width = 0;
|
|
414
|
-
this.height = 0;
|
|
415
|
-
this.delay = 0;
|
|
416
|
-
this.disposeOp = 0;
|
|
417
|
-
this.blendOp = 0;
|
|
418
|
-
this.imageData = null;
|
|
419
|
-
this.imageElement = null;
|
|
420
|
-
}
|
|
421
|
-
/** @type {number} */
|
|
422
|
-
|
|
423
|
-
/** @type {number} */
|
|
424
|
-
|
|
425
|
-
/** @type {number} */
|
|
426
|
-
|
|
427
|
-
/** @type {number} */
|
|
428
|
-
|
|
429
|
-
/** @type {number} */
|
|
430
|
-
|
|
431
|
-
/** @type {number} */
|
|
432
|
-
|
|
433
|
-
/** @type {number} */
|
|
434
|
-
|
|
435
|
-
/** @type {Blob} */
|
|
436
|
-
|
|
437
|
-
/** @type {HTMLImageElement} */
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
_createClass(Frame, [{
|
|
441
|
-
key: 'createImage',
|
|
442
|
-
value: function createImage() {
|
|
443
|
-
var _this2 = this;
|
|
444
|
-
|
|
445
|
-
if (this.imageElement) {
|
|
446
|
-
return Promise.resolve();
|
|
447
|
-
}
|
|
448
|
-
return new Promise(function (resolve, reject) {
|
|
449
|
-
var url = URL.createObjectURL(_this2.imageData);
|
|
450
|
-
_this2.imageElement = document.createElement('img');
|
|
451
|
-
_this2.imageElement.onload = function () {
|
|
452
|
-
URL.revokeObjectURL(url);
|
|
453
|
-
resolve();
|
|
454
|
-
};
|
|
455
|
-
_this2.imageElement.onerror = function () {
|
|
456
|
-
URL.revokeObjectURL(url);
|
|
457
|
-
_this2.imageElement = null;
|
|
458
|
-
reject(new Error("Image creation error"));
|
|
459
|
-
};
|
|
460
|
-
_this2.imageElement.src = url;
|
|
461
|
-
});
|
|
462
|
-
}
|
|
463
|
-
}]);
|
|
464
|
-
|
|
465
|
-
return Frame;
|
|
466
|
-
}();
|
|
467
|
-
|
|
468
|
-
/***/ }),
|
|
469
|
-
/* 3 */
|
|
470
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
471
|
-
|
|
472
|
-
Object.defineProperty(exports, "__esModule", {
|
|
473
|
-
value: true
|
|
474
|
-
});
|
|
475
|
-
|
|
476
|
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
477
|
-
|
|
478
|
-
var _events = __webpack_require__(4);
|
|
479
|
-
|
|
480
|
-
var _events2 = _interopRequireDefault(_events);
|
|
481
|
-
|
|
482
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
483
|
-
|
|
484
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
485
|
-
|
|
486
|
-
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
487
|
-
|
|
488
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
489
|
-
|
|
490
|
-
var _class = function (_EventEmitter) {
|
|
491
|
-
_inherits(_class, _EventEmitter);
|
|
492
|
-
|
|
493
|
-
/**
|
|
494
|
-
* @param {APNG} apng
|
|
495
|
-
* @param {CanvasRenderingContext2D} context
|
|
496
|
-
* @param {boolean} autoPlay
|
|
497
|
-
*/
|
|
498
|
-
|
|
499
|
-
/** @type {number} */
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
/** @type {boolean} */
|
|
503
|
-
|
|
504
|
-
/** @type {ImageData} */
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
/** @type {APNG} */
|
|
508
|
-
|
|
509
|
-
/** @type {CanvasRenderingContext2D} */
|
|
510
|
-
function _class(apng, context, autoPlay) {
|
|
511
|
-
_classCallCheck(this, _class);
|
|
512
|
-
|
|
513
|
-
var _this = _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).call(this));
|
|
514
|
-
|
|
515
|
-
_this.playbackRate = 1.0;
|
|
516
|
-
_this._currentFrameNumber = 0;
|
|
517
|
-
_this._ended = false;
|
|
518
|
-
_this._paused = true;
|
|
519
|
-
_this._numPlays = 0;
|
|
520
|
-
_this._rafId = null;
|
|
521
|
-
|
|
522
|
-
_this._apng = apng;
|
|
523
|
-
_this.context = context;
|
|
524
|
-
_this.stop();
|
|
525
|
-
if (autoPlay) {
|
|
526
|
-
_this.play();
|
|
527
|
-
}
|
|
528
|
-
return _this;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
/**
|
|
532
|
-
*
|
|
533
|
-
* @return {number}
|
|
534
|
-
*/
|
|
535
|
-
|
|
536
|
-
/** @type {number|null} */
|
|
537
|
-
|
|
538
|
-
/** @type {boolean} */
|
|
539
|
-
|
|
540
|
-
/** @type {number} */
|
|
541
|
-
|
|
542
|
-
/** @type {Frame} */
|
|
543
|
-
|
|
544
|
-
/** @type {number} */
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
_createClass(_class, [{
|
|
548
|
-
key: 'renderNextFrame',
|
|
549
|
-
value: function renderNextFrame() {
|
|
550
|
-
this._currentFrameNumber = (this._currentFrameNumber + 1) % this._apng.frames.length;
|
|
551
|
-
if (this._currentFrameNumber === this._apng.frames.length - 1) {
|
|
552
|
-
this._numPlays++;
|
|
553
|
-
if (this._apng.numPlays !== 0 && this._numPlays >= this._apng.numPlays) {
|
|
554
|
-
this._ended = true;
|
|
555
|
-
this._paused = true;
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
if (this._prevFrame && this._prevFrame.disposeOp == 1) {
|
|
560
|
-
this.context.clearRect(this._prevFrame.left, this._prevFrame.top, this._prevFrame.width, this._prevFrame.height);
|
|
561
|
-
} else if (this._prevFrame && this._prevFrame.disposeOp == 2) {
|
|
562
|
-
this.context.putImageData(this._prevFrameData, this._prevFrame.left, this._prevFrame.top);
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
var frame = this.currentFrame;
|
|
566
|
-
this._prevFrame = frame;
|
|
567
|
-
this._prevFrameData = null;
|
|
568
|
-
if (frame.disposeOp == 2) {
|
|
569
|
-
this._prevFrameData = this.context.getImageData(frame.left, frame.top, frame.width, frame.height);
|
|
570
|
-
}
|
|
571
|
-
if (frame.blendOp == 0) {
|
|
572
|
-
this.context.clearRect(frame.left, frame.top, frame.width, frame.height);
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
this.context.drawImage(frame.imageElement, frame.left, frame.top);
|
|
576
|
-
|
|
577
|
-
this.emit('frame', this._currentFrameNumber);
|
|
578
|
-
if (this._ended) {
|
|
579
|
-
this.emit('end');
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
// playback
|
|
584
|
-
|
|
585
|
-
}, {
|
|
586
|
-
key: 'play',
|
|
587
|
-
value: function play() {
|
|
588
|
-
var _this2 = this;
|
|
589
|
-
|
|
590
|
-
if (this._rafId) {
|
|
591
|
-
cancelAnimationFrame(this._rafId);
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
this.emit('play');
|
|
595
|
-
|
|
596
|
-
if (this._ended) {
|
|
597
|
-
this.stop();
|
|
598
|
-
}
|
|
599
|
-
this._paused = false;
|
|
600
|
-
|
|
601
|
-
var nextRenderTime = performance.now() + this.currentFrame.delay / this.playbackRate;
|
|
602
|
-
var tick = function tick(now) {
|
|
603
|
-
if (_this2._ended || _this2._paused) {
|
|
604
|
-
return;
|
|
605
|
-
}
|
|
606
|
-
if (now >= nextRenderTime) {
|
|
607
|
-
while (now - nextRenderTime >= _this2._apng.playTime / _this2.playbackRate) {
|
|
608
|
-
nextRenderTime += _this2._apng.playTime / _this2.playbackRate;
|
|
609
|
-
_this2._numPlays++;
|
|
610
|
-
}
|
|
611
|
-
do {
|
|
612
|
-
_this2.renderNextFrame();
|
|
613
|
-
nextRenderTime += _this2.currentFrame.delay / _this2.playbackRate;
|
|
614
|
-
} while (!_this2._ended && !_this2._paused && now > nextRenderTime);
|
|
615
|
-
}
|
|
616
|
-
_this2._rafId = requestAnimationFrame(tick);
|
|
617
|
-
};
|
|
618
|
-
this._rafId = requestAnimationFrame(tick);
|
|
619
|
-
}
|
|
620
|
-
}, {
|
|
621
|
-
key: 'pause',
|
|
622
|
-
value: function pause() {
|
|
623
|
-
if (!this._paused) {
|
|
624
|
-
if (this._rafId) {
|
|
625
|
-
cancelAnimationFrame(this._rafId);
|
|
626
|
-
this._rafId = null;
|
|
627
|
-
}
|
|
628
|
-
this.emit('pause');
|
|
629
|
-
this._paused = true;
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
}, {
|
|
633
|
-
key: 'stop',
|
|
634
|
-
value: function stop() {
|
|
635
|
-
if (this._rafId) {
|
|
636
|
-
cancelAnimationFrame(this._rafId);
|
|
637
|
-
this._rafId = null;
|
|
638
|
-
}
|
|
639
|
-
this.emit('stop');
|
|
640
|
-
this._numPlays = 0;
|
|
641
|
-
this._ended = false;
|
|
642
|
-
this._paused = true;
|
|
643
|
-
// render first frame
|
|
644
|
-
this._currentFrameNumber = -1;
|
|
645
|
-
this.context.clearRect(0, 0, this._apng.width, this._apng.height);
|
|
646
|
-
this.renderNextFrame();
|
|
647
|
-
}
|
|
648
|
-
}, {
|
|
649
|
-
key: 'currentFrameNumber',
|
|
650
|
-
get: function get() {
|
|
651
|
-
return this._currentFrameNumber;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
/**
|
|
655
|
-
*
|
|
656
|
-
* @return {Frame}
|
|
657
|
-
*/
|
|
658
|
-
|
|
659
|
-
}, {
|
|
660
|
-
key: 'currentFrame',
|
|
661
|
-
get: function get() {
|
|
662
|
-
return this._apng.frames[this._currentFrameNumber];
|
|
663
|
-
}
|
|
664
|
-
}, {
|
|
665
|
-
key: 'paused',
|
|
666
|
-
get: function get() {
|
|
667
|
-
return this._paused;
|
|
668
|
-
}
|
|
669
|
-
}, {
|
|
670
|
-
key: 'ended',
|
|
671
|
-
get: function get() {
|
|
672
|
-
return this._ended;
|
|
673
|
-
}
|
|
674
|
-
}]);
|
|
675
|
-
|
|
676
|
-
return _class;
|
|
677
|
-
}(_events2.default);
|
|
678
|
-
|
|
679
|
-
exports.default = _class;
|
|
680
|
-
|
|
681
|
-
/***/ }),
|
|
682
|
-
/* 4 */
|
|
683
|
-
/***/ (function(module, exports) {
|
|
684
|
-
|
|
685
|
-
// Copyright Joyent, Inc. and other Node contributors.
|
|
686
|
-
//
|
|
687
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
688
|
-
// copy of this software and associated documentation files (the
|
|
689
|
-
// "Software"), to deal in the Software without restriction, including
|
|
690
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
|
691
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
692
|
-
// persons to whom the Software is furnished to do so, subject to the
|
|
693
|
-
// following conditions:
|
|
694
|
-
//
|
|
695
|
-
// The above copyright notice and this permission notice shall be included
|
|
696
|
-
// in all copies or substantial portions of the Software.
|
|
697
|
-
//
|
|
698
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
699
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
700
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
701
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
702
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
703
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
704
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
705
|
-
|
|
706
|
-
function EventEmitter() {
|
|
707
|
-
this._events = this._events || {};
|
|
708
|
-
this._maxListeners = this._maxListeners || undefined;
|
|
709
|
-
}
|
|
710
|
-
module.exports = EventEmitter;
|
|
711
|
-
|
|
712
|
-
// Backwards-compat with node 0.10.x
|
|
713
|
-
EventEmitter.EventEmitter = EventEmitter;
|
|
714
|
-
|
|
715
|
-
EventEmitter.prototype._events = undefined;
|
|
716
|
-
EventEmitter.prototype._maxListeners = undefined;
|
|
717
|
-
|
|
718
|
-
// By default EventEmitters will print a warning if more than 10 listeners are
|
|
719
|
-
// added to it. This is a useful default which helps finding memory leaks.
|
|
720
|
-
EventEmitter.defaultMaxListeners = 10;
|
|
721
|
-
|
|
722
|
-
// Obviously not all Emitters should be limited to 10. This function allows
|
|
723
|
-
// that to be increased. Set to zero for unlimited.
|
|
724
|
-
EventEmitter.prototype.setMaxListeners = function(n) {
|
|
725
|
-
if (!isNumber(n) || n < 0 || isNaN(n))
|
|
726
|
-
throw TypeError('n must be a positive number');
|
|
727
|
-
this._maxListeners = n;
|
|
728
|
-
return this;
|
|
729
|
-
};
|
|
730
|
-
|
|
731
|
-
EventEmitter.prototype.emit = function(type) {
|
|
732
|
-
var er, handler, len, args, i, listeners;
|
|
733
|
-
|
|
734
|
-
if (!this._events)
|
|
735
|
-
this._events = {};
|
|
736
|
-
|
|
737
|
-
// If there is no 'error' event listener then throw.
|
|
738
|
-
if (type === 'error') {
|
|
739
|
-
if (!this._events.error ||
|
|
740
|
-
(isObject(this._events.error) && !this._events.error.length)) {
|
|
741
|
-
er = arguments[1];
|
|
742
|
-
if (er instanceof Error) {
|
|
743
|
-
throw er; // Unhandled 'error' event
|
|
744
|
-
} else {
|
|
745
|
-
// At least give some kind of context to the user
|
|
746
|
-
var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
|
|
747
|
-
err.context = er;
|
|
748
|
-
throw err;
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
handler = this._events[type];
|
|
754
|
-
|
|
755
|
-
if (isUndefined(handler))
|
|
756
|
-
return false;
|
|
757
|
-
|
|
758
|
-
if (isFunction(handler)) {
|
|
759
|
-
switch (arguments.length) {
|
|
760
|
-
// fast cases
|
|
761
|
-
case 1:
|
|
762
|
-
handler.call(this);
|
|
763
|
-
break;
|
|
764
|
-
case 2:
|
|
765
|
-
handler.call(this, arguments[1]);
|
|
766
|
-
break;
|
|
767
|
-
case 3:
|
|
768
|
-
handler.call(this, arguments[1], arguments[2]);
|
|
769
|
-
break;
|
|
770
|
-
// slower
|
|
771
|
-
default:
|
|
772
|
-
args = Array.prototype.slice.call(arguments, 1);
|
|
773
|
-
handler.apply(this, args);
|
|
774
|
-
}
|
|
775
|
-
} else if (isObject(handler)) {
|
|
776
|
-
args = Array.prototype.slice.call(arguments, 1);
|
|
777
|
-
listeners = handler.slice();
|
|
778
|
-
len = listeners.length;
|
|
779
|
-
for (i = 0; i < len; i++)
|
|
780
|
-
listeners[i].apply(this, args);
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
return true;
|
|
784
|
-
};
|
|
785
|
-
|
|
786
|
-
EventEmitter.prototype.addListener = function(type, listener) {
|
|
787
|
-
var m;
|
|
788
|
-
|
|
789
|
-
if (!isFunction(listener))
|
|
790
|
-
throw TypeError('listener must be a function');
|
|
791
|
-
|
|
792
|
-
if (!this._events)
|
|
793
|
-
this._events = {};
|
|
794
|
-
|
|
795
|
-
// To avoid recursion in the case that type === "newListener"! Before
|
|
796
|
-
// adding it to the listeners, first emit "newListener".
|
|
797
|
-
if (this._events.newListener)
|
|
798
|
-
this.emit('newListener', type,
|
|
799
|
-
isFunction(listener.listener) ?
|
|
800
|
-
listener.listener : listener);
|
|
801
|
-
|
|
802
|
-
if (!this._events[type])
|
|
803
|
-
// Optimize the case of one listener. Don't need the extra array object.
|
|
804
|
-
this._events[type] = listener;
|
|
805
|
-
else if (isObject(this._events[type]))
|
|
806
|
-
// If we've already got an array, just append.
|
|
807
|
-
this._events[type].push(listener);
|
|
808
|
-
else
|
|
809
|
-
// Adding the second element, need to change to array.
|
|
810
|
-
this._events[type] = [this._events[type], listener];
|
|
811
|
-
|
|
812
|
-
// Check for listener leak
|
|
813
|
-
if (isObject(this._events[type]) && !this._events[type].warned) {
|
|
814
|
-
if (!isUndefined(this._maxListeners)) {
|
|
815
|
-
m = this._maxListeners;
|
|
816
|
-
} else {
|
|
817
|
-
m = EventEmitter.defaultMaxListeners;
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
if (m && m > 0 && this._events[type].length > m) {
|
|
821
|
-
this._events[type].warned = true;
|
|
822
|
-
console.error('(node) warning: possible EventEmitter memory ' +
|
|
823
|
-
'leak detected. %d listeners added. ' +
|
|
824
|
-
'Use emitter.setMaxListeners() to increase limit.',
|
|
825
|
-
this._events[type].length);
|
|
826
|
-
if (typeof console.trace === 'function') {
|
|
827
|
-
// not supported in IE 10
|
|
828
|
-
console.trace();
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
return this;
|
|
834
|
-
};
|
|
835
|
-
|
|
836
|
-
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
|
837
|
-
|
|
838
|
-
EventEmitter.prototype.once = function(type, listener) {
|
|
839
|
-
if (!isFunction(listener))
|
|
840
|
-
throw TypeError('listener must be a function');
|
|
841
|
-
|
|
842
|
-
var fired = false;
|
|
843
|
-
|
|
844
|
-
function g() {
|
|
845
|
-
this.removeListener(type, g);
|
|
846
|
-
|
|
847
|
-
if (!fired) {
|
|
848
|
-
fired = true;
|
|
849
|
-
listener.apply(this, arguments);
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
g.listener = listener;
|
|
854
|
-
this.on(type, g);
|
|
855
|
-
|
|
856
|
-
return this;
|
|
857
|
-
};
|
|
858
|
-
|
|
859
|
-
// emits a 'removeListener' event iff the listener was removed
|
|
860
|
-
EventEmitter.prototype.removeListener = function(type, listener) {
|
|
861
|
-
var list, position, length, i;
|
|
862
|
-
|
|
863
|
-
if (!isFunction(listener))
|
|
864
|
-
throw TypeError('listener must be a function');
|
|
865
|
-
|
|
866
|
-
if (!this._events || !this._events[type])
|
|
867
|
-
return this;
|
|
868
|
-
|
|
869
|
-
list = this._events[type];
|
|
870
|
-
length = list.length;
|
|
871
|
-
position = -1;
|
|
872
|
-
|
|
873
|
-
if (list === listener ||
|
|
874
|
-
(isFunction(list.listener) && list.listener === listener)) {
|
|
875
|
-
delete this._events[type];
|
|
876
|
-
if (this._events.removeListener)
|
|
877
|
-
this.emit('removeListener', type, listener);
|
|
878
|
-
|
|
879
|
-
} else if (isObject(list)) {
|
|
880
|
-
for (i = length; i-- > 0;) {
|
|
881
|
-
if (list[i] === listener ||
|
|
882
|
-
(list[i].listener && list[i].listener === listener)) {
|
|
883
|
-
position = i;
|
|
884
|
-
break;
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
if (position < 0)
|
|
889
|
-
return this;
|
|
890
|
-
|
|
891
|
-
if (list.length === 1) {
|
|
892
|
-
list.length = 0;
|
|
893
|
-
delete this._events[type];
|
|
894
|
-
} else {
|
|
895
|
-
list.splice(position, 1);
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
if (this._events.removeListener)
|
|
899
|
-
this.emit('removeListener', type, listener);
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
return this;
|
|
903
|
-
};
|
|
904
|
-
|
|
905
|
-
EventEmitter.prototype.removeAllListeners = function(type) {
|
|
906
|
-
var key, listeners;
|
|
907
|
-
|
|
908
|
-
if (!this._events)
|
|
909
|
-
return this;
|
|
910
|
-
|
|
911
|
-
// not listening for removeListener, no need to emit
|
|
912
|
-
if (!this._events.removeListener) {
|
|
913
|
-
if (arguments.length === 0)
|
|
914
|
-
this._events = {};
|
|
915
|
-
else if (this._events[type])
|
|
916
|
-
delete this._events[type];
|
|
917
|
-
return this;
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
// emit removeListener for all listeners on all events
|
|
921
|
-
if (arguments.length === 0) {
|
|
922
|
-
for (key in this._events) {
|
|
923
|
-
if (key === 'removeListener') continue;
|
|
924
|
-
this.removeAllListeners(key);
|
|
925
|
-
}
|
|
926
|
-
this.removeAllListeners('removeListener');
|
|
927
|
-
this._events = {};
|
|
928
|
-
return this;
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
listeners = this._events[type];
|
|
932
|
-
|
|
933
|
-
if (isFunction(listeners)) {
|
|
934
|
-
this.removeListener(type, listeners);
|
|
935
|
-
} else if (listeners) {
|
|
936
|
-
// LIFO order
|
|
937
|
-
while (listeners.length)
|
|
938
|
-
this.removeListener(type, listeners[listeners.length - 1]);
|
|
939
|
-
}
|
|
940
|
-
delete this._events[type];
|
|
941
|
-
|
|
942
|
-
return this;
|
|
943
|
-
};
|
|
944
|
-
|
|
945
|
-
EventEmitter.prototype.listeners = function(type) {
|
|
946
|
-
var ret;
|
|
947
|
-
if (!this._events || !this._events[type])
|
|
948
|
-
ret = [];
|
|
949
|
-
else if (isFunction(this._events[type]))
|
|
950
|
-
ret = [this._events[type]];
|
|
951
|
-
else
|
|
952
|
-
ret = this._events[type].slice();
|
|
953
|
-
return ret;
|
|
954
|
-
};
|
|
955
|
-
|
|
956
|
-
EventEmitter.prototype.listenerCount = function(type) {
|
|
957
|
-
if (this._events) {
|
|
958
|
-
var evlistener = this._events[type];
|
|
959
|
-
|
|
960
|
-
if (isFunction(evlistener))
|
|
961
|
-
return 1;
|
|
962
|
-
else if (evlistener)
|
|
963
|
-
return evlistener.length;
|
|
964
|
-
}
|
|
965
|
-
return 0;
|
|
966
|
-
};
|
|
967
|
-
|
|
968
|
-
EventEmitter.listenerCount = function(emitter, type) {
|
|
969
|
-
return emitter.listenerCount(type);
|
|
970
|
-
};
|
|
971
|
-
|
|
972
|
-
function isFunction(arg) {
|
|
973
|
-
return typeof arg === 'function';
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
function isNumber(arg) {
|
|
977
|
-
return typeof arg === 'number';
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
function isObject(arg) {
|
|
981
|
-
return typeof arg === 'object' && arg !== null;
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
function isUndefined(arg) {
|
|
985
|
-
return arg === void 0;
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
/***/ })
|
|
990
|
-
/******/ ])
|
|
991
|
-
});
|
|
992
|
-
} (lib));
|
|
993
|
-
|
|
994
|
-
var libExports = lib.exports;
|
|
995
|
-
var parseAPNG = /*@__PURE__*/getDefaultExportFromCjs(libExports);
|
|
996
|
-
|
|
997
|
-
const props = {
|
|
1
|
+
import { inject as ie, provide as le, watchEffect as T, onBeforeUnmount as R, defineComponent as E, useId as W, ref as $, onMounted as X, renderSlot as D, watch as G, computed as j, createElementBlock as pe, openBlock as N, resolveComponent as q, createBlock as U, withCtx as ce, createVNode as de } from "vue";
|
|
2
|
+
import { TickerStatus as n } from "@vunk/shared/enum";
|
|
3
|
+
import { TickerStatus as Oe } from "@vunk/shared/enum";
|
|
4
|
+
import { Deferred as me, sleep as K } from "@vunk/shared/promise";
|
|
5
|
+
import fe from "apng-js";
|
|
6
|
+
import { Application as ve, Sprite as ye, Assets as P, Texture as Y, ImageSource as te, BufferImageSource as ge } from "pixi.js";
|
|
7
|
+
import { pickObject as J } from "@vunk/shared/object";
|
|
8
|
+
import { useModelComputed as Q, useDeferred as he } from "@vunk/core/composables";
|
|
9
|
+
import { _ as xe } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
10
|
+
const V = {
|
|
998
11
|
url: {
|
|
999
12
|
type: String,
|
|
1000
|
-
requierd:
|
|
13
|
+
requierd: !1
|
|
1001
14
|
},
|
|
1002
15
|
data: {
|
|
1003
16
|
type: Array,
|
|
@@ -1008,14 +21,14 @@ const props = {
|
|
|
1008
21
|
*/
|
|
1009
22
|
loop: {
|
|
1010
23
|
type: Boolean,
|
|
1011
|
-
default:
|
|
24
|
+
default: !1
|
|
1012
25
|
},
|
|
1013
26
|
/**
|
|
1014
27
|
* @description v-model:status 控制动画状态
|
|
1015
28
|
*/
|
|
1016
29
|
status: {
|
|
1017
30
|
type: String,
|
|
1018
|
-
default:
|
|
31
|
+
default: n.pending
|
|
1019
32
|
},
|
|
1020
33
|
frameRate: {
|
|
1021
34
|
type: Number,
|
|
@@ -1034,551 +47,318 @@ const props = {
|
|
|
1034
47
|
*/
|
|
1035
48
|
prerender: {
|
|
1036
49
|
type: Boolean,
|
|
1037
|
-
default:
|
|
50
|
+
default: !1
|
|
1038
51
|
},
|
|
1039
52
|
visible: {
|
|
1040
53
|
type: Boolean,
|
|
1041
|
-
default:
|
|
54
|
+
default: !0
|
|
1042
55
|
}
|
|
1043
|
-
}
|
|
1044
|
-
const emits = {
|
|
56
|
+
}, S = {
|
|
1045
57
|
"update:status": null,
|
|
1046
58
|
"update:data": null,
|
|
1047
|
-
|
|
1048
|
-
};
|
|
1049
|
-
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
const whenDef = new Deferred();
|
|
1054
|
-
const context = {
|
|
1055
|
-
whenDef,
|
|
1056
|
-
when: () => whenDef.promise
|
|
59
|
+
setData: null
|
|
60
|
+
}, ae = /* @__PURE__ */ Symbol("appInjectKey");
|
|
61
|
+
function we() {
|
|
62
|
+
const a = new ve(), m = new me(), e = {
|
|
63
|
+
whenDef: m,
|
|
64
|
+
when: () => m.promise
|
|
1057
65
|
};
|
|
1058
|
-
|
|
1059
|
-
application,
|
|
1060
|
-
context
|
|
1061
|
-
});
|
|
1062
|
-
return { application, context };
|
|
66
|
+
return le(ae, {
|
|
67
|
+
application: a,
|
|
68
|
+
context: e
|
|
69
|
+
}), { application: a, context: e };
|
|
1063
70
|
}
|
|
1064
|
-
function
|
|
1065
|
-
const
|
|
1066
|
-
if (!
|
|
71
|
+
function ne() {
|
|
72
|
+
const a = ie(ae);
|
|
73
|
+
if (!a)
|
|
1067
74
|
throw new Error("Pixi app not provided");
|
|
1068
|
-
|
|
1069
|
-
return core;
|
|
75
|
+
return a;
|
|
1070
76
|
}
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
sprite.visible = props.visible ?? true;
|
|
77
|
+
function B(a) {
|
|
78
|
+
const m = a.autoResize ?? !0, e = a.resize ?? f, { application: t, context: F } = ne(), l = new ye();
|
|
79
|
+
t.stage.addChild(l), T(() => {
|
|
80
|
+
l.visible = a.visible ?? !0;
|
|
81
|
+
}), T(() => {
|
|
82
|
+
a.label && (l.label = a.label);
|
|
83
|
+
}), m && F.when().then((v) => {
|
|
84
|
+
l.texture && (y(), v.renderer.on("resize", y));
|
|
1080
85
|
});
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
});
|
|
1084
|
-
autoResize && context.when().then((app2) => {
|
|
1085
|
-
if (sprite.texture) {
|
|
1086
|
-
resizeSprite();
|
|
1087
|
-
app2.renderer.on("resize", resizeSprite);
|
|
1088
|
-
}
|
|
1089
|
-
});
|
|
1090
|
-
function resizeSprite() {
|
|
1091
|
-
if (!app.renderer?.screen)
|
|
86
|
+
function y() {
|
|
87
|
+
if (!t.renderer?.screen)
|
|
1092
88
|
return;
|
|
1093
|
-
const
|
|
1094
|
-
|
|
1095
|
-
application:
|
|
1096
|
-
sprite,
|
|
1097
|
-
meta
|
|
89
|
+
const v = l.texture._meta;
|
|
90
|
+
e({
|
|
91
|
+
application: t,
|
|
92
|
+
sprite: l,
|
|
93
|
+
meta: v
|
|
1098
94
|
});
|
|
1099
95
|
}
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
app.stage.removeChild(sprite);
|
|
96
|
+
R(() => {
|
|
97
|
+
t.renderer.off("resize", y), t.stage.removeChild(l);
|
|
1103
98
|
});
|
|
1104
|
-
function
|
|
1105
|
-
const
|
|
1106
|
-
|
|
1107
|
-
const scale = Math.min(scaleX, scaleY);
|
|
1108
|
-
sprite.scale.set(scale);
|
|
1109
|
-
sprite.x = (app.screen.width - sprite.width) / 2;
|
|
1110
|
-
sprite.y = (app.screen.height - sprite.height) / 2;
|
|
99
|
+
function f() {
|
|
100
|
+
const v = t.screen.width / l.texture.width, r = t.screen.height / l.texture.height, w = Math.min(v, r);
|
|
101
|
+
l.scale.set(w), l.x = (t.screen.width - l.width) / 2, l.y = (t.screen.height - l.height) / 2;
|
|
1111
102
|
}
|
|
1112
103
|
return {
|
|
1113
|
-
sprite,
|
|
1114
|
-
resizeSprite,
|
|
1115
|
-
application:
|
|
104
|
+
sprite: l,
|
|
105
|
+
resizeSprite: y,
|
|
106
|
+
application: t
|
|
1116
107
|
};
|
|
1117
108
|
}
|
|
1118
|
-
|
|
1119
|
-
var _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
109
|
+
const _e = /* @__PURE__ */ E({
|
|
1120
110
|
__name: "apng",
|
|
1121
111
|
props: {
|
|
1122
|
-
...
|
|
112
|
+
...V,
|
|
1123
113
|
url: {
|
|
1124
114
|
type: String,
|
|
1125
|
-
required:
|
|
115
|
+
required: !0
|
|
1126
116
|
}
|
|
1127
117
|
},
|
|
1128
|
-
emits,
|
|
1129
|
-
setup(
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
const error = ref("");
|
|
1140
|
-
const textureMap = /* @__PURE__ */ new Map();
|
|
1141
|
-
let timer = null;
|
|
1142
|
-
let reusableCanvas = null;
|
|
1143
|
-
let reusableCtx = null;
|
|
1144
|
-
onMounted(() => loadAPNG(props.url));
|
|
1145
|
-
function getReusableCanvas(width, height) {
|
|
1146
|
-
if (!reusableCanvas) {
|
|
1147
|
-
reusableCanvas = document.createElement("canvas");
|
|
1148
|
-
reusableCtx = reusableCanvas.getContext("2d", {
|
|
1149
|
-
willReadFrequently: true
|
|
1150
|
-
});
|
|
1151
|
-
}
|
|
1152
|
-
if (reusableCanvas.width !== width || reusableCanvas.height !== height) {
|
|
1153
|
-
reusableCanvas.width = width;
|
|
1154
|
-
reusableCanvas.height = height;
|
|
1155
|
-
}
|
|
1156
|
-
return { canvas: reusableCanvas, ctx: reusableCtx };
|
|
1157
|
-
}
|
|
1158
|
-
async function loadAPNG(url) {
|
|
118
|
+
emits: S,
|
|
119
|
+
setup(a, { emit: m }) {
|
|
120
|
+
const e = a, t = m, F = W(), l = (o) => `${F}-apng-frame-${o}`, { sprite: y, resizeSprite: f } = B(e), v = $([]), r = $(0), w = $(!1), g = $(""), i = /* @__PURE__ */ new Map();
|
|
121
|
+
let u = null, c = null, k = null;
|
|
122
|
+
X(() => I(e.url));
|
|
123
|
+
function A(o, _) {
|
|
124
|
+
return c || (c = document.createElement("canvas"), k = c.getContext("2d", {
|
|
125
|
+
willReadFrequently: !0
|
|
126
|
+
})), (c.width !== o || c.height !== _) && (c.width = o, c.height = _), { canvas: c, ctx: k };
|
|
127
|
+
}
|
|
128
|
+
async function I(o) {
|
|
1159
129
|
try {
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
const
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
await
|
|
1176
|
-
|
|
1177
|
-
ctx.drawImage(img, frame.left, frame.top);
|
|
1178
|
-
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
|
1179
|
-
const alias = getAlias(frameIndex);
|
|
1180
|
-
textureMap.set(alias, void 0);
|
|
1181
|
-
ctx.putImageData(imageData, 0, 0);
|
|
1182
|
-
const dataUrl = canvas.toDataURL();
|
|
1183
|
-
Assets.add({ alias, src: dataUrl });
|
|
1184
|
-
const texture = await Assets.load(alias);
|
|
1185
|
-
textureMap.set(alias, texture);
|
|
1186
|
-
if (frameIndex === 0) {
|
|
1187
|
-
sprite.texture = texture;
|
|
1188
|
-
resizeSprite();
|
|
1189
|
-
}
|
|
1190
|
-
return alias;
|
|
130
|
+
g.value = "", w.value = !1, await x();
|
|
131
|
+
const _ = await fetch(o);
|
|
132
|
+
if (!_.ok)
|
|
133
|
+
throw new Error(`加载APNG失败: ${_.status}`);
|
|
134
|
+
const b = await _.arrayBuffer(), C = fe(b);
|
|
135
|
+
if (C instanceof Error)
|
|
136
|
+
throw new TypeError(`APNG解析失败: ${C.message}`);
|
|
137
|
+
const { canvas: z, ctx: L } = A(C.width, C.height), re = C.frames.map(async (O, Z) => {
|
|
138
|
+
L.clearRect(0, 0, z.width, z.height), await O.createImage();
|
|
139
|
+
const se = O.imageElement;
|
|
140
|
+
L.drawImage(se, O.left, O.top);
|
|
141
|
+
const oe = L.getImageData(0, 0, z.width, z.height), M = l(Z);
|
|
142
|
+
i.set(M, void 0), L.putImageData(oe, 0, 0);
|
|
143
|
+
const ue = z.toDataURL();
|
|
144
|
+
P.add({ alias: M, src: ue });
|
|
145
|
+
const ee = await P.load(M);
|
|
146
|
+
return i.set(M, ee), Z === 0 && (y.texture = ee, f()), M;
|
|
1191
147
|
});
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
console.error("\u52A0\u8F7DAPNG\u5931\u8D25:", err);
|
|
1196
|
-
error.value = err instanceof Error ? err.message : "\u52A0\u8F7DAPNG\u5931\u8D25";
|
|
1197
|
-
emit("update:status", TickerStatus.stopped);
|
|
148
|
+
v.value = await Promise.all(re), w.value = !0;
|
|
149
|
+
} catch (_) {
|
|
150
|
+
console.error("加载APNG失败:", _), g.value = _ instanceof Error ? _.message : "加载APNG失败", t("update:status", n.stopped);
|
|
1198
151
|
}
|
|
1199
152
|
}
|
|
1200
|
-
function
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
timer = window.setInterval(() => {
|
|
1204
|
-
if (frames.value.length === 0 || props.status !== TickerStatus.playing) {
|
|
153
|
+
function h() {
|
|
154
|
+
u === null && (u = window.setInterval(() => {
|
|
155
|
+
if (v.value.length === 0 || e.status !== n.playing)
|
|
1205
156
|
return;
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
getAlias(index.value)
|
|
157
|
+
const o = i.get(
|
|
158
|
+
l(r.value)
|
|
1209
159
|
);
|
|
1210
|
-
if (
|
|
1211
|
-
const
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
function stop() {
|
|
1242
|
-
if (timer !== null) {
|
|
1243
|
-
clearInterval(timer);
|
|
1244
|
-
timer = null;
|
|
1245
|
-
}
|
|
1246
|
-
index.value = 0;
|
|
1247
|
-
const firstTexture = textureMap.get(getAlias(0));
|
|
1248
|
-
if (firstTexture) {
|
|
1249
|
-
sprite.texture = firstTexture;
|
|
1250
|
-
resizeSprite();
|
|
1251
|
-
}
|
|
1252
|
-
emit("update:status", TickerStatus.stopped);
|
|
1253
|
-
}
|
|
1254
|
-
async function cleanup() {
|
|
1255
|
-
if (timer !== null) {
|
|
1256
|
-
clearInterval(timer);
|
|
1257
|
-
timer = null;
|
|
1258
|
-
}
|
|
1259
|
-
const unloadPromises = [];
|
|
1260
|
-
for (const [alias, texture] of textureMap) {
|
|
1261
|
-
if (texture && texture !== Texture.EMPTY) {
|
|
1262
|
-
unloadPromises.push(Assets.unload(alias));
|
|
1263
|
-
}
|
|
1264
|
-
}
|
|
1265
|
-
await Promise.all(unloadPromises);
|
|
1266
|
-
textureMap.clear();
|
|
1267
|
-
frames.value = [];
|
|
1268
|
-
index.value = 0;
|
|
1269
|
-
isLoaded.value = false;
|
|
1270
|
-
error.value = "";
|
|
1271
|
-
if (reusableCanvas) {
|
|
1272
|
-
reusableCanvas.width = 0;
|
|
1273
|
-
reusableCanvas.height = 0;
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
watchEffect(() => {
|
|
1277
|
-
switch (props.status) {
|
|
1278
|
-
case TickerStatus.play:
|
|
1279
|
-
play();
|
|
160
|
+
if (o) {
|
|
161
|
+
const _ = r.value - 1;
|
|
162
|
+
_ >= 0 && !e.loop && Promise.resolve().then(() => K(500)).then(() => {
|
|
163
|
+
P.unload(l(_)), i.delete(l(_));
|
|
164
|
+
}), y.texture = o, f(), r.value = e.loop ? (r.value + 1) % v.value.length : r.value + 1;
|
|
165
|
+
} else
|
|
166
|
+
e.loop || t("update:status", n.paused);
|
|
167
|
+
}, 1e3 / e.frameRate));
|
|
168
|
+
}
|
|
169
|
+
function p() {
|
|
170
|
+
!w.value || v.value.length <= 1 || (t("update:status", n.playing), h());
|
|
171
|
+
}
|
|
172
|
+
function s() {
|
|
173
|
+
u !== null && (clearInterval(u), u = null), t("update:status", n.paused);
|
|
174
|
+
}
|
|
175
|
+
function d() {
|
|
176
|
+
u !== null && (clearInterval(u), u = null), r.value = 0;
|
|
177
|
+
const o = i.get(l(0));
|
|
178
|
+
o && (y.texture = o, f()), t("update:status", n.stopped);
|
|
179
|
+
}
|
|
180
|
+
async function x() {
|
|
181
|
+
u !== null && (clearInterval(u), u = null);
|
|
182
|
+
const o = [];
|
|
183
|
+
for (const [_, b] of i)
|
|
184
|
+
b && b !== Y.EMPTY && o.push(P.unload(_));
|
|
185
|
+
await Promise.all(o), i.clear(), v.value = [], r.value = 0, w.value = !1, g.value = "", c && (c.width = 0, c.height = 0);
|
|
186
|
+
}
|
|
187
|
+
return T(() => {
|
|
188
|
+
switch (e.status) {
|
|
189
|
+
case n.play:
|
|
190
|
+
p();
|
|
1280
191
|
break;
|
|
1281
|
-
case
|
|
1282
|
-
|
|
192
|
+
case n.pause:
|
|
193
|
+
s();
|
|
1283
194
|
break;
|
|
1284
|
-
case
|
|
1285
|
-
|
|
195
|
+
case n.stop:
|
|
196
|
+
d();
|
|
1286
197
|
break;
|
|
1287
198
|
}
|
|
1288
|
-
})
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
reusableCanvas = null;
|
|
1292
|
-
reusableCtx = null;
|
|
1293
|
-
});
|
|
1294
|
-
const __returned__ = { props, emit, compId, getAlias, sprite, resizeSprite, frames, index, isLoaded, error, textureMap, get timer() {
|
|
1295
|
-
return timer;
|
|
1296
|
-
}, set timer(v) {
|
|
1297
|
-
timer = v;
|
|
1298
|
-
}, get reusableCanvas() {
|
|
1299
|
-
return reusableCanvas;
|
|
1300
|
-
}, set reusableCanvas(v) {
|
|
1301
|
-
reusableCanvas = v;
|
|
1302
|
-
}, get reusableCtx() {
|
|
1303
|
-
return reusableCtx;
|
|
1304
|
-
}, set reusableCtx(v) {
|
|
1305
|
-
reusableCtx = v;
|
|
1306
|
-
}, getReusableCanvas, loadAPNG, startFrameLoop, play, pause, stop, cleanup };
|
|
1307
|
-
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1308
|
-
return __returned__;
|
|
199
|
+
}), R(async () => {
|
|
200
|
+
await x(), c = null, k = null;
|
|
201
|
+
}), (o, _) => D(o.$slots, "default");
|
|
1309
202
|
}
|
|
1310
|
-
})
|
|
1311
|
-
|
|
1312
|
-
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1313
|
-
return renderSlot(_ctx.$slots, "default");
|
|
1314
|
-
}
|
|
1315
|
-
var ApngComp = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/apng.vue"]]);
|
|
1316
|
-
|
|
1317
|
-
var _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
203
|
+
}), Be = /* @__PURE__ */ E({
|
|
1318
204
|
__name: "bitmap-generator",
|
|
1319
205
|
props: {
|
|
1320
|
-
...
|
|
206
|
+
...J(V, {
|
|
1321
207
|
excludes: ["loop"]
|
|
1322
208
|
}),
|
|
1323
209
|
generator: {
|
|
1324
210
|
type: Object,
|
|
1325
|
-
required:
|
|
211
|
+
required: !0
|
|
1326
212
|
}
|
|
1327
213
|
},
|
|
1328
214
|
emits: {
|
|
1329
215
|
"update:status": null,
|
|
1330
|
-
|
|
216
|
+
load: (a) => a
|
|
1331
217
|
},
|
|
1332
|
-
setup(
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
const emit = __emit;
|
|
1336
|
-
const { sprite, resizeSprite, application } = useSprite(props);
|
|
1337
|
-
const texture = new Texture({
|
|
1338
|
-
dynamic: true
|
|
218
|
+
setup(a, { emit: m }) {
|
|
219
|
+
const e = a, t = m, { sprite: F, resizeSprite: l, application: y } = B(e), f = new Y({
|
|
220
|
+
dynamic: !0
|
|
1339
221
|
});
|
|
1340
|
-
|
|
1341
|
-
function
|
|
1342
|
-
|
|
1343
|
-
const
|
|
1344
|
-
resource:
|
|
222
|
+
F.texture = f;
|
|
223
|
+
function v(u) {
|
|
224
|
+
f.source.destroy();
|
|
225
|
+
const c = new te({
|
|
226
|
+
resource: u
|
|
1345
227
|
});
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
});
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
function drawFrame() {
|
|
1360
|
-
if (props.status !== TickerStatus.playing) {
|
|
1361
|
-
return;
|
|
1362
|
-
}
|
|
1363
|
-
props.generator.next().then(({ value, done }) => {
|
|
1364
|
-
if (done) {
|
|
1365
|
-
return emit("update:status", TickerStatus.stopped);
|
|
1366
|
-
}
|
|
1367
|
-
updateTextureFromBitmap(value);
|
|
228
|
+
f.source = c, f.update(), l();
|
|
229
|
+
}
|
|
230
|
+
t("load", {
|
|
231
|
+
application: y,
|
|
232
|
+
sprite: F
|
|
233
|
+
}), G(() => e.status, (u) => {
|
|
234
|
+
u === n.play && w(), u === n.pause && g(), u === n.stop && i();
|
|
235
|
+
}, { immediate: !0 });
|
|
236
|
+
function r() {
|
|
237
|
+
e.status === n.playing && e.generator.next().then(({ value: u, done: c }) => {
|
|
238
|
+
if (c)
|
|
239
|
+
return t("update:status", n.stopped);
|
|
240
|
+
v(u);
|
|
1368
241
|
});
|
|
1369
242
|
}
|
|
1370
|
-
function
|
|
1371
|
-
|
|
1372
|
-
application.ticker.maxFPS = props.frameRate;
|
|
1373
|
-
emit("update:status", TickerStatus.playing);
|
|
1374
|
-
application.ticker.add(drawFrame);
|
|
243
|
+
function w() {
|
|
244
|
+
y.ticker.minFPS = e.frameRate, y.ticker.maxFPS = e.frameRate, t("update:status", n.playing), y.ticker.add(r);
|
|
1375
245
|
}
|
|
1376
|
-
function
|
|
1377
|
-
|
|
1378
|
-
emit("update:status", TickerStatus.paused);
|
|
246
|
+
function g() {
|
|
247
|
+
y.ticker.remove(r), t("update:status", n.paused);
|
|
1379
248
|
}
|
|
1380
|
-
function
|
|
1381
|
-
|
|
1382
|
-
emit("update:status", TickerStatus.stopped);
|
|
249
|
+
function i() {
|
|
250
|
+
y.ticker.remove(r), t("update:status", n.stopped);
|
|
1383
251
|
}
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
});
|
|
1388
|
-
const __returned__ = { props, emit, sprite, resizeSprite, application, texture, updateTextureFromBitmap, drawFrame, play, pause, stop };
|
|
1389
|
-
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1390
|
-
return __returned__;
|
|
252
|
+
return R(() => {
|
|
253
|
+
i(), f.destroy();
|
|
254
|
+
}), (u, c) => D(u.$slots, "default");
|
|
1391
255
|
}
|
|
1392
|
-
})
|
|
1393
|
-
|
|
1394
|
-
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1395
|
-
return renderSlot(_ctx.$slots, "default");
|
|
1396
|
-
}
|
|
1397
|
-
var bitmapGenerator = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/bitmap-generator.vue"]]);
|
|
1398
|
-
|
|
1399
|
-
var _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
256
|
+
}), Fe = /* @__PURE__ */ E({
|
|
1400
257
|
__name: "bitmap",
|
|
1401
258
|
props: {
|
|
1402
|
-
...
|
|
259
|
+
...J(V, {
|
|
1403
260
|
excludes: ["loop"]
|
|
1404
261
|
}),
|
|
1405
262
|
data: {
|
|
1406
263
|
type: void 0,
|
|
1407
|
-
required:
|
|
264
|
+
required: !0
|
|
1408
265
|
},
|
|
1409
266
|
frameIndex: {
|
|
1410
267
|
type: Number
|
|
1411
268
|
}
|
|
1412
269
|
},
|
|
1413
270
|
emits: {
|
|
1414
|
-
...
|
|
1415
|
-
|
|
271
|
+
...S,
|
|
272
|
+
load: (a) => a,
|
|
1416
273
|
"update:frameIndex": null,
|
|
1417
|
-
|
|
274
|
+
notFound: (a) => !0
|
|
1418
275
|
},
|
|
1419
|
-
setup(
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
const emit = __emit;
|
|
1423
|
-
const { sprite, resizeSprite, application } = useSprite(props);
|
|
1424
|
-
const texture = new Texture({
|
|
1425
|
-
dynamic: true
|
|
276
|
+
setup(a, { emit: m }) {
|
|
277
|
+
const e = a, t = m, { sprite: F, resizeSprite: l, application: y } = B(e), f = new Y({
|
|
278
|
+
dynamic: !0
|
|
1426
279
|
});
|
|
1427
|
-
|
|
1428
|
-
function
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
resource: bitmap
|
|
280
|
+
F.texture = f;
|
|
281
|
+
function v(s) {
|
|
282
|
+
f.source?.resource?.close(), f.source?.destroy();
|
|
283
|
+
const d = new te({
|
|
284
|
+
resource: s
|
|
1433
285
|
});
|
|
1434
|
-
|
|
1435
|
-
texture.update();
|
|
1436
|
-
resizeSprite();
|
|
286
|
+
f.source = d, f.update(), l();
|
|
1437
287
|
}
|
|
1438
|
-
|
|
1439
|
-
application,
|
|
1440
|
-
sprite
|
|
288
|
+
t("load", {
|
|
289
|
+
application: y,
|
|
290
|
+
sprite: F
|
|
1441
291
|
});
|
|
1442
|
-
const
|
|
292
|
+
const r = Q({
|
|
1443
293
|
default: 0,
|
|
1444
294
|
key: "frameIndex"
|
|
1445
|
-
},
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
lastScheduledClearIndex.value = frameIndex;
|
|
1451
|
-
sleep(0).then(() => {
|
|
1452
|
-
emit("setData", {
|
|
1453
|
-
k: frameIndex,
|
|
295
|
+
}, e, t), w = $(-1);
|
|
296
|
+
function g(s) {
|
|
297
|
+
s <= w.value || (w.value = s, K(0).then(() => {
|
|
298
|
+
t("setData", {
|
|
299
|
+
k: s,
|
|
1454
300
|
v: null
|
|
1455
301
|
});
|
|
1456
|
-
});
|
|
302
|
+
}));
|
|
1457
303
|
}
|
|
1458
|
-
let
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
let lastFpsUpdateTime = 0;
|
|
1462
|
-
function startFrameLoop() {
|
|
1463
|
-
if (animationId !== null)
|
|
304
|
+
let i = null, u = 0, c = 0, k = 0;
|
|
305
|
+
function A() {
|
|
306
|
+
if (i !== null)
|
|
1464
307
|
return;
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
drawFrame();
|
|
1475
|
-
frameCount++;
|
|
1476
|
-
const elapsed = now - lastFpsUpdateTime;
|
|
1477
|
-
if (elapsed >= 1e3) {
|
|
1478
|
-
const currentFps = Math.round(frameCount * 1e3 / elapsed);
|
|
1479
|
-
console.log(`[Bitmap] FPS: ${currentFps}`);
|
|
1480
|
-
frameCount = 0;
|
|
1481
|
-
lastFpsUpdateTime = now;
|
|
308
|
+
u = performance.now(), k = u, c = 0;
|
|
309
|
+
function s() {
|
|
310
|
+
const x = performance.now(), o = 1e3 / e.frameRate, _ = x - u;
|
|
311
|
+
if (_ >= o) {
|
|
312
|
+
u = x - _ % o, d(), c++;
|
|
313
|
+
const b = x - k;
|
|
314
|
+
if (b >= 1e3) {
|
|
315
|
+
const C = Math.round(c * 1e3 / b);
|
|
316
|
+
console.log(`[Bitmap] FPS: ${C}`), c = 0, k = x;
|
|
1482
317
|
}
|
|
1483
318
|
}
|
|
1484
|
-
|
|
1485
|
-
animationId = requestAnimationFrame(renderFrame);
|
|
1486
|
-
} else {
|
|
1487
|
-
animationId = null;
|
|
1488
|
-
}
|
|
319
|
+
e.status === n.playing ? i = requestAnimationFrame(s) : i = null;
|
|
1489
320
|
}
|
|
1490
|
-
function
|
|
1491
|
-
if (
|
|
321
|
+
function d() {
|
|
322
|
+
if (e.data.length === 0 || e.status !== n.playing)
|
|
1492
323
|
return;
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
scheduleClearFrame(originIndex);
|
|
1499
|
-
}
|
|
1500
|
-
updateTextureFromBitmap(bitmap);
|
|
1501
|
-
index.value = index.value + 1;
|
|
1502
|
-
} else {
|
|
324
|
+
const x = e.data[r.value];
|
|
325
|
+
if (x) {
|
|
326
|
+
const o = r.value - 1;
|
|
327
|
+
o >= 0 && g(o), v(x), r.value = r.value + 1;
|
|
328
|
+
} else
|
|
1503
329
|
console.warn(
|
|
1504
|
-
`Bitmap for index ${
|
|
1505
|
-
);
|
|
1506
|
-
emit("notFound", index.value);
|
|
1507
|
-
}
|
|
330
|
+
`Bitmap for index ${r.value} not found. Ensure the data is loaded.`
|
|
331
|
+
), t("notFound", r.value);
|
|
1508
332
|
}
|
|
1509
|
-
|
|
333
|
+
i = requestAnimationFrame(s);
|
|
1510
334
|
}
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
});
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
newStatus === TickerStatus.pause && pause();
|
|
1519
|
-
newStatus === TickerStatus.stop && stop();
|
|
1520
|
-
}, { immediate: true });
|
|
1521
|
-
function play() {
|
|
1522
|
-
if (props.data.length > 0) {
|
|
1523
|
-
emit("update:status", TickerStatus.playing);
|
|
1524
|
-
startFrameLoop();
|
|
1525
|
-
} else {
|
|
1526
|
-
emit("update:status", TickerStatus.stopped);
|
|
1527
|
-
}
|
|
335
|
+
T(() => {
|
|
336
|
+
e.prerender && r.value === 0 && e.data.length > 0 && e.data[0] && v(e.data[0]);
|
|
337
|
+
}), G(() => e.status, (s) => {
|
|
338
|
+
s === n.play && I(), s === n.pause && h(), s === n.stop && p();
|
|
339
|
+
}, { immediate: !0 });
|
|
340
|
+
function I() {
|
|
341
|
+
e.data.length > 0 ? (t("update:status", n.playing), A()) : t("update:status", n.stopped);
|
|
1528
342
|
}
|
|
1529
|
-
function
|
|
1530
|
-
|
|
343
|
+
function h() {
|
|
344
|
+
t("update:status", n.paused);
|
|
1531
345
|
}
|
|
1532
|
-
function
|
|
1533
|
-
|
|
1534
|
-
if (animationId !== null) {
|
|
1535
|
-
cancelAnimationFrame(animationId);
|
|
1536
|
-
animationId = null;
|
|
1537
|
-
}
|
|
1538
|
-
emit("update:data", []);
|
|
1539
|
-
index.value = 0;
|
|
1540
|
-
lastScheduledClearIndex.value = -1;
|
|
346
|
+
function p() {
|
|
347
|
+
t("update:status", n.stopped), i !== null && (cancelAnimationFrame(i), i = null), t("update:data", []), r.value = 0, w.value = -1;
|
|
1541
348
|
}
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
});
|
|
1546
|
-
const __returned__ = { props, emit, sprite, resizeSprite, application, texture, updateTextureFromBitmap, index, lastScheduledClearIndex, scheduleClearFrame, get animationId() {
|
|
1547
|
-
return animationId;
|
|
1548
|
-
}, set animationId(v) {
|
|
1549
|
-
animationId = v;
|
|
1550
|
-
}, get lastFrameTime() {
|
|
1551
|
-
return lastFrameTime;
|
|
1552
|
-
}, set lastFrameTime(v) {
|
|
1553
|
-
lastFrameTime = v;
|
|
1554
|
-
}, get frameCount() {
|
|
1555
|
-
return frameCount;
|
|
1556
|
-
}, set frameCount(v) {
|
|
1557
|
-
frameCount = v;
|
|
1558
|
-
}, get lastFpsUpdateTime() {
|
|
1559
|
-
return lastFpsUpdateTime;
|
|
1560
|
-
}, set lastFpsUpdateTime(v) {
|
|
1561
|
-
lastFpsUpdateTime = v;
|
|
1562
|
-
}, startFrameLoop, play, pause, stop };
|
|
1563
|
-
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1564
|
-
return __returned__;
|
|
349
|
+
return R(() => {
|
|
350
|
+
p(), f.destroy();
|
|
351
|
+
}), (s, d) => D(s.$slots, "default");
|
|
1565
352
|
}
|
|
1566
|
-
})
|
|
1567
|
-
|
|
1568
|
-
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1569
|
-
return renderSlot(_ctx.$slots, "default");
|
|
1570
|
-
}
|
|
1571
|
-
var Bitmap = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/bitmap.vue"]]);
|
|
1572
|
-
|
|
1573
|
-
var _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
353
|
+
}), ze = /* @__PURE__ */ E({
|
|
1574
354
|
__name: "buffer-image",
|
|
1575
355
|
props: {
|
|
1576
|
-
...
|
|
356
|
+
...J(V, {
|
|
1577
357
|
excludes: ["loop"]
|
|
1578
358
|
}),
|
|
1579
359
|
data: {
|
|
1580
360
|
type: Array,
|
|
1581
|
-
required:
|
|
361
|
+
required: !0
|
|
1582
362
|
},
|
|
1583
363
|
/**
|
|
1584
364
|
* Pixel format for BufferImageSource.
|
|
@@ -1593,525 +373,285 @@ var _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
1593
373
|
},
|
|
1594
374
|
height: {
|
|
1595
375
|
type: Number,
|
|
1596
|
-
required:
|
|
376
|
+
required: !0
|
|
1597
377
|
},
|
|
1598
378
|
width: {
|
|
1599
379
|
type: Number,
|
|
1600
|
-
required:
|
|
380
|
+
required: !0
|
|
1601
381
|
}
|
|
1602
382
|
},
|
|
1603
383
|
emits: {
|
|
1604
|
-
...
|
|
1605
|
-
|
|
384
|
+
...S,
|
|
385
|
+
load: (a) => a,
|
|
1606
386
|
"update:frameIndex": null,
|
|
1607
|
-
|
|
387
|
+
notFound: (a) => !0
|
|
1608
388
|
},
|
|
1609
|
-
setup(
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
const emit = __emit;
|
|
1613
|
-
const { sprite, resizeSprite, application } = useSprite(props);
|
|
1614
|
-
const texture = new Texture({
|
|
1615
|
-
dynamic: true
|
|
389
|
+
setup(a, { emit: m }) {
|
|
390
|
+
const e = a, t = m, { sprite: F, resizeSprite: l, application: y } = B(e), f = new Y({
|
|
391
|
+
dynamic: !0
|
|
1616
392
|
});
|
|
1617
|
-
|
|
1618
|
-
function
|
|
1619
|
-
|
|
1620
|
-
const
|
|
1621
|
-
resource,
|
|
1622
|
-
height:
|
|
1623
|
-
width:
|
|
1624
|
-
format:
|
|
393
|
+
F.texture = f;
|
|
394
|
+
function v(s) {
|
|
395
|
+
f.source?.destroy();
|
|
396
|
+
const d = new ge({
|
|
397
|
+
resource: s,
|
|
398
|
+
height: e.height,
|
|
399
|
+
width: e.width,
|
|
400
|
+
format: e.format
|
|
1625
401
|
});
|
|
1626
|
-
|
|
1627
|
-
texture.update();
|
|
1628
|
-
resizeSprite();
|
|
402
|
+
f.source = d, f.update(), l();
|
|
1629
403
|
}
|
|
1630
|
-
|
|
1631
|
-
application,
|
|
1632
|
-
sprite
|
|
404
|
+
t("load", {
|
|
405
|
+
application: y,
|
|
406
|
+
sprite: F
|
|
1633
407
|
});
|
|
1634
|
-
const
|
|
408
|
+
const r = Q({
|
|
1635
409
|
default: 0,
|
|
1636
410
|
key: "frameIndex"
|
|
1637
|
-
},
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
lastScheduledClearIndex.value = frameIndex;
|
|
1643
|
-
sleep(0).then(() => {
|
|
1644
|
-
emit("setData", {
|
|
1645
|
-
k: frameIndex,
|
|
411
|
+
}, e, t), w = $(-1);
|
|
412
|
+
function g(s) {
|
|
413
|
+
s <= w.value || (w.value = s, K(0).then(() => {
|
|
414
|
+
t("setData", {
|
|
415
|
+
k: s,
|
|
1646
416
|
v: null
|
|
1647
417
|
});
|
|
1648
|
-
});
|
|
418
|
+
}));
|
|
1649
419
|
}
|
|
1650
|
-
let
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
let lastFpsUpdateTime = 0;
|
|
1654
|
-
function startFrameLoop() {
|
|
1655
|
-
if (animationId !== null)
|
|
420
|
+
let i = null, u = 0, c = 0, k = 0;
|
|
421
|
+
function A() {
|
|
422
|
+
if (i !== null)
|
|
1656
423
|
return;
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
drawFrame();
|
|
1667
|
-
frameCount++;
|
|
1668
|
-
const elapsed = now - lastFpsUpdateTime;
|
|
1669
|
-
if (elapsed >= 1e3) {
|
|
1670
|
-
const currentFps = Math.round(frameCount * 1e3 / elapsed);
|
|
1671
|
-
console.log(`[Bitmap] FPS: ${currentFps}`);
|
|
1672
|
-
frameCount = 0;
|
|
1673
|
-
lastFpsUpdateTime = now;
|
|
424
|
+
u = performance.now(), k = u, c = 0;
|
|
425
|
+
function s() {
|
|
426
|
+
const x = performance.now(), o = 1e3 / e.frameRate, _ = x - u;
|
|
427
|
+
if (_ >= o) {
|
|
428
|
+
u = x - _ % o, d(), c++;
|
|
429
|
+
const b = x - k;
|
|
430
|
+
if (b >= 1e3) {
|
|
431
|
+
const C = Math.round(c * 1e3 / b);
|
|
432
|
+
console.log(`[Bitmap] FPS: ${C}`), c = 0, k = x;
|
|
1674
433
|
}
|
|
1675
434
|
}
|
|
1676
|
-
|
|
1677
|
-
animationId = requestAnimationFrame(renderFrame);
|
|
1678
|
-
} else {
|
|
1679
|
-
animationId = null;
|
|
1680
|
-
}
|
|
435
|
+
e.status === n.playing ? i = requestAnimationFrame(s) : i = null;
|
|
1681
436
|
}
|
|
1682
|
-
function
|
|
1683
|
-
if (
|
|
437
|
+
function d() {
|
|
438
|
+
if (e.data.length === 0 || e.status !== n.playing)
|
|
1684
439
|
return;
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
scheduleClearFrame(originIndex);
|
|
1691
|
-
}
|
|
1692
|
-
updateTexture(bitmap);
|
|
1693
|
-
index.value = index.value + 1;
|
|
1694
|
-
} else {
|
|
440
|
+
const x = e.data[r.value];
|
|
441
|
+
if (x) {
|
|
442
|
+
const o = r.value - 1;
|
|
443
|
+
o >= 0 && g(o), v(x), r.value = r.value + 1;
|
|
444
|
+
} else
|
|
1695
445
|
console.warn(
|
|
1696
|
-
`Bitmap for index ${
|
|
1697
|
-
);
|
|
1698
|
-
emit("notFound", index.value);
|
|
1699
|
-
}
|
|
446
|
+
`Bitmap for index ${r.value} not found. Ensure the data is loaded.`
|
|
447
|
+
), t("notFound", r.value);
|
|
1700
448
|
}
|
|
1701
|
-
|
|
449
|
+
i = requestAnimationFrame(s);
|
|
1702
450
|
}
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
});
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
newStatus === TickerStatus.pause && pause();
|
|
1711
|
-
newStatus === TickerStatus.stop && stop();
|
|
1712
|
-
}, { immediate: true });
|
|
1713
|
-
function play() {
|
|
1714
|
-
if (props.data.length > 0) {
|
|
1715
|
-
emit("update:status", TickerStatus.playing);
|
|
1716
|
-
startFrameLoop();
|
|
1717
|
-
} else {
|
|
1718
|
-
emit("update:status", TickerStatus.stopped);
|
|
1719
|
-
}
|
|
451
|
+
T(() => {
|
|
452
|
+
e.prerender && r.value === 0 && e.data.length > 0 && e.data[0] && v(e.data[0]);
|
|
453
|
+
}), G(() => e.status, (s) => {
|
|
454
|
+
s === n.play && I(), s === n.pause && h(), s === n.stop && p();
|
|
455
|
+
}, { immediate: !0 });
|
|
456
|
+
function I() {
|
|
457
|
+
e.data.length > 0 ? (t("update:status", n.playing), A()) : t("update:status", n.stopped);
|
|
1720
458
|
}
|
|
1721
|
-
function
|
|
1722
|
-
|
|
459
|
+
function h() {
|
|
460
|
+
t("update:status", n.paused);
|
|
1723
461
|
}
|
|
1724
|
-
function
|
|
1725
|
-
|
|
1726
|
-
if (animationId !== null) {
|
|
1727
|
-
cancelAnimationFrame(animationId);
|
|
1728
|
-
animationId = null;
|
|
1729
|
-
}
|
|
1730
|
-
emit("update:data", []);
|
|
1731
|
-
index.value = 0;
|
|
1732
|
-
lastScheduledClearIndex.value = -1;
|
|
462
|
+
function p() {
|
|
463
|
+
t("update:status", n.stopped), i !== null && (cancelAnimationFrame(i), i = null), t("update:data", []), r.value = 0, w.value = -1;
|
|
1733
464
|
}
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
});
|
|
1738
|
-
const __returned__ = { props, emit, sprite, resizeSprite, application, texture, updateTexture, index, lastScheduledClearIndex, scheduleClearFrame, get animationId() {
|
|
1739
|
-
return animationId;
|
|
1740
|
-
}, set animationId(v) {
|
|
1741
|
-
animationId = v;
|
|
1742
|
-
}, get lastFrameTime() {
|
|
1743
|
-
return lastFrameTime;
|
|
1744
|
-
}, set lastFrameTime(v) {
|
|
1745
|
-
lastFrameTime = v;
|
|
1746
|
-
}, get frameCount() {
|
|
1747
|
-
return frameCount;
|
|
1748
|
-
}, set frameCount(v) {
|
|
1749
|
-
frameCount = v;
|
|
1750
|
-
}, get lastFpsUpdateTime() {
|
|
1751
|
-
return lastFpsUpdateTime;
|
|
1752
|
-
}, set lastFpsUpdateTime(v) {
|
|
1753
|
-
lastFpsUpdateTime = v;
|
|
1754
|
-
}, startFrameLoop, play, pause, stop };
|
|
1755
|
-
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1756
|
-
return __returned__;
|
|
465
|
+
return R(() => {
|
|
466
|
+
p(), f.destroy();
|
|
467
|
+
}), (s, d) => D(s.$slots, "default");
|
|
1757
468
|
}
|
|
1758
|
-
})
|
|
1759
|
-
|
|
1760
|
-
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1761
|
-
return renderSlot(_ctx.$slots, "default");
|
|
1762
|
-
}
|
|
1763
|
-
var bufferImage = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/buffer-image.vue"]]);
|
|
1764
|
-
|
|
1765
|
-
var _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
469
|
+
}), Me = /* @__PURE__ */ E({
|
|
1766
470
|
__name: "core",
|
|
1767
471
|
props: {
|
|
1768
|
-
...
|
|
472
|
+
...V,
|
|
1769
473
|
data: {
|
|
1770
474
|
type: void 0,
|
|
1771
|
-
required:
|
|
475
|
+
required: !0
|
|
1772
476
|
},
|
|
1773
477
|
frameIndex: {
|
|
1774
478
|
type: Number
|
|
1775
479
|
}
|
|
1776
480
|
},
|
|
1777
481
|
emits: {
|
|
1778
|
-
...
|
|
1779
|
-
|
|
482
|
+
...S,
|
|
483
|
+
load: (a) => a,
|
|
1780
484
|
"update:frameIndex": null,
|
|
1781
|
-
|
|
485
|
+
notFound: (a) => !0
|
|
1782
486
|
},
|
|
1783
|
-
setup(
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
const completedIndex = ref(0);
|
|
1792
|
-
const enabledData = computed(() => {
|
|
1793
|
-
return props.data.slice(completedIndex.value);
|
|
1794
|
-
});
|
|
1795
|
-
watchEffect(() => {
|
|
1796
|
-
for (const key in enabledData.value) {
|
|
1797
|
-
const theKey = +key + completedIndex.value;
|
|
1798
|
-
const alias = `${compId}-${theKey}`;
|
|
1799
|
-
const src = typeof enabledData.value[key] === "string" ? enabledData.value[key] : enabledData.value[key]?.src;
|
|
1800
|
-
if (!src) {
|
|
1801
|
-
continue;
|
|
1802
|
-
}
|
|
1803
|
-
if (textureMap.has(alias)) {
|
|
1804
|
-
continue;
|
|
1805
|
-
}
|
|
1806
|
-
Assets.add({
|
|
1807
|
-
alias,
|
|
1808
|
-
src,
|
|
487
|
+
setup(a, { emit: m }) {
|
|
488
|
+
const e = a, t = m, F = W(), l = (p) => `${F}-${p}`, { sprite: y, resizeSprite: f, application: v } = B(e), r = /* @__PURE__ */ new Map(), w = $(0), g = j(() => e.data.slice(w.value));
|
|
489
|
+
T(() => {
|
|
490
|
+
for (const p in g.value) {
|
|
491
|
+
const s = +p + w.value, d = `${F}-${s}`, x = typeof g.value[p] == "string" ? g.value[p] : g.value[p]?.src;
|
|
492
|
+
x && (r.has(d) || (P.add({
|
|
493
|
+
alias: d,
|
|
494
|
+
src: x,
|
|
1809
495
|
loadParser: "loadTextures"
|
|
1810
|
-
})
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
res._meta = enabledData.value[key];
|
|
1814
|
-
textureMap.set(alias, res);
|
|
1815
|
-
if (props.prerender && theKey === 0) {
|
|
1816
|
-
sprite.texture = res;
|
|
1817
|
-
resizeSprite();
|
|
1818
|
-
}
|
|
1819
|
-
});
|
|
496
|
+
}), r.set(d, void 0), P.load(d).then((o) => {
|
|
497
|
+
o._meta = g.value[p], r.set(d, o), e.prerender && s === 0 && (y.texture = o, f());
|
|
498
|
+
})));
|
|
1820
499
|
}
|
|
500
|
+
}), t("load", {
|
|
501
|
+
application: v,
|
|
502
|
+
sprite: y
|
|
1821
503
|
});
|
|
1822
|
-
|
|
1823
|
-
application,
|
|
1824
|
-
sprite
|
|
1825
|
-
});
|
|
1826
|
-
const index = useModelComputed({
|
|
504
|
+
const i = Q({
|
|
1827
505
|
default: 0,
|
|
1828
506
|
key: "frameIndex"
|
|
1829
|
-
},
|
|
1830
|
-
let
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
if (animationId !== null)
|
|
507
|
+
}, e, t);
|
|
508
|
+
let u = null, c = 0;
|
|
509
|
+
function k() {
|
|
510
|
+
if (u !== null)
|
|
1834
511
|
return;
|
|
1835
|
-
|
|
1836
|
-
function
|
|
1837
|
-
const
|
|
1838
|
-
|
|
1839
|
-
const delta = now - lastFrameTime;
|
|
1840
|
-
if (delta >= frameDuration) {
|
|
1841
|
-
lastFrameTime = now - delta % frameDuration;
|
|
1842
|
-
drawFrame();
|
|
1843
|
-
}
|
|
1844
|
-
if (props.status === TickerStatus.playing) {
|
|
1845
|
-
animationId = requestAnimationFrame(renderFrame);
|
|
1846
|
-
} else {
|
|
1847
|
-
animationId = null;
|
|
1848
|
-
}
|
|
512
|
+
c = performance.now();
|
|
513
|
+
function p() {
|
|
514
|
+
const d = performance.now(), x = 1e3 / e.frameRate, o = d - c;
|
|
515
|
+
o >= x && (c = d - o % x, s()), e.status === n.playing ? u = requestAnimationFrame(p) : u = null;
|
|
1849
516
|
}
|
|
1850
|
-
function
|
|
1851
|
-
if (
|
|
517
|
+
function s() {
|
|
518
|
+
if (e.data.length === 0 || e.status !== n.playing)
|
|
1852
519
|
return;
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
getAlias(index.value)
|
|
520
|
+
const d = r.get(
|
|
521
|
+
l(i.value)
|
|
1856
522
|
);
|
|
1857
|
-
if (
|
|
1858
|
-
const
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
});
|
|
1872
|
-
completedIndex.value = originIndex;
|
|
1873
|
-
});
|
|
1874
|
-
}
|
|
1875
|
-
sprite.texture = currentTexture;
|
|
1876
|
-
resizeSprite();
|
|
1877
|
-
index.value = props.loop ? (index.value + 1) % props.data.length : index.value + 1;
|
|
1878
|
-
} else {
|
|
523
|
+
if (d) {
|
|
524
|
+
const x = y.texture, o = i.value - 1;
|
|
525
|
+
x && o >= 0 && !e.loop && Promise.resolve(K(500)).then(() => P.unload(
|
|
526
|
+
l(o)
|
|
527
|
+
)).then(() => {
|
|
528
|
+
r.set(
|
|
529
|
+
l(o),
|
|
530
|
+
void 0
|
|
531
|
+
), t("setData", {
|
|
532
|
+
k: o,
|
|
533
|
+
v: ""
|
|
534
|
+
}), w.value = o;
|
|
535
|
+
}), y.texture = d, f(), i.value = e.loop ? (i.value + 1) % e.data.length : i.value + 1;
|
|
536
|
+
} else
|
|
1879
537
|
console.warn(
|
|
1880
|
-
`Texture for index ${
|
|
1881
|
-
);
|
|
1882
|
-
emit("notFound", index.value);
|
|
1883
|
-
if (!props.loop)
|
|
1884
|
-
emit("update:status", TickerStatus.paused);
|
|
1885
|
-
}
|
|
538
|
+
`Texture for index ${i.value} not found. Ensure the texture is loaded.`
|
|
539
|
+
), t("notFound", i.value), e.loop || t("update:status", n.paused);
|
|
1886
540
|
}
|
|
1887
|
-
|
|
541
|
+
u = requestAnimationFrame(p);
|
|
1888
542
|
}
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
function play() {
|
|
1895
|
-
if (props.data.length > 0) {
|
|
1896
|
-
emit("update:status", TickerStatus.playing);
|
|
1897
|
-
startFrameLoop();
|
|
1898
|
-
} else {
|
|
1899
|
-
emit("update:status", TickerStatus.stopped);
|
|
1900
|
-
}
|
|
543
|
+
G(() => e.status, (p) => {
|
|
544
|
+
p === n.play && A(), p === n.pause && I(), p === n.stop && h();
|
|
545
|
+
}, { immediate: !0 });
|
|
546
|
+
function A() {
|
|
547
|
+
e.data.length > 0 ? (t("update:status", n.playing), k()) : t("update:status", n.stopped);
|
|
1901
548
|
}
|
|
1902
|
-
function
|
|
1903
|
-
|
|
549
|
+
function I() {
|
|
550
|
+
t("update:status", n.paused);
|
|
1904
551
|
}
|
|
1905
|
-
function
|
|
1906
|
-
|
|
1907
|
-
if (animationId !== null) {
|
|
1908
|
-
cancelAnimationFrame(animationId);
|
|
1909
|
-
animationId = null;
|
|
1910
|
-
}
|
|
1911
|
-
emit("update:data", []);
|
|
1912
|
-
textureMap.clear();
|
|
1913
|
-
index.value = 0;
|
|
552
|
+
function h() {
|
|
553
|
+
t("update:status", n.stopped), u !== null && (cancelAnimationFrame(u), u = null), t("update:data", []), r.clear(), i.value = 0;
|
|
1914
554
|
}
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
}
|
|
1921
|
-
});
|
|
1922
|
-
stop();
|
|
1923
|
-
});
|
|
1924
|
-
const __returned__ = { props, emit, compId, getAlias, sprite, resizeSprite, application, textureMap, completedIndex, enabledData, index, get animationId() {
|
|
1925
|
-
return animationId;
|
|
1926
|
-
}, set animationId(v) {
|
|
1927
|
-
animationId = v;
|
|
1928
|
-
}, get lastFrameTime() {
|
|
1929
|
-
return lastFrameTime;
|
|
1930
|
-
}, set lastFrameTime(v) {
|
|
1931
|
-
lastFrameTime = v;
|
|
1932
|
-
}, startFrameLoop, play, pause, stop };
|
|
1933
|
-
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1934
|
-
return __returned__;
|
|
555
|
+
return R(() => {
|
|
556
|
+
Array.from(r.entries()).forEach(([s, d]) => {
|
|
557
|
+
d && P.unload(s);
|
|
558
|
+
}), h();
|
|
559
|
+
}), (p, s) => D(p.$slots, "default");
|
|
1935
560
|
}
|
|
1936
|
-
})
|
|
1937
|
-
|
|
1938
|
-
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1939
|
-
return renderSlot(_ctx.$slots, "default");
|
|
1940
|
-
}
|
|
1941
|
-
var core = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/core.vue"]]);
|
|
1942
|
-
|
|
1943
|
-
var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
561
|
+
}), ke = /* @__PURE__ */ E({
|
|
1944
562
|
__name: "provider",
|
|
1945
|
-
setup(
|
|
1946
|
-
|
|
1947
|
-
initPixiApp();
|
|
1948
|
-
const __returned__ = {};
|
|
1949
|
-
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1950
|
-
return __returned__;
|
|
563
|
+
setup(a) {
|
|
564
|
+
return we(), (m, e) => D(m.$slots, "default");
|
|
1951
565
|
}
|
|
1952
|
-
})
|
|
1953
|
-
|
|
1954
|
-
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1955
|
-
return renderSlot(_ctx.$slots, "default");
|
|
1956
|
-
}
|
|
1957
|
-
var ProviderComp = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/provider.vue"]]);
|
|
1958
|
-
|
|
1959
|
-
var _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
566
|
+
}), Pe = /* @__PURE__ */ E({
|
|
1960
567
|
__name: "video",
|
|
1961
568
|
props: {
|
|
1962
|
-
...
|
|
569
|
+
...V,
|
|
1963
570
|
url: {
|
|
1964
571
|
type: String,
|
|
1965
|
-
required:
|
|
572
|
+
required: !0
|
|
1966
573
|
}
|
|
1967
574
|
},
|
|
1968
|
-
emits,
|
|
1969
|
-
setup(
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
const { sprite, resizeSprite } = useSprite(props);
|
|
1976
|
-
const texture = ref();
|
|
1977
|
-
const video = computed(() => {
|
|
1978
|
-
if (texture.value?.source && texture.value.source.resource) {
|
|
1979
|
-
const resource = texture.value.source.resource;
|
|
1980
|
-
if (resource instanceof HTMLVideoElement) {
|
|
1981
|
-
return resource;
|
|
1982
|
-
}
|
|
575
|
+
emits: S,
|
|
576
|
+
setup(a, { emit: m }) {
|
|
577
|
+
const e = a, t = m, F = W(), l = () => `${F}-video`, { sprite: y, resizeSprite: f } = B(e), v = $(), r = j(() => {
|
|
578
|
+
if (v.value?.source && v.value.source.resource) {
|
|
579
|
+
const h = v.value.source.resource;
|
|
580
|
+
if (h instanceof HTMLVideoElement)
|
|
581
|
+
return h;
|
|
1983
582
|
}
|
|
1984
583
|
return null;
|
|
1985
|
-
});
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
});
|
|
1993
|
-
watchEffect(() => {
|
|
1994
|
-
video.value && (video.value.loop = props.loop);
|
|
1995
|
-
});
|
|
1996
|
-
onMounted(() => loadVideoTexture(props.url));
|
|
1997
|
-
async function loadVideoTexture(url) {
|
|
584
|
+
}), w = he(), g = $("");
|
|
585
|
+
w.promise.then(() => {
|
|
586
|
+
e.status === n.play && k();
|
|
587
|
+
}), T(() => {
|
|
588
|
+
r.value && (r.value.loop = e.loop);
|
|
589
|
+
}), X(() => i(e.url));
|
|
590
|
+
async function i(h) {
|
|
1998
591
|
try {
|
|
1999
|
-
|
|
2000
|
-
const
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
}
|
|
2023
|
-
function setupVideoEvents(video2) {
|
|
2024
|
-
video2.addEventListener("play", () => {
|
|
2025
|
-
if (props.status !== TickerStatus.playing) {
|
|
2026
|
-
emit("update:status", TickerStatus.playing);
|
|
2027
|
-
}
|
|
2028
|
-
});
|
|
2029
|
-
video2.addEventListener("pause", () => {
|
|
2030
|
-
if (props.status !== TickerStatus.paused) {
|
|
2031
|
-
emit("update:status", TickerStatus.paused);
|
|
2032
|
-
}
|
|
2033
|
-
});
|
|
2034
|
-
video2.addEventListener("ended", () => {
|
|
2035
|
-
if (props.loop) {
|
|
2036
|
-
video2.currentTime = 0;
|
|
2037
|
-
video2.play();
|
|
2038
|
-
} else {
|
|
2039
|
-
emit("update:status", TickerStatus.stopped);
|
|
2040
|
-
}
|
|
2041
|
-
});
|
|
2042
|
-
video2.addEventListener("error", (e) => {
|
|
2043
|
-
const error = video2.error;
|
|
2044
|
-
let errorMessage = "\u89C6\u9891\u64AD\u653E\u5931\u8D25";
|
|
2045
|
-
if (error) {
|
|
2046
|
-
switch (error.code) {
|
|
2047
|
-
case error.MEDIA_ERR_ABORTED:
|
|
2048
|
-
errorMessage = "\u89C6\u9891\u64AD\u653E\u88AB\u4E2D\u6B62";
|
|
592
|
+
g.value = "";
|
|
593
|
+
const p = l();
|
|
594
|
+
P.cache.has(p) && await P.unload(p), P.add({ alias: p, src: h });
|
|
595
|
+
const s = await P.load(p);
|
|
596
|
+
return v.value = s, y.texture = s, r.value && (r.value.loop = e.loop, r.value.muted = !0, r.value.crossOrigin = "anonymous", u(r.value), w.resolve()), f(), s;
|
|
597
|
+
} catch (p) {
|
|
598
|
+
return console.error("加载视频纹理失败:", p), g.value = "视频加载失败", null;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
function u(h) {
|
|
602
|
+
h.addEventListener("play", () => {
|
|
603
|
+
e.status !== n.playing && t("update:status", n.playing);
|
|
604
|
+
}), h.addEventListener("pause", () => {
|
|
605
|
+
e.status !== n.paused && t("update:status", n.paused);
|
|
606
|
+
}), h.addEventListener("ended", () => {
|
|
607
|
+
e.loop ? (h.currentTime = 0, h.play()) : t("update:status", n.stopped);
|
|
608
|
+
}), h.addEventListener("error", (p) => {
|
|
609
|
+
const s = h.error;
|
|
610
|
+
let d = "视频播放失败";
|
|
611
|
+
if (s)
|
|
612
|
+
switch (s.code) {
|
|
613
|
+
case s.MEDIA_ERR_ABORTED:
|
|
614
|
+
d = "视频播放被中止";
|
|
2049
615
|
break;
|
|
2050
|
-
case
|
|
2051
|
-
|
|
616
|
+
case s.MEDIA_ERR_NETWORK:
|
|
617
|
+
d = "网络错误导致视频播放失败";
|
|
2052
618
|
break;
|
|
2053
|
-
case
|
|
2054
|
-
|
|
619
|
+
case s.MEDIA_ERR_DECODE:
|
|
620
|
+
d = "视频解码失败";
|
|
2055
621
|
break;
|
|
2056
|
-
case
|
|
2057
|
-
|
|
622
|
+
case s.MEDIA_ERR_SRC_NOT_SUPPORTED:
|
|
623
|
+
d = "不支持的视频格式";
|
|
2058
624
|
break;
|
|
2059
625
|
}
|
|
2060
|
-
|
|
2061
|
-
console.error("\u89C6\u9891\u64AD\u653E\u9519\u8BEF:", errorMessage, e);
|
|
2062
|
-
videoError.value = errorMessage;
|
|
2063
|
-
emit("update:status", TickerStatus.stopped);
|
|
626
|
+
console.error("视频播放错误:", d, p), g.value = d, t("update:status", n.stopped);
|
|
2064
627
|
});
|
|
2065
628
|
}
|
|
2066
|
-
async function
|
|
2067
|
-
if (
|
|
2068
|
-
const
|
|
2069
|
-
|
|
2070
|
-
texture.value = void 0;
|
|
2071
|
-
if (Assets.cache.has(alias)) {
|
|
2072
|
-
await Assets.unload(alias);
|
|
2073
|
-
}
|
|
629
|
+
async function c() {
|
|
630
|
+
if (v.value) {
|
|
631
|
+
const h = l();
|
|
632
|
+
v.value.destroy(!0), v.value = void 0, P.cache.has(h) && await P.unload(h);
|
|
2074
633
|
}
|
|
2075
|
-
|
|
634
|
+
g.value = "";
|
|
2076
635
|
}
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
636
|
+
T(() => {
|
|
637
|
+
e.status === n.play && k(), e.status === n.pause && A(), e.status === n.stop && I();
|
|
638
|
+
}), R(() => {
|
|
639
|
+
c();
|
|
2081
640
|
});
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
if (video.value) {
|
|
2087
|
-
video.value.play().catch((error) => {
|
|
2088
|
-
console.error("\u89C6\u9891\u64AD\u653E\u5931\u8D25:", error);
|
|
2089
|
-
videoError.value = "\u89C6\u9891\u64AD\u653E\u5931\u8D25";
|
|
2090
|
-
});
|
|
2091
|
-
}
|
|
641
|
+
function k() {
|
|
642
|
+
r.value && r.value.play().catch((h) => {
|
|
643
|
+
console.error("视频播放失败:", h), g.value = "视频播放失败";
|
|
644
|
+
});
|
|
2092
645
|
}
|
|
2093
|
-
function
|
|
2094
|
-
|
|
646
|
+
function A() {
|
|
647
|
+
r.value?.pause();
|
|
2095
648
|
}
|
|
2096
|
-
function
|
|
2097
|
-
|
|
2098
|
-
video.value.pause();
|
|
2099
|
-
video.value.currentTime = 0;
|
|
2100
|
-
}
|
|
2101
|
-
emit("update:status", TickerStatus.stopped);
|
|
649
|
+
function I() {
|
|
650
|
+
r.value && (r.value.pause(), r.value.currentTime = 0), t("update:status", n.stopped);
|
|
2102
651
|
}
|
|
2103
|
-
|
|
2104
|
-
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2105
|
-
return __returned__;
|
|
652
|
+
return (h, p) => D(h.$slots, "default");
|
|
2106
653
|
}
|
|
2107
|
-
})
|
|
2108
|
-
|
|
2109
|
-
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2110
|
-
return renderSlot(_ctx.$slots, "default");
|
|
2111
|
-
}
|
|
2112
|
-
var VideoComp = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/video.vue"]]);
|
|
2113
|
-
|
|
2114
|
-
var _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
654
|
+
}), be = /* @__PURE__ */ E({
|
|
2115
655
|
__name: "view",
|
|
2116
656
|
props: {
|
|
2117
657
|
defaultOptions: {
|
|
@@ -2119,114 +659,97 @@ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2119
659
|
default: () => ({})
|
|
2120
660
|
}
|
|
2121
661
|
},
|
|
2122
|
-
setup(
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
});
|
|
2135
|
-
const __returned__ = { props, app, context, appRef };
|
|
2136
|
-
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2137
|
-
return __returned__;
|
|
662
|
+
setup(a) {
|
|
663
|
+
const m = a, { application: e, context: t } = ne(), F = $();
|
|
664
|
+
return X(async () => {
|
|
665
|
+
await e.init({
|
|
666
|
+
resizeTo: F.value,
|
|
667
|
+
...m.defaultOptions
|
|
668
|
+
}), t.whenDef.resolve(e), F.value.appendChild(e.canvas);
|
|
669
|
+
}), (l, y) => (N(), pe("div", {
|
|
670
|
+
ref_key: "appRef",
|
|
671
|
+
ref: F,
|
|
672
|
+
class: "vk-pixi-frame"
|
|
673
|
+
}, null, 512));
|
|
2138
674
|
}
|
|
2139
|
-
})
|
|
2140
|
-
|
|
2141
|
-
const _hoisted_1 = {
|
|
2142
|
-
ref: "appRef",
|
|
2143
|
-
class: "vk-pixi-frame"
|
|
2144
|
-
};
|
|
2145
|
-
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2146
|
-
return openBlock(), createElementBlock(
|
|
2147
|
-
"div",
|
|
2148
|
-
_hoisted_1,
|
|
2149
|
-
null,
|
|
2150
|
-
512
|
|
2151
|
-
/* NEED_PATCH */
|
|
2152
|
-
);
|
|
2153
|
-
}
|
|
2154
|
-
var ViewComp = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/view.vue"]]);
|
|
2155
|
-
|
|
2156
|
-
var _sfc_main = defineComponent({
|
|
675
|
+
}), $e = E({
|
|
2157
676
|
name: "VkPixiFrame",
|
|
2158
677
|
components: {
|
|
2159
|
-
ApngComp,
|
|
678
|
+
ApngComp: _e,
|
|
2160
679
|
// CoreComp,
|
|
2161
|
-
ProviderComp,
|
|
2162
|
-
ViewComp,
|
|
2163
|
-
VideoComp,
|
|
2164
|
-
Bitmap
|
|
680
|
+
ProviderComp: ke,
|
|
681
|
+
ViewComp: be,
|
|
682
|
+
VideoComp: Pe,
|
|
683
|
+
Bitmap: Fe
|
|
2165
684
|
},
|
|
2166
|
-
props,
|
|
2167
|
-
emits,
|
|
2168
|
-
setup(
|
|
2169
|
-
const
|
|
2170
|
-
if (!
|
|
2171
|
-
return
|
|
2172
|
-
const
|
|
2173
|
-
return
|
|
2174
|
-
})
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
return url.includes(".mp4") || url.includes(".webm") || url.includes(".mov");
|
|
685
|
+
props: V,
|
|
686
|
+
emits: S,
|
|
687
|
+
setup(a) {
|
|
688
|
+
const m = j(() => {
|
|
689
|
+
if (!a.url)
|
|
690
|
+
return !1;
|
|
691
|
+
const t = a.url.toLowerCase();
|
|
692
|
+
return t.includes(".png") && !t.includes(".mp4") && !t.includes(".webm");
|
|
693
|
+
}), e = j(() => {
|
|
694
|
+
if (!a.url)
|
|
695
|
+
return !1;
|
|
696
|
+
const t = a.url.toLowerCase();
|
|
697
|
+
return t.includes(".mp4") || t.includes(".webm") || t.includes(".mov");
|
|
2180
698
|
});
|
|
2181
699
|
return {
|
|
2182
|
-
isApng,
|
|
2183
|
-
isVideo
|
|
700
|
+
isApng: m,
|
|
701
|
+
isVideo: e
|
|
2184
702
|
};
|
|
2185
703
|
}
|
|
2186
704
|
});
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
const _component_ProviderComp = resolveComponent("ProviderComp");
|
|
2194
|
-
return openBlock(), createBlock(_component_ProviderComp, null, {
|
|
2195
|
-
default: withCtx(() => [
|
|
2196
|
-
createVNode(_component_ViewComp),
|
|
2197
|
-
_ctx.isApng && _ctx.url ? (openBlock(), createBlock(_component_ApngComp, {
|
|
705
|
+
function Ae(a, m, e, t, F, l) {
|
|
706
|
+
const y = q("ViewComp"), f = q("ApngComp"), v = q("VideoComp"), r = q("Bitmap"), w = q("ProviderComp");
|
|
707
|
+
return N(), U(w, null, {
|
|
708
|
+
default: ce(() => [
|
|
709
|
+
de(y),
|
|
710
|
+
a.isApng && a.url ? (N(), U(f, {
|
|
2198
711
|
key: 0,
|
|
2199
|
-
url:
|
|
2200
|
-
loop:
|
|
2201
|
-
status:
|
|
2202
|
-
"onUpdate:status":
|
|
2203
|
-
}, null, 8, ["url", "loop", "status"])) :
|
|
712
|
+
url: a.url,
|
|
713
|
+
loop: a.loop,
|
|
714
|
+
status: a.status,
|
|
715
|
+
"onUpdate:status": m[0] || (m[0] = (g) => a.$emit("update:status", g))
|
|
716
|
+
}, null, 8, ["url", "loop", "status"])) : a.isVideo && a.url ? (N(), U(v, {
|
|
2204
717
|
key: 1,
|
|
2205
|
-
url:
|
|
2206
|
-
loop:
|
|
2207
|
-
status:
|
|
2208
|
-
"onUpdate:status":
|
|
2209
|
-
}, null, 8, ["url", "loop", "status"])) : (
|
|
718
|
+
url: a.url,
|
|
719
|
+
loop: a.loop,
|
|
720
|
+
status: a.status,
|
|
721
|
+
"onUpdate:status": m[1] || (m[1] = (g) => a.$emit("update:status", g))
|
|
722
|
+
}, null, 8, ["url", "loop", "status"])) : (N(), U(r, {
|
|
2210
723
|
key: 2,
|
|
2211
|
-
data:
|
|
2212
|
-
loop:
|
|
2213
|
-
status:
|
|
2214
|
-
onSetData:
|
|
2215
|
-
"onUpdate:status":
|
|
724
|
+
data: a.data,
|
|
725
|
+
loop: a.loop,
|
|
726
|
+
status: a.status,
|
|
727
|
+
onSetData: m[2] || (m[2] = (g) => a.$emit("setData", g)),
|
|
728
|
+
"onUpdate:status": m[3] || (m[3] = (g) => a.$emit("update:status", g))
|
|
2216
729
|
}, null, 8, ["data", "loop", "status"]))
|
|
2217
730
|
]),
|
|
2218
731
|
_: 1
|
|
2219
|
-
/* STABLE */
|
|
2220
732
|
});
|
|
2221
733
|
}
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
734
|
+
const H = /* @__PURE__ */ xe($e, [["render", Ae]]), qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
735
|
+
__proto__: null
|
|
736
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
737
|
+
H.install = (a) => {
|
|
738
|
+
a.component(H.name || "VkPixiFrame", H);
|
|
739
|
+
};
|
|
740
|
+
export {
|
|
741
|
+
Oe as TickerStatus,
|
|
742
|
+
H as VkPixiFrame,
|
|
743
|
+
_e as VkPixiFrameApng,
|
|
744
|
+
Fe as VkPixiFrameBitmap,
|
|
745
|
+
Be as VkPixiFrameBitmapGenerator,
|
|
746
|
+
ze as VkPixiFrameBufferImage,
|
|
747
|
+
Me as VkPixiFrameCore,
|
|
748
|
+
ke as VkPixiFrameProvider,
|
|
749
|
+
Pe as VkPixiFrameVideo,
|
|
750
|
+
be as VkPixiFrameView,
|
|
751
|
+
qe as __VkPixiFrame,
|
|
752
|
+
H as default,
|
|
753
|
+
ne as usePixiApp,
|
|
754
|
+
B as useSprite
|
|
2230
755
|
};
|
|
2231
|
-
|
|
2232
|
-
export { VkPixiFrame, ApngComp as VkPixiFrameApng, Bitmap as VkPixiFrameBitmap, bitmapGenerator as VkPixiFrameBitmapGenerator, bufferImage as VkPixiFrameBufferImage, core as VkPixiFrameCore, ProviderComp as VkPixiFrameProvider, VideoComp as VkPixiFrameVideo, ViewComp as VkPixiFrameView, types as __VkPixiFrame, VkPixiFrame as default, usePixiApp, useSprite };
|