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 - - -