@shijiu/jsview 2.3.151-test.0 → 3.0.0-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 (78) hide show
  1. package/dom/bin/jsview-dom-browser-engine-core.min.js +1 -1
  2. package/dom/bin/jsview-dom-browser-engine-modules.min.js +1 -1
  3. package/dom/bin/{jsview-dom-browser-forge.1493.9a36.wasm → jsview-dom-browser-forge.1760.0e35.wasm} +0 -0
  4. package/dom/bin/jsview-dom-browser-forge.min.js +1 -1
  5. package/dom/bin/jsview-dom-browser-forge.worker.min.js +1 -1
  6. package/dom/bin/jsview-dom-browser.min.js +1 -1
  7. package/dom/bin/jsview-dom-native.min.js +1 -1
  8. package/dom/bin/jsview-engine-js-native.min.js +1 -1
  9. package/dom/target_core_revision.mjs +2 -2
  10. package/loader/jsv-core-api/jsview-core-api-glue.js +10 -1
  11. package/loader/jsv-core-api/wasm/core-api.js +87 -2
  12. package/loader/jsv-core-api/wasm/wasm-extension.js +5 -0
  13. package/loader/jsview-loader.js +7 -0
  14. package/loader/jsview-main.mjs +2 -1
  15. package/loader/jsview.config.default.js +4 -0
  16. package/package.json +7 -5
  17. package/patches/@vitejs+plugin-vue+4.0.0.patch +51 -0
  18. package/patches/@vitejs+plugin-vue+6.0.6.patch +54 -0
  19. package/patches/@vue+compiler-dom+3.2.45.patch +22 -0
  20. package/patches/@vue+compiler-dom+3.6.0-beta.10.patch +22 -0
  21. package/patches/@vue+compiler-sfc+3.2.45.patch +1986 -0
  22. package/patches/@vue+compiler-sfc+3.6.0-beta.10.patch +69 -0
  23. package/patches/@vue+runtime-core+3.2.45.patch +353 -0
  24. package/patches/@vue+runtime-core+3.6.0-beta.10.patch +198 -0
  25. package/patches/@vue+runtime-dom+3.2.45.patch +81 -0
  26. package/patches/@vue+runtime-dom+3.6.0-beta.10.patch +47 -0
  27. package/patches/postcss-js+5.1.0.patch +20 -0
  28. package/patches/vite+4.0.0.patch +117 -0
  29. package/patches/vite+8.0.9.patch +77 -0
  30. package/patches/vue-router+4.1.6.patch +17 -0
  31. package/patches/vue-router+5.0.6.patch +0 -0
  32. package/{patches/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js → thirdparty/@vue/compiler-sfc/jsview-css-to-js.cjs} +15 -10
  33. package/{patches/node_modules/@vue/compiler-sfc/dist/jsview-style-checker.js → thirdparty/@vue/compiler-sfc/jsview-style-checker.cjs} +6 -1
  34. package/{patches/node_modules/@vue/compiler-sfc/dist/jsview-style-formator.cjs.js → thirdparty/@vue/compiler-sfc/jsview-style-formator.cjs} +3 -0
  35. package/thirdparty/@vue/runtime-core/jsview-render-break.mjs +201 -0
  36. package/thirdparty/vite/jsview-vite-extension.mjs +336 -0
  37. package/tools/jsview-build-zip.mjs +7 -2
  38. package/tools/jsview-common.mjs +17 -4
  39. package/tools/{jsview-logger.js → jsview-logger.cjs} +1 -1
  40. package/tools/jsview-post-build.mjs +55 -0
  41. package/tools/jsview-post-install.mjs +98 -110
  42. package/tools/jsview-run-tool.mjs +3 -6
  43. package/tools/jsview-vue-devtools.mjs +1 -1
  44. package/loader/jsview-react-main.js +0 -37
  45. package/loader/jsview-react-script-loader.js +0 -134
  46. package/patches/node_modules/@vitejs/plugin-react/dist/index.cjs +0 -520
  47. package/patches/node_modules/@vitejs/plugin-react/package.json +0 -55
  48. package/patches/node_modules/@vitejs/plugin-vue/dist/index.mjs +0 -2756
  49. package/patches/node_modules/@vitejs/plugin-vue/package.json +0 -51
  50. package/patches/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js +0 -3152
  51. package/patches/node_modules/@vue/compiler-dom/package.json +0 -43
  52. package/patches/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +0 -17730
  53. package/patches/node_modules/@vue/compiler-sfc/package.json +0 -59
  54. package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +0 -8154
  55. package/patches/node_modules/@vue/runtime-core/package.json +0 -38
  56. package/patches/node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts +0 -1531
  57. package/patches/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +0 -1740
  58. package/patches/node_modules/@vue/runtime-dom/package.json +0 -42
  59. package/patches/node_modules/postcss-js/objectifier.js +0 -94
  60. package/patches/node_modules/postcss-js/package.json +0 -42
  61. package/patches/node_modules/react-dev-utils/WebpackDevServerUtils.js +0 -450
  62. package/patches/node_modules/react-dev-utils/package.json +0 -88
  63. package/patches/node_modules/react-dom/cjs/react-dom.development.js +0 -29868
  64. package/patches/node_modules/react-dom/cjs/react-dom.production.min.js +0 -323
  65. package/patches/node_modules/react-dom/package.json +0 -62
  66. package/patches/node_modules/react-scripts/config/paths.js +0 -179
  67. package/patches/node_modules/react-scripts/config/webpack.config.js +0 -858
  68. package/patches/node_modules/react-scripts/package.json +0 -108
  69. package/patches/node_modules/vite/dist/node/chunks/dep-ed9cb113.js +0 -63182
  70. package/patches/node_modules/vite/dist/node/constants.js +0 -125
  71. package/patches/node_modules/vite/dist/node/jsview-vite-extension.js +0 -245
  72. package/patches/node_modules/vite/package.json +0 -153
  73. package/patches/node_modules/vue-router/dist/vue-router.mjs +0 -3613
  74. package/patches/node_modules/vue-router/package.json +0 -114
  75. package/patches/node_modules/webpack-dev-server/client/utils/reloadApp.js +0 -76
  76. package/patches/node_modules/webpack-dev-server/client/utils/sendMessage.js +0 -21
  77. package/patches/node_modules/webpack-dev-server/package.json +0 -141
  78. /package/patches/{node_modules/@originjs/vite-plugin-federation/1.3.4/@originjs+vite-plugin-federation+1.3.4.patch → @originjs+vite-plugin-federation+1.3.4.patch} +0 -0
