@shijiu/jsview-vue 2.2.426-test.0 → 2.3.151-test.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 (126) hide show
  1. package/bin/browser/BrowserAudio.vue.mjs +4 -1
  2. package/bin/jsview-vue-common.mjs +1 -1
  3. package/bin/jsview-vue.mjs +9771 -7511
  4. package/bin/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusHub.d.ts +21 -1
  5. package/bin/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusManager.d.ts +11 -2
  6. package/bin/types/utils/JsViewEngineWidget/MetroWidget/DebugFrame.vue.d.ts +8 -0
  7. package/bin/types/utils/JsViewEngineWidget/MetroWidget/DebugTools.d.ts +5 -0
  8. package/bin/types/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +24 -6
  9. package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +24 -6
  10. package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +9 -2
  11. package/bin/types/utils/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +8 -1
  12. package/bin/types/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.d.ts +2 -1
  13. package/bin/types/utils/JsViewEngineWidget/WidgetCommon.d.ts +10 -7
  14. package/bin/types/utils/JsViewPlugin/JsvAudio/version.d.mts +1 -0
  15. package/bin/types/utils/JsViewPlugin/JsvAudio/version.d.ts +1 -0
  16. package/bin/types/utils/JsViewPlugin/JsvLatex/BrowserJsvLatex.vue.d.ts +1 -1
  17. package/bin/types/utils/JsViewPlugin/JsvLatex/JsvLatex.vue.d.ts +1 -1
  18. package/bin/types/utils/JsViewPlugin/JsvPlayer/AckEventDefine.d.ts +10 -0
  19. package/bin/types/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue.d.ts +1 -2
  20. package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvMedia.d.ts +2 -2
  21. package/bin/types/utils/JsViewVueTools/ForgeHandles.d.ts +1 -0
  22. package/bin/types/utils/JsViewVueTools/JsvRuntimeBridge.d.ts +43 -1
  23. package/bin/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.d.ts +21 -0
  24. package/bin/types/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.d.ts +3 -3
  25. package/bin/types/utils/JsViewVueTools/JsvTextureStore/DominantColor/GetDominantColor.d.ts +7 -0
  26. package/bin/types/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +15 -2
  27. package/bin/types/utils/JsViewVueTools/JsvTextureStore/Store.d.ts +2 -0
  28. package/bin/types/utils/JsViewVueTools/JsvTextureStore/Texture.d.ts +4 -0
  29. package/bin/types/utils/JsViewVueTools/index.d.ts +0 -1
  30. package/bin/types/utils/JsViewVueWidget/Jsv3dDiv.vue.d.ts +120 -0
  31. package/bin/types/utils/JsViewVueWidget/Jsv3dStage.vue.d.ts +144 -0
  32. package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic/index.d.ts +50 -2
  33. package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic2/index.d.ts +23 -2
  34. package/bin/types/utils/JsViewVueWidget/JsvDashPath.vue.d.ts +11 -0
  35. package/bin/types/utils/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue.d.ts +4 -4
  36. package/bin/types/utils/JsViewVueWidget/JsvFilterView.vue.d.ts +3 -3
  37. package/bin/types/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue.d.ts +78 -0
  38. package/bin/types/utils/JsViewVueWidget/JsvFlexCell/index.d.ts +1 -0
  39. package/bin/types/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue.d.ts +2 -1
  40. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue.d.ts +3 -3
  41. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/JsvEnvBlocker.vue.d.ts +3 -3
  42. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +1 -0
  43. package/bin/types/utils/JsViewVueWidget/JsvInput/Cursor.vue.d.ts +1 -1
  44. package/bin/types/utils/JsViewVueWidget/JsvMindMap/JsvMindMap.vue.d.ts +3 -3
  45. package/bin/types/utils/JsViewVueWidget/JsvNinePatch.vue.d.ts +4 -4
  46. package/bin/types/utils/JsViewVueWidget/JsvPosterDiv.vue.d.ts +3 -0
  47. package/bin/types/utils/JsViewVueWidget/JsvPosterImage.vue.d.ts +3 -0
  48. package/bin/types/utils/JsViewVueWidget/JsvRipple/JsvRipple.vue.d.ts +3 -3
  49. package/bin/types/utils/JsViewVueWidget/JsvSmoothSlideContainer.vue.d.ts +72 -0
  50. package/bin/types/utils/JsViewVueWidget/JsvSoundPool.d.ts +26 -0
  51. package/bin/types/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue.d.ts +10 -37
  52. package/bin/types/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue.d.ts +1 -1
  53. package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSmoothSwiper.vue.d.ts +112 -0
  54. package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue.d.ts +1 -1
  55. package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper2.vue.d.ts +142 -0
  56. package/bin/types/utils/JsViewVueWidget/JsvSwiper/index.d.ts +3 -1
  57. package/bin/types/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue.d.ts +3 -3
  58. package/bin/types/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue.d.ts +4 -3
  59. package/bin/types/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue.d.ts +3 -3
  60. package/bin/types/utils/JsViewVueWidget/JsvVisibleSensor/index.d.ts +3 -3
  61. package/bin/types/utils/JsViewVueWidget/index.d.ts +4 -1
  62. package/package.json +1 -1
  63. package/utils/JsViewEngineWidget/CheckType.js +3 -3
  64. package/utils/JsViewEngineWidget/JsvFocus/JsvFocusBlock.vue +25 -6
  65. package/utils/JsViewEngineWidget/JsvFocus/JsvFocusHub.ts +27 -1
  66. package/utils/JsViewEngineWidget/JsvFocus/JsvFocusManager.ts +22 -3
  67. package/utils/JsViewEngineWidget/MetroWidget/DebugFrame.vue +22 -0
  68. package/utils/JsViewEngineWidget/MetroWidget/DebugTools.ts +37 -0
  69. package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +42 -7
  70. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +97 -13
  71. package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +876 -412
  72. package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +43 -2
  73. package/utils/JsViewEngineWidget/MetroWidget/TaskManager.ts +38 -26
  74. package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +144 -73
  75. package/utils/JsViewEngineWidget/WidgetCommon.ts +12 -0
  76. package/utils/JsViewPlugin/JsvAudio/BrowserAudio/BrowserAudio.vue +4 -0
  77. package/utils/JsViewPlugin/JsvAudio/BrowserAudio/JsvSystemAudio.vue +13 -13
  78. package/utils/JsViewPlugin/JsvAudio/version.js +1 -1
  79. package/utils/JsViewPlugin/JsvAudio/version.mjs +1 -1
  80. package/utils/JsViewPlugin/JsvPlayer/AckEventDefine.ts +82 -0
  81. package/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue +50 -32
  82. package/utils/JsViewVueTools/FeatureActive.ts +2 -1
  83. package/utils/JsViewVueTools/ForgeHandles.ts +5 -2
  84. package/utils/JsViewVueTools/JsvRuntimeBridge.js +109 -4
  85. package/utils/JsViewVueTools/JsvTextTools.ts +3 -1
  86. package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.ts +38 -2
  87. package/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.ts +15 -12
  88. package/utils/JsViewVueTools/JsvTextureStore/DominantColor/GetDominantColor.ts +36 -0
  89. package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +24 -3
  90. package/utils/JsViewVueTools/JsvTextureStore/Store.ts +33 -21
  91. package/utils/JsViewVueTools/JsvTextureStore/Texture.ts +56 -41
  92. package/utils/JsViewVueTools/index.js +0 -1
  93. package/utils/JsViewVueWidget/Jsv3dDiv.vue +85 -0
  94. package/utils/JsViewVueWidget/Jsv3dStage.vue +50 -0
  95. package/utils/JsViewVueWidget/JsvApic/JsvApic/index.js +1 -8
  96. package/utils/JsViewVueWidget/JsvApic/JsvApic2/index.js +1 -8
  97. package/utils/JsViewVueWidget/JsvDashPath.vue +150 -0
  98. package/utils/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue +1 -1
  99. package/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue +153 -0
  100. package/utils/JsViewVueWidget/JsvFlexCell/JsvScreenFlex.vue +2 -2
  101. package/utils/JsViewVueWidget/JsvFlexCell/index.js +1 -0
  102. package/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue +26 -22
  103. package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.ts +1 -1
  104. package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +8 -0
  105. package/utils/JsViewVueWidget/JsvInput/EditViewOperator.ts +1 -1
  106. package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +1 -0
  107. package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +0 -9
  108. package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +57 -71
  109. package/utils/JsViewVueWidget/JsvPosterDiv.vue +15 -8
  110. package/utils/JsViewVueWidget/JsvPosterImage.vue +11 -1
  111. package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +2 -2
  112. package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
  113. package/utils/JsViewVueWidget/JsvSmoothSlideContainer.vue +108 -0
  114. package/utils/JsViewVueWidget/JsvSoundPool.js +75 -12
  115. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +99 -61
  116. package/utils/JsViewVueWidget/JsvSwiper/JsvSmoothSwiper.vue +543 -0
  117. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +3 -3
  118. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper2.vue +644 -0
  119. package/utils/JsViewVueWidget/JsvSwiper/index.js +3 -1
  120. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +56 -50
  121. package/utils/JsViewVueWidget/index.js +4 -1
  122. package/bin/browser/BrowserApic.vue.mjs +0 -114
  123. package/bin/browser/BrowserApic2.vue.mjs +0 -108
  124. package/bin/browser/BrowserApicLib.mjs +0 -431
  125. package/bin/types/utils/JsViewVueTools/JsvDemoTester.d.ts +0 -2
  126. package/utils/JsViewVueTools/JsvDemoTester.js +0 -81
