@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
@@ -0,0 +1,159 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2022-04-10 21:21:02
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-04-11 09:04:26
6
+ * @Description: file content
7
+ -->
8
+ <script>
9
+ import JsvTouchContainer, {
10
+ DIRECTION_VERTICAL,
11
+ DIRECTION_HORIZONTAL,
12
+ DIRECTION_DISABLE,
13
+ } from "jsview/utils/JsViewVueWidget/JsvTouchContainer.vue";
14
+ import { touchContainerV, measures } from "./data.js";
15
+ function randomColor() {
16
+ let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
17
+ return (
18
+ "#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
19
+ );
20
+ }
21
+ export default {
22
+ components: {
23
+ JsvTouchContainer,
24
+ },
25
+ setup() {
26
+ return {
27
+ DIRECTION_VERTICAL,
28
+ DIRECTION_HORIZONTAL,
29
+ DIRECTION_DISABLE,
30
+ touchContainerV,
31
+ measures,
32
+ randomColor,
33
+ };
34
+ },
35
+ methods: {
36
+ _onClick(msg) {
37
+ console.log(`_onClick:${JSON.stringify(msg)}`);
38
+ return true;
39
+ },
40
+ },
41
+ };
42
+ </script>
43
+
44
+ <template>
45
+ <div :style="{ width: 1280, height: 720, overflow: 'hidden' }">
46
+ <jsv-touch-container
47
+ :style="{ width: 1280, height: 720 * 2, backgroundColor: '#7b7a1c' }"
48
+ :direction="DIRECTION_HORIZONTAL"
49
+ :dragLimitArea="{ x: 0, y: 0, width: 1280, height: 720 }"
50
+ >
51
+ <div
52
+ :style="{
53
+ left: 30,
54
+ top: 0,
55
+ width: 400,
56
+ height: 40,
57
+ fontSize: 25,
58
+ lineHeight: '40px',
59
+ color: '#f0ef29',
60
+ }"
61
+ >
62
+ 整屏幕滑动
63
+ </div>
64
+ <jsv-touch-container
65
+ :style="{
66
+ left: 30,
67
+ top: 50,
68
+ width: 400,
69
+ height: 500 * 5,
70
+ backgroundColor: '#810000',
71
+ }"
72
+ :direction="DIRECTION_VERTICAL"
73
+ :flingPageWidth="500"
74
+ :dragLimitArea="{ x: 0, y: 0, width: 400, height: 500 }"
75
+ >
76
+ <div
77
+ v-for="(tabList, tabIndex) in touchContainerV"
78
+ :key="'tab' + tabIndex"
79
+ :style="{
80
+ left: 0,
81
+ top: 500 * tabIndex,
82
+ width: 400,
83
+ height: 500,
84
+ backgroundColor: randomColor(),
85
+ }"
86
+ >
87
+ <jsv-touch-container
88
+ v-for="(item, itemIndex) in tabList"
89
+ :key="'tab' + tabIndex + '-' + itemIndex"
90
+ :style="{
91
+ left: item.left,
92
+ top: item.top,
93
+ width: item.width,
94
+ height: item.height,
95
+ backgroundColor: item.backgroundColor,
96
+ fontSize: 18,
97
+ }"
98
+ :onClick="_onClick"
99
+ :direction="DIRECTION_DISABLE"
100
+ >{{ item.content }}</jsv-touch-container
101
+ >
102
+ </div>
103
+ </jsv-touch-container>
104
+
105
+ <div
106
+ :style="{
107
+ left: 530,
108
+ top: 0,
109
+ width: 400,
110
+ height: 40,
111
+ fontSize: 25,
112
+ lineHeight: '40px',
113
+ color: '#f0ef29',
114
+ }"
115
+ >
116
+ 上下滑动
117
+ </div>
118
+ <jsv-touch-container
119
+ :style="{
120
+ left: 530,
121
+ top: 50,
122
+ width: 400,
123
+ height: 500 * 5,
124
+ backgroundColor: '#810000',
125
+ }"
126
+ :direction="DIRECTION_VERTICAL"
127
+ :dragLimitArea="{ x: 0, y: 0, width: 400, height: 500 }"
128
+ >
129
+ <div
130
+ v-for="(tabList, tabIndex) in touchContainerV"
131
+ :key="'tab' + tabIndex"
132
+ :style="{
133
+ left: 0,
134
+ top: 500 * tabIndex,
135
+ width: 400,
136
+ height: 500,
137
+ backgroundColor: randomColor(),
138
+ }"
139
+ >
140
+ <jsv-touch-container
141
+ v-for="(item, itemIndex) in tabList"
142
+ :key="'tab' + tabIndex + '-' + itemIndex"
143
+ :style="{
144
+ left: item.left,
145
+ top: item.top,
146
+ width: item.width,
147
+ height: item.height,
148
+ backgroundColor: item.backgroundColor,
149
+ fontSize: 18,
150
+ }"
151
+ :onClick="_onClick"
152
+ :direction="DIRECTION_DISABLE"
153
+ >{{ item.content }}</jsv-touch-container
154
+ >
155
+ </div>
156
+ </jsv-touch-container>
157
+ </jsv-touch-container>
158
+ </div>
159
+ </template>
@@ -0,0 +1,81 @@
1
+ /*
2
+ * @Author: ChenChanghua
3
+ * @Date: 2022-04-10 21:23:15
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-04-11 10:03:21
6
+ * @Description: file content
7
+ */
8
+ function randomColor() {
9
+ let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
10
+ return (
11
+ "#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
12
+ );
13
+ }
14
+
15
+ const metroWidgetH = [];
16
+ for (let i = 0; i < 500; i++) {
17
+ metroWidgetH.push({
18
+ content: i,
19
+ id: i,
20
+ width: 100,
21
+ height: 200,
22
+ color: randomColor(),
23
+ });
24
+ }
25
+
26
+ const metroWidgetV = [];
27
+ for (let i = 0; i < 500; i++) {
28
+ metroWidgetV.push({
29
+ content: i,
30
+ id: i,
31
+ width: 200,
32
+ height: 100,
33
+ color: randomColor(),
34
+ });
35
+ }
36
+
37
+ const touchContainerH = [];
38
+ for (let i = 0; i < 5; i++) {
39
+ const tabData = [];
40
+ for (let i = 0; i < 20; i++) {
41
+ tabData.push({
42
+ content: i,
43
+ id: i,
44
+ left: (122 / 2) * i,
45
+ top: 10,
46
+ width: 122 / 2 - 10,
47
+ height: 200,
48
+ backgroundColor: randomColor(),
49
+ });
50
+ }
51
+ touchContainerH.push(tabData);
52
+ }
53
+
54
+ const touchContainerV = [];
55
+ for (let i = 0; i < 5; i++) {
56
+ const tabData = [];
57
+ for (let i = 0; i < 20; i++) {
58
+ tabData.push({
59
+ content: i,
60
+ id: i,
61
+ left: 10,
62
+ top: 50 * i,
63
+ width: 300,
64
+ height: 40,
65
+ backgroundColor: randomColor(),
66
+ });
67
+ }
68
+ touchContainerV.push(tabData);
69
+ }
70
+
71
+ function measures(item) {
72
+ return item;
73
+ }
74
+
75
+ export {
76
+ metroWidgetH,
77
+ metroWidgetV,
78
+ touchContainerH,
79
+ touchContainerV,
80
+ measures,
81
+ };
File without changes
File without changes
File without changes
Binary file
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const http = require('http');
5
+ const os = require('os');
6
+
7
+ let baseDir = __dirname;
8
+
9
+ function requestListener(req, res) {
10
+ console.log("[request] " + req.url);
11
+
12
+ if (req.url.endsWith("\.map")) { // return map source file content
13
+ try {
14
+ const fileContent = fs.readFileSync(baseDir + '/' + req.url);
15
+
16
+ res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' });
17
+ res.write(fileContent);
18
+ res.end();
19
+ return;
20
+ } catch (ex) {
21
+ console.log("Failed to process " + req.url + "\nException: " + ex);
22
+ }
23
+ }
24
+
25
+ res.writeHead(404);
26
+ res.end();
27
+ };
28
+
29
+ function getIPAddress() {
30
+ let ret = [];
31
+
32
+ var interfaces = os.networkInterfaces();
33
+ for (var devname in interfaces) {
34
+ var iface = interfaces[devname];
35
+
36
+ for (var i = 0; i < iface.length; i++) {
37
+ var alias = iface[i];
38
+ if (alias.family === 'IPv4' && !alias.internal)
39
+ ret.push(alias.address);
40
+ }
41
+ }
42
+ return ret;
43
+ }
44
+
45
+ function main() {
46
+ if (process.argv.length >= 3) {
47
+ baseDir = process.argv[2];
48
+ }
49
+
50
+ const server = http.createServer(requestListener);
51
+ const port = 57245;
52
+ server.listen(port, '0.0.0.0', () => {
53
+ console.log('');
54
+ console.log('JavaScript source map running at:');
55
+ console.log(' - Local: localhost:' + port);
56
+ getIPAddress().forEach(ip => {
57
+ console.log(' - Network: ' + ip + ':' + port);
58
+ });
59
+ console.log('');
60
+ });
61
+ }
62
+
63
+ main();
@@ -92,6 +92,10 @@ function signApp(options)
92
92
  console.log('Updating ' + path.relative(options.projectDir, jsFile));
