Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,783 changes: 1,741 additions & 42 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions rslib/reactlynx-basic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Rslib + ReactLynx

## Setup

Install the dependencies:

```bash
pnpm install
```

## Get started

Build the library:

```bash
pnpm build
```

Build the library in watch mode:

```bash
pnpm dev
```
32 changes: 32 additions & 0 deletions rslib/reactlynx-basic/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@rslib-example/reactlynx-basic",
"version": "0.0.0",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.jsx"
}
},
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "rslib",
"dev": "rslib --watch"
},
"devDependencies": {
"@lynx-js/react": "^0.126.0",
"@lynx-js/types": "^4.2.1",
"@rsbuild/plugin-react": "^2.1.0",
"@rslib/core": "^1.0.0",
"@types/react": "^19.2.18",
"typescript": "^6.0.3"
},
"peerDependencies": {
"@lynx-js/react": ">=0.100.0",
"@lynx-js/types": ">=4",
"@types/react": ">=19"
}
}
20 changes: 20 additions & 0 deletions rslib/reactlynx-basic/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { pluginReact } from '@rsbuild/plugin-react';
import { defineConfig } from '@rslib/core';

export default defineConfig({
bundle: false,
dts: true,
output: {
target: 'web',
filename: {
js: '[name].jsx',
},
},
plugins: [
pluginReact({
swcReactOptions: {
runtime: 'preserve',
},
}),
],
});
13 changes: 13 additions & 0 deletions rslib/reactlynx-basic/src/ScrollList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { JSX } from '@lynx-js/react';

export function ScrollList(): JSX.Element {
return (
<scroll-view scroll-orientation="horizontal" style={{ width: '240px', height: '80px' }}>
{['red', 'green', 'blue'].map((color) => (
<view key={color} style={{ width: '120px', height: '80px', backgroundColor: color }}>
<text style={{ color: 'white' }}>{color}</text>
</view>
))}
</scroll-view>
);
}
1 change: 1 addition & 0 deletions rslib/reactlynx-basic/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ScrollList } from './ScrollList';
25 changes: 25 additions & 0 deletions rslib/reactlynx-basic/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"lib": ["DOM", "ES2022"],
"jsx": "preserve",
"jsxImportSource": "@lynx-js/react",
"target": "ES2022",
"noEmit": true,
"skipLibCheck": true,
"types": ["@lynx-js/types", "@rslib/core/types"],
"useDefineForClassFields": true,
"rootDir": "src",

/* modules */
"isolatedModules": true,
"moduleDetection": "force",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"allowImportingTsExtensions": true,

/* type checking */
"noUnusedLocals": true,
"noUnusedParameters": true
},
"include": ["src"]
}
29 changes: 29 additions & 0 deletions rslib/reactlynx-rstest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Rslib + ReactLynx

## Setup

Install the dependencies:

```bash
pnpm install
```

## Get started

Build the library:

```bash
pnpm build
```

Build the library in watch mode:

```bash
pnpm dev
```

Run the tests:

```bash
pnpm test
```
39 changes: 39 additions & 0 deletions rslib/reactlynx-rstest/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "@rslib-example/reactlynx-rstest",
"version": "0.0.0",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.jsx"
}
},
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "rslib",
"dev": "rslib --watch",
"test": "rstest",
"test:watch": "rstest --watch"
},
"devDependencies": {
"@lynx-js/react": "^0.126.0",
"@lynx-js/react-rsbuild-plugin": "^0.20.1",
"@lynx-js/types": "^4.2.1",
"@rsbuild/plugin-react": "^2.1.0",
"@rslib/core": "^1.0.0",
"@rstest/adapter-rslib": "^0.11.12",
"@rstest/core": "^0.11.12",
"@types/node": "^24.13.3",
"@types/react": "^19.2.18",
"happy-dom": "^20.14.0",
"typescript": "^6.0.3"
},
"peerDependencies": {
"@lynx-js/react": ">=0.100.0",
"@lynx-js/types": ">=4",
"@types/react": ">=19"
}
}
20 changes: 20 additions & 0 deletions rslib/reactlynx-rstest/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { pluginReact } from '@rsbuild/plugin-react';
import { defineConfig } from '@rslib/core';

export default defineConfig({
bundle: false,
dts: true,
output: {
target: 'web',
filename: {
js: '[name].jsx',
},
},
plugins: [
pluginReact({
swcReactOptions: {
runtime: 'preserve',
},
}),
],
});
9 changes: 9 additions & 0 deletions rslib/reactlynx-rstest/rstest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin';
import { withDefaultConfig } from '@lynx-js/react/testing-library/rstest-config';
import { withRslibConfig } from '@rstest/adapter-rslib';
import { defineConfig } from '@rstest/core';

export default defineConfig({
extends: [withDefaultConfig(), withRslibConfig()],
plugins: [pluginReactLynx()],
});
13 changes: 13 additions & 0 deletions rslib/reactlynx-rstest/src/ScrollList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { JSX } from '@lynx-js/react';

export function ScrollList(): JSX.Element {
return (
<scroll-view scroll-orientation="horizontal" style={{ width: '240px', height: '80px' }}>
{['red', 'green', 'blue'].map((color) => (
<view key={color} style={{ width: '120px', height: '80px', backgroundColor: color }}>
<text style={{ color: 'white' }}>{color}</text>
</view>
))}
</scroll-view>
);
}
1 change: 1 addition & 0 deletions rslib/reactlynx-rstest/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ScrollList } from './ScrollList';
12 changes: 12 additions & 0 deletions rslib/reactlynx-rstest/tests/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { render, screen } from '@lynx-js/react/testing-library';
import { expect, test } from '@rstest/core';
import { ScrollList } from '../src/ScrollList';

test('renders the color items', () => {
render(<ScrollList />);

for (const color of ['red', 'green', 'blue']) {
const item = screen.getByText(color).parentElement;
expect(item?.style.backgroundColor).toBe(color);
}
});
8 changes: 8 additions & 0 deletions rslib/reactlynx-rstest/tests/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"rootDir": "..",
"types": ["@lynx-js/types", "@rslib/core/types", "node"]
},
"include": ["./"]
}
25 changes: 25 additions & 0 deletions rslib/reactlynx-rstest/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"lib": ["DOM", "ES2022"],
"jsx": "preserve",
"jsxImportSource": "@lynx-js/react",
"target": "ES2022",
"noEmit": true,
"skipLibCheck": true,
"types": ["@lynx-js/types", "@rslib/core/types"],
"useDefineForClassFields": true,
"rootDir": "src",

/* modules */
"isolatedModules": true,
"moduleDetection": "force",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"allowImportingTsExtensions": true,

/* type checking */
"noUnusedLocals": true,
"noUnusedParameters": true
},
"include": ["src"]
}
Loading