@lynx-js/web-mainthread-apis-canary 0.19.5-canary-20260111-9646114b → 0.19.6-canary-20260112-6c2b51a6
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 +11 -2
- package/dist/createMainThreadGlobalThis.js +38 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
# @lynx-js/web-mainthread-apis
|
|
2
2
|
|
|
3
|
-
## 0.19.
|
|
3
|
+
## 0.19.6-canary-20260112091442-6c2b51a661ae244eb40671f63f29ee971e084ed4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat: support main thread invoke ui method ([#2104](https://github.com/lynx-family/lynx-stack/pull/2104))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`6c2b51a`](https://github.com/lynx-family/lynx-stack/commit/6c2b51a661ae244eb40671f63f29ee971e084ed4)]:
|
|
10
|
+
- @lynx-js/web-constants@0.19.6-canary-20260112091442-6c2b51a661ae244eb40671f63f29ee971e084ed4
|
|
11
|
+
|
|
12
|
+
## 0.19.5
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
6
15
|
|
|
7
16
|
- Updated dependencies []:
|
|
8
|
-
- @lynx-js/web-constants@0.19.5
|
|
17
|
+
- @lynx-js/web-constants@0.19.5
|
|
9
18
|
|
|
10
19
|
## 0.19.4
|
|
11
20
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2023 The Lynx Authors. All rights reserved.
|
|
2
2
|
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
3
|
// LICENSE file in the root directory of this source tree.
|
|
4
|
-
import { lynxUniqueIdAttribute, systemInfo, parentComponentUniqueIdAttribute, componentIdAttribute, LynxEventNameToW3cByTagName, LynxEventNameToW3cCommon, lynxTagAttribute, W3cEventNameToLynx, cssIdAttribute, lynxDefaultDisplayLinearAttribute, __lynx_timing_flag, lynxDisposedAttribute, lynxEntryNameAttribute, } from '@lynx-js/web-constants';
|
|
4
|
+
import { lynxUniqueIdAttribute, systemInfo, parentComponentUniqueIdAttribute, componentIdAttribute, LynxEventNameToW3cByTagName, LynxEventNameToW3cCommon, lynxTagAttribute, W3cEventNameToLynx, cssIdAttribute, lynxDefaultDisplayLinearAttribute, __lynx_timing_flag, lynxDisposedAttribute, lynxEntryNameAttribute, ErrorCode, } from '@lynx-js/web-constants';
|
|
5
5
|
import { createMainThreadLynx } from './createMainThreadLynx.js';
|
|
6
6
|
import { __AddClass, __AddConfig, __AddDataset, __AddInlineStyle, __AppendElement, __ElementIsEqual, __FirstElement, __GetAttributes, __GetChildren, __GetClasses, __GetComponentID, __GetDataByKey, __GetDataset, __GetElementConfig, __GetElementUniqueID, __GetID, __GetParent, __GetTag, __GetTemplateParts, __InsertElementBefore, __LastElement, __MarkPartElement, __MarkTemplateElement, __NextElement, __RemoveElement, __ReplaceElement, __ReplaceElements, __SetClasses, __SetConfig, __SetCSSId, __SetDataset, __SetID, __SetInlineStyles, __UpdateComponentID, __UpdateComponentInfo, __GetAttributeByName, } from './pureElementPAPIs.js';
|
|
7
7
|
import { createCrossThreadEvent } from './utils/createCrossThreadEvent.js';
|
|
@@ -501,6 +501,43 @@ export function createMainThreadGlobalThis(config) {
|
|
|
501
501
|
_I18nResourceTranslation: callbacks._I18nResourceTranslation,
|
|
502
502
|
_AddEventListener: () => { },
|
|
503
503
|
renderPage: undefined,
|
|
504
|
+
__InvokeUIMethod: (element, method, params, callback) => {
|
|
505
|
+
try {
|
|
506
|
+
if (method === 'boundingClientRect') {
|
|
507
|
+
const rect = element.getBoundingClientRect();
|
|
508
|
+
callback({
|
|
509
|
+
code: ErrorCode.SUCCESS,
|
|
510
|
+
data: {
|
|
511
|
+
id: element.id,
|
|
512
|
+
width: rect.width,
|
|
513
|
+
height: rect.height,
|
|
514
|
+
left: rect.left,
|
|
515
|
+
right: rect.right,
|
|
516
|
+
top: rect.top,
|
|
517
|
+
bottom: rect.bottom,
|
|
518
|
+
},
|
|
519
|
+
});
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
if (typeof element[method] === 'function') {
|
|
523
|
+
const data = element[method](params);
|
|
524
|
+
callback({
|
|
525
|
+
code: ErrorCode.SUCCESS,
|
|
526
|
+
data,
|
|
527
|
+
});
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
callback({
|
|
531
|
+
code: ErrorCode.METHOD_NOT_FOUND,
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
catch (e) {
|
|
535
|
+
console.error(`[lynx-web] invokeUIMethod: apply method failed with`, e, element);
|
|
536
|
+
callback({
|
|
537
|
+
code: ErrorCode.PARAM_INVALID,
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
},
|
|
504
541
|
};
|
|
505
542
|
Object.assign(mtsRealm.globalWindow, mtsGlobalThis);
|
|
506
543
|
Object.defineProperty(mtsRealm.globalWindow, 'renderPage', {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-mainthread-apis-canary",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.6-canary-20260112-6c2b51a6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"**/*.css"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.19.
|
|
29
|
+
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.19.6-canary-20260112-6c2b51a6",
|
|
30
30
|
"hyphenate-style-name": "^1.1.0",
|
|
31
31
|
"wasm-feature-detect": "^1.8.0"
|
|
32
32
|
},
|