@lynx-js/react 0.129.1 → 0.129.3
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 +18 -0
- package/components/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/refresh/.turbo/turbo-build.log +1 -1
- package/runtime/__test__/core/globalProps.test.ts +27 -6
- 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/native/callDestroyLifetimeFun.test.ts +89 -3
- package/runtime/__test__/element-template/native/mts-destroy.test.ts +8 -3
- package/runtime/__test__/element-template/native/reload.test.ts +87 -0
- 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/patch/element-template-patch.test.tsx +15 -0
- 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/template/main-thread-dynamic-attr-state.test.ts +188 -0
- package/runtime/__test__/snapshot/compat/export.test.jsx +8 -2
- 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/ref.test.jsx +30 -0
- package/runtime/__test__/worklet-runtime/initEntry.test.js +12 -0
- package/runtime/compat/index.d.ts +17 -1
- package/runtime/compat/index.js +3 -2
- package/runtime/lazy/compat.js +1 -0
- package/runtime/lazy/element-template-internal.js +1 -0
- package/runtime/lib/core/globalProps.js +1 -1
- package/runtime/lib/core/globalProps.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/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/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/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/native/callDestroyLifetimeFun.js +6 -1
- package/runtime/lib/element-template/native/callDestroyLifetimeFun.js.map +1 -1
- package/runtime/lib/element-template/native/patch-listener.js +1 -1
- 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 +33 -9
- 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/patch.js +27 -2
- package/runtime/lib/element-template/runtime/patch.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-dynamic-attr-state.d.ts +7 -2
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js +368 -58
- 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 +2 -1
- 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/snapshot/lifecycle/destroy.js +23 -17
- package/runtime/lib/snapshot/lifecycle/destroy.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/tsconfig.tsbuildinfo +1 -1
- package/runtime/lib/worklet-runtime/utils/version.js +4 -1
- package/runtime/lib/worklet-runtime/utils/version.js.map +1 -1
- package/runtime/src/core/globalProps.ts +1 -1
- package/runtime/src/element-template/background/attr-slots.ts +5 -1
- 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/debug/alog.ts +5 -2
- package/runtime/src/element-template/internal.ts +1 -0
- package/runtime/src/element-template/native/callDestroyLifetimeFun.ts +5 -1
- package/runtime/src/element-template/native/patch-listener.ts +1 -1
- package/runtime/src/element-template/native/reload-background.ts +1 -1
- package/runtime/src/element-template/native/reload-main-thread.ts +30 -10
- 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 -0
- package/runtime/src/element-template/runtime/patch.ts +33 -0
- package/runtime/src/element-template/runtime/template/attr-slot-plan.ts +31 -4
- package/runtime/src/element-template/runtime/template/main-thread-dynamic-attr-state.ts +441 -65
- package/runtime/src/element-template/runtime/template/main-thread-ref-ctx.ts +12 -2
- package/runtime/src/element-template/runtime/template/typed-attributes.ts +3 -3
- package/runtime/src/snapshot/lifecycle/destroy.ts +23 -18
- package/runtime/src/snapshot/lifecycle/ref/delay.ts +1 -1
- package/runtime/src/worklet-runtime/utils/version.ts +4 -1
- package/runtime/types/types.d.ts +2 -1
- package/testing-library/.turbo/turbo-build.log +7 -7
- package/transform/.turbo/turbo-build$colon$wasm.log +72 -71
- package/transform/__test__/fixture.spec.js +11 -11
- package/transform/__test__/main-thread-object-compat.spec.js +111 -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/gen_stmt.rs +7 -9
- 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 +7 -7
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_lepus.js +7 -7
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_js.js +8 -8
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_lepus.js +8 -8
- 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/swc-plugin-reactlynx/.turbo/turbo-build.log +97 -97
- package/transform/swc-plugin-reactlynx/swc_plugin_reactlynx.wasm +0 -0
- package/transform/swc-plugin-reactlynx-compat/.turbo/turbo-build.log +177 -178
|
@@ -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 {
|