rc-slider-captcha
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -80,3 +80,2 @@ 'use strict'; | ||
var _a; | ||
// className 前缀 | ||
@@ -114,9 +113,11 @@ var prefixCls = 'rc-slider-captcha'; | ||
// 当前运行环境是否可以使用 dom | ||
var isBrowser = typeof window !== 'undefined' && | ||
typeof document !== 'undefined' && | ||
(window === null || window === void 0 ? void 0 : window.document) && | ||
((_a = window.document) === null || _a === void 0 ? void 0 : _a.addEventListener); | ||
var isBrowser = typeof window === 'object' && | ||
window && | ||
typeof document === 'object' && | ||
document && | ||
window.document === document && | ||
!!document.addEventListener; | ||
// 是否支持Touch事件 | ||
// 区分移动端和PC端的事件绑定,移动端也会触发 mouseup mousedown 事件 | ||
var isSupportTouch = typeof window === 'object' && 'ontouchstart' in window; | ||
var isSupportTouch = isBrowser && 'ontouchstart' in window; | ||
// 触发重绘 | ||
@@ -123,0 +124,0 @@ var reflow = function (node) { return node === null || node === void 0 ? void 0 : node.scrollTop; }; |
@@ -76,3 +76,2 @@ import { __assign, __rest, __awaiter, __generator } from 'tslib'; | ||
var _a; | ||
// className 前缀 | ||
@@ -110,9 +109,11 @@ var prefixCls = 'rc-slider-captcha'; | ||
// 当前运行环境是否可以使用 dom | ||
var isBrowser = typeof window !== 'undefined' && | ||
typeof document !== 'undefined' && | ||
(window === null || window === void 0 ? void 0 : window.document) && | ||
((_a = window.document) === null || _a === void 0 ? void 0 : _a.addEventListener); | ||
var isBrowser = typeof window === 'object' && | ||
window && | ||
typeof document === 'object' && | ||
document && | ||
window.document === document && | ||
!!document.addEventListener; | ||
// 是否支持Touch事件 | ||
// 区分移动端和PC端的事件绑定,移动端也会触发 mouseup mousedown 事件 | ||
var isSupportTouch = typeof window === 'object' && 'ontouchstart' in window; | ||
var isSupportTouch = isBrowser && 'ontouchstart' in window; | ||
// 触发重绘 | ||
@@ -119,0 +120,0 @@ var reflow = function (node) { return node === null || node === void 0 ? void 0 : node.scrollTop; }; |
{ | ||
"name": "rc-slider-captcha", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "React slider captcha component.", | ||
@@ -31,3 +31,4 @@ "keywords": [ | ||
"commit": "cz", | ||
"tsc": "tsc --noEmit" | ||
"tsc": "tsc --noEmit", | ||
"prepare": "husky install" | ||
}, | ||
@@ -39,6 +40,2 @@ "config": { | ||
}, | ||
"gitHooks": { | ||
"pre-commit": "lint-staged", | ||
"commit-msg": "npx --no -- commitlint --edit \"$1\"" | ||
}, | ||
"lint-staged": { | ||
@@ -61,10 +58,10 @@ "**/*.{css,less}": "stylelint --fix", | ||
"classnames": "^2.3.2", | ||
"rc-hooks": "^3.0.2", | ||
"tslib": "^2.6.0" | ||
"rc-hooks": "^3.0.5", | ||
"tslib": "^2.6.2" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "~7.22.10", | ||
"@babel/preset-env": "~7.22.10", | ||
"@babel/preset-react": "~7.22.5", | ||
"@babel/preset-typescript": "~7.22.5", | ||
"@babel/core": "~7.22.20", | ||
"@babel/preset-env": "~7.22.20", | ||
"@babel/preset-react": "~7.22.15", | ||
"@babel/preset-typescript": "~7.22.15", | ||
"@commitlint/cli": "^17.7.1", | ||
@@ -74,28 +71,28 @@ "@commitlint/config-conventional": "^17.7.0", | ||
"@rollup/plugin-node-resolve": "^15.2.1", | ||
"@rollup/plugin-typescript": "^11.1.2", | ||
"@testing-library/jest-dom": "^5.17.0", | ||
"@rollup/plugin-typescript": "^11.1.3", | ||
"@testing-library/jest-dom": "^6.1.3", | ||
"@testing-library/react": "^14.0.0", | ||
"@types/jest": "^29.5.4", | ||
"@types/react": "^18.2.21", | ||
"@types/jest": "^29.5.5", | ||
"@types/react": "^18.2.22", | ||
"@types/react-dom": "^18.2.7", | ||
"@types/react-test-renderer": "^18.0.0", | ||
"@types/react-test-renderer": "^18.0.2", | ||
"@typescript-eslint/eslint-plugin": "^5.62.0", | ||
"@typescript-eslint/parser": "^5.62.0", | ||
"antd": "^4.24.13", | ||
"autoprefixer": "^10.4.15", | ||
"babel-jest": "^29.6.3", | ||
"babel-plugin-import": "^1.13.8", | ||
"create-puzzle": "^1.2.1", | ||
"antd": "^5.9.2", | ||
"autoprefixer": "^10.4.16", | ||
"babel-jest": "^29.7.0", | ||
"create-puzzle": "^1.2.5", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"doly-icons": "^1.5.0", | ||
"doly-icons": "^1.5.2", | ||
"dumi": "^1.1.53", | ||
"element-remove": "^1.0.4", | ||
"eslint": "^8.47.0", | ||
"eslint": "^8.49.0", | ||
"eslint-plugin-react": "^7.33.2", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"jest": "^29.6.3", | ||
"jest-environment-jsdom": "^29.6.3", | ||
"husky": "^8.0.3", | ||
"jest": "^29.7.0", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"less": "^4.2.0", | ||
"lint-staged": "^13.3.0", | ||
"postcss": "^8.4.28", | ||
"postcss": "^8.4.30", | ||
"postcss-css-variables": "^0.19.0", | ||
@@ -107,3 +104,3 @@ "prettier": "^2.8.8", | ||
"react-test-renderer": "^18.2.0", | ||
"rollup": "^3.28.1", | ||
"rollup": "^3.29.2", | ||
"rollup-plugin-postcss": "^4.0.2", | ||
@@ -117,5 +114,4 @@ "stylelint": "^14.16.1", | ||
"stylelint-no-unsupported-browser-features": "^5.0.4", | ||
"typescript": "^5.1.6", | ||
"ut2": "^1.4.4", | ||
"yorkie": "^2.0.0" | ||
"typescript": "^5.2.2", | ||
"ut2": "^1.4.9" | ||
}, | ||
@@ -122,0 +118,0 @@ "peerDependencies": { |
@@ -22,12 +22,14 @@ # rc-slider-captcha | ||
```bash | ||
```shell | ||
npm install rc-slider-captcha | ||
``` | ||
or | ||
```bash | ||
```shell | ||
yarn add rc-slider-captcha | ||
``` | ||
```shell | ||
pnpm add rc-slider-captcha | ||
``` | ||
## 使用 | ||
@@ -74,6 +76,6 @@ | ||
| onVerify | 用户操作滑块完成后触发,主要用于验证,返回 `resolve` 表示验证成功,`reject` 表示验证失败。 | `(data: VerifyParam) => Promise<any>` | - | | ||
| mode | 显示模式。`embed` - 嵌入式, `float` - 触发式。 | `'embed' \| 'float'` | `'embed'` | | ||
| mode | 显示模式。`embed` - 嵌入式, `float` - 触发式, `slider` - 只有滑块无拼图。 | `'embed' \| 'float' \| 'slider'` | `'embed'` | | ||
| bgSize | 背景图尺寸 | `{ width: number; height: number; }` | `{ width: 320, height: 160 }` | | ||
| puzzleSize | 拼图尺寸和偏移调整,默认宽度 `60`,高度为背景图高度。 | `{ width: number; height: number; left: number; top: number; }` | `{ width: 60 }` | | ||
| tipText | 提示文本配置 | `{ default: ReactNode; loading: ReactNode; moving: ReactNode; errors: ReactNode; }` | - | | ||
| tipText | 提示文本配置 | `{ default: ReactNode; loading: ReactNode; moving: ReactNode; verifying: ReactNode; success: ReactNode; error: ReactNode; errors: ReactNode; }` | - | | ||
| tipIcon | 提示图标配置 | `{ default: ReactNode; loading: ReactNode; error: ReactNode; success: ReactNode; refresh: ReactNode; }` | - | | ||
@@ -80,0 +82,0 @@ | actionRef | 常用操作 | `React.MutableRefObject<ActionType \| undefined>;` | - | |
@@ -7,7 +7,4 @@ export declare const prefixCls = "rc-slider-captcha"; | ||
export declare function setStyle(el: HTMLElement | null, styleObj?: Record<string, string>): void; | ||
export declare const isBrowser: false | { | ||
<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void; | ||
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void; | ||
}; | ||
export declare const isBrowser: boolean; | ||
export declare const isSupportTouch: boolean; | ||
export declare const reflow: (node: HTMLElement | null) => number | undefined; |
51
149
94994
1382
Updatedrc-hooks@^3.0.5
Updatedtslib@^2.6.2