@lynx-js/react 0.120.0 → 0.121.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 +52 -0
- package/package.json +35 -7
- package/runtime/lazy/compat.js +1 -0
- package/runtime/lazy/react.js +1 -0
- package/runtime/lib/core/hooks/mainThread.d.ts +1 -0
- package/runtime/lib/core/hooks/mainThread.js +7 -0
- package/runtime/lib/core/hooks/mainThread.js.map +1 -0
- package/runtime/lib/{snapshot/hooks/mainThread.d.ts → core/hooks/mainThreadImpl.d.ts} +2 -1
- package/runtime/lib/{snapshot/hooks/mainThread.js → core/hooks/mainThreadImpl.js} +45 -34
- package/runtime/lib/core/hooks/mainThreadImpl.js.map +1 -0
- package/runtime/lib/{snapshot → core}/hooks/react.js +1 -1
- package/runtime/lib/core/hooks/react.js.map +1 -0
- package/runtime/lib/{snapshot → core}/hooks/useLynxGlobalEventListener.d.ts +1 -1
- package/runtime/lib/{snapshot → core}/hooks/useLynxGlobalEventListener.js +1 -1
- package/runtime/lib/core/hooks/useLynxGlobalEventListener.js.map +1 -0
- package/runtime/lib/element-template/background/attr-slots.d.ts +2 -0
- package/runtime/lib/element-template/background/attr-slots.js +34 -0
- package/runtime/lib/element-template/background/attr-slots.js.map +1 -0
- package/runtime/lib/element-template/background/commit-context.d.ts +13 -0
- package/runtime/lib/element-template/background/commit-context.js +25 -0
- package/runtime/lib/element-template/background/commit-context.js.map +1 -0
- package/runtime/lib/element-template/background/commit-hook.d.ts +7 -0
- package/runtime/lib/element-template/background/commit-hook.js +96 -0
- package/runtime/lib/element-template/background/commit-hook.js.map +1 -0
- package/runtime/lib/element-template/background/destroy.d.ts +1 -0
- package/runtime/lib/element-template/background/destroy.js +17 -0
- package/runtime/lib/element-template/background/destroy.js.map +1 -0
- package/runtime/lib/element-template/background/document.d.ts +7 -0
- package/runtime/lib/element-template/background/document.js +27 -0
- package/runtime/lib/element-template/background/document.js.map +1 -0
- package/runtime/lib/element-template/background/hydrate.d.ts +4 -0
- package/runtime/lib/element-template/background/hydrate.js +219 -0
- package/runtime/lib/element-template/background/hydrate.js.map +1 -0
- package/runtime/lib/element-template/background/hydration-listener.d.ts +2 -0
- package/runtime/lib/element-template/background/hydration-listener.js +93 -0
- package/runtime/lib/element-template/background/hydration-listener.js.map +1 -0
- package/runtime/lib/element-template/background/instance.d.ts +39 -0
- package/runtime/lib/element-template/background/instance.js +349 -0
- package/runtime/lib/element-template/background/instance.js.map +1 -0
- package/runtime/lib/element-template/background/manager.d.ts +10 -0
- package/runtime/lib/element-template/background/manager.js +60 -0
- package/runtime/lib/element-template/background/manager.js.map +1 -0
- package/runtime/lib/element-template/client/root.d.ts +36 -0
- package/runtime/lib/element-template/client/root.js +33 -0
- package/runtime/lib/element-template/client/root.js.map +1 -0
- package/runtime/lib/element-template/debug/alog.d.ts +34 -0
- package/runtime/lib/element-template/debug/alog.js +93 -0
- package/runtime/lib/element-template/debug/alog.js.map +1 -0
- package/runtime/lib/element-template/debug/elementPAPICall.d.ts +1 -0
- package/runtime/lib/element-template/debug/elementPAPICall.js +75 -0
- package/runtime/lib/element-template/debug/elementPAPICall.js.map +1 -0
- package/runtime/lib/element-template/debug/profile.d.ts +3 -0
- package/runtime/lib/element-template/debug/profile.js +141 -0
- package/runtime/lib/element-template/debug/profile.js.map +1 -0
- package/runtime/lib/element-template/hooks/react.d.ts +14 -0
- package/runtime/lib/element-template/hooks/react.js +24 -0
- package/runtime/lib/element-template/hooks/react.js.map +1 -0
- package/runtime/lib/element-template/index.d.ts +7 -0
- package/runtime/lib/element-template/index.js +45 -0
- package/runtime/lib/element-template/index.js.map +1 -0
- package/runtime/lib/element-template/internal.d.ts +6 -0
- package/runtime/lib/element-template/internal.js +44 -0
- package/runtime/lib/element-template/internal.js.map +1 -0
- package/runtime/lib/element-template/jsx-dev-runtime/index.d.ts +1 -0
- package/runtime/lib/element-template/jsx-dev-runtime/index.js +5 -0
- package/runtime/lib/element-template/jsx-dev-runtime/index.js.map +1 -0
- package/runtime/lib/element-template/jsx-runtime/index.d.ts +19 -0
- package/runtime/lib/element-template/jsx-runtime/index.js +60 -0
- package/runtime/lib/element-template/jsx-runtime/index.js.map +1 -0
- package/runtime/lib/element-template/lynx/env.d.ts +1 -0
- package/runtime/lib/element-template/lynx/env.js +89 -0
- package/runtime/lib/element-template/lynx/env.js.map +1 -0
- package/runtime/lib/element-template/lynx/performance.d.ts +23 -0
- package/runtime/lib/element-template/lynx/performance.js +135 -0
- package/runtime/lib/element-template/lynx/performance.js.map +1 -0
- package/runtime/lib/element-template/native/callDestroyLifetimeFun.d.ts +1 -0
- package/runtime/lib/element-template/native/callDestroyLifetimeFun.js +8 -0
- package/runtime/lib/element-template/native/callDestroyLifetimeFun.js.map +1 -0
- package/runtime/lib/element-template/native/index.d.ts +1 -0
- package/runtime/lib/element-template/native/index.js +53 -0
- package/runtime/lib/element-template/native/index.js.map +1 -0
- package/runtime/lib/element-template/native/main-thread-api.d.ts +2 -0
- package/runtime/lib/element-template/native/main-thread-api.js +27 -0
- package/runtime/lib/element-template/native/main-thread-api.js.map +1 -0
- package/runtime/lib/element-template/native/mts-destroy.d.ts +3 -0
- package/runtime/lib/element-template/native/mts-destroy.js +37 -0
- package/runtime/lib/element-template/native/mts-destroy.js.map +1 -0
- package/runtime/lib/element-template/native/patch-listener.d.ts +2 -0
- package/runtime/lib/element-template/native/patch-listener.js +66 -0
- package/runtime/lib/element-template/native/patch-listener.js.map +1 -0
- package/runtime/lib/element-template/prop-adapters/event-value.d.ts +1 -0
- package/runtime/lib/element-template/prop-adapters/event-value.js +7 -0
- package/runtime/lib/element-template/prop-adapters/event-value.js.map +1 -0
- package/runtime/lib/element-template/prop-adapters/event.d.ts +7 -0
- package/runtime/lib/element-template/prop-adapters/event.js +61 -0
- package/runtime/lib/element-template/prop-adapters/event.js.map +1 -0
- package/runtime/lib/element-template/prop-adapters/spread.d.ts +5 -0
- package/runtime/lib/element-template/prop-adapters/spread.js +45 -0
- package/runtime/lib/element-template/prop-adapters/spread.js.map +1 -0
- package/runtime/lib/element-template/protocol/lifecycle-constant.d.ts +4 -0
- package/runtime/lib/element-template/protocol/lifecycle-constant.js +9 -0
- package/runtime/lib/element-template/protocol/lifecycle-constant.js.map +1 -0
- package/runtime/lib/element-template/protocol/opcodes.d.ts +7 -0
- package/runtime/lib/element-template/protocol/opcodes.js +10 -0
- package/runtime/lib/element-template/protocol/opcodes.js.map +1 -0
- package/runtime/lib/element-template/protocol/types.d.ts +50 -0
- package/runtime/lib/element-template/protocol/types.js +5 -0
- package/runtime/lib/element-template/protocol/types.js.map +1 -0
- package/runtime/lib/element-template/runtime/components/slot.d.ts +1 -0
- package/runtime/lib/element-template/runtime/components/slot.js +11 -0
- package/runtime/lib/element-template/runtime/components/slot.js.map +1 -0
- package/runtime/lib/element-template/runtime/page/page.d.ts +2 -0
- package/runtime/lib/element-template/runtime/page/page.js +8 -0
- package/runtime/lib/element-template/runtime/page/page.js.map +1 -0
- package/runtime/lib/element-template/runtime/page/root-instance.d.ts +10 -0
- package/runtime/lib/element-template/runtime/page/root-instance.js +17 -0
- package/runtime/lib/element-template/runtime/page/root-instance.js.map +1 -0
- package/runtime/lib/element-template/runtime/patch.d.ts +3 -0
- package/runtime/lib/element-template/runtime/patch.js +145 -0
- package/runtime/lib/element-template/runtime/patch.js.map +1 -0
- package/runtime/lib/element-template/runtime/render/render-main-thread.d.ts +2 -0
- package/runtime/lib/element-template/runtime/render/render-main-thread.js +53 -0
- package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -0
- package/runtime/lib/element-template/runtime/render/render-opcodes.d.ts +4 -0
- package/runtime/lib/element-template/runtime/render/render-opcodes.js +134 -0
- package/runtime/lib/element-template/runtime/render/render-opcodes.js.map +1 -0
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.d.ts +14 -0
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.js +272 -0
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.js.map +1 -0
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.d.ts +11 -0
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.js +23 -0
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.js.map +1 -0
- package/runtime/lib/element-template/runtime/template/handle.d.ts +5 -0
- package/runtime/lib/element-template/runtime/template/handle.js +23 -0
- package/runtime/lib/element-template/runtime/template/handle.js.map +1 -0
- package/runtime/lib/element-template/runtime/template/registry.d.ts +13 -0
- package/runtime/lib/element-template/runtime/template/registry.js +46 -0
- package/runtime/lib/element-template/runtime/template/registry.js.map +1 -0
- package/runtime/lib/index.d.ts +5 -3
- package/runtime/lib/index.js +7 -4
- package/runtime/lib/index.js.map +1 -1
- package/runtime/lib/internal.d.ts +2 -3
- package/runtime/lib/internal.js +3 -4
- package/runtime/lib/internal.js.map +1 -1
- package/runtime/lib/lynx-api.d.ts +1 -1
- package/runtime/lib/lynx-api.js +3 -3
- package/runtime/lib/lynx-api.js.map +1 -1
- package/runtime/lib/lynx.d.ts +1 -1
- package/runtime/lib/lynx.js +3 -3
- package/runtime/lib/lynx.js.map +1 -1
- package/runtime/lib/{snapshot/debug → shared}/component-stack.js +1 -1
- package/runtime/lib/shared/component-stack.js.map +1 -0
- package/runtime/lib/{snapshot/debug → shared}/profile.js +6 -4
- package/runtime/lib/shared/profile.js.map +1 -0
- package/runtime/lib/{snapshot/renderToOpcodes/constants.js → shared/render-constants.js} +1 -1
- package/runtime/lib/shared/render-constants.js.map +1 -0
- package/runtime/lib/snapshot/alog/elementPAPICall.js +1 -1
- package/runtime/lib/snapshot/alog/elementPAPICall.js.map +1 -1
- package/runtime/lib/snapshot/alog/render.js +1 -1
- package/runtime/lib/snapshot/alog/render.js.map +1 -1
- package/runtime/lib/snapshot/compat/initData.d.ts +2 -2
- package/runtime/lib/snapshot/compat/initData.js +1 -1
- package/runtime/lib/snapshot/compat/initData.js.map +1 -1
- package/runtime/lib/snapshot/debug/profileHooks.js +1 -1
- package/runtime/lib/snapshot/debug/profileHooks.js.map +1 -1
- package/runtime/lib/snapshot/debug/vnodeSource.js +1 -1
- package/runtime/lib/snapshot/debug/vnodeSource.js.map +1 -1
- package/runtime/lib/snapshot/gesture/processGesture.d.ts +2 -0
- package/runtime/lib/snapshot/gesture/processGesture.js +16 -1
- package/runtime/lib/snapshot/gesture/processGesture.js.map +1 -1
- package/runtime/lib/snapshot/legacy-react-runtime/index.d.ts +2 -2
- package/runtime/lib/snapshot/legacy-react-runtime/index.js +2 -2
- package/runtime/lib/snapshot/legacy-react-runtime/index.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/destroy.js +1 -1
- package/runtime/lib/snapshot/lifecycle/destroy.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/event/jsReady.js +1 -1
- package/runtime/lib/snapshot/lifecycle/event/jsReady.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/isRendering.js +1 -1
- package/runtime/lib/snapshot/lifecycle/isRendering.js.map +1 -1
- 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/nodesRefApply.d.ts +15 -0
- package/runtime/lib/snapshot/lifecycle/patch/nodesRefApply.js +102 -0
- package/runtime/lib/snapshot/lifecycle/patch/nodesRefApply.js.map +1 -0
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.d.ts +2 -0
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js +17 -0
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js +26 -0
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/ref/delay.d.ts +1 -0
- package/runtime/lib/snapshot/lifecycle/ref/delay.js +5 -3
- package/runtime/lib/snapshot/lifecycle/ref/delay.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/reload.js +1 -1
- package/runtime/lib/snapshot/lifecycle/reload.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/render.js +1 -1
- package/runtime/lib/snapshot/lifecycle/render.js.map +1 -1
- package/runtime/lib/snapshot/list/list.js +4 -1
- package/runtime/lib/snapshot/list/list.js.map +1 -1
- package/runtime/lib/snapshot/list/listUpdateInfo.js +1 -1
- package/runtime/lib/snapshot/list/listUpdateInfo.js.map +1 -1
- package/runtime/lib/snapshot/lynx/component.js +1 -1
- package/runtime/lib/snapshot/lynx/component.js.map +1 -1
- package/runtime/lib/snapshot/lynx/element.d.ts +6 -0
- package/runtime/lib/snapshot/lynx/element.js +35 -0
- package/runtime/lib/snapshot/lynx/element.js.map +1 -0
- package/runtime/lib/snapshot/lynx/env.js +1 -1
- package/runtime/lib/snapshot/lynx/env.js.map +1 -1
- package/runtime/lib/snapshot/lynx/nodesRef.d.ts +6 -0
- package/runtime/lib/snapshot/lynx/nodesRef.js +31 -0
- package/runtime/lib/snapshot/lynx/nodesRef.js.map +1 -0
- package/runtime/lib/snapshot/lynx/performance.js +1 -1
- package/runtime/lib/snapshot/lynx/performance.js.map +1 -1
- package/runtime/lib/snapshot/lynx/portals.d.ts +9 -0
- package/runtime/lib/snapshot/lynx/portals.js +120 -0
- package/runtime/lib/snapshot/lynx/portals.js.map +1 -0
- package/runtime/lib/snapshot/lynx/portalsPending.d.ts +10 -0
- package/runtime/lib/snapshot/lynx/portalsPending.js +38 -0
- package/runtime/lib/snapshot/lynx/portalsPending.js.map +1 -0
- package/runtime/lib/snapshot/lynx/runWithForce.js +1 -1
- package/runtime/lib/snapshot/lynx/runWithForce.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/renderToOpcodes/hydrate.js +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/hydrate.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/index.js +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/index.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/opcodes.js +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/opcodes.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.d.ts +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js +20 -21
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/constants.d.ts +4 -0
- package/runtime/lib/snapshot/snapshot/constants.js +4 -0
- package/runtime/lib/snapshot/snapshot/constants.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/definition.d.ts +1 -0
- package/runtime/lib/snapshot/snapshot/definition.js +49 -1
- package/runtime/lib/snapshot/snapshot/definition.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/dynamicPartType.d.ts +12 -0
- package/runtime/lib/snapshot/snapshot/dynamicPartType.js +12 -0
- package/runtime/lib/snapshot/snapshot/dynamicPartType.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/event.d.ts +1 -1
- package/runtime/lib/snapshot/snapshot/event.js +0 -4
- package/runtime/lib/snapshot/snapshot/event.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/gesture.js +9 -3
- package/runtime/lib/snapshot/snapshot/gesture.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/reconstructInstanceTree.d.ts +14 -0
- package/runtime/lib/snapshot/snapshot/reconstructInstanceTree.js +27 -0
- package/runtime/lib/snapshot/snapshot/reconstructInstanceTree.js.map +1 -0
- package/runtime/lib/snapshot/snapshot/snapshot.js +62 -3
- package/runtime/lib/snapshot/snapshot/snapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/spread.d.ts +1 -1
- package/runtime/lib/snapshot/snapshot/spread.js +32 -1
- package/runtime/lib/snapshot/snapshot/spread.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/utils.d.ts +1 -3
- package/runtime/lib/snapshot/snapshot/utils.js +5 -0
- package/runtime/lib/snapshot/snapshot/utils.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/workletEvent.d.ts +1 -1
- package/runtime/lib/snapshot/snapshot/workletEvent.js +10 -5
- package/runtime/lib/snapshot/snapshot/workletEvent.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/workletRef.d.ts +1 -1
- package/runtime/lib/snapshot/snapshot/workletRef.js +6 -3
- package/runtime/lib/snapshot/snapshot/workletRef.js.map +1 -1
- package/runtime/lib/snapshot/worklet/ref/workletRef.js +1 -1
- package/runtime/lib/snapshot/worklet/ref/workletRef.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -1
- package/runtime/lib/utils.js +1 -1
- package/runtime/lib/utils.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/observers.d.ts +1 -0
- package/runtime/lib/worklet-runtime/bindings/observers.js +5 -3
- package/runtime/lib/worklet-runtime/bindings/observers.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/types.d.ts +1 -1
- package/runtime/lib/worklet-runtime/bindings/types.js.map +1 -1
- package/runtime/lib/worklet-runtime/hydrate.js +1 -1
- package/runtime/lib/worklet-runtime/hydrate.js.map +1 -1
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.d.ts +1 -0
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js +5 -0
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js.map +1 -1
- package/runtime/lib/worklet-runtime/workletRuntime.js +1 -2
- package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
- package/runtime/worklet-runtime/dev.js +8 -4
- package/runtime/worklet-runtime/main.js +1 -1
- package/testing-library/dist/env/index.js +25 -7
- package/testing-library/dist/fire-event.d.ts +21 -7
- package/testing-library/dist/index.d.ts +2 -0
- package/testing-library/dist/pure.js +27 -9
- package/testing-library/dist/type-entry/index.js +0 -0
- package/transform/dist/wasm.cjs +833 -285
- package/transform/index.d.ts +28 -1
- package/types/react.docs.d.ts +9 -1
- package/refresh/.gitignore +0 -1
- package/refresh/.npmignore +0 -3
- package/refresh/.turbo/turbo-build.log +0 -12
- package/refresh/package.json +0 -20
- package/refresh/rslib.config.ts +0 -24
- package/refresh/tsconfig.json +0 -4
- package/refresh/turbo.json +0 -15
- package/runtime/lib/snapshot/debug/component-stack.js.map +0 -1
- package/runtime/lib/snapshot/debug/profile.js.map +0 -1
- package/runtime/lib/snapshot/hooks/mainThread.js.map +0 -1
- package/runtime/lib/snapshot/hooks/react.js.map +0 -1
- package/runtime/lib/snapshot/hooks/useLynxGlobalEventListener.js.map +0 -1
- package/runtime/lib/snapshot/renderToOpcodes/constants.js.map +0 -1
- package/testing-library/README.md +0 -109
- /package/runtime/lib/{snapshot → core}/hooks/react.d.ts +0 -0
- /package/runtime/lib/{snapshot/debug → shared}/component-stack.d.ts +0 -0
- /package/runtime/lib/{snapshot/debug → shared}/profile.d.ts +0 -0
- /package/runtime/lib/{snapshot/renderToOpcodes/constants.d.ts → shared/render-constants.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# @lynx-js/react
|
|
2
2
|
|
|
3
|
+
## 0.121.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Support `React.createElement(type, props, children)` API. ([#2360](https://github.com/lynx-family/lynx-stack/pull/2360))
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
React.createElement('view', { style }, <text>hello</text>);
|
|
11
|
+
// equivalent to
|
|
12
|
+
<view style={style}>
|
|
13
|
+
<text>hello</text>
|
|
14
|
+
</view>;
|
|
15
|
+
|
|
16
|
+
React.createElement(MyComponent, { style }, <view />);
|
|
17
|
+
// equivalent to
|
|
18
|
+
<MyComponent style={style}>
|
|
19
|
+
<view />
|
|
20
|
+
</MyComponent>;
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Clear transient snapshot child props when removed snapshot subtrees are detached, preventing compiled `$*` child references from retaining deleted list holder or list item subtrees after removal. ([#2590](https://github.com/lynx-family/lynx-stack/pull/2590))
|
|
26
|
+
|
|
27
|
+
- Add `createPortal` for rendering a subtree into a different ReactLynx element identified by a `NodesRef`. ([#2543](https://github.com/lynx-family/lynx-stack/pull/2543))
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
function App() {
|
|
31
|
+
const [host, setHost] = useState(null);
|
|
32
|
+
return (
|
|
33
|
+
<view>
|
|
34
|
+
<view ref={setHost} />
|
|
35
|
+
{host && createPortal(<text>hi</text>, host)}
|
|
36
|
+
</view>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- Default `fireEvent` to `bubbles: true` for the TouchEvent family in testing-library to match Lynx runtime semantics, and stop reassigning the read-only `Event.prototype` accessors which threw `TypeError` in strict mode. ([#2532](https://github.com/lynx-family/lynx-stack/pull/2532))
|
|
42
|
+
|
|
43
|
+
- Set `bundle-url` on lazy bundle border elements. ([#2537](https://github.com/lynx-family/lynx-stack/pull/2537))
|
|
44
|
+
|
|
45
|
+
- Stop warning when `runWorklet` receives an invalid or missing main-thread function object. Invalid worklet contexts are still ignored, but nullish handler values no longer produce noisy `MainThreadFunction: Invalid function object` console output. ([#2586](https://github.com/lynx-family/lynx-stack/pull/2586))
|
|
46
|
+
|
|
47
|
+
- Retain main-thread worklet context references before offscreen snapshot elements are materialized, so event, ref, gesture, and spread callbacks stay alive until the DOM update path can attach them. ([#2592](https://github.com/lynx-family/lynx-stack/pull/2592))
|
|
48
|
+
|
|
49
|
+
- Update the @lynx-js/tasm dependency to 0.0.39 and align React template attribute descriptors with it. ([#2643](https://github.com/lynx-family/lynx-stack/pull/2643))
|
|
50
|
+
|
|
51
|
+
- Avoid retaining transformed nested worklet contexts after worklet transformation. ([#2591](https://github.com/lynx-family/lynx-stack/pull/2591))
|
|
52
|
+
|
|
53
|
+
Nested worklets transformed by the worklet runtime now keep their context recovery metadata through a weak reference, preventing cached transformed worklet functions from keeping list-item worklet contexts alive.
|
|
54
|
+
|
|
3
55
|
## 0.120.0
|
|
4
56
|
|
|
5
57
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.121.0",
|
|
4
4
|
"description": "ReactLynx is a framework for developing Lynx applications with familiar React.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,6 +37,22 @@
|
|
|
37
37
|
"types": "./runtime/lib/document.d.ts",
|
|
38
38
|
"default": "./runtime/lib/document.js"
|
|
39
39
|
},
|
|
40
|
+
"./element-template": {
|
|
41
|
+
"types": "./runtime/lib/element-template/index.d.ts",
|
|
42
|
+
"default": "./runtime/lib/element-template/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./element-template/internal": {
|
|
45
|
+
"types": "./runtime/lib/element-template/internal.d.ts",
|
|
46
|
+
"default": "./runtime/lib/element-template/internal.js"
|
|
47
|
+
},
|
|
48
|
+
"./element-template/jsx-runtime": {
|
|
49
|
+
"types": "./runtime/lib/element-template/jsx-runtime/index.d.ts",
|
|
50
|
+
"default": "./runtime/lib/element-template/jsx-runtime/index.js"
|
|
51
|
+
},
|
|
52
|
+
"./element-template/jsx-dev-runtime": {
|
|
53
|
+
"types": "./runtime/lib/element-template/jsx-dev-runtime/index.d.ts",
|
|
54
|
+
"default": "./runtime/lib/element-template/jsx-dev-runtime/index.js"
|
|
55
|
+
},
|
|
40
56
|
"./jsx-runtime": {
|
|
41
57
|
"types": "./runtime/jsx-runtime/index.d.ts",
|
|
42
58
|
"lazy": "./runtime/lazy/jsx-runtime.js",
|
|
@@ -56,12 +72,12 @@
|
|
|
56
72
|
"default": "./runtime/lepus/jsx-runtime/index.js"
|
|
57
73
|
},
|
|
58
74
|
"./hooks": {
|
|
59
|
-
"types": "./runtime/lib/
|
|
60
|
-
"default": "./runtime/lib/
|
|
75
|
+
"types": "./runtime/lib/core/hooks/react.d.ts",
|
|
76
|
+
"default": "./runtime/lib/core/hooks/react.js"
|
|
61
77
|
},
|
|
62
78
|
"./lepus/hooks": {
|
|
63
|
-
"types": "./runtime/lib/
|
|
64
|
-
"default": "./runtime/lib/
|
|
79
|
+
"types": "./runtime/lib/core/hooks/react.d.ts",
|
|
80
|
+
"default": "./runtime/lib/core/hooks/mainThread.js"
|
|
65
81
|
},
|
|
66
82
|
"./lepus": {
|
|
67
83
|
"types": "./runtime/lepus/index.d.ts",
|
|
@@ -132,10 +148,10 @@
|
|
|
132
148
|
"./runtime/lazy/import.d.ts"
|
|
133
149
|
],
|
|
134
150
|
"hooks": [
|
|
135
|
-
"./runtime/lib/
|
|
151
|
+
"./runtime/lib/core/hooks/react.d.ts"
|
|
136
152
|
],
|
|
137
153
|
"lepus/hooks": [
|
|
138
|
-
"./runtime/lib/
|
|
154
|
+
"./runtime/lib/core/hooks/react.d.ts"
|
|
139
155
|
],
|
|
140
156
|
"internal": [
|
|
141
157
|
"./runtime/lib/internal.d.ts"
|
|
@@ -143,6 +159,18 @@
|
|
|
143
159
|
"internal/document": [
|
|
144
160
|
"./runtime/lib/document.d.ts"
|
|
145
161
|
],
|
|
162
|
+
"element-template": [
|
|
163
|
+
"./runtime/lib/element-template/index.d.ts"
|
|
164
|
+
],
|
|
165
|
+
"element-template/internal": [
|
|
166
|
+
"./runtime/lib/element-template/internal.d.ts"
|
|
167
|
+
],
|
|
168
|
+
"element-template/jsx-runtime": [
|
|
169
|
+
"./runtime/lib/element-template/jsx-runtime/index.d.ts"
|
|
170
|
+
],
|
|
171
|
+
"element-template/jsx-dev-runtime": [
|
|
172
|
+
"./runtime/lib/element-template/jsx-dev-runtime/index.d.ts"
|
|
173
|
+
],
|
|
146
174
|
"jsx-runtime": [
|
|
147
175
|
"./runtime/jsx-runtime/index.d.ts"
|
|
148
176
|
],
|
package/runtime/lazy/compat.js
CHANGED
package/runtime/lazy/react.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './mainThreadImpl.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Copyright 2026 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
import { installMainThreadHooks } from './mainThreadImpl.js';
|
|
5
|
+
installMainThreadHooks();
|
|
6
|
+
export * from './mainThreadImpl.js';
|
|
7
|
+
//# sourceMappingURL=mainThread.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mainThread.js","sourceRoot":"","sources":["../../../src/core/hooks/mainThread.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,sBAAsB,EAAE,CAAC;AAEzB,cAAc,qBAAqB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ErrorInfo, PreactContext } from 'preact';
|
|
2
2
|
import type { Dispatch, useEffect as useEffectType, useErrorBoundary as useErrorBoundaryType, useImperativeHandle as useImperativeHandleType, useLayoutEffect as useLayoutEffectType } from 'preact/hooks';
|
|
3
|
+
declare function installMainThreadHooks(): void;
|
|
3
4
|
declare function useState<S>(initialState: S | (() => S)): [S, Dispatch<unknown>];
|
|
4
5
|
declare function useReducer<S, A>(_reducer: (prevState: S, action: A) => S, initialState: S | (() => S), init?: (initialState: S) => S): [S, Dispatch<A>];
|
|
5
6
|
declare function useRef<T>(initialValue?: T): {
|
|
@@ -14,4 +15,4 @@ declare function useId(): string;
|
|
|
14
15
|
declare const useEffect: typeof useEffectType;
|
|
15
16
|
declare const useLayoutEffect: typeof useLayoutEffectType;
|
|
16
17
|
declare const useImperativeHandle: typeof useImperativeHandleType;
|
|
17
|
-
export { useCallback, useContext, useDebugValue, useEffect, useErrorBoundary, useId, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, };
|
|
18
|
+
export { installMainThreadHooks, useCallback, useContext, useDebugValue, useEffect, useErrorBoundary, useId, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, };
|
|
@@ -2,48 +2,59 @@
|
|
|
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
|
/**
|
|
5
|
-
* Implements hooks in main thread.
|
|
5
|
+
* Implements hooks in the main thread.
|
|
6
6
|
* This module is modified from preact/hooks
|
|
7
7
|
*
|
|
8
8
|
* internal-preact/hooks/dist/hooks.mjs
|
|
9
9
|
*/
|
|
10
10
|
import { options } from 'preact';
|
|
11
|
+
import { CHILDREN, COMPONENT, DIFF, DIFFED, HOOK, HOOKS, LIST, MASK, PARENT, PENDING_EFFECTS, RENDER, ROOT, VALUE, VNODE, } from '../../shared/render-constants.js';
|
|
11
12
|
import { noop } from '../../utils.js';
|
|
12
|
-
import { CHILDREN, COMPONENT, DIFF, DIFFED, HOOK, HOOKS, LIST, MASK, PARENT, PENDING_EFFECTS, RENDER, ROOT, VALUE, VNODE, } from '../renderToOpcodes/constants.js';
|
|
13
13
|
let currentIndex;
|
|
14
14
|
let currentComponent;
|
|
15
15
|
let currentHook;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
/* v8 ignore start */
|
|
26
|
-
options[ROOT] = function (vnode, parentDom) {
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
28
|
-
if (vnode && parentDom[CHILDREN] && parentDom[CHILDREN][MASK]) {
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
30
|
-
vnode[MASK] = parentDom[CHILDREN][MASK];
|
|
16
|
+
let hooksInstalled = false;
|
|
17
|
+
let oldBeforeDiff;
|
|
18
|
+
let oldBeforeRender;
|
|
19
|
+
let oldAfterDiff;
|
|
20
|
+
let oldRoot;
|
|
21
|
+
function installMainThreadHooks() {
|
|
22
|
+
if (hooksInstalled) {
|
|
23
|
+
return;
|
|
31
24
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
options[
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
25
|
+
hooksInstalled = true;
|
|
26
|
+
oldBeforeDiff = options[DIFF];
|
|
27
|
+
oldBeforeRender = options[RENDER];
|
|
28
|
+
oldAfterDiff = options[DIFFED];
|
|
29
|
+
oldRoot = options[ROOT];
|
|
30
|
+
options[DIFF] = function (vnode) {
|
|
31
|
+
currentComponent = null;
|
|
32
|
+
if (oldBeforeDiff)
|
|
33
|
+
oldBeforeDiff(vnode);
|
|
34
|
+
};
|
|
35
|
+
/* v8 ignore start */
|
|
36
|
+
options[ROOT] = function (vnode, parentDom) {
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
38
|
+
if (vnode && parentDom[CHILDREN] && parentDom[CHILDREN][MASK]) {
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
40
|
+
vnode[MASK] = parentDom[CHILDREN][MASK];
|
|
41
|
+
}
|
|
42
|
+
if (oldRoot)
|
|
43
|
+
oldRoot(vnode, parentDom);
|
|
44
|
+
};
|
|
45
|
+
/* v8 ignore stop */
|
|
46
|
+
options[RENDER] = function (vnode) {
|
|
47
|
+
if (oldBeforeRender)
|
|
48
|
+
oldBeforeRender(vnode);
|
|
49
|
+
currentComponent = vnode[COMPONENT];
|
|
50
|
+
currentIndex = 0;
|
|
51
|
+
};
|
|
52
|
+
options[DIFFED] = function (vnode) {
|
|
53
|
+
if (oldAfterDiff)
|
|
54
|
+
oldAfterDiff(vnode);
|
|
55
|
+
currentComponent = null;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
47
58
|
function getHookState(index, type) {
|
|
48
59
|
if (options[HOOK]) {
|
|
49
60
|
options[HOOK](currentComponent, index, currentHook || type);
|
|
@@ -148,5 +159,5 @@ function useId() {
|
|
|
148
159
|
const useEffect = noop;
|
|
149
160
|
const useLayoutEffect = noop;
|
|
150
161
|
const useImperativeHandle = noop;
|
|
151
|
-
export { useCallback, useContext, useDebugValue, useEffect, useErrorBoundary, useId, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, };
|
|
152
|
-
//# sourceMappingURL=
|
|
162
|
+
export { installMainThreadHooks, useCallback, useContext, useDebugValue, useEffect, useErrorBoundary, useId, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, };
|
|
163
|
+
//# sourceMappingURL=mainThreadImpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mainThreadImpl.js","sourceRoot":"","sources":["../../../src/core/hooks/mainThreadImpl.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAUjC,OAAO,EACL,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,eAAe,EACf,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,GACN,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,IAAI,YAAoB,CAAC;AACzB,IAAI,gBAA8C,CAAC;AACnD,IAAI,WAAmB,CAAC;AACxB,IAAI,cAAc,GAAG,KAAK,CAAC;AAC3B,IAAI,aAAiD,CAAC;AACtD,IAAI,eAAmD,CAAC;AACxD,IAAI,YAAgD,CAAC;AACrD,IAAI,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G,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACjD,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,CAAW,CAAC;AAChC,CAAC;AAED,mBAAmB;AACnB,MAAM,SAAS,GAAG,IAA4B,CAAC;AAC/C,MAAM,eAAe,GAAG,IAAkC,CAAC;AAC3D,MAAM,mBAAmB,GAAG,IAAsC,CAAC;AAEnE,OAAO,EACL,sBAAsB,EACtB,WAAW,EACX,UAAU,EACV,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,KAAK,EACL,mBAAmB,EACnB,eAAe,EACf,OAAO,EACP,UAAU,EACV,MAAM,EACN,QAAQ,GACT,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
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 { useCallback, useContext, useDebugValue, useErrorBoundary, useId, useImperativeHandle, useMemo, useEffect as usePreactEffect, useState as usePreactState, useReducer, useRef, } from 'preact/hooks';
|
|
5
|
-
import { isProfiling, profileEnd, profileFlowId, profileStart } from '
|
|
5
|
+
import { isProfiling, profileEnd, profileFlowId, profileStart } from '../../shared/profile.js';
|
|
6
6
|
// Cache profiled wrappers by the original preact setter to preserve stable
|
|
7
7
|
// identity without introducing extra hooks in component render flow.
|
|
8
8
|
const stateSetterTraceCache = /* @__PURE__ */ isProfiling
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/core/hooks/react.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EACL,WAAW,EACX,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,KAAK,EACL,mBAAmB,EACnB,OAAO,EACP,SAAS,IAAI,eAAe,EAC5B,QAAQ,IAAI,cAAc,EAC1B,UAAU,EACV,MAAM,GACP,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,WAAW,EAAE,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CAAC,oCAAoC,EAAE,WAAW,CAAC,CAAC;QAChE,IAAI,CAAC;YACH,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC7B,CAAC;gBAAS,CAAC;YACT,UAAU,EAAE,CAAC;QACf,CAAC;IACH,CAAC,CAA0C,CAAC;IAC5C,qBAAqB,EAAE,GAAG,CAAC,eAAe,EAAE,cAA4C,CAAC,CAAC;IAE1F,OAAO,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,QAAQ,GAA0B,CAAC,cAAc,IAAI,WAAW,CAAC;IACrE,CAAC,CAAC,mBAA4C;IAC9C,CAAC,CAAC,cAAc,CAAC;AAEnB;;;;;;;;GAQG;AACH,MAAM,SAAS,GAA4D,CAAC,cAAc,IAAI,WAAW,CAAC;IACxG,CAAC,CAAC,iBAAiB;IACnB,CAAC,CAAC,eAAe,CAAC;AAEpB;;;;;;;;;;;GAWG;AACH,MAAM,eAAe,GAA4D,CAAC,cAAc,IAAI,WAAW,CAAC;IAC9G,CAAC,CAAC,uBAAuB;IACzB,CAAC,CAAC,eAAe,CAAC;AAEpB,OAAO;AACL,SAAS;AACT,QAAQ,EACR,UAAU,EACV,MAAM,EACN,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,WAAW,EACX,OAAO,EACP,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,KAAK,GACN,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// LICENSE file in the root directory of this source tree.
|
|
4
4
|
import { useEffect, useMemo, useRef } from 'preact/hooks';
|
|
5
5
|
/**
|
|
6
|
-
* `useLynxGlobalEventListener`
|
|
6
|
+
* `useLynxGlobalEventListener` helps you `addListener` as early as possible.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLynxGlobalEventListener.js","sourceRoot":"","sources":["../../../src/core/hooks/useLynxGlobalEventListener.ts"],"names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LICENSE file in the root directory of this source tree.
|
|
4
|
+
import { __etAttrPlanMap } from '../runtime/template/attr-slot-plan.js';
|
|
5
|
+
function normalizeAttributeSlots(rawSlots) {
|
|
6
|
+
let normalizedSlots;
|
|
7
|
+
for (let slotIndex = 0; slotIndex < rawSlots.length; slotIndex += 1) {
|
|
8
|
+
const rawSlot = rawSlots[slotIndex];
|
|
9
|
+
if (rawSlot !== undefined) {
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
normalizedSlots ??= rawSlots.slice();
|
|
13
|
+
normalizedSlots[slotIndex] = null;
|
|
14
|
+
}
|
|
15
|
+
return normalizedSlots ?? rawSlots;
|
|
16
|
+
}
|
|
17
|
+
export function prepareAttributeSlots(templateKey, handleId, rawSlots) {
|
|
18
|
+
const attrPlan = __etAttrPlanMap[templateKey];
|
|
19
|
+
if (!attrPlan || attrPlan.length === 0) {
|
|
20
|
+
return normalizeAttributeSlots(rawSlots);
|
|
21
|
+
}
|
|
22
|
+
const normalizedSlots = normalizeAttributeSlots(rawSlots);
|
|
23
|
+
const preparedSlots = normalizedSlots === rawSlots
|
|
24
|
+
? rawSlots.slice()
|
|
25
|
+
: normalizedSlots;
|
|
26
|
+
for (let planIndex = 0; planIndex < attrPlan.length; planIndex += 2) {
|
|
27
|
+
const attrSlotIndex = attrPlan[planIndex];
|
|
28
|
+
const adapter = attrPlan[planIndex + 1];
|
|
29
|
+
const rawValue = rawSlots[attrSlotIndex];
|
|
30
|
+
preparedSlots[attrSlotIndex] = adapter(handleId, attrSlotIndex, rawValue);
|
|
31
|
+
}
|
|
32
|
+
return preparedSlots;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=attr-slots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attr-slots.js","sourceRoot":"","sources":["../../../src/element-template/background/attr-slots.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAG1D,OAAO,EAAE,eAAe,EA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G,OAAO,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;IAC5E,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BackgroundElementTemplateInstance } from './instance.js';
|
|
2
|
+
import type { ElementTemplateUpdateCommitContext } from '../protocol/types.js';
|
|
3
|
+
interface ElementTemplateCommitNonPayloadState {
|
|
4
|
+
removedSubtrees: BackgroundElementTemplateInstance[];
|
|
5
|
+
}
|
|
6
|
+
type ElementTemplateGlobalCommitContext = ElementTemplateUpdateCommitContext & {
|
|
7
|
+
nonPayload: ElementTemplateCommitNonPayloadState;
|
|
8
|
+
};
|
|
9
|
+
export declare const globalCommitContext: ElementTemplateGlobalCommitContext;
|
|
10
|
+
export declare function resetGlobalCommitContext(): void;
|
|
11
|
+
export declare function markRemovedSubtreeForCurrentCommit(root: BackgroundElementTemplateInstance): void;
|
|
12
|
+
export declare function takeRemovedSubtreesForCurrentCommit(): BackgroundElementTemplateInstance[];
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const globalCommitContext = {
|
|
2
|
+
ops: [],
|
|
3
|
+
flushOptions: {},
|
|
4
|
+
nonPayload: {
|
|
5
|
+
removedSubtrees: [],
|
|
6
|
+
},
|
|
7
|
+
};
|
|
8
|
+
export function resetGlobalCommitContext() {
|
|
9
|
+
globalCommitContext.ops = [];
|
|
10
|
+
globalCommitContext.flushOptions = {};
|
|
11
|
+
delete globalCommitContext.flowIds;
|
|
12
|
+
globalCommitContext.nonPayload.removedSubtrees = [];
|
|
13
|
+
}
|
|
14
|
+
export function markRemovedSubtreeForCurrentCommit(root) {
|
|
15
|
+
const { removedSubtrees } = globalCommitContext.nonPayload;
|
|
16
|
+
if (!removedSubtrees.includes(root)) {
|
|
17
|
+
removedSubtrees.push(root);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function takeRemovedSubtreesForCurrentCommit() {
|
|
21
|
+
const removedSubtrees = globalCommitContext.nonPayload.removedSubtrees;
|
|
22
|
+
globalCommitContext.nonPayload.removedSubtrees = [];
|
|
23
|
+
return removedSubtrees;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=commit-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit-context.js","sourceRoot":"","sources":["../../../src/element-template/background/commit-context.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,mBAAmB,GAAuC;IACrE,GAAG,EAAE,EAAE;IACP,YAAY,EAAE,EAAE;IAChB,UAAU,EAAE;QACV,eAAe,EAAE,EAAE;KACpB;CACF,CAAC;AAEF,MAAM,UAAU,wBAAwB;IACtC,mBAAmB,CAAC,GAAG,GAAG,EAAE,CAAC;IAC7B,mBAAmB,CAAC,YAAY,GAAG,EAAE,CAAC;IACtC,OAAO,mBAAmB,CAAC,OAAO,CAAC;IACnC,mBAAmB,CAAC,UAAU,CAAC,eAAe,GAAG,EAAE,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,kCAAkC,CAChD,IAAuC;IAEvC,MAAM,EAAE,eAAe,EAAE,GAAG,mBAAmB,CAAC,UAAU,CAAC;IAC3D,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,mCAAmC;IACjD,MAAM,eAAe,GAAG,mBAAmB,CAAC,UAAU,CAAC,eAAe,CAAC;IACvE,mBAAmB,CAAC,UAAU,CAAC,eAAe,GAAG,EAAE,CAAC;IACpD,OAAO,eAAe,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BackgroundElementTemplateInstance } from './instance.js';
|
|
2
|
+
export declare function markElementTemplateHydrated(): void;
|
|
3
|
+
export declare function isElementTemplateHydrated(): boolean;
|
|
4
|
+
export declare function resetElementTemplateCommitState(): void;
|
|
5
|
+
export declare function scheduleElementTemplateRemovedSubtreeCleanup(removedSubtrees: BackgroundElementTemplateInstance[]): void;
|
|
6
|
+
export declare function cancelElementTemplateRemovedSubtreeCleanup(): void;
|
|
7
|
+
export declare function installElementTemplateCommitHook(): void;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Copyright 2026 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
import { options } from 'preact';
|
|
5
|
+
import { globalCommitContext, resetGlobalCommitContext, takeRemovedSubtreesForCurrentCommit, } from './commit-context.js';
|
|
6
|
+
import { COMMIT } from '../../shared/render-constants.js';
|
|
7
|
+
import { hook } from '../../utils.js';
|
|
8
|
+
import { formatElementTemplateUpdateCommands } from '../debug/alog.js';
|
|
9
|
+
import { profileEnd, profileStart } from '../debug/profile.js';
|
|
10
|
+
import { globalPipelineOptions, markTiming, markTimingLegacy, setPipeline } from '../lynx/performance.js';
|
|
11
|
+
import { ElementTemplateLifecycleConstant } from '../protocol/lifecycle-constant.js';
|
|
12
|
+
let installed = false;
|
|
13
|
+
let hasHydrated = false;
|
|
14
|
+
const scheduledRemovedSubtreeCleanupTimers = new Set();
|
|
15
|
+
export function markElementTemplateHydrated() {
|
|
16
|
+
hasHydrated = true;
|
|
17
|
+
}
|
|
18
|
+
export function isElementTemplateHydrated() {
|
|
19
|
+
return hasHydrated;
|
|
20
|
+
}
|
|
21
|
+
export function resetElementTemplateCommitState() {
|
|
22
|
+
hasHydrated = false;
|
|
23
|
+
resetGlobalCommitContext();
|
|
24
|
+
}
|
|
25
|
+
export function scheduleElementTemplateRemovedSubtreeCleanup(removedSubtrees) {
|
|
26
|
+
if (removedSubtrees.length === 0) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const timer = setTimeout(() => {
|
|
30
|
+
scheduledRemovedSubtreeCleanupTimers.delete(timer);
|
|
31
|
+
for (const root of removedSubtrees) {
|
|
32
|
+
root.tearDown();
|
|
33
|
+
}
|
|
34
|
+
}, 10000);
|
|
35
|
+
scheduledRemovedSubtreeCleanupTimers.add(timer);
|
|
36
|
+
}
|
|
37
|
+
export function cancelElementTemplateRemovedSubtreeCleanup() {
|
|
38
|
+
for (const timer of scheduledRemovedSubtreeCleanupTimers) {
|
|
39
|
+
clearTimeout(timer);
|
|
40
|
+
}
|
|
41
|
+
scheduledRemovedSubtreeCleanupTimers.clear();
|
|
42
|
+
}
|
|
43
|
+
export function installElementTemplateCommitHook() {
|
|
44
|
+
if (installed) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
installed = true;
|
|
48
|
+
hook(options, COMMIT, (originalCommit, vnode, commitQueue) => {
|
|
49
|
+
if (__BACKGROUND__ && hasHydrated && globalCommitContext.ops.length > 0) {
|
|
50
|
+
markTimingLegacy('updateDiffVdomEnd');
|
|
51
|
+
markTiming('diffVdomEnd');
|
|
52
|
+
if (__PROFILE__) {
|
|
53
|
+
profileStart('ReactLynx::commitChanges');
|
|
54
|
+
}
|
|
55
|
+
markTiming('packChangesStart');
|
|
56
|
+
if (globalPipelineOptions) {
|
|
57
|
+
globalCommitContext.flushOptions.pipelineOptions = globalPipelineOptions;
|
|
58
|
+
}
|
|
59
|
+
markTiming('packChangesEnd');
|
|
60
|
+
if (globalPipelineOptions) {
|
|
61
|
+
setPipeline(undefined);
|
|
62
|
+
}
|
|
63
|
+
if (__PROFILE__) {
|
|
64
|
+
profileEnd();
|
|
65
|
+
}
|
|
66
|
+
if (typeof __ALOG__ !== 'undefined' && __ALOG__) {
|
|
67
|
+
console.alog?.('[ReactLynxDebug] ElementTemplate BTS -> MTS update:\n'
|
|
68
|
+
+ JSON.stringify({
|
|
69
|
+
ops: formatElementTemplateUpdateCommands(globalCommitContext.ops),
|
|
70
|
+
flushOptions: globalCommitContext.flushOptions,
|
|
71
|
+
flowIds: globalCommitContext.flowIds,
|
|
72
|
+
}, null, 2));
|
|
73
|
+
}
|
|
74
|
+
const removedSubtrees = takeRemovedSubtreesForCurrentCommit();
|
|
75
|
+
try {
|
|
76
|
+
lynx.getCoreContext().dispatchEvent({
|
|
77
|
+
type: ElementTemplateLifecycleConstant.update,
|
|
78
|
+
data: {
|
|
79
|
+
ops: globalCommitContext.ops,
|
|
80
|
+
flushOptions: globalCommitContext.flushOptions,
|
|
81
|
+
flowIds: globalCommitContext.flowIds,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
resetGlobalCommitContext();
|
|
87
|
+
// Match Snapshot's cleanup boundary: start the delayed teardown only
|
|
88
|
+
// after the bridge dispatch attempt, so background JS objects are not
|
|
89
|
+
// torn down before main-thread detach observes the same commit.
|
|
90
|
+
scheduleElementTemplateRemovedSubtreeCleanup(removedSubtrees);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
originalCommit?.(vnode, commitQueue);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=commit-hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit-hook.js","sourceRoot":"","sources":["../../../src/element-template/background/commit-hook.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,mCAAmC,GACpC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,mCAAmC,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,g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AAC,CAAC;YACL,CAAC;oBAAS,CAAC;gBACT,wBAAwB,EAAE,CAAC;gBAC3B,qEAAqE;gBACrE,sEAAsE;gBACtE,gEAAgE;gBAChE,4CAA4C,CAAC,eAAe,CAAC,CAAC;YAChE,CAAC;QACH,CAAC;QAED,cAAc,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function destroyElementTemplateBackgroundRuntime(): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright 2026 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
import { cancelElementTemplateRemovedSubtreeCleanup, resetElementTemplateCommitState } from './commit-hook.js';
|
|
5
|
+
import { resetElementTemplateHydrationListener } from './hydration-listener.js';
|
|
6
|
+
import { backgroundElementTemplateInstanceManager } from './manager.js';
|
|
7
|
+
import { clearEventState } from '../prop-adapters/event.js';
|
|
8
|
+
export function destroyElementTemplateBackgroundRuntime() {
|
|
9
|
+
resetElementTemplateHydrationListener();
|
|
10
|
+
resetElementTemplateCommitState();
|
|
11
|
+
// Destroy is the only place that may discard delayed removed subtrees instead
|
|
12
|
+
// of letting the Snapshot-aligned timer tear them down later.
|
|
13
|
+
cancelElementTemplateRemovedSubtreeCleanup();
|
|
14
|
+
clearEventState();
|
|
15
|
+
backgroundElementTemplateInstanceManager.clear();
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=destroy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destroy.js","sourceRoot":"","sources":["../../../src/element-template/background/destroy.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,0CAA0C,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAC;AAC/G,OAAO,EAAE,qCAAqC,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,wCAAwC,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,UAAU,uCAAuC;IACrD,qCAAqC,EAAE,CAAC;IACxC,+BAA+B,EAAE,CAAC;IAClC,8EAA8E;IAC9E,8DAA8D;IAC9D,0CAA0C,EAAE,CAAC;IAC7C,eAAe,EAAE,CAAC;IAClB,wCAAwC,CAAC,KAAK,EAAE,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BackgroundElementTemplateInstance } from './instance.js';
|
|
2
|
+
export interface BackgroundElementTemplateDocument {
|
|
3
|
+
createElement(type: string): BackgroundElementTemplateInstance;
|
|
4
|
+
createElementNS(ns: string, type: string): BackgroundElementTemplateInstance;
|
|
5
|
+
createTextNode(text: string): BackgroundElementTemplateInstance;
|
|
6
|
+
}
|
|
7
|
+
export declare function setupBackgroundElementTemplateDocument(): BackgroundElementTemplateDocument;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
import { options } from 'preact';
|
|
5
|
+
import { BUILTIN_RAW_TEXT_TEMPLATE_KEY, BackgroundElementTemplateInstance, BackgroundElementTemplateSlot, } from './instance.js';
|
|
6
|
+
export function setupBackgroundElementTemplateDocument() {
|
|
7
|
+
const doc = {
|
|
8
|
+
createElement(type) {
|
|
9
|
+
if (type === 'slot') {
|
|
10
|
+
return new BackgroundElementTemplateSlot();
|
|
11
|
+
}
|
|
12
|
+
return new BackgroundElementTemplateInstance(type);
|
|
13
|
+
},
|
|
14
|
+
createElementNS(_ns, type) {
|
|
15
|
+
if (type === 'slot') {
|
|
16
|
+
return new BackgroundElementTemplateSlot();
|
|
17
|
+
}
|
|
18
|
+
return new BackgroundElementTemplateInstance(type);
|
|
19
|
+
},
|
|
20
|
+
createTextNode(text) {
|
|
21
|
+
return new BackgroundElementTemplateInstance(BUILTIN_RAW_TEXT_TEMPLATE_KEY, [text]);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
options.document = doc;
|
|
25
|
+
return doc;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../../src/element-template/background/document.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,EACL,6BAA6B,EAC7B,iCAAiC,EACjC,6BAA6B,GAC9B,MAAM,eAAe,CAAC;AAQvB,MAAM,UAAU,sCAAsC;IACpD,MAAM,GAAG,GAAG;QACV,aAAa,CAAC,IAAY;YACxB,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;gBACpB,OAAO,IAAI,6BAA6B,EAAE,CAAC;YAC7C,CAAC;YACD,OAAO,IAAI,iCAAiC,CAAC,IAAI,CAAC,CAAC;QACrD,CAAC;QACD,eAAe,CAAC,GAAW,EAAE,IAAY;YACvC,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;gBACpB,OAAO,IAAI,6BAA6B,EAAE,CAAC;YAC7C,CAAC;YACD,OAAO,IAAI,iCAAiC,CAAC,IAAI,CAAC,CAAC;QACrD,CAAC;QACD,cAAc,CAAC,IAAY;YACzB,OAAO,IAAI,iCAAiC,CAAC,6BAA6B,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QACtF,CAAC;KACF,CAAC;IAEF,OAAO,CAAC,QAAQ,GAAG,GAA0B,CAAC;IAE9C,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BackgroundElementTemplateInstance } from './instance.js';
|
|
2
|
+
import type { ElementTemplateUpdateCommandStream, SerializedElementTemplate } from '../protocol/types.js';
|
|
3
|
+
export declare function hydrate(serialized: SerializedElementTemplate, instance: BackgroundElementTemplateInstance): ElementTemplateUpdateCommandStream;
|
|
4
|
+
export declare function hydrateIntoContext(serialized: SerializedElementTemplate, instance: BackgroundElementTemplateInstance): void;
|