@shijiu/jsview-vue 2.1.448-test.0 → 2.1.482-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 (69) hide show
  1. package/bin/browser/BrowserApic.vue.mjs +4 -4
  2. package/bin/browser/BrowserApic2.vue.mjs +4 -4
  3. package/bin/browser/BrowserApicLib.mjs +24 -24
  4. package/bin/browser/BrowserAudio.vue.mjs +8 -8
  5. package/bin/browser/BrowserJsvLatex.vue.mjs +27 -15
  6. package/bin/browser/BrowserPreload.vue.mjs +4 -4
  7. package/bin/browser/BrowserQrcode.vue.mjs +4 -4
  8. package/bin/browser/BrowserSpray.vue.mjs +4 -4
  9. package/bin/browser/BrowserTextureAnim.vue.mjs +4 -4
  10. package/bin/export-sfc.mjs +3 -3
  11. package/bin/jsview-vue-common.mjs +3 -3
  12. package/bin/jsview-vue.mjs +12138 -13910
  13. package/bin/types/browser/BrowserApic.vue.d.mts +33 -0
  14. package/bin/types/browser/BrowserApic2.vue.d.mts +16 -0
  15. package/bin/types/browser/BrowserApicLib.d.mts +56 -0
  16. package/bin/types/browser/BrowserAudio.vue.d.mts +2 -0
  17. package/bin/types/browser/BrowserJsvLatex.vue.d.mts +55 -0
  18. package/bin/types/browser/BrowserPreload.vue.d.mts +14 -0
  19. package/bin/types/browser/BrowserQrcode.vue.d.mts +29 -0
  20. package/bin/types/browser/BrowserSpray.vue.d.mts +2 -0
  21. package/bin/types/browser/BrowserTextureAnim.vue.d.mts +2 -0
  22. package/bin/types/export-sfc.d.mts +2 -0
  23. package/bin/types/jsview-vue-common.d.mts +23 -0
  24. package/bin/types/jsview-vue.d.mts +2511 -0
  25. package/index.d.ts +3 -4
  26. package/package.json +1 -1
  27. package/tools/config/tsconfig.json +7 -10
  28. package/tools/jsview-vue-build.mjs +25 -4
  29. package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +2 -1
  30. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +2 -1
  31. package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +94 -38
  32. package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +1 -1
  33. package/utils/JsViewEngineWidget/MetroWidget/SlotComponent.vue +0 -1
  34. package/utils/JsViewPlugin/JsvAudio/AudioProxy.js +11 -3
  35. package/utils/JsViewPlugin/JsvAudio/JsvAudio.vue +6 -3
  36. package/utils/JsViewPlugin/JsvAudio/JsvAudioProxy.vue +20 -0
  37. package/utils/JsViewPlugin/JsvAudio/PluginLoader.js +13 -3
  38. package/utils/JsViewPlugin/JsvAudio/index.js +11 -16
  39. package/utils/JsViewPlugin/JsvLatex/BrowserJsvLatex.vue +22 -5
  40. package/utils/JsViewPlugin/JsvLatex/JsvLatex.vue +3 -1
  41. package/utils/JsViewPlugin/JsvLatex/JsvLatexProxy.vue +20 -0
  42. package/utils/JsViewPlugin/JsvLatex/PluginLoader.js +13 -3
  43. package/utils/JsViewPlugin/JsvLatex/index.js +11 -16
  44. package/utils/JsViewPlugin/index.js +1 -1
  45. package/utils/JsViewVueTools/ForgeHandles.ts +14 -0
  46. package/utils/JsViewVueTools/{JsvDynamicKeyFrames.js → JsvDynamicKeyFrames.ts} +2 -2
  47. package/utils/JsViewVueTools/JsvFederationTools.ts +35 -0
  48. package/utils/JsViewVueTools/JsvPreDownloader.ts +36 -37
  49. package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CanvasTexture.ts +1 -1
  50. package/utils/JsViewVueTools/index.js +2 -1
  51. package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.ts +7 -3
  52. package/utils/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.ts +4 -2
  53. package/utils/JsViewVueWidget/JsvFreeMoveActor/JsvEnvBlocker.vue +4 -0
  54. package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.ts +18 -0
  55. package/utils/JsViewVueWidget/JsvMindMap/JsvMindMap.vue +1 -1
  56. package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +2 -1
  57. package/utils/JsViewVueWidget/JsvSpriteAnim/FrameBuidler.ts +11 -7
  58. package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +135 -61
  59. package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteTools.ts +26 -0
  60. package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +8 -1
  61. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +6 -0
  62. package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +1 -1
  63. package/bin/browser/BrowserJsvPlayer.vue.mjs +0 -573
  64. package/utils/JsViewEngineWidget/index.d.ts +0 -28
  65. package/utils/JsViewPlugin/JsvLatex/mathjax-tex-svg.txt +0 -1
  66. package/utils/JsViewPlugin/index.d.ts +0 -1
  67. package/utils/JsViewVueTools/ForgeHandles.js +0 -13
  68. package/utils/JsViewVueTools/index.d.ts +0 -13
  69. /package/utils/JsViewVueWidget/JsvSpriteAnim/{sAnimationToken.js → sAnimationToken.ts} +0 -0
