Skip to content

Conversation

@PupilTong
Copy link
Collaborator

@PupilTong PupilTong commented Apr 27, 2025

  • add touch event support for offscreen-dom
  • add touch properties support for bts and mts event handlers
  • add SystemInfo.screenWidth and SystemInfo.screenHeight

close #54

* add touch event support for offscreen-dom
* add touch properties support for bts and mts event handlers
* add SystemInfo.screenWidth and SystemInfo.screenHeight
@PupilTong PupilTong requested review from colinaaa and Copilot April 27, 2025 13:13
@changeset-bot
Copy link

changeset-bot bot commented Apr 27, 2025

🦋 Changeset detected

Latest commit: b33b1e2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@lynx-js/offscreen-document Patch
@lynx-js/web-mainthread-apis Patch
@lynx-js/web-worker-runtime Patch
@lynx-js/web-constants Patch
@lynx-js/web-core Patch
@lynx-js/web-worker-rpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces touch event support for MTS by extending event handler capabilities, updating system configuration with screen dimensions, and enhancing related tests.

  • Merges touch properties into SystemInfo and browserConfig.
  • Adds tests for touch events and screen dimensions across multiple modules.
  • Updates type definitions and cloning utilities to accommodate new touch event properties.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/web-platform/web-worker-runtime/src/backgroundThread/background-apis/createNativeApp.ts Merges browserConfig into SystemInfo.
packages/web-platform/web-tests/tests/react/basic-mts-bindtouchstart/index.jsx Adds test for binding touchstart events.
packages/web-platform/web-tests/tests/react/api-SystemInfo-height-width/index.jsx Adds test for SystemInfo.pixelHeight/pixelWidth screen info.
packages/web-platform/web-tests/tests/react.spec.ts Adds tests for touch events and screen info, with a minor typo in test.skip.
packages/web-platform/web-mainthread-apis/src/utils/createCrossThreadEvent.ts Enhances cloning logic for touch event properties.
packages/web-platform/web-mainthread-apis/src/MainThreadRuntime.ts Updates SystemInfo merging by spreading config.browserConfig.
packages/web-platform/web-core/src/apis/createLynxView.ts Introduces screen dimension calculations for browserConfig.
packages/web-platform/web-constants/src/types/PageConfig.ts and Cloneable.ts Updates type definitions to support new screen dimension data and boolean values.
packages/web-platform/offscreen-document/src/main/initOffscreenDocument.ts Modifies cloning of additional touch event properties using transferToCloneable.
.cspell/lynx.txt and .changeset/* Updates documentation and change logs for touch event support.

@codecov
Copy link

codecov bot commented Apr 27, 2025

Bundle Report

Changes will increase total bundle size by 881 bytes (0.14%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
@lynx-js/web-explorer-web-array-push 325.12kB 881 bytes (0.27%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: @lynx-js/web-explorer-web-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/js/index.js 525 bytes 155.15kB 0.34%
static/js/async/61.js -19 bytes 57.8kB -0.03%
static/js/async/346.js 375 bytes 30.08kB 1.26%

@codspeed-hq
Copy link

codspeed-hq bot commented Apr 27, 2025

CodSpeed Performance Report

Merging #641 will not alter performance

Comparing PupilTong:p/hw/mts-touch (b33b1e2) with main (2698532)

Summary

✅ 1 untouched benchmarks

@codecov
Copy link

codecov bot commented Apr 27, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
2219 1 2218 66
View the top 2 failed test(s) by shortest run time
react.spec.ts reactlynx3 testselementslistbasic-element-list-basic
Stack Traces | 14.3s run time
react.spec.ts:3382:7 basic-element-list-basic
web-core.test.ts web core testscreateJSObjectDestructionObserver
Stack Traces | 150s run time
web-core.test.ts:204:3 createJSObjectDestructionObserver

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@PupilTong PupilTong added this pull request to the merge queue Apr 28, 2025
Merged via the queue into lynx-family:main with commit c9ccad6 Apr 28, 2025
28 of 29 checks passed
@PupilTong PupilTong deleted the p/hw/mts-touch branch April 28, 2025 04:10
colinaaa pushed a commit that referenced this pull request May 9, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @lynx-js/[email protected]

### Minor Changes

- Reverts #239: "batch multiple patches for main thread communication"
([#649](#649))

This reverts the change that batched updates sent to the main thread in
a single render pass.

### Patch Changes

- Add support for batch rendering in `<list>` with async resolution of
sub-tree properties and element trees.
([#624](#624))

    Use the `experimental-batch-render-strategy` attribute of `<list>`:

    ```tsx
    <list
      /**
       * Batch render strategy:
       * 0: (Default) Disabled - No batch rendering
       * 1: Basic - Only batch rendering enabled
* 2: Property Resolution - Batch render with async property resolution
for list item subtree
* 3: Full Resolution - Batch render with async property and element tree
resolution for list item subtree
       */
      experimental-batch-render-strategy={3}
    ></list>
    ```

- rename @lynx-js/test-environment to @lynx-js/testing-environment
([#704](#704))

- Auto import `@lynx-js/react/experimental/lazy/import` when using
`import(url)`
([#667](#667))

- Auto import `@lynx-js/react/experimental/lazy/import` when using
`<component is={url} />`
([#666](#666))

- Fixed a race condition when updating states and GlobalProps
simultaneously.
([#707](#707))

This fix prevents the "Attempt to render more than one `<page />`" error
from occurring during normal application usage.

- Fix error like `Unterminated string constant` when using multi-line
JSX StringLiteral.
([#654](#654))

## @lynx-js/[email protected]

### Minor Changes

- Switch to ESM package format by setting `"type": "module"`.
([#703](#703))

### Patch Changes

- rename @lynx-js/test-environment to @lynx-js/testing-environment
([#704](#704))

## @lynx-js/[email protected]

### Minor Changes

- feat: add new parameter `nativeModulesPath` to
`pluginWebPlatform({})`.
([#668](#668))

After this commit, you can use `nativeModulesPath` to package custom
nativeModules directly into the worker, and no longer need to pass
`nativeModulesMap` to lynx-view.

    Here is an example:

    -   `native-modules.ts`:

    ```ts
    // index.native-modules.ts
    export default {
      CustomModule: function (NativeModules, NativeModulesCall) {
        return {
          async getColor(data, callback) {
            const color = await NativeModulesCall("getColor", data);
            callback(color);
          },
        };
      },
    };
    ```

    -   plugin config:

    ```ts
    // rsbuild.config.ts