93
93
 
94
94
  var jsvAppContents = fs.readFileSync(jsFile);
95
+ jsvAppContents = jsvAppContents.toString();
96
+ jsvAppContents = jsvAppContents.replace('# sourceMappingURL=', '# sourceMappingURL=http://localhost:57245/map/');
97
+ jsvAppContents += '\n'; // 把\n归入算进md5计算中
98
+
95
99
  const jsvAppMd5 = crypto.createHash('md5').update(jsvAppContents).digest('hex');
96
100
  let appDataInfo = '';
97
101
  if (jsFile.indexOf('main.jsv.') > 0) {
@@ -101,21 +105,53 @@ function signApp(options)
101
105
  // 格式化jsvapp信息 /*jsvapp:内容长度:{内容}*/
102
106
  // 使用TextEncoder解决中文长度问题
103
107
  const infoLen = new TextEncoder().encode(appDataInfo).length;
104
- appDataInfo = '/*jsvapp:' + infoLen + ':' + appDataInfo + '*/';
108
+ appDataInfo = '/*jsvapp:' + infoLen + ':' + appDataInfo + ':' + infoLen + ':jsvapp*/';
105
109
  }
106
- jsvAppContents = '/*jsvmd5:' + jsvAppMd5 + '*/' + appDataInfo + jsvAppContents;
110
+ jsvAppContents = jsvAppContents + appDataInfo + '/*jsvmd5:' + jsvAppMd5 + '*/';
107
111
  fs.writeFileSync(jsFile, jsvAppContents);
