@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
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var e,t,n;let r,l,i;function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class a{cancel(){return __ElementAnimate(this.effect.target.element,[3,this.id])}pause(){return __ElementAnimate(this.effect.target.element,[2,this.id])}play(){return __ElementAnimate(this.effect.target.element,[1,this.id])}start(){return __ElementAnimate(this.effect.target.element,[0,this.id,this.effect.keyframes,this.effect.options])}constructor(e){o(this,"effect",void 0),o(this,"id",void 0),this.effect=e,this.id="__lynx-inner-js-animation-"+a.count++,this.start()}}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}o(a,"count",0);class s{constructor(e,t,n){u(this,"target",void 0),u(this,"keyframes",void 0),u(this,"options",void 0),this.target=e,this.keyframes=t,this.options=n}}function c(e,t){var n;let r=(null!=(n=SystemInfo.lynxSdkVersion)?n:"1.0").split(".");return Number(r[0])>e||Number(r[0])==e&&Number(r[1])>t}let d=!1,f=!0;class y{setAttribute(e,t){__SetAttribute(this.element,e,t),this.flushElementTree()}setStyleProperty(e,t){__AddInlineStyle(this.element,e,t),this.flushElementTree()}setStyleProperties(e){for(let t in e)__AddInlineStyle(this.element,t,e[t]);this.flushElementTree()}getAttribute(e){return __GetAttributeByName(this.element,e)}getAttributeNames(){return __GetAttributeNames(this.element)}querySelector(e){let t=__QuerySelector(this.element,e,{});return t?new y(t):null}querySelectorAll(e){return __QuerySelectorAll(this.element,e,{}).map(e=>new y(e))}getComputedStyleProperty(e){if(!c(3,4))throw Error("getComputedStyleProperty requires Lynx sdk version 3.5");if(!e)throw Error("getComputedStyleProperty: key is required");return __GetComputedStyleByKey(this.element,e)}animate(e,t){return new a(new s(this,e,"number"==typeof t?{duration:t}:null!=t?t:{}))}invoke(e,t){return new Promise((n,r)=>{__InvokeUIMethod(this.element,e,null!=t?t:{},e=>{0===e.code?n(e.data):r(Error("UI method invoke: "+JSON.stringify(e)))}),this.flushElementTree()})}flushElementTree(){!d&&f&&(d=!0,Promise.resolve().then(()=>{d=!1,__FlushElementTree()}))}constructor(e){var t,n;n=void 0,(t="element")in this?Object.defineProperty(this,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):this[t]=n,Object.defineProperty(this,"element",{get:()=>e})}}class m{static get(){return null!=m.pageElement||(m.pageElement=__GetPageElement()),m.pageElement}}function h(e,t,n){let r;try{r=runWorklet(e,t)}finally{lynx.getJSContext().dispatchEvent({type:"Lynx.Worklet.FunctionCallRet",data:JSON.stringify({resolveId:n,returnValue:r})})}}t=void 0,(e="pageElement")in m?Object.defineProperty(m,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):m[e]=t;let _=(e,t)=>({current:t,_wvid:e}),p=e=>{let t,n=e._wvid;return n<0?(t=r._firstScreenWorkletRefMap[n])||(t=r._firstScreenWorkletRefMap[n]=_(n,e._initValue)):t=r._workletRefMap[n],t};function k(){l.delayedBackgroundFunctionArray.length=0}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e,t,n){lynxWorkletImpl._workletMap[t]=n}let I=new WeakMap;function b(e,t){if("object"!=typeof e||null===e)return e;if(t){let t=I.get(e);if(t)return t}let n={main:e};return x(n,0,e),t&&I.set(e,n.main),n.main}let x=(e,t,n)=>{if(++t>=1e3)throw Error("Depth of value exceeds limit of 1000.");if("object"==typeof e&&null!==e)for(let l in e){let i=e[l];if("object"==typeof i&&null!==i){if("elementRefptr"in i){e[l]=new y(i.elementRefptr);continue}if(!(i instanceof y)){if(x(i,t,n),"_wvid"in i){e[l]=p(i);continue}if("_wkltId"in i){let t=i===n,r={...i};if(e[l]=lynxWorkletImpl._workletMap[i._wkltId].bind(r),!t){let t=function(e){try{return new WeakRef(e)}catch{return}}(i);t&&(e[l].ctxRef=t)}continue}if("_jsFnId"in i){var r;i._execId=n._execId,null==(r=lynxWorkletImpl._jsFunctionLifecycleManager)||r.addRef(n._execId,i);continue}}}}};if(void 0===globalThis.lynxWorkletImpl){let e,t;globalThis.lynxWorkletImpl={_workletMap:{},_refImpl:r={_workletRefMap:{},_firstScreenWorkletRefMap:{},updateWorkletRef:function(e,t){p(e).current=t?new y(t):null},updateWorkletRefInitValueChanges:function(e){e.forEach(([e,t])=>{r._workletRefMap[e]||(r._workletRefMap[e]=_(e,t))})},clearFirstScreenWorkletRefMap:function(){r._firstScreenWorkletRefMap={}}},_runOnBackgroundDelayImpl:l={delayedBackgroundFunctionArray:[],clearDelayedBackgroundFunctions:k,delayRunOnBackground:function(e,t){var n;l.delayedBackgroundFunctionArray.push({task:t}),(null!=(n=e._delayIndices)?n:e._delayIndices=[]).push(l.delayedBackgroundFunctionArray.length-1)},runDelayedBackgroundFunctions:function(){for(let e of l.delayedBackgroundFunctionArray)(null==e?void 0:e.jsFnHandle)&&e.task(e.jsFnHandle._jsFnId,e.jsFnHandle._execId);k()}},_hydrateCtx:function(e,t){!function e(t,n,r){var l,i,o;if(t&&"object"==typeof t&&n&&"object"==typeof n&&(!t._wkltId||t._wkltId===n._wkltId))for(let a in t)if("_wvid"===a){l=t[a],"_initValue"in(i=n)||(lynxWorkletImpl._refImpl._workletRefMap[l]=i)}else if("_jsFn"===a)!function(e,t,n){for(let r in e){let l=e[r],i=t[r];if(!(null==i?void 0:i._delayIndices)){i&&(i._isFirstScreen=!1,i._execId=n,Object.assign(i,l));continue}for(let e of i._delayIndices){let t=lynxWorkletImpl._runOnBackgroundDelayImpl.delayedBackgroundFunctionArray[e];t&&(l._execId=n,t.jsFnHandle=l)}}}(t[a],n[a],r);else{let l="function"==typeof n[a]?null==(o=n[a].ctxRef)?void 0:o.deref():n[a];e(t[a],l,r)}}(e,t,e._execId)},_eventDelayImpl:i={_delayedWorkletParamsMap:new Map,runDelayedWorklet:function(e,t){(()=>{let n=i._delayedWorkletParamsMap.get(e._wkltId);if(void 0===n)return;let r=[];n.forEach(n=>{var l;let i=n[0];(null==i||null==(l=i.currentTarget)?void 0:l.elementRefptr)===t?setTimeout(()=>{runWorklet(e,n)},0):r.push(n)}),i._delayedWorkletParamsMap.set(e._wkltId,r)})()},clearDelayedWorklets:function(){i._delayedWorkletParamsMap.clear()}},_eomImpl:{setShouldFlush:function(e){f=e}},_runRunOnMainThreadTask:h},c(2,15)&&(globalThis.lynxWorkletImpl._jsFunctionLifecycleManager=new class e{addRef(e,t){var n;this.retainedObjects.has(t)||(this.retainedObjects.add(t),this.execIdRefCount.set(e,(null!=(n=this.execIdRefCount.get(e))?n:0)+1),this.registry.register(t,e))}removeRef(e){let t=this.execIdRefCount.get(e);t>1?this.execIdRefCount.set(e,t-1):(this.execIdRefCount.delete(e),this.execIdSetToFire.add(e),this.willFire||(this.willFire=!0,Promise.resolve().then(()=>{this.fire()})))}fire(){lynx.getJSContext().dispatchEvent({type:"Lynx.Worklet.releaseBackgroundWorkletCtx",data:Array.from(this.execIdSetToFire)}),this.execIdSetToFire.clear(),this.willFire=!1}constructor(){g(this,"execIdRefCount",new Map),g(this,"execIdSetToFire",new Set),g(this,"retainedObjects",new WeakSet),g(this,"willFire",!1),g(this,"registry",void 0),this.registry=new FinalizationRegistry(this.removeRef.bind(this))}}),globalThis.registerWorklet=v,globalThis.registerWorkletInternal=v,globalThis.runWorklet=function(e,t,n){var r,l,o;if("object"==typeof(r=e)&&null!==r&&("_wkltId"in r||"_lepusWorkletHash"in r)){let r,a;return"_lepusWorkletHash"in e?void(l=e._lepusWorkletHash,o=t,(a=(r=i._delayedWorkletParamsMap).get(l))?a.push(o):r.set(l,[o])):function(e,t,n){let r=(e._wkltId,b(e,!0)),l=b(t||[],!1),[i,o]=function(e,t){if(!Array.isArray(e)||"object"!=typeof e[0]||null===e[0]||(!t||1!==t.source)&&1)return[!1,{}];let n={},r=e[0];return r.stopPropagation=function(){var e;n._eventReturnResult=(null!=(e=n._eventReturnResult)?e:0)|1},r.stopImmediatePropagation=function(){var e;n._eventReturnResult=(null!=(e=n._eventReturnResult)?e:0)|2},[!0,n]}(l,n),a=r(...l);return i?{returnValue:a,eventReturnResult:o._eventReturnResult}:a}(e,t,n)}},lynx.querySelector=function(e){let t=m.get();if(!t)return null;let n=__QuerySelector(t,e,{});return n?new y(n):null},lynx.querySelectorAll=function(e){let t=m.get();return t?__QuerySelectorAll(t,e,{}).map(e=>new y(e)):[]},globalThis.setTimeout=lynx.setTimeout,globalThis.setInterval=lynx.setInterval,globalThis.clearTimeout=lynx.clearTimeout,globalThis.clearInterval=null!=(n=lynx.clearInterval)?n:lynx.clearTimeInterval,e=lynx.requestAnimationFrame,lynx.requestAnimationFrame=globalThis.requestAnimationFrame=t=>{if(!c(2,15))throw Error("requestAnimationFrame in main thread script requires Lynx sdk version 2.16");return e(t)},globalThis.cancelAnimationFrame=lynx.cancelAnimationFrame,(t=lynx.getJSContext()).addEventListener("Lynx.Worklet.runWorkletCtx",e=>{let t=JSON.parse(e.data);h(t.worklet,t.params,t.resolveId)}),t.addEventListener("Lynx.Worklet.releaseWorkletRef",e=>{var t;t=e.data.id,delete r._workletRefMap[t]})}})();
|
|
1
|
+
(()=>{var e,t,r;let n,l,i;function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class a{cancel(){return __ElementAnimate(this.effect.target.element,[3,this.id])}pause(){return __ElementAnimate(this.effect.target.element,[2,this.id])}play(){return __ElementAnimate(this.effect.target.element,[1,this.id])}start(){return __ElementAnimate(this.effect.target.element,[0,this.id,this.effect.keyframes,this.effect.options])}constructor(e){o(this,"effect",void 0),o(this,"id",void 0),this.effect=e,this.id="__lynx-inner-js-animation-"+a.count++,this.start()}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}o(a,"count",0);class s{constructor(e,t,r){u(this,"target",void 0),u(this,"keyframes",void 0),u(this,"options",void 0),this.target=e,this.keyframes=t,this.options=r}}function c(e,t){var r;let n=(null!=(r=SystemInfo.lynxSdkVersion)?r:"1.0").split(".");return Number(n[0])>e||Number(n[0])==e&&Number(n[1])>t}let d=!1,f=!0;class y{setAttribute(e,t){__SetAttribute(this.element,e,t),this.flushElementTree()}setStyleProperty(e,t){__AddInlineStyle(this.element,e,t),this.flushElementTree()}setStyleProperties(e){for(let t in e)__AddInlineStyle(this.element,t,e[t]);this.flushElementTree()}getAttribute(e){return __GetAttributeByName(this.element,e)}getAttributeNames(){return __GetAttributeNames(this.element)}querySelector(e){let t=__QuerySelector(this.element,e,{});return t?new y(t):null}querySelectorAll(e){return __QuerySelectorAll(this.element,e,{}).map(e=>new y(e))}getComputedStyleProperty(e){if(!c(3,4))throw Error("getComputedStyleProperty requires Lynx sdk version 3.5");if(!e)throw Error("getComputedStyleProperty: key is required");return __GetComputedStyleByKey(this.element,e)}animate(e,t){return new a(new s(this,e,"number"==typeof t?{duration:t}:null!=t?t:{}))}invoke(e,t){return new Promise((r,n)=>{__InvokeUIMethod(this.element,e,null!=t?t:{},e=>{0===e.code?r(e.data):n(Error("UI method invoke: "+JSON.stringify(e)))}),this.flushElementTree()})}flushElementTree(){!d&&f&&(d=!0,Promise.resolve().then(()=>{d=!1,__FlushElementTree()}))}constructor(e){var t,r;r=void 0,(t="element")in this?Object.defineProperty(this,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):this[t]=r,Object.defineProperty(this,"element",{get:()=>e})}}class h{static get(){return null!=h.pageElement||(h.pageElement=__GetPageElement()),h.pageElement}}function p(e,t,r){let n;try{n=runWorklet(e,t)}finally{lynx.getJSContext().dispatchEvent({type:"Lynx.Worklet.FunctionCallRet",data:JSON.stringify({resolveId:r,returnValue:n})})}}t=void 0,(e="pageElement")in h?Object.defineProperty(h,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):h[e]=t;let m=new Map,_=new WeakMap;function g(e){return"function"==typeof e?Function.prototype.toString.call(e):`worklet:${e._wkltId}`}function b(e){var t;return e._type&&"main-thread"!==e._type?function(e){var t;let r=e._type,n=m.get(r);if(!n)throw Error(`MainThreadObject type is not registered: "${r}". Define the type in a module evaluated on the main thread before initializing its handle.`);let l=(null!=(t=n.resolvedCreate)?t:n.resolvedCreate=function(e){if("function"==typeof e)return e;if(!("_wkltId"in e)||"_lepusWorkletHash"in e)throw Error("Cannot resolve an invalid Main Thread Function.");return lynxWorkletImpl._workletMap[e._wkltId]}(n.create))(e._initValue);if("object"!=typeof l||null===l)throw Error(`MainThreadObject type "${r}" created a non-object value.`);return _.set(l,r),l}(e):(t=e._wvid,{current:e._initValue,_wvid:t})}function k(e){return"object"==typeof e&&null!==e&&"number"==typeof e._wvid&&Object.prototype.hasOwnProperty.call(e,"current")}function w(e,t,r){let n;if(_.has(t)?n="typed-object":k(t)&&(n="mutable-cell"),!n)throw Error(`Cannot apply MainThreadObject ${r} for handle ${e._wvid}: the existing target has no worklet-value metadata.`);let l=e._type,i=l&&"main-thread"!==l?"typed-object":"mutable-cell";if(n!==i)throw Error(`Worklet value kind mismatch during ${r} for handle ${e._wvid}: background handle expects ${i}, but the main-thread target is ${n}.`);"typed-object"===n&&function(e,t,r){let n=_.get(t),l=e._type;if(n!==l)throw Error(`MainThreadObject type mismatch during ${r} for handle ${e._wvid}: background handle expects type "${l}", but the main-thread target is type "${n}".`)}(e,t,r)}let v=e=>{let t,r=e._wvid;if(r<0){var l,i;t=null!=(i=(l=n._firstScreenWorkletRefMap)[r])?i:l[r]=b(e)}else t=n._workletRefMap[r];return t};function I(){l.delayedBackgroundFunctionArray.length=0}function x(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j(e,t,r){lynxWorkletImpl._workletMap[t]=r}let R=new WeakMap;function W(e,t){if("object"!=typeof e||null===e)return e;if(t){let t=R.get(e);if(t)return t}let r=T({main:e},0,e);return t&&R.set(e,r.main),r.main}let T=(e,t,r)=>{if(++t>=1e3)throw Error("Depth of value exceeds limit of 1000.");if("object"!=typeof e||null===e)return e;let n=e;for(let o in n){var l,i;let a=n[o];if("object"!=typeof a||null===a||_.has(a))continue;if("number"==typeof(i=a)._wvid&&"string"==typeof i._type&&"main-thread"!==i._type){n=M(n,e,o,v(a));continue}if("elementRefptr"in a){n[o]=new y(a.elementRefptr);continue}if(a instanceof y)continue;let u=T(a,t,r);if("_wvid"in a){n[o]=v(a);continue}if("_wkltId"in a){let t=a===r,l={...u},i=lynxWorkletImpl._workletMap[a._wkltId].bind(l);u!==a&&n===e&&n!==r&&(n=F(n)),n=M(n,e,o,i),t||(i.boundCtx=l);continue}if(u!==a&&(n===e&&n!==r&&(n=F(n)),n=M(n,e,o,u)),"_jsFnId"in a){a._execId=r._execId,null==(l=lynxWorkletImpl._jsFunctionLifecycleManager)||l.addRef(r._execId,a);continue}}return n};function M(e,t,r,n){let l=Object.getOwnPropertyDescriptor(e,r);if(null==l?void 0:l.get){let i={value:n,writable:!0,enumerable:l.enumerable,configurable:l.configurable};if(e===t||!l.configurable){let t=Object.getOwnPropertyDescriptors(e);return t[r]=i,F(e,t)}Object.defineProperty(e,r,i)}else e[r]=n;return e}function F(e,t=Object.getOwnPropertyDescriptors(e)){return Object.defineProperties(Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e)),t)}if(void 0===globalThis.lynxWorkletImpl){let e,t;globalThis.lynxWorkletImpl={_workletMap:{},_refImpl:(m.clear(),_=new WeakMap,n={_workletRefMap:{},_firstScreenWorkletRefMap:{},updateWorkletRef:function(e,t){v(e).current=t?new y(t):null},updateWorkletRefInitValueChanges:function(e){let t,r=!1;if(e.forEach(([e,l,i])=>{try{let t={_wvid:e,_initValue:l,_type:i},r=n._workletRefMap[e];r?w(t,r,"initialization patch"):n._workletRefMap[e]=b(t)}catch(e){r||(t=e,r=!0)}}),r)throw t},registerMainThreadObjectType:function(e,t){if("main-thread"===e)throw Error('MainThreadObject type "main-thread" is reserved for MainThreadRef.');let r=m.get(e);if(r){if(g(r.create)!==g(t))throw Error(`Conflicting MainThreadObject registration for type "${e}". A type key must always use the same create function.`);return}m.set(e,{create:t})},clearFirstScreenWorkletRefMap:function(){n._firstScreenWorkletRefMap={}}}),_runOnBackgroundDelayImpl:l={delayedBackgroundFunctionArray:[],clearDelayedBackgroundFunctions:I,delayRunOnBackground:function(e,t){var r;l.delayedBackgroundFunctionArray.push({task:t}),(null!=(r=e._delayIndices)?r:e._delayIndices=[]).push(l.delayedBackgroundFunctionArray.length-1)},runDelayedBackgroundFunctions:function(){for(let e of l.delayedBackgroundFunctionArray)(null==e?void 0:e.jsFnHandle)&&e.task(e.jsFnHandle._jsFnId,e.jsFnHandle._execId);I()}},_hydrateCtx:function(e,t){!function e(t,r,l){if(t&&"object"==typeof t&&r&&"object"==typeof r&&(!t._wkltId||t._wkltId===r._wkltId)){var i,o,a;if("number"==typeof(i=t)._wvid&&"string"==typeof i._type)return void function(e,t){"object"==typeof t&&null!==t&&(_.has(t)||k(t))&&(w(e,t,"hydration"),n._workletRefMap[e._wvid]=t)}(t,r);for(let n in t)if("_wvid"===n){o=t[n],"_initValue"in(a=r)||(lynxWorkletImpl._refImpl._workletRefMap[o]=a)}else if("_jsFn"===n)!function(e,t,r){for(let n in e){let l=e[n],i=t[n];if(!(null==i?void 0:i._delayIndices)){i&&(i._isFirstScreen=!1,i._execId=r,Object.assign(i,l));continue}for(let e of i._delayIndices){let t=lynxWorkletImpl._runOnBackgroundDelayImpl.delayedBackgroundFunctionArray[e];t&&(l._execId=r,t.jsFnHandle=l)}}}(t[n],r[n],l);else{let i="function"==typeof r[n]?r[n].boundCtx:r[n];e(t[n],i,l)}}}(e,t,e._execId)},_eventDelayImpl:i={_delayedWorkletParamsMap:new Map,runDelayedWorklet:function(e,t){(()=>{let r=i._delayedWorkletParamsMap.get(e._wkltId);if(void 0===r)return;let n=[];r.forEach(r=>{var l;let i=r[0];(null==i||null==(l=i.currentTarget)?void 0:l.elementRefptr)===t?setTimeout(()=>{runWorklet(e,r)},0):n.push(r)}),i._delayedWorkletParamsMap.set(e._wkltId,n)})()},clearDelayedWorklets:function(){i._delayedWorkletParamsMap.clear()}},_eomImpl:{setShouldFlush:function(e){f=e}},_runRunOnMainThreadTask:p},c(2,15)&&(globalThis.lynxWorkletImpl._jsFunctionLifecycleManager=new class e{addRef(e,t){var r;this.retainedObjects.has(t)||(this.retainedObjects.add(t),this.execIdRefCount.set(e,(null!=(r=this.execIdRefCount.get(e))?r:0)+1),this.registry.register(t,e))}removeRef(e){let t=this.execIdRefCount.get(e);t>1?this.execIdRefCount.set(e,t-1):(this.execIdRefCount.delete(e),this.execIdSetToFire.add(e),this.willFire||(this.willFire=!0,Promise.resolve().then(()=>{this.fire()})))}fire(){lynx.getJSContext().dispatchEvent({type:"Lynx.Worklet.releaseBackgroundWorkletCtx",data:Array.from(this.execIdSetToFire)}),this.execIdSetToFire.clear(),this.willFire=!1}constructor(){x(this,"execIdRefCount",new Map),x(this,"execIdSetToFire",new Set),x(this,"retainedObjects",new WeakSet),x(this,"willFire",!1),x(this,"registry",void 0),this.registry=new FinalizationRegistry(this.removeRef.bind(this))}}),globalThis.registerWorklet=j,globalThis.registerWorkletInternal=j,globalThis.runWorklet=function(e,t,r){var n,l,o;if("object"==typeof(n=e)&&null!==n&&("_wkltId"in n||"_lepusWorkletHash"in n)){let n,a;return"_lepusWorkletHash"in e?void(l=e._lepusWorkletHash,o=t,(a=(n=i._delayedWorkletParamsMap).get(l))?a.push(o):n.set(l,[o])):function(e,t,r){let n=(e._wkltId,W(e,!0)),l=W(t||[],!1),[i,o]=function(e,t){if(!Array.isArray(e)||"object"!=typeof e[0]||null===e[0]||(!t||1!==t.source)&&1)return[!1,{}];let r={},n=e[0];return n.stopPropagation=function(){var e;r._eventReturnResult=(null!=(e=r._eventReturnResult)?e:0)|1},n.stopImmediatePropagation=function(){var e;r._eventReturnResult=(null!=(e=r._eventReturnResult)?e:0)|2},[!0,r]}(l,r),a=n(...l);return i?{returnValue:a,eventReturnResult:o._eventReturnResult}:a}(e,t,r)}},lynx.querySelector=function(e){let t=h.get();if(!t)return null;let r=__QuerySelector(t,e,{});return r?new y(r):null},lynx.querySelectorAll=function(e){let t=h.get();return t?__QuerySelectorAll(t,e,{}).map(e=>new y(e)):[]},globalThis.setTimeout=lynx.setTimeout,globalThis.setInterval=lynx.setInterval,globalThis.clearTimeout=lynx.clearTimeout,globalThis.clearInterval=null!=(r=lynx.clearInterval)?r:lynx.clearTimeInterval,e=lynx.requestAnimationFrame,lynx.requestAnimationFrame=globalThis.requestAnimationFrame=t=>{if(!c(2,15))throw Error("requestAnimationFrame in main thread script requires Lynx sdk version 2.16");return e(t)},globalThis.cancelAnimationFrame=lynx.cancelAnimationFrame,(t=lynx.getJSContext()).addEventListener("Lynx.Worklet.runWorkletCtx",e=>{let t=JSON.parse(e.data);p(t.worklet,t.params,t.resolveId)}),t.addEventListener("Lynx.Worklet.releaseWorkletRef",e=>{var t;t=e.data.id,delete n._workletRefMap[t]})}})();
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
$ rslib
|
|
2
|
-
Rslib v1.0.
|
|
1
|
+
$ rslib
|
|
2
|
+
Rslib v1.0.2
|
|
3
3
|
|
|
4
4
|
info build started...
|
|
5
|
-
start generating declaration files... (esm2)
|
|
6
5
|
start generating declaration files... (esm0)
|
|
7
|
-
|
|
8
|
-
ready built in 0.
|
|
9
|
-
ready built in 0.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ready declaration files
|
|
6
|
+
start generating declaration files... (esm2)
|
|
7
|
+
ready built in 0.86s (esm2)
|
|
8
|
+
ready built in 0.97s (esm1)
|
|
9
|
+
ready built in 1.52s (esm0)
|
|
10
|
+
info declaration files prepared with tsgo in 1.58 s (esm2)
|
|
11
|
+
ready declaration files bundled successfully: dist/index.d.ts in 3.82 s (esm2)
|
|
12
|
+
ready declaration files generated in 7.63 s (esm0)
|
|
13
13
|
|
|
14
14
|
File (esm0) Size
|
|
15
15
|
dist/rslib-runtime-0.js 1.6 kB
|
|
16
16
|
dist/rstest-config.js 3.2 kB
|
|
17
17
|
dist/@rstest/adapter-rsbuild~0.js 3.7 kB
|
|
18
18
|
dist/plugins/index.js 12.1 kB
|
|
19
|
-
dist/env/index.js 26.
|
|
20
|
-
dist/pure.js
|
|
19
|
+
dist/env/index.js 26.7 kB
|
|
20
|
+
dist/pure.js 539.1 kB
|
|
21
21
|
|
|
22
|
-
Total: 586.
|
|
22
|
+
Total: 586.4 kB
|
|
23
23
|
|
|
24
24
|
10 files generated in dist, total: 8.5 kB (esm1)
|
|
25
25
|
|
|
@@ -106,7 +106,7 @@ const initElementTree = ()=>{
|
|
|
106
106
|
}
|
|
107
107
|
if (null === value) return void e.removeAttribute(key);
|
|
108
108
|
if ('string' == typeof value) return void e.setAttribute(key, value);
|
|
109
|
-
e.setAttribute(key, JSON.stringify(value));
|
|
109
|
+
else return void e.setAttribute(key, JSON.stringify(value));
|
|
110
110
|
}
|
|
111
111
|
__AddEvent(e, eventType, eventName, eventHandler) {
|
|
112
112
|
if (e.eventMap?.[`${eventType}:${eventName}`]) {
|
|
@@ -609,7 +609,7 @@ function injectBackgroundThreadGlobals(target, polyfills) {
|
|
|
609
609
|
getJSContext: ()=>backgroundThreadContexts.JsContext,
|
|
610
610
|
getJSModule: (moduleName)=>{
|
|
611
611
|
if ('GlobalEventEmitter' === moduleName) return globalEventEmitter;
|
|
612
|
-
throw new Error(`getJSModule(${moduleName}) not implemented`);
|
|
612
|
+
else throw new Error(`getJSModule(${moduleName}) not implemented`);
|
|
613
613
|
},
|
|
614
614
|
reportError: (e)=>{
|
|
615
615
|
throw e;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { act } from 'preact/test-utils';
|
|
2
2
|
import { ARIARole } from 'aria-query';
|
|
3
|
-
import { OptionsReceived } from 'pretty-format';
|
|
4
|
-
import * as prettyFormat from 'pretty-format';
|
|
5
3
|
|
|
6
4
|
export { act }
|
|
7
5
|
|
|
@@ -284,6 +282,37 @@ export declare interface ByRoleOptions {
|
|
|
284
282
|
*/
|
|
285
283
|
export declare function cleanup(): void;
|
|
286
284
|
|
|
285
|
+
/**
|
|
286
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
287
|
+
*
|
|
288
|
+
* This source code is licensed under the MIT license found in the
|
|
289
|
+
* LICENSE file in the root directory of this source tree.
|
|
290
|
+
*/
|
|
291
|
+
declare type Colors = {
|
|
292
|
+
comment: {
|
|
293
|
+
close: string;
|
|
294
|
+
open: string;
|
|
295
|
+
};
|
|
296
|
+
content: {
|
|
297
|
+
close: string;
|
|
298
|
+
open: string;
|
|
299
|
+
};
|
|
300
|
+
prop: {
|
|
301
|
+
close: string;
|
|
302
|
+
open: string;
|
|
303
|
+
};
|
|
304
|
+
tag: {
|
|
305
|
+
close: string;
|
|
306
|
+
open: string;
|
|
307
|
+
};
|
|
308
|
+
value: {
|
|
309
|
+
close: string;
|
|
310
|
+
open: string;
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
declare type CompareKeys = ((a: string, b: string) => number) | undefined;
|
|
315
|
+
|
|
287
316
|
export declare function computeHeadingLevel(element: Element): number | undefined
|
|
288
317
|
|
|
289
318
|
export declare interface Config {
|
|
@@ -307,6 +336,22 @@ export declare interface Config {
|
|
|
307
336
|
getElementError: (message: string | null, container: Element) => Error
|
|
308
337
|
}
|
|
309
338
|
|
|
339
|
+
declare type Config_2 = {
|
|
340
|
+
callToJSON: boolean;
|
|
341
|
+
compareKeys: CompareKeys;
|
|
342
|
+
colors: Colors;
|
|
343
|
+
escapeRegex: boolean;
|
|
344
|
+
escapeString: boolean;
|
|
345
|
+
indent: string;
|
|
346
|
+
maxDepth: number;
|
|
347
|
+
min: boolean;
|
|
348
|
+
plugins: Plugins;
|
|
349
|
+
printBasicPrototype: boolean;
|
|
350
|
+
printFunctionName: boolean;
|
|
351
|
+
spacingInner: string;
|
|
352
|
+
spacingOuter: string;
|
|
353
|
+
};
|
|
354
|
+
|
|
310
355
|
export declare interface ConfigFn {
|
|
311
356
|
(existingConfig: Config): Partial<Config>
|
|
312
357
|
}
|
|
@@ -329,6 +374,8 @@ export declare type CreateObject = {
|
|
|
329
374
|
) => Event
|
|
330
375
|
}
|
|
331
376
|
|
|
377
|
+
declare const DEFAULT_OPTIONS: Options;
|
|
378
|
+
|
|
332
379
|
export declare interface DefaultNormalizerOptions {
|
|
333
380
|
trim?: boolean
|
|
334
381
|
collapseWhitespace?: boolean
|
|
@@ -618,6 +665,13 @@ declare type FireObject_2 = {
|
|
|
618
665
|
) => boolean
|
|
619
666
|
}
|
|
620
667
|
|
|
668
|
+
/**
|
|
669
|
+
* Returns a presentation string of your `val` object
|
|
670
|
+
* @param val any potential JavaScript object
|
|
671
|
+
* @param options Custom settings
|
|
672
|
+
*/
|
|
673
|
+
declare function format(val: unknown, options?: OptionsReceived): string;
|
|
674
|
+
|
|
621
675
|
export declare type GetAllBy<Arguments extends any[]> = QueryMethod<
|
|
622
676
|
Arguments,
|
|
623
677
|
HTMLElement[]
|
|
@@ -741,6 +795,8 @@ variant?: Variant,
|
|
|
741
795
|
method?: Method,
|
|
742
796
|
): Suggestion | undefined
|
|
743
797
|
|
|
798
|
+
declare type Indent = (arg0: string) => string;
|
|
799
|
+
|
|
744
800
|
/**
|
|
745
801
|
* @public
|
|
746
802
|
*/
|
|
@@ -1021,17 +1077,64 @@ export declare type Method =
|
|
|
1021
1077
|
| 'Title'
|
|
1022
1078
|
| 'title'
|
|
1023
1079
|
|
|
1080
|
+
declare type NewPlugin = {
|
|
1081
|
+
serialize: (val: any, config: Config_2, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
|
|
1082
|
+
test: Test;
|
|
1083
|
+
};
|
|
1084
|
+
|
|
1024
1085
|
export declare type NormalizerFn = (text: string) => string
|
|
1025
1086
|
|
|
1026
1087
|
export declare interface NormalizerOptions extends DefaultNormalizerOptions {
|
|
1027
1088
|
normalizer?: NormalizerFn
|
|
1028
1089
|
}
|
|
1029
1090
|
|
|
1091
|
+
declare type OldPlugin = {
|
|
1092
|
+
print: (val: unknown, print: Print, indent: Indent, options: PluginOptions, colors: Colors) => string;
|
|
1093
|
+
test: Test;
|
|
1094
|
+
};
|
|
1095
|
+
|
|
1096
|
+
declare type Options = {
|
|
1097
|
+
callToJSON: boolean;
|
|
1098
|
+
compareKeys: CompareKeys;
|
|
1099
|
+
escapeRegex: boolean;
|
|
1100
|
+
escapeString: boolean;
|
|
1101
|
+
highlight: boolean;
|
|
1102
|
+
indent: number;
|
|
1103
|
+
maxDepth: number;
|
|
1104
|
+
min: boolean;
|
|
1105
|
+
plugins: Plugins;
|
|
1106
|
+
printBasicPrototype: boolean;
|
|
1107
|
+
printFunctionName: boolean;
|
|
1108
|
+
theme: Theme;
|
|
1109
|
+
};
|
|
1110
|
+
|
|
1111
|
+
declare type OptionsReceived = PrettyFormatOptions;
|
|
1112
|
+
|
|
1030
1113
|
/**
|
|
1031
1114
|
* @public
|
|
1032
1115
|
*/
|
|
1033
1116
|
declare type PickUnderscoreKeys<T> = Pick<T, FilterUnderscoreKeys<T>>;
|
|
1034
1117
|
|
|
1118
|
+
declare type Plugin_2 = NewPlugin | OldPlugin;
|
|
1119
|
+
|
|
1120
|
+
declare type PluginOptions = {
|
|
1121
|
+
edgeSpacing: string;
|
|
1122
|
+
min: boolean;
|
|
1123
|
+
spacing: string;
|
|
1124
|
+
};
|
|
1125
|
+
|
|
1126
|
+
declare type Plugins = Array<Plugin_2>;
|
|
1127
|
+
|
|
1128
|
+
declare const plugins: {
|
|
1129
|
+
AsymmetricMatcher: NewPlugin;
|
|
1130
|
+
ConvertAnsi: NewPlugin;
|
|
1131
|
+
DOMCollection: NewPlugin;
|
|
1132
|
+
DOMElement: NewPlugin;
|
|
1133
|
+
Immutable: NewPlugin;
|
|
1134
|
+
ReactElement: NewPlugin;
|
|
1135
|
+
ReactTestComponent: NewPlugin;
|
|
1136
|
+
};
|
|
1137
|
+
|
|
1035
1138
|
export declare function prettyDOM(
|
|
1036
1139
|
dom?: Element | HTMLDocument,
|
|
1037
1140
|
maxLength?: number,
|
|
@@ -1046,8 +1149,48 @@ export declare interface PrettyDOMOptions extends prettyFormat.OptionsReceived {
|
|
|
1046
1149
|
filterNode?: (node: Node) => boolean
|
|
1047
1150
|
}
|
|
1048
1151
|
|
|
1152
|
+
declare namespace prettyFormat {
|
|
1153
|
+
export {
|
|
1154
|
+
format,
|
|
1155
|
+
Colors,
|
|
1156
|
+
CompareKeys,
|
|
1157
|
+
Config_2 as Config,
|
|
1158
|
+
Options,
|
|
1159
|
+
OptionsReceived,
|
|
1160
|
+
OldPlugin,
|
|
1161
|
+
NewPlugin,
|
|
1162
|
+
Plugin_2 as Plugin,
|
|
1163
|
+
Plugins,
|
|
1164
|
+
PrettyFormatOptions,
|
|
1165
|
+
Printer,
|
|
1166
|
+
Refs,
|
|
1167
|
+
Theme,
|
|
1168
|
+
DEFAULT_OPTIONS,
|
|
1169
|
+
plugins,
|
|
1170
|
+
format as default
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1049
1173
|
export { prettyFormat }
|
|
1050
1174
|
|
|
1175
|
+
declare interface PrettyFormatOptions {
|
|
1176
|
+
callToJSON?: boolean;
|
|
1177
|
+
compareKeys?: CompareKeys;
|
|
1178
|
+
escapeRegex?: boolean;
|
|
1179
|
+
escapeString?: boolean;
|
|
1180
|
+
highlight?: boolean;
|
|
1181
|
+
indent?: number;
|
|
1182
|
+
maxDepth?: number;
|
|
1183
|
+
min?: boolean;
|
|
1184
|
+
plugins?: Plugins;
|
|
1185
|
+
printBasicPrototype?: boolean;
|
|
1186
|
+
printFunctionName?: boolean;
|
|
1187
|
+
theme?: ThemeReceived;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
declare type Print = (arg0: unknown) => string;
|
|
1191
|
+
|
|
1192
|
+
declare type Printer = (val: unknown, config: Config_2, indentation: string, depth: number, refs: Refs, hasCalledToJSON?: boolean) => string;
|
|
1193
|
+
|
|
1051
1194
|
export declare interface Queries {
|
|
1052
1195
|
[T: string]: Query
|
|
1053
1196
|
}
|
|
@@ -1267,6 +1410,8 @@ export declare interface QueryOptions {
|
|
|
1267
1410
|
[key: string]: RegExp | boolean
|
|
1268
1411
|
}
|
|
1269
1412
|
|
|
1413
|
+
declare type Refs = Array<unknown>;
|
|
1414
|
+
|
|
1270
1415
|
/**
|
|
1271
1416
|
* Render into the page. It should be used with cleanup.
|
|
1272
1417
|
*
|
|
@@ -1376,7 +1521,7 @@ export declare interface RenderHookOptions<Props> {
|
|
|
1376
1521
|
* export * from '@lynx-js/react/testing-library'
|
|
1377
1522
|
*
|
|
1378
1523
|
* // override renderHook method
|
|
1379
|
-
* export {
|
|
1524
|
+
* export { customRenderHook as renderHook }
|
|
1380
1525
|
* ```
|
|
1381
1526
|
*/
|
|
1382
1527
|
wrapper?: React.JSXElementConstructor<{ children: React.ReactNode }> | undefined;
|
|
@@ -1492,7 +1637,7 @@ export declare interface RenderOptions<Q extends Queries = typeof queries> {
|
|
|
1492
1637
|
export declare type RenderResult<Q extends Queries = typeof queries> = {
|
|
1493
1638
|
container: LynxElement;
|
|
1494
1639
|
rerender: (ui: React.ReactNode) => void;
|
|
1495
|
-
unmount: () =>
|
|
1640
|
+
unmount: () => void;
|
|
1496
1641
|
asFragment: () => DocumentFragment;
|
|
1497
1642
|
} & { [P in keyof Q]: BoundFunction<Q[P]> };
|
|
1498
1643
|
|
|
@@ -1531,6 +1676,24 @@ export declare interface Suggestion {
|
|
|
1531
1676
|
toString(): string
|
|
1532
1677
|
}
|
|
1533
1678
|
|
|
1679
|
+
declare type Test = (arg0: any) => boolean;
|
|
1680
|
+
|
|
1681
|
+
declare type Theme = {
|
|
1682
|
+
comment: string;
|
|
1683
|
+
content: string;
|
|
1684
|
+
prop: string;
|
|
1685
|
+
tag: string;
|
|
1686
|
+
value: string;
|
|
1687
|
+
};
|
|
1688
|
+
|
|
1689
|
+
declare type ThemeReceived = {
|
|
1690
|
+
comment?: string;
|
|
1691
|
+
content?: string;
|
|
1692
|
+
prop?: string;
|
|
1693
|
+
tag?: string;
|
|
1694
|
+
value?: string;
|
|
1695
|
+
};
|
|
1696
|
+
|
|
1534
1697
|
export declare type Variant =
|
|
1535
1698
|
| 'find'
|
|
1536
1699
|
| 'findAll'
|
|
@@ -149,7 +149,7 @@ function testingLibraryPlugin(options) {
|
|
|
149
149
|
code: result.code,
|
|
150
150
|
map: result.map
|
|
151
151
|
};
|
|
152
|
-
this.error(`babel-plugin-react-compiler transform failed for ${sourcePath}: ${result ? 'missing code or map' : 'no result'}`);
|
|
152
|
+
else this.error(`babel-plugin-react-compiler transform failed for ${sourcePath}: ${result ? 'missing code or map' : 'no result'}`);
|
|
153
153
|
} catch (e) {
|
|
154
154
|
this.error(e);
|
|
155
155
|
}
|
|
@@ -9938,12 +9938,14 @@ __webpack_require__.add({
|
|
|
9938
9938
|
if (!(index < values.length)) return {
|
|
9939
9939
|
done: true
|
|
9940
9940
|
};
|
|
9941
|
-
|
|
9942
|
-
|
|
9943
|
-
|
|
9944
|
-
|
|
9945
|
-
|
|
9946
|
-
|
|
9941
|
+
else {
|
|
9942
|
+
var value = values[index];
|
|
9943
|
+
index += 1;
|
|
9944
|
+
return {
|
|
9945
|
+
done: false,
|
|
9946
|
+
value: value
|
|
9947
|
+
};
|
|
9948
|
+
}
|
|
9947
9949
|
}
|
|
9948
9950
|
};
|
|
9949
9951
|
return iter;
|
|
@@ -10040,13 +10042,15 @@ __webpack_require__.add({
|
|
|
10040
10042
|
},
|
|
10041
10043
|
decompressFromUint8Array: function(compressed) {
|
|
10042
10044
|
if (null == compressed) return LZString.decompress(compressed);
|
|
10043
|
-
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
|
|
10048
|
-
|
|
10049
|
-
|
|
10045
|
+
else {
|
|
10046
|
+
var buf = new Array(compressed.length / 2);
|
|
10047
|
+
for(var i = 0, TotalLen = buf.length; i < TotalLen; i++)buf[i] = 256 * compressed[2 * i] + compressed[2 * i + 1];
|
|
10048
|
+
var result = [];
|
|
10049
|
+
buf.forEach(function(c) {
|
|
10050
|
+
result.push(f(c));
|
|
10051
|
+
});
|
|
10052
|
+
return LZString.decompress(result.join(''));
|
|
10053
|
+
}
|
|
10050
10054
|
},
|
|
10051
10055
|
compressToEncodedURIComponent: function(input) {
|
|
10052
10056
|
if (null == input) return "";
|
|
@@ -10230,8 +10234,7 @@ __webpack_require__.add({
|
|
|
10230
10234
|
if (context_data_position == bitsPerChar - 1) {
|
|
10231
10235
|
context_data.push(getCharFromInt(context_data_val));
|
|
10232
10236
|
break;
|
|
10233
|
-
}
|
|
10234
|
-
context_data_position++;
|
|
10237
|
+
} else context_data_position++;
|
|
10235
10238
|
}
|
|
10236
10239
|
return context_data.join('');
|
|
10237
10240
|
},
|
|
@@ -10706,10 +10709,10 @@ __webpack_require__.add({
|
|
|
10706
10709
|
var _collections = __webpack_require__("../../../node_modules/.pnpm/pretty-format@27.5.1/node_modules/pretty-format/build/collections.js");
|
|
10707
10710
|
var global = function() {
|
|
10708
10711
|
if ("u" > typeof globalThis) return globalThis;
|
|
10709
|
-
if (void 0 !== global) return global;
|
|
10710
|
-
if ("u" > typeof self) return self;
|
|
10711
|
-
if ("u" > typeof window) return window;
|
|
10712
|
-
return Function('return this')();
|
|
10712
|
+
else if (void 0 !== global) return global;
|
|
10713
|
+
else if ("u" > typeof self) return self;
|
|
10714
|
+
else if ("u" > typeof window) return window;
|
|
10715
|
+
else return Function('return this')();
|
|
10713
10716
|
}();
|
|
10714
10717
|
var Symbol1 = global['jest-symbol-do-not-touch'] || global.Symbol;
|
|
10715
10718
|
const asymmetricMatcher = 'function' == typeof Symbol1 && Symbol1.for ? Symbol1.for('jest.asymmetricMatcher') : 0x1357a5;
|
|
@@ -11050,10 +11053,10 @@ __webpack_require__.add({
|
|
|
11050
11053
|
var _markup = __webpack_require__("../../../node_modules/.pnpm/pretty-format@27.5.1/node_modules/pretty-format/build/plugins/lib/markup.js");
|
|
11051
11054
|
var global = function() {
|
|
11052
11055
|
if ("u" > typeof globalThis) return globalThis;
|
|
11053
|
-
if (void 0 !== global) return global;
|
|
11054
|
-
if ("u" > typeof self) return self;
|
|
11055
|
-
if ("u" > typeof window) return window;
|
|
11056
|
-
return Function('return this')();
|
|
11056
|
+
else if (void 0 !== global) return global;
|
|
11057
|
+
else if ("u" > typeof self) return self;
|
|
11058
|
+
else if ("u" > typeof window) return window;
|
|
11059
|
+
else return Function('return this')();
|
|
11057
11060
|
}();
|
|
11058
11061
|
var Symbol1 = global['jest-symbol-do-not-touch'] || global.Symbol;
|
|
11059
11062
|
const testSymbol = 'function' == typeof Symbol1 && Symbol1.for ? Symbol1.for('react.test.json') : 0xea71357;
|
|
@@ -12380,10 +12383,10 @@ function getDocument() {
|
|
|
12380
12383
|
}
|
|
12381
12384
|
function getWindowFromNode(node) {
|
|
12382
12385
|
if (node.defaultView) return node.defaultView;
|
|
12383
|
-
if (node.ownerDocument && node.ownerDocument.defaultView) return node.ownerDocument.defaultView;
|
|
12384
|
-
if (node.window) return node.window;
|
|
12385
|
-
if (node.ownerDocument && null === node.ownerDocument.defaultView) throw new Error("It looks like the window object is not available for the provided node.");
|
|
12386
|
-
if (node.then instanceof Function) throw new Error("It looks like you passed a Promise object instead of a DOM node. Did you do something like `fireEvent.click(screen.findBy...` when you meant to use a `getBy` query `fireEvent.click(screen.getBy...`, or await the findBy query `fireEvent.click(await screen.findBy...`?");
|
|
12386
|
+
else if (node.ownerDocument && node.ownerDocument.defaultView) return node.ownerDocument.defaultView;
|
|
12387
|
+
else if (node.window) return node.window;
|
|
12388
|
+
else if (node.ownerDocument && null === node.ownerDocument.defaultView) throw new Error("It looks like the window object is not available for the provided node.");
|
|
12389
|
+
else if (node.then instanceof Function) throw new Error("It looks like you passed a Promise object instead of a DOM node. Did you do something like `fireEvent.click(screen.findBy...` when you meant to use a `getBy` query `fireEvent.click(screen.getBy...`, or await the findBy query `fireEvent.click(await screen.findBy...`?");
|
|
12387
12390
|
else if (Array.isArray(node)) throw new Error("It looks like you passed an Array instead of a DOM node. Did you do something like `fireEvent.click(screen.getAllBy...` when you meant to use a `getBy` query `fireEvent.click(screen.getBy...`?");
|
|
12388
12391
|
else if ('function' == typeof node.debug && 'function' == typeof node.logTestingPlaygroundURL) throw new Error("It looks like you passed a `screen` object. Did you do something like `fireEvent.click(screen, ...` when you meant to use a query, e.g. `fireEvent.click(screen.getBy..., `?");
|
|
12389
12392
|
else throw new Error("The given node is not an Element, the node type is: " + typeof node + ".");
|
|
@@ -12404,7 +12407,7 @@ const shouldHighlight = ()=>{
|
|
|
12404
12407
|
if (colorsJSON) colors = JSON.parse(colorsJSON);
|
|
12405
12408
|
} catch {}
|
|
12406
12409
|
if ('boolean' == typeof colors) return colors;
|
|
12407
|
-
return void 0 !== process.versions && void 0 !== process.versions.node;
|
|
12410
|
+
else return void 0 !== process.versions && void 0 !== process.versions.node;
|
|
12408
12411
|
};
|
|
12409
12412
|
const { DOMCollection: DOMCollection } = build.plugins;
|
|
12410
12413
|
const ELEMENT_NODE = 1;
|
|
@@ -12541,16 +12544,16 @@ function fuzzyMatches(textToMatch, node, matcher, normalizer) {
|
|
|
12541
12544
|
assertNotNullOrUndefined(matcher);
|
|
12542
12545
|
const normalizedText = normalizer(textToMatch);
|
|
12543
12546
|
if ('string' == typeof matcher || 'number' == typeof matcher) return normalizedText.toLowerCase().includes(matcher.toString().toLowerCase());
|
|
12544
|
-
if ('function' == typeof matcher) return matcher(normalizedText, node);
|
|
12545
|
-
return matchRegExp(matcher, normalizedText);
|
|
12547
|
+
else if ('function' == typeof matcher) return matcher(normalizedText, node);
|
|
12548
|
+
else return matchRegExp(matcher, normalizedText);
|
|
12546
12549
|
}
|
|
12547
12550
|
function matches(textToMatch, node, matcher, normalizer) {
|
|
12548
12551
|
if ('string' != typeof textToMatch) return false;
|
|
12549
12552
|
assertNotNullOrUndefined(matcher);
|
|
12550
12553
|
const normalizedText = normalizer(textToMatch);
|
|
12551
12554
|
if (matcher instanceof Function) return matcher(normalizedText, node);
|
|
12552
|
-
if (matcher instanceof RegExp) return matchRegExp(matcher, normalizedText);
|
|
12553
|
-
return normalizedText === String(matcher);
|
|
12555
|
+
else if (matcher instanceof RegExp) return matchRegExp(matcher, normalizedText);
|
|
12556
|
+
else return normalizedText === String(matcher);
|
|
12554
12557
|
}
|
|
12555
12558
|
function getDefaultNormalizer(_temp) {
|
|
12556
12559
|
let { trim = true, collapseWhitespace = true } = void 0 === _temp ? {} : _temp;
|
|
@@ -12617,8 +12620,8 @@ function buildElementRoleList(elementRolesMap) {
|
|
|
12617
12620
|
const shouldBeNonEmpty = -1 !== constraints.indexOf('set');
|
|
12618
12621
|
const hasExplicitValue = void 0 !== value;
|
|
12619
12622
|
if (hasExplicitValue) return "[" + attributeName + "=\"" + value + "\"]";
|
|
12620
|
-
if (shouldNotExist) return ":not([" + attributeName + "])";
|
|
12621
|
-
if (shouldBeNonEmpty) return "[" + attributeName + "]:not([" + attributeName + "=\"\"])";
|
|
12623
|
+
else if (shouldNotExist) return ":not([" + attributeName + "])";
|
|
12624
|
+
else if (shouldBeNonEmpty) return "[" + attributeName + "]:not([" + attributeName + "=\"\"])";
|
|
12622
12625
|
return "[" + attributeName + "]";
|
|
12623
12626
|
}).join('');
|
|
12624
12627
|
}
|
|
@@ -12921,7 +12924,7 @@ function waitFor(callback, _ref) {
|
|
|
12921
12924
|
}
|
|
12922
12925
|
function checkRealTimersCallback() {
|
|
12923
12926
|
if (!jestFakeTimersAreEnabled()) return checkCallback();
|
|
12924
|
-
{
|
|
12927
|
+
else {
|
|
12925
12928
|
const error = new Error("Changed from using real timers to fake timers while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing to fake timers. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830");
|
|
12926
12929
|
if (!showOriginalStackTrace) copyStackTrace(error, stackTraceError);
|
|
12927
12930
|
return reject(error);
|
|
@@ -13137,9 +13140,8 @@ const getAllByLabelText = function(container, text) {
|
|
|
13137
13140
|
if (labels.length) {
|
|
13138
13141
|
const tagNames = labels.map((label)=>getTagNameOfElementAssociatedWithLabelViaFor(container, label)).filter((tagName)=>!!tagName);
|
|
13139
13142
|
if (tagNames.length) throw getConfig().getElementError(tagNames.map((tagName)=>"Found a label with the text of: " + text + ", however the element associated with this label (<" + tagName + " />) is non-labellable [https://html.spec.whatwg.org/multipage/forms.html#category-label]. If you really need to label a <" + tagName + " />, you can use aria-label or aria-labelledby instead.").join('\n\n'), container);
|
|
13140
|
-
throw getConfig().getElementError("Found a label with the text of: " + text + ", however no form control was found associated to that label. Make sure you're using the \"for\" attribute or \"aria-labelledby\" attribute correctly.", container);
|
|
13141
|
-
}
|
|
13142
|
-
throw getConfig().getElementError("Unable to find a label with the text of: " + text, container);
|
|
13143
|
+
else throw getConfig().getElementError("Found a label with the text of: " + text + ", however no form control was found associated to that label. Make sure you're using the \"for\" attribute or \"aria-labelledby\" attribute correctly.", container);
|
|
13144
|
+
} else throw getConfig().getElementError("Unable to find a label with the text of: " + text, container);
|
|
13143
13145
|
}
|
|
13144
13146
|
return els;
|
|
13145
13147
|
};
|
|
@@ -13211,7 +13213,7 @@ const queryAllByDisplayValue = function(container, value, _temp) {
|
|
|
13211
13213
|
});
|
|
13212
13214
|
return Array.from(container.querySelectorAll("input,textarea,select")).filter((node)=>{
|
|
13213
13215
|
if ('SELECT' !== node.tagName) return matcher(node.value, node, value, matchNormalizer);
|
|
13214
|
-
{
|
|
13216
|
+
else {
|
|
13215
13217
|
const selectedOptions = Array.from(node.options).filter((option)=>option.selected);
|
|
13216
13218
|
return selectedOptions.some((optionNode)=>matcher(getNodeText(optionNode), optionNode, value, matchNormalizer));
|
|
13217
13219
|
}
|
|
@@ -14282,10 +14284,9 @@ function getElement(elemOrNodesRef) {
|
|
|
14282
14284
|
if (elemOrNodesRef instanceof NodesRef) {
|
|
14283
14285
|
const { type, identifier } = elemOrNodesRef._nodeSelectToken;
|
|
14284
14286
|
return 0 === type ? document.querySelector(identifier) : __GetElementByUniqueId(Number(identifier));
|
|
14285
|
-
}
|
|
14286
|
-
if ('
|
|
14287
|
-
|
|
14288
|
-
throw new Error('Invalid element, got: ' + elemOrNodesRef.constructor?.name);
|
|
14287
|
+
} else if ('refAttr' in elemOrNodesRef) return document.querySelector(`[react-ref-${elemOrNodesRef.refAttr[0]}-${elemOrNodesRef.refAttr[1]}]`);
|
|
14288
|
+
else if (elemOrNodesRef?.constructor?.name === 'HTMLUnknownElement') return elemOrNodesRef;
|
|
14289
|
+
else throw new Error('Invalid element, got: ' + elemOrNodesRef.constructor?.name);
|
|
14289
14290
|
}
|
|
14290
14291
|
const fire_event_fireEvent = (elemOrNodesRef, ...args)=>{
|
|
14291
14292
|
const isMainThread = __MAIN_THREAD__;
|
|
@@ -14498,7 +14499,7 @@ function pure_render(ui, { queries, wrapper: WrapperComponent, enableMainThread
|
|
|
14498
14499
|
const { document: document1 } = lynxTestingEnv.env.window;
|
|
14499
14500
|
const container = lynxTestingEnv.mainThread.elementTree.root;
|
|
14500
14501
|
if ('function' == typeof document1.createRange) return document1.createRange().createContextualFragment(container.innerHTML);
|
|
14501
|
-
{
|
|
14502
|
+
else {
|
|
14502
14503
|
const template = document1.createElement('template');
|
|
14503
14504
|
template.innerHTML = container.innerHTML;
|
|
14504
14505
|
return template.content;
|
|
@@ -59,7 +59,7 @@ export interface RenderOptions<Q extends Queries = typeof queries> {
|
|
|
59
59
|
export type RenderResult<Q extends Queries = typeof queries> = {
|
|
60
60
|
container: LynxElement;
|
|
61
61
|
rerender: (ui: ComponentChild) => void;
|
|
62
|
-
unmount: () =>
|
|
62
|
+
unmount: () => void;
|
|
63
63
|
} & { [P in keyof Q]: BoundFunction<Q[P]> };
|
|
64
64
|
|
|
65
65
|
// @public
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "rslib
|
|
8
|
-
"dev": "rslib
|
|
7
|
+
"build": "rslib",
|
|
8
|
+
"dev": "rslib --watch",
|
|
9
9
|
"rstest": "rstest",
|
|
10
10
|
"test": "npm run test:base && npm run test:3.1",
|
|
11
11
|
"test:3.1": "vitest --config vitest.3.1.config.ts",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"@rstest/core": "catalog:rstest",
|
|
24
24
|
"@testing-library/dom": "^10.4.1",
|
|
25
25
|
"@testing-library/jest-dom": "^7.0.0",
|
|
26
|
-
"preact": "catalog:lynxjs"
|
|
26
|
+
"preact": "catalog:lynxjs",
|
|
27
|
+
"pretty-format": "^30.4.1"
|
|
27
28
|
}
|
|
28
29
|
}
|
|
@@ -53,7 +53,7 @@ describe('lynx global API', () => {
|
|
|
53
53
|
const reportErrorCalls = lynxTestingEnv.backgroundThread.lynx.reportError.mock.calls;
|
|
54
54
|
|
|
55
55
|
expect(() => render(<view />)).toThrowErrorMatchingInlineSnapshot(
|
|
56
|
-
`[Error: snapshotPatchApply failed: ctx not found, snapshot type: 'null'. You can set environment variable \`REACT_ALOG=true\` and restart your dev server for troubleshooting.]`,
|
|
56
|
+
`[Error: snapshotPatchApply failed: ctx not found, snapshot type: 'null', parent: { id: 10000000000, snapshot type: 'null', missing: true }, child: { id: 10000000000, snapshot type: 'null', missing: true }, operation: 'InsertBefore', commitId: 2, isHydration: true. You can set environment variable \`REACT_ALOG=true\` and restart your dev server for troubleshooting.]`,
|
|
57
57
|
);
|
|
58
58
|
|
|
59
59
|
const snapshotPatch = JSON.parse(callLepusMethodCalls[0][1]['data']).patchList[0].snapshotPatch;
|