import { pluginWebPlatform } from
"@lynx-js/web-platform-rsbuild-plugin";
    import { defineConfig } from "@rsbuild/core";

    export default defineConfig({
      plugins: [
        pluginWebPlatform({
          // replace with your actual native-modules file path
nativeModulesPath: path.resolve(__dirname, "./index.native-modules.ts"),
        }),
      ],
    });
    ```

- feat: Provides Rsbuild plugin for Web projects in Lynx Web Platform,
currently supports polyfill about lynx.
([#606](#606))

## @lynx-js/[email protected]

### Patch Changes

- Bump Rsbuild v1.3.17 with Rspack v1.3.9.
([#708](#708))

- Support `performance.profile`.
([#691](#691))

- Support CLI flag `--mode` to specify the build mode.
([#723](#723))

- Enable native Rsdoctor plugin by default.
([#688](#688))

Set `tools.rsdoctor.experiments.enableNativePlugin` to `false` to use
the old JS plugin.

    ```js
    import { defineConfig } from "@lynx-js/rspeedy";

    export default defineConfig({
      tools: {
        rsdoctor: {
          experiments: {
            enableNativePlugin: false,
          },
        },
      },
    });
    ```

See [Rsdoctor -
1.0](https://rsdoctor.dev/blog/release/release-note-1_0#-faster-analysis)
for more details.

- Bump Rsbuild v1.3.14 with Rspack v1.3.8.
([#630](#630))

## @lynx-js/[email protected]

### Patch Changes

- Fix runtime error: "SyntaxError: Identifier 'i' has already been
declared". ([#651](#651))

- Enable runtime profiling when `performance.profile` is set to true.
([#722](#722))

- fix: resolve page crash on development mode when enabling
`experimental_isLazyBundle: true`
([#653](#653))

- Support `@lynx-js/react` v0.108.0.
([#649](#649))

- Updated dependencies
\[[`ea4da1a`](ea4da1a),
[`ca15dda`](ca15dda),
[`f8d369d`](f8d369d),
[`ea4da1a`](ea4da1a)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- Support `hidden`, `no-underline` and `line-through` utilities.
([#745](#745))

## @lynx-js/[email protected]

### Patch Changes

- feat: support touch events
([#641](#641))

## @lynx-js/[email protected]

### Patch Changes

- feat: support touch events for MTS
([#641](#641))

    now we support

    -   main-thread:bindtouchstart
    -   main-thread:bindtouchend
    -   main-thread:bindtouchmove
    -   main-thread:bindtouchcancel

-   Updated dependencies \[]:
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- fix: some inline style properties cause crash
([#647](#647))

    add support for the following css properties

    -   mask
    -   mask-repeat
    -   mask-position
    -   mask-clip
    -   mask-origin
    -   mask-size
    -   gap
    -   column-gap
    -   row-gap
    -   image-rendering
    -   hyphens
    -   offset-path
    -   offset-distance

- feat: support touch events for MTS
([#641](#641))

    now we support

    -   main-thread:bindtouchstart
    -   main-thread:bindtouchend
    -   main-thread:bindtouchmove
    -   main-thread:bindtouchcancel

- feat: add SystemInfo.screenWidth and SystemInfo.screenHeight
([#641](#641))

- Updated dependencies
\[[`c9ccad6`](c9ccad6),
[`9ad394e`](9ad394e),
[`f4cfb70`](f4cfb70),
[`c9ccad6`](c9ccad6),
[`839d61c`](839d61c)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- fix(web): x-swiper-item threshold updated to 20
([#639](#639))

- fix: In React19, setter and getter functions are treated as
properties, making it impossible to retrieve the current value via
attributes. ([#639](#639))

## @lynx-js/[email protected]

### Patch Changes

- feat: use nativeModulesPath instead of nativeModulesMap to lynx-view.
([#668](#668))

- fix: fork @vant/touch-emulator and make it work with shadowroot
([#662](#662))

- fix: loading errors caused by script import order
([#665](#665))

- chore: update homepage
([#645](#645))

## @lynx-js/[email protected]

### Patch Changes

- fix: some inline style properties cause crash
([#647](#647))

    add support for the following css properties

    -   mask
    -   mask-repeat
    -   mask-position
    -   mask-clip
    -   mask-origin
    -   mask-size
    -   gap
    -   column-gap
    -   row-gap
    -   image-rendering
    -   hyphens
    -   offset-path
    -   offset-distance

- feat: support touch events for MTS
([#641](#641))

    now we support

    -   main-thread:bindtouchstart
    -   main-thread:bindtouchend
    -   main-thread:bindtouchmove
    -   main-thread:bindtouchcancel

- Updated dependencies
\[[`c9ccad6`](c9ccad6)]:
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- feat: support for using `lynx.queueMicrotask`.
([#702](#702))

- feat: support touch events for MTS
([#641](#641))

    now we support

    -   main-thread:bindtouchstart
    -   main-thread:bindtouchend
    -   main-thread:bindtouchmove
    -   main-thread:bindtouchcancel

- feat: provide comments for `@lynx-js/web-platform-rsbuild-plugin`.
([#668](#668))

- Updated dependencies
\[[`c9ccad6`](c9ccad6),
[`9ad394e`](9ad394e),
[`c9ccad6`](c9ccad6)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- feat: add `experimental_isLazyBundle` option, it will disable snapshot
HMR for standalone lazy bundle
([#653](#653))

- Add the `profile` option to control whether `__PROFILE__` is enabled.
([#722](#722))

- Support `@lynx-js/react` v0.108.0.
([#649](#649))

## @lynx-js/[email protected]

### Patch Changes

- feat: add `experimental_isLazyBundle` option, it will disable
lynxChunkEntries for standalone lazy bundle
([#653](#653))

## [email protected]



## @lynx-js/[email protected]



## [email protected]



## @lynx-js/[email protected]

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Support MTS

2 participants