@vunk/plus 1.3.13 → 1.3.14

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.
@@ -3,6 +3,7 @@ import { S as State, b as localUniformBitGl } from './colorToUniform.mjs';
3
3
  import { e as ensureAttributes, G as GpuStencilModesToPixi, c as createUboSyncFunction, b as uboSyncFunctionsSTD40, U as UboSystem, R as RenderTargetSystem, B as BufferResource, d as uniformParsers, f as textureBitGl, S as SharedSystems, a as SharedRenderPipes } from './SharedSystems.mjs';
4
4
  import 'vue';
5
5
  import '@vunk/shared/enum';
6
+ import '@vunk/shared/promise';
6
7
  import './browser.mjs';
7
8
  import './_commonjsHelpers.mjs';
8
9
  import './_plugin-vue_export-helper.mjs';
@@ -3,6 +3,7 @@ import { S as State, l as localUniformBitGroup2, a as localUniformBit } from './
3
3
  import { c as createUboSyncFunction, u as uboSyncFunctionsWGSL, U as UboSystem, B as BufferResource, G as GpuStencilModesToPixi, e as ensureAttributes, R as RenderTargetSystem, t as textureBit, S as SharedSystems, a as SharedRenderPipes } from './SharedSystems.mjs';
4
4
  import 'vue';
5
5
  import '@vunk/shared/enum';
6
+ import '@vunk/shared/promise';
6
7
  import './browser.mjs';
7
8
  import './_commonjsHelpers.mjs';
8
9
  import './_plugin-vue_export-helper.mjs';
