From aa22c27332db6843a1bc9f752a5f5c383b221d66 Mon Sep 17 00:00:00 2001
From: Qingyu Wang <40660121+colinaaa@users.noreply.github.com>
Date: Thu, 5 Jun 2025 21:09:12 +0800
Subject: [PATCH] Revert "feat: Add examples for input and textarea (#79)"
This reverts commit 97fbbfd4a1aa4af922f58947e10a2be643e880d1.
---
README.md | 4 -
examples/input/lynx.config.mjs | 31 ----
examples/input/package.json | 34 -----
examples/input/rspeedy-env.d.ts | 1 -
examples/input/src/auto-height/index.tsx | 138 ------------------
examples/input/src/base/index.tsx | 53 -------
examples/input/tsconfig.json | 21 ---
examples/textarea/lynx.config.mjs | 31 ----
examples/textarea/package.json | 34 -----
examples/textarea/rspeedy-env.d.ts | 1 -
examples/textarea/src/base/index.tsx | 62 --------
.../src/customized-placeholder/index.scss | 10 --
.../src/customized-placeholder/index.tsx | 49 -------
examples/textarea/tsconfig.json | 21 ---
pnpm-lock.yaml | 65 +--------
15 files changed, 7 insertions(+), 548 deletions(-)
delete mode 100644 examples/input/lynx.config.mjs
delete mode 100644 examples/input/package.json
delete mode 100644 examples/input/rspeedy-env.d.ts
delete mode 100644 examples/input/src/auto-height/index.tsx
delete mode 100644 examples/input/src/base/index.tsx
delete mode 100644 examples/input/tsconfig.json
delete mode 100644 examples/textarea/lynx.config.mjs
delete mode 100644 examples/textarea/package.json
delete mode 100644 examples/textarea/rspeedy-env.d.ts
delete mode 100644 examples/textarea/src/base/index.tsx
delete mode 100644 examples/textarea/src/customized-placeholder/index.scss
delete mode 100644 examples/textarea/src/customized-placeholder/index.tsx
delete mode 100644 examples/textarea/tsconfig.json
diff --git a/README.md b/README.md
index 4fa24055..46b6cda0 100644
--- a/README.md
+++ b/README.md
@@ -15,9 +15,6 @@ This repository is intended to showcase examples of Lynx.
- [`scroll-view`]: An example shows how to use scrollable container
- [`text`]: An example shows how to use text and inline-text
- [`view`]: An example shows how to use view
-- XElement
- - [`input`]: An example shows how to use input
- - [`textarea`]: An example shows how to use textarea
- Styling
- [`animation`]: Examples for using animation
- [`css`]: Examples for using different CSS
@@ -47,7 +44,6 @@ This repository is intended to showcase examples of Lynx.
[`scroll-view`]: ./examples/scroll-view
[`text`]: ./examples/text
[`view`]: ./examples/view
-[`input`]: ./examples/input
[`fetch`]: ./examples/fetch
[`basic-usage`]: ./examples/web-platform
[`accessibility`]: ./examples/accessibility
diff --git a/examples/input/lynx.config.mjs b/examples/input/lynx.config.mjs
deleted file mode 100644
index b5c306f7..00000000
--- a/examples/input/lynx.config.mjs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2024 The Lynx Authors. All rights reserved.
-// Licensed under the Apache License Version 2.0 that can be found in the
-// LICENSE file in the root directory of this source tree.
-
-import { pluginQRCode } from "@lynx-js/qrcode-rsbuild-plugin";
-import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
-import { defineConfig } from "@lynx-js/rspeedy";
-import { pluginSass } from "@rsbuild/plugin-sass";
-import { pluginTypeCheck } from "@rsbuild/plugin-type-check";
-
-export default defineConfig({
- source: {
- entry: {
- base: "./src/base/index.tsx",
- autoHeight: "./src/auto-height/index.tsx",
- },
- },
- plugins: [
- pluginReactLynx(),
- pluginSass(),
- pluginQRCode(),
- pluginTypeCheck(),
- ],
- output: {
- assetPrefix: "https://lynxjs.org/lynx-examples/list/dist",
- },
- environments: {
- lynx: {},
- web: {},
- },
-});
diff --git a/examples/input/package.json b/examples/input/package.json
deleted file mode 100644
index 6d94d86a..00000000
--- a/examples/input/package.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "name": "@lynx-example/input",
- "description": "An example shows how to use input in Lynx",
- "type": "module",
- "version": "0.6.0",
- "license": "Apache-2.0",
- "scripts": {
- "build": "rspeedy build",
- "dev": "rspeedy dev",
- "preview": "rspeedy preview"
- },
- "dependencies": {
- "@lynx-js/react": "catalog:"
- },
- "files": [
- "dist/",
- "src/",
- "lynx.config.mjs"
- ],
- "repository": {
- "type": "git",
- "url": "git+https://github.com/lynx-family/lynx-examples.git",
- "directory": "examples/input"
- },
- "devDependencies": {
- "@lynx-js/qrcode-rsbuild-plugin": "catalog:",
- "@lynx-js/react-rsbuild-plugin": "catalog:",
- "@lynx-js/rspeedy": "catalog:",
- "@lynx-js/types": "^3.2.0",
- "@rsbuild/plugin-sass": "^1.2.1",
- "@types/react": "^18.3.18",
- "typescript": "~5.7.3"
- }
-}
diff --git a/examples/input/rspeedy-env.d.ts b/examples/input/rspeedy-env.d.ts
deleted file mode 100644
index 1c813a68..00000000
--- a/examples/input/rspeedy-env.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-///
diff --git a/examples/input/src/auto-height/index.tsx b/examples/input/src/auto-height/index.tsx
deleted file mode 100644
index 0330547d..00000000
--- a/examples/input/src/auto-height/index.tsx
+++ /dev/null
@@ -1,138 +0,0 @@
-// Copyright 2024 The Lynx Authors. All rights reserved.
-// Licensed under the Apache License Version 2.0 that can be found in the
-// LICENSE file in the root directory of this source tree.
-
-import { root, useLynxGlobalEventListener, useState } from "@lynx-js/react";
-
-const App = () => {
- const [inputContent, setInputContent] = useState("");
-
- const setNativeProps = (itemId: string, props: Record) => {
- lynx
- .createSelectorQuery()
- .select(`#${itemId}`)
- .setNativeProps(props)
- .exec();
- };
-
- const getItemRect = (
- itemId: string,
- success: (
- left: number,
- top: number,
- right: number,
- bottom: number,
- width: number,
- height: number,
- ) => void,
- fail?: (res: any) => void,
- ) => {
- const nodeRef = itemId === "root"
- ? lynx.createSelectorQuery().selectRoot()
- : lynx.createSelectorQuery().select(`#${itemId}`);
-
- nodeRef
- .invoke({
- method: "boundingClientRect",
- params: {
- relativeTo: "screen",
- },
- success: res => {
- success(
- /* eslint-disable @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access*/
- res.left,
- res.top,
- res.right,
- res.bottom,
- res.width,
- res.height,
- /* eslint-enable. no-safe-argument */
- );
- },
- fail: res => {
- fail?.(res);
- },
- })
- .exec();
- };
-
- const keyboardChanged = (keyboardHeightInPx: number) => {
- if (keyboardHeightInPx === 0) {
- setNativeProps("panel", {
- transform: `translateY(${0}px)`,
- transition: "transform 0.1s",
- });
- } else {
- setNativeProps("panel", {
- transform: `translateY(${-keyboardHeightInPx}px)`,
- transition: "transform 0.3s",
- });
- }
- };
-
- useLynxGlobalEventListener(
- "keyboardstatuschanged",
- (status: unknown, keyboardHeight: unknown) => {
- console.log(status);
- console.log(keyboardHeight);
- // @ts-ignore
- keyboardChanged(status === "on" ? keyboardHeight : 0);
- },
- );
-
- return (
-
-
- {Array.from({ length: 50 }).map((item, index) => {
- return (
-
- {`item-${index}${inputContent ? `-${inputContent}` : ""}`}
-
- );
- })}
-
-
- {
- // @ts-ignore
-
-
- {
- console.log(res.detail.value);
- setInputContent(res.detail.value);
- }}
- />
-
- }
-
-
- );
-};
-
-root.render();
-
-if (import.meta.webpackHot) {
- import.meta.webpackHot.accept();
-}
diff --git a/examples/input/src/base/index.tsx b/examples/input/src/base/index.tsx
deleted file mode 100644
index e024164d..00000000
--- a/examples/input/src/base/index.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2024 The Lynx Authors. All rights reserved.
-// Licensed under the Apache License Version 2.0 that can be found in the
-// LICENSE file in the root directory of this source tree.
-
-import { root, useState } from "@lynx-js/react";
-
-const App = () => {
- const [inputContent, setInputContent] = useState("");
-
- return (
-
-
- {
- // @ts-ignore
-
-
- {
- console.log(res.detail.value);
- setInputContent(res.detail.value);
- }}
- />
-
- }
-
-
- {Array.from({ length: 50 }).map((item, index) => {
- return (
-
- {`item-${index}${inputContent ? `-${inputContent}` : ""}`}
-
- );
- })}
-
-
- );
-};
-
-root.render();
-
-if (import.meta.webpackHot) {
- import.meta.webpackHot.accept();
-}
diff --git a/examples/input/tsconfig.json b/examples/input/tsconfig.json
deleted file mode 100644
index 785e7e5c..00000000
--- a/examples/input/tsconfig.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "compilerOptions": {
- "jsx": "preserve",
- "jsxImportSource": "@lynx-js/react",
-
- "module": "node16",
- "moduleResolution": "node16",
-
- "strict": true,
- "isolatedModules": true,
- "verbatimModuleSyntax": true,
-
- "esModuleInterop": true,
- "skipLibCheck": true,
-
- "paths": {
- "@assets/*": ["./assets/*"],
- },
- },
- "exclude": ["dist/"],
-}
diff --git a/examples/textarea/lynx.config.mjs b/examples/textarea/lynx.config.mjs
deleted file mode 100644
index 16e84f0c..00000000
--- a/examples/textarea/lynx.config.mjs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2024 The Lynx Authors. All rights reserved.
-// Licensed under the Apache License Version 2.0 that can be found in the
-// LICENSE file in the root directory of this source tree.
-
-import { pluginQRCode } from "@lynx-js/qrcode-rsbuild-plugin";
-import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
-import { defineConfig } from "@lynx-js/rspeedy";
-import { pluginSass } from "@rsbuild/plugin-sass";
-import { pluginTypeCheck } from "@rsbuild/plugin-type-check";
-
-export default defineConfig({
- source: {
- entry: {
- base: "./src/base/index.tsx",
- customizedPlaceholder: "./src/customized-placeholder/index.tsx",
- },
- },
- plugins: [
- pluginReactLynx(),
- pluginSass(),
- pluginQRCode(),
- pluginTypeCheck(),
- ],
- output: {
- assetPrefix: "https://lynxjs.org/lynx-examples/list/dist",
- },
- environments: {
- lynx: {},
- web: {},
- },
-});
diff --git a/examples/textarea/package.json b/examples/textarea/package.json
deleted file mode 100644
index df26d568..00000000
--- a/examples/textarea/package.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "name": "@lynx-example/textarea",
- "description": "An example shows how to use textarea in Lynx",
- "type": "module",
- "version": "0.6.0",
- "license": "Apache-2.0",
- "scripts": {
- "build": "rspeedy build",
- "dev": "rspeedy dev",
- "preview": "rspeedy preview"
- },
- "dependencies": {
- "@lynx-js/react": "catalog:"
- },
- "files": [
- "dist/",
- "src/",
- "lynx.config.mjs"
- ],
- "repository": {
- "type": "git",
- "url": "git+https://github.com/lynx-family/lynx-examples.git",
- "directory": "examples/textarea"
- },
- "devDependencies": {
- "@lynx-js/qrcode-rsbuild-plugin": "catalog:",
- "@lynx-js/react-rsbuild-plugin": "catalog:",
- "@lynx-js/rspeedy": "catalog:",
- "@lynx-js/types": "^3.2.0",
- "@rsbuild/plugin-sass": "^1.2.1",
- "@types/react": "^18.3.18",
- "typescript": "~5.7.3"
- }
-}
diff --git a/examples/textarea/rspeedy-env.d.ts b/examples/textarea/rspeedy-env.d.ts
deleted file mode 100644
index 1c813a68..00000000
--- a/examples/textarea/rspeedy-env.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-///
diff --git a/examples/textarea/src/base/index.tsx b/examples/textarea/src/base/index.tsx
deleted file mode 100644
index 841f3396..00000000
--- a/examples/textarea/src/base/index.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2024 The Lynx Authors. All rights reserved.
-// Licensed under the Apache License Version 2.0 that can be found in the
-// LICENSE file in the root directory of this source tree.
-
-import { root, useState } from "@lynx-js/react";
-
-const App = () => {
- const [inputContent, setInputContent] = useState("");
-
- return (
-
-
- {
- // @ts-ignore
-
-
-
-
-
- {
- // @ts-ignore
-
-
-
-
- );
-};
-
-root.render();
-
-if (import.meta.webpackHot) {
- import.meta.webpackHot.accept();
-}
diff --git a/examples/textarea/src/customized-placeholder/index.scss b/examples/textarea/src/customized-placeholder/index.scss
deleted file mode 100644
index 54e97707..00000000
--- a/examples/textarea/src/customized-placeholder/index.scss
+++ /dev/null
@@ -1,10 +0,0 @@
-.textarea {
- color: purple;
- font-size: 20px;
- min-height: 100px;
- caret-color: greenyellow;
-}
-
-.textarea::placeholder {
- color: orange;
-}
diff --git a/examples/textarea/src/customized-placeholder/index.tsx b/examples/textarea/src/customized-placeholder/index.tsx
deleted file mode 100644
index 0bfe1e5f..00000000
--- a/examples/textarea/src/customized-placeholder/index.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2024 The Lynx Authors. All rights reserved.
-// Licensed under the Apache License Version 2.0 that can be found in the
-// LICENSE file in the root directory of this source tree.
-
-import { root, useState } from "@lynx-js/react";
-import "./index.scss";
-
-const App = () => {
- const [inputContent, setInputContent] = useState("");
-
- return (
-
- Customized Placeholder And Caret Color
-
- {
- // @ts-ignore
-
-
-
-
- );
-};
-
-root.render();
-
-if (import.meta.webpackHot) {
- import.meta.webpackHot.accept();
-}
diff --git a/examples/textarea/tsconfig.json b/examples/textarea/tsconfig.json
deleted file mode 100644
index 785e7e5c..00000000
--- a/examples/textarea/tsconfig.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "compilerOptions": {
- "jsx": "preserve",
- "jsxImportSource": "@lynx-js/react",
-
- "module": "node16",
- "moduleResolution": "node16",
-
- "strict": true,
- "isolatedModules": true,
- "verbatimModuleSyntax": true,
-
- "esModuleInterop": true,
- "skipLibCheck": true,
-
- "paths": {
- "@assets/*": ["./assets/*"],
- },
- },
- "exclude": ["dist/"],
-}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index f6fe86e3..193e1157 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -441,34 +441,6 @@ importers:
specifier: ~5.7.3
version: 5.7.3
- examples/input:
- dependencies:
- '@lynx-js/react':
- specifier: 'catalog:'
- version: 0.109.0(@lynx-js/types@3.3.0)(@types/react@18.3.18)
- devDependencies:
- '@lynx-js/qrcode-rsbuild-plugin':
- specifier: 'catalog:'
- version: 0.3.6
- '@lynx-js/react-rsbuild-plugin':
- specifier: 'catalog:'
- version: 0.10.1(@lynx-js/react@0.109.0(@lynx-js/types@3.3.0)(@types/react@18.3.18))(webpack@5.98.0)
- '@lynx-js/rspeedy':
- specifier: 'catalog:'
- version: 0.9.7(@rspack/core@1.3.11(@swc/helpers@0.5.17))(typescript@5.7.3)(webpack@5.98.0)
- '@lynx-js/types':
- specifier: ^3.2.0
- version: 3.3.0
- '@rsbuild/plugin-sass':
- specifier: ^1.2.1
- version: 1.2.2(@rsbuild/core@1.3.21)
- '@types/react':
- specifier: ^18.3.18
- version: 18.3.18
- typescript:
- specifier: ~5.7.3
- version: 5.7.3
-
examples/layout:
dependencies:
'@lynx-js/react':
@@ -864,34 +836,6 @@ importers:
specifier: ~5.7.3
version: 5.7.3
- examples/textarea:
- dependencies:
- '@lynx-js/react':
- specifier: 'catalog:'
- version: 0.109.0(@lynx-js/types@3.3.0)(@types/react@18.3.18)
- devDependencies:
- '@lynx-js/qrcode-rsbuild-plugin':
- specifier: 'catalog:'
- version: 0.3.6
- '@lynx-js/react-rsbuild-plugin':
- specifier: 'catalog:'
- version: 0.10.1(@lynx-js/react@0.109.0(@lynx-js/types@3.3.0)(@types/react@18.3.18))(webpack@5.98.0)
- '@lynx-js/rspeedy':
- specifier: 'catalog:'
- version: 0.9.7(@rspack/core@1.3.11(@swc/helpers@0.5.17))(typescript@5.7.3)(webpack@5.98.0)
- '@lynx-js/types':
- specifier: ^3.2.0
- version: 3.3.0
- '@rsbuild/plugin-sass':
- specifier: ^1.2.1
- version: 1.2.2(@rsbuild/core@1.3.21)
- '@types/react':
- specifier: ^18.3.18
- version: 18.3.18
- typescript:
- specifier: ~5.7.3
- version: 5.7.3
-
examples/todo-list:
dependencies:
'@lynx-js/react':
@@ -2287,6 +2231,9 @@ packages:
caniuse-lite@1.0.30001702:
resolution: {integrity: sha512-LoPe/D7zioC0REI5W73PeR1e1MLCipRGq/VkovJnd6Df+QVqT+vT33OXCp8QUd7kA7RZrHWxb1B36OQKI/0gOA==}
+ caniuse-lite@1.0.30001715:
+ resolution: {integrity: sha512-7ptkFGMm2OAOgvZpwgA4yjQ5SQbrNVGdRjzH0pBdy1Fasvcr+KAeECmbCAECzTuDuoX0FCY8KzUxjf9+9kfZEw==}
+
caniuse-lite@1.0.30001718:
resolution: {integrity: sha512-AflseV1ahcSunK53NfEs9gFWgOEmzr0f+kaMFA4xiLZlr9Hzt7HxcSpIFcnNCUkz6R6dWKa54rUz3HUmI3nVcw==}
@@ -6271,7 +6218,7 @@ snapshots:
browserslist@4.24.4:
dependencies:
- caniuse-lite: 1.0.30001718
+ caniuse-lite: 1.0.30001715
electron-to-chromium: 1.5.111
node-releases: 2.0.19
update-browserslist-db: 1.1.3(browserslist@4.24.4)
@@ -6308,12 +6255,14 @@ snapshots:
caniuse-api@3.0.0:
dependencies:
browserslist: 4.24.4
- caniuse-lite: 1.0.30001718
+ caniuse-lite: 1.0.30001715
lodash.memoize: 4.1.2
lodash.uniq: 4.5.0
caniuse-lite@1.0.30001702: {}
+ caniuse-lite@1.0.30001715: {}
+
caniuse-lite@1.0.30001718: {}
chalk@4.1.2: