@lynx-js/web-core 0.12.0 → 0.13.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 CHANGED
@@ -1,5 +1,36 @@
1
1
  # @lynx-js/web-core
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Patch Changes
6
+
7
+ - refactor: isolate SystemInfo ([#628](https://github.com/lynx-family/lynx-stack/pull/628))
8
+
9
+ Never assign `SystemInfo` on worker's self object.
10
+
11
+ - feat: support thread strategy `all-on-ui` ([#625](https://github.com/lynx-family/lynx-stack/pull/625))
12
+
13
+ ```html
14
+ <lynx-view thread-strategy="all-on-ui"></lynx-view>
15
+ ```
16
+
17
+ This will make the lynx's main-thread run on the UA's main thread.
18
+
19
+ Note that the `all-on-ui` does not support the HMR & chunk splitting yet.
20
+
21
+ - fix(web): css selector not work for selectors with combinator and pseudo-class on WEB ([#608](https://github.com/lynx-family/lynx-stack/pull/608))
22
+
23
+ like `.parent > :not([hidden]) ~ :not([hidden])`
24
+
25
+ you will need to upgrade your `react-rsbuild-plugin` to fix this issue
26
+
27
+ - Updated dependencies [[`4ee0465`](https://github.com/lynx-family/lynx-stack/commit/4ee0465f6e5846a0d038b49d2a7c95e87c9e5c77), [`74b5bd1`](https://github.com/lynx-family/lynx-stack/commit/74b5bd15339b70107a7c42525494da46e8f8f6bd), [`06bb78a`](https://github.com/lynx-family/lynx-stack/commit/06bb78a6b93d4a7be7177a6269dd4337852ce90d), [`5a3d9af`](https://github.com/lynx-family/lynx-stack/commit/5a3d9afe52ba639987db124ca35580261e0718b5), [`5269cab`](https://github.com/lynx-family/lynx-stack/commit/5269cabef7609159bdd0dd14a03c5da667907424), [`74b5bd1`](https://github.com/lynx-family/lynx-stack/commit/74b5bd15339b70107a7c42525494da46e8f8f6bd), [`2b069f8`](https://github.com/lynx-family/lynx-stack/commit/2b069f8786c95bdb9ac1f35091f05f7fd3b52225)]:
28
+ - @lynx-js/web-mainthread-apis@0.13.0
29
+ - @lynx-js/web-worker-runtime@0.13.0
30
+ - @lynx-js/web-constants@0.13.0
31
+ - @lynx-js/offscreen-document@0.0.1
32
+ - @lynx-js/web-worker-rpc@0.13.0
33
+
3
34
  ## 0.12.0
4
35
 
5
36
  ### Minor Changes
@@ -22,6 +22,7 @@ export type INapiModulesCall = (name: string, data: any, moduleName: string, lyn
22
22
  * @property {INapiModulesCall} onNapiModulesCall [optional] the NapiModule value handler.
23
23
  * @property {"false" | "true" | null} injectHeadLinks [optional] @default true set it to "false" to disable injecting the <link href="" ref="stylesheet"> styles into shadowroot
24
24
  * @property {number} lynxGroupId [optional] (attribute: "lynx-group-id") the background shared context id, which is used to share webworker between different lynx cards
25
+ * @property {"all-on-ui" | "multi-thread"} threadStrategy [optional] @default "multi-thread" (attribute: "thread-strategy") controls the thread strategy for current lynx view
25
26
  * @property {(string)=>Promise<LynxTemplate>} customTemplateLoader [optional] the custom template loader, which is used to load the template
26
27
  *
27
28
  * @event error lynx card fired an error
@@ -139,6 +140,12 @@ export declare class LynxView extends HTMLElement {
139
140
  * @private
140
141
  */
141
142
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
143
+ /**
144
+ * @param
145
+ * @property
146
+ */
147
+ get threadStrategy(): 'all-on-ui' | 'multi-thread';
148
+ set threadStrategy(val: 'all-on-ui' | 'multi-thread');
142
149
  /**
143
150
  * @private
144
151
  */
@@ -20,6 +20,7 @@ import { inShadowRootStyles } from './inShadowRootStyles.js';
20
20
  * @property {INapiModulesCall} onNapiModulesCall [optional] the NapiModule value handler.
21
21
  * @property {"false" | "true" | null} injectHeadLinks [optional] @default true set it to "false" to disable injecting the <link href="" ref="stylesheet"> styles into shadowroot
22
22
  * @property {number} lynxGroupId [optional] (attribute: "lynx-group-id") the background shared context id, which is used to share webworker between different lynx cards
23
+ * @property {"all-on-ui" | "multi-thread"} threadStrategy [optional] @default "multi-thread" (attribute: "thread-strategy") controls the thread strategy for current lynx view
23
24
  * @property {(string)=>Promise<LynxTemplate>} customTemplateLoader [optional] the custom template loader, which is used to load the template
24
25
  *
25
26
  * @event error lynx card fired an error
@@ -243,6 +244,22 @@ export class LynxView extends HTMLElement {
243
244
  }
244
245
  }
245
246
  }
247
+ /**
248
+ * @param
249
+ * @property
250
+ */
251
+ get threadStrategy() {
252
+ // @ts-expect-error
253
+ return this.getAttribute('thread-strategy');
254
+ }
255
+ set threadStrategy(val) {
256
+ if (val) {
257
+ this.setAttribute('thread-strategy', val);
258
+ }
259
+ else {
260
+ this.removeAttribute('thread-strategy');
261
+ }
262
+ }
246
263
  /**
247
264
  * @private
248
265
  */
@@ -288,7 +305,9 @@ export class LynxView extends HTMLElement {
288
305
  this.attachShadow({ mode: 'open' });
289
306
  }
290
307
  const lynxGroupId = this.lynxGroupId;
308
+ const threadStrategy = (this.threadStrategy ?? 'multi-thread');
291
309
  const lynxView = createLynxView({
310
+ threadStrategy,
292
311
  tagMap,
293
312
  shadowRoot: this.shadowRoot,
294
313
  templateUrl: this.#url,
@@ -1,16 +1,17 @@
1
1
  import type { Cloneable, NapiModulesMap, NativeModulesMap, sendGlobalEventEndpoint, UpdateDataType } from '@lynx-js/web-constants';
2
- import { startUIThread } from '../uiThread/startUIThread.js';
2
+ import { type StartUIThreadCallbacks } from '../uiThread/startUIThread.js';
3
3
  import type { RpcCallType } from '@lynx-js/web-worker-rpc';
4
4
  export interface LynxViewConfigs {
5
5
  templateUrl: string;
6
6
  initData: Cloneable;
7
7
  globalProps: Cloneable;
8
8
  shadowRoot: ShadowRoot;
9
- callbacks: Parameters<typeof startUIThread>[4];
9
+ callbacks: StartUIThreadCallbacks;
10
10
  nativeModulesMap: NativeModulesMap;
11
11
  napiModulesMap: NapiModulesMap;
12
12
  tagMap: Record<string, string>;
13
13
  lynxGroupId: number | undefined;
14
+ threadStrategy: 'all-on-ui' | 'multi-thread';
14
15
  }
15
16
  export interface LynxView {
16
17
  updateData(data: Cloneable, updateDataType: UpdateDataType, callback?: () => void): void;
@@ -1,16 +1,18 @@
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 { startUIThread } from '../uiThread/startUIThread.js';
4
+ import { startUIThread, } from '../uiThread/startUIThread.js';
5
5
  export function createLynxView(configs) {
6
- const { shadowRoot, callbacks, templateUrl, globalProps, initData, nativeModulesMap, napiModulesMap, tagMap, lynxGroupId, } = configs;
6
+ const { shadowRoot, callbacks, templateUrl, globalProps, initData, nativeModulesMap, napiModulesMap, tagMap, lynxGroupId, threadStrategy = 'multi-thread', } = configs;
7
7
  return startUIThread(templateUrl, {
8
8
  tagMap,
9
9
  initData,
10
10
  globalProps,
11
11
  nativeModulesMap,
12
12
  napiModulesMap,
13
- browserConfig: {},
14
- }, shadowRoot, lynxGroupId, callbacks);
13
+ browserConfig: {
14
+ pixelRatio: window.devicePixelRatio,
15
+ },
16
+ }, shadowRoot, lynxGroupId, threadStrategy, callbacks);
15
17
  }
16
18
  //# sourceMappingURL=createLynxView.js.map
@@ -4,5 +4,5 @@ interface LynxViewRpc {
4
4
  backgroundRpc: Rpc;
5
5
  terminateWorkers: () => void;
6
6
  }
7
- export declare function bootWorkers(lynxGroupId: number | undefined): LynxViewRpc;
7
+ export declare function bootWorkers(lynxGroupId: number | undefined, allOnUI?: boolean): LynxViewRpc;
8
8
  export {};
@@ -5,9 +5,15 @@ import { Rpc } from '@lynx-js/web-worker-rpc';
5
5
  const backgroundWorkerContextCount = [];
6
6
  const contextIdToBackgroundWorker = [];
7
7
  let preHeatedMainWorker = createMainWorker();
8
- export function bootWorkers(lynxGroupId) {
9
- const curMainWorker = preHeatedMainWorker;
10
- preHeatedMainWorker = createMainWorker();
8
+ export function bootWorkers(lynxGroupId, allOnUI) {
9
+ let curMainWorker;
10
+ if (allOnUI) {
11
+ curMainWorker = createUIChannel();
12
+ }
13
+ else {
14
+ curMainWorker = preHeatedMainWorker;
15
+ preHeatedMainWorker = createMainWorker();
16
+ }
11
17
  const curBackgroundWorker = createBackgroundWorker(lynxGroupId, curMainWorker.channelMainThreadWithBackground);
12
18
  if (lynxGroupId !== undefined) {
13
19
  if (backgroundWorkerContextCount[lynxGroupId]) {
@@ -21,7 +27,7 @@ export function bootWorkers(lynxGroupId) {
21
27
  mainThreadRpc: curMainWorker.mainThreadRpc,
22
28
  backgroundRpc: curBackgroundWorker.backgroundRpc,
23
29
  terminateWorkers: () => {
24
- curMainWorker.mainThreadWorker.terminate();
30
+ curMainWorker.mainThreadWorker?.terminate();
25
31
  if (lynxGroupId === undefined) {
26
32
  curBackgroundWorker.backgroundThreadWorker.terminate();
27
33
  }
@@ -33,6 +39,14 @@ export function bootWorkers(lynxGroupId) {
33
39
  },
34
40
  };
35
41
  }
42
+ function createUIChannel() {
43
+ const channelMainThreadWithBackground = new MessageChannel();
44
+ const mainThreadRpc = new Rpc(channelMainThreadWithBackground.port1, 'main-to-bg');
45
+ return {
46
+ mainThreadRpc,
47
+ channelMainThreadWithBackground,
48
+ };
49
+ }
36
50
  function createMainWorker() {
37
51
  const channelToMainThread = new MessageChannel();
38
52
  const channelMainThreadWithBackground = new MessageChannel();
@@ -41,7 +55,6 @@ function createMainWorker() {
41
55
  mode: 'main',
42
56
  toUIThread: channelToMainThread.port2,
43
57
  toPeerThread: channelMainThreadWithBackground.port1,
44
- pixelRatio: window.devicePixelRatio,
45
58
  };
46
59
  mainThreadWorker.postMessage(mainThreadMessage, [
47
60
  channelToMainThread.port2,
@@ -69,7 +82,6 @@ function createBackgroundWorker(lynxGroupId, channelMainThreadWithBackground) {
69
82
  mode: 'background',
70
83
  toUIThread: channelToBackground.port2,
71
84
  toPeerThread: channelMainThreadWithBackground.port2,
72
- pixelRatio: window.devicePixelRatio,
73
85
  };
74
86
  backgroundThreadWorker.postMessage(backgroundThreadMessage, [
75
87
  channelToBackground.port2,
@@ -0,0 +1,8 @@
1
+ import type { MainThreadStartConfigs } from '@lynx-js/web-constants';
2
+ import { Rpc } from '@lynx-js/web-worker-rpc';
3
+ export declare function createRenderAllOnUI(mainToBackgroundRpc: Rpc, shadowRoot: ShadowRoot, markTimingInternal: (timingKey: string, pipelineId?: string, timeStamp?: number) => void, callbacks: {
4
+ onError?: () => void;
5
+ }): {
6
+ start: (configs: MainThreadStartConfigs) => Promise<void>;
7
+ updateDataMainThread: (args_0: import("@lynx-js/web-constants").Cloneable, args_1: Record<string, string>) => Promise<void>;
8
+ };
@@ -0,0 +1,26 @@
1
+ import { Rpc } from '@lynx-js/web-worker-rpc';
2
+ const { loadMainThread, } = await import('@lynx-js/web-mainthread-apis');
3
+ export function createRenderAllOnUI(mainToBackgroundRpc, shadowRoot, markTimingInternal, callbacks) {
4
+ if (!globalThis.module) {
5
+ Object.assign(globalThis, { module: {} });
6
+ }
7
+ const docu = Object.assign(shadowRoot, {
8
+ createElement: document.createElement.bind(document),
9
+ });
10
+ const { startMainThread } = loadMainThread(mainToBackgroundRpc, docu, () => { }, markTimingInternal, () => {
11
+ callbacks.onError?.();
12
+ });
13
+ let runtime;
14
+ const start = async (configs) => {
15
+ const mainThreadRuntime = startMainThread(configs);
16
+ runtime = await mainThreadRuntime;
17
+ };
18
+ const updateDataMainThread = async (...args) => {
19
+ runtime.updatePage?.(...args);
20
+ };
21
+ return {
22
+ start,
23
+ updateDataMainThread,
24
+ };
25
+ }
26
+ //# sourceMappingURL=createRenderAllOnUI.js.map
@@ -0,0 +1,7 @@
1
+ import type { Rpc } from '@lynx-js/web-worker-rpc';
2
+ export declare function createRenderMultiThread(mainThreadRpc: Rpc, shadowRoot: ShadowRoot, callbacks: {
3
+ onError?: () => void;
4
+ }): {
5
+ start: (args_0: import("@lynx-js/web-constants").MainThreadStartConfigs) => void;
6
+ updateDataMainThread: (args_0: import("@lynx-js/web-constants").Cloneable, args_1: Record<string, string>) => Promise<void>;
7
+ };
@@ -0,0 +1,16 @@
1
+ import { mainThreadStartEndpoint, updateDataEndpoint, } from '@lynx-js/web-constants';
2
+ import { registerReportErrorHandler } from './crossThreadHandlers/registerReportErrorHandler.js';
3
+ import { registerFlushElementTreeHandler } from './crossThreadHandlers/registerFlushElementTreeHandler.js';
4
+ export function createRenderMultiThread(mainThreadRpc, shadowRoot, callbacks) {
5
+ registerReportErrorHandler(mainThreadRpc, callbacks.onError);
6
+ registerFlushElementTreeHandler(mainThreadRpc, {
7
+ shadowRoot,
8
+ });
9
+ const start = mainThreadRpc.createCall(mainThreadStartEndpoint);
10
+ const updateDataMainThread = mainThreadRpc.createCall(updateDataEndpoint);
11
+ return {
12
+ start,
13
+ updateDataMainThread,
14
+ };
15
+ }
16
+ //# sourceMappingURL=createRenderMultiThread.js.map
@@ -1,3 +1,4 @@
1
- import type { Rpc } from '@lynx-js/web-worker-rpc';
1
+ import type { RpcCallType } from '@lynx-js/web-worker-rpc';
2
2
  import type { LynxView } from '../../apis/createLynxView.js';
3
- export declare function createUpdateData(mainThreadRpc: Rpc, backgroundRpc: Rpc): LynxView['updateData'];
3
+ import { updateDataEndpoint } from '@lynx-js/web-constants';
4
+ export declare function createUpdateData(updateDataMainThread: RpcCallType<typeof updateDataEndpoint>, updateDataBackground: RpcCallType<typeof updateDataEndpoint>): LynxView['updateData'];
@@ -2,12 +2,12 @@
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
4
  import { updateDataEndpoint, } from '@lynx-js/web-constants';
5
- export function createUpdateData(mainThreadRpc, backgroundRpc) {
5
+ export function createUpdateData(updateDataMainThread, updateDataBackground) {
6
6
  return (data, _updateDataType, callback) => {
7
7
  Promise.all([
8
8
  // There is no need to process options for now, as they have default values.
9
- mainThreadRpc.invoke(updateDataEndpoint, [data, {}]),
10
- backgroundRpc.invoke(updateDataEndpoint, [data, {}]),
9
+ updateDataMainThread(data, {}),
10
+ updateDataBackground(data, {}),
11
11
  ]).then(() => callback?.());
12
12
  };
13
13
  }
@@ -0,0 +1,10 @@
1
+ import { type NapiModulesCall, type NativeModulesCall } from '@lynx-js/web-constants';
2
+ import type { Rpc } from '@lynx-js/web-worker-rpc';
3
+ export declare function startBackground(backgroundRpc: Rpc, shadowRoot: ShadowRoot, callbacks: {
4
+ nativeModulesCall: NativeModulesCall;
5
+ napiModulesCall: NapiModulesCall;
6
+ }): {
7
+ sendGlobalEvent: (args_0: string, args_1: import("@lynx-js/web-constants").Cloneable[] | undefined) => void;
8
+ markTiming: (timingKey: string, pipelineId: string | undefined, timeStamp: number) => void;
9
+ updateDataBackground: (args_0: import("@lynx-js/web-constants").Cloneable, args_1: Record<string, string>) => Promise<void>;
10
+ };
@@ -0,0 +1,26 @@
1
+ import { markTimingEndpoint, sendGlobalEventEndpoint, updateDataEndpoint, } from '@lynx-js/web-constants';
2
+ import { registerInvokeUIMethodHandler } from './crossThreadHandlers/registerInvokeUIMethodHandler.js';
3
+ import { registerNativePropsHandler } from './crossThreadHandlers/registerSetNativePropsHandler.js';
4
+ import { registerNativeModulesCallHandler } from './crossThreadHandlers/registerNativeModulesCallHandler.js';
5
+ import { registerTriggerComponentEventHandler } from './crossThreadHandlers/registerTriggerComponentEventHandler.js';
6
+ import { registerSelectComponentHandler } from './crossThreadHandlers/registerSelectComponentHandler.js';
7
+ import { registerNapiModulesCallHandler } from './crossThreadHandlers/registerNapiModulesCallHandler.js';
8
+ import { registerDispatchLynxViewEventHandler } from './crossThreadHandlers/registerDispatchLynxViewEventHandler.js';
9
+ export function startBackground(backgroundRpc, shadowRoot, callbacks) {
10
+ registerInvokeUIMethodHandler(backgroundRpc, shadowRoot);
11
+ registerNativePropsHandler(backgroundRpc, shadowRoot);
12
+ registerTriggerComponentEventHandler(backgroundRpc, shadowRoot);
13
+ registerSelectComponentHandler(backgroundRpc, shadowRoot);
14
+ registerNativeModulesCallHandler(backgroundRpc, callbacks.nativeModulesCall);
15
+ registerNapiModulesCallHandler(backgroundRpc, callbacks.napiModulesCall);
16
+ registerDispatchLynxViewEventHandler(backgroundRpc, shadowRoot);
17
+ const sendGlobalEvent = backgroundRpc.createCall(sendGlobalEventEndpoint);
18
+ const markTiming = backgroundRpc.createCall(markTimingEndpoint);
19
+ const updateDataBackground = backgroundRpc.createCall(updateDataEndpoint);
20
+ return {
21
+ sendGlobalEvent,
22
+ markTiming,
23
+ updateDataBackground,
24
+ };
25
+ }
26
+ //# sourceMappingURL=startBackground.js.map
@@ -1,8 +1,9 @@
1
1
  import type { LynxView } from '../apis/createLynxView.js';
2
2
  import { type LynxTemplate, type MainThreadStartConfigs, type NapiModulesCall, type NativeModulesCall } from '@lynx-js/web-constants';
3
- export declare function startUIThread(templateUrl: string, configs: Omit<MainThreadStartConfigs, 'template'>, shadowRoot: ShadowRoot, lynxGroupId: number | undefined, callbacks: {
3
+ export type StartUIThreadCallbacks = {
4
4
  nativeModulesCall: NativeModulesCall;
5
5
  napiModulesCall: NapiModulesCall;
6
6
  onError?: () => void;
7
7
  customTemplateLoader?: (url: string) => Promise<LynxTemplate>;
8
- }): LynxView;
8
+ };
9
+ export declare function startUIThread(templateUrl: string, configs: Omit<MainThreadStartConfigs, 'template'>, shadowRoot: ShadowRoot, lynxGroupId: number | undefined, threadStrategy: 'all-on-ui' | 'multi-thread', callbacks: StartUIThreadCallbacks): LynxView;
@@ -1,53 +1,40 @@
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 { registerInvokeUIMethodHandler } from './crossThreadHandlers/registerInvokeUIMethodHandler.js';
5
- import { registerNativePropsHandler } from './crossThreadHandlers/registerSetNativePropsHandler.js';
6
- import { registerNativeModulesCallHandler } from './crossThreadHandlers/registerNativeModulesCallHandler.js';
7
4
  import { bootWorkers } from './bootWorkers.js';
8
- import { registerReportErrorHandler } from './crossThreadHandlers/registerReportErrorHandler.js';
9
- import { registerFlushElementTreeHandler } from './crossThreadHandlers/registerFlushElementTreeHandler.js';
10
5
  import { createDispose } from './crossThreadHandlers/createDispose.js';
11
- import { registerTriggerComponentEventHandler } from './crossThreadHandlers/registerTriggerComponentEventHandler.js';
12
- import { registerSelectComponentHandler } from './crossThreadHandlers/registerSelectComponentHandler.js';
13
- import { mainThreadStartEndpoint, markTimingEndpoint, sendGlobalEventEndpoint, } from '@lynx-js/web-constants';
6
+ import {} from '@lynx-js/web-constants';
14
7
  import { loadTemplate } from '../utils/loadTemplate.js';
15
8
  import { createUpdateData } from './crossThreadHandlers/createUpdateData.js';
16
- import { registerNapiModulesCallHandler } from './crossThreadHandlers/registerNapiModulesCallHandler.js';
17
- import { registerDispatchLynxViewEventHandler } from './crossThreadHandlers/registerDispatchLynxViewEventHandler.js';
18
- export function startUIThread(templateUrl, configs, shadowRoot, lynxGroupId, callbacks) {
9
+ import { startBackground } from './startBackground.js';
10
+ import { createRenderMultiThread } from './createRenderMultiThread.js';
11
+ import { createRenderAllOnUI } from './createRenderAllOnUI.js';
12
+ export function startUIThread(templateUrl, configs, shadowRoot, lynxGroupId, threadStrategy, callbacks) {
19
13
  const createLynxStartTiming = performance.now() + performance.timeOrigin;
20
- const { mainThreadRpc, backgroundRpc, terminateWorkers, } = bootWorkers(lynxGroupId);
21
- const sendGlobalEvent = backgroundRpc.createCall(sendGlobalEventEndpoint);
22
- const mainThreadStart = mainThreadRpc.createCall(mainThreadStartEndpoint);
23
- const markTiming = backgroundRpc.createCall(markTimingEndpoint);
14
+ const allOnUI = threadStrategy === 'all-on-ui';
15
+ const { mainThreadRpc, backgroundRpc, terminateWorkers, } = bootWorkers(lynxGroupId, allOnUI);
16
+ const { markTiming, sendGlobalEvent, updateDataBackground } = startBackground(backgroundRpc, shadowRoot, callbacks);
24
17
  const markTimingInternal = (timingKey, pipelineId, timeStamp) => {
25
18
  if (!timeStamp)
26
19
  timeStamp = performance.now() + performance.timeOrigin;
27
20
  markTiming(timingKey, pipelineId, timeStamp);
28
21
  };
22
+ const { start, updateDataMainThread } = allOnUI
23
+ ? createRenderAllOnUI(
24
+ /* main-to-bg rpc*/ mainThreadRpc, shadowRoot, markTimingInternal, callbacks)
25
+ : createRenderMultiThread(
26
+ /* main-to-ui rpc*/ mainThreadRpc, shadowRoot, callbacks);
29
27
  markTimingInternal('create_lynx_start', undefined, createLynxStartTiming);
30
28
  markTimingInternal('load_template_start');
31
29
  loadTemplate(templateUrl, callbacks.customTemplateLoader).then((template) => {
32
30
  markTimingInternal('load_template_end');
33
- mainThreadStart({
31
+ start({
34
32
  ...configs,
35
33
  template,
36
34
  });
37
35
  });
38
- registerReportErrorHandler(mainThreadRpc, callbacks.onError);
39
- registerDispatchLynxViewEventHandler(backgroundRpc, shadowRoot);
40
- registerFlushElementTreeHandler(mainThreadRpc, {
41
- shadowRoot,
42
- });
43
- registerInvokeUIMethodHandler(backgroundRpc, shadowRoot);
44
- registerNativePropsHandler(backgroundRpc, shadowRoot);
45
- registerTriggerComponentEventHandler(backgroundRpc, shadowRoot);
46
- registerSelectComponentHandler(backgroundRpc, shadowRoot);
47
- registerNativeModulesCallHandler(backgroundRpc, callbacks.nativeModulesCall);
48
- registerNapiModulesCallHandler(backgroundRpc, callbacks.napiModulesCall);
49
36
  return {
50
- updateData: createUpdateData(mainThreadRpc, backgroundRpc),
37
+ updateData: createUpdateData(updateDataMainThread, updateDataBackground),
51
38
  dispose: createDispose(backgroundRpc, terminateWorkers),
52
39
  sendGlobalEvent,
53
40
  };
@@ -82,12 +82,14 @@ const mainThreadInjectVars = [
82
82
  '__OnLifecycleEvent',
83
83
  '__FlushElementTree',
84
84
  '__LoadLepusChunk',
85
+ 'SystemInfo',
85
86
  ];
86
87
  const backgroundInjectVars = [
87
88
  'NativeModules',
88
89
  'globalThis',
89
90
  'lynx',
90
91
  'lynxCoreInject',
92
+ 'SystemInfo',
91
93
  ];
92
94
  const backgroundInjectWithBind = [
93
95
  'Card',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-core",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [],
@@ -24,14 +24,15 @@
24
24
  "**/*.css"
25
25
  ],
26
26
  "dependencies": {
27
- "@lynx-js/offscreen-document": "0.0.0",
28
- "@lynx-js/web-constants": "0.12.0",
29
- "@lynx-js/web-worker-rpc": "0.12.0",
30
- "@lynx-js/web-worker-runtime": "0.12.0"
27
+ "@lynx-js/offscreen-document": "0.0.1",
28
+ "@lynx-js/web-constants": "0.13.0",
29
+ "@lynx-js/web-mainthread-apis": "0.13.0",
30
+ "@lynx-js/web-worker-rpc": "0.13.0",
31
+ "@lynx-js/web-worker-runtime": "0.13.0"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@lynx-js/lynx-core": "0.1.2",
34
- "@lynx-js/web-elements": "0.6.0"
35
+ "@lynx-js/web-elements": "0.7.0"
35
36
  },
36
37
  "peerDependencies": {
37
38
  "@lynx-js/lynx-core": "0.1.2",