@shijiu/jsview-vue 0.9.422 → 0.9.490

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 (56) hide show
  1. package/dom/bin/jsview-browser-debug-dom.min.js +1 -1
  2. package/dom/bin/jsview-dom.min.js +1 -1
  3. package/dom/jsv-browser-debug-dom.js_1 +8 -0
  4. package/dom/jsv-dom.js_1 +6 -0
  5. package/dom/jsv-forge-define.js_1 +6 -0
  6. package/dom/target_core_revision.js +3 -3
  7. package/package.json +1 -1
  8. package/patches/node_modules/@vue/cli-service/lib/config/assets.js +1 -1
  9. package/samples/ColorSpace/App.vue +4 -4
  10. package/samples/DemoHomepage/router.js +16 -1
  11. package/samples/FilterDemo/App.vue +121 -0
  12. package/samples/GridDemo/App.vue +183 -0
  13. package/samples/GridDemo/ButtonBlock.vue +111 -0
  14. package/samples/GridDemo/FocusItem.vue +56 -0
  15. package/samples/GridDemo/Item.vue +101 -0
  16. package/samples/NinePatchDemo/App.vue +146 -0
  17. package/samples/NinePatchDemo/Item.vue +70 -0
  18. package/samples/TouchSample/App.vue +137 -0
  19. package/samples/TouchSample/Item.vue +101 -0
  20. package/samples/TouchSample/MetroWidgetHorizontal.vue +144 -0
  21. package/samples/TouchSample/MetroWidgetVertical.vue +144 -0
  22. package/samples/TouchSample/TouchContainerHorizontal.vue +159 -0
  23. package/samples/TouchSample/TouchContainerVertical.vue +159 -0
  24. package/samples/TouchSample/data.js +81 -0
  25. package/samples/{ColorSpace → assets}/bmpDemo.bmp +0 -0
  26. package/samples/{ColorSpace → assets}/jpegDemo.jpeg +0 -0
  27. package/samples/{ColorSpace → assets}/pngDemo.png +0 -0
  28. package/samples/{ColorSpace → assets}/pngNoAlphaDemo.png +0 -0
  29. package/samples/assets/webpDemo.webp +0 -0
  30. package/scripts/jsview-jsmap-serve.js +63 -0
  31. package/scripts/jsview-post-build.js +45 -3
  32. package/scripts/jsview-post-install.js +22 -0
  33. package/utils/JsViewEngineWidget/JsvFocusBlock.vue +7 -5
  34. package/utils/JsViewEngineWidget/JsvFocusManager.js +5 -0
  35. package/utils/JsViewEngineWidget/MetroWidget/ItemView.vue +7 -14
  36. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +212 -89
  37. package/utils/JsViewEngineWidget/MetroWidget/RootView.vue +4 -3
  38. package/utils/JsViewEngineWidget/TemplateParser.js +8 -6
  39. package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +20 -0
  40. package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +203 -85
  41. package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +43 -14
  42. package/utils/JsViewPlugin/JsvPlayer/index.js +4 -0
  43. package/utils/JsViewPlugin/JsvPlayer/version.js +19 -0
  44. package/utils/JsViewVueTools/DebugTool.js +24 -0
  45. package/utils/JsViewVueTools/NinePatchHelper.js +44 -0
  46. package/utils/JsViewVueTools/TypeCheckAndSet.js +27 -0
  47. package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +2 -2
  48. package/utils/JsViewVueWidget/JsvFilterView.vue +73 -0
  49. package/utils/JsViewVueWidget/JsvGrid.vue +573 -0
  50. package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +7 -0
  51. package/utils/JsViewVueWidget/JsvNinePatch.vue +2 -2
  52. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +1 -1
  53. package/utils/JsViewVueWidget/JsvTextureAnim/CommonType.js +8 -0
  54. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +171 -38
  55. package/utils/JsViewVueWidget/JsvTextureAnim/index.js +3 -2
  56. package/utils/JsViewVueWidget/JsvTouchContainer.vue +184 -0
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import {JsvMediaVideo, findMediaObjectByKey} from './JsvMedia'
2
+ import {JsvMediaVideo, findMediaObjectByKey, logDebug} from './JsvMedia'
3
3
  import JsvNativeSharedDiv from 'jsview/utils/JsViewVueWidget/JsvNativeSharedDiv.vue'
