@shijiu/jsview-vue 2.2.426-test.0 → 2.3.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.
Files changed (86) hide show
  1. package/bin/jsview-vue-common.mjs +1 -1
  2. package/bin/jsview-vue.mjs +7506 -6980
  3. package/bin/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusManager.d.ts +11 -2
  4. package/bin/types/utils/JsViewEngineWidget/MetroWidget/DebugFrame.vue.d.ts +8 -0
  5. package/bin/types/utils/JsViewEngineWidget/MetroWidget/DebugTools.d.ts +5 -0
  6. package/bin/types/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +24 -6
  7. package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +24 -6
  8. package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +9 -2
  9. package/bin/types/utils/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +3 -0
  10. package/bin/types/utils/JsViewPlugin/JsvAudio/version.d.mts +1 -0
  11. package/bin/types/utils/JsViewPlugin/JsvAudio/version.d.ts +1 -0
  12. package/bin/types/utils/JsViewPlugin/JsvLatex/BrowserJsvLatex.vue.d.ts +1 -1
  13. package/bin/types/utils/JsViewPlugin/JsvLatex/JsvLatex.vue.d.ts +1 -1
  14. package/bin/types/utils/JsViewPlugin/JsvPlayer/AckEventDefine.d.ts +10 -0
  15. package/bin/types/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue.d.ts +1 -2
  16. package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvMedia.d.ts +2 -2
  17. package/bin/types/utils/JsViewVueTools/JsvRuntimeBridge.d.ts +6 -0
  18. package/bin/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.d.ts +21 -0
  19. package/bin/types/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +1 -1
  20. package/bin/types/utils/JsViewVueTools/index.d.ts +0 -1
  21. package/bin/types/utils/JsViewVueWidget/Jsv3dDiv.vue.d.ts +120 -0
  22. package/bin/types/utils/JsViewVueWidget/Jsv3dStage.vue.d.ts +144 -0
  23. package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic/index.d.ts +50 -2
  24. package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic2/index.d.ts +23 -2
  25. package/bin/types/utils/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue.d.ts +4 -4
  26. package/bin/types/utils/JsViewVueWidget/JsvFilterView.vue.d.ts +3 -3
  27. package/bin/types/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue.d.ts +78 -0
  28. package/bin/types/utils/JsViewVueWidget/JsvFlexCell/index.d.ts +1 -0
  29. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue.d.ts +3 -3
  30. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/JsvEnvBlocker.vue.d.ts +3 -3
  31. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +1 -0
  32. package/bin/types/utils/JsViewVueWidget/JsvInput/Cursor.vue.d.ts +1 -1
  33. package/bin/types/utils/JsViewVueWidget/JsvMindMap/JsvMindMap.vue.d.ts +3 -3
  34. package/bin/types/utils/JsViewVueWidget/JsvNinePatch.vue.d.ts +4 -4
  35. package/bin/types/utils/JsViewVueWidget/JsvPosterDiv.vue.d.ts +3 -0
  36. package/bin/types/utils/JsViewVueWidget/JsvPosterImage.vue.d.ts +3 -0
  37. package/bin/types/utils/JsViewVueWidget/JsvRipple/JsvRipple.vue.d.ts +3 -3
  38. package/bin/types/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue.d.ts +10 -37
  39. package/bin/types/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue.d.ts +1 -1
  40. package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue.d.ts +1 -1
  41. package/bin/types/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue.d.ts +3 -3
  42. package/bin/types/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue.d.ts +3 -2
  43. package/bin/types/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue.d.ts +3 -3
  44. package/bin/types/utils/JsViewVueWidget/JsvVisibleSensor/index.d.ts +3 -3
  45. package/bin/types/utils/JsViewVueWidget/index.d.ts +2 -0
  46. package/package.json +1 -1
  47. package/utils/JsViewEngineWidget/CheckType.js +3 -3
  48. package/utils/JsViewEngineWidget/JsvFocus/JsvFocusBlock.vue +25 -6
  49. package/utils/JsViewEngineWidget/JsvFocus/JsvFocusManager.ts +22 -3
  50. package/utils/JsViewEngineWidget/MetroWidget/DebugFrame.vue +22 -0
  51. package/utils/JsViewEngineWidget/MetroWidget/DebugTools.ts +37 -0
  52. package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +42 -7
  53. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +62 -10
  54. package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +205 -91
  55. package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +30 -0
  56. package/utils/JsViewPlugin/JsvAudio/version.js +1 -1
  57. package/utils/JsViewPlugin/JsvAudio/version.mjs +1 -1
  58. package/utils/JsViewPlugin/JsvPlayer/AckEventDefine.ts +82 -0
  59. package/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue +49 -31
  60. package/utils/JsViewVueTools/JsvRuntimeBridge.js +12 -3
  61. package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.ts +38 -2
  62. package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +1 -1
  63. package/utils/JsViewVueTools/index.js +0 -1
  64. package/utils/JsViewVueWidget/Jsv3dDiv.vue +85 -0
  65. package/utils/JsViewVueWidget/Jsv3dStage.vue +50 -0
  66. package/utils/JsViewVueWidget/JsvApic/JsvApic/index.js +1 -8
  67. package/utils/JsViewVueWidget/JsvApic/JsvApic2/index.js +1 -8
  68. package/utils/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue +1 -1
  69. package/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue +151 -0
  70. package/utils/JsViewVueWidget/JsvFlexCell/JsvScreenFlex.vue +2 -2
  71. package/utils/JsViewVueWidget/JsvFlexCell/index.js +1 -0
  72. package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +8 -0
  73. package/utils/JsViewVueWidget/JsvInput/EditViewOperator.ts +1 -1
  74. package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +0 -9
  75. package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +57 -71
  76. package/utils/JsViewVueWidget/JsvPosterDiv.vue +15 -8
  77. package/utils/JsViewVueWidget/JsvPosterImage.vue +11 -1
  78. package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
  79. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +99 -61
  80. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +48 -48
  81. package/utils/JsViewVueWidget/index.js +2 -0
  82. package/bin/browser/BrowserApic.vue.mjs +0 -114
  83. package/bin/browser/BrowserApic2.vue.mjs +0 -108
  84. package/bin/browser/BrowserApicLib.mjs +0 -431
  85. package/bin/types/utils/JsViewVueTools/JsvDemoTester.d.ts +0 -2
  86. package/utils/JsViewVueTools/JsvDemoTester.js +0 -81