@@ -0,0 +1,82 @@
1
+ export class AckEventDefine {
2
+ // Category
3
+ static CATEGORY_JSC: number = 1;
4
+ static CATEGORY_VIEW: number = 2;
5
+ static CATEGORY_EXCEPTION: number = 3;
6
+
7
+ // Type of jsc
8
+ // Content lifeCycle: event格式:
9
+ // {
10
+ // "act": string类型,当前动作,
11
+ // JsContext重载启动时(reload动作,或者loadUrl动作, 以及closeView时): "reset"
12
+ // js启动过程事件: 按顺序
13
+ // "systemJsLoaded": 系统js加载完成
14
+ // "engineJsRead": Engine Js 完成下载
15
+ // "engineJsLoaded": Engine Js 完成eval
16
+ // "mainJsRead": Main Js 完成下载
17
+ // "mainJsLoaded": Main Js 完成 eval
18
+ // "appJsStart": 开始运行框架的主入口处理
19
+ // "contextId": int类型,发生事件对应的context id,当url切换或者reload时,contentId会发生变化
20
+ // }
21
+ static TYPE_JS_CONTEXT_LIFECYCLE: number = 1;
22
+
23
+ // Content permission: event格式:
24
+ // {
25
+ // "contextId": int类型,发生事件对应的context id,当url切换或者reload时,contentId会发生变化
26
+ // "authDone": int类型 是否完成校验, 0: 还未进行校验, 1: 已完成校验
27
+ // ================== 授权做完后的信息 ====================
28
+ // success(bool): 当次授权校验是否通过
29
+ // showAlert(bool): APP界面右下角展示未授权提示,满足下面条件之一时会展示
30
+ // 1. app运行的main.js是未进行签名(签名参考src/appConfig/中的描述)的,提示"npm start 调试模式"
31
+ // 2. 仅在在线授权服务器无法达到, 并且达到允许次数时生效(每日累计1次, 最多累计30天), 提示"抢先版内核"
32
+ // 3. 远程授权api返回结果为未授权时
33
+ // 4. 本地有授权文件,但授权文件不合法或者过期
34
+ // errorCount(int): 在线授权api访问失败(网络不通)的累计次数, api访问到并拿到结果后清0
35
+ // checkType(int): 授权的校验方式, 1: 调试模式, 2: 本地文件校验的方式, 3: 在线校验方式
36
+ // customDescribe: 授权的描述, 许可范围等描述
37
+ // errorCode: 授权失败的错误码
38
+ // -1: apk签名不匹配(仅离线校验时)
39
+ // -2: js的app name未登记
40
+ // -3: js的app签名和app name登记信息不匹配
41
+ // -4: permission.js文件过期
42
+ // -5: core版本不匹配
43
+ // -6: 分支名不匹配
44
+ // -7: 在线鉴权时未通过的统一错误码(后台详细错误码搭建中...)
45
+ // -8: 页面为npm start的调试模式(开发人员调试时才会出现此状态)
46
+ // -101: 本地permission.js文件格式错误
47
+ // -102: permission.js文件授权信息中core版本无法正确解析为数字错误
48
+ // -103: permission.js文件授权信息中的日期格式错误
49
+ // -105: 在线鉴权api请求失败错误
50
+ // playerMaxVer(int): 播放器授权的最高版本(0000 00000) 前4位为渠道号,后5位为版本号
51
+ // }
52
+ static TYPE_JS_CONTEXT_PERMISSION: number = 2;
53
+
54
+ // Type of view
55
+ // Shared view layout: event格式:
56
+ // {
57
+ // "x": int类型,对应view更新到了x位置,
58
+ // "y": int类型,对应view更新到了y位置,
59
+ // "width": int类型,对应view宽度更新后的值,
60
+ // "height": int类型,对应view高度更新后的值,
61
+ // "mat4": native指针类型, view的位置信息的matrix,
62
+ // "visible": int类型, view是否可见,(0:不可见, 1:可见)
63
+ // "order": int类型, 本NativeSharedView的相对图层
64
+ // "dw": int类型,Design map width,用于换算x,y,width,height
65
+ // }
66
+ static TYPE_SHARED_VIEW_LAYOUT: number = 1;
67
+
68
+ // app view aspect ratio change: event格式:
69
+ // {
70
+ // "width": int类型,横轴比例,对应"16/9"中的16,
71
+ // "height": int类型,纵轴比例,对应"16/9"中的9,
72
+ // }
73
+ static TYPE_APP_ASPECT_RATIO_CHANGE: number = 2;
74
+
75
+ // Type of exception
76
+ // Unhandled exit action: event格式:
77
+ // {
78
+ // "reason": string类型,触发离开动作的触发器,例如: "backKey",
79
+ // "comment": string类型, 当BackKey场景, 为"keyDown"和"keyUp"
80
+ // }
81
+ static TYPE_EXCEPTION_UNHANDLED_EXIT_ACTION: number = 1;
82
+ }
@@ -1,7 +1,9 @@
1
1
  <script>
