@lynx-js/web-core-server 0.17.2 → 0.18.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/CHANGELOG.md +2 -0
- package/dist/index.js +22 -13
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -620,7 +620,7 @@ const publishEventEndpoint = createRpcEndpoint('publishEvent', false, false);
|
|
|
620
620
|
createRpcEndpoint('postOffscreenEventEndpoint', false, false);
|
|
621
621
|
const switchExposureServiceEndpoint = createRpcEndpoint('switchExposureServiceEndpoint', false, false);
|
|
622
622
|
createRpcEndpoint('mainThreadStart', false, false);
|
|
623
|
-
createRpcEndpoint('updateData', false, true);
|
|
623
|
+
const updateDataEndpoint = createRpcEndpoint('updateData', false, true);
|
|
624
624
|
createRpcEndpoint('sendGlobalEventEndpoint', false, false);
|
|
625
625
|
createRpcEndpoint('dispose', false, true);
|
|
626
626
|
const BackgroundThreadStartEndpoint = createRpcEndpoint('start', false, true);
|
|
@@ -671,17 +671,6 @@ var UpdateDataOptions_NativeUpdateDataType;
|
|
|
671
671
|
NativeUpdateDataType[NativeUpdateDataType["UPDATE"] = 0] = "UPDATE";
|
|
672
672
|
NativeUpdateDataType[NativeUpdateDataType["RESET"] = 1] = "RESET";
|
|
673
673
|
})(UpdateDataOptions_NativeUpdateDataType || (UpdateDataOptions_NativeUpdateDataType = {}));
|
|
674
|
-
var UpdateDataOptions_UpdateDataType;
|
|
675
|
-
(function(UpdateDataType) {
|
|
676
|
-
UpdateDataType[UpdateDataType["Unknown"] = 0] = "Unknown";
|
|
677
|
-
UpdateDataType[UpdateDataType["UpdateExplicitByUser"] = 1] = "UpdateExplicitByUser";
|
|
678
|
-
UpdateDataType[UpdateDataType["UpdateByKernelFromCtor"] = 2] = "UpdateByKernelFromCtor";
|
|
679
|
-
UpdateDataType[UpdateDataType["UpdateByKernelFromRender"] = 4] = "UpdateByKernelFromRender";
|
|
680
|
-
UpdateDataType[UpdateDataType["UpdateByKernelFromHydrate"] = 8] = "UpdateByKernelFromHydrate";
|
|
681
|
-
UpdateDataType[UpdateDataType["UpdateByKernelFromGetDerived"] = 16] = "UpdateByKernelFromGetDerived";
|
|
682
|
-
UpdateDataType[UpdateDataType["UpdateByKernelFromConflict"] = 32] = "UpdateByKernelFromConflict";
|
|
683
|
-
UpdateDataType[UpdateDataType["UpdateByKernelFromHMR"] = 64] = "UpdateByKernelFromHMR";
|
|
684
|
-
})(UpdateDataOptions_UpdateDataType || (UpdateDataOptions_UpdateDataType = {}));
|
|
685
674
|
const DispatchEventResult = {
|
|
686
675
|
NotCanceled: 0,
|
|
687
676
|
CanceledByEventHandler: 1,
|
|
@@ -1294,6 +1283,18 @@ function createCrossThreadEvent(domEvent, eventName) {
|
|
|
1294
1283
|
targetTouches: isTrusted ? targetTouches.map(toCloneableObject) : targetTouches,
|
|
1295
1284
|
changedTouches: isTrusted ? changedTouches.map(toCloneableObject) : changedTouches
|
|
1296
1285
|
});
|
|
1286
|
+
} else if (type.startsWith('mouse')) {
|
|
1287
|
+
const mouseEvent = domEvent;
|
|
1288
|
+
Object.assign(otherProperties, {
|
|
1289
|
+
button: mouseEvent.button,
|
|
1290
|
+
buttons: mouseEvent.buttons,
|
|
1291
|
+
x: mouseEvent.x,
|
|
1292
|
+
y: mouseEvent.y,
|
|
1293
|
+
pageX: mouseEvent.pageX,
|
|
1294
|
+
pageY: mouseEvent.pageY,
|
|
1295
|
+
clientX: mouseEvent.clientX,
|
|
1296
|
+
clientY: mouseEvent.clientY
|
|
1297
|
+
});
|
|
1297
1298
|
}
|
|
1298
1299
|
const currentTargetDatasetString = currentTargetElement?.getAttribute(lynxDatasetAttribute);
|
|
1299
1300
|
const currentTargetDataset = currentTargetDatasetString ? JSON.parse(decodeURIComponent(currentTargetDatasetString)) : {};
|
|
@@ -2003,6 +2004,7 @@ function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealm,
|
|
|
2003
2004
|
const publicComponentEvent = backgroundThreadRpc.createCall(publicComponentEventEndpoint);
|
|
2004
2005
|
const postExposure = backgroundThreadRpc.createCall(postExposureEndpoint);
|
|
2005
2006
|
const dispatchI18nResource = backgroundThreadRpc.createCall(dispatchI18nResourceEndpoint);
|
|
2007
|
+
const updateDataBackground = backgroundThreadRpc.createCall(updateDataEndpoint);
|
|
2006
2008
|
markTimingInternal('lepus_execute_start');
|
|
2007
2009
|
async function startMainThread(config, ssrHydrateInfo) {
|
|
2008
2010
|
let isFp = true;
|
|
@@ -2113,8 +2115,15 @@ function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealm,
|
|
|
2113
2115
|
await mtsRealm.loadScript(template.lepusCode.root);
|
|
2114
2116
|
jsContext.__start();
|
|
2115
2117
|
}
|
|
2118
|
+
function handleUpdatedData(newData, options) {
|
|
2119
|
+
const runtime = mtsRealm.globalWindow;
|
|
2120
|
+
const processedData = runtime.processData ? runtime.processData(newData, options?.processorName) : newData;
|
|
2121
|
+
runtime.updatePage?.(processedData, options);
|
|
2122
|
+
return updateDataBackground(processedData, options);
|
|
2123
|
+
}
|
|
2116
2124
|
return {
|
|
2117
|
-
startMainThread
|
|
2125
|
+
startMainThread,
|
|
2126
|
+
handleUpdatedData
|
|
2118
2127
|
};
|
|
2119
2128
|
}
|
|
2120
2129
|
const templateCache = new Map();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-core-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"rsbuild-plugin-arethetypeswrong": "0.1.1",
|
|
27
27
|
"rsbuild-plugin-publint": "0.3.3",
|
|
28
28
|
"@lynx-js/offscreen-document": "0.1.4",
|
|
29
|
-
"@lynx-js/web-constants": "0.
|
|
30
|
-
"@lynx-js/web-elements-template": "0.8.
|
|
31
|
-
"@lynx-js/web-mainthread-apis": "0.
|
|
32
|
-
"@lynx-js/web-worker-rpc": "0.
|
|
29
|
+
"@lynx-js/web-constants": "0.18.0",
|
|
30
|
+
"@lynx-js/web-elements-template": "0.8.8",
|
|
31
|
+
"@lynx-js/web-mainthread-apis": "0.18.0",
|
|
32
|
+
"@lynx-js/web-worker-rpc": "0.18.0"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "rslib build",
|