108
112
  });
109
113
  }
110
114
 
115
+ function makeDebugMap(options)
116
+ {
117
+ fs.mkdirSync(options.mapDir, { recursive: true });
118
+
119
+ const jsDir = path.resolve(options.distDir, 'js');
120
+ const jsFiles = fs.readdirSync(jsDir);
121
+ jsFiles.forEach((file, index) => {
122
+ if (!file.endsWith('.map')) {
123
+ return;
124
+ }
125
+
126
+ const from = path.resolve(jsDir, file);
127
+ const to = path.resolve(options.mapDir, file);
128
+ console.log("Moving " + path.relative(options.projectDir, to));
129
+ fs.renameSync(from, to);
130
+ });
131
+
132
+ const jsmapServeName = "jsview-jsmap-serve.js";
133
+ const jsmapServePath = path.resolve(options.scriptsDir, jsmapServeName);
134
+ if (!fs.existsSync(jsmapServePath)) {
135
+ console.error("Failed to copy jsview-jsmap-serve.js, file not exists.");
136
+ process.exit(1);
137
+ }
138
+
139
+ const to = path.resolve(options.debugDir, jsmapServeName);
140
+ console.log("Making " + path.relative(options.projectDir, to));
141
+ fs.copyFileSync(jsmapServePath, to);
142
+ }
143
+
111
144
  function main() {
112
145
  const options = {};
113
146
  options.projectDir = process.cwd();
114
147
  options.modulesDir = path.resolve(options.projectDir, "node_modules");
115
148
  options.jsviewDir = path.resolve(options.modulesDir, "@shijiu/jsview-vue");
116
149
  options.patchesDir = path.resolve(options.jsviewDir, "patches");
150
+ options.scriptsDir = path.resolve(options.jsviewDir, "scripts");
117
151
  options.distDir = path.resolve(options.projectDir, "dist");
118
152
  options.appConfigDir = path.resolve(options.projectDir, "src/appConfig");
153
+ options.debugDir = path.resolve(options.distDir, "debug");
154
+ options.mapDir = path.resolve(options.debugDir, "map");
119
155
 
120
156
 
121
157
  vueConfigFile = path.resolve(options.projectDir, 'vue.config.js');
@@ -130,7 +166,13 @@ function main() {
130
166
  console.info();
131
167
  signApp(options);
132
168
  console.info();
133
- console.info('Sign complete.');
169
+ console.info('Signed JsView App.');
170
+
171
+ console.info('Making JsView Debug map...');
172
+ console.info();
173
+ makeDebugMap(options);
174
+ console.info();
175
+ console.info('Made JsView Debug map.');
134
176
  }
135
177
 
136
178
  main();
@@ -55,6 +55,28 @@ async function printRevision(options) {
55
55
  console.log('* Update revision to:');
56
56
  console.log('* CORE: ' + jsviewTargetVersion.CoreRevision);
57
57
  console.log('* ENGINE JS URL: ' + jsviewTargetVersion.JseUrl);
58
+ console.log('* PLUGIN LIST: ');
59
+
60
+ // print plugin info
61
+ let pluginCount = 0;
62
+ {
63
+ let pluginDirPath = path.join(options.jsviewDir, '/utils/JsViewPlugin');
64
+ fs.readdirSync(pluginDirPath).forEach((file) => {
65
+ var pathname = path.join(pluginDirPath, file);
66
+ if (fs.statSync(pathname).isDirectory()) {
67
+ let versionFilePath = path.join(pathname, 'version.js');
68
+ if (fs.existsSync(versionFilePath)) {
69
+ const targetVersion = require(versionFilePath);
70
+ console.log(`* [${path.basename
71
+ (pathname)}] : ${targetVersion.packageName
72
+ } : ${targetVersion.version}`);
73
+ pluginCount++;
74
+ }
75
+ }
76
+ })
77
+ }
78
+ console.log(`* total:${pluginCount}`);
79
+
58
80
  console.log('**************************************************');
59
81
  }
60
82
 
@@ -7,15 +7,15 @@
7
7
  * @return 是否消耗 true: 已消耗,不再冒泡; false: 继续冒泡
8
8
  * onFocus: 获得焦点回调
9
9
  * onBlur: 失去焦点回调
10
- * dispathchKeyDown: 分发按键落下事件回调
10
+ * onDispatchKeyDown: 分发按键落下事件回调
11
11
  * @params keyEvent
12
12
  * @return 是否消耗 true: 已消耗,不再分发; false: 继续分发
13
- * dispathcKeyUp: 分发按键抬起事件回调
13
+ * onDispatchKeyUp: 分发按键抬起事件回调
14
14
  * @params keyEvent
15
15
  * @return 是否消耗 true: 已消耗,不再分发; false: 继续分发
16
- * fid/branchName: 用于设置焦点的id
16
+ * name: 用于设置焦点的id
17
+ * namespace: 焦点id的命名空间
17
18
  * autoFocus: 当Mount后自动获得焦点, 设置为"exact",将把其子节点的焦点给抢过来
18
- * asHub: true/false,设置后,此节点会创建二级hub,不同的hub之间fid可以重复(用于子场景由不同开发者开发后进行合并的场景)
19
19
  -->
20
20
 
21
21
  <script>
@@ -74,7 +74,9 @@ export default {
74
74
  }
75
75
  },