package/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from "./utils/JsViewEngineWidget";
2
- export * from "./utils/JsViewPlugin";
3
- export * from "./utils/JsViewVueTools";
4
- export * from "./utils/JsViewVueWidget";
1
+ // 二选一 "./bin" 用于执行打包的js,"./utils" 用于调试
2
+ export * from "./bin/types/jsview-vue.d.mjs";
3
+ // export * from "./utils";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shijiu/jsview-vue",
3
- "version": "2.1.448-test.0",
3
+ "version": "2.1.482-test.0",
4
4
  "license": "MIT",
5
5
  "repository": "system/jsview-framework",
6
6
  "author": "mengxk",
@@ -1,18 +1,15 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "es2021",
3
+ "target": "es2022",
4
4
  "module": "es2022",
5
5
  "moduleResolution": "node",
6
6
  "strict": true,
7
- "jsx": "preserve",
8
- "resolveJsonModule": true,
9
- "noEmit": true,
10
7
  "allowJs": true,
11
- "paths": {
12
- "jsview": [ "./node_modules/@shijiu/jsview-vue" ],
13
- }
8
+ "declaration": true,
9
+ "emitDeclarationOnly": true,
10
+ "declarationDir": "../../bin/types"
14
11
  },
15
- "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue",
16
- "node_modules/@shijiu/jsview-vue/**/*.vue"
17
- ]
12
+ "include": [
13
+ "../../bin/jsview-vue.mjs"
14
+ ],
18
15
  }
@@ -2,8 +2,8 @@
2
2
  'use strict';
3
3
 
4
4
  import fs from 'node:fs';
