@lynx-js/react 0.126.2 → 0.128.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 +36 -0
- package/components/tsconfig.tsbuildinfo +1 -1
- package/docs/directives.md +90 -0
- package/docs/global-events.md +50 -0
- package/docs/import-attributes.md +43 -0
- package/docs/macros.md +285 -0
- package/package.json +7 -14
- package/refresh/.turbo/turbo-build.log +2 -2
- package/refresh/dist/index.js +26 -6
- package/refresh/package.json +1 -1
- package/runtime/__test__/core/main-thread-object.test.js +149 -0
- package/runtime/__test__/element-template/fixtures/background/main-thread-function/run-on-main-thread/index.tsx +26 -3
- package/runtime/__test__/element-template/imports/main-thread-object-api.test.ts +10 -0
- package/runtime/__test__/element-template/internal/legacy-internal-guardrail.test.ts +4 -1
- package/runtime/__test__/element-template/runtime/background/event/compiled-fixtures.test.tsx +39 -48
- package/runtime/__test__/element-template/runtime/background/main-thread-function/compiled-fixtures.test.tsx +11 -9
- package/runtime/__test__/element-template/runtime/render/render-transform.contract.test.ts +6 -3
- package/runtime/__test__/element-template/test-utils/mock/globals.js +6 -0
- package/runtime/__test__/element-template/vitest.config.ts +4 -0
- package/runtime/__test__/snapshot/ctxNotFound.test.ts +271 -0
- package/runtime/__test__/snapshot/event.test.jsx +7 -7
- package/runtime/__test__/snapshot/lazy.test.js +73 -1
- package/runtime/__test__/snapshot/lynx/portals.test.jsx +75 -37
- package/runtime/__test__/snapshot/snapshotPatch.test.jsx +59 -47
- package/runtime/__test__/snapshot/spread.test.jsx +10 -10
- package/runtime/__test__/snapshot/worklet/main-thread-object.test.jsx +306 -0
- package/runtime/__test__/snapshot/worklet/workletRef.test.jsx +1 -0
- package/runtime/__test__/worklet-runtime/initEntry.test.js +109 -0
- package/runtime/__test__/worklet-runtime/mainThreadObject.test.js +182 -0
- package/runtime/__test__/worklet-runtime/object-methods.test.js +59 -0
- package/runtime/__test__/worklet-runtime/workletRef.test.js +362 -2
- package/runtime/__test__/worklet-runtime/workletRuntime.test.js +246 -1
- package/runtime/lazy/compat.js +2 -0
- package/runtime/lazy/element-template-internal.js +1 -1
- package/runtime/lazy/element-template.js +2 -0
- package/runtime/lazy/internal.js +2 -1
- package/runtime/lazy/react.js +2 -0
- package/runtime/lib/core/background-function/exec-map.js.map +1 -1
- package/runtime/lib/core/background-function/handle.js.map +1 -1
- package/runtime/lib/core/background-function/run-on-background.d.ts +16 -0
- package/runtime/lib/core/background-function/run-on-background.js +16 -0
- package/runtime/lib/core/background-function/run-on-background.js.map +1 -1
- package/runtime/lib/core/capture-main-thread-object.d.ts +1 -0
- package/runtime/lib/core/capture-main-thread-object.js +16 -0
- package/runtime/lib/core/capture-main-thread-object.js.map +1 -0
- package/runtime/lib/core/commit-context.js.map +1 -1
- package/runtime/lib/core/compat/legacy-react-runtime.js.map +1 -1
- package/runtime/lib/core/compat/lynxComponent.js.map +1 -1
- package/runtime/lib/core/component.js.map +1 -1
- package/runtime/lib/core/forceRootRender.js.map +1 -1
- package/runtime/lib/core/globalProps.d.ts +2 -0
- package/runtime/lib/core/globalProps.js.map +1 -1
- package/runtime/lib/core/hooks/mainThread.js.map +1 -1
- package/runtime/lib/core/hooks/mainThreadImpl.js.map +1 -1
- package/runtime/lib/core/hooks/react.d.ts +4 -0
- package/runtime/lib/core/hooks/react.js +4 -0
- package/runtime/lib/core/hooks/react.js.map +1 -1
- package/runtime/lib/core/hooks/useLynxGlobalEventListener.d.ts +2 -0
- package/runtime/lib/core/hooks/useLynxGlobalEventListener.js +2 -0
- package/runtime/lib/core/hooks/useLynxGlobalEventListener.js.map +1 -1
- package/runtime/lib/core/initData.d.ts +2 -0
- package/runtime/lib/core/initData.js +2 -0
- package/runtime/lib/core/initData.js.map +1 -1
- package/runtime/lib/core/lynx/dynamic-import.js.map +1 -1
- package/runtime/lib/core/lynx/lazy-bundle.js.map +1 -1
- package/runtime/lib/core/lynx/runtime-backend.js.map +1 -1
- package/runtime/lib/core/lynx/runtime-version.js.map +1 -1
- package/runtime/lib/core/lynx-data-processors.js.map +1 -1
- package/runtime/lib/core/lynx-page-data.js.map +1 -1
- package/runtime/lib/core/lynx-update-data.js.map +1 -1
- package/runtime/lib/core/main-thread-function.js.map +1 -1
- package/runtime/lib/core/main-thread-object-handle-registry.d.ts +3 -0
- package/runtime/lib/core/main-thread-object-handle-registry.js +17 -0
- package/runtime/lib/core/main-thread-object-handle-registry.js.map +1 -0
- package/runtime/lib/core/main-thread-object.d.ts +77 -0
- package/runtime/lib/core/main-thread-object.js +258 -0
- package/runtime/lib/core/main-thread-object.js.map +1 -0
- package/runtime/lib/core/main-thread-ref-id.d.ts +1 -0
- package/runtime/lib/core/main-thread-ref-id.js +14 -0
- package/runtime/lib/core/main-thread-ref-id.js.map +1 -0
- package/runtime/lib/core/main-thread-ref-init-value.d.ts +1 -1
- package/runtime/lib/core/main-thread-ref-init-value.js +4 -2
- package/runtime/lib/core/main-thread-ref-init-value.js.map +1 -1
- package/runtime/lib/core/main-thread-ref.d.ts +4 -0
- package/runtime/lib/core/main-thread-ref.js +5 -8
- package/runtime/lib/core/main-thread-ref.js.map +1 -1
- package/runtime/lib/core/mts-capability.js.map +1 -1
- package/runtime/lib/core/performance.js.map +1 -1
- package/runtime/lib/core/ref.js.map +1 -1
- package/runtime/lib/core/reload-version.js.map +1 -1
- package/runtime/lib/core/runtime-destroy.js.map +1 -1
- package/runtime/lib/core/thread-function-call/main-thread.js.map +1 -1
- package/runtime/lib/core/thread-function-call/return-value.js.map +1 -1
- package/runtime/lib/document.js.map +1 -1
- package/runtime/lib/element-template/background/attr-slots.js.map +1 -1
- package/runtime/lib/element-template/background/commit-context.js.map +1 -1
- package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
- package/runtime/lib/element-template/background/destroy.js.map +1 -1
- package/runtime/lib/element-template/background/document.js.map +1 -1
- package/runtime/lib/element-template/background/hydrate.js.map +1 -1
- package/runtime/lib/element-template/background/hydration-listener.js.map +1 -1
- package/runtime/lib/element-template/background/instance.js.map +1 -1
- package/runtime/lib/element-template/background/manager.js.map +1 -1
- package/runtime/lib/element-template/background/page-root-hydrate.js.map +1 -1
- package/runtime/lib/element-template/background/render-scope.js.map +1 -1
- package/runtime/lib/element-template/client/root.js.map +1 -1
- package/runtime/lib/element-template/debug/alog.js.map +1 -1
- package/runtime/lib/element-template/debug/elementPAPICall.js.map +1 -1
- package/runtime/lib/element-template/debug/profile.js.map +1 -1
- package/runtime/lib/element-template/hydration-map.js.map +1 -1
- package/runtime/lib/element-template/index.d.ts +2 -0
- package/runtime/lib/element-template/index.js +1 -0
- package/runtime/lib/element-template/index.js.map +1 -1
- package/runtime/lib/element-template/internal.d.ts +1 -1
- package/runtime/lib/element-template/internal.js +1 -1
- package/runtime/lib/element-template/internal.js.map +1 -1
- package/runtime/lib/element-template/jsx-dev-runtime/index.js.map +1 -1
- package/runtime/lib/element-template/jsx-runtime/index.js.map +1 -1
- package/runtime/lib/element-template/lynx/env.js.map +1 -1
- package/runtime/lib/element-template/lynx/performance.js.map +1 -1
- package/runtime/lib/element-template/native/callDestroyLifetimeFun.js.map +1 -1
- package/runtime/lib/element-template/native/index.js.map +1 -1
- package/runtime/lib/element-template/native/main-thread-api.js.map +1 -1
- package/runtime/lib/element-template/native/mts-destroy.js.map +1 -1
- package/runtime/lib/element-template/native/patch-listener.js.map +1 -1
- package/runtime/lib/element-template/native/reload-background.js.map +1 -1
- package/runtime/lib/element-template/native/reload-main-thread.js.map +1 -1
- package/runtime/lib/element-template/prop-adapters/event-value.js.map +1 -1
- package/runtime/lib/element-template/prop-adapters/event.js.map +1 -1
- package/runtime/lib/element-template/prop-adapters/ref.js.map +1 -1
- package/runtime/lib/element-template/prop-adapters/spread.js.map +1 -1
- package/runtime/lib/element-template/protocol/lifecycle-constant.js.map +1 -1
- package/runtime/lib/element-template/protocol/opcodes.js.map +1 -1
- package/runtime/lib/element-template/protocol/page.js.map +1 -1
- package/runtime/lib/element-template/protocol/template-type.js.map +1 -1
- package/runtime/lib/element-template/protocol/types.d.ts +1 -1
- package/runtime/lib/element-template/protocol/types.js.map +1 -1
- package/runtime/lib/element-template/protocol/update-event.js.map +1 -1
- package/runtime/lib/element-template/runtime/list/list.js.map +1 -1
- package/runtime/lib/element-template/runtime/page/authored-page.js.map +1 -1
- package/runtime/lib/element-template/runtime/page/page.js.map +1 -1
- package/runtime/lib/element-template/runtime/page/root-instance.js.map +1 -1
- package/runtime/lib/element-template/runtime/patch.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/create-rendered-host.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/host.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-components.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-direct.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/handle.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-background-function.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-event-ctx.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-function.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-ref-ctx.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/registry.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/typed-attributes.js.map +1 -1
- package/runtime/lib/element-template/runtime-marker.js.map +1 -1
- package/runtime/lib/index.js.map +1 -1
- package/runtime/lib/internal.d.ts +1 -1
- package/runtime/lib/internal.js +1 -1
- package/runtime/lib/internal.js.map +1 -1
- package/runtime/lib/lynx-api.d.ts +34 -0
- package/runtime/lib/lynx-api.js +21 -0
- package/runtime/lib/lynx-api.js.map +1 -1
- package/runtime/lib/lynx.js +4 -1
- package/runtime/lib/lynx.js.map +1 -1
- package/runtime/lib/root.js.map +1 -1
- package/runtime/lib/runtime-marker.js.map +1 -1
- package/runtime/lib/shared/attribute-name.js.map +1 -1
- package/runtime/lib/shared/component-stack.js.map +1 -1
- package/runtime/lib/shared/index-map.js.map +1 -1
- package/runtime/lib/shared/profile.js.map +1 -1
- package/runtime/lib/shared/render-constants.js.map +1 -1
- package/runtime/lib/snapshot/alog/elementPAPICall.js.map +1 -1
- package/runtime/lib/snapshot/alog/index.js.map +1 -1
- package/runtime/lib/snapshot/alog/render.js.map +1 -1
- package/runtime/lib/snapshot/compat/componentIs.js.map +1 -1
- package/runtime/lib/snapshot/debug/debug.js.map +1 -1
- package/runtime/lib/snapshot/debug/describeInvalidValue.js.map +1 -1
- package/runtime/lib/snapshot/debug/formatPatch.js.map +1 -1
- package/runtime/lib/snapshot/debug/printSnapshot.js.map +1 -1
- package/runtime/lib/snapshot/debug/profileHooks.js.map +1 -1
- package/runtime/lib/snapshot/debug/vnodeSource.js.map +1 -1
- package/runtime/lib/snapshot/gesture/processGesture.js.map +1 -1
- package/runtime/lib/snapshot/gesture/processGestureBagkround.js.map +1 -1
- package/runtime/lib/snapshot/gesture/types.js.map +1 -1
- package/runtime/lib/snapshot/index.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/constant.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/destroy.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/event/delayEvents.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/event/delayLifecycleEvents.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/event/firstScreenSync.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/isRendering.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/commit.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/error.d.ts +11 -1
- package/runtime/lib/snapshot/lifecycle/patch/error.js +24 -16
- package/runtime/lib/snapshot/lifecycle/patch/error.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/globalState.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/isMainThreadHydrating.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/nodesRefApply.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.d.ts +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js +29 -7
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js +2 -2
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/ref/delay.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/reload.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/render.js.map +1 -1
- package/runtime/lib/snapshot/list/list.js.map +1 -1
- package/runtime/lib/snapshot/list/listUpdateInfo.js.map +1 -1
- package/runtime/lib/snapshot/list/pendingListUpdates.js.map +1 -1
- package/runtime/lib/snapshot/lynx/calledByNative.js.map +1 -1
- package/runtime/lib/snapshot/lynx/children.d.ts +2 -0
- package/runtime/lib/snapshot/lynx/children.js.map +1 -1
- package/runtime/lib/snapshot/lynx/element.d.ts +8 -0
- package/runtime/lib/snapshot/lynx/element.js +4 -0
- package/runtime/lib/snapshot/lynx/element.js.map +1 -1
- package/runtime/lib/snapshot/lynx/env.js.map +1 -1
- package/runtime/lib/snapshot/lynx/injectLepusMethods.js.map +1 -1
- package/runtime/lib/snapshot/lynx/lazyBundleConstants.js.map +1 -1
- package/runtime/lib/snapshot/lynx/nodesRef.js.map +1 -1
- package/runtime/lib/snapshot/lynx/performance.js.map +1 -1
- package/runtime/lib/snapshot/lynx/portals.js.map +1 -1
- package/runtime/lib/snapshot/lynx/portalsPending.js.map +1 -1
- package/runtime/lib/snapshot/lynx/prepareLazyBundleMTS.js.map +1 -1
- package/runtime/lib/snapshot/lynx/runWithForce.js.map +1 -1
- package/runtime/lib/snapshot/lynx/suspense.js.map +1 -1
- package/runtime/lib/snapshot/lynx/tt.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/hydrate.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/index.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/opcodes.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/constants.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/definition.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/dynamicPartType.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/event.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/gesture.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/index.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/list.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/platformInfo.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/reconstructInstanceTree.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/ref.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/snapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/snapshotCreatorMap.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/snapshotInstanceHydrationMap.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/snapshotInstanceManager.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/spread.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/types.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/utils.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/workletEvent.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/workletRef.js.map +1 -1
- package/runtime/lib/snapshot/worklet/call/runOnMainThread.d.ts +2 -0
- package/runtime/lib/snapshot/worklet/call/runOnMainThread.js +2 -0
- package/runtime/lib/snapshot/worklet/call/runOnMainThread.js.map +1 -1
- package/runtime/lib/snapshot/worklet/ctx.js.map +1 -1
- package/runtime/lib/snapshot/worklet/destroy.js.map +1 -1
- package/runtime/lib/snapshot/worklet/functionality.js.map +1 -1
- package/runtime/lib/snapshot/worklet/hmr.js.map +1 -1
- package/runtime/lib/snapshot/worklet/ref/updateInitValue.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -1
- package/runtime/lib/utils.js.map +1 -1
- package/runtime/lib/worklet-runtime/api/animation/animation.js.map +1 -1
- package/runtime/lib/worklet-runtime/api/animation/effect.js.map +1 -1
- package/runtime/lib/worklet-runtime/api/element.js.map +1 -1
- package/runtime/lib/worklet-runtime/api/lepusQuerySelector.js.map +1 -1
- package/runtime/lib/worklet-runtime/api/lynxApi.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/bindings.d.ts +3 -3
- package/runtime/lib/worklet-runtime/bindings/bindings.js +9 -1
- package/runtime/lib/worklet-runtime/bindings/bindings.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/events.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/index.d.ts +0 -1
- package/runtime/lib/worklet-runtime/bindings/index.js +0 -1
- package/runtime/lib/worklet-runtime/bindings/index.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/observers.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/types.d.ts +3 -6
- package/runtime/lib/worklet-runtime/bindings/types.js.map +1 -1
- package/runtime/lib/worklet-runtime/delayRunOnBackground.js.map +1 -1
- package/runtime/lib/worklet-runtime/delayWorkletEvent.js.map +1 -1
- package/runtime/lib/worklet-runtime/eomImpl.js.map +1 -1
- package/runtime/lib/worklet-runtime/eventPropagation.js.map +1 -1
- package/runtime/lib/worklet-runtime/global.js.map +1 -1
- package/runtime/lib/worklet-runtime/hydrate.js +26 -7
- package/runtime/lib/worklet-runtime/hydrate.js.map +1 -1
- package/runtime/lib/worklet-runtime/index.js +6 -0
- package/runtime/lib/worklet-runtime/index.js.map +1 -1
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js.map +1 -1
- package/runtime/lib/worklet-runtime/listeners.js.map +1 -1
- package/runtime/lib/worklet-runtime/mainThreadObject.d.ts +8 -0
- package/runtime/lib/worklet-runtime/mainThreadObject.js +67 -0
- package/runtime/lib/worklet-runtime/mainThreadObject.js.map +1 -0
- package/runtime/lib/worklet-runtime/runOnMainThread.js.map +1 -1
- package/runtime/lib/worklet-runtime/utils/mainThreadFlushLoopGuard.js.map +1 -1
- package/runtime/lib/worklet-runtime/utils/profile.js.map +1 -1
- package/runtime/lib/worklet-runtime/utils/version.js.map +1 -1
- package/runtime/lib/worklet-runtime/workletRef.d.ts +11 -7
- package/runtime/lib/worklet-runtime/workletRef.js +72 -9
- package/runtime/lib/worklet-runtime/workletRef.js.map +1 -1
- package/runtime/lib/worklet-runtime/workletRuntime.js +68 -9
- package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
- package/runtime/package.json +2 -3
- package/runtime/src/core/background-function/run-on-background.ts +16 -0
- package/runtime/src/core/capture-main-thread-object.ts +17 -0
- package/runtime/src/core/globalProps.ts +2 -0
- package/runtime/src/core/hooks/react.ts +4 -0
- package/runtime/src/core/hooks/useLynxGlobalEventListener.ts +2 -0
- package/runtime/src/core/initData.ts +2 -0
- package/runtime/src/core/main-thread-object-handle-registry.ts +25 -0
- package/runtime/src/core/main-thread-object.ts +380 -0
- package/runtime/src/core/main-thread-ref-id.ts +16 -0
- package/runtime/src/core/main-thread-ref-init-value.ts +12 -4
- package/runtime/src/core/main-thread-ref.ts +7 -8
- package/runtime/src/element-template/background/commit-hook.ts +1 -1
- package/runtime/src/element-template/index.ts +6 -0
- package/runtime/src/element-template/internal.ts +2 -1
- package/runtime/src/element-template/protocol/types.ts +1 -1
- package/runtime/src/internal.ts +1 -1
- package/runtime/src/lynx-api.ts +38 -0
- package/runtime/src/lynx.ts +5 -1
- package/runtime/src/snapshot/lifecycle/patch/error.ts +36 -19
- package/runtime/src/snapshot/lifecycle/patch/snapshotPatchApply.ts +29 -7
- package/runtime/src/snapshot/lifecycle/patch/updateMainThread.ts +2 -2
- package/runtime/src/snapshot/lynx/children.ts +2 -0
- package/runtime/src/snapshot/lynx/element.ts +8 -0
- package/runtime/src/snapshot/worklet/call/runOnMainThread.ts +2 -0
- package/runtime/src/snapshot/worklet/ref/updateInitValue.ts +1 -1
- package/runtime/src/worklet-runtime/bindings/bindings.ts +17 -2
- package/runtime/src/worklet-runtime/bindings/index.ts +0 -1
- package/runtime/src/worklet-runtime/bindings/types.ts +7 -11
- package/runtime/src/worklet-runtime/hydrate.ts +43 -10
- package/runtime/src/worklet-runtime/index.ts +7 -0
- package/runtime/src/worklet-runtime/mainThreadObject.ts +117 -0
- package/runtime/src/worklet-runtime/workletRef.ts +120 -19
- package/runtime/src/worklet-runtime/workletRuntime.ts +83 -11
- package/runtime/tsconfig.json +2 -0
- package/runtime/vitest.config.ts +4 -0
- package/testing-library/.turbo/turbo-build.log +11 -11
- package/testing-library/dist/env/index.js +3 -15
- package/testing-library/dist/index.d.ts +165 -2
- package/testing-library/dist/plugins/index.js +10 -0
- package/testing-library/dist/rstest-config.js +15 -0
- package/testing-library/dist/setupFiles/common/worklet-runtime-init.js +11 -0
- package/testing-library/package.json +2 -1
- package/testing-library/rstest.config.ts +3 -0
- package/testing-library/src/__tests__/lynx.test.jsx +1 -1
- package/testing-library/src/__tests__/rstest-config.test.js +34 -1
- package/testing-library/src/__tests__/worklet.test.jsx +87 -33
- package/testing-library/src/plugins/vitest.ts +5 -1
- package/testing-library/src/rstest-config.ts +17 -1
- package/testing-library/src/setupFiles/common/worklet-runtime-init.js +22 -0
- package/testing-library/tsconfig.docs.json +9 -0
- package/testing-library/typedoc.json +22 -0
- package/transform/.turbo/turbo-build$colon$wasm.log +135 -73
- package/transform/__test__/defines.spec.js +80 -12
- package/transform/__test__/fixture.spec.js +231 -71
- package/transform/__test__/object-methods.spec.js +82 -0
- package/transform/crates/swc_plugin_worklet/decl_collect.rs +10 -0
- package/transform/crates/swc_plugin_worklet/extract_ident.rs +14 -0
- package/transform/crates/swc_plugin_worklet/gen_stmt.rs +228 -13
- package/transform/crates/swc_plugin_worklet/lib.rs +599 -150
- package/transform/crates/swc_plugin_worklet/napi.rs +10 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_capture_env_js.js +8 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_capture_env_lepus.js +12 -7
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_expose_object_method_capture_channels_js.js +27 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_expose_object_method_capture_channels_lepus.js +43 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_ident_from_this_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_js.js +16 -14
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_lepus.js +18 -18
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_3_lepus.js +3 -5
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_4_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_js.js +7 -5
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_lepus.js +9 -9
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_computed_object_method_key_lepus.js +22 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_globals.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_object_method_local_decls_lepus.js +14 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_type_annotations.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_destructure_from_closure.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_extract_catch_clause_params.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_extract_idents_inside_of_ctx.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_transform_recursively.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_preserve_main_thread_objects_in_class_js.js +42 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_preserve_main_thread_objects_in_class_lepus.js +58 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_arrow_function.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_fn_decl_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_function_expr.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_property_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_static_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_static_property_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_js.js +3 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_js_fn_in_run_on_js_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus.js +5 -5
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus_alias.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus_general.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus_general_mixed.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_multiple_worklets.js +3 -5
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_multiple_worklets_in_func.js +3 -5
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_object_methods_js.js +9 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_object_methods_lepus.js +14 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_ui_worklet_lepus.js +2 -4
- package/transform/dist/wasm.cjs +1 -1
- package/transform/index.d.ts +25 -1
- package/transform/rspack-napi/tsconfig.tsbuildinfo +1 -1
- package/transform/src/lib.rs +193 -23
- package/transform/swc-plugin-reactlynx/.turbo/turbo-build.log +63 -467
- package/transform/swc-plugin-reactlynx/swc_plugin_reactlynx.wasm +0 -0
- package/transform/swc-plugin-reactlynx-compat/.turbo/turbo-build.log +340 -28
- package/transform/swc-plugin-reactlynx-compat/swc_plugin_reactlynx_compat.wasm +0 -0
- package/transform/vitest.config.ts +5 -1
- package/types/react.docs.d.ts +130 -11
- package/runtime/lib/worklet-runtime/bindings/loadRuntime.d.ts +0 -8
- package/runtime/lib/worklet-runtime/bindings/loadRuntime.js +0 -23
- package/runtime/lib/worklet-runtime/bindings/loadRuntime.js.map +0 -1
- package/runtime/src/worklet-runtime/bindings/loadRuntime.ts +0 -25
- package/runtime/worklet-runtime/dev.js +0 -638
- package/runtime/worklet-runtime/main.js +0 -1
- package/testing-library/node_modules/.bin/rsbuild +0 -68
- package/testing-library/node_modules/.bin/rspeedy +0 -68
- package/testing-library/node_modules/.bin/rstest +0 -68
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_add_worklet_runtime_ident_with_inner_ident.js +0 -13
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_add_worklet_runtime_ident_with_outer_ident.js +0 -13
- package/transform/node_modules/.bin/esbuild +0 -59
- package/transform/node_modules/.bin/napi +0 -68
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
use napi_derive::napi;
|
|
2
|
+
use std::cell::Cell;
|
|
3
|
+
use std::rc::Rc;
|
|
2
4
|
|
|
3
5
|
use swc_core::ecma::ast::*;
|
|
4
6
|
use swc_core::ecma::visit::{noop_visit_mut_type, VisitMut};
|
|
@@ -23,6 +25,8 @@ pub struct WorkletVisitorConfig {
|
|
|
23
25
|
/// @internal
|
|
24
26
|
#[napi(ts_type = "'LEPUS' | 'JS' | 'MIXED'")]
|
|
25
27
|
pub target: TransformTarget,
|
|
28
|
+
/// Module providing worklet helpers. The init entry uses this path with a
|
|
29
|
+
/// trailing `/internal` removed, followed by `/worklet-runtime/init`.
|
|
26
30
|
pub runtime_pkg: String,
|
|
27
31
|
}
|
|
28
32
|
|
|
@@ -32,7 +36,7 @@ impl Default for WorkletVisitorConfig {
|
|
|
32
36
|
filename: "index.js".into(),
|
|
33
37
|
target: TransformTarget::LEPUS,
|
|
34
38
|
custom_global_ident_names: None,
|
|
35
|
-
runtime_pkg: "
|
|
39
|
+
runtime_pkg: "@lynx-js/react/internal".into(),
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
}
|
|
@@ -103,6 +107,11 @@ impl WorkletVisitor {
|
|
|
103
107
|
self
|
|
104
108
|
}
|
|
105
109
|
|
|
110
|
+
pub fn with_main_thread_programmability(mut self, result: Rc<Cell<bool>>) -> Self {
|
|
111
|
+
self.inner = self.inner.with_main_thread_programmability(result);
|
|
112
|
+
self
|
|
113
|
+
}
|
|
114
|
+
|
|
106
115
|
pub fn with_defines_collector(mut self, collector: DefinesCollector) -> Self {
|
|
107
116
|
self.inner.defines_collector = Some(collector);
|
|
108
117
|
self
|
package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_capture_env_js.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import { captureMainThreadObject as __captureMainThreadObject } from "@lynx-js/react";
|
|
2
|
+
var captureMainThreadObject = __captureMainThreadObject;
|
|
1
3
|
let Y = {
|
|
2
4
|
_c: {
|
|
3
5
|
y1,
|
|
4
6
|
y2,
|
|
5
7
|
y3,
|
|
6
8
|
y4,
|
|
7
|
-
y5: {
|
|
9
|
+
y5: captureMainThreadObject(y5) ?? {
|
|
8
10
|
r: y5.r
|
|
11
|
+
},
|
|
12
|
+
props: captureMainThreadObject(props) ?? {
|
|
13
|
+
value: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
14
|
+
get: __mainThreadObjectSource.get
|
|
15
|
+
})(props.value)
|
|
9
16
|
}
|
|
10
17
|
},
|
|
11
18
|
_wkltId: "a77b:test:1"
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
2
|
+
import { captureMainThreadObject as __captureMainThreadObject } from "@lynx-js/react";
|
|
3
|
+
var captureMainThreadObject = __captureMainThreadObject;
|
|
3
4
|
let Y = {
|
|
4
5
|
_c: {
|
|
5
6
|
y1,
|
|
6
7
|
y2,
|
|
7
8
|
y3,
|
|
8
9
|
y4,
|
|
9
|
-
y5: {
|
|
10
|
+
y5: captureMainThreadObject(y5) ?? {
|
|
10
11
|
r: y5.r
|
|
12
|
+
},
|
|
13
|
+
props: captureMainThreadObject(props) ?? {
|
|
14
|
+
value: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
15
|
+
get: __mainThreadObjectSource.get
|
|
16
|
+
})(props.value)
|
|
11
17
|
}
|
|
12
18
|
},
|
|
13
19
|
_wkltId: "a77b:test:1"
|
|
14
20
|
};
|
|
15
|
-
|
|
16
|
-
__workletRuntimeLoaded && registerWorkletInternal("main-thread", "a77b:test:1", function() {
|
|
21
|
+
__registerWorklet("main-thread", "a77b:test:1", function() {
|
|
17
22
|
const Y = lynxWorkletImpl._workletMap["a77b:test:1"].bind(this);
|
|
18
|
-
let { y1, y2, y3, y4, y5 } = this["_c"];
|
|
23
|
+
let { y1, y2, y3, y4, y5, props } = this["_c"];
|
|
19
24
|
"main thread";
|
|
20
25
|
let a = 123;
|
|
21
26
|
const b = [
|
|
@@ -31,5 +36,5 @@ __workletRuntimeLoaded && registerWorkletInternal("main-thread", "a77b:test:1",
|
|
|
31
36
|
e: y4
|
|
32
37
|
}
|
|
33
38
|
};
|
|
34
|
-
return y5.r;
|
|
39
|
+
return y5.r + props.value.get();
|
|
35
40
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { transformToWorklet as __transformToWorklet } from "@lynx-js/react";
|
|
2
|
+
var transformToWorklet = __transformToWorklet;
|
|
3
|
+
const callback = ()=>{};
|
|
4
|
+
const valueType = defineMainThreadObjectType({
|
|
5
|
+
type: '@test/capturing-value',
|
|
6
|
+
helper: 1,
|
|
7
|
+
callback,
|
|
8
|
+
get callbackOnly () {
|
|
9
|
+
return {
|
|
10
|
+
_wkltId: "a77b:test:1",
|
|
11
|
+
_jsFn: {
|
|
12
|
+
_jsFn1: transformToWorklet(this.callback)
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
get create () {
|
|
17
|
+
return {
|
|
18
|
+
_wkltId: "a77b:test:2",
|
|
19
|
+
_jsFn: {
|
|
20
|
+
_jsFn1: transformToWorklet(callback)
|
|
21
|
+
},
|
|
22
|
+
...{
|
|
23
|
+
helper: this.helper
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
2
|
+
const callback = ()=>{};
|
|
3
|
+
const valueType = defineMainThreadObjectType({
|
|
4
|
+
type: '@test/capturing-value',
|
|
5
|
+
helper: 1,
|
|
6
|
+
callback,
|
|
7
|
+
get callbackOnly () {
|
|
8
|
+
return {
|
|
9
|
+
_wkltId: "a77b:test:1",
|
|
10
|
+
_jsFn: {
|
|
11
|
+
_jsFn1: {
|
|
12
|
+
_isFirstScreen: true
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
get create () {
|
|
18
|
+
return {
|
|
19
|
+
_wkltId: "a77b:test:2",
|
|
20
|
+
_jsFn: {
|
|
21
|
+
_jsFn1: {
|
|
22
|
+
_isFirstScreen: true
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
...{
|
|
26
|
+
helper: this.helper
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
__registerWorklet("main-thread", "a77b:test:1", function() {
|
|
32
|
+
let { _jsFn1 } = this["_jsFn"];
|
|
33
|
+
"main thread";
|
|
34
|
+
runOnBackground(_jsFn1)();
|
|
35
|
+
});
|
|
36
|
+
__registerWorklet("main-thread", "a77b:test:2", function(initialValue: number) {
|
|
37
|
+
let { _jsFn1 } = this["_jsFn"];
|
|
38
|
+
"main thread";
|
|
39
|
+
runOnBackground(_jsFn1)();
|
|
40
|
+
return {
|
|
41
|
+
value: initialValue + this.helper
|
|
42
|
+
};
|
|
43
|
+
});
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var loadWorkletRuntime = __loadWorkletRuntime;
|
|
1
|
+
import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
3
2
|
let onTapLepus = {
|
|
4
3
|
_wkltId: "a123:test:1",
|
|
5
4
|
...{
|
|
6
5
|
a: this.a
|
|
7
6
|
}
|
|
8
7
|
};
|
|
9
|
-
|
|
10
|
-
__workletRuntimeLoaded && registerWorkletInternal("main-thread", "a123:test:1", function(event: ReactLynx.Worklet.ITouchEvent) {
|
|
8
|
+
__registerWorklet("main-thread", "a123:test:1", function(event: ReactLynx.Worklet.ITouchEvent) {
|
|
11
9
|
const onTapLepus = lynxWorkletImpl._workletMap["a123:test:1"].bind(this);
|
|
12
10
|
"main thread";
|
|
13
11
|
let a = 1;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { captureMainThreadObject as __captureMainThreadObject } from "@lynx-js/react";
|
|
2
|
+
var captureMainThreadObject = __captureMainThreadObject;
|
|
1
3
|
let onTapLepus = {
|
|
2
4
|
_c: {
|
|
3
5
|
aaaa,
|
|
@@ -8,22 +10,22 @@ let onTapLepus = {
|
|
|
8
10
|
_wkltId: "a123:test:1",
|
|
9
11
|
...{
|
|
10
12
|
aaaa: this.aaaa,
|
|
11
|
-
bbbb: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
bbbb: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
14
|
+
cccc: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
15
|
+
dddd: __mainThreadObjectSource.dddd
|
|
16
|
+
})(__mainThreadObjectSource.cccc)
|
|
17
|
+
})(this.bbbb),
|
|
16
18
|
eeee: this.eeee,
|
|
17
19
|
ffff: this.ffff,
|
|
18
|
-
hhhh: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
hhhh: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
21
|
+
'iiii': __mainThreadObjectSource['iiii'],
|
|
22
|
+
kkkk: __mainThreadObjectSource.kkkk
|
|
23
|
+
})(this.hhhh),
|
|
22
24
|
llll: this.llll,
|
|
23
|
-
mmmm: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
mmmm: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
26
|
+
nnnn: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
27
|
+
'oooo': __mainThreadObjectSource['oooo']
|
|
28
|
+
})(__mainThreadObjectSource.nnnn)
|
|
29
|
+
})(this.mmmm)
|
|
28
30
|
}
|
|
29
31
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
2
|
+
import { captureMainThreadObject as __captureMainThreadObject } from "@lynx-js/react";
|
|
3
|
+
var captureMainThreadObject = __captureMainThreadObject;
|
|
3
4
|
let onTapLepus = {
|
|
4
5
|
_c: {
|
|
5
6
|
aaaa,
|
|
@@ -10,27 +11,26 @@ let onTapLepus = {
|
|
|
10
11
|
_wkltId: "a123:test:1",
|
|
11
12
|
...{
|
|
12
13
|
aaaa: this.aaaa,
|
|
13
|
-
bbbb: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
bbbb: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
15
|
+
cccc: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
16
|
+
dddd: __mainThreadObjectSource.dddd
|
|
17
|
+
})(__mainThreadObjectSource.cccc)
|
|
18
|
+
})(this.bbbb),
|
|
18
19
|
eeee: this.eeee,
|
|
19
20
|
ffff: this.ffff,
|
|
20
|
-
hhhh: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
hhhh: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
22
|
+
'iiii': __mainThreadObjectSource['iiii'],
|
|
23
|
+
kkkk: __mainThreadObjectSource.kkkk
|
|
24
|
+
})(this.hhhh),
|
|
24
25
|
llll: this.llll,
|
|
25
|
-
mmmm: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
mmmm: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
27
|
+
nnnn: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
28
|
+
'oooo': __mainThreadObjectSource['oooo']
|
|
29
|
+
})(__mainThreadObjectSource.nnnn)
|
|
30
|
+
})(this.mmmm)
|
|
30
31
|
}
|
|
31
32
|
};
|
|
32
|
-
|
|
33
|
-
__workletRuntimeLoaded && registerWorkletInternal("main-thread", "a123:test:1", function() {
|
|
33
|
+
__registerWorklet("main-thread", "a123:test:1", function() {
|
|
34
34
|
const onTapLepus = lynxWorkletImpl._workletMap["a123:test:1"].bind(this);
|
|
35
35
|
let { aaaa, bbbb, eeee, ffff } = this["_c"];
|
|
36
36
|
"main thread";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var loadWorkletRuntime = __loadWorkletRuntime;
|
|
1
|
+
import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
3
2
|
let enableScroll = {
|
|
4
3
|
_c: {
|
|
5
4
|
containerID,
|
|
@@ -12,8 +11,7 @@ let enableScroll = {
|
|
|
12
11
|
let makeVelocityIfRequired = {
|
|
13
12
|
_wkltId: "a123:test:2"
|
|
14
13
|
};
|
|
15
|
-
|
|
16
|
-
__workletRuntimeLoaded && registerWorkletInternal("main-thread", "a123:test:1", function(enable: boolean) {
|
|
14
|
+
__registerWorklet("main-thread", "a123:test:1", function(enable: boolean) {
|
|
17
15
|
const enableScroll = lynxWorkletImpl._workletMap["a123:test:1"].bind(this);
|
|
18
16
|
let { containerID, a, b, f } = this["_c"];
|
|
19
17
|
'main thread';
|
|
@@ -23,7 +21,7 @@ __workletRuntimeLoaded && registerWorkletInternal("main-thread", "a123:test:1",
|
|
|
23
21
|
e: f
|
|
24
22
|
}).e;
|
|
25
23
|
});
|
|
26
|
-
|
|
24
|
+
__registerWorklet("main-thread", "a123:test:2", function(nodeRef: MainThreadRef<Velocity>, velocity: boolean) {
|
|
27
25
|
const makeVelocityIfRequired = lynxWorkletImpl._workletMap["a123:test:2"].bind(this);
|
|
28
26
|
'main thread';
|
|
29
27
|
class Velocity implements Velocity {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var loadWorkletRuntime = __loadWorkletRuntime;
|
|
1
|
+
import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
3
2
|
let enableScroll = {
|
|
4
3
|
_wkltId: "a123:test:1"
|
|
5
4
|
};
|
|
6
|
-
|
|
7
|
-
__workletRuntimeLoaded && registerWorkletInternal("main-thread", "a123:test:1", function(enable: boolean) {
|
|
5
|
+
__registerWorklet("main-thread", "a123:test:1", function(enable: boolean) {
|
|
8
6
|
const enableScroll = lynxWorkletImpl._workletMap["a123:test:1"].bind(this);
|
|
9
7
|
'main thread';
|
|
10
8
|
function x() {
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
+
import { captureMainThreadObject as __captureMainThreadObject } from "@lynx-js/react";
|
|
2
|
+
var captureMainThreadObject = __captureMainThreadObject;
|
|
1
3
|
let onTapLepus = {
|
|
2
4
|
_c: {
|
|
3
|
-
aaaa: {
|
|
5
|
+
aaaa: captureMainThreadObject(aaaa) ?? {
|
|
4
6
|
bbbb: aaaa.bbbb
|
|
5
7
|
},
|
|
6
|
-
cccc: {
|
|
8
|
+
cccc: captureMainThreadObject(cccc) ?? {
|
|
7
9
|
dddd: cccc.dddd
|
|
8
10
|
},
|
|
9
|
-
hhhh: {
|
|
11
|
+
hhhh: captureMainThreadObject(hhhh) ?? {
|
|
10
12
|
iiii: hhhh.iiii
|
|
11
13
|
},
|
|
12
14
|
llll,
|
|
13
|
-
oooo: {
|
|
15
|
+
oooo: captureMainThreadObject(oooo) ?? {
|
|
14
16
|
pppp: oooo.pppp,
|
|
15
17
|
qqqq: oooo.qqqq
|
|
16
18
|
},
|
|
17
19
|
rrrr,
|
|
18
|
-
uuuu: {
|
|
20
|
+
uuuu: captureMainThreadObject(uuuu) ?? {
|
|
19
21
|
"__??__": uuuu["__??__"]
|
|
20
22
|
}
|
|
21
23
|
},
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
2
|
+
import { captureMainThreadObject as __captureMainThreadObject } from "@lynx-js/react";
|
|
3
|
+
var captureMainThreadObject = __captureMainThreadObject;
|
|
3
4
|
let onTapLepus = {
|
|
4
5
|
_c: {
|
|
5
|
-
aaaa: {
|
|
6
|
+
aaaa: captureMainThreadObject(aaaa) ?? {
|
|
6
7
|
bbbb: aaaa.bbbb
|
|
7
8
|
},
|
|
8
|
-
cccc: {
|
|
9
|
+
cccc: captureMainThreadObject(cccc) ?? {
|
|
9
10
|
dddd: cccc.dddd
|
|
10
11
|
},
|
|
11
|
-
hhhh: {
|
|
12
|
+
hhhh: captureMainThreadObject(hhhh) ?? {
|
|
12
13
|
iiii: hhhh.iiii
|
|
13
14
|
},
|
|
14
15
|
llll,
|
|
15
|
-
oooo: {
|
|
16
|
+
oooo: captureMainThreadObject(oooo) ?? {
|
|
16
17
|
pppp: oooo.pppp,
|
|
17
18
|
qqqq: oooo.qqqq
|
|
18
19
|
},
|
|
19
20
|
rrrr,
|
|
20
|
-
uuuu: {
|
|
21
|
+
uuuu: captureMainThreadObject(uuuu) ?? {
|
|
21
22
|
"__??__": uuuu["__??__"]
|
|
22
23
|
}
|
|
23
24
|
},
|
|
24
25
|
_wkltId: "a123:test:1"
|
|
25
26
|
};
|
|
26
|
-
|
|
27
|
-
__workletRuntimeLoaded && registerWorkletInternal("main-thread", "a123:test:1", function() {
|
|
27
|
+
__registerWorklet("main-thread", "a123:test:1", function() {
|
|
28
28
|
const onTapLepus = lynxWorkletImpl._workletMap["a123:test:1"].bind(this);
|
|
29
29
|
let { aaaa, cccc, hhhh, llll, oooo, rrrr, uuuu } = this["_c"];
|
|
30
30
|
"main thread";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
2
|
+
const name = 'create';
|
|
3
|
+
const nestedName = 'read';
|
|
4
|
+
const valueType = defineMainThreadObjectType({
|
|
5
|
+
type: '@test/value',
|
|
6
|
+
[name]: {
|
|
7
|
+
_c: {
|
|
8
|
+
nestedName
|
|
9
|
+
},
|
|
10
|
+
_wkltId: "a77b:test:1"
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
__registerWorklet("main-thread", "a77b:test:1", function(initialValue) {
|
|
14
|
+
let { nestedName } = this["_c"];
|
|
15
|
+
"main thread";
|
|
16
|
+
return {
|
|
17
|
+
value: initialValue,
|
|
18
|
+
[nestedName] (nestedName) {
|
|
19
|
+
return nestedName;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
});
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var loadWorkletRuntime = __loadWorkletRuntime;
|
|
1
|
+
import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
3
2
|
let Y = {
|
|
4
3
|
_wkltId: "a77b:test:1"
|
|
5
4
|
};
|
|
6
|
-
|
|
7
|
-
__workletRuntimeLoaded && registerWorkletInternal("main-thread", "a77b:test:1", function() {
|
|
5
|
+
__registerWorklet("main-thread", "a77b:test:1", function() {
|
|
8
6
|
const Y = lynxWorkletImpl._workletMap["a77b:test:1"].bind(this);
|
|
9
7
|
"main thread";
|
|
10
8
|
console.log(111);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
2
|
+
const valueType = defineMainThreadObjectType({
|
|
3
|
+
type: '@test/value',
|
|
4
|
+
create: {
|
|
5
|
+
_wkltId: "a77b:test:1"
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
__registerWorklet("main-thread", "a77b:test:1", function(initialValue) {
|
|
9
|
+
"main thread";
|
|
10
|
+
const state = {
|
|
11
|
+
value: initialValue
|
|
12
|
+
};
|
|
13
|
+
return state;
|
|
14
|
+
});
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var loadWorkletRuntime = __loadWorkletRuntime;
|
|
1
|
+
import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
3
2
|
let onTapLepus = {
|
|
4
3
|
_c: {
|
|
5
4
|
wv
|
|
6
5
|
},
|
|
7
6
|
_wkltId: "a123:test:1"
|
|
8
7
|
};
|
|
9
|
-
|
|
10
|
-
__workletRuntimeLoaded && registerWorkletInternal("main-thread", "a123:test:1", function(event: ReactLynx.Worklet.ITouchEvent) {
|
|
8
|
+
__registerWorklet("main-thread", "a123:test:1", function(event: ReactLynx.Worklet.ITouchEvent) {
|
|
11
9
|
const onTapLepus = lynxWorkletImpl._workletMap["a123:test:1"].bind(this);
|
|
12
10
|
let { wv } = this["_c"];
|
|
13
11
|
"main thread";
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var loadWorkletRuntime = __loadWorkletRuntime;
|
|
1
|
+
import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
3
2
|
let Y = {
|
|
4
3
|
_wkltId: "a77b:test:1"
|
|
5
4
|
};
|
|
6
|
-
|
|
7
|
-
__workletRuntimeLoaded && registerWorkletInternal("main-thread", "a77b:test:1", function(n) {
|
|
5
|
+
__registerWorklet("main-thread", "a77b:test:1", function(n) {
|
|
8
6
|
const Y = lynxWorkletImpl._workletMap["a77b:test:1"].bind(this);
|
|
9
7
|
"main thread";
|
|
10
8
|
let a = 123;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var loadWorkletRuntime = __loadWorkletRuntime;
|
|
1
|
+
import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
3
2
|
let onTapLepus = {
|
|
4
3
|
_c: {
|
|
5
4
|
g
|
|
6
5
|
},
|
|
7
6
|
_wkltId: "a123:test:1"
|
|
8
7
|
};
|
|
9
|
-
|
|
10
|
-
__workletRuntimeLoaded && registerWorkletInternal("main-thread", "a123:test:1", function(event: ReactLynx.Worklet.ITouchEvent) {
|
|
8
|
+
__registerWorklet("main-thread", "a123:test:1", function(event: ReactLynx.Worklet.ITouchEvent) {
|
|
11
9
|
const onTapLepus = lynxWorkletImpl._workletMap["a123:test:1"].bind(this);
|
|
12
10
|
let { g } = this["_c"];
|
|
13
11
|
"main thread";
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var loadWorkletRuntime = __loadWorkletRuntime;
|
|
1
|
+
import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
3
2
|
let onTapLepus = {
|
|
4
3
|
_wkltId: "a123:test:1"
|
|
5
4
|
};
|
|
6
|
-
|
|
7
|
-
__workletRuntimeLoaded && registerWorkletInternal("main-thread", "a123:test:1", function(event: ReactLynx.Worklet.ITouchEvent) {
|
|
5
|
+
__registerWorklet("main-thread", "a123:test:1", function(event: ReactLynx.Worklet.ITouchEvent) {
|
|
8
6
|
const onTapLepus = lynxWorkletImpl._workletMap["a123:test:1"].bind(this);
|
|
9
7
|
"main thread";
|
|
10
8
|
if (true) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var loadWorkletRuntime = __loadWorkletRuntime;
|
|
1
|
+
import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
3
2
|
let X = {
|
|
4
3
|
_c: {
|
|
5
4
|
y1,
|
|
@@ -9,8 +8,7 @@ let X = {
|
|
|
9
8
|
},
|
|
10
9
|
_wkltId: "a77b:test:1"
|
|
11
10
|
};
|
|
12
|
-
|
|
13
|
-
__workletRuntimeLoaded && registerWorkletInternal("main-thread", "a77b:test:1", function() {
|
|
11
|
+
__registerWorklet("main-thread", "a77b:test:1", function() {
|
|
14
12
|
const X = lynxWorkletImpl._workletMap["a77b:test:1"].bind(this);
|
|
15
13
|
let { y1, y2, z1, z2 } = this["_c"];
|
|
16
14
|
"main thread";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { captureMainThreadObject as __captureMainThreadObject } from "@lynx-js/react";
|
|
2
|
+
var captureMainThreadObject = __captureMainThreadObject;
|
|
3
|
+
class App extends Component {
|
|
4
|
+
value: MotionValue<number>;
|
|
5
|
+
ref: MainThreadRef<number>;
|
|
6
|
+
static value: MotionValue<number>;
|
|
7
|
+
get onTap() {
|
|
8
|
+
return {
|
|
9
|
+
_wkltId: "a123:test:1",
|
|
10
|
+
...{
|
|
11
|
+
value: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
12
|
+
"get": __mainThreadObjectSource["get"],
|
|
13
|
+
set: __mainThreadObjectSource.set
|
|
14
|
+
})(this.value),
|
|
15
|
+
props: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
16
|
+
value: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
17
|
+
get: __mainThreadObjectSource.get
|
|
18
|
+
})(__mainThreadObjectSource.value)
|
|
19
|
+
})(this.props),
|
|
20
|
+
ref: this.ref
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
get onMove() {
|
|
25
|
+
return {
|
|
26
|
+
_wkltId: "a123:test:2",
|
|
27
|
+
...{
|
|
28
|
+
value: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
29
|
+
get: __mainThreadObjectSource.get
|
|
30
|
+
})(this.value)
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
static onStatic = {
|
|
35
|
+
_wkltId: "a123:test:3",
|
|
36
|
+
...{
|
|
37
|
+
value: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
38
|
+
get: __mainThreadObjectSource.get
|
|
39
|
+
})(this.value)
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
2
|
+
import { captureMainThreadObject as __captureMainThreadObject } from "@lynx-js/react";
|
|
3
|
+
var captureMainThreadObject = __captureMainThreadObject;
|
|
4
|
+
class App extends Component {
|
|
5
|
+
value: MotionValue<number>;
|
|
6
|
+
ref: MainThreadRef<number>;
|
|
7
|
+
static value: MotionValue<number>;
|
|
8
|
+
onTap = {
|
|
9
|
+
_wkltId: "a123:test:1",
|
|
10
|
+
...{
|
|
11
|
+
value: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
12
|
+
"get": __mainThreadObjectSource["get"],
|
|
13
|
+
set: __mainThreadObjectSource.set
|
|
14
|
+
})(this.value),
|
|
15
|
+
props: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
16
|
+
value: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
17
|
+
get: __mainThreadObjectSource.get
|
|
18
|
+
})(__mainThreadObjectSource.value)
|
|
19
|
+
})(this.props),
|
|
20
|
+
ref: this.ref
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
onMove = {
|
|
24
|
+
_wkltId: "a123:test:2",
|
|
25
|
+
...{
|
|
26
|
+
value: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
27
|
+
get: __mainThreadObjectSource.get
|
|
28
|
+
})(this.value)
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
static onStatic = {
|
|
32
|
+
_wkltId: "a123:test:3",
|
|
33
|
+
...{
|
|
34
|
+
value: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
35
|
+
get: __mainThreadObjectSource.get
|
|
36
|
+
})(this.value)
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
__registerWorklet("main-thread", "a123:test:1", function() {
|
|
41
|
+
this["onTap"] = lynxWorkletImpl._workletMap["a123:test:1"].bind(this);
|
|
42
|
+
"main thread";
|
|
43
|
+
this.value.get();
|
|
44
|
+
this.props.value.get();
|
|
45
|
+
this.value.set(1);
|
|
46
|
+
this.value?.get();
|
|
47
|
+
this.value["get"]();
|
|
48
|
+
return this.ref.current;
|
|
49
|
+
});
|
|
50
|
+
__registerWorklet("main-thread", "a123:test:2", function() {
|
|
51
|
+
"main thread";
|
|
52
|
+
return this.value.get();
|
|
53
|
+
});
|
|
54
|
+
__registerWorklet("main-thread", "a123:test:3", function() {
|
|
55
|
+
this["onStatic"] = lynxWorkletImpl._workletMap["a123:test:3"].bind(this);
|
|
56
|
+
"main thread";
|
|
57
|
+
return this.value.get();
|
|
58
|
+
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var loadWorkletRuntime = __loadWorkletRuntime;
|
|
1
|
+
import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
3
2
|
import { sharedRuntime } from './utils.js' with {
|
|
4
3
|
runtime: "shared"
|
|
5
4
|
};
|
|
@@ -12,8 +11,7 @@ let worklet = {
|
|
|
12
11
|
y1: this.y1
|
|
13
12
|
}
|
|
14
13
|
};
|
|
15
|
-
|
|
16
|
-
__workletRuntimeLoaded && registerWorkletInternal("main-thread", "a77b:test:1", function(event: Event) {
|
|
14
|
+
__registerWorklet("main-thread", "a77b:test:1", function(event: Event) {
|
|
17
15
|
const worklet = lynxWorkletImpl._workletMap["a77b:test:1"].bind(this);
|
|
18
16
|
let { y1 } = this["_c"];
|
|
19
17
|
"main thread";
|