@lynx-js/react 0.129.0 → 0.129.2
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 +24 -0
- package/components/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/refresh/.turbo/turbo-build.log +1 -1
- package/runtime/__test__/core/globalProps.test.ts +27 -6
- package/runtime/__test__/core/hooks/useLynxGlobalEventListener.test.jsx +1 -1
- package/runtime/__test__/element-template/fixtures/gesture/direct/index.tsx +33 -0
- package/runtime/__test__/element-template/fixtures/spread/mts/index.tsx +197 -0
- package/runtime/__test__/element-template/imports/no-legacy-imports.test.ts +7 -6
- package/runtime/__test__/element-template/internal/legacy-internal-guardrail.test.ts +1 -2
- package/runtime/__test__/element-template/native/callDestroyLifetimeFun.test.ts +89 -3
- package/runtime/__test__/element-template/native/main-thread-api.test.ts +5 -2
- package/runtime/__test__/element-template/native/mts-destroy.test.ts +88 -0
- package/runtime/__test__/element-template/native/reload-dual-thread-communication.test.ts +3 -0
- package/runtime/__test__/element-template/native/reload.test.ts +118 -2
- package/runtime/__test__/element-template/runtime/background/global-props/compiled-fixtures.test.tsx +5 -5
- package/runtime/__test__/element-template/runtime/background/global-props.test.tsx +1 -1
- package/runtime/__test__/element-template/runtime/background/hydrate.test.ts +70 -0
- package/runtime/__test__/element-template/runtime/background/ref/compiled-fixtures.test.tsx +3 -4
- package/runtime/__test__/element-template/runtime/background/reload.test.ts +74 -0
- package/runtime/__test__/element-template/runtime/background/update-timing.test.ts +15 -0
- package/runtime/__test__/element-template/runtime/patch/element-template-patch.test.tsx +212 -7
- package/runtime/__test__/element-template/runtime/patch/update-timing.test.ts +4 -1
- package/runtime/__test__/element-template/runtime/prop-adapters/gesture-compiled.test.ts +200 -0
- package/runtime/__test__/element-template/runtime/prop-adapters/gesture.test.ts +420 -0
- package/runtime/__test__/element-template/runtime/prop-adapters/spread-mts-compiled.test.ts +527 -0
- package/runtime/__test__/element-template/runtime/prop-adapters/spread.test.ts +185 -6
- package/runtime/__test__/element-template/runtime/render/render-direct-native.test.tsx +21 -1
- package/runtime/__test__/element-template/runtime/render/render-direct-suspense.test.ts +4 -1
- package/runtime/__test__/element-template/runtime/render/render-direct.test.ts +4 -1
- package/runtime/__test__/element-template/runtime/render/render-main-thread.test.ts +101 -1
- package/runtime/__test__/element-template/runtime/template/element-template-handle.test.ts +32 -0
- package/runtime/__test__/element-template/runtime/template/main-thread-dynamic-attr-state.test.ts +309 -26
- package/runtime/__test__/element-template/test-utils/debug/envManager.ts +8 -5
- package/runtime/__test__/element-template/test-utils/mock/mockNativePapi.ts +35 -2
- package/runtime/__test__/guardrails/snapshot-containment.test.ts +45 -11
- package/runtime/__test__/shared/component-stack.test.ts +211 -0
- package/runtime/__test__/snapshot/debug/formatPatch.test.ts +0 -8
- package/runtime/__test__/snapshot/gesture/prepareGestureForCommit.test.js +1 -1
- package/runtime/__test__/snapshot/lifecycle/updateGlobalProps.event.test.jsx +2 -2
- package/runtime/__test__/snapshot/lifecycle/updateGlobalProps.test.jsx +3 -3
- package/runtime/__test__/snapshot/lynx/timing.test.jsx +3 -0
- package/runtime/__test__/snapshot/preact.test.jsx +0 -3
- package/runtime/__test__/snapshot/ref.test.jsx +30 -0
- package/runtime/__test__/snapshot/snapshotPatch.test.jsx +0 -33
- package/runtime/__test__/worklet-runtime/jsFunctionLifecycle.test.js +12 -0
- package/runtime/__test__/worklet-runtime/loadRuntime.test.js +68 -0
- package/runtime/__test__/worklet-runtime/workletRuntime.test.js +30 -0
- package/runtime/lazy/element-template-internal.js +1 -1
- package/runtime/lazy/internal.js +1 -1
- package/runtime/lazy/jsx-dev-runtime.js +1 -1
- package/runtime/lazy/jsx-runtime.js +1 -1
- package/runtime/lazy/legacy-react-runtime.js +1 -1
- package/runtime/lazy/react-lepus.js +1 -1
- package/runtime/lazy/react.js +1 -1
- package/runtime/lib/core/capture-main-thread-object.js +2 -1
- package/runtime/lib/core/capture-main-thread-object.js.map +1 -1
- package/runtime/lib/core/compat/legacy-react-runtime.js +1 -1
- package/runtime/lib/core/compat/legacy-react-runtime.js.map +1 -1
- package/runtime/lib/core/globalProps.js +1 -1
- package/runtime/lib/core/globalProps.js.map +1 -1
- package/runtime/lib/core/lynx/lazy-bundle.js +1 -1
- package/runtime/lib/core/lynx/lazy-bundle.js.map +1 -1
- package/runtime/lib/core/lynx-data-processors.d.ts +125 -1
- package/runtime/lib/core/lynx-data-processors.js +3 -0
- package/runtime/lib/core/lynx-data-processors.js.map +1 -1
- package/runtime/lib/core/runtime-destroy.js +1 -1
- package/runtime/lib/core/runtime-destroy.js.map +1 -1
- package/runtime/lib/document.js +0 -5
- package/runtime/lib/document.js.map +1 -1
- package/runtime/lib/element-template/background/attr-slots.js +5 -2
- package/runtime/lib/element-template/background/attr-slots.js.map +1 -1
- package/runtime/lib/element-template/background/commit-hook.js +11 -12
- package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
- package/runtime/lib/element-template/background/destroy.js +16 -11
- package/runtime/lib/element-template/background/destroy.js.map +1 -1
- package/runtime/lib/element-template/background/hydrate.js +23 -0
- package/runtime/lib/element-template/background/hydrate.js.map +1 -1
- package/runtime/lib/element-template/client/root.d.ts +1 -1
- package/runtime/lib/element-template/client/root.js.map +1 -1
- package/runtime/lib/element-template/debug/alog.d.ts +1 -1
- package/runtime/lib/element-template/debug/alog.js +4 -1
- package/runtime/lib/element-template/debug/alog.js.map +1 -1
- package/runtime/lib/element-template/index.d.ts +2 -2
- package/runtime/lib/element-template/index.js.map +1 -1
- package/runtime/lib/element-template/internal.d.ts +2 -2
- package/runtime/lib/element-template/internal.js +1 -14
- package/runtime/lib/element-template/internal.js.map +1 -1
- package/runtime/lib/element-template/lynx/env.js.map +1 -1
- package/runtime/lib/element-template/native/callDestroyLifetimeFun.js +6 -1
- package/runtime/lib/element-template/native/callDestroyLifetimeFun.js.map +1 -1
- package/runtime/lib/element-template/native/flush.d.ts +1 -0
- package/runtime/lib/element-template/native/flush.js +9 -0
- package/runtime/lib/element-template/native/flush.js.map +1 -0
- package/runtime/lib/element-template/native/main-thread-api.js +3 -7
- package/runtime/lib/element-template/native/main-thread-api.js.map +1 -1
- package/runtime/lib/element-template/native/mts-destroy.js +8 -2
- package/runtime/lib/element-template/native/mts-destroy.js.map +1 -1
- package/runtime/lib/element-template/native/patch-listener.js +57 -50
- package/runtime/lib/element-template/native/patch-listener.js.map +1 -1
- package/runtime/lib/element-template/native/reload-background.js +1 -1
- package/runtime/lib/element-template/native/reload-background.js.map +1 -1
- package/runtime/lib/element-template/native/reload-main-thread.js +35 -10
- package/runtime/lib/element-template/native/reload-main-thread.js.map +1 -1
- package/runtime/lib/element-template/prop-adapters/gesture.d.ts +23 -0
- package/runtime/lib/element-template/prop-adapters/gesture.js +97 -0
- package/runtime/lib/element-template/prop-adapters/gesture.js.map +1 -0
- package/runtime/lib/element-template/prop-adapters/spread.d.ts +6 -1
- package/runtime/lib/element-template/prop-adapters/spread.js +72 -2
- package/runtime/lib/element-template/prop-adapters/spread.js.map +1 -1
- package/runtime/lib/element-template/protocol/opcodes.d.ts +1 -0
- package/runtime/lib/element-template/protocol/opcodes.js +1 -0
- package/runtime/lib/element-template/protocol/opcodes.js.map +1 -1
- package/runtime/lib/element-template/protocol/types.d.ts +7 -1
- package/runtime/lib/element-template/protocol/types.js.map +1 -1
- package/runtime/lib/element-template/runtime/page/root-instance.d.ts +0 -1
- package/runtime/lib/element-template/runtime/page/root-instance.js.map +1 -1
- package/runtime/lib/element-template/runtime/patch.js +31 -2
- package/runtime/lib/element-template/runtime/patch.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-components.js +4 -4
- package/runtime/lib/element-template/runtime/render/render-components.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-main-thread.js +2 -0
- package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.d.ts +4 -2
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.js +17 -4
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-background-function.js +8 -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.d.ts +7 -1
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js +380 -50
- 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-ref-ctx.d.ts +3 -2
- package/runtime/lib/element-template/runtime/template/main-thread-ref-ctx.js +10 -1
- package/runtime/lib/element-template/runtime/template/main-thread-ref-ctx.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/typed-attributes.js +3 -3
- package/runtime/lib/element-template/runtime/template/typed-attributes.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 +2 -125
- package/runtime/lib/lynx-api.js.map +1 -1
- package/runtime/lib/shared/component-stack.d.ts +0 -4
- package/runtime/lib/shared/component-stack.js +21 -5
- package/runtime/lib/shared/component-stack.js.map +1 -1
- package/runtime/lib/snapshot/gesture/{processGestureBagkround.js → processGestureBackground.js} +1 -1
- package/runtime/lib/snapshot/gesture/processGestureBackground.js.map +1 -0
- package/runtime/lib/snapshot/lifecycle/destroy.js +23 -17
- package/runtime/lib/snapshot/lifecycle/destroy.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.d.ts +0 -1
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js +0 -5
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js +0 -10
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js +56 -51
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/ref/delay.d.ts +5 -0
- package/runtime/lib/snapshot/lifecycle/ref/delay.js +1 -1
- package/runtime/lib/snapshot/lifecycle/ref/delay.js.map +1 -1
- package/runtime/lib/snapshot/list/listUpdateInfo.js +0 -30
- package/runtime/lib/snapshot/list/listUpdateInfo.js.map +1 -1
- package/runtime/lib/snapshot/lynx/calledByNative.js +11 -8
- package/runtime/lib/snapshot/lynx/calledByNative.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/hydrate.js +0 -52
- package/runtime/lib/snapshot/renderToOpcodes/hydrate.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/index.js +10 -10
- package/runtime/lib/snapshot/renderToOpcodes/index.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/opcodes.js +0 -51
- package/runtime/lib/snapshot/renderToOpcodes/opcodes.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -1
- package/runtime/lib/worklet-runtime/bindings/index.d.ts +1 -0
- package/runtime/lib/worklet-runtime/bindings/index.js +1 -0
- package/runtime/lib/worklet-runtime/bindings/index.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/loadRuntime.d.ts +8 -0
- package/runtime/lib/worklet-runtime/bindings/loadRuntime.js +23 -0
- package/runtime/lib/worklet-runtime/bindings/loadRuntime.js.map +1 -0
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.d.ts +2 -0
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js +6 -0
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js.map +1 -1
- package/runtime/lib/worklet-runtime/workletRuntime.js +2 -0
- package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
- package/runtime/package.json +2 -3
- package/runtime/src/core/capture-main-thread-object.ts +2 -1
- package/runtime/src/core/compat/legacy-react-runtime.ts +1 -1
- package/runtime/src/core/globalProps.ts +1 -1
- package/runtime/src/core/lynx/lazy-bundle.ts +1 -1
- package/runtime/src/core/lynx-data-processors.ts +124 -1
- package/runtime/src/core/runtime-destroy.ts +1 -1
- package/runtime/src/document.ts +0 -6
- package/runtime/src/element-template/background/attr-slots.ts +5 -1
- package/runtime/src/element-template/background/commit-hook.ts +18 -12
- package/runtime/src/element-template/background/destroy.ts +16 -13
- package/runtime/src/element-template/background/hydrate.ts +23 -0
- package/runtime/src/element-template/client/root.ts +1 -3
- package/runtime/src/element-template/debug/alog.ts +5 -2
- package/runtime/src/element-template/index.ts +2 -2
- package/runtime/src/element-template/internal.ts +1 -20
- package/runtime/src/element-template/lynx/env.ts +1 -1
- package/runtime/src/element-template/native/callDestroyLifetimeFun.ts +5 -1
- package/runtime/src/element-template/native/flush.ts +10 -0
- package/runtime/src/element-template/native/main-thread-api.ts +3 -6
- package/runtime/src/element-template/native/mts-destroy.ts +7 -2
- package/runtime/src/element-template/native/patch-listener.ts +62 -57
- package/runtime/src/element-template/native/reload-background.ts +1 -1
- package/runtime/src/element-template/native/reload-main-thread.ts +32 -11
- package/runtime/src/element-template/prop-adapters/gesture.ts +144 -0
- package/runtime/src/element-template/prop-adapters/spread.ts +110 -2
- package/runtime/src/element-template/protocol/opcodes.ts +1 -0
- package/runtime/src/element-template/protocol/types.ts +8 -13
- package/runtime/src/element-template/runtime/page/root-instance.ts +0 -1
- package/runtime/src/element-template/runtime/patch.ts +38 -0
- package/runtime/src/element-template/runtime/render/render-components.ts +3 -3
- package/runtime/src/element-template/runtime/render/render-main-thread.ts +2 -0
- package/runtime/src/element-template/runtime/template/attr-slot-plan.ts +31 -4
- package/runtime/src/element-template/runtime/template/main-thread-background-function.ts +8 -1
- package/runtime/src/element-template/runtime/template/main-thread-dynamic-attr-state.ts +456 -50
- package/runtime/src/element-template/runtime/template/main-thread-ref-ctx.ts +14 -4
- package/runtime/src/element-template/runtime/template/typed-attributes.ts +3 -3
- package/runtime/src/element-template/types.d.ts +6 -0
- package/runtime/src/internal.ts +1 -1
- package/runtime/src/lynx-api.ts +2 -124
- package/runtime/src/shared/component-stack.ts +22 -5
- package/runtime/src/snapshot/lifecycle/destroy.ts +23 -18
- package/runtime/src/snapshot/lifecycle/patch/snapshotPatch.ts +0 -5
- package/runtime/src/snapshot/lifecycle/patch/snapshotPatchApply.ts +0 -10
- package/runtime/src/snapshot/lifecycle/patch/updateMainThread.ts +62 -58
- package/runtime/src/snapshot/lifecycle/ref/delay.ts +1 -1
- package/runtime/src/snapshot/list/listUpdateInfo.ts +0 -52
- package/runtime/src/snapshot/lynx/calledByNative.ts +11 -9
- package/runtime/src/snapshot/renderToOpcodes/hydrate.ts +0 -58
- package/runtime/src/snapshot/renderToOpcodes/index.ts +8 -8
- package/runtime/src/snapshot/renderToOpcodes/opcodes.ts +0 -57
- package/runtime/src/snapshot/snapshot/backgroundSnapshot.ts +1 -1
- package/runtime/src/worklet-runtime/README.md +30 -10
- package/runtime/src/worklet-runtime/bindings/index.ts +2 -0
- package/runtime/src/worklet-runtime/bindings/loadRuntime.ts +25 -0
- package/runtime/src/worklet-runtime/jsFunctionLifecycle.ts +6 -0
- package/runtime/src/worklet-runtime/workletRuntime.ts +2 -0
- package/runtime/types/types.d.ts +2 -1
- package/runtime/vitest.config.ts +0 -2
- package/testing-library/.turbo/turbo-build.log +7 -7
- package/testing-library/src/__tests__/act.test.jsx +0 -7
- package/testing-library/src/__tests__/alog.test.jsx +12 -54
- package/testing-library/src/__tests__/end-to-end.test.jsx +0 -7
- package/testing-library/src/__tests__/renderComponent.test.jsx +0 -14
- package/testing-library/src/__tests__/worklet.test.jsx +49 -0
- package/transform/.turbo/turbo-build$colon$wasm.log +133 -297
- package/transform/__test__/defines.spec.js +30 -0
- package/transform/__test__/fixture.spec.js +11 -11
- package/transform/__test__/main-thread-object-compat.spec.js +111 -0
- package/transform/__test__/object-methods.spec.js +79 -0
- package/transform/crates/swc_plugin_element_template/lib.rs +11 -0
- package/transform/crates/swc_plugin_element_template/tests/element_template_contract.rs +113 -0
- package/transform/crates/swc_plugin_worklet/extract_ident.rs +99 -49
- package/transform/crates/swc_plugin_worklet/gen_stmt.rs +63 -57
- package/transform/crates/swc_plugin_worklet/lib.rs +393 -589
- package/transform/crates/swc_plugin_worklet/napi.rs +4 -6
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_capture_env_js.js +3 -3
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_capture_env_lepus.js +3 -3
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_js.js +11 -6
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_lepus.js +12 -6
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_js.js +14 -5
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_lepus.js +17 -6
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_preserve_main_thread_objects_in_class_js.js +5 -5
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_preserve_main_thread_objects_in_class_lepus.js +5 -5
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_js.js +1 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus.js +1 -1
- package/transform/dist/wasm.cjs +1 -1
- package/transform/package.json +0 -1
- package/transform/src/lib.rs +1 -1
- package/transform/swc-plugin-reactlynx/.turbo/turbo-build.log +167 -69
- package/transform/swc-plugin-reactlynx/src/lib.rs +1 -4
- package/transform/swc-plugin-reactlynx/swc_plugin_reactlynx.wasm +0 -0
- package/transform/swc-plugin-reactlynx-compat/.turbo/turbo-build.log +226 -132
- package/runtime/lib/snapshot/gesture/processGestureBagkround.js.map +0 -1
- package/runtime/lib/snapshot/worklet/hmr.d.ts +0 -1
- package/runtime/lib/snapshot/worklet/hmr.js +0 -28
- package/runtime/lib/snapshot/worklet/hmr.js.map +0 -1
- package/runtime/src/snapshot/worklet/hmr.ts +0 -34
- /package/runtime/lib/snapshot/gesture/{processGestureBagkround.d.ts → processGestureBackground.d.ts} +0 -0
- /package/runtime/src/snapshot/gesture/{processGestureBagkround.ts → processGestureBackground.ts} +0 -0
|
@@ -128,6 +128,13 @@ export type SetMainThreadEventCommand = [
|
|
|
128
128
|
value: SerializableValue | null,
|
|
129
129
|
];
|
|
130
130
|
|
|
131
|
+
export type SetGestureCommand = [
|
|
132
|
+
typeof ElementTemplateUpdateOps.setGesture,
|
|
133
|
+
targetHandleId: number,
|
|
134
|
+
attrSlotIndex: number,
|
|
135
|
+
value: SerializableValue | null,
|
|
136
|
+
];
|
|
137
|
+
|
|
131
138
|
export type SetMainThreadRefCommand = [
|
|
132
139
|
typeof ElementTemplateUpdateOps.setMainThreadRef,
|
|
133
140
|
targetHandleId: number,
|
|
@@ -186,6 +193,7 @@ export type ElementTemplateUpdateCommand =
|
|
|
186
193
|
| SetAttributeCommand
|
|
187
194
|
| SetMainThreadEventCommand
|
|
188
195
|
| SetMainThreadRefCommand
|
|
196
|
+
| SetGestureCommand
|
|
189
197
|
| InsertNodeCommand
|
|
190
198
|
| RemoveNodeCommand
|
|
191
199
|
| CreateTypedElementCommand
|
|
@@ -199,20 +207,7 @@ export type ElementTemplateUpdateCommand =
|
|
|
199
207
|
export type ElementTemplateUpdateCommandStream = ElementTemplateUpdateCommand[number][];
|
|
200
208
|
|
|
201
209
|
export interface ElementTemplateFlushOptions {
|
|
202
|
-
// triggerLayout?: boolean;
|
|
203
|
-
// operationID?: any;
|
|
204
|
-
// __lynx_timing_flag?: string;
|
|
205
|
-
// nativeUpdateDataOrder?: number;
|
|
206
|
-
// elementID?: number;
|
|
207
|
-
// listID?: number;
|
|
208
|
-
// listReuseNotification?: {
|
|
209
|
-
// listElement: FiberElement;
|
|
210
|
-
// itemKey: string;
|
|
211
|
-
// };
|
|
212
210
|
pipelineOptions?: PipelineOptions;
|
|
213
|
-
// elementIDs?: number[];
|
|
214
|
-
// operationIDs?: any[];
|
|
215
|
-
// asyncFlush?: boolean;
|
|
216
211
|
triggerDataUpdated?: boolean;
|
|
217
212
|
emptyPatch?: boolean;
|
|
218
213
|
}
|
|
@@ -16,6 +16,8 @@ import {
|
|
|
16
16
|
} from './list/list.js';
|
|
17
17
|
import type { ETListFlushResult, ETListUpdateItem } from './list/list.js';
|
|
18
18
|
import { insertElementTemplateSubtree } from './template/handle.js';
|
|
19
|
+
import { retainMainThreadBackgroundFunctionCtx } from './template/main-thread-background-function.js';
|
|
20
|
+
import type { MTEventNativeWrapper } from './template/main-thread-event-ctx.js';
|
|
19
21
|
import { elementTemplateRegistry } from './template/registry.js';
|
|
20
22
|
import { TYPED_ELEMENT_ATTRIBUTES_SLOT_INDEX } from './template/typed-attributes.js';
|
|
21
23
|
import { ElementTemplateUpdateOps } from '../protocol/opcodes.js';
|
|
@@ -41,11 +43,18 @@ import type {
|
|
|
41
43
|
import {
|
|
42
44
|
deleteMainThreadDynamicAttrStateForSubtree,
|
|
43
45
|
initializeMainThreadDynamicAttrSlots,
|
|
46
|
+
isSpreadDynamicAttrSlot,
|
|
44
47
|
prepareMainThreadDynamicAttrSlotsForNative,
|
|
48
|
+
prepareSpreadAttrSlotForNative,
|
|
49
|
+
reconcileUnhydratedSpreadMTRefSlots,
|
|
50
|
+
updateGestureAttrSlot,
|
|
45
51
|
updateMainThreadEventAttrSlot,
|
|
46
52
|
updateMainThreadRefAttrSlot,
|
|
53
|
+
updateSpreadAttrSlot,
|
|
47
54
|
} from './template/main-thread-dynamic-attr-state.js';
|
|
48
55
|
import type { MainThreadDynamicAttrSubtreeHandle } from './template/main-thread-dynamic-attr-state.js';
|
|
56
|
+
import { retainGestureCallbacks } from '../prop-adapters/gesture.js';
|
|
57
|
+
import type { GestureSlotValue } from '../prop-adapters/gesture.js';
|
|
49
58
|
|
|
50
59
|
export type { ElementTemplateUpdateCommandStream } from '../protocol/types.js';
|
|
51
60
|
|
|
@@ -103,6 +112,7 @@ export function applyElementTemplateUpdateCommands(
|
|
|
103
112
|
handleId,
|
|
104
113
|
templateType,
|
|
105
114
|
attributeSlots,
|
|
115
|
+
true,
|
|
106
116
|
);
|
|
107
117
|
}
|
|
108
118
|
break;
|
|
@@ -126,10 +136,32 @@ export function applyElementTemplateUpdateCommands(
|
|
|
126
136
|
break;
|
|
127
137
|
}
|
|
128
138
|
}
|
|
139
|
+
if (isSpreadDynamicAttrSlot(targetId, attrSlotIndex)) {
|
|
140
|
+
const nativeValue = prepareSpreadAttrSlotForNative(value);
|
|
141
|
+
__SetAttributeOfElementTemplate(nativeRef, attrSlotIndex, nativeValue);
|
|
142
|
+
updateSpreadAttrSlot(targetId, attrSlotIndex, value, nativeRef, isHydration);
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
129
145
|
__SetAttributeOfElementTemplate(nativeRef, attrSlotIndex, value);
|
|
130
146
|
break;
|
|
131
147
|
}
|
|
132
148
|
|
|
149
|
+
case ElementTemplateUpdateOps.setGesture: {
|
|
150
|
+
const targetId = stream[i++] as number;
|
|
151
|
+
const attrSlotIndex = stream[i++] as number;
|
|
152
|
+
const value = stream[i++] as SerializableValue | null;
|
|
153
|
+
const nativeRef = resolveTargetHandle(targetId, 'target');
|
|
154
|
+
if (!nativeRef) {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
if (value != null) {
|
|
158
|
+
retainGestureCallbacks(value as unknown as GestureSlotValue);
|
|
159
|
+
}
|
|
160
|
+
__SetAttributeOfElementTemplate(nativeRef, attrSlotIndex, value);
|
|
161
|
+
updateGestureAttrSlot(targetId, attrSlotIndex, value, isHydration);
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
|
|
133
165
|
case ElementTemplateUpdateOps.setMainThreadEvent: {
|
|
134
166
|
const targetId = stream[i++] as number;
|
|
135
167
|
const attrSlotIndex = stream[i++] as number;
|
|
@@ -138,6 +170,9 @@ export function applyElementTemplateUpdateCommands(
|
|
|
138
170
|
if (!nativeRef) {
|
|
139
171
|
continue;
|
|
140
172
|
}
|
|
173
|
+
if (value != null) {
|
|
174
|
+
retainMainThreadBackgroundFunctionCtx((value as unknown as MTEventNativeWrapper).value);
|
|
175
|
+
}
|
|
141
176
|
__SetAttributeOfElementTemplate(nativeRef, attrSlotIndex, value);
|
|
142
177
|
updateMainThreadEventAttrSlot(targetId, attrSlotIndex, value, isHydration);
|
|
143
178
|
break;
|
|
@@ -323,6 +358,9 @@ export function applyElementTemplateUpdateCommands(
|
|
|
323
358
|
}
|
|
324
359
|
}
|
|
325
360
|
}
|
|
361
|
+
if (isHydration) {
|
|
362
|
+
reconcileUnhydratedSpreadMTRefSlots();
|
|
363
|
+
}
|
|
326
364
|
flushPendingListUpdates();
|
|
327
365
|
}
|
|
328
366
|
|
|
@@ -40,7 +40,7 @@ const assign = /* @__PURE__ */ Object.assign;
|
|
|
40
40
|
// Global state for the current render pass
|
|
41
41
|
export let beforeDiff: ((vnode: unknown) => void) | undefined;
|
|
42
42
|
export let beforeDiff2: ((vnode: unknown, context: Record<string, unknown>) => void) | undefined;
|
|
43
|
-
let afterDiff, renderHook,
|
|
43
|
+
let afterDiff, renderHook, unmountHook;
|
|
44
44
|
|
|
45
45
|
export function renderWithHooks(
|
|
46
46
|
vnode: unknown,
|
|
@@ -62,7 +62,7 @@ export function renderWithHooks(
|
|
|
62
62
|
beforeDiff2 = options[DIFF2];
|
|
63
63
|
afterDiff = options[DIFFED];
|
|
64
64
|
renderHook = options[RENDER];
|
|
65
|
-
|
|
65
|
+
unmountHook = options.unmount;
|
|
66
66
|
|
|
67
67
|
const parent = h(Fragment, null);
|
|
68
68
|
parent[CHILDREN] = [vnode];
|
|
@@ -141,7 +141,7 @@ function renderClassComponent(vnode, context, globalContext) {
|
|
|
141
141
|
export function cleanupVNode(vnode: unknown): void {
|
|
142
142
|
if (afterDiff) afterDiff(vnode);
|
|
143
143
|
vnode[PARENT] = undefined;
|
|
144
|
-
if (
|
|
144
|
+
if (unmountHook) unmountHook(vnode);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
export function renderComponentVNode(
|
|
@@ -16,6 +16,7 @@ import { flushInitialElementTemplateListUpdates } from '../list/list.js';
|
|
|
16
16
|
import { __page } from '../page/page.js';
|
|
17
17
|
import { __root } from '../page/root-instance.js';
|
|
18
18
|
import { insertElementTemplateSubtree } from '../template/handle.js';
|
|
19
|
+
import { applyPendingMainThreadRefAttachments } from '../template/main-thread-dynamic-attr-state.js';
|
|
19
20
|
import { getElementTemplateNativeRef } from '../template/registry.js';
|
|
20
21
|
import { TYPED_ELEMENT_ATTRIBUTES_SLOT_INDEX } from '../template/typed-attributes.js';
|
|
21
22
|
|
|
@@ -48,6 +49,7 @@ function renderMainThread(): void {
|
|
|
48
49
|
);
|
|
49
50
|
}
|
|
50
51
|
flushInitialListUpdates();
|
|
52
|
+
applyPendingMainThreadRefAttachments();
|
|
51
53
|
} finally {
|
|
52
54
|
profileEnd();
|
|
53
55
|
}
|
|
@@ -6,8 +6,10 @@ import { prepareMTEventCtxForNative } from './main-thread-event-ctx.js';
|
|
|
6
6
|
import { prepareMTRefForNative } from './main-thread-ref-ctx.js';
|
|
7
7
|
import { isMainThreadFunction } from '../../../core/main-thread-function.js';
|
|
8
8
|
import { getEventValue } from '../../prop-adapters/event-value.js';
|
|
9
|
+
import { prepareGestureForNative } from '../../prop-adapters/gesture.js';
|
|
10
|
+
import type { GestureSlotValue } from '../../prop-adapters/gesture.js';
|
|
9
11
|
import { prepareRefAttrSlot } from '../../prop-adapters/ref.js';
|
|
10
|
-
import { prepareSpreadAttrSlot } from '../../prop-adapters/spread.js';
|
|
12
|
+
import { prepareSpreadAttrSlot, prepareTypedSpreadAttrSlot } from '../../prop-adapters/spread.js';
|
|
11
13
|
import type { SerializableValue } from '../../protocol/types.js';
|
|
12
14
|
|
|
13
15
|
export interface EtAttrAdapterContext {
|
|
@@ -31,7 +33,7 @@ export type EtAttrPlanMap = Record<
|
|
|
31
33
|
|
|
32
34
|
export const __etAttrPlanMap = Object.create(null) as EtAttrPlanMap;
|
|
33
35
|
|
|
34
|
-
export type MainThreadDynamicAttrKind = 'mt-event' | 'mt-ref';
|
|
36
|
+
export type MainThreadDynamicAttrKind = 'mt-event' | 'mt-ref' | 'gesture' | 'spread';
|
|
35
37
|
|
|
36
38
|
const mainThreadDynamicAttrSlotKinds = new Map<
|
|
37
39
|
string,
|
|
@@ -54,8 +56,12 @@ export function getMainThreadDynamicAttrSlotKinds(
|
|
|
54
56
|
let kind: MainThreadDynamicAttrKind | undefined;
|
|
55
57
|
if (adapter === adaptMTEventAttrSlot) {
|
|
56
58
|
kind = 'mt-event';
|
|
59
|
+
} else if (adapter === adaptGestureAttrSlot) {
|
|
60
|
+
kind = 'gesture';
|
|
57
61
|
} else if (adapter === adaptMTRefAttrSlot) {
|
|
58
62
|
kind = 'mt-ref';
|
|
63
|
+
} else if (adapter === adaptSpreadAttrSlot) {
|
|
64
|
+
kind = 'spread';
|
|
59
65
|
}
|
|
60
66
|
if (kind) {
|
|
61
67
|
(slotKinds ??= new Map()).set(attrPlan[planIndex] as number, kind);
|
|
@@ -72,7 +78,7 @@ export function hasMainThreadRefAttrSlot(templateType: string): boolean {
|
|
|
72
78
|
return false;
|
|
73
79
|
}
|
|
74
80
|
for (const kind of slotKinds.values()) {
|
|
75
|
-
if (kind === 'mt-ref') {
|
|
81
|
+
if (kind === 'mt-ref' || kind === 'spread') {
|
|
76
82
|
return true;
|
|
77
83
|
}
|
|
78
84
|
}
|
|
@@ -135,12 +141,33 @@ export function adaptMTRefAttrSlot(
|
|
|
135
141
|
);
|
|
136
142
|
}
|
|
137
143
|
|
|
144
|
+
export function adaptGestureAttrSlot(
|
|
145
|
+
_handleId: number,
|
|
146
|
+
attrSlotIndex: number,
|
|
147
|
+
value: unknown,
|
|
148
|
+
context?: EtAttrAdapterContext,
|
|
149
|
+
): SerializableValue | null {
|
|
150
|
+
return prepareGestureForNative(
|
|
151
|
+
value,
|
|
152
|
+
context?.previousPreparedSlots[attrSlotIndex] as GestureSlotValue | null | undefined,
|
|
153
|
+
) as unknown as SerializableValue | null;
|
|
154
|
+
}
|
|
155
|
+
|
|
138
156
|
export function adaptSpreadAttrSlot(
|
|
139
157
|
handleId: number,
|
|
140
158
|
attrSlotIndex: number,
|
|
141
159
|
value: unknown,
|
|
160
|
+
context?: EtAttrAdapterContext,
|
|
161
|
+
): SerializableValue | null {
|
|
162
|
+
return prepareSpreadAttrSlot(handleId, attrSlotIndex, value, context);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export function adaptTypedSpreadAttrSlot(
|
|
166
|
+
handleId: number,
|
|
167
|
+
attrSlotIndex: number,
|
|
168
|
+
value: unknown,
|
|
142
169
|
): SerializableValue | null {
|
|
143
|
-
return
|
|
170
|
+
return prepareTypedSpreadAttrSlot(handleId, attrSlotIndex, value);
|
|
144
171
|
}
|
|
145
172
|
|
|
146
173
|
export function clearEtAttrPlanMap(): void {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
runOnBackground,
|
|
12
12
|
} from '../../../core/background-function/run-on-background.js';
|
|
13
13
|
import { resetFunctionCallReturnListener } from '../../../core/thread-function-call/return-value.js';
|
|
14
|
-
import { isRunOnBackgroundEnabled } from '../../../worklet-runtime/jsFunctionLifecycle.js';
|
|
14
|
+
import { JsFunctionLifecycleManager, isRunOnBackgroundEnabled } from '../../../worklet-runtime/jsFunctionLifecycle.js';
|
|
15
15
|
|
|
16
16
|
type BackgroundFunctionCtx = Parameters<typeof registerBackgroundFunctionCtx>[0];
|
|
17
17
|
type RetainableMainThreadCtx = Parameters<typeof retainWorkletCtx>[0];
|
|
@@ -33,6 +33,8 @@ export function registerMainThreadBackgroundFunctionCtx(ctx: MainThreadBackgroun
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
// Track the input before Native takes ownership. If Native rejects it, collection
|
|
37
|
+
// must still release its already-registered background execution; slot state commits later.
|
|
36
38
|
export function retainMainThreadBackgroundFunctionCtx(ctx: MainThreadBackgroundFunctionCtx): void {
|
|
37
39
|
retainWorkletCtx(ctx as RetainableMainThreadCtx);
|
|
38
40
|
}
|
|
@@ -43,6 +45,11 @@ export function resetElementTemplateBackgroundFunctionRuntime(): void {
|
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
export function resetElementTemplateMainThreadBackgroundFunctionRuntime(): void {
|
|
48
|
+
const manager = globalThis.lynxWorkletImpl?._jsFunctionLifecycleManager;
|
|
49
|
+
if (manager) {
|
|
50
|
+
manager.dispose();
|
|
51
|
+
globalThis.lynxWorkletImpl._jsFunctionLifecycleManager = new JsFunctionLifecycleManager();
|
|
52
|
+
}
|
|
46
53
|
clearDelayedRunOnBackgroundFunctions();
|
|
47
54
|
resetFunctionCallReturnListener();
|
|
48
55
|
}
|