@lynx-js/react 0.121.1 → 0.122.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 +44 -0
- package/package.json +5 -5
- package/runtime/lazy/element-template-import.js +73 -0
- package/runtime/lazy/import.js +4 -0
- package/runtime/lazy/target.js +23 -0
- package/runtime/lib/core/background-function/exec-map.d.ts +11 -0
- package/runtime/lib/core/background-function/exec-map.js +39 -0
- package/runtime/lib/core/background-function/exec-map.js.map +1 -0
- package/runtime/lib/core/background-function/handle.d.ts +8 -0
- package/runtime/lib/core/background-function/handle.js +25 -0
- package/runtime/lib/core/background-function/handle.js.map +1 -0
- package/runtime/lib/core/background-function/run-on-background.d.ts +8 -0
- package/runtime/lib/{snapshot/worklet/call/runOnBackground.js → core/background-function/run-on-background.js} +39 -33
- package/runtime/lib/core/background-function/run-on-background.js.map +1 -0
- package/runtime/lib/{snapshot/legacy-react-runtime/index.d.ts → core/compat/legacy-react-runtime.d.ts} +4 -4
- package/runtime/lib/{snapshot/legacy-react-runtime/index.js → core/compat/legacy-react-runtime.js} +6 -6
- package/runtime/lib/core/compat/legacy-react-runtime.js.map +1 -0
- package/runtime/lib/{snapshot → core}/compat/lynxComponent.d.ts +2 -1
- package/runtime/lib/{snapshot → core}/compat/lynxComponent.js +11 -5
- package/runtime/lib/core/compat/lynxComponent.js.map +1 -0
- package/runtime/lib/core/component.d.ts +2 -0
- package/runtime/lib/{snapshot/lynx → core}/component.js +37 -31
- package/runtime/lib/core/component.js.map +1 -0
- package/runtime/lib/core/initData.js +35 -0
- package/runtime/lib/core/initData.js.map +1 -1
- package/runtime/lib/{snapshot/lynx/dynamic-js.js → core/lynx/dynamic-import.js} +1 -1
- package/runtime/lib/core/lynx/dynamic-import.js.map +1 -0
- package/runtime/lib/core/lynx/lazy-bundle.js.map +1 -0
- package/runtime/lib/core/lynx/runtime-backend.d.ts +5 -0
- package/runtime/lib/core/lynx/runtime-backend.js +20 -0
- package/runtime/lib/core/lynx/runtime-backend.js.map +1 -0
- package/runtime/lib/core/lynx-page-data.js +6 -0
- package/runtime/lib/core/lynx-page-data.js.map +1 -1
- package/runtime/lib/core/lynx-update-data.js +6 -0
- package/runtime/lib/core/lynx-update-data.js.map +1 -1
- package/runtime/lib/core/performance.d.ts +30 -0
- package/runtime/lib/core/performance.js +145 -0
- package/runtime/lib/core/performance.js.map +1 -0
- package/runtime/lib/core/runtime-destroy.d.ts +4 -0
- package/runtime/lib/core/runtime-destroy.js +18 -0
- package/runtime/lib/core/runtime-destroy.js.map +1 -0
- package/runtime/lib/core/thread-function-call/main-thread.d.ts +5 -0
- package/runtime/lib/core/thread-function-call/main-thread.js +69 -0
- package/runtime/lib/core/thread-function-call/main-thread.js.map +1 -0
- package/runtime/lib/core/thread-function-call/return-value.d.ts +2 -0
- package/runtime/lib/core/thread-function-call/return-value.js +67 -0
- package/runtime/lib/core/thread-function-call/return-value.js.map +1 -0
- package/runtime/lib/element-template/background/attr-slots.d.ts +1 -1
- package/runtime/lib/element-template/background/attr-slots.js +8 -7
- package/runtime/lib/element-template/background/attr-slots.js.map +1 -1
- package/runtime/lib/element-template/background/commit-hook.js +81 -61
- package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
- package/runtime/lib/element-template/background/destroy.js +4 -0
- package/runtime/lib/element-template/background/destroy.js.map +1 -1
- package/runtime/lib/element-template/background/document.js +7 -1
- package/runtime/lib/element-template/background/document.js.map +1 -1
- package/runtime/lib/element-template/background/hydrate.d.ts +2 -3
- package/runtime/lib/element-template/background/hydrate.js +237 -58
- package/runtime/lib/element-template/background/hydrate.js.map +1 -1
- package/runtime/lib/element-template/background/hydration-listener.js +38 -38
- package/runtime/lib/element-template/background/hydration-listener.js.map +1 -1
- package/runtime/lib/element-template/background/instance.d.ts +31 -4
- package/runtime/lib/element-template/background/instance.js +219 -31
- package/runtime/lib/element-template/background/instance.js.map +1 -1
- package/runtime/lib/element-template/background/render-scope.d.ts +4 -0
- package/runtime/lib/element-template/background/render-scope.js +43 -0
- package/runtime/lib/element-template/background/render-scope.js.map +1 -0
- package/runtime/lib/element-template/debug/alog.d.ts +14 -0
- package/runtime/lib/element-template/debug/alog.js +23 -0
- package/runtime/lib/element-template/debug/alog.js.map +1 -1
- package/runtime/lib/element-template/debug/elementPAPICall.js +1 -0
- package/runtime/lib/element-template/debug/elementPAPICall.js.map +1 -1
- package/runtime/lib/element-template/index.d.ts +5 -2
- package/runtime/lib/element-template/index.js +8 -7
- package/runtime/lib/element-template/index.js.map +1 -1
- package/runtime/lib/element-template/internal.d.ts +7 -0
- package/runtime/lib/element-template/internal.js +9 -9
- package/runtime/lib/element-template/internal.js.map +1 -1
- package/runtime/lib/element-template/lynx/env.js +2 -0
- package/runtime/lib/element-template/lynx/env.js.map +1 -1
- package/runtime/lib/element-template/lynx/performance.d.ts +0 -21
- package/runtime/lib/element-template/lynx/performance.js +4 -121
- package/runtime/lib/element-template/lynx/performance.js.map +1 -1
- package/runtime/lib/element-template/native/index.js +3 -1
- package/runtime/lib/element-template/native/index.js.map +1 -1
- package/runtime/lib/element-template/native/main-thread-api.js +1 -1
- package/runtime/lib/element-template/native/main-thread-api.js.map +1 -1
- package/runtime/lib/element-template/native/mts-destroy.js +6 -0
- package/runtime/lib/element-template/native/mts-destroy.js.map +1 -1
- package/runtime/lib/element-template/native/patch-listener.js +42 -17
- package/runtime/lib/element-template/native/patch-listener.js.map +1 -1
- package/runtime/lib/element-template/native/reload-background.d.ts +1 -0
- package/runtime/lib/element-template/native/{reload.js → reload-background.js} +1 -26
- package/runtime/lib/element-template/native/reload-background.js.map +1 -0
- package/runtime/lib/element-template/native/{reload.d.ts → reload-main-thread.d.ts} +0 -1
- package/runtime/lib/element-template/native/reload-main-thread.js +39 -0
- package/runtime/lib/element-template/native/reload-main-thread.js.map +1 -0
- package/runtime/lib/element-template/prop-adapters/spread.d.ts +1 -4
- package/runtime/lib/element-template/prop-adapters/spread.js +1 -1
- package/runtime/lib/element-template/prop-adapters/spread.js.map +1 -1
- package/runtime/lib/element-template/protocol/opcodes.d.ts +3 -0
- package/runtime/lib/element-template/protocol/opcodes.js +3 -0
- package/runtime/lib/element-template/protocol/opcodes.js.map +1 -1
- package/runtime/lib/element-template/protocol/template-type.d.ts +25 -0
- package/runtime/lib/element-template/protocol/template-type.js +42 -0
- package/runtime/lib/element-template/protocol/template-type.js.map +1 -0
- package/runtime/lib/element-template/protocol/types.d.ts +38 -15
- package/runtime/lib/element-template/protocol/types.js.map +1 -1
- package/runtime/lib/element-template/protocol/update-event.d.ts +15 -0
- package/runtime/lib/element-template/protocol/update-event.js +24 -0
- package/runtime/lib/element-template/protocol/update-event.js.map +1 -0
- package/runtime/lib/element-template/runtime/list/list.d.ts +65 -0
- package/runtime/lib/element-template/runtime/list/list.js +587 -0
- package/runtime/lib/element-template/runtime/list/list.js.map +1 -0
- package/runtime/lib/element-template/runtime/patch.d.ts +1 -1
- package/runtime/lib/element-template/runtime/patch.js +198 -75
- package/runtime/lib/element-template/runtime/patch.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-main-thread.js +13 -0
- package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-opcodes.js +83 -43
- package/runtime/lib/element-template/runtime/render/render-opcodes.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.js +32 -1
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.d.ts +7 -5
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.js +17 -4
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/handle.d.ts +3 -2
- package/runtime/lib/element-template/runtime/template/handle.js +11 -0
- package/runtime/lib/element-template/runtime/template/handle.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-background-function.d.ts +10 -0
- package/runtime/lib/element-template/runtime/template/main-thread-background-function.js +30 -0
- package/runtime/lib/element-template/runtime/template/main-thread-background-function.js.map +1 -0
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.d.ts +15 -0
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js +91 -0
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js.map +1 -0
- package/runtime/lib/element-template/runtime/template/main-thread-event-ctx.d.ts +15 -0
- package/runtime/lib/element-template/runtime/template/main-thread-event-ctx.js +29 -0
- package/runtime/lib/element-template/runtime/template/main-thread-event-ctx.js.map +1 -0
- package/runtime/lib/element-template/runtime/template/main-thread-function.d.ts +6 -0
- package/runtime/lib/element-template/runtime/template/main-thread-function.js +24 -0
- package/runtime/lib/element-template/runtime/template/main-thread-function.js.map +1 -0
- package/runtime/lib/element-template/runtime/template/registry.d.ts +2 -0
- package/runtime/lib/element-template/runtime/template/registry.js +5 -0
- package/runtime/lib/element-template/runtime/template/registry.js.map +1 -1
- package/runtime/lib/element-template/runtime-backend-marker.js +6 -0
- package/runtime/lib/element-template/runtime-backend-marker.js.map +1 -0
- package/runtime/lib/index.d.ts +4 -2
- package/runtime/lib/index.js +5 -2
- package/runtime/lib/index.js.map +1 -1
- package/runtime/lib/internal.d.ts +5 -4
- package/runtime/lib/internal.js +6 -5
- package/runtime/lib/internal.js.map +1 -1
- package/runtime/lib/lynx-api.d.ts +1 -1
- package/runtime/lib/lynx-api.js +1 -1
- package/runtime/lib/lynx-api.js.map +1 -1
- package/runtime/lib/runtime-backend-marker.js +6 -0
- package/runtime/lib/runtime-backend-marker.js.map +1 -0
- package/runtime/lib/{snapshot/worklet/indexMap.d.ts → shared/index-map.d.ts} +2 -2
- package/runtime/lib/{snapshot/worklet/indexMap.js → shared/index-map.js} +5 -3
- package/runtime/lib/shared/index-map.js.map +1 -0
- package/runtime/lib/snapshot/lifecycle/patch/commit.js +2 -2
- package/runtime/lib/snapshot/lifecycle/patch/commit.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -1
- package/runtime/lib/snapshot/lynx/calledByNative.js +1 -1
- package/runtime/lib/snapshot/lynx/calledByNative.js.map +1 -1
- package/runtime/lib/snapshot/lynx/children.d.ts +13 -0
- package/runtime/lib/snapshot/lynx/children.js +19 -0
- package/runtime/lib/snapshot/lynx/children.js.map +1 -0
- package/runtime/lib/snapshot/lynx/performance.d.ts +0 -21
- package/runtime/lib/snapshot/lynx/performance.js +7 -121
- package/runtime/lib/snapshot/lynx/performance.js.map +1 -1
- package/runtime/lib/snapshot/lynx/tt.js +2 -2
- package/runtime/lib/snapshot/lynx/tt.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/snapshot.js +1 -1
- package/runtime/lib/snapshot/snapshot/snapshot.js.map +1 -1
- package/runtime/lib/snapshot/worklet/call/runOnMainThread.js +10 -31
- package/runtime/lib/snapshot/worklet/call/runOnMainThread.js.map +1 -1
- package/runtime/lib/snapshot/worklet/ctx.js +2 -2
- package/runtime/lib/snapshot/worklet/ctx.js.map +1 -1
- package/runtime/lib/snapshot/worklet/destroy.d.ts +0 -1
- package/runtime/lib/snapshot/worklet/destroy.js +2 -5
- package/runtime/lib/snapshot/worklet/destroy.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -1
- package/runtime/lib/worklet-runtime/bindings/observers.d.ts +7 -0
- package/runtime/lib/worklet-runtime/bindings/observers.js +14 -1
- package/runtime/lib/worklet-runtime/bindings/observers.js.map +1 -1
- package/runtime/lib/worklet-runtime/delayRunOnBackground.d.ts +2 -1
- package/runtime/lib/worklet-runtime/delayRunOnBackground.js +6 -2
- package/runtime/lib/worklet-runtime/delayRunOnBackground.js.map +1 -1
- package/runtime/lib/worklet-runtime/hydrate.js +3 -0
- package/runtime/lib/worklet-runtime/hydrate.js.map +1 -1
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.d.ts +1 -1
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js +1 -1
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js.map +1 -1
- package/runtime/lib/worklet-runtime/workletRuntime.js +17 -2
- package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
- package/runtime/worklet-runtime/dev.js +26 -9
- package/runtime/worklet-runtime/main.js +1 -1
- package/testing-library/dist/{rslib-runtime.js → 0~rslib-runtime.js} +14 -13
- package/testing-library/dist/env/vitest.js +1 -1
- package/testing-library/dist/plugins/index.js +1 -1
- package/testing-library/dist/pure.js +18 -18
- package/testing-library/dist/rstest-config.js +2 -4
- package/testing-library/dist/setupFiles/common/bootstrap.js +1 -0
- package/testing-library/dist/setupFiles/common/runtime-setup.js +1 -1
- package/testing-library/dist/setupFiles/inner/rstest.js +2 -1
- package/testing-library/dist/setupFiles/inner/vitest.js +2 -1
- package/testing-library/dist/type-entry/index.js +1 -0
- package/transform/dist/wasm.cjs +113 -40
- package/types/react.docs.d.ts +14 -0
- package/runtime/lib/element-template/native/reload.js.map +0 -1
- package/runtime/lib/snapshot/compat/lynxComponent.js.map +0 -1
- package/runtime/lib/snapshot/legacy-react-runtime/index.js.map +0 -1
- package/runtime/lib/snapshot/lynx/component.js.map +0 -1
- package/runtime/lib/snapshot/lynx/dynamic-js.js.map +0 -1
- package/runtime/lib/snapshot/lynx/lazy-bundle.js.map +0 -1
- package/runtime/lib/snapshot/worklet/call/delayedRunOnMainThreadData.d.ts +0 -3
- package/runtime/lib/snapshot/worklet/call/delayedRunOnMainThreadData.js +0 -10
- package/runtime/lib/snapshot/worklet/call/delayedRunOnMainThreadData.js.map +0 -1
- package/runtime/lib/snapshot/worklet/call/execMap.js +0 -43
- package/runtime/lib/snapshot/worklet/call/execMap.js.map +0 -1
- package/runtime/lib/snapshot/worklet/call/functionCall.d.ts +0 -1
- package/runtime/lib/snapshot/worklet/call/functionCall.js +0 -33
- package/runtime/lib/snapshot/worklet/call/functionCall.js.map +0 -1
- package/runtime/lib/snapshot/worklet/call/runOnBackground.d.ts +0 -20
- package/runtime/lib/snapshot/worklet/call/runOnBackground.js.map +0 -1
- package/runtime/lib/snapshot/worklet/call/transformToWorklet.d.ts +0 -1
- package/runtime/lib/snapshot/worklet/call/transformToWorklet.js +0 -22
- package/runtime/lib/snapshot/worklet/call/transformToWorklet.js.map +0 -1
- package/runtime/lib/snapshot/worklet/indexMap.js.map +0 -1
- package/testing-library/dist/881.js +0 -1
- /package/runtime/lib/{snapshot/lynx/dynamic-js.d.ts → core/lynx/dynamic-import.d.ts} +0 -0
- /package/runtime/lib/{snapshot → core}/lynx/lazy-bundle.d.ts +0 -0
- /package/runtime/lib/{snapshot → core}/lynx/lazy-bundle.js +0 -0
- /package/runtime/lib/{snapshot/lynx/component.d.ts → element-template/runtime-backend-marker.d.ts} +0 -0
- /package/runtime/lib/{snapshot/worklet/call/execMap.d.ts → runtime-backend-marker.d.ts} +0 -0
- /package/testing-library/dist/{0~123.js → 0~@rstest/adapter-rsbuild.js} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import './runtime-backend-marker.js';
|
|
2
|
+
import { Children, Fragment, Suspense, cloneElement, createElement, createRef, forwardRef, isValidElement, lazy, memo, useSyncExternalStore } from 'preact/compat';
|
|
2
3
|
import type { Consumer, FC, ReactNode } from 'react';
|
|
3
4
|
import type { GlobalProps } from '../core/globalProps.js';
|
|
4
5
|
import { useLynxGlobalEventListener } from '../core/hooks/useLynxGlobalEventListener.js';
|
|
@@ -8,7 +9,7 @@ import './native/index.js';
|
|
|
8
9
|
export { Component, createContext } from 'preact';
|
|
9
10
|
export { PureComponent } from 'preact/compat';
|
|
10
11
|
export * from '@lynx-js/react/hooks';
|
|
11
|
-
export { Children, createRef, Fragment, isValidElement, memo, forwardRef, lazy, createElement, cloneElement, useSyncExternalStore, };
|
|
12
|
+
export { Children, createRef, Fragment, isValidElement, memo, forwardRef, Suspense, lazy, createElement, cloneElement, useSyncExternalStore, };
|
|
12
13
|
export declare const InitDataProvider: FC<{
|
|
13
14
|
children?: ReactNode | undefined;
|
|
14
15
|
}>;
|
|
@@ -24,5 +25,7 @@ export declare const useGlobalPropsChanged: (callback: (data: GlobalProps) => vo
|
|
|
24
25
|
export { withInitDataInState };
|
|
25
26
|
export { useLynxGlobalEventListener };
|
|
26
27
|
export * from './client/root.js';
|
|
28
|
+
export { runOnBackground } from './runtime/template/main-thread-background-function.js';
|
|
29
|
+
export { runOnMainThread } from './runtime/template/main-thread-function.js';
|
|
27
30
|
export type { GlobalProps } from '../core/globalProps.js';
|
|
28
31
|
export type { DataProcessorDefinition, DataProcessors, InitData, InitDataRaw } from '../lynx-api.js';
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
// Copyright 2024 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
|
|
4
|
+
import './runtime-backend-marker.js';
|
|
5
|
+
import { Children, Component, Fragment, PureComponent, Suspense, cloneElement, createContext, createElement, createRef, forwardRef, isValidElement, lazy, memo, useSyncExternalStore, } from 'preact/compat';
|
|
5
6
|
import { useCallback, useContext, useDebugValue, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, } from '@lynx-js/react/hooks';
|
|
7
|
+
import { installComponentCompat } from '../core/component.js';
|
|
6
8
|
import { createGlobalProps } from '../core/globalProps.js';
|
|
7
9
|
import { useLynxGlobalEventListener } from '../core/hooks/useLynxGlobalEventListener.js';
|
|
8
10
|
import { factory, withInitDataInState } from '../core/initData.js';
|
|
9
11
|
import './native/index.js';
|
|
10
|
-
|
|
11
|
-
// import { Suspense } from './lynx/suspense.js';
|
|
12
|
+
installComponentCompat();
|
|
12
13
|
export { Component, createContext } from 'preact';
|
|
13
14
|
export { PureComponent } from 'preact/compat';
|
|
14
15
|
export * from '@lynx-js/react/hooks';
|
|
@@ -37,13 +38,11 @@ export default {
|
|
|
37
38
|
PureComponent,
|
|
38
39
|
memo,
|
|
39
40
|
forwardRef,
|
|
40
|
-
|
|
41
|
+
Suspense,
|
|
41
42
|
lazy,
|
|
42
43
|
createElement,
|
|
43
44
|
};
|
|
44
|
-
export { Children, createRef, Fragment, isValidElement, memo, forwardRef,
|
|
45
|
-
// Suspense,
|
|
46
|
-
lazy, createElement, cloneElement, useSyncExternalStore, };
|
|
45
|
+
export { Children, createRef, Fragment, isValidElement, memo, forwardRef, Suspense, lazy, createElement, cloneElement, useSyncExternalStore, };
|
|
47
46
|
const _InitData = /* @__PURE__ */ factory({
|
|
48
47
|
createContext,
|
|
49
48
|
useState,
|
|
@@ -72,4 +71,6 @@ export const useGlobalPropsChanged = /* @__PURE__ */ _GlobalProps
|
|
|
72
71
|
export { withInitDataInState };
|
|
73
72
|
export { useLynxGlobalEventListener };
|
|
74
73
|
export * from './client/root.js';
|
|
74
|
+
export { runOnBackground } from './runtime/template/main-thread-background-function.js';
|
|
75
|
+
export { runOnMainThread } from './runtime/template/main-thread-function.js';
|
|
75
76
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/element-template/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EACL,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,SAAS,EACT,UAAU,EACV,cAAc,EACd,IAAI,EACJ,IAAI,EACJ,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,WAAW,EACX,UAAU,EACV,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,eAAe,EACf,OAAO,EACP,UAAU,EACV,MAAM,EACN,QAAQ,GACT,MAAM,sBAAsB,CAAC;A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CAAC;AACpF,MAAM,CAAC,MAAM,qBAAqB,GAAoD,eAAe,CAAC,YAAY;KAC/G,UAAU,EAAE,CAAC;AAEhB,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAC/B,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAEtC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC"}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
import './runtime-backend-marker.js';
|
|
1
2
|
import './native/index.js';
|
|
2
3
|
import { __root } from './runtime/page/root-instance.js';
|
|
3
4
|
export { __root };
|
|
4
5
|
export { options, Component, process, } from 'preact';
|
|
5
6
|
export type { Options } from 'preact';
|
|
7
|
+
export { loadDynamicJS, __dynamicImport } from '../core/lynx/dynamic-import.js';
|
|
6
8
|
export { withInitDataInState } from '../core/initData.js';
|
|
9
|
+
export { wrapWithLynxComponent } from '../core/compat/lynxComponent.js';
|
|
10
|
+
export { transformToWorklet } from './runtime/template/main-thread-background-function.js';
|
|
11
|
+
export { loadWorkletRuntime } from '@lynx-js/react/worklet-runtime/bindings';
|
|
12
|
+
export declare function registerWorkletOnBackground(_type: string, _hash: string, _fn: (...args: unknown[]) => unknown): void;
|
|
13
|
+
export { __etAttrPlanMap, adaptEventAttrSlot, adaptMTEventAttrSlot, adaptRefAttrSlot, adaptSpreadAttrSlot, } from './runtime/template/attr-slot-plan.js';
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
// LICENSE file in the root directory of this source tree.
|
|
4
4
|
// import { Suspense, createElement, lazy } from 'preact/compat';
|
|
5
5
|
// import type { FC } from 'react';
|
|
6
|
+
import './runtime-backend-marker.js';
|
|
6
7
|
import './native/index.js';
|
|
7
8
|
// import { factory as factory2 } from '../compat/componentIs.js';
|
|
8
9
|
// import { useMemo } from '../core/hooks/react.js';
|
|
9
|
-
// import { loadLazyBundle } from '../lynx/lazy-bundle.js';
|
|
10
10
|
import { __root } from './runtime/page/root-instance.js';
|
|
11
11
|
/**
|
|
12
12
|
* @internal kept only to fail fast when stale internal imports leak into the
|
|
@@ -23,9 +23,9 @@ export { __root };
|
|
|
23
23
|
export { options,
|
|
24
24
|
// Component is not an internal API, but refresh needs it from 'react/internal'
|
|
25
25
|
Component, process, } from 'preact';
|
|
26
|
-
|
|
26
|
+
export { loadDynamicJS, __dynamicImport } from '../core/lynx/dynamic-import.js';
|
|
27
27
|
export { withInitDataInState } from '../core/initData.js';
|
|
28
|
-
|
|
28
|
+
export { wrapWithLynxComponent } from '../core/compat/lynxComponent.js';
|
|
29
29
|
/**
|
|
30
30
|
* @internal a polyfill for <component is=? />
|
|
31
31
|
*/
|
|
@@ -34,10 +34,10 @@ export { withInitDataInState } from '../core/initData.js';
|
|
|
34
34
|
// { Suspense, lazy, createElement, useMemo } as any,
|
|
35
35
|
// loadLazyBundle,
|
|
36
36
|
// );
|
|
37
|
-
|
|
38
|
-
// TODO:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
export { __etAttrPlanMap, adaptEventAttrSlot, adaptRefAttrSlot, adaptSpreadAttrSlot, } from './runtime/template/attr-slot-plan.js';
|
|
37
|
+
export { loadLazyBundle } from '../core/lynx/lazy-bundle.js';
|
|
38
|
+
// TODO(ET MTS): add MTRef hydrate semantics in follow-up tracks.
|
|
39
|
+
export { transformToWorklet } from './runtime/template/main-thread-background-function.js';
|
|
40
|
+
export { loadWorkletRuntime } from '@lynx-js/react/worklet-runtime/bindings';
|
|
41
|
+
export function registerWorkletOnBackground(_type, _hash, _fn) { }
|
|
42
|
+
export { __etAttrPlanMap, adaptEventAttrSlot, adaptMTEventAttrSlot, adaptRefAttrSlot, adaptSpreadAttrSlot, } from './runtime/template/attr-slot-plan.js';
|
|
43
43
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/element-template/internal.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,iEAAiE;AACjE,mCAAmC;AAEnC,OAAO,mBAAmB,CAAC;AAE3B,kEAAkE;AAClE,oDAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/element-template/internal.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,iEAAiE;AACjE,mCAAmC;AAEnC,OAAO,6BAA6B,CAAC;AACrC,OAAO,mBAAmB,CAAC;AAE3B,kEAAkE;AAClE,oDAAoD;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAEzD;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IACR;IAAnB,YAAmB,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;QAC7B,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;IAC9F,CAAC;CACF;AAED,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,OAAO,EACL,OAAO;AACP,+EAA+E;AAC/E,SAAS,EACT,OAAO,GACR,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEhF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE;;GAEG;AACH,qFAAqF;AACrF,sEAAsE;AACtE,uDAAuD;AACvD,oBAAoB;AACpB,KAAK;AAEL,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,iEAAiE;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,MAAM,UAAU,2BAA2B,CACzC,KAAa,EACb,KAAa,EACb,GAAoC,IAC7B,CAAC;AAEV,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,sCAAsC,CAAC"}
|
|
@@ -22,6 +22,8 @@ export function setupLynxEnv() {
|
|
|
22
22
|
lynx.__initData = {
|
|
23
23
|
/* available only in renderPage */
|
|
24
24
|
};
|
|
25
|
+
globalThis.SystemInfo =
|
|
26
|
+
lynx.SystemInfo ?? {};
|
|
25
27
|
lynx.triggerGlobalEventFromLepus = function (eventName, params) {
|
|
26
28
|
__OnLifecycleEvent(['globalEventFromLepus', [eventName, params]]);
|
|
27
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../src/element-template/lynx/env.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAGvE,MAAM,UAAU,YAAY;IAC1B,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,IAAI,QAAQ,GAA4B,EAAE,CAAC;QAC3C,IAAI,UAAU,GAA4B,EAAE,CAAC;QAE7C,IAAI,CAAC;YACH,MAAM,MAAM,GAAI,cAEd;gBACA,EAAE,EAAE,EAAE,OAAO,CAAC;YAChB,IAAI,MAAM,EAAE,CAAC;gBACX,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC;gBACjC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;YACvC,CAAC;QACH,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;QAEV,IAAI,CAAC,UAAU,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,UAAU,EAAE,CAAC;QACjD,IAAI,CAAC,sBAAsB,GAAG,cAAY,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,SAAS,EAAE,CAAC;QACd,IAAI,CAAC,UAAU,GAAG;QAChB,kCAAkC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AAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,WAAW,EAAE,CAAC;gBAClD,wBAAwB;gBACxB,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC;YACrC,CAAC;QACH,CAAC;QAED,IAAI,CAAC,sBAAsB,GAAG,UAC5B,uBAAiD;YAEjD,UAAU,CAAC,WAAW,GAAG,iBAAiB,CAAC,uBAAuB,CAAC,CAAC;QACtE,CAAC,CAAC;QAEF,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAChC,CAAC;AACH,CAAC"}
|
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
declare const PerformanceTimingKeys: readonly ["updateSetStateTrigger", "updateDiffVdomStart", "updateDiffVdomEnd", "diffVdomStart", "diffVdomEnd", "packChangesStart", "packChangesEnd", "parseChangesStart", "parseChangesEnd", "patchChangesStart", "patchChangesEnd", "hydrateParsePayloadStart", "hydrateParsePayloadEnd", "mtsRenderStart", "mtsRenderEnd"];
|
|
2
|
-
declare const PerformanceTimingFlags: {
|
|
3
|
-
readonly reactLynxHydrate: "react_lynx_hydrate";
|
|
4
|
-
};
|
|
5
|
-
declare const PipelineOrigins: {
|
|
6
|
-
readonly reactLynxHydrate: "reactLynxHydrate";
|
|
7
|
-
readonly updateTriggeredByBts: "updateTriggeredByBts";
|
|
8
|
-
};
|
|
9
|
-
type PipelineOrigin = typeof PipelineOrigins[keyof typeof PipelineOrigins];
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated used by old timing api(setState timing flag)
|
|
12
|
-
*/
|
|
13
|
-
declare const PerfSpecificKey = "__lynx_timing_flag";
|
|
14
|
-
declare let globalPipelineOptions: PipelineOptions | undefined;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated used by old timing api(setState timing flag)
|
|
17
|
-
*/
|
|
18
|
-
declare function markTimingLegacy(key: typeof PerformanceTimingKeys[number], timingFlag_?: string): void;
|
|
19
|
-
declare function beginPipeline(needTimestamps: boolean, pipelineOrigin: PipelineOrigin, timingFlag?: string): void;
|
|
20
|
-
declare function setPipeline(pipeline: PipelineOptions | undefined): void;
|
|
21
|
-
declare function markTiming(timestampKey: typeof PerformanceTimingKeys[number], force?: boolean): void;
|
|
22
1
|
declare function initTimingAPI(): void;
|
|
23
2
|
export {};
|
|
@@ -1,135 +1,18 @@
|
|
|
1
1
|
// Copyright 2024 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 {
|
|
5
|
-
import { RENDER_COMPONENT, ROOT } from '../../shared/render-constants.js';
|
|
6
|
-
import { hook } from '../../utils.js';
|
|
4
|
+
import { initTimingAPI as initCoreTimingAPI } from '../../core/performance.js';
|
|
7
5
|
import { globalCommitContext } from '../background/commit-context.js';
|
|
8
|
-
const PerformanceTimingKeys = [
|
|
9
|
-
'updateSetStateTrigger',
|
|
10
|
-
'updateDiffVdomStart',
|
|
11
|
-
'updateDiffVdomEnd',
|
|
12
|
-
// updateSetStateTrigger, updateDiffVdomStart and updateDiffVdomEnd is deprecated
|
|
13
|
-
'diffVdomStart',
|
|
14
|
-
'diffVdomEnd',
|
|
15
|
-
'packChangesStart',
|
|
16
|
-
'packChangesEnd',
|
|
17
|
-
'parseChangesStart',
|
|
18
|
-
'parseChangesEnd',
|
|
19
|
-
'patchChangesStart',
|
|
20
|
-
'patchChangesEnd',
|
|
21
|
-
'hydrateParsePayloadStart',
|
|
22
|
-
'hydrateParsePayloadEnd',
|
|
23
|
-
'mtsRenderStart',
|
|
24
|
-
'mtsRenderEnd',
|
|
25
|
-
];
|
|
26
|
-
const PerformanceTimingFlags = {
|
|
27
|
-
reactLynxHydrate: 'react_lynx_hydrate',
|
|
28
|
-
};
|
|
29
|
-
const PipelineOrigins = {
|
|
30
|
-
reactLynxHydrate: 'reactLynxHydrate',
|
|
31
|
-
updateTriggeredByBts: 'updateTriggeredByBts',
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated used by old timing api(setState timing flag)
|
|
35
|
-
*/
|
|
36
|
-
const PerfSpecificKey = '__lynx_timing_flag';
|
|
37
|
-
let timingFlag;
|
|
38
|
-
let shouldMarkDiffVdomStart = false;
|
|
39
|
-
let shouldMarkDiffVdomEnd = false;
|
|
40
|
-
let globalPipelineOptions;
|
|
41
|
-
/**
|
|
42
|
-
* @deprecated used by old timing api(setState timing flag)
|
|
43
|
-
*/
|
|
44
|
-
function markTimingLegacy(key, timingFlag_) {
|
|
45
|
-
switch (key) {
|
|
46
|
-
case 'updateSetStateTrigger': {
|
|
47
|
-
shouldMarkDiffVdomStart = true;
|
|
48
|
-
shouldMarkDiffVdomEnd = true;
|
|
49
|
-
timingFlag = timingFlag_;
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
case 'updateDiffVdomStart': {
|
|
53
|
-
if (!shouldMarkDiffVdomStart) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
shouldMarkDiffVdomStart = false;
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
case 'updateDiffVdomEnd': {
|
|
60
|
-
if (!shouldMarkDiffVdomEnd) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
shouldMarkDiffVdomEnd = false;
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
lynx.getNativeApp().markTiming?.(timingFlag, key);
|
|
68
|
-
}
|
|
69
|
-
function beginPipeline(needTimestamps, pipelineOrigin, timingFlag) {
|
|
70
|
-
globalPipelineOptions = lynx.performance?._generatePipelineOptions?.();
|
|
71
|
-
if (globalPipelineOptions) {
|
|
72
|
-
globalPipelineOptions.needTimestamps = needTimestamps;
|
|
73
|
-
globalPipelineOptions.pipelineOrigin = pipelineOrigin;
|
|
74
|
-
globalPipelineOptions.dsl = 'reactLynx';
|
|
75
|
-
switch (pipelineOrigin) {
|
|
76
|
-
case PipelineOrigins.reactLynxHydrate:
|
|
77
|
-
globalPipelineOptions.stage = 'hydrate';
|
|
78
|
-
break;
|
|
79
|
-
case PipelineOrigins.updateTriggeredByBts:
|
|
80
|
-
globalPipelineOptions.stage = 'update';
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
lynx.performance?._onPipelineStart?.(globalPipelineOptions.pipelineID, globalPipelineOptions);
|
|
84
|
-
if (timingFlag) {
|
|
85
|
-
lynx.performance?._bindPipelineIdWithTimingFlag?.(globalPipelineOptions.pipelineID, timingFlag);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
function setPipeline(pipeline) {
|
|
90
|
-
globalPipelineOptions = pipeline;
|
|
91
|
-
}
|
|
92
|
-
function markTiming(timestampKey, force) {
|
|
93
|
-
if (globalPipelineOptions && (force || globalPipelineOptions.needTimestamps)) {
|
|
94
|
-
lynx.performance?._markTiming?.(globalPipelineOptions.pipelineID, timestampKey);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
6
|
function shouldStartUpdatePipeline() {
|
|
98
7
|
return globalCommitContext.ops.length > 0;
|
|
99
8
|
}
|
|
100
9
|
function initTimingAPI() {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
// Check update ops to make sure this only runs after hydrate
|
|
104
|
-
if (__JS__ && shouldStartUpdatePipeline()) {
|
|
105
|
-
if (!globalPipelineOptions) {
|
|
106
|
-
beginPipeline(false, PipelineOrigins.updateTriggeredByBts);
|
|
107
|
-
markTiming('diffVdomStart', true);
|
|
108
|
-
}
|
|
109
|
-
if (shouldMarkDiffVdomStart) {
|
|
110
|
-
markTimingLegacy('updateDiffVdomStart');
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
hook(options, RENDER_COMPONENT, (old, vnode, c) => {
|
|
115
|
-
helper();
|
|
116
|
-
/* v8 ignore start */
|
|
117
|
-
if (old) {
|
|
118
|
-
old(vnode, c);
|
|
119
|
-
}
|
|
120
|
-
/* v8 ignore stop */
|
|
121
|
-
});
|
|
122
|
-
hook(options, ROOT, (old, vnode, parentDom) => {
|
|
123
|
-
helper();
|
|
124
|
-
/* v8 ignore start */
|
|
125
|
-
if (old) {
|
|
126
|
-
old(vnode, parentDom);
|
|
127
|
-
}
|
|
128
|
-
/* v8 ignore stop */
|
|
10
|
+
initCoreTimingAPI({
|
|
11
|
+
shouldStartUpdatePipeline,
|
|
129
12
|
});
|
|
130
13
|
}
|
|
131
14
|
/**
|
|
132
15
|
* @internal
|
|
133
16
|
*/
|
|
134
|
-
export {
|
|
17
|
+
export { initTimingAPI };
|
|
135
18
|
//# sourceMappingURL=performance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performance.js","sourceRoot":"","sources":["../../../src/element-template/lynx/performance.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"performance.js","sourceRoot":"","sources":["../../../src/element-template/lynx/performance.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,SAAS,yBAAyB;IAChC,OAAO,mBAAmB,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,aAAa;IACpB,iBAAiB,CAAC;QAChB,yBAAyB;KAC1B,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -7,7 +7,7 @@ import { callDestroyLifetimeFun } from './callDestroyLifetimeFun.js';
|
|
|
7
7
|
import { injectCalledByNative } from './main-thread-api.js';
|
|
8
8
|
import { installOnMtsDestruction } from './mts-destroy.js';
|
|
9
9
|
import { installElementTemplatePatchListener } from './patch-listener.js';
|
|
10
|
-
import { reloadBackground } from './reload.js';
|
|
10
|
+
import { reloadBackground } from './reload-background.js';
|
|
11
11
|
import { runWithForceRootRender } from '../../core/forceRootRender.js';
|
|
12
12
|
import { updateGlobalProps as updateGlobalPropsCore } from '../../core/globalProps.js';
|
|
13
13
|
import { installMainThreadHooks } from '../../core/hooks/mainThreadImpl.js';
|
|
@@ -16,6 +16,7 @@ import { installElementTemplateCommitHook } from '../background/commit-hook.js';
|
|
|
16
16
|
import { setupBackgroundElementTemplateDocument } from '../background/document.js';
|
|
17
17
|
import { installElementTemplateHydrationListener } from '../background/hydration-listener.js';
|
|
18
18
|
import { BackgroundElementTemplateInstance } from '../background/instance.js';
|
|
19
|
+
import { installElementTemplateRenderScopeHooks } from '../background/render-scope.js';
|
|
19
20
|
import { initElementTemplatePAPICallAlog } from '../debug/elementPAPICall.js';
|
|
20
21
|
import { initProfileHook } from '../debug/profile.js';
|
|
21
22
|
import { setupLynxEnv } from '../lynx/env.js';
|
|
@@ -65,6 +66,7 @@ function init() {
|
|
|
65
66
|
lynxCoreInject.tt.updateGlobalProps = updateGlobalProps;
|
|
66
67
|
lynxCoreInject.tt.updateCardData = updateCardData;
|
|
67
68
|
lynxCoreInject.tt.onAppReload = reloadBackground;
|
|
69
|
+
installElementTemplateRenderScopeHooks();
|
|
68
70
|
installElementTemplateCommitHook();
|
|
69
71
|
if (process.env['NODE_ENV'] !== 'test') {
|
|
70
72
|
initTimingAPI();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/element-template/native/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EA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ACzC,uCAAuC,EAAE,CAAC;QAC1C,yBAAyB,EAAE,CAAC;QAC5B,cAAc,CAAC,EAAE,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;QAClE,cAAc,CAAC,EAAE,CAAC,YAAY,GAAG,YAAY,CAAC;QAC9C,cAAc,CAAC,EAAE,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;QAC9D,cAAc,CAAC,EAAE,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QACxD,cAAc,CAAC,EAAE,CAAC,cAAc,GAAG,cAAc,CAAC;QAClD,cAAc,CAAC,EAAE,CAAC,WAAW,GAAG,gBAAgB,CAAC;QACjD,sCAAsC,EAAE,CAAC;QACzC,gCAAgC,EAAE,CAAC;QACnC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,MAAM,EAAE,CAAC;YACvC,aAAa,EAAE,CAAC;YAChB,IAAI,IAAI,CAAC,WAAW,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC;gBAC7C,eAAe,EAAE,CAAC;YACpB,CAAC;QACH,CAAC;IACH,CAAC;IAED,YAAY,EAAE,CAAC;AACjB,CAAC;AAED,IAAI,EAAE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2024 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 { reloadMainThread } from './reload.js';
|
|
4
|
+
import { reloadMainThread } from './reload-main-thread.js';
|
|
5
5
|
import { applyUpdatePageData } from '../../core/lynx-page-data.js';
|
|
6
6
|
import { __page, createElementTemplatePage, setupPage } from '../runtime/page/page.js';
|
|
7
7
|
import { renderMainThread, resetMainThreadRootRefs } from '../runtime/render/render-main-thread.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main-thread-api.js","sourceRoot":"","sources":["../../../src/element-template/native/main-thread-api.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"main-thread-api.js","sourceRoot":"","sources":["../../../src/element-template/native/main-thread-api.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,yBAAyB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAEpG,SAAS,oBAAoB;IAC3B,MAAM,cAAc,GAAqB;QACvC,UAAU;QACV,UAAU;QACV,iBAAiB;QACjB,WAAW,EAAE;YACX,OAAO,IAAI,CAAC;QACd,CAAC;QACD,gBAAgB,EAAE,cAAkB,CAAC;KACtC,CAAC;IAEF,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,UAAU,CAAC,IAAyC;IAC3D,IAAI,CAAC,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,SAAS,CAAC,yBAAyB,EAAE,CAAC,CAAC;IACvC,uBAAuB,EAAE,CAAC;IAC1B,gBAAgB,EAAE,CAAC;AACrB,CAAC;AAED,SAAS,UAAU,CAAC,IAAyC,EAAE,OAA0B;IACvF,IAAI,4BAA4B,KAAK,aAAa,EAAE,CAAC;QACnD,OAAO;IACT,CAAC;IAED,IAAI,OAAO,EAAE,cAAc,EAAE,CAAC;QAC5B,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAChC,OAAO;IACT,CAAC;IAED,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnC,kBAAkB,CAAC,MAAM,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc,EAAE,OAA0B;IACnE,IAAI,OAAO,EAAE,CAAC;QACZ,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;SAAM,CAAC;QACN,kBAAkB,EAAE,CAAC;IACvB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -2,6 +2,9 @@
|
|
|
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 { resetElementTemplatePatchListener } from './patch-listener.js';
|
|
5
|
+
import { destroyAllElementTemplateListStates } from '../runtime/list/list.js';
|
|
6
|
+
import { resetElementTemplateMainThreadBackgroundFunctionRuntime } from '../runtime/template/main-thread-background-function.js';
|
|
7
|
+
import { clearMainThreadDynamicAttrState } from '../runtime/template/main-thread-dynamic-attr-state.js';
|
|
5
8
|
import { elementTemplateRegistry } from '../runtime/template/registry.js';
|
|
6
9
|
export function installOnMtsDestruction() {
|
|
7
10
|
lynx.getNative?.().addEventListener('__DestroyLifetime', onMtsDestruction);
|
|
@@ -29,7 +32,10 @@ export function destroyElementTemplateMainThreadRuntime() {
|
|
|
29
32
|
}
|
|
30
33
|
// The registry is the main-thread strong-reference owner for ET refs. Clear it
|
|
31
34
|
// even if listener reset fails so destroy does not leave removed pages retained.
|
|
35
|
+
destroyAllElementTemplateListStates();
|
|
32
36
|
elementTemplateRegistry.clear();
|
|
37
|
+
clearMainThreadDynamicAttrState();
|
|
38
|
+
resetElementTemplateMainThreadBackgroundFunctionRuntime();
|
|
33
39
|
if (didPatchListenerResetThrow) {
|
|
34
40
|
throw patchListenerResetError;
|
|
35
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mts-destroy.js","sourceRoot":"","sources":["../../../src/element-template/native/mts-destroy.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,iCAAiC,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE1E,MAAM,UAAU,uBAAuB;IACrC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACrC,WAAW,EAAE,YAAY,EAAE,CAAC,6BAA6B,CAAC,CAAC;IAC3D,IAAI,CAAC;QACH,uCAAuC,EAAE,CAAC;IAC5C,CAAC;YAAS,CAAC;QACT,WAAW,EAAE,UAAU,EAAE,EAAE,CAAC;QAC5B,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,mBAAmB,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;IAChF,CAAC;AACH,CAAC;AAED,MAAM,UAAU,uCAAuC;IACrD,IAAI,uBAAgC,CAAC;IACrC,IAAI,0BAA0B,GAAG,KAAK,CAAC;IACvC,IAAI,CAAC;QACH,iCAAiC,EAAE,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,uBAAuB,GAAG,KAAK,CAAC;QAChC,0BAA0B,GAAG,IAAI,CAAC;IACpC,CAAC;IAED,+EAA+E;IAC/E,iFAAiF;IACjF,uBAAuB,CAAC,KAAK,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"mts-destroy.js","sourceRoot":"","sources":["../../../src/element-template/native/mts-destroy.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,iCAAiC,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,uDAAuD,EAAE,MAAM,wDAAwD,CAAC;AACjI,OAAO,EAAE,+BAA+B,EAAE,MAAM,uDAAuD,CAAC;AACxG,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE1E,MAAM,UAAU,uBAAuB;IACrC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACrC,WAAW,EAAE,YAAY,EAAE,CAAC,6BAA6B,CAAC,CAAC;IAC3D,IAAI,CAAC;QACH,uCAAuC,EAAE,CAAC;IAC5C,CAAC;YAAS,CAAC;QACT,WAAW,EAAE,UAAU,EAAE,EAAE,CAAC;QAC5B,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,mBAAmB,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;IAChF,CAAC;AACH,CAAC;AAED,MAAM,UAAU,uCAAuC;IACrD,IAAI,uBAAgC,CAAC;IACrC,IAAI,0BAA0B,GAAG,KAAK,CAAC;IACvC,IAAI,CAAC;QACH,iCAAiC,EAAE,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,uBAAuB,GAAG,KAAK,CAAC;QAChC,0BAA0B,GAAG,IAAI,CAAC;IACpC,CAAC;IAED,+EAA+E;IAC/E,iFAAiF;IACjF,mCAAmC,EAAE,CAAC;IACtC,uBAAuB,CAAC,KAAK,EAAE,CAAC;IAChC,+BAA+B,EAAE,CAAC;IAClC,uDAAuD,EAAE,CAAC;IAE1D,IAAI,0BAA0B,EAAE,CAAC;QAC/B,MAAM,uBAAuB,CAAC;IAChC,CAAC;AACH,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// Copyright 2024 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 { flushDelayedRunOnBackgroundFunctions, runRunOnMainThreadTask, setEomShouldFlushElementTree, } from '@lynx-js/react/worklet-runtime/bindings';
|
|
5
|
+
import { markTiming, setPipeline } from '../../core/performance.js';
|
|
4
6
|
import { getReloadVersion } from '../../core/reload-version.js';
|
|
5
7
|
import { formatElementTemplateUpdateCommands } from '../debug/alog.js';
|
|
6
|
-
import { markTiming, setPipeline } from '../lynx/performance.js';
|
|
7
8
|
import { ElementTemplateLifecycleConstant } from '../protocol/lifecycle-constant.js';
|
|
8
9
|
import { __page } from '../runtime/page/page.js';
|
|
9
10
|
import { applyElementTemplateUpdateCommands } from '../runtime/patch.js';
|
|
@@ -11,20 +12,13 @@ let listener;
|
|
|
11
12
|
export function installElementTemplatePatchListener() {
|
|
12
13
|
resetElementTemplatePatchListener();
|
|
13
14
|
listener = (event) => {
|
|
14
|
-
const {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const { patchOptions } = event.data;
|
|
16
|
+
if (typeof patchOptions.reloadVersion === 'number'
|
|
17
|
+
&& patchOptions.reloadVersion < getReloadVersion()) {
|
|
17
18
|
return;
|
|
18
19
|
}
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const pipelineOptions = flushOptions.pipelineOptions;
|
|
22
|
-
setPipeline(pipelineOptions);
|
|
23
|
-
const flowIds = Array.isArray(payload?.flowIds) && payload.flowIds.length > 0
|
|
24
|
-
? payload.flowIds
|
|
25
|
-
: undefined;
|
|
26
|
-
const shouldProfilePatch = hasOps
|
|
27
|
-
&& !!flowIds
|
|
20
|
+
const { flowIds, pipelineOptions } = patchOptions;
|
|
21
|
+
const shouldProfilePatch = !!flowIds
|
|
28
22
|
&& typeof lynx.performance?.profileStart === 'function'
|
|
29
23
|
&& typeof lynx.performance?.profileEnd === 'function';
|
|
30
24
|
if (shouldProfilePatch) {
|
|
@@ -33,6 +27,15 @@ export function installElementTemplatePatchListener() {
|
|
|
33
27
|
flowIds,
|
|
34
28
|
});
|
|
35
29
|
}
|
|
30
|
+
setPipeline(pipelineOptions);
|
|
31
|
+
markTiming('mtsRenderStart');
|
|
32
|
+
markTiming('parseChangesStart');
|
|
33
|
+
const payload = JSON.parse(event.data.payload);
|
|
34
|
+
markTiming('parseChangesEnd');
|
|
35
|
+
const hasOps = payload.ops.length > 0;
|
|
36
|
+
const flushOptions = payload.flushOptions;
|
|
37
|
+
const isHydration = payload.isHydration === true;
|
|
38
|
+
const delayedRunOnMainThreadData = payload.delayedRunOnMainThreadData;
|
|
36
39
|
if (hasOps) {
|
|
37
40
|
if (typeof __ALOG__ !== 'undefined' && __ALOG__) {
|
|
38
41
|
console.alog?.('[ReactLynxDebug] ElementTemplate main-thread patch:\n'
|
|
@@ -42,16 +45,38 @@ export function installElementTemplatePatchListener() {
|
|
|
42
45
|
flowIds,
|
|
43
46
|
}, null, 2));
|
|
44
47
|
}
|
|
45
|
-
markTiming('mtsRenderStart');
|
|
46
|
-
markTiming('parseChangesStart');
|
|
47
|
-
markTiming('parseChangesEnd');
|
|
48
48
|
markTiming('patchChangesStart');
|
|
49
49
|
try {
|
|
50
|
-
applyElementTemplateUpdateCommands(payload.ops);
|
|
50
|
+
applyElementTemplateUpdateCommands(payload.ops, isHydration);
|
|
51
51
|
}
|
|
52
52
|
finally {
|
|
53
53
|
markTiming('patchChangesEnd');
|
|
54
54
|
markTiming('mtsRenderEnd');
|
|
55
|
+
if (isHydration) {
|
|
56
|
+
flushDelayedRunOnBackgroundFunctions();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
markTiming('mtsRenderEnd');
|
|
62
|
+
if (isHydration) {
|
|
63
|
+
flushDelayedRunOnBackgroundFunctions();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (delayedRunOnMainThreadData?.length) {
|
|
67
|
+
setEomShouldFlushElementTree(false);
|
|
68
|
+
try {
|
|
69
|
+
for (const data of delayedRunOnMainThreadData) {
|
|
70
|
+
try {
|
|
71
|
+
runRunOnMainThreadTask(data.worklet, data.params, data.resolveId);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
lynx.reportError(error);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
finally {
|
|
79
|
+
setEomShouldFlushElementTree(true);
|
|
55
80
|
}
|
|
56
81
|
}
|
|
57
82
|
__FlushElementTree(__page, flushOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch-listener.js","sourceRoot":"","sources":["../../../src/element-template/native/patch-listener.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;
|
|
1
|
+
{"version":3,"file":"patch-listener.js","sourceRoot":"","sources":["../../../src/element-template/native/patch-listener.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAG1D,OAAO,EACL,oCAAoC,EACpC,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,mCAAmC,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AAGrF,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAC;AAEzE,IAAI,QAES,CAAC;AAEd,MAAM,UAAU,mCAAmC;IACjD,iCAAiC,EAAE,CAAC;IAEpC,QAAQ,GAAG,CAAC,KAA+C,EAAE,EAAE;QAC7D,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;QACpC,IACE,OAAO,YAAY,CAAC,aAAa,KAAK,QAAQ;eAC3C,YAAY,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/C,IAAI,QAAQ,EAAE,CAAC;QACb,IAAI,CAAC,YAAY,EAAE,CAAC,mBAAmB,CACrC,gCAAgC,CAAC,MAAM,EACvC,QAAQ,CACT,CAAC;IACJ,CAAC;IACD,QAAQ,GAAG,SAAS,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function reloadBackground(updateData: unknown): void;
|
|
@@ -10,32 +10,7 @@ import { installElementTemplateHydrationListener } from '../background/hydration
|
|
|
10
10
|
import { BackgroundElementTemplateInstance } from '../background/instance.js';
|
|
11
11
|
import { profileEnd, profileStart } from '../debug/profile.js';
|
|
12
12
|
import { resetEventStateForRuntime } from '../prop-adapters/event.js';
|
|
13
|
-
import { __page } from '../runtime/page/page.js';
|
|
14
13
|
import { __root, setRoot } from '../runtime/page/root-instance.js';
|
|
15
|
-
import { removeMainThreadRootRefs, renderMainThread } from '../runtime/render/render-main-thread.js';
|
|
16
|
-
import { resetTemplateId } from '../runtime/template/handle.js';
|
|
17
|
-
import { elementTemplateRegistry } from '../runtime/template/registry.js';
|
|
18
|
-
export function reloadMainThread(data, options) {
|
|
19
|
-
if (typeof __PROFILE__ !== 'undefined' && __PROFILE__) {
|
|
20
|
-
profileStart('ReactLynx::reloadMainThread');
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
increaseReloadVersion();
|
|
24
|
-
applyUpdatePageData(data, options);
|
|
25
|
-
elementTemplateRegistry.clear();
|
|
26
|
-
resetTemplateId();
|
|
27
|
-
const oldRoot = __root;
|
|
28
|
-
removeMainThreadRootRefs();
|
|
29
|
-
setRoot({ __jsx: oldRoot.__jsx });
|
|
30
|
-
renderMainThread();
|
|
31
|
-
__FlushElementTree(__page, options);
|
|
32
|
-
}
|
|
33
|
-
finally {
|
|
34
|
-
if (typeof __PROFILE__ !== 'undefined' && __PROFILE__) {
|
|
35
|
-
profileEnd();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
14
|
export function reloadBackground(updateData) {
|
|
40
15
|
if (typeof __PROFILE__ !== 'undefined' && __PROFILE__) {
|
|
41
16
|
profileStart('ReactLynx::reloadBackground');
|
|
@@ -61,4 +36,4 @@ export function reloadBackground(updateData) {
|
|
|
61
36
|
}
|
|
62
37
|
}
|
|
63
38
|
}
|
|
64
|
-
//# sourceMappingURL=reload.js.map
|
|
39
|
+
//# sourceMappingURL=reload-background.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reload-background.js","sourceRoot":"","sources":["../../../src/element-template/native/reload-background.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAG1D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,uCAAuC,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,sCAAsC,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,uCAAuC,EAAE,MAAM,qCAAqC,CAAC;AAC9F,OAAO,EAAE,iCAAiC,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAEnE,MAAM,UAAU,gBAAgB,CAAC,UAAmB;IAClD,IAAI,OAAO,WAAW,KAAK,WAAW,IAAI,WAAW,EAAE,CAAC;QACtD,YAAY,CAAC,6BAA6B,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC;QACzB,uCAAuC,EAAE,CAAC;QAC1C,qBAAqB,EAAE,CAAC;QACxB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