@shijiu/jsview-vue 2.1.200 → 2.1.340-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.
- package/bin/browser/BrowserApic.vue.mjs +124 -0
- package/bin/browser/BrowserApic2.vue.mjs +118 -0
- package/bin/browser/BrowserApicLib.mjs +424 -0
- package/bin/browser/BrowserAudio.vue.mjs +263 -0
- package/bin/browser/BrowserJsvLatex.vue.mjs +110 -0
- package/bin/browser/BrowserJsvPlayer.vue.mjs +573 -0
- package/bin/browser/BrowserPreload.vue.mjs +154 -0
- package/bin/browser/BrowserQrcode.vue.mjs +178 -0
- package/bin/browser/BrowserSpray.vue.mjs +66 -0
- package/bin/browser/BrowserTextureAnim.vue.mjs +324 -0
- package/bin/export-sfc.mjs +12 -0
- package/bin/jsview-common.mjs +39 -0
- package/bin/jsview-vue.mjs +21106 -0
- package/index.js +3 -4
- package/package.json +1 -2
- package/tools/config/rollup.config.mjs +52 -0
- package/tools/config/tsconfig.json +18 -0
- package/tools/config/vite.config.ts +60 -0
- package/tools/jsview-vue-build.mjs +125 -0
- package/utils/JsViewEngineWidget/{JsvFocusBlock.vue → JsvFocus/JsvFocusBlock.vue} +11 -11
- package/utils/JsViewEngineWidget/{JsvFocusHub.ts → JsvFocus/JsvFocusHub.ts} +9 -3
- package/utils/JsViewEngineWidget/{JsvFocusManager.js → JsvFocus/JsvFocusManager.js} +6 -5
- package/utils/JsViewEngineWidget/MetroWidget/AnimationManager.ts +33 -10
- package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +89 -57
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +118 -62
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +504 -60
- package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +11 -1
- package/utils/JsViewEngineWidget/MetroWidget/SlotComponent.vue +13 -0
- package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +1 -1
- package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +1 -1
- package/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.ts +34 -1
- package/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.ts +52 -11
- package/utils/JsViewEngineWidget/index.js +3 -3
- package/utils/JsViewPlugin/JsvAudio/AudioProxy.js +9 -0
- package/utils/JsViewPlugin/JsvAudio/BrowserAudio/BrowserAudio.vue +11 -3
- package/utils/JsViewPlugin/JsvAudio/JsvAudio.vue +1 -0
- package/utils/JsViewPlugin/JsvAudio/JsvAudioBridgeProxy.js +8 -0
- package/utils/JsViewPlugin/JsvAudio/ScreenLockManager.js +16 -0
- package/utils/JsViewPlugin/JsvAudio/version.js +3 -3
- package/utils/JsViewPlugin/JsvAudio/version.mjs +3 -3
- package/utils/JsViewPlugin/JsvLatex/index.js +1 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +1 -1
- package/utils/JsViewPlugin/JsvPlayer/index-0.9.js +3 -3
- package/utils/JsViewPlugin/JsvPlayer/index.js +2 -2
- package/utils/JsViewVueTools/DebugTool.js +2 -2
- package/utils/JsViewVueTools/DefaultKeyMap.js +1 -1
- package/utils/JsViewVueTools/JsvDynamicCssStyle.js +1 -1
- package/utils/JsViewVueTools/JsvDynamicKeyFrames.js +2 -2
- package/utils/JsViewVueTools/JsvImpactTracer.js +7 -7
- package/utils/JsViewVueTools/JsvPreDownloader.ts +1 -1
- package/utils/JsViewVueTools/JsvRefTaker.js +2 -1
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +29 -29
- package/utils/JsViewVueTools/JsvStyleClass.js +3 -3
- package/utils/JsViewVueTools/JsvStyleSheetsDeclarer.js +1 -1
- package/utils/JsViewVueTools/JsvTextTools.js +4 -4
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CanvasTexture.ts +29 -1
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CommandList.ts +6 -5
- package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +60 -2
- package/utils/JsViewVueTools/NinePatchHelper.js +1 -1
- package/utils/JsViewVueWidget/JsvActorMove/ActorControlBase.js +1 -1
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.js +1 -1
- package/utils/JsViewVueWidget/JsvApic/{BrowserApic → JsvApic}/BrowserApic.vue +20 -23
- package/utils/JsViewVueWidget/JsvApic/{JsvApic.vue → JsvApic/JsvApic.vue} +3 -14
- package/utils/JsViewVueWidget/JsvApic/{index.js → JsvApic/index.js} +2 -4
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue +116 -0
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue +137 -0
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/index.js +17 -0
- package/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/BrowserApicLib.js +4 -0
- package/utils/JsViewVueWidget/JsvApic/{BrowserApic → JsvBrowserApicLib}/NormalLoopTool.js +16 -18
- package/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/PartLoopTool.js +90 -0
- package/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/SingleLoopTool.js +17 -0
- package/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/Viewer.js +111 -0
- package/utils/JsViewVueWidget/JsvApic/JsvCommonLoopToolBase.js +48 -0
- package/utils/JsViewVueWidget/JsvConnectLine/ArcLineManager.js +71 -0
- package/utils/JsViewVueWidget/JsvConnectLine/JsvConnectLine.vue +354 -0
- package/utils/JsViewVueWidget/JsvConnectLine/index.js +2 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.ts +37 -18
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.ts +7 -3
- package/utils/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue +28 -2
- package/utils/JsViewVueWidget/JsvFreeMoveActor/JsvEnvBlocker.vue +12 -5
- package/utils/JsViewVueWidget/JsvFreeMoveActor/NexusNode.ts +21 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.ts +47 -59
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.ts +129 -12
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +45 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/index.js +10 -2
- package/utils/JsViewVueWidget/JsvGrid.vue +1 -1
- package/utils/JsViewVueWidget/JsvHole.js +1 -1
- package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +1 -1
- package/utils/JsViewVueWidget/JsvLine/JsvLine.vue +2 -2
- package/utils/JsViewVueWidget/JsvLine/LineManager.js +6 -4
- package/utils/JsViewVueWidget/JsvMarquee.vue +7 -4
- package/utils/JsViewVueWidget/JsvPieChart.vue +1 -1
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +1 -1
- package/utils/JsViewVueWidget/JsvPreload/index.js +1 -1
- package/utils/JsViewVueWidget/JsvProgressBar.vue +172 -0
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +0 -1
- package/utils/JsViewVueWidget/JsvQrcode/index.js +1 -1
- package/utils/JsViewVueWidget/JsvRadarChart.vue +1 -1
- package/utils/JsViewVueWidget/JsvScaleTextBox.vue +0 -2
- package/utils/JsViewVueWidget/JsvSector.vue +1 -1
- package/utils/JsViewVueWidget/JsvSoundPool.js +1 -1
- package/utils/JsViewVueWidget/JsvSpray/index.js +1 -1
- package/utils/JsViewVueWidget/JsvSpriteAnim/FrameBuidler.ts +235 -0
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +433 -401
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteLoader.vue +120 -0
- package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +2 -2
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +5 -5
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +425 -422
- package/utils/JsViewVueWidget/JsvVisibleSensor/index.js +1 -1
- package/utils/JsViewVueWidget/index.js +7 -3
- package/utils/index.js +4 -0
- package/utils/JsViewVueWidget/JsvApic/BrowserApic/LoopToolBase.js +0 -25
- package/utils/JsViewVueWidget/JsvApic/BrowserApic/PartLoopTool.js +0 -119
- package/utils/JsViewVueWidget/JsvApic/BrowserApic/Viewer.js +0 -106
- /package/utils/JsViewPlugin/JsvLatex/{JsvLatexBrowser.vue → BrowserJsvLatex.vue} +0 -0
- /package/utils/JsViewPlugin/JsvPlayer/{JsvPlayerBrowser-0.9.vue → BrowserJsvPlayer-0.9.vue} +0 -0
- /package/utils/JsViewPlugin/JsvPlayer/{JsvPlayerBrowser.vue → BrowserJsvPlayer.vue} +0 -0
- /package/utils/JsViewVueWidget/JsvApic/{BrowserApic → JsvBrowserApicLib}/ApicDataBase.js +0 -0
- /package/utils/JsViewVueWidget/JsvApic/{BrowserApic → JsvBrowserApicLib}/GifData.js +0 -0
- /package/utils/JsViewVueWidget/JsvApic/{BrowserApic → JsvBrowserApicLib}/WebpData.js +0 -0
package/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./utils
|
|
4
|
-
export * from "./utils/JsViewVueWidget";
|
|
1
|
+
// 二选一 "./bin" 用于执行打包的js,"./utils" 用于调试
|
|
2
|
+
export * from "./bin/jsview-vue.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.
|
|
3
|
+
"version": "2.1.340-test.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "system/jsview-framework",
|
|
6
6
|
"author": "mengxk",
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"qr.js": "0.0.0"
|
|
15
15
|
},
|
|
16
|
-
"devDependencies": {},
|
|
17
16
|
"engines": {
|
|
18
17
|
"node": ">=16.0.0"
|
|
19
18
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
|
|
3
|
+
const projectDir = process.cwd();
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
external: [
|
|
7
|
+
'@shijiu/jsview',
|
|
8
|
+
'@shijiu/jsview/dom/*',
|
|
9
|
+
'@shijiu/jsview/dom/jsv-forge-define',
|
|
10
|
+
'plugin-vue:export-helper',
|
|
11
|
+
'qr.js',
|
|
12
|
+
'vue',
|
|
13
|
+
'vue-router',
|
|
14
|
+
],
|
|
15
|
+
input: path.resolve(projectDir, 'node_modules', '.cache', 'utils/index.mjs'),
|
|
16
|
+
output: {
|
|
17
|
+
chunkFileNames: (chunkInfo) => getChunkFileName(chunkInfo),
|
|
18
|
+
dir: 'bin',
|
|
19
|
+
entryFileNames: 'jsview-vue.mjs',
|
|
20
|
+
format: 'esm',
|
|
21
|
+
manualChunks: (id) => getManualChunks(id),
|
|
22
|
+
name: 'jsview-vue',
|
|
23
|
+
sourcemap: false,
|
|
24
|
+
exports: 'named',
|
|
25
|
+
},
|
|
26
|
+
treeshake: false,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function getManualChunks(id) {
|
|
30
|
+
if(path.relative(projectDir, id) == 'node_modules/.cache/_virtual/_plugin-vue_export-helper.mjs') { // 解决非显示字符问题
|
|
31
|
+
return 'export-sfc';
|
|
32
|
+
} else if(path.basename(id).startsWith('JsvCommon')) { // 解决Browser和Native同时引用问题。
|
|
33
|
+
return 'jsview-common';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function getChunkFileName(chunkInfo) {
|
|
38
|
+
if (chunkInfo.name == 'jsview-common') {
|
|
39
|
+
return 'jsview-common.mjs'
|
|
40
|
+
} else if (chunkInfo.name.startsWith('Browser')) {
|
|
41
|
+
return 'browser/[name].mjs'
|
|
42
|
+
} else if (chunkInfo.name == 'export-sfc') {
|
|
43
|
+
return '[name].mjs'
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
console.error("JsView Rollup Error: Unexpected chunk name:", chunkInfo.name)
|
|
47
|
+
return '[name].mjs'
|
|
48
|
+
|
|
49
|
+
// 执行到此处可能会引起循环import的问题,什么也不返回,以此来引起rollup的打包失败。
|
|
50
|
+
// 需要根据失败信息来修复此风险
|
|
51
|
+
undefined = undefined // 使用console或throw不能定位到此处
|
|
52
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2021",
|
|
4
|
+
"module": "es2022",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"jsx": "preserve",
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"noEmit": true,
|
|
10
|
+
"allowJs": true,
|
|
11
|
+
"paths": {
|
|
12
|
+
"jsview": [ "./node_modules/@shijiu/jsview-vue" ],
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue",
|
|
16
|
+
"node_modules/@shijiu/jsview-vue/**/*.vue"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import vue from '@vitejs/plugin-vue'
|
|
3
|
+
import fs from 'node:fs'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
|
|
6
|
+
const projectDir = process.cwd();
|
|
7
|
+
|
|
8
|
+
// https://vitejs.dev/config/
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
build: {
|
|
11
|
+
lib: {
|
|
12
|
+
entry: path.resolve(projectDir, 'utils/index.js'),
|
|
13
|
+
formats: ["es"],
|
|
14
|
+
},
|
|
15
|
+
minify: false,
|
|
16
|
+
rollupOptions: {
|
|
17
|
+
external: [
|
|
18
|
+
'@shijiu/jsview',
|
|
19
|
+
'@shijiu/jsview/dom/*',
|
|
20
|
+
'@shijiu/jsview/dom/jsv-forge-define',
|
|
21
|
+
'qr.js',
|
|
22
|
+
'vue',
|
|
23
|
+
'vue-router',
|
|
24
|
+
],
|
|
25
|
+
output: {
|
|
26
|
+
banner: (chunkInfo) => getBanner(chunkInfo),
|
|
27
|
+
dir: path.resolve(projectDir, 'node_modules', '.cache'),
|
|
28
|
+
entryFileNames: '[name].mjs',
|
|
29
|
+
format: 'esm',
|
|
30
|
+
preserveModules: true,
|
|
31
|
+
preserveModulesRoot: projectDir,
|
|
32
|
+
sourcemap: false,
|
|
33
|
+
},
|
|
34
|
+
treeshake: false,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
plugins: [
|
|
38
|
+
vue()
|
|
39
|
+
],
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
function getBanner(chunkInfo) {
|
|
43
|
+
let filePath = chunkInfo.facadeModuleId
|
|
44
|
+
filePath = filePath.replace(/^\x00/, '') // '\0plugin-vue:export-helper',
|
|
45
|
+
const modulePath = path.relative(projectDir, filePath)
|
|
46
|
+
let banner = `
|
|
47
|
+
//!
|
|
48
|
+
//! ${modulePath};
|
|
49
|
+
//!
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
if(filePath.endsWith('.vue')) {
|
|
53
|
+
const regex = /<script.*?<\/script>|<style.*?<\/style>|<template.*?<\/template>/gs
|
|
54
|
+
const content = fs.readFileSync(filePath, 'utf-8')
|
|
55
|
+
const topLevelComments = content.replace(regex, '');
|
|
56
|
+
banner += `/*! ${topLevelComments} */`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return banner;
|
|
60
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
import childProcess from 'node:child_process';
|
|
5
|
+
import fs from 'node:fs';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import url from 'url';
|
|
8
|
+
|
|
9
|
+
function checkNodeVersion(minMajorVersion = 16)
|
|
10
|
+
{
|
|
11
|
+
const versions = process.version.replace('v', '').split('.');
|
|
12
|
+
const [majorVersion, minorVersion, patchVersion] = versions;
|
|
13
|
+
|
|
14
|
+
console.info(`Node version: v${majorVersion}.${minorVersion}.${patchVersion}`);
|
|
15
|
+
if (majorVersion < minMajorVersion) {
|
|
16
|
+
console.error('Error: Node version is too low! Please upgrade your Node.js first.');
|
|
17
|
+
process.exit(1)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function execCommand(cmdline)
|
|
22
|
+
{
|
|
23
|
+
console.info('Run [' + cmdline + ']... ');
|
|
24
|
+
try {
|
|
25
|
+
const ret = childProcess.execSync(cmdline, { stdio: 'inherit' });
|
|
26
|
+
if (ret) {
|
|
27
|
+
return ret.toString();
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
} catch (err) {
|
|
31
|
+
console.error('Error: ', err);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function parseArguments()
|
|
37
|
+
{
|
|
38
|
+
const options = {
|
|
39
|
+
withoutNpmInstall: false,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// arg0: node
|
|
43
|
+
// arg1: script.js
|
|
44
|
+
const arguList = process.argv.slice(2);
|
|
45
|
+
for (const argu of arguList) {
|
|
46
|
+
if (argu == '--without-npm-install' || argu == '-n') {
|
|
47
|
+
options.withoutNpmInstall = true;
|
|
48
|
+
} else if (argu == '--help' || argu == '-h') {
|
|
49
|
+
console.log('Usages:')
|
|
50
|
+
console.log('')
|
|
51
|
+
console.log(' -n | --without-npm-install: Ignore to run npm install.')
|
|
52
|
+
console.log('')
|
|
53
|
+
console.log(' -h | --help: Print help usages.')
|
|
54
|
+
console.log('')
|
|
55
|
+
process.exit(0)
|
|
56
|
+
} else {
|
|
57
|
+
console.error('Failed to parse argument: ' + argu)
|
|
58
|
+
process.exit(1)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return options
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function main()
|
|
66
|
+
{
|
|
67
|
+
checkNodeVersion();
|
|
68
|
+
|
|
69
|
+
const options = parseArguments();
|
|
70
|
+
|
|
71
|
+
const currJsFilePath = url.fileURLToPath(import.meta.url)
|
|
72
|
+
const jsviewVueDir = path.resolve(currJsFilePath, '../../') // jsview-framework/@shijiu/jsview-vue
|
|
73
|
+
|
|
74
|
+
const noSavePkgList = [
|
|
75
|
+
// jsview
|
|
76
|
+
`${jsviewVueDir}/../jsview`,
|
|
77
|
+
'gifuct-js@2.1.2',
|
|
78
|
+
'postcss-js@4.0.0',
|
|
79
|
+
|
|
80
|
+
// vue + vite
|
|
81
|
+
'vue@3.2.45',
|
|
82
|
+
'vue-router@4.1.6',
|
|
83
|
+
'@vitejs/plugin-vue@5.0.3 ',
|
|
84
|
+
'typescript@4.9.3',
|
|
85
|
+
'vite@5.0.11',
|
|
86
|
+
'vue-tsc@1.0.11',
|
|
87
|
+
|
|
88
|
+
// jsview-vue dep
|
|
89
|
+
'sass@1.58.1',
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
const noSavePackages = noSavePkgList.toString().replaceAll(',', ' ');
|
|
93
|
+
const version = process.env['JSVIEW_VUE_VERSION'];
|
|
94
|
+
|
|
95
|
+
let batchCommand = []
|
|
96
|
+
|
|
97
|
+
fs.rmSync(`${jsviewVueDir}/bin`, { recursive: true, force: true });
|
|
98
|
+
if(options.withoutNpmInstall == false
|
|
99
|
+
|| fs.existsSync(`${jsviewVueDir}/node_modules`) == false) {
|
|
100
|
+
fs.rmSync(`${jsviewVueDir}/node_modules`, { recursive: true, force: true });
|
|
101
|
+
batchCommand = [
|
|
102
|
+
'npm install',
|
|
103
|
+
`npm install --no-save ${noSavePackages}`,
|
|
104
|
+
`node ${jsviewVueDir}/node_modules/@shijiu/jsview/tools/jsview-post-install.mjs --framework=vue`,
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
batchCommand = [
|
|
108
|
+
...batchCommand,
|
|
109
|
+
`${jsviewVueDir}/node_modules/.bin/vue-tsc --project ${jsviewVueDir}/tools/config/tsconfig.json`,
|
|
110
|
+
`JSVIEW_DISABLE_MANUALCHUNKS=true ${jsviewVueDir}/node_modules/.bin/vite build --config ${jsviewVueDir}/tools/config/vite.config.ts`,
|
|
111
|
+
`${version ? 'JSVIEW_VUE_VERSION='+version : ''} ${jsviewVueDir}/node_modules/.bin/rollup --config ${jsviewVueDir}/tools/config/rollup.config.mjs`,
|
|
112
|
+
];
|
|
113
|
+
for(const command of batchCommand) {
|
|
114
|
+
execCommand(`cd ${jsviewVueDir} && ${command}`);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if(options.withoutNpmInstall == false) {
|
|
118
|
+
fs.rmSync(`${jsviewVueDir}/node_modules`, { recursive: true, force: true });
|
|
119
|
+
fs.rmSync(`${jsviewVueDir}/package-lock.json`, { recursive: true, force: true });
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
console.info('Done...');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
main();
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
onActivated,
|
|
39
39
|
onDeactivated,
|
|
40
40
|
} from "vue";
|
|
41
|
-
import { HUB_NS_PROVIDE_NAME } from "./
|
|
41
|
+
import { HUB_NS_PROVIDE_NAME } from "./JsvFocusHub";
|
|
42
42
|
|
|
43
43
|
const props = defineProps({
|
|
44
44
|
name: String,
|
|
@@ -51,7 +51,7 @@ const props = defineProps({
|
|
|
51
51
|
onKeyDown: Function,
|
|
52
52
|
onFocus: Function,
|
|
53
53
|
onBlur: Function,
|
|
54
|
-
|
|
54
|
+
onCustomEvent: Function,
|
|
55
55
|
});
|
|
56
56
|
if (props.namespace && props.name) {
|
|
57
57
|
throw new Error("JsvFocusBlock Error: Either name or namespace can be set.");
|
|
@@ -102,8 +102,8 @@ const requestFocus = async (passToChild) => {
|
|
|
102
102
|
node?.requestFocus(passToChild);
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
-
const
|
|
106
|
-
toRaw(fDivRef.value)?.FocusNodeRef.
|
|
105
|
+
const bubbleCustomEvent = (ev) => {
|
|
106
|
+
toRaw(fDivRef.value)?.FocusNodeRef.bubbleCustomEvent(ev);
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
const returnFocusToParent = (ev) => {
|
|
@@ -113,7 +113,7 @@ const returnFocusToParent = (ev) => {
|
|
|
113
113
|
const exportObject = {
|
|
114
114
|
getFullName,
|
|
115
115
|
requestFocus,
|
|
116
|
-
|
|
116
|
+
bubbleCustomEvent,
|
|
117
117
|
returnFocusToParent,
|
|
118
118
|
};
|
|
119
119
|
const _mountToFocusSystem = () => {
|
|
@@ -150,10 +150,10 @@ const _mountToFocusSystem = () => {
|
|
|
150
150
|
focusNode.setOnBlur(_onBlur);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
actionCallback.
|
|
154
|
-
props.
|
|
155
|
-
if (actionCallback.
|
|
156
|
-
focusNode.
|
|
153
|
+
actionCallback.onCustomEvent =
|
|
154
|
+
props.onCustomEvent || props.onAction?.onCustomEvent;
|
|
155
|
+
if (actionCallback.onCustomEvent) {
|
|
156
|
+
focusNode.setOnCustomEvent(_onCustomEvent);
|
|
157
157
|
}
|
|
158
158
|
// 建立父子关系链
|
|
159
159
|
let self = toRaw(fDivRef.value);
|
|
@@ -195,8 +195,8 @@ const _onFocus = () => {
|
|
|
195
195
|
const _onBlur = () => {
|
|
196
196
|
actionCallback?.onBlur(exportObject);
|
|
197
197
|
};
|
|
198
|
-
const
|
|
199
|
-
return actionCallback?.
|
|
198
|
+
const _onCustomEvent = (ev) => {
|
|
199
|
+
return actionCallback?.onCustomEvent(ev) || false;
|
|
200
200
|
};
|
|
201
201
|
|
|
202
202
|
onMounted(() => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
class FocusHubApi {
|
|
2
|
+
class JsvFocusHubApi {
|
|
4
3
|
private _FocusHub: any; // JsvFocusableNode中的class Hub
|
|
5
4
|
|
|
6
5
|
constructor(focusableHubRef: any) {
|
|
@@ -120,4 +119,11 @@ class FocusHubApi {
|
|
|
120
119
|
}
|
|
121
120
|
}
|
|
122
121
|
|
|
123
|
-
|
|
122
|
+
const ROOT_HUB_PROVIDE_NAME = "__jsvFocusRootHub__";
|
|
123
|
+
const HUB_NS_PROVIDE_NAME = "__jsvFocusNameSpace__";
|
|
124
|
+
|
|
125
|
+
export {
|
|
126
|
+
JsvFocusHubApi,
|
|
127
|
+
ROOT_HUB_PROVIDE_NAME,
|
|
128
|
+
HUB_NS_PROVIDE_NAME
|
|
129
|
+
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/* eslint-disable no-prototype-builtins */
|
|
2
2
|
|
|
3
3
|
import JsvFocusBlock from "./JsvFocusBlock.vue";
|
|
4
|
-
import
|
|
4
|
+
import {
|
|
5
|
+
JsvFocusHubApi,
|
|
6
|
+
ROOT_HUB_PROVIDE_NAME,
|
|
7
|
+
HUB_NS_PROVIDE_NAME
|
|
8
|
+
} from "./JsvFocusHub.ts";
|
|
5
9
|
import { inject } from "vue";
|
|
6
10
|
|
|
7
|
-
const ROOT_HUB_PROVIDE_NAME = "__jsvFocusRootHub__";
|
|
8
|
-
const HUB_NS_PROVIDE_NAME = "__jsvFocusNameSpace__";
|
|
9
|
-
|
|
10
11
|
const useFocusHub = (withNameSpace) => {
|
|
11
12
|
if (withNameSpace) {
|
|
12
13
|
let nameSpace = inject(HUB_NS_PROVIDE_NAME); // nameSpace变更由JsvFocusBlock设置namespace时变更
|
|
@@ -118,4 +119,4 @@ function jsvCreateFocusManager() {
|
|
|
118
119
|
return new JsvFocusManager();
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
export { jsvCreateFocusManager, useFocusHub
|
|
122
|
+
export { jsvCreateFocusManager, useFocusHub };
|
|
@@ -3,7 +3,8 @@ import { ShallowRef, watch, ref, Ref } from "vue";
|
|
|
3
3
|
|
|
4
4
|
export enum TaskType {
|
|
5
5
|
RESIZE_ITEM,
|
|
6
|
-
SLIDE
|
|
6
|
+
SLIDE,
|
|
7
|
+
ON_FOCUS_CHANGE,
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
interface Task {
|
|
@@ -21,18 +22,20 @@ export class MacroEndTaskManager {
|
|
|
21
22
|
private customerOnBreak: TaskCallback;
|
|
22
23
|
private mTaskToken: Ref<number> = ref(0);
|
|
23
24
|
private mToken: number = 0;
|
|
25
|
+
private mFlushedFrameCount = -1;
|
|
24
26
|
|
|
25
27
|
constructor(onFlushTask: TaskCallback, onBreak: TaskCallback) {
|
|
26
28
|
this.customerOnBreak = onBreak;
|
|
27
29
|
this.customerOnFlushTakEnd = onFlushTask;
|
|
28
|
-
watch(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
// watch(
|
|
31
|
+
// () => this.mTaskToken.value,
|
|
32
|
+
// () => {
|
|
33
|
+
// this.onFlushTask();
|
|
34
|
+
// this.mFlushedFrameCount = this.frameCount;
|
|
35
|
+
// },
|
|
36
|
+
// {
|
|
37
|
+
// flush: 'post'
|
|
38
|
+
// })
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
private getToken(): number {
|
|
@@ -45,6 +48,11 @@ export class MacroEndTaskManager {
|
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
public addTask(type: TaskType, params: any) {
|
|
51
|
+
if (this.mFlushedFrameCount == Forge.sFrameCount.count) {
|
|
52
|
+
console.log("MetroWidget: tasks in currnet frame flushed. ignore task", type, params);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
48
56
|
this.taskList.push({
|
|
49
57
|
type,
|
|
50
58
|
params,
|
|
@@ -60,8 +68,23 @@ export class MacroEndTaskManager {
|
|
|
60
68
|
}
|
|
61
69
|
}
|
|
62
70
|
this.onBreak(breakList);
|
|
63
|
-
this.mTaskToken.value = this.getToken();
|
|
71
|
+
// this.mTaskToken.value = this.getToken();
|
|
64
72
|
}
|
|
73
|
+
|
|
74
|
+
//每次添加task时推迟处理
|
|
75
|
+
this.mTaskToken.value = this.getToken();
|
|
76
|
+
let selfToken = this.mTaskToken.value;
|
|
77
|
+
Promise.resolve().then(() => {
|
|
78
|
+
// console.log("flushtask", selfToken, this.mTaskToken.value)
|
|
79
|
+
if (selfToken == this.mTaskToken.value) {
|
|
80
|
+
this.onFlushTask();
|
|
81
|
+
this.mFlushedFrameCount = this.frameCount;
|
|
82
|
+
//task flush 完成后有按键过来时, 按键触发的task会被丢掉, 因此任务完成后RequestSwap
|
|
83
|
+
Forge.sRenderBridge.RequestSwap();
|
|
84
|
+
} else {
|
|
85
|
+
// console.log("drop promise");
|
|
86
|
+
}
|
|
87
|
+
})
|
|
65
88
|
}
|
|
66
89
|
|
|
67
90
|
private onFlushTask() {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
只显示单列/行的MetroWidget
|
|
3
3
|
-->
|
|
4
4
|
<script setup>
|
|
5
|
-
import { ref, shallowRef, computed } from "vue";
|
|
5
|
+
import { ref, shallowRef, computed, reactive } from "vue";
|
|
6
6
|
import { setup } from "./MetroWidgetSetup";
|
|
7
7
|
import {
|
|
8
8
|
VERTICAL,
|
|
@@ -140,6 +140,16 @@ const props = defineProps({
|
|
|
140
140
|
type: Boolean,
|
|
141
141
|
default: false,
|
|
142
142
|
},
|
|
143
|
+
onFocusRectChange: {
|
|
144
|
+
type: Function,
|
|
145
|
+
},
|
|
146
|
+
onAllItemResizeDone: {
|
|
147
|
+
type: Function,
|
|
148
|
+
},
|
|
149
|
+
// enableTouch: {
|
|
150
|
+
// type: Boolean,
|
|
151
|
+
// default: false,
|
|
152
|
+
// },
|
|
143
153
|
});
|
|
144
154
|
|
|
145
155
|
const renderBreakKey = props.enableItemRenderBreak ? RENDER_ITEM_BREAK_KEY : "";
|
|
@@ -152,6 +162,12 @@ const slideDivTop = ref(0);
|
|
|
152
162
|
const focusNode = shallowRef(null);
|
|
153
163
|
const pageUpdateToken = ref(0);
|
|
154
164
|
|
|
165
|
+
const touchDiv = shallowRef(null);
|
|
166
|
+
const touchDivSize = reactive({
|
|
167
|
+
width: 0,
|
|
168
|
+
height: 0,
|
|
169
|
+
});
|
|
170
|
+
|
|
155
171
|
const normalizedPlaceHolder = computed(() => {
|
|
156
172
|
return {
|
|
157
173
|
gap: props.placeHolderSetting.gap ?? 0,
|
|
@@ -168,9 +184,12 @@ const {
|
|
|
168
184
|
focusBlockOnFocus,
|
|
169
185
|
focusBlockOnBlur,
|
|
170
186
|
focusBlockOnKeyDown,
|
|
171
|
-
|
|
187
|
+
focusBlockOnCustomEvent,
|
|
172
188
|
_onFocusableItemEdge,
|
|
173
189
|
exportObject,
|
|
190
|
+
onTouchDown,
|
|
191
|
+
onTouchRelease,
|
|
192
|
+
currentFocusIndex,
|
|
174
193
|
} = setup(
|
|
175
194
|
props,
|
|
176
195
|
itemRender,
|
|
@@ -181,6 +200,8 @@ const {
|
|
|
181
200
|
slideDivTop,
|
|
182
201
|
focusNode,
|
|
183
202
|
pageUpdateToken,
|
|
203
|
+
touchDiv,
|
|
204
|
+
touchDivSize,
|
|
184
205
|
"list"
|
|
185
206
|
);
|
|
186
207
|
|
|
@@ -212,66 +233,77 @@ defineExpose(exportObject);
|
|
|
212
233
|
top: slideDivTop,
|
|
213
234
|
}"
|
|
214
235
|
>
|
|
215
|
-
<div
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
top: item.templateInfo.top,
|
|
236
|
-
width: item.templateInfo.width,
|
|
237
|
-
height: item.templateInfo.height,
|
|
238
|
-
zIndex: item.renderStyle.zIndex,
|
|
236
|
+
<div
|
|
237
|
+
ref="touchDiv"
|
|
238
|
+
:style="{
|
|
239
|
+
width: touchDivSize.width,
|
|
240
|
+
height: touchDivSize.height,
|
|
241
|
+
}"
|
|
242
|
+
@jsv-touchend="onTouchRelease"
|
|
243
|
+
>
|
|
244
|
+
<div>
|
|
245
|
+
<slot name="background"></slot>
|
|
246
|
+
</div>
|
|
247
|
+
<div ref="locateDiv">
|
|
248
|
+
<jsv-focus-block
|
|
249
|
+
ref="focusNode"
|
|
250
|
+
:name="name"
|
|
251
|
+
:onAction="{
|
|
252
|
+
onFocus: focusBlockOnFocus,
|
|
253
|
+
onBlur: focusBlockOnBlur,
|
|
254
|
+
onKeyDown: focusBlockOnKeyDown,
|
|
255
|
+
onCustomEvent: focusBlockOnCustomEvent,
|
|
239
256
|
}"
|
|
240
257
|
>
|
|
241
258
|
<div
|
|
242
|
-
v-
|
|
243
|
-
|
|
244
|
-
"
|
|
245
|
-
:key="renderBreakKey"
|
|
246
|
-
:ref="item.slotRef"
|
|
247
|
-
>
|
|
248
|
-
<slot
|
|
249
|
-
name="renderItem"
|
|
250
|
-
:data="item.customerData"
|
|
251
|
-
:onEdge="_onFocusableItemEdge"
|
|
252
|
-
:onAction="item.registerObj"
|
|
253
|
-
:query="item.query"
|
|
254
|
-
:onItemEdge="_onFocusableItemEdge"
|
|
255
|
-
></slot>
|
|
256
|
-
</div>
|
|
257
|
-
<div
|
|
258
|
-
v-if="
|
|
259
|
-
enableItemRenderBreak &&
|
|
260
|
-
placeHolderSetting &&
|
|
261
|
-
!item.mounted.value
|
|
262
|
-
"
|
|
259
|
+
v-for="(item, index) in renderData"
|
|
260
|
+
:key="pageUpdateToken + '_' + item.index"
|
|
261
|
+
:ref="item.divRef"
|
|
263
262
|
:style="{
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
: normalizedPlaceHolder.backgroundColor,
|
|
270
|
-
borderRadius: normalizedPlaceHolder.borderRadius,
|
|
263
|
+
left: item.templateInfo.left,
|
|
264
|
+
top: item.templateInfo.top,
|
|
265
|
+
width: item.templateInfo.width,
|
|
266
|
+
height: item.templateInfo.height,
|
|
267
|
+
zIndex: item.renderStyle.zIndex,
|
|
271
268
|
}"
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
269
|
+
@click="item.onTap.value"
|
|
270
|
+
>
|
|
271
|
+
<div
|
|
272
|
+
v-if="
|
|
273
|
+
!enableItemRenderBreak || item.mounted.value || itemRender
|
|
274
|
+
"
|
|
275
|
+
:key="renderBreakKey"
|
|
276
|
+
:ref="item.slotRef"
|
|
277
|
+
:id="`${name}_${index}`"
|
|
278
|
+
>
|
|
279
|
+
<slot
|
|
280
|
+
name="renderItem"
|
|
281
|
+
:data="item.customerData"
|
|
282
|
+
:onEdge="_onFocusableItemEdge"
|
|
283
|
+
:onAction="item.registerObj"
|
|
284
|
+
:query="item.query"
|
|
285
|
+
:onItemEdge="_onFocusableItemEdge"
|
|
286
|
+
></slot>
|
|
287
|
+
</div>
|
|
288
|
+
<div
|
|
289
|
+
v-if="
|
|
290
|
+
enableItemRenderBreak &&
|
|
291
|
+
placeHolderSetting &&
|
|
292
|
+
!item.mounted.value
|
|
293
|
+
"
|
|
294
|
+
:style="{
|
|
295
|
+
width: item.renderStyle.width - normalizedPlaceHolder.gap,
|
|
296
|
+
height: item.renderStyle.height - normalizedPlaceHolder.gap,
|
|
297
|
+
backgroundColor:
|
|
298
|
+
currentFocusIndex == item.index
|
|
299
|
+
? normalizedPlaceHolder.focusBackgroundColor
|
|
300
|
+
: normalizedPlaceHolder.backgroundColor,
|
|
301
|
+
borderRadius: normalizedPlaceHolder.borderRadius,
|
|
302
|
+
}"
|
|
303
|
+
></div>
|
|
304
|
+
</div>
|
|
305
|
+
</jsv-focus-block>
|
|
306
|
+
</div>
|
|
275
307
|
</div>
|
|
276
308
|
<div>
|
|
277
309
|
<slot name="foreground"></slot>
|