2
2
  import { Forge } from "@shijiu/jsview/dom/jsv-forge-define";
3
+ import { AckEventDefine } from "./AckEventDefine.ts";
3
4
  import playerExMethods from "./JsvMediaBrowserInterface.js";
4
5
  import { shallowRef } from "vue";
6
+ import { JsvNativeSharedDiv } from "jsview";
5
7
 
6
8
  let logDebug = console.log;
7
9
 
@@ -276,14 +278,16 @@ export default {
276
278
  */
277
279
  corner: { type: Number, default: 0 },
278
280
  },
279
- components: {},
281
+ components: {
282
+ JsvNativeSharedDiv,
283
+ },
280
284
  watch: {
281
285
  active(newValue) {
282
- console.log("LudlDebug active newValue: " + newValue);
286
+ console.log("active newValue: " + newValue);
283
287
  if (this.video) {
284
288
  if (newValue) {
285
289
  this.registerEvent();
286
- this.video.setHoleID(this.holeId);
290
+ // this.video.setHoleID?.(this.holeId);
287
291
  this.holeStyle = {
288
292
  left: 0,
289
293
  top: 0,
@@ -332,8 +336,7 @@ export default {
332
336
  return {
333
337
  video: null,
334
338
  holeId: "",
335
- jsvMainView: shallowRef(null),
336
- innerViewId: shallowRef(-1),
339
+ positionAckFunc: null,
337
340
  };
338
341
  },
339
342
 
@@ -370,8 +373,35 @@ export default {
370
373
  if (!this.video) {
371
374
  // 创建PC版本的video标签
372
375
  this.video = window.originDocument.createElement("video");
376
+ this.video.style.position = "absolute";
377
+ this.video.style.zIndex = -100;
373
378
  this._extendsApi(this.video);
374
- this.video.style.borderRadius = this.corner + "px";
379
+
380
+ const appElement = window.originDocument.getElementById("app");
381
+ document.body.insertBefore(this.video, appElement);
382
+
383
+ // 跟踪视频显示位置
384
+ let _this = this;
385
+ this.positionAckFunc = (event_json) => {
386
+ // 跟踪JsvNativeShared的位置变化
387
+ let new_pos = JSON.parse(event_json);
388
+ this.video.style.left =
389
+ window.JsvCoreApi.WasmExt.measurePosition(new_pos.x) + "px";
390
+ this.video.style.top =
391
+ window.JsvCoreApi.WasmExt.measurePosition(new_pos.y) + "px";
392
+
393
+ this.video.style.width =
394
+ window.JsvCoreApi.WasmExt.measurePosition(new_pos.width) + "px";
395
+ this.video.style.height =
396
+ window.JsvCoreApi.WasmExt.measurePosition(new_pos.height) + "px";
397
+ };
398
+
399
+ window.JsvCoreApi.WasmExt.listenerToAckEvent(
400
+ AckEventDefine.CATEGORY_VIEW,
401
+ AckEventDefine.TYPE_SHARED_VIEW_LAYOUT,
402
+ this.holeId,
403
+ this.positionAckFunc
404
+ );
375
405
  } else {
376
406
  this.video.setRef();
377
407
  first_create = false;
@@ -421,24 +451,20 @@ export default {
421
451
  }
422
452
  }
423
453
 
424
- // 创建挂载的VideoView
425
- this.jsvMainView = new Forge.VideoView(this.video, null);
426
- this.innerViewId = Forge.sViewStore.add(
427
- new Forge.ViewInfo(this.jsvMainView)
428
- );
429
-
430
454
  this.onRef?.(this.video);
431
455
  }
432
456
  },
433
457
 
434
458
  unmounted() {
435
459
  if (this.video != null) {
436
- // 清理View管理缓存
437
- if (this.innerViewId !== -1) {
438
- Forge.sViewStore.remove(this.innerViewId);
439
- this.innerViewId = -1;
440
- this.jsvMainView = null;
460
+ // 清理video标签
461
+ document.body.removeChild(this.video);
462
+
463
+ // 解除NativeSharedDiv对应的位置监听
464
+ if (this.positionAckFunc != null) {
465
+ window.JsvCoreApi.WasmExt.recycleAckListener(this.positionAckFunc);
441
466
  }
467
+
442
468
  this.onRef?.(null);
443
469
  }
444
470
  },
@@ -467,7 +493,7 @@ export default {
467
493
  this.video.addEventListener("canplaythrough", this.onCanPlayThrough);
468
494
  this.video.addEventListener("progress", this.onProgress);
469
495
  this.video.addEventListener("loadedmetadata", this.onLoadedMetaData);
470
- this.video.addEventListener("load", this.onLoad);
496
+ this.video.addEventListener("loadeddata", this.onLoad);
471
497
  this.video.addEventListener("durationchange", this.onDurationChange);
472
498
  this.video.addEventListener("seeking", this.onSeeking);
473
499
  this.video.addEventListener("seeked", this.onSeeked);
@@ -495,23 +521,15 @@ export default {
495
521
  </script>
496
522
 
497
523
  <template>
498
- <div
524
+ <jsv-native-shared-div
499
525
  :style="{
500
526
  ...holeStyle,
501
- backgroundColor: 'rgba(0,0,0,1)',
502
- borderRadius: corner,
527
+ left: this.style.left,
528
+ top: this.style.top,
503
529
  }"
504
- >
505
- <div
506
- :style="{
507
- left: holeStyle.left,
508
- top: holeStyle.top,
509
- width: holeStyle.width,
510
- height: holeStyle.height,
511
- }"
512
- :data-jsv-vw-innerview="innerViewId"
513
- />
514
- </div>
530
+ :getId="getHoleId"
531
+ :corner="corner"
532
+ />
515
533
  </template>
516
534
 
517
535
  <style scoped></style>
@@ -53,7 +53,8 @@ function JsvUseFeature(from: String, comp_name: String) {
53
53
  return;
54
54
  }
55
55
 
56
- console.error(`Error: ${comp_name}(from ${from}) is not activated, need JsvActiveFeature(JsvFeatureNames.${comp_name}) in boot`);
56
+ // 未激活简易提示, need JsvActiveFeature(JsvFeatureNames.${ comp_name }) in boot`);
57
+ console.log(`LOG: ${comp_name}(from ${from}) is not activated`);
57
58
  }
58
59
 
59
60
  // 备用接口: 防止未授权组件被错误激活引起的崩溃和水印显示
@@ -1,11 +1,13 @@
1
1
  let handles: {
2
2
  TextureManager: any,
3
3
  RootView: any,
4
- RootActivity: any
4
+ RootActivity: any,
5
+ sRenderBridge: any
5
6
  } = {
6
7
  TextureManager: null,
7
8
  RootView: null,
8
- RootActivity: null
9
+ RootActivity: null,
10
+ sRenderBridge: null
9
11
  }
10
12
 
11
13
  const jsvCode = (window as any).JsvCode;
@@ -13,6 +15,7 @@ jsvCode.ForgeHandles.listenToReady(() => {
13
15
  handles.TextureManager = jsvCode.ForgeHandles.TextureManager;
14
16
  handles.RootView = jsvCode.ForgeHandles.RootView;
15
17
  handles.RootActivity = jsvCode.ForgeHandles.RootActivity;
18
+ handles.sRenderBridge = jsvCode.ForgeHandles.sRenderBridge;
16
19
  })
17
20
 
18
21
  export default handles;
@@ -14,9 +14,9 @@ function direct_call(name, ...args) {
14
14
  } else {
15
15
  let func = null;
16
16
  if (window.jJsvRuntimeBridge && typeof window.jJsvRuntimeBridge[name] === "function") {
17
- func = window.jJsvRuntimeBridge[name];
17
+ func = window.jJsvRuntimeBridge[name].bind(window.jJsvRuntimeBridge);
18
18
  } else if (window.jContentShellJBridge && typeof window.jContentShellJBridge[name] === "function") {
19
- func = window.jContentShellJBridge[name];
19
+ func = window.jContentShellJBridge[name].bind(window.jContentShellJBridge);
20
20
  }
21
21
  direct_call_map[name] = func;
22
22
  if (func) {
@@ -112,6 +112,31 @@ function openWindow(url, startup_image, startup_video, startup_duration, add_his
112
112
  return window.jJsvRuntimeBridge.openWindow(url, JSON.stringify(setting))
113
113
  }
114
114
 
115
+ /**
116
+ * 打开另外一个小程序
117
+ * @param {string} url 小程序url
118
+ * @param {string} startup_image 启动图url
119
+ * @param {string} startup_video 启动视频url
120
+ * @param {int} startup_duration 启动图时长,默认0
121
+ * @param {int} add_history 是否添加历史,0不添加,1添加
122
+ * @returns {Promise}
123
+ */
124
+ function openApp(url, startup_image, startup_video, startup_duration, add_history) {
125
+ let setting = {};
126
+ if (startup_image !== null && startup_image !== "")
127
+ setting.startupImage = startup_image;
128
+
129
+ if (startup_video !== null && startup_video !== "") {
130
+ setting.startupVideo = startup_video;
131
+ }
132
+
133
+ setting.startupDuration = startup_duration;
134
+ setting.addHistory = (add_history ? 1 : 0); // 兼容true/false传值
135
+
136
+ // direct_call("openWindow", url, JSON.stringify(setting));
137
+ return window.jJsvRuntimeBridge.openApp(url, JSON.stringify(setting))
138
+ }
139
+
115
140
  /**
116
141
  * 用新的进程打开另外一个小程序
117
142
  * @param {string} url 小程序url
@@ -136,6 +161,30 @@ function startUrlInNewTab(url, startup_image, startup_video, startup_duration, a
136
161
  return window.jJsvRuntimeBridge.startUrlInNewTab(url, JSON.stringify(setting))
137
162
  }
138
163
 
164
+ /**
165
+ * 用新的进程打开另外一个小程序
166
+ * @param {string} url 小程序url
167
+ * @param {string} startup_image 启动图url
168
+ * @param {string} startup_video 启动视频url
169
+ * @param {int} startup_duration 启动图时长,默认0
170
+ * @param {int} add_history 是否添加历史,0不添加,1添加
171
+ * @returns {Promise}
172
+ */
173
+ function openAppInNewTab(url, startup_image, startup_video, startup_duration, add_history) {
174
+ let setting = {};
175
+ if (startup_image !== null && startup_image !== "")
176
+ setting.startupImage = startup_image;
177
+
178
+ if (startup_video !== null && startup_video !== "") {
179
+ setting.startupVideo = startup_video;
180
+ }
181
+
182
+ setting.startupDuration = startup_duration;
183
+ setting.addHistory = (add_history ? 1 : 0); // 兼容true/false传值
184
+
185
+ return window.jJsvRuntimeBridge.openAppInNewTab(url, JSON.stringify(setting))
186
+ }
187
+
139
188
  /**
140
189
  * 用于给上一个小程序返回结果,通常与startUrlInNewTab和openWindow配合使用
141
190
  * @param {string} data 返回给上一个小程序的结果
@@ -202,9 +251,10 @@ function getInstalledApps() {
202
251
  * @param {string} uri Uri方式启动
203
252
  * @param {Array} flags 数组,用于intent.addFlags
204
253
  * @param {Array} param JSON格式数组,数组元素是 object ,object中的内容用于intent.putExtra
254
+ * @param {Array} category string数组,用于intent.addCategory
205
255
  *
206
256
  */
207
- function startNativeApp(package_name, activity, action, uri, flags, param) {
257
+ function startNativeApp(package_name, activity, action, uri, flags, param, category) {
208
258
  var obj = {};
209
259
  if (package_name !== null && package_name !== "")
210
260
  obj.packageName = package_name;
@@ -224,9 +274,52 @@ function startNativeApp(package_name, activity, action, uri, flags, param) {
224
274
  if (param !== null && param.length > 0)
225
275
  obj.param = param;
226
276
 
277
+ if (category!==null && category.length > 0)
278
+ obj.category = category
279
+
227
280
  direct_call("startNativeApp", JSON.stringify(obj));
228
281
  }
229
282
 
283
+ /**
284
+ * 启动安卓APP
285
+ * @param {string} package_name 包名
286
+ * @param {string} activity Activity方式启动
287
+ * @param {string} action Action方式启动
288
+ * @param {string} uri Uri方式启动
289
+ * @param {Array} flags 数组,用于intent.addFlags
290
+ * @param {Array} param JSON格式数组,数组元素是 object ,object中的内容用于intent.putExtra
291
+ * @param {Array} category string数组,用于intent.addCategory
292
+ *
293
+ */
294
+ function openNativeApp(package_name, activity, action, uri, flags, param, category) {
295
+ var obj = {};
296
+ if (package_name !== null && package_name !== "")
297
+ obj.packageName = package_name;
298
+
299
+ if (activity !== null && activity !== "")
300
+ obj.activity = activity;
301
+
302
+ if (action !== null && action !== "")
303
+ obj.action = action;
304
+
305
+ if (uri !== null && uri !== "")
306
+ obj.uri = uri;
307
+
308
+ if (flags !== null && flags.length > 0)
309
+ obj.flags = flags;
310
+
311
+ if (param !== null && param.length > 0)
312
+ obj.param = param;
313
+
314
+ if (category!==null && category.length > 0)
315
+ obj.category = category
316
+
317
+
318
+ // return window.jJsvRuntimeBridge.openNativeApp(JSON.stringify(obj));
319
+ return direct_call("openNativeApp", JSON.stringify(obj));
320
+ }
321
+
322
+
230
323
  /**
231
324
  * 发送安卓广播
232
325
  * @param {string} package_name 包名
@@ -600,6 +693,14 @@ function providerUpdate(uri, contentValue, selection, selectionArgs) {
600
693
  return direct_call("providerUpdate", uri, contentValue ? JSON.stringify(contentValue) : null, selection, selectionArgs ? JSON.stringify(selectionArgs) : null)
601
694
  }
602
695
 
696
+ /**
697
+ *
698
+ * @returns 设备开机时长
699
+ */
700
+ function getBootTime(){
701
+ return direct_call("getBootTime")
702
+ }
703
+
603
704
 
604
705
  // 显示声明,可以提高执行速度和利用上编辑器的成员名提示功能
605
706
  const bridge = {
@@ -609,7 +710,9 @@ const bridge = {
609
710
  getDeviceUUID,
610
711
  getAndroidId,
611
712
  openWindow,
713
+ openApp,
612
714
  startUrlInNewTab,
715
+ openAppInNewTab,
613
716
  onWindowResult,
614
717
  reloadWindow,
615
718
  closePage,
@@ -617,6 +720,7 @@ const bridge = {
617
720
  getSystemProperty,
618
721
  getInstalledApps,
619
722
  startNativeApp,
723
+ openNativeApp,
620
724
  sendNativeBroadcast,
621
725
  startService,
622
726
  getDeviceInfo,
@@ -645,7 +749,8 @@ const bridge = {
645
749
  providerQuery,
646
750
  providerInsert,
647
751
  providerDelete,
648
- providerUpdate
752
+ providerUpdate,
753
+ getBootTime
649
754
  };
650
755
 
651
756
  export {
@@ -24,7 +24,9 @@ declare interface FontStyleDefine {
24
24
  * @return {int} 文字宽度
25
25
  **/
26
26
  const getTextWidth = (text: string, style: FontStyleDefine) => {
27
- let forgeRef = Forge;
27
+ if (text && typeof text != "string") {
28
+ text = "" + text; // 规避text为非字符串导致接口调用错误的问题
29
+ }
28
30
  return Forge.TextUtils.GetTextWidth(text, style);
29
31
  };
30
32
 
@@ -1,5 +1,29 @@
1
1
  import * as Constants from "./CommandList"
2
2
 
3
+ /**
4
+ * PathStrokeSetting
5
+ * 描边样式设定
6
+ * lineWidth: 描边线宽
7
+ * color: 描边颜色
8
+ * dash: 描边虚线样式,例如[10, 5]表示10px实线,5px虚线,交替出现
9
+ * phase: 描边虚线样式起始位置,例如0表示从虚线开始位置开始绘制
10
+ */
11
+ interface PathStrokeSetting {
12
+ lineWidth: Number,
13
+ color: String,
14
+ dash?: Array<Number>,
15
+ phase?: Number
16
+ }
17
+
18
+ function pathStrokeSettingToJson(setting: PathStrokeSetting): Object {
19
+ return {
20
+ "lineWidth": setting.lineWidth,
21
+ "clr": setting.color,
22
+ "dash": setting.dash,
23
+ "phase": setting.phase
24
+ }
25
+ }
26
+
3
27
  class DrawingPath {
4
28
  protected drawCommandsRefs: Array<Object> = [];
5
29
  protected finishedDraw: boolean = false; // 控制stroke和fill只能调用一次
@@ -16,6 +40,19 @@ class DrawingPath {
16
40
  * @param {String} color 颜色设定,例如rgba(red:0~255, green:0~255, blue:0~255, alpla:0~1.0), 或则 #AARRGGBB
17
41
  */
18
42
  public stroke(lineWidth: Number, color: String) {
43
+ this.strokeWithSetting({
44
+ lineWidth: lineWidth,
45
+ color: color,
46
+ });
47
+ }
48
+
49
+ /**
50
+ * strokeWithSetting
51
+ * 绘制边框,并设置描边样式
52
+ *
53
+ * @param {PathStrokeSetting} setting 描边样式设定
54
+ */
55
+ public strokeWithSetting(setting: PathStrokeSetting) {
19
56
  if (this.finishedDraw) {
20
57
  console.error("Error: path can only draw once");
21
58
  return;
@@ -24,8 +61,7 @@ class DrawingPath {
24
61
  this.drawCommandsRefs.push({
25
62
  "cmd": Constants.CMD_PREPARE_PAINT,
26
63
  "type": "stroke",
27
- "lineWidth": lineWidth,
28
- "clr": color
64
+ ...pathStrokeSettingToJson(setting)
29
65
  });
30
66
  this.onFinishDraw(); // 调用继承类的完成处理执行绘制
31
67
  this.finishedDraw = true;
@@ -6,18 +6,19 @@ export type CapturedCallback = (
6
6
  textureAccessName: string,
7
7
  autoRecycleSet: boolean,
8
8
  width: number,
9
- height: number) => void;
9
+ height: number,
10
+ isCannceled: boolean) => void;
10
11
 
11
12
  export class CapturedTexture extends TextureBase {
12
- private _AutoRecycle: boolean;
13
13
  private _Callback: CapturedCallback | null;
14
14
  private _CaptureDiv: any;
15
15
  private _Canceled: boolean = false;
16
-
16
+ private _PostProcessParams: any = null;
17
17
  constructor(
18
18
  captureDiv: any,
19
19
  callback: CapturedCallback,
20
- autoRecycle: boolean) {
20
+ autoRecycle: boolean,
21
+ postProcessParams: any = null) {
21
22
  super(null);
22
23
 
23
24
  // 激活引擎的功能支持
@@ -25,12 +26,14 @@ export class CapturedTexture extends TextureBase {
25
26
 
26
27
  this._CaptureDiv = captureDiv;
27
28
  this._Callback = callback;
28
- this._AutoRecycle = autoRecycle;
29
+ this.autoRecycle = autoRecycle;
30
+ this._PostProcessParams = postProcessParams;
29
31
  }
30
32
 
31
33
  // 清理对Callback和div的引用,防止泄露
32
34
  cancel() {
33
35
  if (!this._Canceled) {
36
+ this._Callback?.("", this.autoRecycle, 0, 0, true);
34
37
  this._Callback = null;
35
38
  this._CaptureDiv = null;
36
39
  this._Canceled = true;
@@ -47,18 +50,18 @@ export class CapturedTexture extends TextureBase {
47
50
  return;
48
51
  }
49
52
 
50
- // 处理自动回收
51
- if (!this._AutoRecycle) {
52
- this.addToStore(); // 用TextureStore来跟进引用状态
53
- }
53
+ //由于自动回收是三帧后回收, 所以需要先添加到store
54
+ this.addToStore();
54
55
 
55
56
  // 回调
56
57
  this._Callback?.(
57
58
  this.getStoreName(),
58
- this._AutoRecycle,
59
+ this.autoRecycle,
59
60
  resultObj.width as number,
60
- resultObj.height as number);
61
- }
61
+ resultObj.height as number,
62
+ false);
63
+ },
64
+ this._PostProcessParams
62
65
  );
63
66
  return '';
64
67
  }
@@ -0,0 +1,36 @@
1
+ import ForgeHandles from "../../../JsViewVueTools/ForgeHandles";
2
+ /**
3
+ * 使用ForgeTexture获取图片的dominant color, 注意, 此方法会hold住texture资源, 需要保证组件unmount时调用释放处理
4
+ * @param src 图片的src
5
+ * @param cbk 回调函数, 参数: info
6
+ * @returns 用于cancel的句柄,当cancel时,会清理对div和Callback的引用
7
+ */
8
+ export function getDominantColorByForgeTexture(
9
+ src: string,
10
+ cbk: (i: any) => void
11
+ ) {
12
+ if (!src) {
13
+ console.warn("getDominantColorByForgeTexture: src is empty");
14
+ return () => {};
15
+ }
16
+ const setting = { src };
17
+ let texture = (ForgeHandles.TextureManager as any).GetImageProcessTexture(
18
+ JSON.stringify(setting)
19
+ );
20
+ let canceled = false;
21
+ const callback = (info: any) => {
22
+ if (canceled) {
23
+ return;
24
+ }
25
+ cbk(info.extra);
26
+ texture?.RequestToUnload();
27
+ texture = null;
28
+ };
29
+ texture.DisableAutoRecycle();
30
+ texture.RegisterLoadImageCallback(src, callback, null);
31
+ return () => {
32
+ canceled = true;
33
+ texture?.RequestToUnload();
34
+ texture = null;
35
+ };
36
+ }
@@ -19,6 +19,7 @@
19
19
  import CanvasTexture from "./CanvasTexture/CanvasTexture";
20
20
  import { CapturedTexture, CapturedCallback } from "./CapturedTexture/CapturedTexture";
21
21
  import sStore from "./Store";
22
+ import { getDominantColorByForgeTexture } from "./DominantColor/GetDominantColor";
22
23
 
23
24
  let sJsvTextureConst = {
24
25
  LEFT: 1,
@@ -38,7 +39,7 @@ let sTextureStoreApi = {
38
39
  * @param {String|null} baseName 可选, 访问名的前缀信息
39
40
  * @return {CanvasTexture}
40
41
  */
41
- canvasTexture: (width: Number, height: Number, baseName: String | null): CanvasTexture => {
42
+ canvasTexture: (width: Number, height: Number, baseName: String | null = null): CanvasTexture => {
42
43
  return new CanvasTexture(width, height, baseName);
43
44
  },
44
45
 
@@ -65,14 +66,16 @@ let sTextureStoreApi = {
65
66
  不需要主动调用deleteTexture释放.
66
67
  false: 此场景在callback收到资源名后, 需要使用完毕后调用 deleteTexture 手动释放
67
68
  在手动释放之前,可以赋给其他div/img来复用
69
+ * @param {any} postProcessParams 可选, 截图处理的参数
68
70
  * @return {CapturedTexture} 用于cancel的句柄,当cancel时,会清理对div和Callback的引用
69
71
  */
70
72
  capture2Texture: (
71
73
  captureDiv: any,
72
74
  callback: CapturedCallback,
73
- autoRecycle: boolean = true): CapturedTexture => {
75
+ autoRecycle: boolean = true,
76
+ postProcessParams: any = null): CapturedTexture => {
74
77
 
75
- let texture = new CapturedTexture(captureDiv, callback, autoRecycle);
78
+ let texture = new CapturedTexture(captureDiv, callback, autoRecycle, postProcessParams);
76
79
  texture.commit();
77
80
 
78
81
  return texture;
@@ -91,8 +94,26 @@ let sTextureStoreApi = {
91
94
  textureRef.recycle();
92
95
  }
93
96
  },
97
+
98
+ /**
99
+ * getDominantColor
100
+ * 获取图片的 dominant color
101
+ *
102
+ * @param src 图片的src
103
+ * @param callback 回调函数, 参数: info
104
+ * @return 用于cancel的句柄,当cancel时,会清理对div和Callback的引用
105
+ */
106
+ getDominantColor: (src: string, callback: (info: any) => void) => {
107
+ return getDominantColorByForgeTexture(src, (i: any) => {
108
+ callback(i);
109
+ });
110
+ }
94
111
  }
95
112
 
113
+ export enum CaptureProcessType {
114
+ Blur = 1,
115
+ }
116
+
96
117
  export {
97
118
  sTextureStoreApi as JsvTextureStoreApi,
98
119
  sJsvTextureConst as JsvTextureConst,