@@ -2,6 +2,7 @@ import { P as Point, r as removeItems, E as ExtensionType, T as Ticker, U as UPD
2
2
  import './init.mjs';
3
3
  import 'vue';
4
4
  import '@vunk/shared/enum';
5
+ import '@vunk/shared/promise';
5
6
  import './browser.mjs';
6
7
  import './_commonjsHelpers.mjs';
7
8
  import './_plugin-vue_export-helper.mjs';
@@ -1,5 +1,6 @@
1
- import { inject, provide, defineComponent, watchEffect, ref, onBeforeUnmount, renderSlot, onMounted, createElementBlock, openBlock, resolveComponent, createBlock, withCtx, createVNode, mergeProps } from 'vue';
1
+ import { inject, provide, defineComponent, useId, watchEffect, ref, onBeforeUnmount, renderSlot, onMounted, createElementBlock, openBlock, resolveComponent, createBlock, withCtx, createVNode, mergeProps } from 'vue';
2
2
  import { TickerStatus } from '@vunk/shared/enum';
3
+ import { sleep } from '@vunk/shared/promise';
3
4
  import { c as consola } from './browser.mjs';
4
5
  import { g as getDefaultExportFromCjs } from './_commonjsHelpers.mjs';
5
6
  import { _ as _export_sfc } from './_plugin-vue_export-helper.mjs';
@@ -21018,7 +21019,8 @@ const props = {
21018
21019
  };
21019
21020
  const emits = {
21020
21021
  "update:status": null,
21021
- "update:data": null
21022
+ "update:data": null,
21023
+ "setData": null
21022
21024
  };
21023
21025
 
21024
21026
  const appInjectKey = Symbol("appInjectKey");
@@ -21043,6 +21045,8 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
21043
21045
  const props = __props;
21044
21046
  const emit = __emit;
21045
21047
  const app = usePixiApp();
21048
+ const compId = useId();
21049
+ const getAlias = (key) => `${compId}-${key}`;
21046
21050
  const sprite = new Sprite();
21047
21051
  app.stage.addChild(sprite);
21048
21052
  function resizeSprite() {
@@ -21056,12 +21060,21 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
21056
21060
  const textureMap = /* @__PURE__ */ new Map();
21057
21061
  watchEffect(() => {
21058
21062
  for (const key in props.data) {
21063
+ const alias = `${compId}-${key}`;
21059
21064
  const url = props.data[key];
21060
- if (textureMap.has(url)) {
21065
+ if (textureMap.has(alias)) {
21061
21066
  continue;
21062
21067
  }
21063
- Assets.load(url).then((res) => {
21064
- textureMap.set(url, res);
21068
+ consola.info(
21069
+ `\u52A0\u8F7D\u7EB9\u7406 ${alias}`
21070
+ );
21071
+ Assets.add({
21072
+ alias,
21073
+ src: url
21074
+ });
21075
+ textureMap.set(alias, void 0);
21076
+ Assets.load(alias).then((res) => {
21077
+ textureMap.set(alias, res);
21065
21078
  if (key === "0") {
21066
21079
  sprite.texture = res;
21067
21080
  resizeSprite();
@@ -21078,9 +21091,26 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
21078
21091
  if (props.data.length === 0 || props.status !== TickerStatus.playing) {
21079
21092
  return;
21080
21093
  }
21081
- const currentTexture = textureMap.get(props.data[index.value]);
21082
- consola.info("Frame Index", index.value, currentTexture);
21094
+ const currentTexture = textureMap.get(
21095
+ getAlias(index.value)
21096
+ );
21083
21097
  if (currentTexture) {
21098
+ const originTexture = sprite.texture;
21099
+ const originIndex = index.value - 1;
21100
+ if (originTexture && originIndex >= 0) {
21101
+ Promise.resolve(sleep(500)).then(() => Assets.unload(
21102
+ getAlias(originIndex)
21103
+ )).then(() => {
21104
+ textureMap.set(
21105
+ getAlias(originIndex),
21106
+ void 0
21107
+ );
21108
+ emit("setData", {
21109
+ k: originIndex,
21110
+ v: ""
21111
+ });
21112
+ });
21113
+ }
21084
21114
  sprite.texture = currentTexture;
21085
21115
  resizeSprite();
21086
21116
  index.value = index.value + 1;
@@ -21217,4 +21247,4 @@ VkPixiFrame.install = (app) => {
21217
21247
  app.component(VkPixiFrame.name || "VkPixiFrame", VkPixiFrame);
21218
21248
  };
21219
21249
 
21220
- export { VERSION as $, AbstractRenderer as A, BufferUsage as B, Container as C, DOMAdapter as D, ExtensionType as E, Bounds as F, GpuProgram as G, TexturePool as H, FilterEffect as I, Sprite as J, getAttributeInfoFromFormat as K, unsafeEvalSupported as L, Matrix as M, uid as N, Rectangle as O, Point as P, SystemRunner as Q, RendererType as R, STENCIL_MODES as S, Ticker as T, UPDATE_PRIORITY as U, multiplyColors as V, UPDATE_VISIBLE as W, UPDATE_COLOR as X, UPDATE_BLEND as Y, Color as Z, getLocalBounds as _, EventEmitter as a, deprecation as a0, v8_0_0 as a1, RendererInitHook as a2, Geometry as a3, compileHighShaderGlProgram as a4, colorBitGl as a5, generateTextureBatchBitGl as a6, roundPixelsBitGl as a7, getBatchSamplersUniformGroup as a8, ViewContainer as a9, GraphicsContext as aa, TextStyle as ab, generateTextStyleKey as ac, BatchableGraphics as ad, getAdjustedBlendModeBlend as ae, ViewableBuffer as af, TextureStyle as ag, BitmapFontManager as ah, getBitmapTextLayout as ai, Cache as aj, updateQuadBounds as ak, CanvasTextMetrics as al, nextPow2 as am, fontStringFromTextStyle as an, getCanvasFillStyle as ao, GraphicsContextSystem as ap, _sfc_main$3 as aq, _sfc_main$2 as ar, _sfc_main$1 as as, VkPixiFrame as at, types as au, Buffer as b, BindGroup as c, createIdFromString as d, extensions as e, fastCopy as f, getTextureBatchBindGroup as g, CLEAR as h, CanvasSource as i, TextureSource as j, UniformGroup as k, CanvasPool as l, compileHighShaderGpuProgram as m, colorBit as n, generateTextureBatchBit as o, roundPixelsBit as p, getMaxTexturesPerBatch as q, removeItems as r, Shader as s, Texture as t, GlProgram as u, TextureMatrix as v, warn as w, DefaultBatcher as x, BigPool as y, getGlobalBounds as z };
21250
+ export { VERSION as $, AbstractRenderer as A, BufferUsage as B, Container as C, DOMAdapter as D, ExtensionType as E, Bounds as F, GpuProgram as G, TexturePool as H, FilterEffect as I, Sprite as J, getAttributeInfoFromFormat as K, unsafeEvalSupported as L, Matrix as M, uid as N, Rectangle as O, Point as P, SystemRunner as Q, RendererType as R, STENCIL_MODES as S, Ticker as T, UPDATE_PRIORITY as U, multiplyColors as V, UPDATE_VISIBLE as W, UPDATE_COLOR as X, UPDATE_BLEND as Y, Color as Z, getLocalBounds as _, EventEmitter as a, deprecation as a0, v8_0_0 as a1, RendererInitHook as a2, Geometry as a3, compileHighShaderGlProgram as a4, colorBitGl as a5, generateTextureBatchBitGl as a6, roundPixelsBitGl as a7, getBatchSamplersUniformGroup as a8, ViewContainer as a9, GraphicsContext as aa, TextStyle as ab, generateTextStyleKey as ac, BatchableGraphics as ad, getAdjustedBlendModeBlend as ae, ViewableBuffer as af, TextureStyle as ag, BitmapFontManager as ah, getBitmapTextLayout as ai, Cache as aj, updateQuadBounds as ak, CanvasTextMetrics as al, nextPow2 as am, fontStringFromTextStyle as an, getCanvasFillStyle as ao, GraphicsContextSystem as ap, VkPixiFrame as aq, _sfc_main$3 as ar, _sfc_main$2 as as, _sfc_main$1 as at, types as au, Buffer as b, BindGroup as c, createIdFromString as d, extensions as e, fastCopy as f, getTextureBatchBindGroup as g, CLEAR as h, CanvasSource as i, TextureSource as j, UniformGroup as k, CanvasPool as l, compileHighShaderGpuProgram as m, colorBit as n, generateTextureBatchBit as o, roundPixelsBit as p, getMaxTexturesPerBatch as q, removeItems as r, Shader as s, Texture as t, GlProgram as u, TextureMatrix as v, warn as w, DefaultBatcher as x, BigPool as y, getGlobalBounds as z };
@@ -4,5 +4,5 @@ import VkPixiFrameProvider from './src/provider.vue';
4
4
  import VkPixiFrameView from './src/view.vue';
5
5
  export * as __VkPixiFrame from './src/types';
6
6
  export { TickerStatus } from '@vunk/shared/enum';
7
- export { VkPixiFrameCore, VkPixiFrameProvider, VkPixiFrameView, };
7
+ export { VkPixiFrame, VkPixiFrameCore, VkPixiFrameProvider, VkPixiFrameView, };
8
8
  export default VkPixiFrame;
@@ -1,6 +1,7 @@
1
- export { aq as VkPixiFrameCore, ar as VkPixiFrameProvider, as as VkPixiFrameView, au as __VkPixiFrame, at as default } from '../index2.mjs';
1
+ export { aq as VkPixiFrame, ar as VkPixiFrameCore, as as VkPixiFrameProvider, at as VkPixiFrameView, au as __VkPixiFrame, aq as default } from '../index2.mjs';
2
2
  export { TickerStatus } from '@vunk/shared/enum';
3
3
  import 'vue';
4
+ import '@vunk/shared/promise';
4
5
  import '../browser.mjs';
5
6
  import '../_commonjsHelpers.mjs';
6
7
  import '../_plugin-vue_export-helper.mjs';
@@ -1,6 +1,6 @@
1
1
  import type { Texture } from 'pixi.js';
2
2
  import { TickerStatus } from '@vunk/shared/enum';
3
- import { Sprite } from 'pixi.js';
3
+ import { Sprite, TextureSource } from 'pixi.js';
4
4
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
5
5
  data: {
6
6
  type: {
@@ -63,14 +63,17 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
63
63
  default: number;
64
64
  };
65
65
  }>> & Readonly<{
66
+ onSetData?: ((...args: any[]) => any) | undefined;
66
67
  "onUpdate:status"?: ((...args: any[]) => any) | undefined;
67
68
  "onUpdate:data"?: ((...args: any[]) => any) | undefined;
68
69
  }> & {}>;
69
- emit: ((event: "update:status", ...args: any[]) => void) & ((event: "update:data", ...args: any[]) => void);
70
+ emit: ((event: "setData", ...args: any[]) => void) & ((event: "update:status", ...args: any[]) => void) & ((event: "update:data", ...args: any[]) => void);
70
71
  app: import("pixi.js").Application<import("pixi.js").Renderer>;
72
+ compId: string;
73
+ getAlias: (key: string | number) => string;
71
74
  sprite: Sprite;
72
75
  resizeSprite: () => void;
73
- textureMap: Map<string, Texture<import("pixi.js").TextureSource<any>>>;
76
+ textureMap: Map<string, Texture<TextureSource<any>>>;
74
77
  index: import("vue").Ref<number, number>;
75
78
  timer: number | null;
76
79
  startFrameLoop: () => void;
@@ -80,6 +83,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
80
83
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
81
84
  'update:status': null;
82
85
  'update:data': null;
86
+ setData: null;
83
87
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
84
88
  data: {
85
89
  type: {
@@ -111,6 +115,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
111
115
  default: number;
112
116
  };
113
117
  }>> & Readonly<{
118
+ onSetData?: ((...args: any[]) => any) | undefined;
114
119
  "onUpdate:status"?: ((...args: any[]) => any) | undefined;
115
120
  "onUpdate:data"?: ((...args: any[]) => any) | undefined;
116
121
  }>, {
@@ -37,4 +37,5 @@ export declare const props: {
37
37
  export declare const emits: {
38
38
  'update:status': null;
39
39
  'update:data': null;
40
+ setData: null;
40
41
  };
@@ -31,6 +31,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
31
31
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
32
32
  'update:status': null;
33
33
  'update:data': null;
34
+ setData: null;
34
35
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
35
36
  data: {
36
37
  type: {
@@ -62,6 +63,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
62
63
  default: number;
63
64
  };
64
65
  }>> & Readonly<{
66
+ onSetData?: ((...args: any[]) => any) | undefined;
65
67
  "onUpdate:status"?: ((...args: any[]) => any) | undefined;
66
68
  "onUpdate:data"?: ((...args: any[]) => any) | undefined;
67
69
  }>, {
@@ -132,11 +134,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
132
134
  default: number;
133
135
  };
134
136
  }>> & Readonly<{
137
+ onSetData?: ((...args: any[]) => any) | undefined;
135
138
  "onUpdate:status"?: ((...args: any[]) => any) | undefined;
136
139
  "onUpdate:data"?: ((...args: any[]) => any) | undefined;
137
140
  }> & {}>;
138
- emit: ((event: "update:status", ...args: any[]) => void) & ((event: "update:data", ...args: any[]) => void);
141
+ emit: ((event: "setData", ...args: any[]) => void) & ((event: "update:status", ...args: any[]) => void) & ((event: "update:data", ...args: any[]) => void);
139
142
  app: import("pixi.js").Application<import("pixi.js").Renderer>;
143
+ compId: string;
144
+ getAlias: (key: string | number) => string;
140
145
  sprite: import("pixi.js").Sprite;
141
146
  resizeSprite: () => void;
142
147
  textureMap: Map<string, import("pixi.js").Texture<import("pixi.js").TextureSource<any>>>;
@@ -149,6 +154,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
149
154
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
150
155
  'update:status': null;
151
156
  'update:data': null;
157
+ setData: null;
152
158
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
153
159
  data: {
154
160
  type: {
@@ -180,6 +186,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
180
186
  default: number;
181
187
  };
182
188
  }>> & Readonly<{
189
+ onSetData?: ((...args: any[]) => any) | undefined;
183
190
  "onUpdate:status"?: ((...args: any[]) => any) | undefined;
184
191
  "onUpdate:data"?: ((...args: any[]) => any) | undefined;
185
192
  }>, {
@@ -3,6 +3,7 @@ import './index2.mjs';
3
3
  import './colorToUniform.mjs';
4
4
  import 'vue';
5
5
  import '@vunk/shared/enum';
6
+ import '@vunk/shared/promise';
6
7
  import './browser.mjs';
7
8
  import './_commonjsHelpers.mjs';
8
9
  import './_plugin-vue_export-helper.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vunk/plus",
3
- "version": "1.3.13",
3
+ "version": "1.3.14",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "ISC",