5
- import path from 'path';
6
- import url from 'url';
5
+ import path from 'node:path';
6
+ import url from 'node:url';
7
7
  import {
8
8
  checkNodeVersion,
9
9
  execCommand,
@@ -11,12 +11,30 @@ import {
11
11
  parseArguments,
12
12
  } from '../../../@shijiu/jsview/tools/jsview-common.mjs';
13
13
 
14
+ function formatBannerRecursive(dir)
15
+ {
16
+ const fileNameList = fs.readdirSync(dir);
17
+ for(const fileName of fileNameList) {
18
+ const filePath = path.resolve(dir, fileName);
19
+ const stat = fs.statSync(filePath);
20
+ if(stat.isDirectory()) {
21
+ formatBannerRecursive(filePath);
22
+ } else {
23
+ let content = fs.readFileSync(filePath, 'utf-8');
24
+ content = content.replace(/\/\/!/g, '//');
25
+ content = content.replace(/\/\*!/g, '/*');
26
+ fs.writeFileSync(filePath, content, 'utf-8');
27
+ }
28
+ }
29
+ }
30
+
14
31
  async function main(argv)
15
32
  {
16
33
  checkNodeVersion();
17
34
 
18
35
  const currJsFilePath = url.fileURLToPath(import.meta.url)
19
36
  const jsviewVueDir = path.resolve(currJsFilePath, '../../') // jsview-framework/@shijiu/jsview-vue
37
+ const jsviewVueBinDir = path.resolve(jsviewVueDir, 'bin') // jsview-framework/@shijiu/jsview-vue/bin
20
38
 
21
39
  const noSavePkgList = [
22
40
  // jsview
@@ -27,6 +45,7 @@ async function main(argv)
27
45
  // vue + vite
28
46
  'vue@3.2.45',
29
47
  'vue-router@4.1.6',
48
+ '@babel/types',
30
49
  '@vitejs/plugin-vue@4.0.0',
31
50
  'typescript@4.9.3',
32
51
  'vite@4.0.0',
@@ -41,7 +60,7 @@ async function main(argv)
41
60
 
42
61
  let batchCommand = []
43
62
 
44
- fs.rmSync(`${jsviewVueDir}/bin`, { recursive: true, force: true });
63
+ fs.rmSync(jsviewVueBinDir, { recursive: true, force: true });
45
64
  if(!argv.withoutNpmInstall
46
65
  || fs.existsSync(`${jsviewVueDir}/node_modules`) == false) {
47
66
  const registry = getNpmRegistry();
@@ -54,14 +73,16 @@ async function main(argv)
54
73
  }
55
74
  batchCommand = [
56
75
  ...batchCommand,
57
- `${jsviewVueDir}/node_modules/.bin/vue-tsc --project ${jsviewVueDir}/tools/config/tsconfig.json`,
58
76
  `JSVIEW_DISABLE_MANUALCHUNKS=true ${jsviewVueDir}/node_modules/.bin/vite build --config ${jsviewVueDir}/tools/config/vite.config.ts`,
59
77
  `${version ? 'JSVIEW_VUE_VERSION='+version : ''} ${jsviewVueDir}/node_modules/.bin/rollup --config ${jsviewVueDir}/tools/config/rollup.config.mjs`,
78
+ `${jsviewVueDir}/node_modules/.bin/vue-tsc --project ${jsviewVueDir}/tools/config/tsconfig.json`,
60
79
  ];
61
80
  for(const command of batchCommand) {
62
81
  execCommand(`cd ${jsviewVueDir} && ${command}`);
63
82
  }
64
83
 
84
+ formatBannerRecursive(jsviewVueBinDir);
85
+
65
86
  if(!argv.withoutNpmInstall) {
66
87
  fs.rmSync(`${jsviewVueDir}/node_modules`, { recursive: true, force: true });
67
88
  fs.rmSync(`${jsviewVueDir}/package-lock.json`, { recursive: true, force: true });
@@ -123,7 +123,7 @@ const props = defineProps({
123
123
  },
124
124
  keepTraceRange: {
125
125
  type: Number,
126
- default: 0,
126
+ default: 3,
127
127
  },
128
128
  onScroll: {
129
129
  type: Function,
@@ -255,6 +255,7 @@ defineExpose(exportObject);
255
255
  v-for="(item, index) in renderData"
256
256
  :key="pageUpdateToken + '_' + item.index"
257
257
  :ref="item.divRef"
258
+ data-jsv-vw-test-rect="1"
258
259
  :style="{
259
260
  left: item.templateInfo.left,
260
261
  top: item.templateInfo.top,
@@ -358,7 +358,7 @@ const props = defineProps({
358
358
  },
359
359
  keepTraceRange: {
360
360
  type: Number,
361
- default: 0,
361
+ default: 3,
362
362
  },
363
363
  onScroll: {
364
364
  type: Function,
@@ -490,6 +490,7 @@ defineExpose(exportObject);
490
490
  v-for="(item, index) in renderData"
491
491
  :key="pageUpdateToken + '_' + item.index"
492
492
  :ref="item.divRef"
493
+ data-jsv-vw-test-rect="1"
493
494
  :style="{
494
495
  left: item.templateInfo.left,
495
496
  top: item.templateInfo.top,
@@ -201,6 +201,7 @@ export const setup = (
201
201
 
202
202
  let existOnFocusChange = false;
203
203
  let targetVisibleStart = visibleInfo.start;
204
+
204
205
  //先遍历寻找slide task, 确认目标位置. 有多个slide task时取最后一个
205
206
  taskList.forEach(i => {
206
207
  if (i.type == TaskType.SLIDE) {
@@ -314,13 +315,7 @@ export const setup = (
314
315
  updateHandler = pageUpdater.update(
315
316
  metroTemplate,
316
317
  visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
317
- Math.min(
318
- visibleInfo.startMax +
319
- visibleInfo.range +
320
- visibleInfo.padding.end -
321
- 1,
322
- visibleInfo.endWithPadding + props.keepTraceRange * pageRange
323
- ),
318
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
324
319
  focusId,
325
320
  mergeTmp,
326
321
  permanentItemList
@@ -591,6 +586,8 @@ export const setup = (
591
586
  if (id == focusId) {
592
587
  return;
593
588
  }
589
+ //有外部触发的滚动时, 取消load
590
+ tryCancelDelayLoad();
594
591
  templateItemAdder.tryAddItemById(id);
595
592
  let next_focus_item = getItemById(id);
596
593
  if (next_focus_item) {
@@ -679,6 +676,8 @@ export const setup = (
679
676
  };
680
677
 
681
678
  const slideTo = (position, doAnim) => {
679
+ //有外部触发的滚动时, 取消load
680
+ tryCancelDelayLoad();
682
681
  templateItemAdder.tryAddItemByPosition(position);
683
682
  if (
684
683
  typeof position !== "undefined" &&
@@ -720,6 +719,8 @@ export const setup = (
720
719
  };
721
720
 
722
721
  const slideToDiv = (div, doAnim) => {
722
+ //有外部触发的滚动时, 取消load
723
+ tryCancelDelayLoad();
723
724
  if (div) {
724
725
  const item_layout = div.jsvGetRelativePosition(toRaw(locateDiv.value));
725
726
  const direction = 1;
@@ -822,10 +823,7 @@ export const setup = (
822
823
  const updater = pageUpdater.update(
823
824
  metroTemplate,
824
825
  visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
825
- Math.min(
826
- visibleInfo.startMax + visibleInfo.range + visibleInfo.padding.end - 1,
827
- visibleInfo.endWithPadding + props.keepTraceRange * pageRange
828
- ),
826
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
829
827
  focusId,
830
828
  false,
831
829
  permanentItemList
@@ -849,6 +847,8 @@ export const setup = (
849
847
  };
850
848
 
851
849
  const moveFocus = (direction) => {
850
+ //有外部触发的滚动时, 取消load
851
+ tryCancelDelayLoad();
852
852
  if (direction == "left" || direction == 37 || direction == EdgeDirection.left) {
853
853
  _moveToNext(-1, 0);
854
854
  } else if (direction == "right" || direction == 39 || direction == EdgeDirection.right) {
@@ -891,19 +891,19 @@ export const setup = (
891
891
  unlockSlide,
892
892
  lock,
893
893
  unlock,
894
+ refreshData,
895
+ moveFocus,
894
896
  slideTo,
897
+ slideToItem,
898
+ slideToDiv,
895
899
  setFocusId,
896
900
  setFocusByUid,
897
- getFocusBlockRef,
898
901
  setEnterFocusId,
899
902
  setEnterFocusRect,
900
- slideToItem,
901
- slideToDiv,
902
- refreshData,
903
+ setZIndex,
904
+ getFocusBlockRef,
903
905
  getVisibleItems,
904
- moveFocus,
905
906
  getCustomerDataSize,
906
- setZIndex,
907
907
  getCurrentFocusIndex,
908
908
  getCurMode,
909
909
  getTemplatePosition,
@@ -1108,6 +1108,7 @@ export const setup = (
1108
1108
  if (onKeyDownLock) {
1109
1109
  return true;
1110
1110
  }
1111
+ tryCancelDelayLoad();
1111
1112
  if (mode.getMode() == TOUCH_MODE) {
1112
1113
  if (mode.duringTouch()) {
1113
1114
  //touch过程中的按键不处理
@@ -1414,8 +1415,8 @@ export const setup = (
1414
1415
  } else {
1415
1416
  const updater = pageUpdater.update(
1416
1417
  metroTemplate,
1417
- cur_visible_start,
1418
- cur_visible_start + visibleInfo.range + visibleInfo.padding.end - 1,
1418
+ visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
1419
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
1419
1420
  next_focus_item.id,
1420
1421
  false,
1421
1422
  permanentItemList
@@ -1731,6 +1732,7 @@ export const setup = (
1731
1732
  const touchLoadItemRect = visibleInfo.range;
1732
1733
  const reachAnchorGroup = 2;
1733
1734
  const wallConditionGroup = 1;
1735
+ const touchCountGroup = 3;
1734
1736
 
1735
1737
  let divPos = -1;
1736
1738
  let frameCount = -1;
@@ -1745,7 +1747,8 @@ export const setup = (
1745
1747
  }
1746
1748
  }
1747
1749
 
1748
- const mergeTouchSlideToSlideDiv = () => {
1750
+ const mergeTouchSlideToSlideDiv = (touchCount) => {
1751
+ // console.log("touchtest", props.name, `touchToDiv div: ${slideDivTop.value}, visibleStart:${visibleInfo.start} swapCount: ${Forge.sFrameCount.count}`)
1749
1752
  if (vertical) {
1750
1753
  slideDivTop.value = -visibleInfo.start;
1751
1754
  } else {
@@ -1760,14 +1763,27 @@ export const setup = (
1760
1763
  .boxPosition(walls.left, walls.top, walls.right, walls.bottom)
1761
1764
  .then([actorController.state().setHitWallOverflow()]), //TODO 通过prop设置哪个方向overflow
1762
1765
  actorController
1763
- .action()
1764
- .teleportTo(0, 0)]);
1766
+ .condition(touchCountGroup, false)
1767
+ .touchCount(touchCount)
1768
+ .then([
1769
+ actorController
1770
+ .action()
1771
+ .teleportTo(0, 0)
1772
+ ])
1773
+ ]);
1774
+ //下一帧删除touchCount
1775
+ actorController.run([
1776
+ actorController.condition().onNextTick().then([
1777
+ actorController.state().removeConditionByGroup(touchCountGroup),
1778
+ ])
1779
+ ])
1765
1780
  }
1766
1781
 
1767
- const onTouchDown = (data) => {
1782
+ const onTouchDown = (data, customData, nexusCustomData) => {
1768
1783
  mode.touchStart();
1769
1784
  mode.flingEnd();
1770
-
1785
+ // console.log("touchtest", `${props.name} animId:${debugAnimId} viewId:${debugViewId}`,
1786
+ // "onTouchDown", data, customData, nexusCustomData)
1771
1787
  const t = 100;
1772
1788
  const offsetThreshold = {
1773
1789
  left: vertical ? undefined : t,
@@ -1789,13 +1805,12 @@ export const setup = (
1789
1805
  //blur item
1790
1806
  onItemBlur(getItemById(focusId));
1791
1807
 
1792
- // visibleInfo.start = getVisibleStart(data);
1793
1808
  templateItemAdder.tryAddItemByPosition(visibleInfo.end + visibleInfo.range);
1794
1809
 
1795
1810
  const updater = pageUpdater.update(
1796
1811
  metroTemplate,
1797
- visibleInfo.startWithPadding - visibleInfo.range,
1798
- visibleInfo.endWithPadding + visibleInfo.range,
1812
+ visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
1813
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
1799
1814
  0,
1800
1815
  false,
1801
1816
  permanentItemList
@@ -1832,37 +1847,56 @@ export const setup = (
1832
1847
  }
1833
1848
  }
1834
1849
 
1835
- const onDragStart = (data) => {
1850
+ const onDragStart = (data, customData, nexusCustomData) => {
1836
1851
  mode.dragStart()
1837
1852
  visibleInfo.start = getVisibleStart(data);
1838
1853
  }
1839
1854
 
1840
- const onDragEnd = (data) => {
1855
+ const onDragEnd = (data, customData, nexusCustomData) => {
1841
1856
  visibleInfo.start = getVisibleStart(data);
1857
+ // console.log("touchtest", props.name + " animId:" + debugAnimId,
1858
+ // `onDragEnd ${visibleInfo.start}`)
1842
1859
  actorController.run([
1843
1860
  actorController.state().removeConditionByGroup(reachAnchorGroup),
1844
1861
  ]);
1845
- mergeTouchSlideToSlideDiv();
1862
+ let touchCount = -1;
1863
+ if (nexusCustomData) {
1864
+ try {
1865
+ touchCount = JSON.parse(nexusCustomData).tc;
1866
+ } catch (e) {
1867
+ touchCount = -1;
1868
+ }
1869
+ }
1870
+ mergeTouchSlideToSlideDiv(touchCount);
1846
1871
  updateRenderItems(false, false);
1847
1872
  mode.touchEnd()
1848
1873
  }
1849
1874
 
1850
- const onFlingStart = (data) => {
1875
+ const onFlingStart = (data, customData, nexusCustomData) => {
1851
1876
  mode.flingStart();
1852
1877
  visibleInfo.start = getVisibleStart(data);
1853
1878
  updateRenderItems(true, true);
1854
1879
  }
1855
1880
 
1856
- const onFlingProgress = (data) => {
1881
+ const onFlingProgress = (data, customData, nexusCustomData) => {
1857
1882
  visibleInfo.start = getVisibleStart(data);
1858
1883
  updateRenderItems(true, true);
1859
1884
  }
1860
1885
 
1861
- const onFlingEnd = (data) => {
1886
+ const onFlingEnd = (data, customData, nexusCustomData) => {
1862
1887
  visibleInfo.start = getVisibleStart(data);
1888
+ // console.log("touchtest", props.name, `onFlingEnd ${visibleInfo.start}`, data, customData, nexusCustomData)
1863
1889
  //记录拖拽的距离
1864
1890
  if (mode.duringFling()) {
1865
- mergeTouchSlideToSlideDiv();
1891
+ let touchCount = -1;
1892
+ if (nexusCustomData) {
1893
+ try {
1894
+ touchCount = JSON.parse(nexusCustomData).tc;
1895
+ } catch (e) {
1896
+ touchCount = -1;
1897
+ }
1898
+ }
1899
+ mergeTouchSlideToSlideDiv(touchCount);
1866
1900
  updateRenderItems(false, false);
1867
1901
  mode.flingEnd();
1868
1902
  mode.touchEnd();
@@ -1891,8 +1925,8 @@ export const setup = (
1891
1925
  templateItemAdder.tryAddItemByPosition(visibleInfo.start + visibleInfo.range);
1892
1926
  const updater = pageUpdater.update(
1893
1927
  metroTemplate,
1894
- expand ? visibleInfo.start - visibleInfo.range : visibleInfo.startWithPadding,
1895
- expand ? visibleInfo.start + 2 * visibleInfo.range : visibleInfo.endWithPadding,
1928
+ visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
1929
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
1896
1930
  0,
1897
1931
  true,
1898
1932
  permanentItemList
@@ -1914,12 +1948,17 @@ export const setup = (
1914
1948
  }
1915
1949
  }
1916
1950
 
1951
+ //TODO debug
1952
+ // let debugAnimId = -1;
1953
+ // let debugViewId = -1
1917
1954
  const initTouch = () => {
1918
1955
  actorController = new ActorControl();
1919
1956
  const divView = touchDiv.value.jsvGetProxyView();
1920
1957
  actorController.bindForgeView(divView, true);
1921
1958
  divView.DragEnables?.(4 | 0x08 | 0x10); // 只激活drag
1922
-
1959
+ // debugAnimId = actorController.debugGetAnimId();
1960
+ // debugViewId = divView.ViewId;
1961
+ // console.log("touchtest", props.name, `animId:${debugAnimId} viewId:${debugViewId}`);
1923
1962
  const walls = getTouchWall();
1924
1963
  //注册回调
1925
1964
  actorController.run([
@@ -1960,7 +1999,7 @@ export const setup = (
1960
1999
  }
1961
2000
 
1962
2001
  //init
1963
- pageUpdater = new PageUpdater(_updatePage);
2002
+ pageUpdater = new PageUpdater(_updatePage, props.name);
1964
2003
  visibleInfo.range = vertical
1965
2004
  ? widgetRectInfo.contentHeight
1966
2005
  : widgetRectInfo.contentWidth;
@@ -2005,6 +2044,7 @@ export const setup = (
2005
2044
  focusId = init_focus_id;
2006
2045
  visibleInfo.start = cur_visible_start;
2007
2046
 
2047
+ //保证创建速度, 你描画一屏
2008
2048
  const initUpdater = pageUpdater.update(
2009
2049
  metroTemplate,
2010
2050
  visibleInfo.startWithPadding,
@@ -2014,6 +2054,21 @@ export const setup = (
2014
2054
  permanentItemList
2015
2055
  );
2016
2056
  initUpdater.apply();
2057
+ //延时加载剩余屏
2058
+ const delayLoadHandler = setTimeout(() => {
2059
+ const updateHandler = pageUpdater.update(
2060
+ metroTemplate,
2061
+ visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
2062
+ visibleInfo.endWithPadding + props.keepTraceRange * pageRange,
2063
+ focusId,
2064
+ false,
2065
+ permanentItemList
2066
+ );
2067
+ updateHandler.apply();
2068
+ }, 200);
2069
+ const tryCancelDelayLoad = () => {
2070
+ clearTimeout(delayLoadHandler);
2071
+ }
2017
2072
 
2018
2073
  onMounted(() => {
2019
2074
  _changeFocusId(focusId, false);
@@ -2038,6 +2093,7 @@ export const setup = (
2038
2093
  onUpdated(() => { });
2039
2094
 
2040
2095
  onBeforeUnmount(() => {
2096
+ tryCancelDelayLoad();
2041
2097
  mounted = false;
2042
2098
  });
2043
2099
 
@@ -115,7 +115,7 @@ export class RenderItem {
115
115
  }
116
116
 
117
117
  public readonly onTap = computed(() => {
118
- return this.enableTap ? { click: this.onClick.bind(this) } : {};
118
+ return this.enableTap ? this.onClick.bind(this) : null;
119
119
  })
120
120
 
121
121
  public onClick(): boolean {
@@ -5,7 +5,6 @@
5
5
  <script setup>
6
6
  import { onBeforeUpdate } from "vue";
7
7
  onBeforeUpdate(() => {
8
- console.log("onBeforeUpdate");
9
8
  return false;
10
9
  });
11
10
  </script>
@@ -5,10 +5,12 @@
5
5
  */
6
6
  import JsvAudioBridgeProxy from "./JsvAudioBridgeProxy";
7
7
  import { checkType, toRawType } from "./CheckType";
8
- import sPluginLoader from "./PluginLoader";
8
+ import { GetPluginLoader } from "./PluginLoader";
9
9
  import Events from "./Events.js"
10
10
  import { ScreenLockManager } from "./ScreenLockManager.js";
11
11
 
12
+ let sPluginLoader = GetPluginLoader();
13
+
12
14
  const TAG = "JsvAudio";
13
15
 
14
16
  let keyToken = 0;
@@ -47,8 +49,14 @@ class AudioManager {
47
49
  }
48
50
  }
49
51
  }
50
- const sAudioManager = new AudioManager();
51
52
 
53
+ let sAudioManager = null;
54
+ function getAudioManager() {
55
+ if (sAudioManager == null) {
56
+ sAudioManager = new AudioManager();
57
+ }
58
+ return sAudioManager;
59
+ }
52
60
 
53
61
  const AUDIO_PROPS = {
54
62
  "src": { type: Object },
@@ -336,4 +344,4 @@ class AudioProxy {
336
344
  }
337
345
  }
338
346
 
339
- export { sAudioManager, getKeyToken };
347
+ export { getAudioManager, getKeyToken };
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { sAudioManager, getKeyToken } from "./AudioProxy.js";
2
+ import { getAudioManager, getKeyToken } from "./AudioProxy.js";
3
3
  import { onBeforeUnmount } from "vue";
4
4
 
5
5
  const props = defineProps({
@@ -94,9 +94,12 @@ const props = defineProps({
94
94
  },
95
95
  });
96
96
 
97
+ let sAudioManager = getAudioManager();
98
+
97
99
  //同进程起不同版本的core时, pluginMananger是一个对象, 因此java端的JsvAudio是同一个map, 所以要加jsviewCoreInfo避免id重复导致bug
98
- const jsviewCoreInfo = window.JsView?.getJsContextId?.() + "_" + window.JsView.CodeRevision
99
- let key = "JsvAudio_" + jsviewCoreInfo + "_" + getKeyToken();
100
+ const jsviewCoreInfo =
101
+ window.JsView?.getJsContextId?.() + "_" + window.JsView.CodeRevision;
102
+ let key = "JsvAudio_" + jsviewCoreInfo + "_" + getKeyToken();
100
103
  if (props.playerKey) {
101
104
  key = props.playerKey + "_" + jsviewCoreInfo;
102
105
  }
@@ -0,0 +1,20 @@
1
+ <script setup>
2
+ import { defineAsyncComponent } from "vue";
3
+ import JsvAudio from "./JsvAudio.vue";
4
+
5
+ const AsyncComp = defineAsyncComponent(() => {
6
+ return new Promise((resolve, reject) => {
7
+ if (!window.JsView) {
8
+ console.log("Load BrowserAudio");
9
+ const BrowserAudio = import("./BrowserAudio/BrowserAudio.vue");
10
+ resolve(BrowserAudio);
11
+ } else {
12
+ resolve(JsvAudio);
13
+ }
14
+ });
15
+ });
16
+ </script>
17
+
18
+ <template>
19
+ <AsyncComp v-bind="$attrs" />
20
+ </template>
@@ -135,6 +135,16 @@ class PluginLoader {
135
135
  }
136
136
  }
137
137
 
138
- const sPluginLoader = new PluginLoader();
139
- sPluginLoader.registerGlobalListener();
140
- export default sPluginLoader;
138
+ let sPluginLoader = null;
139
+
140
+ function GetPluginLoader() {
141
+ if (sPluginLoader == null) {
142
+ sPluginLoader = new PluginLoader();
143
+ sPluginLoader.registerGlobalListener();
144
+ }
145
+ return sPluginLoader;
146
+ }
147
+
148
+ export {
149
+ GetPluginLoader
150
+ }
@@ -3,26 +3,21 @@
3
3
  * @Date: 2023-02-28 10:18:42
4
4
  * @Description: file content
5
5
  */
6
- import sPluginLoader from "./PluginLoader.js";
7
- import JsvAudio from "./JsvAudio.vue"
6
+ import { GetPluginLoader } from "./PluginLoader.js";
7
+ import JsvAudio from "./JsvAudioProxy.vue"
8
8
 
9
- let globalLoadJsvAudioPlugin;
10
- let _JsvAudio;
11
-
12
- if (!window.JsView) {
13
- const BrowserJsvAudio = await import("./BrowserAudio/BrowserAudio.vue");
14
- //browser
15
- globalLoadJsvAudioPlugin = (listener) => {
9
+ const globalLoadJsvAudioPlugin = (listener) => {
10
+ if (!window.JsView) {
16
11
  setTimeout(listener, 0);
17
- };
18
- _JsvAudio = BrowserJsvAudio.default;
19
- } else {
20
- //jsview
21
- globalLoadJsvAudioPlugin = sPluginLoader.loadPlugin.bind(sPluginLoader);
22
- _JsvAudio = JsvAudio;
12
+ } else {
13
+ //jsview
14
+ let pluginLoader = GetPluginLoader();
15
+ let innerFunc = pluginLoader.loadPlugin.bind(pluginLoader);
16
+ innerFunc(listener);
17
+ }
23
18
  }
24
19
 
25
20
  export {
26
- _JsvAudio as JsvAudio,
21
+ JsvAudio,
27
22
  globalLoadJsvAudioPlugin,
28
23
  }
@@ -1,9 +1,8 @@
1
1
  <script setup>
2
2
  // import "./mathjax-tex-svg.js";
3
3
  import { Forge } from "@shijiu/jsview/dom/jsv-forge-define";
4
- import { ref, onMounted } from "vue";
4
+ import { shallowRef, onBeforeUnmount } from "vue";
5
5
  import { getHtmlStr } from "./BrowserDomBuilder.js";
6
- import libPath from "./mathjax-tex-svg.txt";
7
6
 
8
7
  const props = defineProps({
9
8
  latexStr: {
@@ -40,11 +39,29 @@ const props = defineProps({
40
39
  },
41
40
  });
42
41
 
43
- let layoutView = new Forge.IFrameView();
42
+ let innerViewId = shallowRef(-1);
44
43
 
44
+ let layoutView = new Forge.IFrameView();
45
45
  layoutView.SetIframeSize(props.width, props.height);
46
- layoutView.SetInnerHtml(getHtmlStr(libPath, props.latexStr, props.fontSize, props.width, props.height, props.color));
47
- let innerViewId = Forge.sViewStore.add(new Forge.ViewInfo(layoutView));
46
+ layoutView.SetInnerHtml(
47
+ getHtmlStr(
48
+ "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewTestResource/DocResource/mathjax-tex-svg.txt",
49
+ props.latexStr,
50
+ props.fontSize,
51
+ props.width,
52
+ props.height,
53
+ props.color
54
+ )
55
+ );
56
+ innerViewId.value = Forge.sViewStore.add(new Forge.ViewInfo(layoutView));
57
+
58
+ onBeforeUnmount(() => {
59
+ if (innerViewId.value != -1) {
60
+ Forge.sViewStore.remove(innerViewId.value);
61
+ innerViewId.value = -1;
62
+ console.log("success remove innerview");
63
+ }
64
+ });
48
65
  </script>
49
66
  <template>
50
67
  <div