@lynx-js/web-core-canary 0.17.2-canary-20251001-734ff75a → 0.18.0-canary-20251010-77397fd5
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 +29 -6
- package/dist/apis/LynxView.d.ts +3 -3
- package/dist/apis/LynxView.js +3 -3
- package/dist/apis/createLynxView.d.ts +2 -2
- package/dist/uiThread/createRenderAllOnUI.d.ts +1 -1
- package/dist/uiThread/createRenderAllOnUI.js +7 -7
- package/dist/uiThread/createRenderMultiThread.d.ts +1 -1
- package/dist/uiThread/crossThreadHandlers/createUpdateData.d.ts +1 -1
- package/dist/uiThread/crossThreadHandlers/createUpdateData.js +4 -8
- package/dist/uiThread/startBackground.d.ts +0 -1
- package/dist/uiThread/startBackground.js +1 -3
- package/dist/uiThread/startUIThread.js +2 -2
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
# @lynx-js/web-core
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.18.0-canary-20251010092201-77397fd535cf60556f8f82f7ef8dae8a623d1625
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fix: ([#1837](https://github.com/lynx-family/lynx-stack/pull/1837))
|
|
8
|
+
|
|
9
|
+
1. `LynxView.updateData()` cannot trigger `dataProcessor`.
|
|
10
|
+
|
|
11
|
+
2. **This is a break change:** The second parameter of `LynxView.updateData()` has been changed from `UpdateDataType` to `string`, which is the `processorName` (default is `default` which will use `defaultDataProcessor`). This change is to better align with Native. The current complete type is as follows:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
LynxView.updateData(data: Cloneable, processorName?: string | undefined, callback?: (() => void) | undefined): void
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`77397fd`](https://github.com/lynx-family/lynx-stack/commit/77397fd535cf60556f8f82f7ef8dae8a623d1625)]:
|
|
20
|
+
- @lynx-js/web-worker-runtime@0.18.0-canary-20251010092201-77397fd535cf60556f8f82f7ef8dae8a623d1625
|
|
21
|
+
- @lynx-js/web-constants@0.18.0-canary-20251010092201-77397fd535cf60556f8f82f7ef8dae8a623d1625
|
|
22
|
+
- @lynx-js/web-elements@0.8.8-canary-20251010092201-77397fd535cf60556f8f82f7ef8dae8a623d1625
|
|
23
|
+
- @lynx-js/web-mainthread-apis@0.18.0-canary-20251010092201-77397fd535cf60556f8f82f7ef8dae8a623d1625
|
|
24
|
+
- @lynx-js/web-worker-rpc@0.18.0-canary-20251010092201-77397fd535cf60556f8f82f7ef8dae8a623d1625
|
|
25
|
+
|
|
26
|
+
## 0.17.2
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
6
29
|
|
|
@@ -12,10 +35,10 @@
|
|
|
12
35
|
- support to add a breakpoint in chrome after reloading the web page
|
|
13
36
|
|
|
14
37
|
- Updated dependencies [[`a35a245`](https://github.com/lynx-family/lynx-stack/commit/a35a2452e5355bda3c475f9a750a86085e0cf56a)]:
|
|
15
|
-
- @lynx-js/web-worker-runtime@0.17.2
|
|
16
|
-
- @lynx-js/web-constants@0.17.2
|
|
17
|
-
- @lynx-js/web-mainthread-apis@0.17.2
|
|
18
|
-
- @lynx-js/web-worker-rpc@0.17.2
|
|
38
|
+
- @lynx-js/web-worker-runtime@0.17.2
|
|
39
|
+
- @lynx-js/web-constants@0.17.2
|
|
40
|
+
- @lynx-js/web-mainthread-apis@0.17.2
|
|
41
|
+
- @lynx-js/web-worker-rpc@0.17.2
|
|
19
42
|
|
|
20
43
|
## 0.17.1
|
|
21
44
|
|
|
@@ -1424,7 +1447,7 @@
|
|
|
1424
1447
|
```
|
|
1425
1448
|
* @param {string} url [required] The url of the entry of your Lynx card
|
|
1426
1449
|
* @param {Cloneable} globalProps [optional] The globalProps value of this Lynx card
|
|
1427
|
-
* @param {Cloneable} initData [
|
|
1450
|
+
* @param {Cloneable} initData [optional] The initial data of this Lynx card
|
|
1428
1451
|
* @param {Record<string,string>} overrideLynxTagToHTMLTagMap [optional] use this property/attribute to override the lynx tag -> html tag map
|
|
1429
1452
|
* @param {NativeModulesCallHandler} onNativeModulesCall [optional] the NativeModules.bridge.call value handler. Arguments will be cached before this property is assigned.
|
|
1430
1453
|
*
|
package/dist/apis/LynxView.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Cloneable, type I18nResourceTranslationOptions, type InitI18nResources, type LynxTemplate, type NapiModulesCall, type NapiModulesMap, type NativeModulesCall, type NativeModulesMap
|
|
1
|
+
import { type Cloneable, type I18nResourceTranslationOptions, type InitI18nResources, type LynxTemplate, type NapiModulesCall, type NapiModulesMap, type NativeModulesCall, type NativeModulesMap } from '@lynx-js/web-constants';
|
|
2
2
|
export type INapiModulesCall = (name: string, data: any, moduleName: string, lynxView: LynxView, dispatchNapiModules: (data: Cloneable) => void) => Promise<{
|
|
3
3
|
data: unknown;
|
|
4
4
|
transfer?: Transferable[];
|
|
@@ -12,7 +12,7 @@ export type INapiModulesCall = (name: string, data: any, moduleName: string, lyn
|
|
|
12
12
|
/**
|
|
13
13
|
* @property {string} url [required] (attribute: "url") The url of the entry of your Lynx card
|
|
14
14
|
* @property {Cloneable} globalProps [optional] (attribute: "global-props") The globalProps value of this Lynx card
|
|
15
|
-
* @property {Cloneable} initData [
|
|
15
|
+
* @property {Cloneable} initData [optional] (attribute: "init-data") The initial data of this Lynx card
|
|
16
16
|
* @property {Record<string,string>} overrideLynxTagToHTMLTagMap [optional] use this property/attribute to override the lynx tag -> html tag map
|
|
17
17
|
* @property {NativeModulesMap} nativeModulesMap [optional] use to customize NativeModules. key is module-name, value is esm url.
|
|
18
18
|
* @property {NativeModulesCall} onNativeModulesCall [optional] the NativeModules value handler. Arguments will be cached before this property is assigned.
|
|
@@ -132,7 +132,7 @@ export declare class LynxView extends HTMLElement {
|
|
|
132
132
|
* @method
|
|
133
133
|
* update the `__initData` and trigger essential flow
|
|
134
134
|
*/
|
|
135
|
-
updateData(data: Cloneable,
|
|
135
|
+
updateData(data: Cloneable, processorName?: string, callback?: () => void): void;
|
|
136
136
|
/**
|
|
137
137
|
* @public
|
|
138
138
|
* @method
|
package/dist/apis/LynxView.js
CHANGED
|
@@ -9,7 +9,7 @@ import { inShadowRootStyles, lynxDisposedAttribute, lynxTagAttribute, } from '@l
|
|
|
9
9
|
/**
|
|
10
10
|
* @property {string} url [required] (attribute: "url") The url of the entry of your Lynx card
|
|
11
11
|
* @property {Cloneable} globalProps [optional] (attribute: "global-props") The globalProps value of this Lynx card
|
|
12
|
-
* @property {Cloneable} initData [
|
|
12
|
+
* @property {Cloneable} initData [optional] (attribute: "init-data") The initial data of this Lynx card
|
|
13
13
|
* @property {Record<string,string>} overrideLynxTagToHTMLTagMap [optional] use this property/attribute to override the lynx tag -> html tag map
|
|
14
14
|
* @property {NativeModulesMap} nativeModulesMap [optional] use to customize NativeModules. key is module-name, value is esm url.
|
|
15
15
|
* @property {NativeModulesCall} onNativeModulesCall [optional] the NativeModules value handler. Arguments will be cached before this property is assigned.
|
|
@@ -220,8 +220,8 @@ export class LynxView extends HTMLElement {
|
|
|
220
220
|
* @method
|
|
221
221
|
* update the `__initData` and trigger essential flow
|
|
222
222
|
*/
|
|
223
|
-
updateData(data,
|
|
224
|
-
this.#instance?.updateData(data,
|
|
223
|
+
updateData(data, processorName, callback) {
|
|
224
|
+
this.#instance?.updateData(data, processorName, callback);
|
|
225
225
|
}
|
|
226
226
|
/**
|
|
227
227
|
* @public
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Cloneable, SSRDumpInfo, I18nResourceTranslationOptions, InitI18nResources, NapiModulesMap, NativeModulesMap, sendGlobalEventEndpoint
|
|
1
|
+
import type { Cloneable, SSRDumpInfo, I18nResourceTranslationOptions, InitI18nResources, NapiModulesMap, NativeModulesMap, sendGlobalEventEndpoint } from '@lynx-js/web-constants';
|
|
2
2
|
import { type StartUIThreadCallbacks } from '../uiThread/startUIThread.js';
|
|
3
3
|
import type { RpcCallType } from '@lynx-js/web-worker-rpc';
|
|
4
4
|
export interface LynxViewConfigs {
|
|
@@ -16,7 +16,7 @@ export interface LynxViewConfigs {
|
|
|
16
16
|
ssr?: SSRDumpInfo;
|
|
17
17
|
}
|
|
18
18
|
export interface LynxView {
|
|
19
|
-
updateData(data: Cloneable,
|
|
19
|
+
updateData(data: Cloneable, processorName?: string, callback?: () => void): void;
|
|
20
20
|
dispose(): Promise<void>;
|
|
21
21
|
sendGlobalEvent: RpcCallType<typeof sendGlobalEventEndpoint>;
|
|
22
22
|
updateGlobalProps: (data: Cloneable) => void;
|
|
@@ -3,6 +3,6 @@ import { Rpc } from '@lynx-js/web-worker-rpc';
|
|
|
3
3
|
import type { StartUIThreadCallbacks } from './startUIThread.js';
|
|
4
4
|
export declare function createRenderAllOnUI(mainToBackgroundRpc: Rpc, shadowRoot: ShadowRoot, loadTemplate: TemplateLoader, markTimingInternal: (timingKey: string, pipelineId?: string, timeStamp?: number) => void, flushMarkTimingInternal: () => void, callbacks: StartUIThreadCallbacks, ssrDumpInfo: SSRDumpInfo | undefined): {
|
|
5
5
|
start: (configs: StartMainThreadContextConfig) => Promise<void>;
|
|
6
|
-
updateDataMainThread: (args_0: Cloneable, args_1:
|
|
6
|
+
updateDataMainThread: (args_0: Cloneable, args_1: import("@lynx-js/web-constants").UpdateDataOptions | undefined) => Promise<void>;
|
|
7
7
|
updateI18nResourcesMainThread: (data: Cloneable) => void;
|
|
8
8
|
};
|
|
@@ -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 { i18nResourceMissedEventName, I18nResources, lynxUniqueIdAttribute, } from '@lynx-js/web-constants';
|
|
4
|
+
import { updateDataEndpoint, i18nResourceMissedEventName, I18nResources, lynxUniqueIdAttribute, } from '@lynx-js/web-constants';
|
|
5
5
|
import { Rpc } from '@lynx-js/web-worker-rpc';
|
|
6
6
|
import { dispatchLynxViewEvent } from '../utils/dispatchLynxViewEvent.js';
|
|
7
7
|
import { createExposureMonitor } from './crossThreadHandlers/createExposureMonitor.js';
|
|
@@ -83,7 +83,7 @@ export function createRenderAllOnUI(mainToBackgroundRpc, shadowRoot, loadTemplat
|
|
|
83
83
|
const { exposureChangedCallback } = createExposureMonitor(shadowRoot);
|
|
84
84
|
const mtsRealm = createIFrameRealm(shadowRoot);
|
|
85
85
|
const mtsGlobalThis = mtsRealm.globalWindow;
|
|
86
|
-
const { startMainThread } = prepareMainThreadAPIs(mainToBackgroundRpc, shadowRoot, document, mtsRealm, exposureChangedCallback, markTimingInternal, flushMarkTimingInternal, (err, _, release) => {
|
|
86
|
+
const { startMainThread, handleUpdatedData } = prepareMainThreadAPIs(mainToBackgroundRpc, shadowRoot, document, mtsRealm, exposureChangedCallback, markTimingInternal, flushMarkTimingInternal, (err, _, release) => {
|
|
87
87
|
callbacks.onError?.(err, release, 'lepus.js');
|
|
88
88
|
}, triggerI18nResourceFallback, (initI18nResources) => {
|
|
89
89
|
i18nResources.setData(initI18nResources);
|
|
@@ -125,18 +125,18 @@ export function createRenderAllOnUI(mainToBackgroundRpc, shadowRoot, loadTemplat
|
|
|
125
125
|
await startMainThread(configs);
|
|
126
126
|
}
|
|
127
127
|
// Process any pending update calls that were queued while mtsGlobalThis was undefined
|
|
128
|
-
for (const
|
|
129
|
-
|
|
128
|
+
for (const [newData, options] of pendingUpdateCalls) {
|
|
129
|
+
handleUpdatedData(newData, options);
|
|
130
130
|
}
|
|
131
131
|
pendingUpdateCalls.length = 0;
|
|
132
132
|
};
|
|
133
|
-
const updateDataMainThread = async (
|
|
133
|
+
const updateDataMainThread = async (newData, options) => {
|
|
134
134
|
if (mtsGlobalThis) {
|
|
135
|
-
|
|
135
|
+
return handleUpdatedData(newData, options);
|
|
136
136
|
}
|
|
137
137
|
else {
|
|
138
138
|
// Cache the call if mtsGlobalThis is not yet initialized
|
|
139
|
-
pendingUpdateCalls.push(
|
|
139
|
+
pendingUpdateCalls.push([newData, options]);
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
142
|
const updateI18nResourcesMainThread = (data) => {
|
|
@@ -3,6 +3,6 @@ import type { Rpc } from '@lynx-js/web-worker-rpc';
|
|
|
3
3
|
import type { StartUIThreadCallbacks } from './startUIThread.js';
|
|
4
4
|
export declare function createRenderMultiThread(mainThreadRpc: Rpc, shadowRoot: ShadowRoot, loadTemplate: TemplateLoader, callbacks: StartUIThreadCallbacks): {
|
|
5
5
|
start: (args_0: import("@lynx-js/web-constants").StartMainThreadContextConfig) => void;
|
|
6
|
-
updateDataMainThread: (args_0: import("@lynx-js/web-constants").Cloneable, args_1:
|
|
6
|
+
updateDataMainThread: (args_0: import("@lynx-js/web-constants").Cloneable, args_1: import("@lynx-js/web-constants").UpdateDataOptions | undefined) => Promise<void>;
|
|
7
7
|
updateI18nResourcesMainThread: (args_0: import("@lynx-js/web-constants").Cloneable) => void;
|
|
8
8
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { RpcCallType } from '@lynx-js/web-worker-rpc';
|
|
2
2
|
import type { LynxView } from '../../apis/createLynxView.js';
|
|
3
3
|
import { updateDataEndpoint } from '@lynx-js/web-constants';
|
|
4
|
-
export declare function createUpdateData(updateDataMainThread: RpcCallType<typeof updateDataEndpoint
|
|
4
|
+
export declare function createUpdateData(updateDataMainThread: RpcCallType<typeof updateDataEndpoint>): LynxView['updateData'];
|
|
@@ -1,14 +1,10 @@
|
|
|
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 { updateDataEndpoint
|
|
5
|
-
export function createUpdateData(updateDataMainThread
|
|
6
|
-
return (data,
|
|
7
|
-
|
|
8
|
-
// There is no need to process options for now, as they have default values.
|
|
9
|
-
updateDataMainThread(data, {}),
|
|
10
|
-
updateDataBackground(data, {}),
|
|
11
|
-
]).then(() => callback?.());
|
|
4
|
+
import { updateDataEndpoint } from '@lynx-js/web-constants';
|
|
5
|
+
export function createUpdateData(updateDataMainThread) {
|
|
6
|
+
return (data, processorName, callback) => {
|
|
7
|
+
updateDataMainThread(data, { processorName }).then(() => callback?.());
|
|
12
8
|
};
|
|
13
9
|
}
|
|
14
10
|
//# sourceMappingURL=createUpdateData.js.map
|
|
@@ -4,6 +4,5 @@ import type { StartUIThreadCallbacks } from './startUIThread.js';
|
|
|
4
4
|
export declare function startBackground(backgroundRpc: Rpc, shadowRoot: ShadowRoot, callbacks: StartUIThreadCallbacks): {
|
|
5
5
|
sendGlobalEvent: (args_0: string, args_1: Cloneable[] | undefined) => void;
|
|
6
6
|
markTiming: (args_0: import("@lynx-js/web-constants").MarkTiming[]) => void;
|
|
7
|
-
updateDataBackground: (args_0: Cloneable, args_1: Record<string, string>) => Promise<void>;
|
|
8
7
|
updateI18nResourceBackground: (data: InitI18nResources, options: I18nResourceTranslationOptions) => void;
|
|
9
8
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getCacheI18nResourcesKey, markTimingEndpoint, sendGlobalEventEndpoint,
|
|
1
|
+
import { getCacheI18nResourcesKey, markTimingEndpoint, sendGlobalEventEndpoint, updateI18nResourceEndpoint, } from '@lynx-js/web-constants';
|
|
2
2
|
import { registerInvokeUIMethodHandler } from './crossThreadHandlers/registerInvokeUIMethodHandler.js';
|
|
3
3
|
import { registerNativePropsHandler } from './crossThreadHandlers/registerSetNativePropsHandler.js';
|
|
4
4
|
import { registerNativeModulesCallHandler } from './crossThreadHandlers/registerNativeModulesCallHandler.js';
|
|
@@ -22,7 +22,6 @@ export function startBackground(backgroundRpc, shadowRoot, callbacks) {
|
|
|
22
22
|
registerReportErrorHandler(backgroundRpc, 'app-service.js', callbacks.onError);
|
|
23
23
|
const sendGlobalEvent = backgroundRpc.createCall(sendGlobalEventEndpoint);
|
|
24
24
|
const markTiming = backgroundRpc.createCall(markTimingEndpoint);
|
|
25
|
-
const updateDataBackground = backgroundRpc.createCall(updateDataEndpoint);
|
|
26
25
|
const updateI18nResourceBackground = (data, options) => {
|
|
27
26
|
const matchedResources = data.find(i => getCacheI18nResourcesKey(i.options)
|
|
28
27
|
=== getCacheI18nResourcesKey(options));
|
|
@@ -33,7 +32,6 @@ export function startBackground(backgroundRpc, shadowRoot, callbacks) {
|
|
|
33
32
|
return {
|
|
34
33
|
sendGlobalEvent,
|
|
35
34
|
markTiming,
|
|
36
|
-
updateDataBackground,
|
|
37
35
|
updateI18nResourceBackground,
|
|
38
36
|
};
|
|
39
37
|
}
|
|
@@ -13,7 +13,7 @@ export function startUIThread(templateUrl, configs, shadowRoot, lynxGroupId, thr
|
|
|
13
13
|
const createLynxStartTiming = performance.now() + performance.timeOrigin;
|
|
14
14
|
const allOnUI = threadStrategy === 'all-on-ui';
|
|
15
15
|
const { mainThreadRpc, backgroundRpc, terminateWorkers, } = bootWorkers(lynxGroupId, allOnUI, configs.browserConfig);
|
|
16
|
-
const { markTiming, sendGlobalEvent,
|
|
16
|
+
const { markTiming, sendGlobalEvent, updateI18nResourceBackground, } = startBackground(backgroundRpc, shadowRoot, callbacks);
|
|
17
17
|
const cacheMarkTimings = {
|
|
18
18
|
records: [],
|
|
19
19
|
timeout: null,
|
|
@@ -43,7 +43,7 @@ export function startUIThread(templateUrl, configs, shadowRoot, lynxGroupId, thr
|
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
45
|
return {
|
|
46
|
-
updateData: createUpdateData(updateDataMainThread
|
|
46
|
+
updateData: createUpdateData(updateDataMainThread),
|
|
47
47
|
dispose: createDispose(backgroundRpc, terminateWorkers),
|
|
48
48
|
sendGlobalEvent,
|
|
49
49
|
updateGlobalProps: backgroundRpc.createCall(updateGlobalPropsEndpoint),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-core-canary",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0-canary-20251010-77397fd5",
|
|
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.4",
|
|
28
|
-
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.
|
|
29
|
-
"@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.
|
|
30
|
-
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.
|
|
31
|
-
"@lynx-js/web-worker-runtime": "npm:@lynx-js/web-worker-runtime-canary@0.
|
|
28
|
+
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.18.0-canary-20251010-77397fd5",
|
|
29
|
+
"@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.18.0-canary-20251010-77397fd5",
|
|
30
|
+
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.18.0-canary-20251010-77397fd5",
|
|
31
|
+
"@lynx-js/web-worker-runtime": "npm:@lynx-js/web-worker-runtime-canary@0.18.0-canary-20251010-77397fd5"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@lynx-js/lynx-core": "0.1.3",
|
|
35
|
-
"@lynx-js/web-elements": "npm:@lynx-js/web-elements-canary@0.8.
|
|
35
|
+
"@lynx-js/web-elements": "npm:@lynx-js/web-elements-canary@0.8.8-canary-20251010-77397fd5"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@lynx-js/lynx-core": "0.1.3",
|