@lynx-js/react 0.126.1 → 0.127.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 +40 -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 +4 -3
- package/refresh/.turbo/turbo-build.log +4 -4
- package/refresh/dist/index.js +27 -8
- package/refresh/package.json +2 -2
- package/runtime/__test__/core/main-thread-object.test.js +149 -0
- package/runtime/__test__/element-template/debug/profile-installation.test.tsx +97 -1
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.non-string-raw-text-key-on-main/output.txt +1 -1
- package/runtime/__test__/element-template/fixtures/background/main-thread-function/run-on-main-thread/index.tsx +26 -3
- package/runtime/__test__/element-template/fixtures/render/child-siblings/index.js.txt +15 -11
- package/runtime/__test__/element-template/fixtures/render/component/index.js.txt +8 -7
- package/runtime/__test__/element-template/fixtures/render/component-slot-content/index.js.txt +14 -10
- package/runtime/__test__/element-template/fixtures/render/css-scope-dynamic-bundle-url/index.js.txt +4 -3
- package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/_shared.ts +2 -9
- package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/appends-root-text-via-append-element/case.ts +2 -4
- package/runtime/__test__/element-template/fixtures/render/direct-native/creates-template-from-attrs-and-slot-text/case.ts +20 -0
- package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/handles-multiple-template-children-in-the-same-slot/case.ts +3 -16
- package/runtime/__test__/element-template/fixtures/render/direct-native/handles-multiple-text-nodes-in-the-same-slot/case.ts +18 -0
- package/runtime/__test__/element-template/fixtures/render/direct-native/inserts-nested-templates-into-parent-slots/case.ts +20 -0
- package/runtime/__test__/element-template/fixtures/render/direct-native/keeps-slot-children-separated-and-ordered/case.ts +18 -0
- package/runtime/__test__/element-template/fixtures/render/direct-native/passes-bundle-url-to-native-create/case.ts +15 -0
- package/runtime/__test__/element-template/fixtures/render/mapped-view-children/index.js.txt +12 -11
- package/runtime/__test__/element-template/fixtures/render/mixed-children/index.js.txt +8 -7
- package/runtime/__test__/element-template/fixtures/render/multiple-text/index.js.txt +15 -13
- package/runtime/__test__/element-template/fixtures/render/nested-templates/index.js.txt +9 -7
- package/runtime/__test__/element-template/fixtures/render/react-example/index.js.txt +17 -20
- package/runtime/__test__/element-template/fixtures/render/sparse-element-slot/index.js.txt +13 -10
- package/runtime/__test__/element-template/fixtures/render/template-dedupe/index.js.txt +14 -11
- package/runtime/__test__/element-template/imports/main-thread-object-api.test.ts +10 -0
- package/runtime/__test__/element-template/imports/suspense-lazy.test.ts +52 -7
- package/runtime/__test__/element-template/internal/legacy-internal-guardrail.test.ts +3 -0
- package/runtime/__test__/element-template/native/reload.test.ts +10 -26
- package/runtime/__test__/element-template/runtime/background/component-stack.test.tsx +76 -0
- package/runtime/__test__/element-template/runtime/background/hydrate.test.ts +87 -43
- package/runtime/__test__/element-template/runtime/background/instance.test.ts +14 -0
- package/runtime/__test__/element-template/runtime/background/main-thread-function/compiled-fixtures.test.tsx +4 -0
- package/runtime/__test__/element-template/runtime/render/compact-host-debug.test.ts +57 -0
- package/runtime/__test__/element-template/runtime/render/compact-host.test.ts +199 -0
- package/runtime/__test__/element-template/runtime/render/render-components.test.jsx +292 -0
- package/runtime/__test__/element-template/runtime/render/{render-opcodes-into-element-template.et.test.tsx → render-direct-native.test.tsx} +50 -314
- package/runtime/__test__/element-template/runtime/render/render-direct-suspense.test.ts +378 -0
- package/runtime/__test__/element-template/runtime/render/render-direct.test.ts +491 -0
- package/runtime/__test__/element-template/runtime/render/render-main-thread.contract.test.ts +2 -28
- package/runtime/__test__/element-template/runtime/render/render-main-thread.test.ts +21 -35
- package/runtime/__test__/element-template/runtime/render/render-transform.contract.test.ts +6 -5
- package/runtime/__test__/element-template/test-utils/debug/renderFixtureRunner.ts +4 -4
- package/runtime/__test__/element-template/vitest.config.ts +2 -1
- package/runtime/__test__/snapshot/ctxNotFound.test.ts +271 -0
- package/runtime/__test__/snapshot/debug/main-thread-children-with-same-key.test.ts +28 -0
- package/runtime/__test__/snapshot/debug/profile.test.jsx +108 -3
- package/runtime/__test__/snapshot/event.test.jsx +7 -7
- package/runtime/__test__/snapshot/lazy.test.js +114 -7
- package/runtime/__test__/snapshot/lifecycle/reloadGc.test.jsx +66 -0
- package/runtime/__test__/snapshot/lynx/portals.test.jsx +75 -37
- package/runtime/__test__/snapshot/lynx/runtime-version.test.ts +140 -0
- package/runtime/__test__/snapshot/snapshotPatch.test.jsx +59 -47
- package/runtime/__test__/snapshot/spread.test.jsx +32 -25
- package/runtime/__test__/snapshot/ssr.legacy-slot.test.jsx +168 -0
- package/runtime/__test__/snapshot/ssr.list.test.jsx +211 -0
- 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/hydrate.test.js +92 -0
- package/runtime/__test__/worklet-runtime/mainThreadObject.test.js +182 -0
- package/runtime/__test__/worklet-runtime/object-methods.test.js +60 -0
- package/runtime/__test__/worklet-runtime/runOnBackground.test.js +8 -6
- package/runtime/__test__/worklet-runtime/workletRef.test.js +362 -2
- package/runtime/__test__/worklet-runtime/workletRuntime.test.js +249 -3
- package/runtime/lazy/compat.js +2 -0
- package/runtime/lazy/element-template-import.js +0 -4
- package/runtime/lazy/element-template-internal.js +19 -8
- package/runtime/lazy/element-template-jsx-dev-runtime.js +1 -8
- package/runtime/lazy/element-template-jsx-runtime.js +1 -3
- package/runtime/lazy/element-template.js +3 -3
- package/runtime/lazy/import.js +0 -4
- package/runtime/lazy/internal.js +17 -1
- package/runtime/lazy/react.js +2 -0
- package/runtime/lazy/target.js +0 -21
- 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.js +16 -0
- package/runtime/lib/core/capture-main-thread-object.js.map +1 -0
- package/runtime/lib/core/globalProps.d.ts +2 -0
- package/runtime/lib/core/globalProps.js.map +1 -1
- package/runtime/lib/core/hooks/react.d.ts +6 -0
- package/runtime/lib/core/hooks/react.js +6 -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/runtime-version.d.ts +16 -0
- package/runtime/lib/core/lynx/runtime-version.js +51 -0
- package/runtime/lib/core/lynx/runtime-version.js.map +1 -0
- 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 +261 -0
- package/runtime/lib/core/main-thread-object.js.map +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/element-template/background/commit-hook.js.map +1 -1
- package/runtime/lib/element-template/background/document.d.ts +1 -1
- package/runtime/lib/element-template/background/document.js +1 -1
- package/runtime/lib/element-template/background/document.js.map +1 -1
- package/runtime/lib/element-template/background/hydrate.js +51 -19
- package/runtime/lib/element-template/background/hydrate.js.map +1 -1
- package/runtime/lib/element-template/background/instance.js +5 -6
- package/runtime/lib/element-template/background/instance.js.map +1 -1
- package/runtime/lib/element-template/debug/profile.js +38 -22
- package/runtime/lib/element-template/debug/profile.js.map +1 -1
- package/runtime/lib/element-template/index.d.ts +3 -1
- package/runtime/lib/element-template/index.js +2 -1
- package/runtime/lib/element-template/index.js.map +1 -1
- package/runtime/lib/element-template/internal.d.ts +5 -1
- package/runtime/lib/element-template/internal.js +7 -1
- package/runtime/lib/element-template/internal.js.map +1 -1
- package/runtime/lib/element-template/native/index.js +4 -0
- package/runtime/lib/element-template/native/index.js.map +1 -1
- package/runtime/lib/element-template/protocol/types.d.ts +1 -1
- package/runtime/lib/element-template/runtime/list/list.d.ts +1 -0
- package/runtime/lib/element-template/runtime/list/list.js +3 -0
- package/runtime/lib/element-template/runtime/list/list.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/create-rendered-host.d.ts +7 -0
- package/runtime/lib/element-template/runtime/render/create-rendered-host.js +65 -0
- package/runtime/lib/element-template/runtime/render/create-rendered-host.js.map +1 -0
- package/runtime/lib/element-template/runtime/render/host.d.ts +18 -0
- package/runtime/lib/element-template/runtime/render/host.js +25 -0
- package/runtime/lib/element-template/runtime/render/host.js.map +1 -0
- package/runtime/lib/element-template/runtime/render/render-components.d.ts +6 -0
- package/runtime/lib/element-template/runtime/render/render-components.js +190 -0
- package/runtime/lib/element-template/runtime/render/render-components.js.map +1 -0
- package/runtime/lib/element-template/runtime/render/{render-opcodes.d.ts → render-direct.d.ts} +3 -1
- package/runtime/lib/element-template/runtime/render/render-direct.js +194 -0
- package/runtime/lib/element-template/runtime/render/render-direct.js.map +1 -0
- package/runtime/lib/element-template/runtime/render/render-main-thread.js +10 -9
- package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/handle.d.ts +2 -1
- package/runtime/lib/element-template/runtime/template/handle.js +12 -4
- package/runtime/lib/element-template/runtime/template/handle.js.map +1 -1
- package/runtime/lib/element-template/runtime-marker.d.ts +1 -0
- package/runtime/lib/element-template/runtime-marker.js +13 -0
- package/runtime/lib/element-template/runtime-marker.js.map +1 -0
- package/runtime/lib/index.d.ts +1 -1
- package/runtime/lib/index.js +1 -1
- package/runtime/lib/index.js.map +1 -1
- package/runtime/lib/internal.d.ts +4 -1
- package/runtime/lib/internal.js +6 -1
- package/runtime/lib/internal.js.map +1 -1
- package/runtime/lib/lynx-api.d.ts +49 -6
- package/runtime/lib/lynx-api.js +34 -4
- 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/runtime-marker.d.ts +1 -0
- package/runtime/lib/runtime-marker.js +13 -0
- package/runtime/lib/runtime-marker.js.map +1 -0
- package/runtime/lib/shared/component-stack.js +5 -1
- package/runtime/lib/shared/component-stack.js.map +1 -1
- package/runtime/lib/snapshot/debug/profileHooks.js +38 -22
- package/runtime/lib/snapshot/debug/profileHooks.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/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/reload.js +3 -0
- package/runtime/lib/snapshot/lifecycle/reload.js.map +1 -1
- package/runtime/lib/snapshot/lynx/calledByNative.js +3 -0
- 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 +10 -0
- package/runtime/lib/snapshot/lynx/element.js +6 -0
- package/runtime/lib/snapshot/lynx/element.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/opcodes.js +2 -1
- package/runtime/lib/snapshot/renderToOpcodes/opcodes.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/ref/updateInitValue.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +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/types.d.ts +3 -6
- package/runtime/lib/worklet-runtime/bindings/types.js.map +1 -1
- package/runtime/lib/worklet-runtime/hydrate.js +27 -8
- package/runtime/lib/worklet-runtime/hydrate.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/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 +69 -19
- 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 +6 -0
- package/runtime/src/core/hooks/useLynxGlobalEventListener.ts +2 -0
- package/runtime/src/core/initData.ts +2 -0
- package/runtime/src/core/lynx/runtime-version.ts +62 -0
- package/runtime/src/core/main-thread-object-handle-registry.ts +25 -0
- package/runtime/src/core/main-thread-object.ts +387 -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/background/document.ts +3 -3
- package/runtime/src/element-template/background/hydrate.ts +61 -29
- package/runtime/src/element-template/background/instance.ts +5 -6
- package/runtime/src/element-template/debug/profile.ts +48 -36
- package/runtime/src/element-template/index.ts +7 -1
- package/runtime/src/element-template/internal.ts +14 -1
- package/runtime/src/element-template/native/index.ts +4 -0
- package/runtime/src/element-template/protocol/types.ts +1 -1
- package/runtime/src/element-template/runtime/list/list.ts +4 -0
- package/runtime/src/element-template/runtime/render/create-rendered-host.ts +126 -0
- package/runtime/src/element-template/runtime/render/host.ts +51 -0
- package/runtime/src/element-template/runtime/render/render-components.ts +255 -0
- package/runtime/src/element-template/runtime/render/render-direct.ts +275 -0
- package/runtime/src/element-template/runtime/render/render-main-thread.ts +10 -9
- package/runtime/src/element-template/runtime/template/handle.ts +17 -7
- package/runtime/src/element-template/runtime-marker.ts +17 -0
- package/runtime/src/index.ts +1 -1
- package/runtime/src/internal.ts +11 -1
- package/runtime/src/lynx-api.ts +53 -6
- package/runtime/src/lynx.ts +5 -1
- package/runtime/src/runtime-marker.ts +17 -0
- package/runtime/src/shared/component-stack.ts +5 -1
- package/runtime/src/snapshot/debug/profileHooks.ts +52 -40
- 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/lifecycle/reload.ts +4 -0
- package/runtime/src/snapshot/lynx/calledByNative.ts +4 -0
- package/runtime/src/snapshot/lynx/children.ts +2 -0
- package/runtime/src/snapshot/lynx/element.ts +10 -0
- package/runtime/src/snapshot/renderToOpcodes/opcodes.ts +2 -1
- 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/types.ts +7 -11
- package/runtime/src/worklet-runtime/hydrate.ts +44 -11
- 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 +84 -21
- package/runtime/types/types.d.ts +2 -0
- package/runtime/worklet-runtime/dev.js +155 -30
- package/runtime/worklet-runtime/main.js +1 -1
- package/testing-library/.turbo/turbo-build.log +12 -12
- package/testing-library/dist/env/index.js +2 -2
- package/testing-library/dist/index.d.ts +167 -4
- package/testing-library/dist/plugins/index.js +1 -1
- package/testing-library/dist/pure.js +45 -44
- package/testing-library/etc/react-lynx-testing-library.api.md +1 -1
- package/testing-library/package.json +4 -3
- package/testing-library/src/__tests__/lynx.test.jsx +1 -1
- package/testing-library/src/__tests__/reload/reloadGc.test.jsx +64 -0
- package/testing-library/src/__tests__/reload/reloadTemplate.js +39 -0
- package/testing-library/src/__tests__/worklet.test.jsx +46 -1
- package/testing-library/tsconfig.docs.json +9 -0
- package/testing-library/typedoc.json +22 -0
- package/testing-library/types/entry.d.ts +2 -2
- package/transform/.turbo/turbo-build$colon$wasm.log +151 -67
- package/transform/__test__/fixture.spec.js +89 -50
- package/transform/__test__/object-methods.spec.js +84 -0
- package/transform/__test__/text.spec.js +75 -0
- package/transform/crates/swc_plugin_compat/lib.rs +4 -3
- package/transform/crates/swc_plugin_compat/napi.rs +4 -3
- package/transform/crates/swc_plugin_define_dce/napi.rs +1 -1
- package/transform/crates/swc_plugin_dynamic_import/lib.rs +105 -3
- package/transform/crates/swc_plugin_dynamic_import/tests/__swc_snapshots__/lib.rs/should_suffix_webpack_chunk_name.js +5 -0
- package/transform/crates/swc_plugin_element_template/host_lowering.rs +111 -0
- package/transform/crates/swc_plugin_element_template/lib.rs +41 -5
- package/transform/crates/swc_plugin_element_template/lowering.rs +39 -7
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_generate_attribute_slots_for_dynamic_attributes.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_background_conditional_attributes.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_boolean_and_number_attributes.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_complex_text_structure.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_dataset_attributes.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_deeply_nested_user_components.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_dynamic_class_attributes.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_events_lepus.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_id_attributes.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_inline_styles.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_interpolated_text_with_siblings_lepus.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_mixed_content.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_nested_structure_and_dynamic_content.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_refs_lepus.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_sibling_user_components.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_spread_attributes.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_user_component.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_isolate_arrays_with_child_slot_placeholder.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_keep_code_and_template_attribute_slots_in_sync_for_spread.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_output_element_template_simple_lepus.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_output_template_with_static_attributes.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_verify_template_structure_complex.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_verify_text_attribute_and_child_text_slots.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/element_template.rs +70 -66
- package/transform/crates/swc_plugin_element_template/tests/element_template_contract.rs +94 -8
- package/transform/crates/swc_plugin_shake/lib.rs +1 -1
- package/transform/crates/swc_plugin_shake/napi.rs +1 -1
- package/transform/crates/swc_plugin_text/lib.rs +57 -16
- package/transform/crates/swc_plugin_text/tests/__swc_snapshots__/lib.rs/should_keep_children_for_dynamic_or_multiple_text.js +13 -0
- package/transform/crates/swc_plugin_text/tests/__swc_snapshots__/lib.rs/should_transform_string_expressions_to_text_attr.js +13 -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 +202 -3
- package/transform/crates/swc_plugin_worklet/lib.rs +468 -3
- 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 +10 -5
- 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 +45 -0
- 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 +16 -16
- 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 +7 -7
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_computed_object_method_key_lepus.js +24 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_object_method_local_decls_lepus.js +16 -0
- 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_transform_js.js +3 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus.js +3 -3
- 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 +16 -0
- package/transform/crates/swc_plugins_shared/jsx_helpers.rs +8 -4
- package/transform/dist/wasm.cjs +1 -1
- package/transform/index.d.ts +7 -6
- package/transform/rspack-napi/tsconfig.tsbuildinfo +1 -1
- package/transform/src/swc_plugin_extract_str/mod.rs +1 -1
- package/transform/swc-plugin-reactlynx/.turbo/turbo-build.log +63 -270
- package/transform/swc-plugin-reactlynx/index.d.ts +2 -2
- package/transform/swc-plugin-reactlynx/swc_plugin_reactlynx.wasm +0 -0
- package/transform/swc-plugin-reactlynx-compat/.turbo/turbo-build.log +306 -170
- package/transform/swc-plugin-reactlynx-compat/index.d.ts +3 -3
- 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/__test__/element-template/fixtures/render/opcodes-into-element-template/creates-template-from-attrs-and-slot-text/case.ts +0 -39
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/handles-multiple-text-nodes-in-the-same-slot/case.ts +0 -29
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/inserts-nested-templates-into-parent-slots/case.ts +0 -42
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/keeps-slot-children-separated-and-ordered/case.ts +0 -31
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/passes-bundle-url-to-native-create/case.ts +0 -20
- package/runtime/__test__/element-template/runtime/render/render-to-opcodes.et.test.jsx +0 -522
- package/runtime/lib/element-template/runtime/render/render-opcodes.js +0 -216
- package/runtime/lib/element-template/runtime/render/render-opcodes.js.map +0 -1
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.d.ts +0 -16
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.js +0 -324
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.js.map +0 -1
- package/runtime/lib/element-template/runtime-backend-marker.js +0 -6
- package/runtime/lib/element-template/runtime-backend-marker.js.map +0 -1
- package/runtime/lib/runtime-backend-marker.js +0 -6
- package/runtime/lib/runtime-backend-marker.js.map +0 -1
- package/runtime/src/element-template/runtime/render/render-opcodes.ts +0 -313
- package/runtime/src/element-template/runtime/render/render-to-opcodes.ts +0 -411
- package/runtime/src/element-template/runtime-backend-marker.ts +0 -7
- package/runtime/src/runtime-backend-marker.ts +0 -7
- package/testing-library/node_modules/.bin/rsbuild +0 -55
- package/testing-library/node_modules/.bin/rspeedy +0 -55
- package/testing-library/node_modules/.bin/rstest +0 -55
- package/transform/node_modules/.bin/esbuild +0 -46
- package/transform/node_modules/.bin/napi +0 -55
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/appends-root-text-via-append-element/native-log.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/appends-root-text-via-append-element/output.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/creates-template-from-attrs-and-slot-text/native-log.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/creates-template-from-attrs-and-slot-text/output.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/handles-multiple-template-children-in-the-same-slot/native-log.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/handles-multiple-template-children-in-the-same-slot/output.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/handles-multiple-text-nodes-in-the-same-slot/native-log.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/handles-multiple-text-nodes-in-the-same-slot/output.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/inserts-nested-templates-into-parent-slots/native-log.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/inserts-nested-templates-into-parent-slots/output.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/keeps-slot-children-separated-and-ordered/native-log.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/keeps-slot-children-separated-and-ordered/output.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/passes-bundle-url-to-native-create/native-log.txt +0 -0
- /package/runtime/lib/{element-template/runtime-backend-marker.d.ts → core/capture-main-thread-object.d.ts} +0 -0
- /package/runtime/lib/{runtime-backend-marker.d.ts → core/main-thread-ref-id.d.ts} +0 -0
package/types/react.docs.d.ts
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
3
|
// LICENSE file in the root directory of this source tree.
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* `@lynx-js/react` is React for Lynx. It keeps the React 17 API surface,
|
|
7
|
+
* re-exporting the standard hooks and APIs, and adds what the dual-thread
|
|
8
|
+
* model needs: main-thread functions, the data a page receives from native,
|
|
9
|
+
* and a few compile-time directives and macros.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
*
|
|
13
|
+
* The React APIs below behave as the
|
|
14
|
+
* {@link https://react.dev/reference/react | official React reference}
|
|
15
|
+
* describes them, unless a page says otherwise. They are compatible with
|
|
16
|
+
* React 17 and {@link https://preactjs.com/guide/v10/switching-to-preact/ | Preact}.
|
|
17
|
+
*
|
|
18
|
+
* React entered its "concurrent" era with
|
|
19
|
+
* {@link https://react.dev/blog/2022/03/29/react-v18 | React 18}. Concurrent
|
|
20
|
+
* features such as `useTransition` and `useDeferredValue` make strict demands
|
|
21
|
+
* on how the host schedules work — they depend on browser Web APIs or on the
|
|
22
|
+
* React Native architecture. Lynx evolves its own architecture, so ReactLynx
|
|
23
|
+
* builds on React 17 and keeps the React programming model. The parts of
|
|
24
|
+
* {@link https://react.dev/blog/2024/04/25/react-19 | React 19} and the
|
|
25
|
+
* {@link https://react.dev/learn/react-compiler | React Compiler} that do not
|
|
26
|
+
* depend on the concurrent architecture are still on the table.
|
|
27
|
+
*
|
|
28
|
+
* For an introduction to ReactLynx, see the
|
|
29
|
+
* {@link https://lynxjs.org/react/ | ReactLynx guides}.
|
|
30
|
+
*
|
|
31
|
+
* @groupDescription Hooks
|
|
32
|
+
* Hooks that ReactLynx adds on top of React, plus the React hooks it
|
|
33
|
+
* re-exports or re-implements for the dual-thread model.
|
|
34
|
+
*
|
|
35
|
+
* @groupDescription Components
|
|
36
|
+
* Provider and consumer components for the data a Lynx page receives from
|
|
37
|
+
* the native side, and the components re-exported from React.
|
|
38
|
+
*
|
|
39
|
+
* @groupDescription Functions
|
|
40
|
+
* Functions for crossing the thread boundary, creating elements outside JSX
|
|
41
|
+
* and mounting the root.
|
|
42
|
+
*
|
|
43
|
+
* @groupDescription Types
|
|
44
|
+
* The types and classes exported by `@lynx-js/react`. Augment `InitData` and
|
|
45
|
+
* `GlobalProps` in your project to type the data your page receives.
|
|
46
|
+
*
|
|
47
|
+
* @document ../docs/directives.md
|
|
48
|
+
* @document ../docs/macros.md
|
|
49
|
+
* @document ../docs/global-events.md
|
|
50
|
+
* @document ../docs/import-attributes.md
|
|
51
|
+
*
|
|
52
|
+
* @packageDocumentation
|
|
53
|
+
*/
|
|
54
|
+
|
|
5
55
|
import type { ReactLynxChildren } from '../runtime/lib/index.js';
|
|
6
56
|
|
|
7
57
|
declare global {
|
|
@@ -49,8 +99,7 @@ declare global {
|
|
|
49
99
|
}
|
|
50
100
|
|
|
51
101
|
/**
|
|
52
|
-
*
|
|
53
|
-
* @see https://react.dev/reference/react/hooks
|
|
102
|
+
* @group Hooks
|
|
54
103
|
*/
|
|
55
104
|
export {
|
|
56
105
|
useCallback,
|
|
@@ -64,25 +113,91 @@ export {
|
|
|
64
113
|
useSyncExternalStore,
|
|
65
114
|
} from 'react';
|
|
66
115
|
|
|
67
|
-
export { useEffect, useLayoutEffect
|
|
116
|
+
export { useEffect, useLayoutEffect } from '../runtime/lib/core/hooks/react.js';
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Catches errors thrown by the components below and lets the component
|
|
120
|
+
* render a fallback.
|
|
121
|
+
* @see https://preactjs.com/guide/v10/hooks/#useerrorboundary
|
|
122
|
+
*
|
|
123
|
+
* @group Hooks
|
|
124
|
+
*/
|
|
125
|
+
export { useErrorBoundary } from '../runtime/lib/core/hooks/react.js';
|
|
68
126
|
|
|
69
127
|
/**
|
|
70
|
-
*
|
|
71
|
-
* @see https://react.dev/reference/react/apis
|
|
128
|
+
* @group Functions
|
|
72
129
|
*/
|
|
73
130
|
export { createContext, forwardRef, lazy, memo } from 'react';
|
|
74
131
|
|
|
75
132
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
133
|
+
* Lets you group elements without a wrapper node.
|
|
134
|
+
*
|
|
135
|
+
* @see {@link https://react.dev/reference/react/Fragment | React Docs}
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
*
|
|
139
|
+
* ```tsx
|
|
140
|
+
* import { Fragment } from '@lynx-js/react';
|
|
141
|
+
*
|
|
142
|
+
* <Fragment>
|
|
143
|
+
* <text>Hello</text>
|
|
144
|
+
* <text>World</text>
|
|
145
|
+
* </Fragment>
|
|
146
|
+
* ```
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
*
|
|
150
|
+
* ```tsx
|
|
151
|
+
* // Using the <></> shorthand syntax:
|
|
152
|
+
*
|
|
153
|
+
* <>
|
|
154
|
+
* <text>Hello</text>
|
|
155
|
+
* <text>World</text>
|
|
156
|
+
* </>
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* @public
|
|
160
|
+
*
|
|
161
|
+
* @group Components
|
|
162
|
+
*
|
|
163
|
+
* @function
|
|
164
|
+
*/
|
|
165
|
+
export const Fragment: typeof import('react').Fragment;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Lets you display a fallback until its children have finished loading.
|
|
169
|
+
*
|
|
170
|
+
* @see {@link https://react.dev/reference/react/Suspense | React Docs}
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
*
|
|
174
|
+
* ```tsx
|
|
175
|
+
* import { Suspense, lazy } from '@lynx-js/react';
|
|
176
|
+
*
|
|
177
|
+
* const ProfileDetails = lazy(() => import('./ProfileDetails.jsx'));
|
|
178
|
+
*
|
|
179
|
+
* <Suspense fallback={<Loading />}>
|
|
180
|
+
* <ProfileDetails />
|
|
181
|
+
* </Suspense>
|
|
182
|
+
* ```
|
|
183
|
+
*
|
|
184
|
+
* @public
|
|
185
|
+
*
|
|
186
|
+
* @group Components
|
|
187
|
+
*
|
|
188
|
+
* @function
|
|
78
189
|
*/
|
|
79
|
-
export
|
|
190
|
+
export const Suspense: typeof import('react').Suspense;
|
|
80
191
|
|
|
81
192
|
/**
|
|
82
|
-
*
|
|
83
|
-
* @see https://react.dev/reference/react/legacy
|
|
193
|
+
* @group Components
|
|
84
194
|
*/
|
|
85
|
-
export { Component, PureComponent
|
|
195
|
+
export { Component, PureComponent } from 'react';
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* @group Functions
|
|
199
|
+
*/
|
|
200
|
+
export { createRef, isValidElement } from 'react';
|
|
86
201
|
|
|
87
202
|
export type { CloneElement, CreateElement, ReactLynxChildren } from '../runtime/lib/index.js';
|
|
88
203
|
|
|
@@ -92,6 +207,8 @@ export type { CloneElement, CreateElement, ReactLynxChildren } from '../runtime/
|
|
|
92
207
|
* Arrays returned by `map`, `forEach`, and `toArray` are frozen.
|
|
93
208
|
*
|
|
94
209
|
* @public
|
|
210
|
+
*
|
|
211
|
+
* @group Functions
|
|
95
212
|
*/
|
|
96
213
|
export const Children: ReactLynxChildren;
|
|
97
214
|
|
|
@@ -100,6 +217,8 @@ export const Children: ReactLynxChildren;
|
|
|
100
217
|
* `NodesRef` (e.g. from `ref={setX}` or `lynx.createSelectorQuery()`).
|
|
101
218
|
*
|
|
102
219
|
* @public
|
|
220
|
+
*
|
|
221
|
+
* @group Functions
|
|
103
222
|
*/
|
|
104
223
|
export { createPortal } from '../runtime/lib/index.js';
|
|
105
224
|
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__OpAttr,
|
|
3
|
-
__OpBegin,
|
|
4
|
-
__OpEnd,
|
|
5
|
-
__OpSlot,
|
|
6
|
-
__OpText,
|
|
7
|
-
renderOpcodesIntoElementTemplate,
|
|
8
|
-
runCase,
|
|
9
|
-
} from '../_shared.js';
|
|
10
|
-
|
|
11
|
-
export function run() {
|
|
12
|
-
return runCase(({ root, nativeLog }) => {
|
|
13
|
-
const opcodes = [
|
|
14
|
-
__OpBegin,
|
|
15
|
-
{ type: '_et_foo', props: {} },
|
|
16
|
-
__OpAttr,
|
|
17
|
-
['test'],
|
|
18
|
-
__OpSlot,
|
|
19
|
-
1,
|
|
20
|
-
__OpText,
|
|
21
|
-
'Hello',
|
|
22
|
-
__OpEnd,
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
const { rootRefs } = renderOpcodesIntoElementTemplate(opcodes);
|
|
26
|
-
rootRefs.forEach(rootRef => __InsertNodeToElementTemplate(root, 0, rootRef, null));
|
|
27
|
-
|
|
28
|
-
const rootChild = root.children?.[0];
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
output: {
|
|
32
|
-
rootChild,
|
|
33
|
-
},
|
|
34
|
-
files: {
|
|
35
|
-
'native-log.txt': nativeLog,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { __OpBegin, __OpEnd, __OpSlot, __OpText, renderOpcodesIntoElementTemplate, runCase } from '../_shared.js';
|
|
2
|
-
|
|
3
|
-
export function run() {
|
|
4
|
-
return runCase(({ root, nativeLog }) => {
|
|
5
|
-
const opcodes = [
|
|
6
|
-
__OpBegin,
|
|
7
|
-
{ type: '_et_parent', props: {} },
|
|
8
|
-
__OpSlot,
|
|
9
|
-
0,
|
|
10
|
-
__OpText,
|
|
11
|
-
'A',
|
|
12
|
-
__OpText,
|
|
13
|
-
'B',
|
|
14
|
-
__OpEnd,
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
const { rootRefs } = renderOpcodesIntoElementTemplate(opcodes);
|
|
18
|
-
rootRefs.forEach(rootRef => __InsertNodeToElementTemplate(root, 0, rootRef, null));
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
output: {
|
|
22
|
-
slotChildren: root.children?.[0]?.children?.[0]?.children ?? [],
|
|
23
|
-
},
|
|
24
|
-
files: {
|
|
25
|
-
'native-log.txt': nativeLog,
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__OpAttr,
|
|
3
|
-
__OpBegin,
|
|
4
|
-
__OpEnd,
|
|
5
|
-
__OpSlot,
|
|
6
|
-
__OpText,
|
|
7
|
-
renderOpcodesIntoElementTemplate,
|
|
8
|
-
runCase,
|
|
9
|
-
} from '../_shared.js';
|
|
10
|
-
|
|
11
|
-
export function run() {
|
|
12
|
-
return runCase(({ root, nativeLog }) => {
|
|
13
|
-
const opcodes = [
|
|
14
|
-
__OpBegin,
|
|
15
|
-
{ type: '_et_outer', props: {} },
|
|
16
|
-
__OpSlot,
|
|
17
|
-
0,
|
|
18
|
-
__OpBegin,
|
|
19
|
-
{ type: '_et_inner', props: {} },
|
|
20
|
-
__OpAttr,
|
|
21
|
-
['inner'],
|
|
22
|
-
__OpSlot,
|
|
23
|
-
0,
|
|
24
|
-
__OpText,
|
|
25
|
-
'X',
|
|
26
|
-
__OpEnd,
|
|
27
|
-
__OpEnd,
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
const { rootRefs } = renderOpcodesIntoElementTemplate(opcodes);
|
|
31
|
-
rootRefs.forEach(rootRef => __InsertNodeToElementTemplate(root, 0, rootRef, null));
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
output: {
|
|
35
|
-
rootChild: root.children?.[0],
|
|
36
|
-
},
|
|
37
|
-
files: {
|
|
38
|
-
'native-log.txt': nativeLog,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { __OpBegin, __OpEnd, __OpSlot, __OpText, renderOpcodesIntoElementTemplate, runCase } from '../_shared.js';
|
|
2
|
-
|
|
3
|
-
export function run() {
|
|
4
|
-
return runCase(({ root, nativeLog }) => {
|
|
5
|
-
const opcodes = [
|
|
6
|
-
__OpBegin,
|
|
7
|
-
{ type: '_et_foo', props: {} },
|
|
8
|
-
__OpSlot,
|
|
9
|
-
0,
|
|
10
|
-
__OpText,
|
|
11
|
-
'A',
|
|
12
|
-
__OpSlot,
|
|
13
|
-
1,
|
|
14
|
-
__OpText,
|
|
15
|
-
'B',
|
|
16
|
-
__OpEnd,
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
const { rootRefs } = renderOpcodesIntoElementTemplate(opcodes);
|
|
20
|
-
rootRefs.forEach(rootRef => __InsertNodeToElementTemplate(root, 0, rootRef, null));
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
output: {
|
|
24
|
-
rootChild: root.children?.[0],
|
|
25
|
-
},
|
|
26
|
-
files: {
|
|
27
|
-
'native-log.txt': nativeLog,
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { __OpBegin, __OpEnd, renderOpcodesIntoElementTemplate, runCase } from '../_shared.js';
|
|
2
|
-
|
|
3
|
-
export function run() {
|
|
4
|
-
return runCase(({ root, nativeLog }) => {
|
|
5
|
-
const opcodes = [
|
|
6
|
-
__OpBegin,
|
|
7
|
-
{ type: 'dynamic-entry:_et_foo', props: {} },
|
|
8
|
-
__OpEnd,
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
const { rootRefs } = renderOpcodesIntoElementTemplate(opcodes);
|
|
12
|
-
rootRefs.forEach(rootRef => __InsertNodeToElementTemplate(root, 0, rootRef, null));
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
files: {
|
|
16
|
-
'native-log.txt': nativeLog,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
});
|
|
20
|
-
}
|