@@ -10,6 +10,7 @@ export default class WasmCoreApis {
10
10
  this.EngineJs = "embedded";
11
11
  this.UrlBuilder = URL;
12
12
  this.Platform = "pc-wasm"; // 平台信息,可选有 android/pc-wasm/harmony-webview
13
+ this.ProcessType = "wasm";
13
14
 
14
15
  this._ForgeHandle = null;
15
16
 
@@ -157,6 +158,14 @@ export default class WasmCoreApis {
157
158
  console.log("removeGlobalJsExceptionAck not implemented");
158
159
  }
159
160
 
161
+ addModuleFailedAck(callback) {
162
+ console.log("addModuleFailedAck not implemented");
163
+ }
164
+
165
+ removeModuleFailedAck(callback) {
166
+ console.log("removeModuleFailedAck not implemented");
167
+ }
168
+
160
169
  toggleViewVisible(toVisible) {
161
170
  console.log("toggleViewVisible not implemented");
162
171
  }
@@ -189,8 +198,22 @@ export default class WasmCoreApis {
189
198
  // wasm不支持调整 cookie domain
190
199
  }
191
200
 
201
+ refreshCookies() {
202
+ // wasm不支持调整 cookie domain
203
+ }
204
+
192
205
  setRenderGlobalConfig(json) {
193
- this._ForgeHandle?.sRenderBridge.SetGlobalConfig(json);
206
+ // 抓取forge_config中需要的配置, 保持未设时, 在forge_config中也不存在
207
+ const forge_config = {};
208
+ ['texCache', 'holderCache', 'simulDecodeNum', 'touchSlop', 'wheelRate'].forEach(key => { if (key in json) forge_config[key] = json[key]; });
209
+ this._ForgeHandle?.sRenderBridge.SetGlobalConfig(forge_config);
210
+
211
+ // 抓取dom_config中需要的配置, 保持未设时, 在dom_config中也不存在
212
+ const dom_config = {};
213
+ ['maxDomSync'].forEach(key => { if (key in json) dom_config[key] = json[key]; });
214
+ if (typeof dom_config.maxDomSync == 'number') {
215
+ window.JsvCode.Dom.SetLazyTaskOverLoadLevel(dom_config.maxDomSync);
216
+ }
194
217
  }
195
218
 
196
219
  setForgeJsHandle(forgeHandle) {
@@ -201,9 +224,71 @@ export default class WasmCoreApis {
201
224
  console.log("onMainTsDone...");
202
225
  }
203
226
 
204
- // tag参数中以空格隔开每个tag
227
+ /**
228
+ * 完全释放GLView, 以达到完全清理GL内存的目的,一般配合JsView的visibility的回调一齐使用
229
+ * 场景1: 可以通过此接口,规避在android 9.0上把其他进程的GL内存都算在本进程的内存统计上的问题
230
+ * 场景2: 完全释放绘制资源,以保证作为Launcher时,退到后时最小化内存
231
+ *
232
+ * @param delayedTimeMs int类型 延迟关闭View的时间,可以为0, 单位:秒
233
+ */
234
+ delayRemoveGLView(delayedTimeSec) {
235
+ console.log("delayRemoveGLView not implemented in wasm");
236
+ }
237
+
238
+ /**
239
+ * 恢复已经被关闭的GLView,一般在delayRemoveGLView后对GLView进行重新展示
240
+ * 此接口内部有状态自查,可以在任何状态调用,既使 delayRemoveGLView 没有触发
241
+ */
242
+ restoreGLView() {
243
+ console.log("restoreGLView not implemented in wasm");
244
+ }
245
+
246
+ // wasm专属api调试api, tag参数中以空格隔开每个tag
205
247
  enableConsoleTag(tag) {
206
248
  this.WasmExt.ForgeLogRef?.EnableTag(tag);
207
249
  this.WasmExt.JseLogRef?.EnableTag(tag);
208
250
  }
251
+
252
+ /**
253
+ * 用户无操作时降帧的功能
254
+ *
255
+ * @param enable boolean类型, 是否开启此功能
256
+ * @param idleFps int类型, 0-60, 开启时限制的帧率
257
+ * @param idleTimeMs int类型, 用户无操作多少时间后降帧(毫秒)
258
+ */
259
+ setIdleFps(enable, idleFps, idleTimeMs) {
260
+ console.log("setIdleFps not implemented in wasm");
261
+ }
262
+
263
+ /**
264
+ * 保持fps高帧率的开关,主要用于灵活控制用户无操作时降帧功能的小开关
265
+ *
266
+ * @param enable boolean类型, 是否保持,保持时关闭降帧功能,不保持时开启降帧功能
267
+ */
268
+ keepFpsHighPerf(enable) {
269
+ console.log("keepFpsHighPerf not implemented in wasm");
270
+ }
271
+
272
+ /**
273
+ * 设置图片缓存上限,默认为80M,每次进行回收时会自动回收到其3/4
274
+ * @params new_level int, 新水位
275
+ */
276
+ setTextureMaxWaterLevel(level) {
277
+ console.log("setTextureMaxWaterLevel not implemented in wasm");
278
+ }
279
+
280
+ base64ToLatinBytes(base64String) {
281
+ // 在wasm版本中,String会转成uint8Array, 和C++的jse::impl::JseStringImpl中的处理呼应
282
+ // 因为在wasm,native层无法直接按照Latin-1编码提取String
283
+ const bytes = atob(base64String);
284
+ const uint8Array = new Uint8Array(bytes.length);
285
+
286
+ for (let i = 0; i < bytes.length; i++) {
287
+ const code = bytes.charCodeAt(i);
288
+ // Latin-1 范围是 0x00-0xFF,超出范围的字符会被截断
289
+ uint8Array[i] = code & 0xFF;
290
+ }
291
+
292
+ return uint8Array;
293
+ }
209
294
  }
@@ -34,4 +34,9 @@ export default class WasmCoreApisExtension {
34
34
  this.ForgeLogRef = forge_log_ref;
35
35
  this.JseLogRef = jse_log_ref;
36
36
  }
37
+ }
38
+
39
+ // 补充setJsvAppConfig api,用于在wasm场景下设置app配置
40
+ if (!window.setJsvAppConfig) {
41
+ window.setJsvAppConfig = function(appConfig) { }
37
42
  }
