@lynx-js/react 0.119.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 +78 -0
- package/package.json +39 -11
- package/runtime/lazy/compat.js +1 -0
- package/runtime/lazy/internal.js +3 -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/{hooks/mainThread.d.ts → core/hooks/mainThreadImpl.d.ts} +2 -1
- package/runtime/lib/{hooks/mainThread.js → core/hooks/mainThreadImpl.js} +46 -35
- package/runtime/lib/core/hooks/mainThreadImpl.js.map +1 -0
- package/runtime/lib/{hooks → core/hooks}/react.js +1 -1
- package/runtime/lib/core/hooks/react.js.map +1 -0
- package/runtime/lib/{hooks → core/hooks}/useLynxGlobalEventListener.d.ts +1 -1
- package/runtime/lib/{hooks → core/hooks}/useLynxGlobalEventListener.js +1 -1
- package/runtime/lib/core/hooks/useLynxGlobalEventListener.js.map +1 -0
- package/runtime/lib/document.d.ts +4 -4
- package/runtime/lib/document.js +14 -12
- package/runtime/lib/document.js.map +1 -1
- 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.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.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.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.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 +7 -5
- package/runtime/lib/index.js +9 -6
- package/runtime/lib/index.js.map +1 -1
- package/runtime/lib/internal.d.ts +22 -20
- package/runtime/lib/internal.js +26 -23
- package/runtime/lib/internal.js.map +1 -1
- package/runtime/lib/lynx-api.d.ts +5 -5
- package/runtime/lib/lynx-api.js +9 -9
- package/runtime/lib/lynx-api.js.map +1 -1
- package/runtime/lib/lynx.d.ts +2 -2
- package/runtime/lib/lynx.js +17 -17
- package/runtime/lib/lynx.js.map +1 -1
- package/runtime/lib/root.d.ts +2 -2
- package/runtime/lib/root.js +2 -2
- package/runtime/lib/root.js.map +1 -1
- package/runtime/lib/{debug → shared}/component-stack.js +1 -1
- package/runtime/lib/shared/component-stack.js.map +1 -0
- package/runtime/lib/{debug → shared}/profile.js +6 -4
- package/runtime/lib/shared/profile.js.map +1 -0
- package/runtime/lib/{renderToOpcodes/constants.js → shared/render-constants.js} +1 -1
- package/runtime/lib/shared/render-constants.js.map +1 -0
- package/runtime/lib/{alog → snapshot/alog}/elementPAPICall.js +1 -1
- package/runtime/lib/snapshot/alog/elementPAPICall.js.map +1 -0
- package/runtime/lib/snapshot/alog/index.js.map +1 -0
- package/runtime/lib/{alog → snapshot/alog}/render.js +2 -2
- package/runtime/lib/snapshot/alog/render.js.map +1 -0
- package/runtime/lib/snapshot/compat/componentIs.js.map +1 -0
- package/runtime/lib/{compat → snapshot/compat}/initData.d.ts +2 -2
- package/runtime/lib/{compat → snapshot/compat}/initData.js +1 -1
- package/runtime/lib/snapshot/compat/initData.js.map +1 -0
- package/runtime/lib/snapshot/compat/lynxComponent.js.map +1 -0
- package/runtime/lib/snapshot/debug/debug.js.map +1 -0
- package/runtime/lib/snapshot/debug/describeInvalidValue.js.map +1 -0
- package/runtime/lib/snapshot/debug/formatPatch.js.map +1 -0
- package/runtime/lib/snapshot/debug/printSnapshot.js.map +1 -0
- package/runtime/lib/{debug → snapshot/debug}/profileHooks.js +2 -2
- package/runtime/lib/snapshot/debug/profileHooks.js.map +1 -0
- package/runtime/lib/{debug → snapshot/debug}/vnodeSource.js +1 -1
- package/runtime/lib/snapshot/debug/vnodeSource.js.map +1 -0
- package/runtime/lib/{gesture → snapshot/gesture}/processGesture.d.ts +2 -0
- package/runtime/lib/{gesture → snapshot/gesture}/processGesture.js +40 -3
- package/runtime/lib/snapshot/gesture/processGesture.js.map +1 -0
- package/runtime/lib/snapshot/gesture/processGestureBagkround.d.ts +9 -0
- package/runtime/lib/snapshot/gesture/processGestureBagkround.js +80 -0
- package/runtime/lib/snapshot/gesture/processGestureBagkround.js.map +1 -0
- package/runtime/lib/snapshot/gesture/types.js.map +1 -0
- package/runtime/lib/snapshot/index.d.ts +1 -4
- package/runtime/lib/snapshot/index.js +2 -5
- package/runtime/lib/snapshot/index.js.map +1 -1
- package/runtime/lib/{legacy-react-runtime → snapshot/legacy-react-runtime}/index.d.ts +2 -2
- package/runtime/lib/{legacy-react-runtime → snapshot/legacy-react-runtime}/index.js +2 -2
- package/runtime/lib/snapshot/legacy-react-runtime/index.js.map +1 -0
- package/runtime/lib/snapshot/lifecycle/constant.js.map +1 -0
- package/runtime/lib/{lifecycle → snapshot/lifecycle}/destroy.js +2 -2
- package/runtime/lib/snapshot/lifecycle/destroy.js.map +1 -0
- package/runtime/lib/snapshot/lifecycle/event/delayEvents.js.map +1 -0
- package/runtime/lib/snapshot/lifecycle/event/delayLifecycleEvents.js.map +1 -0
- package/runtime/lib/{lifecycle → snapshot/lifecycle}/event/jsReady.js +2 -2
- package/runtime/lib/snapshot/lifecycle/event/jsReady.js.map +1 -0
- package/runtime/lib/{lifecycle → snapshot/lifecycle}/isRendering.js +2 -2
- package/runtime/lib/snapshot/lifecycle/isRendering.js.map +1 -0
- package/runtime/lib/snapshot/lifecycle/pass.js.map +1 -0
- package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/commit.js +3 -3
- package/runtime/lib/snapshot/lifecycle/patch/commit.js.map +1 -0
- package/runtime/lib/snapshot/lifecycle/patch/error.js.map +1 -0
- package/runtime/lib/snapshot/lifecycle/patch/globalState.js.map +1 -0
- package/runtime/lib/snapshot/lifecycle/patch/isMainThreadHydrating.js.map +1 -0
- 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/{lifecycle → snapshot/lifecycle}/patch/snapshotPatch.d.ts +2 -0
- package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/snapshotPatch.js +27 -2
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js.map +1 -0
- package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/snapshotPatchApply.js +28 -0
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js.map +1 -0
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -0
- package/runtime/lib/{lifecycle → snapshot/lifecycle}/ref/delay.d.ts +1 -0
- package/runtime/lib/{lifecycle → snapshot/lifecycle}/ref/delay.js +5 -3
- package/runtime/lib/snapshot/lifecycle/ref/delay.js.map +1 -0
- package/runtime/lib/{lifecycle → snapshot/lifecycle}/reload.js +3 -3
- package/runtime/lib/snapshot/lifecycle/reload.js.map +1 -0
- package/runtime/lib/snapshot/lifecycle/render.d.ts +2 -0
- package/runtime/lib/{lifecycle → snapshot/lifecycle}/render.js +2 -2
- package/runtime/lib/snapshot/lifecycle/render.js.map +1 -0
- package/runtime/lib/{list → snapshot/list}/list.js +5 -2
- package/runtime/lib/snapshot/list/list.js.map +1 -0
- package/runtime/lib/{list → snapshot/list}/listUpdateInfo.js +1 -1
- package/runtime/lib/snapshot/list/listUpdateInfo.js.map +1 -0
- package/runtime/lib/snapshot/list/pendingListUpdates.js.map +1 -0
- package/runtime/lib/snapshot/lynx/calledByNative.d.ts +2 -0
- package/runtime/lib/{lynx → snapshot/lynx}/calledByNative.js +2 -2
- package/runtime/lib/snapshot/lynx/calledByNative.js.map +1 -0
- package/runtime/lib/{lynx → snapshot/lynx}/component.js +1 -1
- package/runtime/lib/snapshot/lynx/component.js.map +1 -0
- package/runtime/lib/snapshot/lynx/dynamic-js.js.map +1 -0
- 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.d.ts +1 -0
- package/runtime/lib/{lynx → snapshot/lynx}/env.js +1 -4
- package/runtime/lib/snapshot/lynx/env.js.map +1 -0
- package/runtime/lib/snapshot/lynx/injectLepusMethods.js.map +1 -0
- package/runtime/lib/snapshot/lynx/lazy-bundle.js.map +1 -0
- 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/{lynx → snapshot/lynx}/performance.js +2 -2
- package/runtime/lib/snapshot/lynx/performance.js.map +1 -0
- 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/{lynx → snapshot/lynx}/runWithForce.js +2 -2
- package/runtime/lib/snapshot/lynx/runWithForce.js.map +1 -0
- package/runtime/lib/{lynx → snapshot/lynx}/suspense.js +27 -17
- package/runtime/lib/snapshot/lynx/suspense.js.map +1 -0
- package/runtime/lib/{lynx → snapshot/lynx}/tt.js +3 -3
- package/runtime/lib/snapshot/lynx/tt.js.map +1 -0
- package/runtime/lib/{renderToOpcodes → snapshot/renderToOpcodes}/hydrate.js +22 -5
- package/runtime/lib/snapshot/renderToOpcodes/hydrate.js.map +1 -0
- package/runtime/lib/{renderToOpcodes → snapshot/renderToOpcodes}/index.js +35 -14
- package/runtime/lib/snapshot/renderToOpcodes/index.js.map +1 -0
- package/runtime/lib/{renderToOpcodes → snapshot/renderToOpcodes}/opcodes.js +5 -3
- package/runtime/lib/snapshot/renderToOpcodes/opcodes.js.map +1 -0
- package/runtime/lib/snapshot/{backgroundSnapshot.d.ts → snapshot/backgroundSnapshot.d.ts} +2 -1
- package/runtime/lib/snapshot/{backgroundSnapshot.js → snapshot/backgroundSnapshot.js} +101 -73
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -0
- package/runtime/lib/snapshot/{constants.d.ts → snapshot/constants.d.ts} +4 -0
- package/runtime/lib/snapshot/{constants.js → snapshot/constants.js} +4 -0
- package/runtime/lib/snapshot/snapshot/constants.js.map +1 -0
- package/runtime/lib/snapshot/{definition.d.ts → snapshot/definition.d.ts} +2 -0
- package/runtime/lib/snapshot/{definition.js → snapshot/definition.js} +55 -3
- package/runtime/lib/snapshot/snapshot/definition.js.map +1 -0
- package/runtime/lib/snapshot/{dynamicPartType.d.ts → snapshot/dynamicPartType.d.ts} +14 -0
- package/runtime/lib/snapshot/{dynamicPartType.js → snapshot/dynamicPartType.js} +14 -0
- package/runtime/lib/snapshot/snapshot/dynamicPartType.js.map +1 -0
- package/runtime/lib/snapshot/{event.d.ts → snapshot/event.d.ts} +1 -1
- package/runtime/lib/snapshot/{event.js → snapshot/event.js} +0 -4
- package/runtime/lib/snapshot/snapshot/event.js.map +1 -0
- package/runtime/lib/snapshot/{gesture.js → snapshot/gesture.js} +9 -3
- package/runtime/lib/snapshot/snapshot/gesture.js.map +1 -0
- package/runtime/lib/snapshot/snapshot/index.d.ts +4 -0
- package/runtime/lib/snapshot/snapshot/index.js +8 -0
- package/runtime/lib/snapshot/snapshot/index.js.map +1 -0
- package/runtime/lib/snapshot/snapshot/list.js.map +1 -0
- package/runtime/lib/snapshot/snapshot/platformInfo.js.map +1 -0
- 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/{ref.d.ts → snapshot/ref.d.ts} +1 -0
- package/runtime/lib/snapshot/{ref.js → snapshot/ref.js} +13 -1
- package/runtime/lib/snapshot/snapshot/ref.js.map +1 -0
- package/runtime/lib/snapshot/{snapshot.d.ts → snapshot/snapshot.d.ts} +1 -0
- package/runtime/lib/snapshot/{snapshot.js → snapshot/snapshot.js} +90 -11
- package/runtime/lib/snapshot/snapshot/snapshot.js.map +1 -0
- package/runtime/lib/snapshot/snapshot/snapshotInstanceHydrationMap.js.map +1 -0
- package/runtime/lib/snapshot/{spread.d.ts → snapshot/spread.d.ts} +1 -1
- package/runtime/lib/snapshot/{spread.js → snapshot/spread.js} +35 -4
- package/runtime/lib/snapshot/snapshot/spread.js.map +1 -0
- package/runtime/lib/snapshot/{types.d.ts → snapshot/types.d.ts} +1 -0
- package/runtime/lib/snapshot/snapshot/types.js.map +1 -0
- package/runtime/lib/snapshot/{utils.d.ts → snapshot/utils.d.ts} +1 -3
- package/runtime/lib/snapshot/{utils.js → snapshot/utils.js} +5 -0
- package/runtime/lib/snapshot/snapshot/utils.js.map +1 -0
- package/runtime/lib/snapshot/{workletEvent.d.ts → snapshot/workletEvent.d.ts} +1 -1
- package/runtime/lib/snapshot/{workletEvent.js → snapshot/workletEvent.js} +10 -5
- package/runtime/lib/snapshot/snapshot/workletEvent.js.map +1 -0
- package/runtime/lib/snapshot/{workletRef.d.ts → snapshot/workletRef.d.ts} +1 -1
- package/runtime/lib/snapshot/{workletRef.js → snapshot/workletRef.js} +6 -3
- package/runtime/lib/snapshot/snapshot/workletRef.js.map +1 -0
- package/runtime/lib/snapshot/worklet/call/delayedRunOnMainThreadData.js.map +1 -0
- package/runtime/lib/snapshot/worklet/call/execMap.js.map +1 -0
- package/runtime/lib/snapshot/worklet/call/functionCall.js.map +1 -0
- package/runtime/lib/snapshot/worklet/call/runOnBackground.js.map +1 -0
- package/runtime/lib/snapshot/worklet/call/runOnMainThread.js.map +1 -0
- package/runtime/lib/snapshot/worklet/call/transformToWorklet.js.map +1 -0
- package/runtime/lib/snapshot/worklet/ctx.d.ts +1 -0
- package/runtime/lib/snapshot/worklet/ctx.js.map +1 -0
- package/runtime/lib/snapshot/worklet/destroy.js.map +1 -0
- package/runtime/lib/{worklet → snapshot/worklet}/functionality.js +1 -1
- package/runtime/lib/snapshot/worklet/functionality.js.map +1 -0
- package/runtime/lib/snapshot/worklet/hmr.js.map +1 -0
- package/runtime/lib/snapshot/worklet/indexMap.js.map +1 -0
- package/runtime/lib/snapshot/worklet/ref/updateInitValue.js.map +1 -0
- package/runtime/lib/{worklet → snapshot/worklet}/ref/workletRef.js +1 -1
- package/runtime/lib/snapshot/worklet/ref/workletRef.js.map +1 -0
- package/runtime/lib/snapshot/worklet/ref/workletRefPool.js.map +1 -0
- 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 +29 -11
- package/testing-library/dist/setupFiles/common/runtime-setup.js +14 -49
- package/testing-library/dist/type-entry/index.js +0 -0
- package/transform/dist/wasm.cjs +1274 -665
- 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/alog/elementPAPICall.js.map +0 -1
- package/runtime/lib/alog/index.js.map +0 -1
- package/runtime/lib/alog/render.js.map +0 -1
- package/runtime/lib/compat/componentIs.js.map +0 -1
- package/runtime/lib/compat/initData.js.map +0 -1
- package/runtime/lib/compat/lynxComponent.js.map +0 -1
- package/runtime/lib/debug/component-stack.js.map +0 -1
- package/runtime/lib/debug/debug.js.map +0 -1
- package/runtime/lib/debug/describeInvalidValue.js.map +0 -1
- package/runtime/lib/debug/formatPatch.js.map +0 -1
- package/runtime/lib/debug/printSnapshot.js.map +0 -1
- package/runtime/lib/debug/profile.js.map +0 -1
- package/runtime/lib/debug/profileHooks.js.map +0 -1
- package/runtime/lib/debug/vnodeSource.js.map +0 -1
- package/runtime/lib/gesture/processGesture.js.map +0 -1
- package/runtime/lib/gesture/processGestureBagkround.d.ts +0 -2
- package/runtime/lib/gesture/processGestureBagkround.js +0 -19
- package/runtime/lib/gesture/processGestureBagkround.js.map +0 -1
- package/runtime/lib/gesture/types.js.map +0 -1
- package/runtime/lib/hooks/mainThread.js.map +0 -1
- package/runtime/lib/hooks/react.js.map +0 -1
- package/runtime/lib/hooks/useLynxGlobalEventListener.js.map +0 -1
- package/runtime/lib/legacy-react-runtime/index.js.map +0 -1
- package/runtime/lib/lifecycle/constant.js.map +0 -1
- package/runtime/lib/lifecycle/destroy.js.map +0 -1
- package/runtime/lib/lifecycle/event/delayEvents.js.map +0 -1
- package/runtime/lib/lifecycle/event/delayLifecycleEvents.js.map +0 -1
- package/runtime/lib/lifecycle/event/jsReady.js.map +0 -1
- package/runtime/lib/lifecycle/isRendering.js.map +0 -1
- package/runtime/lib/lifecycle/pass.js.map +0 -1
- package/runtime/lib/lifecycle/patch/commit.js.map +0 -1
- package/runtime/lib/lifecycle/patch/error.js.map +0 -1
- package/runtime/lib/lifecycle/patch/globalState.js.map +0 -1
- package/runtime/lib/lifecycle/patch/isMainThreadHydrating.js.map +0 -1
- package/runtime/lib/lifecycle/patch/snapshotPatch.js.map +0 -1
- package/runtime/lib/lifecycle/patch/snapshotPatchApply.js.map +0 -1
- package/runtime/lib/lifecycle/patch/updateMainThread.js.map +0 -1
- package/runtime/lib/lifecycle/ref/delay.js.map +0 -1
- package/runtime/lib/lifecycle/reload.js.map +0 -1
- package/runtime/lib/lifecycle/render.js.map +0 -1
- package/runtime/lib/list/list.js.map +0 -1
- package/runtime/lib/list/listUpdateInfo.js.map +0 -1
- package/runtime/lib/list/pendingListUpdates.js.map +0 -1
- package/runtime/lib/lynx/calledByNative.js.map +0 -1
- package/runtime/lib/lynx/component.js.map +0 -1
- package/runtime/lib/lynx/dynamic-js.js.map +0 -1
- package/runtime/lib/lynx/env.js.map +0 -1
- package/runtime/lib/lynx/injectLepusMethods.js.map +0 -1
- package/runtime/lib/lynx/lazy-bundle.js.map +0 -1
- package/runtime/lib/lynx/performance.js.map +0 -1
- package/runtime/lib/lynx/runWithForce.js.map +0 -1
- package/runtime/lib/lynx/suspense.js.map +0 -1
- package/runtime/lib/lynx/tt.js.map +0 -1
- package/runtime/lib/renderToOpcodes/constants.js.map +0 -1
- package/runtime/lib/renderToOpcodes/hydrate.js.map +0 -1
- package/runtime/lib/renderToOpcodes/index.js.map +0 -1
- package/runtime/lib/renderToOpcodes/opcodes.js.map +0 -1
- package/runtime/lib/snapshot/backgroundSnapshot.js.map +0 -1
- package/runtime/lib/snapshot/constants.js.map +0 -1
- package/runtime/lib/snapshot/definition.js.map +0 -1
- package/runtime/lib/snapshot/dynamicPartType.js.map +0 -1
- package/runtime/lib/snapshot/event.js.map +0 -1
- package/runtime/lib/snapshot/gesture.js.map +0 -1
- package/runtime/lib/snapshot/list.js.map +0 -1
- package/runtime/lib/snapshot/platformInfo.js.map +0 -1
- package/runtime/lib/snapshot/ref.js.map +0 -1
- package/runtime/lib/snapshot/snapshot.js.map +0 -1
- package/runtime/lib/snapshot/snapshotInstanceHydrationMap.js.map +0 -1
- package/runtime/lib/snapshot/spread.js.map +0 -1
- package/runtime/lib/snapshot/types.js.map +0 -1
- package/runtime/lib/snapshot/utils.js.map +0 -1
- package/runtime/lib/snapshot/workletEvent.js.map +0 -1
- package/runtime/lib/snapshot/workletRef.js.map +0 -1
- package/runtime/lib/worklet/call/delayedRunOnMainThreadData.js.map +0 -1
- package/runtime/lib/worklet/call/execMap.js.map +0 -1
- package/runtime/lib/worklet/call/functionCall.js.map +0 -1
- package/runtime/lib/worklet/call/runOnBackground.js.map +0 -1
- package/runtime/lib/worklet/call/runOnMainThread.js.map +0 -1
- package/runtime/lib/worklet/call/transformToWorklet.js.map +0 -1
- package/runtime/lib/worklet/ctx.js.map +0 -1
- package/runtime/lib/worklet/destroy.js.map +0 -1
- package/runtime/lib/worklet/functionality.js.map +0 -1
- package/runtime/lib/worklet/hmr.js.map +0 -1
- package/runtime/lib/worklet/indexMap.js.map +0 -1
- package/runtime/lib/worklet/ref/updateInitValue.js.map +0 -1
- package/runtime/lib/worklet/ref/workletRef.js.map +0 -1
- package/runtime/lib/worklet/ref/workletRefPool.js.map +0 -1
- package/testing-library/README.md +0 -109
- /package/runtime/lib/{hooks → core/hooks}/react.d.ts +0 -0
- /package/runtime/lib/{lynx → element-template/lynx}/env.d.ts +0 -0
- /package/runtime/lib/{lynx/calledByNative.d.ts → element-template/native/main-thread-api.d.ts} +0 -0
- /package/runtime/lib/{lynx/component.d.ts → element-template/runtime/components/slot.d.ts} +0 -0
- /package/runtime/lib/{lifecycle/render.d.ts → element-template/runtime/render/render-main-thread.d.ts} +0 -0
- /package/runtime/lib/{debug → shared}/component-stack.d.ts +0 -0
- /package/runtime/lib/{debug → shared}/profile.d.ts +0 -0
- /package/runtime/lib/{renderToOpcodes/constants.d.ts → shared/render-constants.d.ts} +0 -0
- /package/runtime/lib/{alog → snapshot/alog}/elementPAPICall.d.ts +0 -0
- /package/runtime/lib/{alog → snapshot/alog}/index.d.ts +0 -0
- /package/runtime/lib/{alog → snapshot/alog}/index.js +0 -0
- /package/runtime/lib/{alog → snapshot/alog}/render.d.ts +0 -0
- /package/runtime/lib/{compat → snapshot/compat}/componentIs.d.ts +0 -0
- /package/runtime/lib/{compat → snapshot/compat}/componentIs.js +0 -0
- /package/runtime/lib/{compat → snapshot/compat}/lynxComponent.d.ts +0 -0
- /package/runtime/lib/{compat → snapshot/compat}/lynxComponent.js +0 -0
- /package/runtime/lib/{debug → snapshot/debug}/debug.d.ts +0 -0
- /package/runtime/lib/{debug → snapshot/debug}/debug.js +0 -0
- /package/runtime/lib/{debug → snapshot/debug}/describeInvalidValue.d.ts +0 -0
- /package/runtime/lib/{debug → snapshot/debug}/describeInvalidValue.js +0 -0
- /package/runtime/lib/{debug → snapshot/debug}/formatPatch.d.ts +0 -0
- /package/runtime/lib/{debug → snapshot/debug}/formatPatch.js +0 -0
- /package/runtime/lib/{debug → snapshot/debug}/printSnapshot.d.ts +0 -0
- /package/runtime/lib/{debug → snapshot/debug}/printSnapshot.js +0 -0
- /package/runtime/lib/{debug → snapshot/debug}/profileHooks.d.ts +0 -0
- /package/runtime/lib/{debug → snapshot/debug}/vnodeSource.d.ts +0 -0
- /package/runtime/lib/{gesture → snapshot/gesture}/types.d.ts +0 -0
- /package/runtime/lib/{gesture → snapshot/gesture}/types.js +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/constant.d.ts +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/constant.js +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/destroy.d.ts +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/event/delayEvents.d.ts +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/event/delayEvents.js +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/event/delayLifecycleEvents.d.ts +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/event/delayLifecycleEvents.js +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/event/jsReady.d.ts +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/isRendering.d.ts +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/pass.d.ts +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/pass.js +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/commit.d.ts +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/error.d.ts +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/error.js +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/globalState.d.ts +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/globalState.js +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/isMainThreadHydrating.d.ts +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/isMainThreadHydrating.js +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/snapshotPatchApply.d.ts +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/updateMainThread.d.ts +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/updateMainThread.js +0 -0
- /package/runtime/lib/{lifecycle → snapshot/lifecycle}/reload.d.ts +0 -0
- /package/runtime/lib/{list → snapshot/list}/list.d.ts +0 -0
- /package/runtime/lib/{list → snapshot/list}/listUpdateInfo.d.ts +0 -0
- /package/runtime/lib/{list → snapshot/list}/pendingListUpdates.d.ts +0 -0
- /package/runtime/lib/{list → snapshot/list}/pendingListUpdates.js +0 -0
- /package/runtime/lib/{worklet/call/execMap.d.ts → snapshot/lynx/component.d.ts} +0 -0
- /package/runtime/lib/{lynx → snapshot/lynx}/dynamic-js.d.ts +0 -0
- /package/runtime/lib/{lynx → snapshot/lynx}/dynamic-js.js +0 -0
- /package/runtime/lib/{lynx → snapshot/lynx}/injectLepusMethods.d.ts +0 -0
- /package/runtime/lib/{lynx → snapshot/lynx}/injectLepusMethods.js +0 -0
- /package/runtime/lib/{lynx → snapshot/lynx}/lazy-bundle.d.ts +0 -0
- /package/runtime/lib/{lynx → snapshot/lynx}/lazy-bundle.js +0 -0
- /package/runtime/lib/{lynx → snapshot/lynx}/performance.d.ts +0 -0
- /package/runtime/lib/{lynx → snapshot/lynx}/runWithForce.d.ts +0 -0
- /package/runtime/lib/{lynx → snapshot/lynx}/suspense.d.ts +0 -0
- /package/runtime/lib/{lynx → snapshot/lynx}/tt.d.ts +0 -0
- /package/runtime/lib/{renderToOpcodes → snapshot/renderToOpcodes}/hydrate.d.ts +0 -0
- /package/runtime/lib/{renderToOpcodes → snapshot/renderToOpcodes}/index.d.ts +0 -0
- /package/runtime/lib/{renderToOpcodes → snapshot/renderToOpcodes}/opcodes.d.ts +0 -0
- /package/runtime/lib/snapshot/{gesture.d.ts → snapshot/gesture.d.ts} +0 -0
- /package/runtime/lib/snapshot/{list.d.ts → snapshot/list.d.ts} +0 -0
- /package/runtime/lib/snapshot/{list.js → snapshot/list.js} +0 -0
- /package/runtime/lib/snapshot/{platformInfo.d.ts → snapshot/platformInfo.d.ts} +0 -0
- /package/runtime/lib/snapshot/{platformInfo.js → snapshot/platformInfo.js} +0 -0
- /package/runtime/lib/snapshot/{snapshotInstanceHydrationMap.d.ts → snapshot/snapshotInstanceHydrationMap.d.ts} +0 -0
- /package/runtime/lib/snapshot/{snapshotInstanceHydrationMap.js → snapshot/snapshotInstanceHydrationMap.js} +0 -0
- /package/runtime/lib/snapshot/{types.js → snapshot/types.js} +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/call/delayedRunOnMainThreadData.d.ts +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/call/delayedRunOnMainThreadData.js +0 -0
- /package/runtime/lib/{worklet/call/transformToWorklet.d.ts → snapshot/worklet/call/execMap.d.ts} +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/call/execMap.js +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/call/functionCall.d.ts +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/call/functionCall.js +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/call/runOnBackground.d.ts +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/call/runOnBackground.js +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/call/runOnMainThread.d.ts +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/call/runOnMainThread.js +0 -0
- /package/runtime/lib/{worklet/ctx.d.ts → snapshot/worklet/call/transformToWorklet.d.ts} +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/call/transformToWorklet.js +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/ctx.js +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/destroy.d.ts +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/destroy.js +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/functionality.d.ts +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/hmr.d.ts +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/hmr.js +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/indexMap.d.ts +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/indexMap.js +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/ref/updateInitValue.d.ts +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/ref/updateInitValue.js +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/ref/workletRef.d.ts +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/ref/workletRefPool.d.ts +0 -0
- /package/runtime/lib/{worklet → snapshot/worklet}/ref/workletRefPool.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,83 @@
|
|
|
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
|
+
|
|
55
|
+
## 0.120.0
|
|
56
|
+
|
|
57
|
+
### Minor Changes
|
|
58
|
+
|
|
59
|
+
- Bump `@lynx-js/internal-preact` from `10.28.4-dfff9aa` to `10.29.1-20260424024911-12b794f` ([diff](https://github.com/lynx-family/internal-preact/compare/10.28.4-dfff9aa...10.29.1-20260424024911-12b794f)). ([#2512](https://github.com/lynx-family/lynx-stack/pull/2512))
|
|
60
|
+
|
|
61
|
+
Fixes wrong DOM order when a keyed child moves to a different `$N` slot across a re-render. Cross-slot moves now land at the correct slot position instead of being appended past stable siblings.
|
|
62
|
+
|
|
63
|
+
- Refactor preact to support multi-slots children and reduce the number and depth of snapshot. ([#1764](https://github.com/lynx-family/lynx-stack/pull/1764))
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- Fix stale callback-local references when transforming JSX inside `children={array.map(...)}` prop expressions. ([#2524](https://github.com/lynx-family/lynx-stack/pull/2524))
|
|
68
|
+
|
|
69
|
+
- Fix ref callbacks not being cleaned up or re-applied correctly when the ref at the same element slot changes across rerenders that happen before hydration (e.g. a `useEffect` triggering `setState` during the initial background render). ([#2500](https://github.com/lynx-family/lynx-stack/pull/2500))
|
|
70
|
+
|
|
71
|
+
- fix: reduce redundant updates for main-thread handlers and gestures ([#2188](https://github.com/lynx-family/lynx-stack/pull/2188))
|
|
72
|
+
|
|
73
|
+
- Updates are faster when the main-thread event handler or gesture object is stable across rerenders (fewer unnecessary native updates).
|
|
74
|
+
- Spread props rerenders that don't semantically change the handler/gesture no longer trigger redundant updates.
|
|
75
|
+
- Removing a gesture from spread props reliably clears the gesture state on the target element.
|
|
76
|
+
|
|
77
|
+
- Fix hydration edge cases by tolerating serialized snapshot nodes with missing `values` ([#2481](https://github.com/lynx-family/lynx-stack/pull/2481))
|
|
78
|
+
|
|
79
|
+
- Keep ReactLynx Testing Library imports aligned with the contained snapshot runtime paths. ([#2498](https://github.com/lynx-family/lynx-stack/pull/2498))
|
|
80
|
+
|
|
3
81
|
## 0.119.0
|
|
4
82
|
|
|
5
83
|
### 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/hooks/react.d.ts",
|
|
60
|
-
"default": "./runtime/lib/hooks/react.js"
|
|
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/hooks/react.d.ts",
|
|
64
|
-
"default": "./runtime/lib/hooks/mainThread.js"
|
|
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",
|
|
@@ -96,9 +112,9 @@
|
|
|
96
112
|
"default": "./runtime/lib/worklet-runtime/bindings/index.js"
|
|
97
113
|
},
|
|
98
114
|
"./legacy-react-runtime": {
|
|
99
|
-
"types": "./runtime/lib/legacy-react-runtime/index.d.ts",
|
|
115
|
+
"types": "./runtime/lib/snapshot/legacy-react-runtime/index.d.ts",
|
|
100
116
|
"lazy": "./runtime/lazy/legacy-react-runtime.js",
|
|
101
|
-
"default": "./runtime/lib/legacy-react-runtime/index.js"
|
|
117
|
+
"default": "./runtime/lib/snapshot/legacy-react-runtime/index.js"
|
|
102
118
|
},
|
|
103
119
|
"./testing-library": {
|
|
104
120
|
"types": "./testing-library/types/index.d.ts",
|
|
@@ -132,10 +148,10 @@
|
|
|
132
148
|
"./runtime/lazy/import.d.ts"
|
|
133
149
|
],
|
|
134
150
|
"hooks": [
|
|
135
|
-
"./runtime/lib/hooks/react.d.ts"
|
|
151
|
+
"./runtime/lib/core/hooks/react.d.ts"
|
|
136
152
|
],
|
|
137
153
|
"lepus/hooks": [
|
|
138
|
-
"./runtime/lib/hooks/react.d.ts"
|
|
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
|
],
|
|
@@ -174,7 +202,7 @@
|
|
|
174
202
|
"./runtime/lib/worklet-runtime/bindings/index.d.ts"
|
|
175
203
|
],
|
|
176
204
|
"legacy-react-runtime": [
|
|
177
|
-
"./runtime/lib/legacy-react-runtime/index.d.ts"
|
|
205
|
+
"./runtime/lib/snapshot/legacy-react-runtime/index.d.ts"
|
|
178
206
|
]
|
|
179
207
|
}
|
|
180
208
|
},
|
|
@@ -192,7 +220,7 @@
|
|
|
192
220
|
"README.zh.md"
|
|
193
221
|
],
|
|
194
222
|
"dependencies": {
|
|
195
|
-
"preact": "npm:@lynx-js/internal-preact@10.
|
|
223
|
+
"preact": "npm:@lynx-js/internal-preact@10.29.1-20260424024911-12b794f"
|
|
196
224
|
},
|
|
197
225
|
"devDependencies": {
|
|
198
226
|
"@lynx-js/types": "3.7.0",
|
package/runtime/lazy/compat.js
CHANGED
package/runtime/lazy/internal.js
CHANGED
|
@@ -19,7 +19,10 @@ export const {
|
|
|
19
19
|
__DynamicPartChildren,
|
|
20
20
|
__DynamicPartChildren_0,
|
|
21
21
|
__DynamicPartListChildren,
|
|
22
|
+
__DynamicPartListSlotV2,
|
|
22
23
|
__DynamicPartSlot,
|
|
24
|
+
__DynamicPartSlotV2,
|
|
25
|
+
__DynamicPartSlotV2_0,
|
|
23
26
|
__DynamicPartMultiChildren,
|
|
24
27
|
__dynamicImport,
|
|
25
28
|
__page,
|
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 '
|
|
12
|
-
import { noop } from '
|
|
11
|
+
import { CHILDREN, COMPONENT, DIFF, DIFFED, HOOK, HOOKS, LIST, MASK, PARENT, PENDING_EFFECTS, RENDER, ROOT, VALUE, VNODE, } from '../../shared/render-constants.js';
|
|
12
|
+
import { noop } from '../../utils.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,OAA2D,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,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,UAAU,E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CAAoC,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":[],"mapp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|
+
import { BackgroundSnapshotInstance } from './snapshot/snapshot/backgroundSnapshot.js';
|
|
2
|
+
import { SnapshotInstance } from './snapshot/snapshot/snapshot.js';
|
|
3
3
|
/**
|
|
4
4
|
* This module implements an Interface Adapter Pattern to integrate Preact's
|
|
5
5
|
* rendering system with Lynx's custom Snapshot-based virtual DOM.
|
|
@@ -26,10 +26,10 @@ declare const document: SnapshotDocumentAdapter;
|
|
|
26
26
|
* Sets up the document interface for the background thread.
|
|
27
27
|
* All DOM operations are intercepted to create {@link BackgroundSnapshotInstance}.
|
|
28
28
|
*/
|
|
29
|
-
declare function setupBackgroundDocument(): void;
|
|
29
|
+
declare function setupBackgroundDocument(_document?: SnapshotDocumentAdapter): void;
|
|
30
30
|
/**
|
|
31
31
|
* Sets up the document interface for the main thread.
|
|
32
32
|
* All DOM operations are intercepted to create {@link SnapshotInstance}.
|
|
33
33
|
*/
|
|
34
|
-
declare function setupDocument(): void;
|
|
34
|
+
declare function setupDocument(_document?: SnapshotDocumentAdapter): void;
|
|
35
35
|
export { document, setupBackgroundDocument, setupDocument };
|
package/runtime/lib/document.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
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 { BackgroundSnapshotInstance } from './snapshot/backgroundSnapshot.js';
|
|
5
|
-
import { SnapshotInstance } from './snapshot/snapshot.js';
|
|
4
|
+
import { BackgroundSnapshotInstance } from './snapshot/snapshot/backgroundSnapshot.js';
|
|
5
|
+
import { SnapshotInstance } from './snapshot/snapshot/snapshot.js';
|
|
6
6
|
const document = {};
|
|
7
7
|
/**
|
|
8
8
|
* Sets up the document interface for the background thread.
|
|
9
9
|
* All DOM operations are intercepted to create {@link BackgroundSnapshotInstance}.
|
|
10
10
|
*/
|
|
11
|
-
function setupBackgroundDocument() {
|
|
12
|
-
|
|
11
|
+
function setupBackgroundDocument(_document = document) {
|
|
12
|
+
_document.createElement = function (type) {
|
|
13
13
|
return new BackgroundSnapshotInstance(type);
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
_document.createElementNS = function (_ns, type, _is) {
|
|
16
16
|
return new BackgroundSnapshotInstance(type);
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
_document.createTextNode = function (text) {
|
|
19
19
|
const i = new BackgroundSnapshotInstance(null);
|
|
20
20
|
i.setAttribute(0, text);
|
|
21
21
|
Object.defineProperty(i, 'data', {
|
|
@@ -30,14 +30,16 @@ function setupBackgroundDocument() {
|
|
|
30
30
|
* Sets up the document interface for the main thread.
|
|
31
31
|
* All DOM operations are intercepted to create {@link SnapshotInstance}.
|
|
32
32
|
*/
|
|
33
|
-
function setupDocument() {
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
function setupDocument(_document = document) {
|
|
34
|
+
_document.createElement = function (type) {
|
|
35
|
+
const si = new SnapshotInstance(type);
|
|
36
|
+
return si;
|
|
36
37
|
};
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
_document.createElementNS = function (_ns, type, _is) {
|
|
39
|
+
const si = new SnapshotInstance(type);
|
|
40
|
+
return si;
|
|
39
41
|
};
|
|
40
|
-
|
|
42
|
+
_document.createTextNode = function (text) {
|
|
41
43
|
const i = new SnapshotInstance(null);
|
|
42
44
|
i.setAttribute(0, text);
|
|
43
45
|
Object.defineProperty(i, 'data', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"document.js","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA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AAI,gBAAgB,CAAC,IAAyB,CAAC,CAAC;QAC1D,CAAC,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACxB,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE;YAC/B,GAAG,CAAC,CAAC;gBACH,CAAC,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACvB,CAAC;SACF,CAAC,CAAC;QACH,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,+BAA+B;AAC/B,0BAA0B;AAC1B,qBAAqB;AACrB,IAAI;AAEJ,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { __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,EAAE,MAAM,uCAAuC,CAAC;AAGxE,SAAS,uBAAuB,CAAC,QAA4B;IAC3D,IAAI,eAAgD,CAAC;IACrD,KAAK,IAAI,SAAS,GAAG,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC,MAAM,EAAE,SAAS,IAAI,CAAC,EAAE,CAAC;QACpE,MAAM,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,SAAS;QACX,CAAC;QACD,eAAe,KAAK,QAAQ,CAAC,KAAK,EAAyB,CAAC;QAC5D,eAAe,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IACpC,CAAC;IACD,OAAO,eAAe,IAAI,QAA+B,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,WAAmB,EACnB,QAAgB,EAChB,QAA4B;IAE5B,MAAM,QAAQ,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;IAC9C,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvC,OAAO,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,eAAe,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAC1D,MAAM,aAAa,GAAG,eAAe,KAAK,QAAQ;QAChD,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAyB;QACzC,CAAC,CAAC,eAAe,CAAC;IACpB,KAAK,IAAI,SAAS,GAAG,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC,MAAM,EAAE,SAAS,IAAI,CAAC,EAAE,CAAC;QACpE,MAAM,aAAa,GAAG,QAAQ,CAAC,SAAS,CAAW,CAAC;QACpD,MAAM,OAAO,GAAG,QAAQ,CAAC,SAAS,GAAG,CAAC,CAAkB,CAAC;QACzD,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;QACzC,aAAa,CAAC,aAAa,CAAC,GAAG,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;
|