76
76
  beforeUnmount() {
77
- this.$el.FocusNodeRef.onUnMount();
77
+ const focusNode = this.$el.FocusNodeRef;
78
+ focusNode.onUnMount();
79
+ focusNode.jsvVueComponent = undefined;
78
80
  },
79
81
 
80
82
  methods: {
@@ -22,6 +22,11 @@ export class JsvFocusManager {
22
22
  app.config.globalProperties.$jsvFocusManager = this;
23
23
  }
24
24
 
25
+ getCurrentFocusStack() {
26
+ let focus_stack = this.$_topFDiv?.getHub()?.getCurrentFocusStack();
27
+ return (focus_stack ? focus_stack : []);
28
+ }
29
+
25
30
  // declareAlias(alias, blockName) {
26
31
  // if(typeof alias !== 'string') {
27
32
  // throw new Error('JsvFocusManager Error: 1st argument must be a string as alias.')
@@ -2,7 +2,7 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2021-09-18 14:34:20
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-03-25 14:30:24
5
+ * @LastEditTime: 2022-04-02 16:21:15
6
6
  * @Description: file content
7
7
  -->
8
8
  <script>
@@ -99,12 +99,13 @@ export default {
99
99
  return this.$refs.itemDiv;
100
100
  },
101
101
  testTouchEnable() {
102
+
102
103
  if (this.enableTouch) {
103
- if (this.$refs.element) {
104
+ if (this.$refs.itemDiv) {
104
105
  if (!this.touchTested) {
105
106
  // 为view添加触控处理
106
- let view = this.$refs.element.jsvMaskView;
107
- var dragSetting = new Forge.DragSetting(
107
+ let view = this.$refs.itemDiv.jsvMaskView;
108
+ let dragSetting = new Forge.DragSetting(
108
109
  Forge.DragSetting.DIRECTION_DISABLE,
109
110
  20,
110
111
  false,
@@ -152,18 +153,10 @@ export default {
152
153
  },
153
154
  mounted() {
154
155
  this.widgetHandler.updateMounted(this.index, true);
155
- //TODO 触控的处理有待添加
156
- // this.testTouchEnable();
157
- // this.widgetHandler.updateMounted(this.index, true);
158
- // const curFocus = this.widgetHandler.getCurrentFocusId();
159
- // if (this.widgetHandler.isFocus() && curFocus.index === this.index) {
160
- // //unmount 后导致的onFocus 在 mount 前,onFocus 为生效的问题
161
- // this.onFocus();
162
- // }
156
+ this.testTouchEnable();
163
157
  },
164
158
  updated() {
165
- //TODO 触控的处理有待添加
166
- // this.testTouchEnable();
159
+ this.testTouchEnable();
167
160
  },
168
161
  beforeUnmount() {
169
162
  this.widgetHandler.updateMounted(this.index, false);