@lynx-js/web-core-canary 0.15.5-canary-20250807-ead12c97 → 0.15.5-canary-20250808-ed2ddcc3
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @lynx-js/web-core
|
|
2
2
|
|
|
3
|
-
## 0.15.5-canary-
|
|
3
|
+
## 0.15.5-canary-20250808031952-ed2ddcc34fc404ffebb895eb3c928a2fd8dd7959
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
@@ -8,14 +8,22 @@
|
|
|
8
8
|
|
|
9
9
|
See [nodejs/node#59362](https://github.com/nodejs/node/issues/59362) for more details.
|
|
10
10
|
|
|
11
|
+
- feat: support path() for `createQuerySelector` ([#1456](https://github.com/lynx-family/lynx-stack/pull/1456))
|
|
12
|
+
|
|
13
|
+
- Added `getPathInfo` API to `NativeApp` and its cross-thread handler for retrieving the path from a DOM node to the root.
|
|
14
|
+
- Implemented endpoint and handler registration in both background and UI threads.
|
|
15
|
+
- Implemented `nativeApp.getPathInfo()`
|
|
16
|
+
|
|
11
17
|
- fix: when `onNativeModulesCall` is delayed in mounting, the NativeModules execution result may be undefined. ([#1457](https://github.com/lynx-family/lynx-stack/pull/1457))
|
|
12
18
|
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- @lynx-js/web-
|
|
17
|
-
- @lynx-js/web-
|
|
18
|
-
- @lynx-js/web-worker-
|
|
19
|
+
- fix: `onNativeModulesCall` && `onNapiModulesCall` use getter to get. ([#1466](https://github.com/lynx-family/lynx-stack/pull/1466))
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [[`29434ae`](https://github.com/lynx-family/lynx-stack/commit/29434aec853f14242f521316429cf07a93b8c371), [`fb7096b`](https://github.com/lynx-family/lynx-stack/commit/fb7096bb3c79166cd619a407095b8206eccb7918), [`ca8dc3c`](https://github.com/lynx-family/lynx-stack/commit/ca8dc3c87cc88846c0c431551c22302d94470b9e)]:
|
|
22
|
+
- @lynx-js/web-mainthread-apis@0.15.5-canary-20250808031952-ed2ddcc34fc404ffebb895eb3c928a2fd8dd7959
|
|
23
|
+
- @lynx-js/web-constants@0.15.5-canary-20250808031952-ed2ddcc34fc404ffebb895eb3c928a2fd8dd7959
|
|
24
|
+
- @lynx-js/web-worker-runtime@0.15.5-canary-20250808031952-ed2ddcc34fc404ffebb895eb3c928a2fd8dd7959
|
|
25
|
+
- @lynx-js/web-elements@0.8.4-canary-20250808031952-ed2ddcc34fc404ffebb895eb3c928a2fd8dd7959
|
|
26
|
+
- @lynx-js/web-worker-rpc@0.15.5-canary-20250808031952-ed2ddcc34fc404ffebb895eb3c928a2fd8dd7959
|
|
19
27
|
|
|
20
28
|
## 0.15.4
|
|
21
29
|
|
package/dist/apis/LynxView.js
CHANGED
|
@@ -373,8 +373,8 @@ export class LynxView extends HTMLElement {
|
|
|
373
373
|
initI18nResources: this.#initI18nResources,
|
|
374
374
|
callbacks: {
|
|
375
375
|
nativeModulesCall: (...args) => {
|
|
376
|
-
if (this
|
|
377
|
-
return this
|
|
376
|
+
if (this.onNativeModulesCall) {
|
|
377
|
+
return this.onNativeModulesCall(...args);
|
|
378
378
|
}
|
|
379
379
|
else {
|
|
380
380
|
return new Promise(resolve => {
|
|
@@ -383,7 +383,7 @@ export class LynxView extends HTMLElement {
|
|
|
383
383
|
}
|
|
384
384
|
},
|
|
385
385
|
napiModulesCall: (...args) => {
|
|
386
|
-
return this
|
|
386
|
+
return this.onNapiModulesCall?.(...args);
|
|
387
387
|
},
|
|
388
388
|
onError: (error, release, fileName) => {
|
|
389
389
|
this.dispatchEvent(new CustomEvent('error', {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Copyright 2023 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
import { Rpc } from '@lynx-js/web-worker-rpc';
|
|
5
|
+
import { ErrorCode, getPathInfoEndpoint, lynxDatasetAttribute, lynxTagAttribute, } from '@lynx-js/web-constants';
|
|
6
|
+
import { queryNodes } from './queryNodes.js';
|
|
7
|
+
export function registerGetPathInfoHandler(rpc, shadowRoot) {
|
|
8
|
+
rpc.registerHandler(getPathInfoEndpoint, (type, identifier, component_id, first_only, root_unique_id) => {
|
|
9
|
+
let code = ErrorCode.UNKNOWN;
|
|
10
|
+
let data;
|
|
11
|
+
queryNodes(shadowRoot, type, identifier, component_id, first_only, root_unique_id, (element) => {
|
|
12
|
+
try {
|
|
13
|
+
const path = [];
|
|
14
|
+
let currentNode = element;
|
|
15
|
+
while (currentNode) {
|
|
16
|
+
const parent = currentNode.parentElement;
|
|
17
|
+
const parentNodeForChildren = parent ?? shadowRoot;
|
|
18
|
+
const children = Array.from(parentNodeForChildren.children);
|
|
19
|
+
const tag = currentNode.getAttribute(lynxTagAttribute);
|
|
20
|
+
const index = tag === 'page' ? 0 : children.indexOf(currentNode);
|
|
21
|
+
const id = currentNode.getAttribute('id') || undefined;
|
|
22
|
+
const className = currentNode.getAttribute('class') || undefined;
|
|
23
|
+
const datasetString = currentNode.getAttribute(lynxDatasetAttribute);
|
|
24
|
+
const dataSet = datasetString
|
|
25
|
+
? JSON.parse(decodeURIComponent(datasetString))
|
|
26
|
+
: undefined;
|
|
27
|
+
path.push({
|
|
28
|
+
tag,
|
|
29
|
+
id,
|
|
30
|
+
class: className,
|
|
31
|
+
dataSet,
|
|
32
|
+
index,
|
|
33
|
+
});
|
|
34
|
+
if (tag === 'page' || currentNode.parentNode === shadowRoot) {
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
currentNode = parent;
|
|
38
|
+
}
|
|
39
|
+
data = { path };
|
|
40
|
+
code = ErrorCode.SUCCESS;
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
console.error('[lynx-web] getPathInfo: failed with', e, element);
|
|
44
|
+
code = ErrorCode.UNKNOWN;
|
|
45
|
+
}
|
|
46
|
+
}, (error) => {
|
|
47
|
+
code = error;
|
|
48
|
+
});
|
|
49
|
+
return { code, data };
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=registerGetPathInfoHandler.js.map
|
|
@@ -8,6 +8,7 @@ import { registerNapiModulesCallHandler } from './crossThreadHandlers/registerNa
|
|
|
8
8
|
import { registerDispatchLynxViewEventHandler } from './crossThreadHandlers/registerDispatchLynxViewEventHandler.js';
|
|
9
9
|
import { registerTriggerElementMethodEndpointHandler } from './crossThreadHandlers/registerTriggerElementMethodEndpointHandler.js';
|
|
10
10
|
import { registerReportErrorHandler } from './crossThreadHandlers/registerReportErrorHandler.js';
|
|
11
|
+
import { registerGetPathInfoHandler } from './crossThreadHandlers/registerGetPathInfoHandler.js';
|
|
11
12
|
export function startBackground(backgroundRpc, shadowRoot, callbacks) {
|
|
12
13
|
registerInvokeUIMethodHandler(backgroundRpc, shadowRoot);
|
|
13
14
|
registerNativePropsHandler(backgroundRpc, shadowRoot);
|
|
@@ -15,6 +16,7 @@ export function startBackground(backgroundRpc, shadowRoot, callbacks) {
|
|
|
15
16
|
registerSelectComponentHandler(backgroundRpc, shadowRoot);
|
|
16
17
|
registerNativeModulesCallHandler(backgroundRpc, callbacks.nativeModulesCall);
|
|
17
18
|
registerNapiModulesCallHandler(backgroundRpc, callbacks.napiModulesCall);
|
|
19
|
+
registerGetPathInfoHandler(backgroundRpc, shadowRoot);
|
|
18
20
|
registerDispatchLynxViewEventHandler(backgroundRpc, shadowRoot);
|
|
19
21
|
registerTriggerElementMethodEndpointHandler(backgroundRpc, shadowRoot);
|
|
20
22
|
registerReportErrorHandler(backgroundRpc, 'app-service.js', callbacks.onError);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-core-canary",
|
|
3
|
-
"version": "0.15.5-canary-
|
|
3
|
+
"version": "0.15.5-canary-20250808-ed2ddcc3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@lynx-js/offscreen-document": "npm:@lynx-js/offscreen-document-canary@0.1.3",
|
|
28
|
-
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.15.5-canary-
|
|
29
|
-
"@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.15.5-canary-
|
|
30
|
-
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.15.5-canary-
|
|
31
|
-
"@lynx-js/web-worker-runtime": "npm:@lynx-js/web-worker-runtime-canary@0.15.5-canary-
|
|
28
|
+
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.15.5-canary-20250808-ed2ddcc3",
|
|
29
|
+
"@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.15.5-canary-20250808-ed2ddcc3",
|
|
30
|
+
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.15.5-canary-20250808-ed2ddcc3",
|
|
31
|
+
"@lynx-js/web-worker-runtime": "npm:@lynx-js/web-worker-runtime-canary@0.15.5-canary-20250808-ed2ddcc3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@lynx-js/lynx-core": "0.1.2",
|
|
35
|
-
"@lynx-js/web-elements": "npm:@lynx-js/web-elements-canary@0.8.4-canary-
|
|
35
|
+
"@lynx-js/web-elements": "npm:@lynx-js/web-elements-canary@0.8.4-canary-20250808-ed2ddcc3"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@lynx-js/lynx-core": "0.1.2",
|