@macle-community/simulator-web 0.0.0-stage → 1.0.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/README.md +125 -2
- package/bin/macle-web-simulator.js +108 -0
- package/package.json +37 -4
- package/runtime/framework/service/service.js +1 -0
- package/runtime/framework/view/view.js +1 -0
- package/runtime/remoteDebug/adapter.js +1 -0
- package/runtime/remoteDebug/service.html +16 -0
- package/runtime/remoteDebug/sub-packages.js +1 -0
- package/runtime/simulator/config/config.json +40 -0
- package/runtime/simulator/css/common.css +945 -0
- package/runtime/simulator/index.html +95 -0
- package/runtime/simulator/mockApi.json +1 -0
- package/runtime/simulator/native/native.js +1 -0
- package/runtime/simulator/public/default-user-avatar@128w.jpg +0 -0
- package/runtime/simulator/service/app.js +1 -0
- package/runtime/simulator/service/service.html +14 -0
- package/runtime/simulator/service/sync-api.js +1 -0
- package/runtime/simulator/version.json +1 -0
- package/runtime/simulator/view/webview.js +1 -0
- package/src/compiler.js +117 -0
- package/src/mock-backend.js +225 -0
- package/src/project-parser.js +87 -0
- package/src/server.js +334 -0
- package/src/watcher.js +76 -0
- package/web/index.html +234 -0
- package/web/qrcode.js +1145 -0
- package/web/simulator.css +526 -0
- package/web/simulator.js +510 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! date: Wed Sep 30 2026, package version: 26.6.0-LG0001 */(()=>{let e;const t=[],o="MACLE_CUSTOM_LOG",n="MACLE_ERROR_LOG",s="notifyViewLayer",a="invoke",i="notifyNative",r="onNativeNotify",c="onNotify",p="syncApi";function y(e){if(!e||"string"!=typeof e)return{};try{return JSON.parse(e)}catch(e){return{}}}const g=e=>{const o=JSON.stringify(e);1===m.readyState?m.send(o):t.push(o)},l=(e,t)=>{logicLayer.notifyNative(e,t)};(()=>{const t=window.location.search.substring(1).split("&");for(let o=0;o<t.length;o++)if("server"===t[o].split("=")[0]){e=t[o].split("=")[1];break}})();const m=new WebSocket("ws://".concat(e,"/logic"));m.onopen=()=>{t&&t.forEach((e=>{m.send(e)}))},window.global={webkit:{messageHandlers:{notifyViewLayer:{postMessage(e){const t=JSON.parse(e.paramsString).webviewIdList;e.targetName=t;g({type:s,params:e})}},invoke:{postMessage(e){g({type:a,params:e})}},notifyNative:{postMessage(e){g({type:i,params:e})}}}}},m.onmessage=function(e){const t=JSON.parse(e.data),o=t.type,n=t.params;o===r?logicLayer.onNativeNotify(n.event,n.viewId,y(n.params)):o===c?logicLayer.onNotify(n.event,n.viewId,y(n.params)):logicLayer.onInvokeFinished(n.callbackId,n.invokeStatusCode,y(n.outputParams))},window.prompt=t=>{const o=t&&JSON.parse(t),s={type:p,params:o},a=JSON.stringify(s),i=new XMLHttpRequest;if(i.open("POST","http://".concat(e,"/logic"),!1),i.setRequestHeader("content-type","application/json"),i.send(a),200!==i.status){const e={key:"logicEngineError",message:"同步请求失败",timestamp:Date.now()};l(n,e)}else{const e="";try{const t=JSON.parse(i.responseText);if(t.status)return t.params;e="".concat(t.eventName," 调用失败")}catch(t){e="".concat(o.command," ").concat(t)}const t={key:"logicEngineError",message:e,timestamp:Date.now()};l(n,t)}},m.onerror=function(e){const t={key:"logicEngineError",message:"WebSocket error: ".concat(e),timestamp:Date.now()};l(n,t)},m.onclose=function(e){const t={level:"log",log:"WebSocket closed with code: ".concat(e.code),timestamp:Date.now()};l(o,t)}})();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
5
|
+
</head>
|
|
6
|
+
|
|
7
|
+
<body>
|
|
8
|
+
<script type="text/javascript" src="./adapter.js"></script>
|
|
9
|
+
<script src="../framework/service/service.js" type="text/javascript"></script>
|
|
10
|
+
<script src="../app/app-service.js" type="text/javascript"></script>
|
|
11
|
+
<script src="./sub-packages.js" type="text/javascript"></script>
|
|
12
|
+
<script>
|
|
13
|
+
logicLayer.notifyNative(window.Enums.SERVICE_READY);
|
|
14
|
+
</script>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! date: Wed Sep 30 2026, package version: 26.6.0-LG0001 */(()=>{const e=window.__maAppCode__["app.json"].subPackages,a=[];if(e){for(let t=0;t<e.length;t++){const p=e[t].root,c="../app/".concat(p,"app-service.js"),o=document.createElement("script");o.type="text/javascript",o.language="javascript",o.src=c,a.push(o)}a.forEach((e=>{document.getElementsByTagName("body")[0].appendChild(e)}))}})();
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"api": {
|
|
3
|
+
"getLocation": {
|
|
4
|
+
"verticalAccuracy": 10,
|
|
5
|
+
"speed": -1,
|
|
6
|
+
"longitude": 118.76191309804084,
|
|
7
|
+
"horizontalAccuracy": 65,
|
|
8
|
+
"latitude": 31.982052781804494,
|
|
9
|
+
"accuracy": 65,
|
|
10
|
+
"altitude": 59.177478790283203
|
|
11
|
+
},
|
|
12
|
+
"getSystemInfo": {
|
|
13
|
+
"brand": "devtool",
|
|
14
|
+
"system": "devtool 22.6.0",
|
|
15
|
+
"model": "iphone 6/7/8",
|
|
16
|
+
"pixelRatio": "2",
|
|
17
|
+
"screenHeight": 667,
|
|
18
|
+
"screenWidth": 375,
|
|
19
|
+
"statusBarHeight": 20,
|
|
20
|
+
"windowHeight": 667,
|
|
21
|
+
"windowWidth": 375,
|
|
22
|
+
"language": "en-US"
|
|
23
|
+
},
|
|
24
|
+
"getSystemSetting": {
|
|
25
|
+
"bluetoothEnabled": true,
|
|
26
|
+
"locationEnabled": true,
|
|
27
|
+
"wifiEnabled": true,
|
|
28
|
+
"deviceOrientation": "portrait"
|
|
29
|
+
},
|
|
30
|
+
"getKbzBackendServerUrl": ""
|
|
31
|
+
},
|
|
32
|
+
"thirdPartyAuth": {},
|
|
33
|
+
"cache": {
|
|
34
|
+
"permission": {}
|
|
35
|
+
},
|
|
36
|
+
"axios": {
|
|
37
|
+
"baseUrl": "/mcss/simulate"
|
|
38
|
+
},
|
|
39
|
+
"statusBar": false
|
|
40
|
+
}
|