4
4
 
5
5
 
@@ -46,6 +46,10 @@ export default {
46
46
  * 属性,Boolean类型,是否保留最后一帧,true保留,false不保留。
47
47
  */
48
48
  keepLastFrame: {type: Boolean, default: false},
49
+ /**
50
+ * 属性,String类型,视频显示比例,origin原始比例显示,full全屏显示,x:y按照指定比例显示。
51
+ */
52
+ videoAspectRatio: {type: String, default: "origin"},
49
53
  /**
50
54
  * 回调函数,播放结束时通过此回调接口通知。
51
55
  */
@@ -113,6 +117,22 @@ export default {
113
117
  * 回调函数,音频获取焦点后触发此事件,可能会触发resume(点播)或者加入频道(直播)。
114
118
  */
115
119
  onAudioFocusGain: {type: Function, default: ()=>{return{}}},
120
+ /**
121
+ * 回调函数,直播进入时移状态时,触发此事件。
122
+ */
123
+ onTimeShift: {type: Function, default: ()=>{return{}}},
124
+ /**
125
+ * 回调函数,直播进入时移状态时,成功播放触发此事件。
126
+ */
127
+ onTimeShifted: {type: Function, default: ()=>{return{}}},
128
+ /**
129
+ * 回调函数,时移回到直播状态,触发此事件。
130
+ */
131
+ onBackLive: {type: Function, default: ()=>{return{}}},
132
+ /**
133
+ * 回调函数,时移回到直播状态时,成功播放触发此事件。
134
+ */
135
+ onBackLived: {type: Function, default: ()=>{return{}}},
116
136
  /**
117
137
  * 属性,Object类型,设置窗口属性,同其他组件的style设置。
118
138
  */
@@ -128,7 +148,7 @@ export default {
128
148
  },
129
149
  watch: {
130
150
  active(newValue) {
131
- console.log("active newValue: "+newValue);
151
+ logDebug("active newValue: "+newValue);
132
152
  if(this.video){
133
153
  if(newValue){
134
154
  this.registerEvent();
@@ -146,7 +166,7 @@ export default {
146
166
  }
147
167
  },
148
168
  style(newValue){
149
- console.log("holeStyle newValue: left="+newValue.left+", top="+newValue.top+", width="+newValue.width+", height="+newValue.height);
169
+ logDebug("holeStyle newValue: left="+newValue.left+", top="+newValue.top+", width="+newValue.width+", height="+newValue.height);
150
170
  if(this.active){
151
171
  this.holeStyle = {
152
172
  left: 0, top: 0,
@@ -155,7 +175,7 @@ export default {
155
175
  }
156
176
  },
157
177
  keepLastFrame(newValue){
158
- console.log("keepLastFrame newValue: "+newValue);
178
+ logDebug("keepLastFrame newValue: "+newValue);
159
179
  if(this.video && this.active){
160
180
  this.video.keepLastFrame = this.keepLastFrame;
161
181
  }
@@ -177,13 +197,13 @@ export default {
177
197
  created() {
178
198
  },
179
199
  mounted() {
180
- console.log("JsvPlayer:",this.style)
200
+ logDebug("JsvPlayer:",this.style)
181
201
 
182
202
  let key = "Jsv_" + Math.floor(Math.random() * 10000);
183
203
  if(this.playerKey){
184
204
  key = this.playerKey;
185
205
  }
186
- console.log("player key:"+key)
206
+ logDebug("player key:"+key)
187
207
 
188
208
  let player_type = 1;
189
209
  if(this.playerType)
@@ -193,10 +213,10 @@ export default {
193
213
  if(!this.background)
194
214
  background = this.background;
195
215
 
196
- console.log("JsvPlayer background:"+background)
216
+ logDebug("JsvPlayer background:"+background)
197
217
 
198
218
  const designMap = window.Forge.DesignMap();
199
- console.log("JsvPlayer:", this.holeId)
219
+ logDebug("JsvPlayer:", this.holeId)
200
220
 
201
221
  this.video = findMediaObjectByKey(key);
202
222
  let first_create = true;
@@ -212,12 +232,12 @@ export default {
212
232
  if(this.active){
213
233
  this.registerEvent();
214
234
 
215
- if(first_create){
235
+ //if(first_create){
216
236
  if(this.src && this.src !== "")
217
237
  this.video.src = this.src;
218
238
 
219
- if(this.currenttime !== 0)
220
- this.video.currentTime = this.currenttime;
239
+ if(this.currentTime !== 0)
240
+ this.video.currentTime = this.currentTime;
221
241
 
222
242
  if(this.autoplay){
223
243
  this.video.autoplay = this.autoplay;
@@ -234,7 +254,12 @@ export default {
234
254
  if(this.keepLastFrame){
235
255
  this.video.keepLastFrame = this.keepLastFrame;
236
256
  }
237
- }else{
257
+
258
+ if(this.videoAspectRatio !== "origin"){
259
+ this.video.videoAspectRatio = this.videoAspectRatio;
260
+ }
261
+ //}else{
262
+ if(!first_create){
238
263
  this.video.setHoleID(this.holeId);
239
264
  this.holeStyle = {
240
265
  left: 0, top: 0,
@@ -256,7 +281,7 @@ export default {
256
281
 
257
282
  methods: {
258
283
  getHoleId(id){
259
- console.log("getHoleId:", id)
284
+ logDebug("getHoleId:", id)
260
285
  this.holeId = id;
261
286
  },
262
287
  registerEvent(){
@@ -266,7 +291,7 @@ export default {
266
291
  //this.video.addEventListener("abort", this.onAbort);
267
292
  this.video.addEventListener("timeupdate", this.onTimeUpdate);
268
293
  this.video.addEventListener("loadstart", () => {
269
- console.log("JsvPlayer received loadstart event.");
294
+ logDebug("JsvPlayer received loadstart event.");
270
295
  this.holeStyle = {
271
296
  left: 0, top: 0,
272
297
  width:this.style.width, height:this.style.height
@@ -285,6 +310,10 @@ export default {
285
310
  this.video.addEventListener("canplay", this.onCanPlay);
286
311
  this.video.addEventListener("audiofocusloss", this.onAudioFocusLoss);
287
312
  this.video.addEventListener("audiofocusgain", this.onAudioFocusGain);
313
+ this.video.addEventListener("timeshift", this.onTimeShift);
314
+ this.video.addEventListener("timeshifted", this.onTimeShifted);
315
+ this.video.addEventListener("backlive", this.onBackLive);
316
+ this.video.addEventListener("backlived", this.onBackLived);
288
317
  }
289
318
  }
290
319
  },
@@ -15,6 +15,10 @@ if (window.JsvWidgetWrapperGroup?.BrowserJsvPlayer) {
15
15
  console.log("Loading player plugin");
16
16
  setTimeout(()=>{listener()}, 0);
17
17
  }
18
+
19
+ getJsvPlayerCapabilitySet = () => {
20
+ return null;
21
+ }
18
22
  }
19
23
 
20
24
  let component = _JsvPlayer.default;
@@ -0,0 +1,19 @@
1
+ let PluginInfo={
2
+ //downloadUrl:"http://192.168.0.37:8080/plugin/JsvPlayer-6.0.zip", //插件下载地址
3
+ packageName:"com.qcode.jsvplayer",
4
+ name:"播放器插件",
5
+ version:"1.4.8", //插件需要的版本号
6
+ versionCodeMin:148,
7
+ versionCodeMax:148,
8
+ bridgeName:"jsvPlayerBridge", //插件bridge注册到jsview的名称
9
+ className:"com.qcode.jsvplayer.JsvPlayer", //插件初始化类名称
10
+ initMethod:"createInstance", //插件初始化方法
11
+ listener:"top.JsvPlayerPluginLoadResult", //插件加载结果回调
12
+ listener2: "top.JsvPlayerPluginStatus",
13
+ // debug:true,
14
+ md5:"68be07d505e34d120ee95c5595ba6d73"
15
+ };
16
+
17
+ // 不要用export default,update-env脚本不能解析
18
+ // 导出字段要含有 pluginVersionInfo 信息,作为npm时版本参考
19
+ module.exports = PluginInfo;
@@ -12,10 +12,34 @@ let DebugTools = {
12
12
  },
13
13
  };
14
14
 
15
+ function DebugWrap81ErrorStack() {
16
+ // V8 js-core r81 版本内部,对于console.error和warn的堆栈无法和map自动匹配(缺少列号)
17
+ // 后续的V8版本修正了这个问题,而对于81版本,先使用new Error中的堆栈信息来绕开这个问题
18
+ if (!console._jsvOriginError) {
19
+ console._jsvOriginError = console.error; // JSExtra固化函数不能简单的用闭包替代
20
+ console.error = (...args) => {
21
+ console._jsvOriginError(...args, new Error("stack"));
22
+ }
23
+ }
24
+ }
25
+
26
+ function DebugWrap81WarnStack() {
27
+ // V8 js-core r81 版本内部,对于console.error和warn的堆栈无法和map自动匹配(缺少列号)
28
+ // 后续的V8版本修正了这个问题,而对于81版本,先使用new Error中的堆栈信息来绕开这个问题
29
+ if (!console._jsvOriginWarn) {
30
+ console._jsvOriginWarn = console.warn; // JSExtra固化函数不能简单的用闭包替代
31
+ console.warn = (...args) => {
32
+ console._jsvOriginWarn(...args, new Error("stack"));
33
+ }
34
+ }
35
+ }
36
+
15
37
  // 全局引用,以便于在devtools中能直接进行查询
16
38
  window.JsvDebugTools = DebugTools;
17
39
 
18
40
  export {
19
41
  DebugTools,
20
42
  DebugObjectRefer,
43
+ DebugWrap81ErrorStack,
44
+ DebugWrap81WarnStack
21
45
  }
@@ -0,0 +1,44 @@
1
+ function toHtmlBorderSet() {
2
+
3
+ }
4
+
5
+
6
+ /*
7
+ * imageWidth { int } // (必填)原图信息: 原图的宽度(由于正方形,宽高相同)
8
+ * centerWidth { int } // (必填)原图信息: .9图的中心区域宽度(repeat区域)
9
+ * imageDspWidth { int } // (选填)原图缩放后的显示宽度,计算方法:
10
+ * 四角为90度圆弧时: imageDspWidth = 显示图形的圆弧半径 / 原图中圆弧的半径 * 原图宽度
11
+ * 原图中圆弧半径 = (原图宽度 - borderOutset * 2) / 2
12
+ * 四角为其他形状时,原图.9图的四角区域,缩放到要和显示图形重合后的宽度。
13
+ * borderOutset { int } // (必填)原图信息: 图片边缘到中心内容区域边缘的距离, 快速计算: (原图宽度 - 原图中放内容宽度) / 2
14
+ */
15
+ function toNinePatchForgeViewSet(imageWidth, centerWidth, imageDspWidth, borderOutset) {
16
+ let image_scaledown_width = (imageDspWidth > 0 ? imageDspWidth : imageWidth);
17
+
18
+ // 内容边缘尺寸(相对于缩放后的图)
19
+ let outset_of_content_scaledown = Math.ceil(borderOutset * image_scaledown_width / imageWidth);
20
+
21
+ // 中心repeat区域宽度,最小为1px
22
+ let center_repeat_width_scaledown = Math.max(1, Math.ceil(centerWidth * image_scaledown_width / imageWidth));
23
+
24
+ // 计算repeat距离图片的边界
25
+ // 注意: 当去除repeat区域后左右不对称时,默认取左边比右边的短1px
26
+ let outset_of_repeat_scaledown = Math.floor((image_scaledown_width - center_repeat_width_scaledown) / 2);
27
+
28
+ return {
29
+ padding: {
30
+ start: outset_of_content_scaledown,
31
+ width: Math.max(0, image_scaledown_width - 2 * outset_of_content_scaledown)
32
+ },
33
+ repeat: [{
34
+ start: outset_of_repeat_scaledown,
35
+ width: center_repeat_width_scaledown
36
+ }],
37
+ imageDspSize: image_scaledown_width
38
+ };
39
+ }
40
+
41
+ export {
42
+ toHtmlBorderSet,
43
+ toNinePatchForgeViewSet
44
+ }
@@ -0,0 +1,27 @@
1
+ var number_convert_tmp = new Float32Array(1);
2
+
3
+ function numberCheckSet(number) {
4
+ number_convert_tmp = number; // 强制类型转换, 避免JSON化时类型出错,因为 '123' 123 都能通过Nan检测
5
+ if (!isNaN(number_convert_tmp)) {
6
+ return number_convert_tmp;
7
+ } else {
8
+ console.warn(`${number} is not type of number, default as 0`);
9
+ return 0;
10
+ }
11
+ }
12
+
13
+ function urlCheckSet(origin_url) {
14
+ if (origin_url && origin_url.indexOf("http") === 0) {
15
+ return origin_url;
16
+ } else if (window.JsView.React.UrlRef) {
17
+ return (new window.JsView.React.UrlRef(origin_url)).href;
18
+ } else {
19
+ console.warn(`${origin_url} is not valid url format, default as null`);
20
+ return null;
21
+ }
22
+ }
23
+
24
+ export {
25
+ numberCheckSet,
26
+ urlCheckSet
27
+ };
@@ -2,7 +2,7 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2021-10-13 13:14:42
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2021-11-18 16:43:54
5
+ * @LastEditTime: 2022-04-25 15:37:04
6
6
  * @Description: file content
7
7
  -->
8
8
 
@@ -10,7 +10,7 @@
10
10
  * 【模块 export 内容】
11
11
  * JsvApic:Vue高阶组件,控制动图播放
12
12
  * prop说明:
13
- * src {string} 对应img标签的src
13
+ * src {string} 对应img标签的src, 传url时需要注意使用url([链接])
14
14
  * style {object} 对应img标签的style
15
15
  * loopType {enum} 循环播放类型 LOOP_DEFAULT(默认)/LOOP_INFINITE(无限)/LOOP_FINITE(有限)/LOOP_PART(部分帧循环)
16
16
  * loopInfo {int[][3]} loopType为LOOP_PART时的循环设置,
@@ -0,0 +1,73 @@
1
+ <!--
2
+ * 【模块 export 内容】
3
+ * JsvFilterView:黑白滤镜组件
4
+ * props说明:
5
+ * width {int} 宽
6
+ * height {int} 高
7
+ * left {int} left位置
8
+ * top {int} top位置
9
+ * methods说明:
10
+ * enableFilter
11
+ @description 开关滤镜
12
+ @params {boolean} enable 滤镜是否生效
13
+ -->
14
+ <script>
15
+ import { Forge, ForgeExtension } from "../../dom/jsv-forge-define";
16
+
17
+ export default {
18
+ props: {
19
+ width: {
20
+ type: Number,
21
+ },
22
+ height: {
23
+ type: Number,
24
+ },
25
+ left: {
26
+ type: Number,
27
+ default: 0,
28
+ },
29
+ top: {
30
+ type: Number,
31
+ default: 0,
32
+ },
33
+ },
34
+ setup() {
35
+ return {
36
+ filterView: null,
37
+ };
38
+ },
39
+ created() {
40
+ this.filterView = new Forge.FilterView();
41
+ const view_store = ForgeExtension.RootActivity
42
+ ? ForgeExtension.RootActivity.ViewStore
43
+ : Forge.sViewStore;
44
+ this.viewId = view_store.add(
45
+ new Forge.ViewInfo(this.filterView, {
46
+ x: this.left,
47
+ y: this.top,
48
+ width: this.width,
49
+ height: this.height,
50
+ })
51
+ );
52
+ },
53
+ beforeUnmount() {
54
+ const view_store = ForgeExtension.RootActivity
55
+ ? ForgeExtension.RootActivity.ViewStore
56
+ : Forge.sViewStore;
57
+ view_store.remove(this.viewId);
58
+ },
59
+ methods: {
60
+ enableFilter(enable) {
61
+ if (this.filterView) {
62
+ this.filterView.FilterSwitch(enable);
63
+ }
64
+ },
65
+ },
66
+ };
67
+ </script>
68
+
69
+ <template>
70
+ <div :jsv_innerview="viewId">
71
+ <slot></slot>
72
+ </div>
73
+ </template>