@@ -138,6 +138,13 @@ export default class JsViewLoader {
138
138
  // (可选配置)按键接受的扩展,例如将静音按键(JAVA键值为164)映射为JS键值20001,PS:注意"164"的引号
139
139
  window.JsvCoreApi.addKeysMap(this.#config.vendorConfig.bindKeys);
140
140
 
141
+ // 设置触摸滑动距离阈值
142
+ if (this.#config.vendorConfig.touchConfig.slop > 0) {
143
+ window.JsvCoreApi.setRenderGlobalConfig({
144
+ touchSlop: this.#config.vendorConfig.touchConfig.slop
145
+ });
146
+ }
147
+
141
148
  // (可选配置)localStorage支持
142
149
  let storageDomain = this.#config.jsviewConfig.localStorage.domain;
143
150
  if (!storageDomain || storageDomain === "default") {
@@ -17,7 +17,8 @@ async function main() {
17
17
  const onInitJsViewEnv = async function () {
18
18
  // JsView环境加载完毕后,加载vue/react的main.js文件。
19
19
  try {
20
- await import('/src/main.tsx');
20
+ window.setJsvAppConfig(JSON.stringify(appConfig));
21
+ await import('/src/main.ts');
21
22
  } finally {
22
23
  window.JsvCoreApi.onMainTsDone(); // 通知Java, 此时app首次渲染执行完毕
23
24
  }
@@ -37,6 +37,10 @@ export default {
37
37
  displayScale: 1.5
38
38
  },
39
39
 
40
+ touchConfig: {
41
+ slop: undefined, // 触摸滑动距离阈值, 单位px,为undefined时表示使用JsView系统默认距离
42
+ },
43
+
40
44
  // (可选配置)按键接受的扩展,例如将静音按键(JAVA键值为164)映射为JS键值20001,
41
45
  // PS:注意'164'的引号
42
46
  bindKeys: {
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "@shijiu/jsview",
3
- "version": "2.3.151-test.0",
3
+ "version": "3.0.0-test.0",
4
+ "type": "module",
4
5
  "bin": {
5
- "jsview-post-build": "./tools/jsview-post-build.js",
6
- "jsview-post-install": "./tools/jsview-post-install.js"
6
+ "jsview-post-build": "./tools/jsview-post-build.mjs",
7
+ "jsview-post-install": "./tools/jsview-post-install.mjs",
8
+ "jsview-run-tool": "./tools/jsview-run-tool.mjs"
7
9
  },
8
10
  "license": "MIT",
9
11
  "repository": "system/jsview-framework",
@@ -17,10 +19,10 @@
17
19
  ],
18
20
  "dependencies": {
19
21
  "gifuct-js": "2.1.2",
20
- "postcss-js": "4.0.0"
22
+ "postcss-js": "5.1.0"
21
23
  },
22
24
  "devDependencies": {},
23
25
  "engines": {
24
- "node": ">=16.0.0"
26
+ "node": ">=20.0.0"
25
27
  }
26
28
  }
@@ -0,0 +1,51 @@
1
+ diff --git a/node_modules/@vitejs/plugin-vue/dist/index.mjs b/node_modules/@vitejs/plugin-vue/dist/index.mjs
2
+ index 52f6edb..038bed5 100644
3
+ --- a/node_modules/@vitejs/plugin-vue/dist/index.mjs
4
+ +++ b/node_modules/@vitejs/plugin-vue/dist/index.mjs
5
+ @@ -260,7 +260,33 @@ function resolveScript(descriptor, options, ssr) {
6
+ return null;
7
+ }
8
+ const cacheToUse = ssr ? ssrCache : clientCache;
9
+ - const cached = cacheToUse.get(descriptor);
10
+ +// JsView Added >>>
11
+ +// 1. 解决style内容发生变化,不使用cache,在templete class和style同时发生变化没有被更新问题。
12
+ +// 2. 解决@import的css文件没有被更新问题。
13
+ + // const cached = cacheToUse.get(descriptor);
14
+ + let cached = cacheToUse.get(descriptor);
15
+ + if (cached && descriptor.filename?.endsWith('.vue') && descriptor.styles) {
16
+ + for (const style of descriptor.styles) {
17
+ + let useCache = false;
18
+ + // 检查解决style内容发生变化
19
+ + for(const cachedContent of cached.map.sourcesContent) {
20
+ + if(cachedContent.includes(style.content)) {
21
+ + useCache = true;
22
+ + break;
23
+ + }
24
+ + }
25
+ + // 检查@import的css文件。
26
+ + if (style.content?.includes('@use')) {
27
+ + useCache = false;
28
+ + }
29
+ +
30
+ + if(useCache == false) {
31
+ + cached = null;
32
+ + break;
33
+ + }
34
+ + }
35
+ + }
36
+ +// JsView Added <<<
37
+ if (cached) {
38
+ return cached;
39
+ }
40
+ @@ -2115,6 +2141,11 @@ async function handleHotUpdate({ file, modules, read, server }, options) {
41
+ if (prevStyles.length > nextStyles.length) {
42
+ affectedModules.add(mainModule);
43
+ }
44
+ +// JsView Added >>>
45
+ +// 当Style发生变化时,更新Script,同步CSS to JS
46
+ + // 貌似没有作用,已经被上面修改的一起处理了。
47
+ + // affectedModules.add(mainModule);
48
+ +// JsView Added <<<
49
+ const prevCustoms = prevDescriptor.customBlocks || [];
50
+ const nextCustoms = descriptor.customBlocks || [];
51
+ if (prevCustoms.length !== nextCustoms.length) {
@@ -0,0 +1,54 @@
1
+ diff --git a/node_modules/@vitejs/plugin-vue/dist/index.mjs b/node_modules/@vitejs/plugin-vue/dist/index.mjs
2
+ index 6886d94..ef142d8 100644
3
+ --- a/node_modules/@vitejs/plugin-vue/dist/index.mjs
4
+ +++ b/node_modules/@vitejs/plugin-vue/dist/index.mjs
5
+ @@ -271,7 +271,34 @@ function isUseInlineTemplate(descriptor, options) {
6
+ const scriptIdentifier = `_sfc_main`;
7
+ function resolveScript(descriptor, options, ssr, customElement) {
8
+ if (!descriptor.script && !descriptor.scriptSetup) return null;
9
+ - const cached = getResolvedScript(descriptor, ssr);
10
+ +
11
+ +// JsView Modified >>>
12
+ +// 1. 解决style内容发生变化,不使用cache,在templete class和style同时发生变化没有被更新问题。
13
+ +// 2. 解决@import的css文件没有被更新问题。
14
+ + let cached = getResolvedScript(descriptor, ssr);
15
+ + if (cached && descriptor.filename?.endsWith('.vue') && descriptor.styles) {
16
+ + for (const style of descriptor.styles) {
17
+ + let useCache = false;
18
+ + // 检查解决style内容发生变化
19
+ + for(const cachedContent of cached.map.sourcesContent) {
20
+ + if(cachedContent.includes(style.content)) {
21
+ + useCache = true;
22
+ + break;
23
+ + }
24
+ + }
25
+ + // 检查@import的css文件。
26
+ + if (style.content?.includes('@import')) {
27
+ + useCache = false;
28
+ + }
29
+ +
30
+ + if(useCache == false) {
31
+ + cached = null;
32
+ + break;
33
+ + }
34
+ + }
35
+ + }
36
+ +// JsView Modified <<<
37
+ +
38
+ if (cached) return cached;
39
+ const resolved = options.compiler.compileScript(descriptor, {
40
+ ...options.script,
41
+ @@ -1181,6 +1208,13 @@ async function handleHotUpdate({ file, modules, read }, options, customElement,
42
+ }
43
+ }
44
+ if (prevStyles.length > nextStyles.length) affectedModules.add(mainModule);
45
+ +
46
+ +// JsView Added >>>
47
+ +// 当Style发生变化时,更新Script,同步CSS to JS
48
+ + // 貌似没有作用,已经被上面修改的一起处理了。
49
+ + // affectedModules.add(mainModule);
50
+ +// JsView Added <<<
51
+ +
52
+ const prevCustoms = prevDescriptor.customBlocks || [];
53
+ const nextCustoms = descriptor.customBlocks || [];
54
+ if (prevCustoms.length !== nextCustoms.length) affectedModules.add(mainModule);
@@ -0,0 +1,22 @@
1
+ diff --git a/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js b/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js
2
+ index dee1f5d..d173790 100644
3
+ --- a/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js
4
+ +++ b/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js
5
+ @@ -2641,6 +2641,17 @@ const resolveModifiers = (key, modifiers, context, loc) => {
6
+ // e.g. .passive & .capture
7
+ eventOptionModifiers.push(modifier);
8
+ }
9
+ +// JsView Added >>>
10
+ +// 处理自定义的 addEventListener() options, 前缀为jsv
11
+ + else if(modifier.startsWith('jsv')) {
12
+ + const regex = new RegExp('[A-Z]');
13
+ + if (regex.test(modifier)) {
14
+ + console.error("JsView Error: Failed to parse event option: " + modifier + ". Please use lower-case");
15
+ + continue;
16
+ + }
17
+ + eventOptionModifiers.push(modifier);
18
+ + }
19
+ +// JsView Added <<<
20
+ else {
21
+ // runtimeModifiers: modifiers that needs runtime guards
22
+ if (maybeKeyModifier(modifier)) {
@@ -0,0 +1,22 @@
1
+ diff --git a/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js b/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js
2
+ index f62528c..67c6411 100644
3
+ --- a/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js
4
+ +++ b/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js
5
+ @@ -204,6 +204,17 @@ const resolveModifiers = (key, modifiers, context, loc) => {
6
+ const modifier = modifiers[i].content;
7
+ if (modifier === "native" && context && (0, _vue_compiler_core.checkCompatEnabled)("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
8
+ else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
9
+ +// JsView Added >>>
10
+ +// 处理自定义的 addEventListener() options, 前缀为jsv
11
+ + else if(modifier.startsWith('jsv')) {
12
+ + const regex = new RegExp('[A-Z]');
13
+ + if (regex.test(modifier)) {
14
+ + console.error("JsView Error: Failed to parse event option: " + modifier + ". Please use lower-case");
15
+ + continue;
16
+ + }
17
+ + eventOptionModifiers.push(modifier);
18
+ + }
19
+ +// JsView Added <<<
20
+ else {
21
+ const keyString = (0, _vue_shared.isString)(key) ? key : (0, _vue_compiler_core.isStaticExp)(key) ? key.content : null;
22
+ if (maybeKeyModifier(modifier)) if (keyString) if (isKeyboardEvent(keyString.toLowerCase())) keyModifiers.push(modifier);