@@ -84,6 +84,11 @@ const TexAlignAnchor = {
84
84
  };
85
85
  export { TexAlignAnchor };
86
86
 
87
+ const STATE_IDLE = 0;
88
+ const STATE_RUNNING = 1;
89
+ const STATE_PAUSED = 2;
90
+ const STATE_END = 3;
91
+
87
92
  export default {
88
93
  props: {
89
94
  src: String,
@@ -128,7 +133,7 @@ export default {
128
133
  },
129
134
  setup() {
130
135
  return {
131
- forgeAnimation: null,
136
+ runningState: STATE_IDLE, // 0:未开始, 1:运行中, 2:暂停, 3:正常结束
132
137
  innerViewId: -1,
133
138
  };
134
139
  },
@@ -244,7 +249,10 @@ export default {
244
249
  return new Forge.LayoutView(texture_set);
245
250
  },
246
251
 
247
- _onAnimationEnd() {
252
+ _onAnimationEnd(normal_end) {
253
+ if (normal_end) {
254
+ this.runningState = STATE_END;
255
+ }
248
256
  this.onAnimationEnd?.();
249
257
  },
250
258
 
@@ -273,9 +281,34 @@ export default {
273
281
  }
274
282
  },
275
283
 
284
+ _buildAnimation() {
285
+ if (this.animation) {
286
+ let anim = new Forge.CssKeyframeAnimation(
287
+ "@keyframes texAnimDef" + this.animation,
288
+ this.duration,
289
+ null,
290
+ 1,
291
+ 1
292
+ );
293
+ anim.EnableDelay(this.delay).SetRepeat(this.repeat);
294
+ anim.Enable(Forge.AnimationEnable.ReleaseAfterEndCallback);
295
+ anim.SetAnimationListener(
296
+ new Forge.AnimationListener(null, this._onAnimationEnd, null)
297
+ );
298
+
299
+ return anim;
300
+ } else {
301
+ return null;
302
+ }
303
+ },
304
+
276
305
  start() {
277
- if (this.forgeAnimation && this.innerView) {
278
- this.innerView.StartTextureAnimation(this.forgeAnimation);
306
+ if (this.innerView) {
307
+ let anim = this._buildAnimation();
308
+ if (anim) {
309
+ this.runningState = STATE_RUNNING;
310
+ this.innerView.StartTextureAnimation(anim);
311
+ }
279
312
  }
280
313
  },
281
314
 
@@ -311,9 +344,9 @@ export default {
311
344
  );
312
345
  // 1.1 兼容border转为decorate
313
346
  let decorate = this.$props.decorate;
314
- // if (this.$props.borderRadius) {
315
- // decorate = this._readRadius(this.$props.borderRadius);
316
- // }
347
+ if (this.$props.borderRadius) {
348
+ decorate = this._readRadius(this.$props.borderRadius);
349
+ }
317
350
 
318
351
  // 2.创建view
319
352
  this.innerView = this._createForgeView(view_texture, decorate);
@@ -326,26 +359,7 @@ export default {
326
359
  }
327
360
  this._updateTexCoord();
328
361
 
329
- // 4.设置texture的动画形变
330
- if (this.animation) {
331
- this.forgeAnimation = new Forge.CssKeyframeAnimation(
332
- "@keyframes texAnimDef" + this.animation,
333
- this.duration,
334
- null,
335
- 1,
336
- 1
337
- );
338
- this.forgeAnimation.EnableDelay(this.delay).SetRepeat(this.repeat);
339
- this.forgeAnimation.Enable(Forge.AnimationEnable.ReleaseAfterEndCallback);
340
- this.forgeAnimation.SetAnimationListener(
341
- new Forge.AnimationListener(null, this._onAnimationEnd, null)
342
- );
343
- } else {
344
- this.forgeAnimation = null;
345
- }
346
-
347
- // 5. inner view标准处理
348
-
362
+ // 4. inner view标准处理
349
363
  this.innerViewId = Forge.sViewStore.add(new Forge.ViewInfo(this.innerView));
350
364
  },
351
365
  beforeUnmount() {
@@ -360,33 +374,19 @@ export default {
360
374
  }
361
375
  },
362
376
  activated() {
363
- if (this.innerView) {
364
- if (this.animation && this.forgeAnimation == null) {
365
- this.forgeAnimation = new Forge.CssKeyframeAnimation(
366
- "@keyframes texAnimDef" + this.animation,
367
- this.duration,
368
- null,
369
- 1,
370
- 1
371
- );
372
- this.forgeAnimation.EnableDelay(this.delay).SetRepeat(this.repeat);
373
- this.forgeAnimation.Enable(
374
- Forge.AnimationEnable.ReleaseAfterEndCallback
375
- );
376
- this.forgeAnimation.SetAnimationListener(
377
- new Forge.AnimationListener(null, this._onAnimationEnd, null)
378
- );
379
- this.innerView.StartTextureAnimation(this.forgeAnimation);
380
- } else {
381
- this.forgeAnimation = null;
382
- }
377
+ if (this.innerView && this.runningState == STATE_PAUSED) {
378
+ // 动画未正常结束,重新开始动画
379
+ let anim = this._buildAnimation();
380
+ this.innerView.StartTextureAnimation(anim); // pause状态,一定有值
383
381
  }
384
382
  },
385
383
  deactivated() {
386
384
  if (this.innerView) {
387
385
  this.innerView.StopTextureAnimation();
386
+ if (this.runningState == STATE_RUNNING) {
387
+ this.runningState = STATE_PAUSED;
388
+ }
388
389
  }
389
- this.forgeAnimation = null;
390
390
  },
391
391
  };
392
392
  </script>
@@ -63,3 +63,5 @@ export * from "./JsvClipDiv"
63
63
  export * from "./JsvDriftScope"
64
64
  export { default as JsvTouchModeSwitcher } from "./JsvTouchModeSwitcher.vue"
65
65
  export { default as JsvDragBox } from "./JsvDragBox/JsvDragBox.vue"
66
+ export { default as Jsv3dDiv } from "./Jsv3dDiv.vue";
67
+ export { default as Jsv3dStage } from "./Jsv3dStage.vue";
@@ -1,114 +0,0 @@
1
- import { shallowRef, onMounted, openBlock, createElementBlock, normalizeStyle } from 'vue';
2
- import { W as WebpData, G as GifData, V as Viewer } from './BrowserApicLib.mjs';
3
- import { L as LoopType } from '../jsview-vue-common.mjs';
4
-
5
- /*
6
- + @file {@link file://./../../../../../utils/JsViewVueWidget/JsvApic/JsvApic/BrowserApic.vue}
7
- */
8
- const _sfc_main = {
9
- __name: "BrowserApic",
10
- props: {
11
- src: String,
12
- style: Object,
13
- autoPlay: {
14
- type: Boolean,
15
- default: true
16
- },
17
- loopType: {
18
- type: Number,
19
- default: LoopType.LOOP_DEFAULT
20
- },
21
- loopInfo: {
22
- type: Array,
23
- default: () => [[-1, -1, -1]]
24
- },
25
- onStart: Function,
26
- onEnd: Function,
27
- onLoad: Function
28
- },
29
- setup(__props, { expose }) {
30
- const props = __props;
31
- const renderDocument = window.JsvCode.Dom.RenderDocument ? window.JsvCode.Dom.RenderDocument : window.JsvCode.Dom.BrowserDocument;
32
- const loadImage = (url) => {
33
- return new Promise((resolve, reject) => {
34
- let xhr = new XMLHttpRequest();
35
- xhr.open("GET", url);
36
- xhr.responseType = "arraybuffer";
37
- xhr.onreadystatechange = () => {
38
- if (xhr.readyState === 4 && xhr.status === 200) {
39
- if (xhr.status == 200) {
40
- let apic_data;
41
- if (url.indexOf(".webp") > 0) {
42
- apic_data = new WebpData(xhr.response);
43
- resolve(apic_data);
44
- } else if (url.indexOf(".gif") > 0) {
45
- apic_data = new GifData(xhr.response);
46
- resolve(apic_data);
47
- } else {
48
- reject("unsupport file " + url);
49
- }
50
- } else {
51
- reject("get image data failed. " + url + " " + xhr.status);
52
- }
53
- }
54
- };
55
- xhr.send();
56
- });
57
- };
58
- const getUrl = (base_url) => {
59
- let url_trim = base_url.trim();
60
- if (url_trim.indexOf("http") === 0) {
61
- return url_trim;
62
- } else if (url_trim.indexOf("url") === 0) {
63
- let index_1 = url_trim.indexOf("(");
64
- let index_2 = url_trim.indexOf(")");
65
- return url_trim.substring(index_1 + 1, index_2);
66
- } else {
67
- return url_trim;
68
- }
69
- };
70
- let viewer = null;
71
- let canvasProxyRef = shallowRef(null);
72
- const play = () => {
73
- viewer?.play(props.loopType, props.loopInfo);
74
- };
75
- const stop = (frameCount = -1) => {
76
- viewer?.stop(frameCount);
77
- };
78
- onMounted(() => {
79
- let domLayoutView = canvasProxyRef.value.jsvGetProxyView();
80
- domLayoutView.RegisterOnProxyReady(() => {
81
- let canvas = renderDocument.createElement("canvas");
82
- canvas.style.width = props.style.width + "px";
83
- canvas.style.height = props.style.height + "px";
84
- domLayoutView.HtmlGetElement().appendChild(canvas);
85
- loadImage(getUrl(props.src)).then((data) => {
86
- let listener = {
87
- onstart: props.onStart,
88
- onend: props.onEnd
89
- };
90
- viewer = new Viewer(data, canvas, listener);
91
- if (props.onLoad) {
92
- props.onLoad();
93
- }
94
- if (props.autoPlay) {
95
- play();
96
- }
97
- }).catch((err) => console.error(err));
98
- });
99
- });
100
- expose({
101
- play,
102
- stop
103
- });
104
- return (_ctx, _cache) => {
105
- return openBlock(), createElementBlock("div", {
106
- ref_key: "canvasProxyRef",
107
- ref: canvasProxyRef,
108
- style: normalizeStyle(props.style)
109
- }, null, 4);
110
- };
111
- }
112
- };
113
-
114
- export { _sfc_main as default };
@@ -1,108 +0,0 @@
1
- import { shallowRef, onMounted, openBlock, createElementBlock, normalizeStyle } from 'vue';
2
- import { W as WebpData, G as GifData, V as Viewer } from './BrowserApicLib.mjs';
3
- import { L as LoopType } from '../jsview-vue-common.mjs';
4
-
5
- /*
6
- + @file {@link file://./../../../../../utils/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue}
7
- */
8
- const _sfc_main = {
9
- __name: "BrowserApic2",
10
- props: {
11
- src: String,
12
- style: Object,
13
- onStart: Function,
14
- onEnd: Function,
15
- onLoad: Function
16
- },
17
- setup(__props, { expose }) {
18
- const props = __props;
19
- let waitForPlayInfo = null;
20
- const renderDocument = window.JsvCode.Dom.RenderDocument ? window.JsvCode.Dom.RenderDocument : window.JsvCode.Dom.BrowserDocument;
21
- const loadImage = (url) => {
22
- return new Promise((resolve, reject) => {
23
- let xhr = new XMLHttpRequest();
24
- xhr.open("GET", url);
25
- xhr.responseType = "arraybuffer";
26
- xhr.onreadystatechange = () => {
27
- if (xhr.readyState === 4 && xhr.status === 200) {
28
- if (xhr.status == 200) {
29
- let apic_data;
30
- if (url.indexOf(".webp") > 0) {
31
- apic_data = new WebpData(xhr.response);
32
- resolve(apic_data);
33
- } else if (url.indexOf(".gif") > 0) {
34
- apic_data = new GifData(xhr.response);
35
- resolve(apic_data);
36
- } else {
37
- reject("unsupport file " + url);
38
- }
39
- } else {
40
- reject("get image data failed. " + url + " " + xhr.status);
41
- }
42
- }
43
- };
44
- xhr.send();
45
- });
46
- };
47
- const getUrl = (base_url) => {
48
- let url_trim = base_url.trim();
49
- if (url_trim.indexOf("http") === 0) {
50
- return url_trim;
51
- } else if (url_trim.indexOf("url") === 0) {
52
- let index_1 = url_trim.indexOf("(");
53
- let index_2 = url_trim.indexOf(")");
54
- return url_trim.substring(index_1 + 1, index_2);
55
- } else {
56
- return url_trim;
57
- }
58
- };
59
- let viewer = null;
60
- let canvasProxyRef = shallowRef(null);
61
- onMounted(() => {
62
- let domLayoutView = canvasProxyRef.value.jsvGetProxyView();
63
- domLayoutView.RegisterOnProxyReady(() => {
64
- let canvas = renderDocument.createElement("canvas");
65
- canvas.style.width = props.style.width + "px";
66
- canvas.style.height = props.style.height + "px";
67
- domLayoutView.HtmlGetElement().appendChild(canvas);
68
- loadImage(getUrl(props.src)).then((data) => {
69
- let listener = {
70
- onstart: props.onStart,
71
- onend: props.onEnd
72
- };
73
- viewer = new Viewer(data, canvas, listener);
74
- if (props.onLoad) {
75
- props.onLoad();
76
- }
77
- if (waitForPlayInfo) {
78
- viewer.play(...waitForPlayInfo);
79
- waitForPlayInfo = null;
80
- }
81
- }).catch((err) => console.error(err));
82
- });
83
- });
84
- expose({
85
- show: (frameIndex = 0) => {
86
- if (!isNaN(frameIndex)) {
87
- viewer?.play(LoopType.LOOP_SINGLE, [[0, frameIndex, 0]]);
88
- }
89
- },
90
- play: (...args) => {
91
- waitForPlayInfo = args;
92
- viewer?.play(...args);
93
- },
94
- stop: (frameCount = -1) => {
95
- viewer?.stop(frameCount);
96
- }
97
- });
98
- return (_ctx, _cache) => {
99
- return openBlock(), createElementBlock("div", {
100
- ref_key: "canvasProxyRef",
101
- ref: canvasProxyRef,
102
- style: normalizeStyle(props.style)
103
- }, null, 4);
104
- };
105
- }
106
- };
107
-
108
- export { _sfc_main as default };