@uiw/utils
Advanced tools
Comparing version 5.0.0-bate-5 to 5.0.0-bate-6
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.getScroll = getScroll; | ||
/** | ||
@@ -21,3 +20,2 @@ * Gets the scroll value of the given element in the given side (top and left) | ||
} | ||
var prop = top ? 'pageYOffset' : 'pageXOffset'; | ||
@@ -27,9 +25,7 @@ var method = top ? 'scrollTop' : 'scrollLeft'; | ||
var ret = isWindow ? target[prop] : target[method]; | ||
if (isWindow && typeof ret !== 'number') { | ||
ret = document.documentElement[method]; | ||
} | ||
return ret; | ||
} | ||
//# sourceMappingURL=getScroll.js.map |
@@ -6,5 +6,3 @@ "use strict"; | ||
}); | ||
var _getScroll = require("./getScroll"); | ||
Object.keys(_getScroll).forEach(function (key) { | ||
@@ -20,5 +18,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _props = require("./props"); | ||
Object.keys(_props).forEach(function (key) { | ||
@@ -34,5 +30,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _randomid = require("./randomid"); | ||
Object.keys(_randomid).forEach(function (key) { | ||
@@ -48,5 +42,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _noop = require("./noop"); | ||
Object.keys(_noop).forEach(function (key) { | ||
@@ -62,5 +54,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _theme = require("./theme"); | ||
Object.keys(_theme).forEach(function (key) { | ||
@@ -67,0 +57,0 @@ if (key === "default" || key === "__esModule") return; |
@@ -7,4 +7,3 @@ "use strict"; | ||
exports.noop = noop; | ||
function noop() {} | ||
//# sourceMappingURL=noop.js.map |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.randomid = randomid; | ||
/** | ||
@@ -10,0 +9,0 @@ * Returns a random text |
@@ -48,3 +48,3 @@ import React from 'react'; | ||
* **/ | ||
export declare const GetStyledCloneComponent: <T = any, M = Record<string, any>>(props: GetStyledCloneComponentProps<T, M>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.FunctionComponentElement<{ | ||
export declare const GetStyledCloneComponent: <T = any, M = Record<string, any>>(props: GetStyledCloneComponentProps<T, M>) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.FunctionComponentElement<{ | ||
children?: React.ReactNode; | ||
@@ -51,0 +51,0 @@ }>; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"]; | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,11 +8,6 @@ value: true | ||
exports.transformationVariable = exports.transformationHump = exports.getTransitionGroupStatusType = exports.getThemeVariantValue = exports.GetStyledCloneComponent = void 0; | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _excluded = ["className"]; | ||
/** | ||
@@ -30,2 +24,3 @@ * @description: 转换驼峰命名 | ||
}; | ||
/** | ||
@@ -37,6 +32,3 @@ * `css 变量`转换成`主题变量`规则 :css变量去除标识(`--w-`)之后,进行转换 驼峰命名 | ||
*/ | ||
exports.transformationHump = transformationHump; | ||
var transformationVariable = function transformationVariable(cssVariable, ident) { | ||
@@ -47,3 +39,2 @@ var Variable = {}; | ||
var name = transformationHump(key, ident); | ||
if (Reg.test(ident)) { | ||
@@ -59,5 +50,3 @@ // 这种是变量的方式 | ||
}; | ||
exports.transformationVariable = transformationVariable; | ||
/** | ||
@@ -70,20 +59,14 @@ * @description: 获取主题变量值 | ||
var defaultTheme = options.defaultTheme, | ||
theme = options.theme; | ||
theme = options.theme; | ||
if (field) { | ||
var defaultValue = (defaultTheme || {})[field]; | ||
var value = (theme || {})[field]; | ||
if (value || typeof value === 'number') { | ||
return value; | ||
} | ||
return defaultValue; | ||
} | ||
return ''; | ||
}; | ||
exports.getThemeVariantValue = getThemeVariantValue; | ||
/** | ||
@@ -102,13 +85,11 @@ * styled-components 当遇到 clone 子集的时候,利用 as 功能进行转换 | ||
var children = props.children, | ||
oProps = props.oProps, | ||
_props$isChildClassNa = props.isChildClassName, | ||
isChildClassName = _props$isChildClassNa === void 0 ? true : _props$isChildClassNa, | ||
styleClassName = props.className; | ||
oProps = props.oProps, | ||
_props$isChildClassNa = props.isChildClassName, | ||
isChildClassName = _props$isChildClassNa === void 0 ? true : _props$isChildClassNa, | ||
styleClassName = props.className; | ||
if ( /*#__PURE__*/_react["default"].isValidElement(children)) { | ||
var _ref = oProps || {}, | ||
_ref$className = _ref.className, | ||
oClassName = _ref$className === void 0 ? '' : _ref$className, | ||
rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded); | ||
_ref$className = _ref.className, | ||
oClassName = _ref$className === void 0 ? '' : _ref$className, | ||
rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded); | ||
var childProps = (children === null || children === void 0 ? void 0 : children.props) || {}; | ||
@@ -124,3 +105,2 @@ var className = (childProps === null || childProps === void 0 ? void 0 : childProps.className) || ''; | ||
} | ||
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, { | ||
@@ -130,12 +110,10 @@ children: children | ||
}; | ||
/** | ||
* 通过 className 获取 react-transition-group 状态 | ||
* **/ | ||
exports.GetStyledCloneComponent = GetStyledCloneComponent; | ||
var getTransitionGroupStatusType = function getTransitionGroupStatusType(pix, className) { | ||
var reg = new RegExp("^".concat(pix)); // 字符串进行分割数组 | ||
var reg = new RegExp("^".concat(pix)); | ||
// 字符串进行分割数组 | ||
var classArr = className.split(' ').filter(function (name) { | ||
@@ -148,4 +126,3 @@ return reg.test(name); | ||
}; | ||
exports.getTransitionGroupStatusType = getTransitionGroupStatusType; | ||
//# sourceMappingURL=theme.js.map |
@@ -13,3 +13,2 @@ /** | ||
} | ||
var prop = top ? 'pageYOffset' : 'pageXOffset'; | ||
@@ -19,9 +18,7 @@ var method = top ? 'scrollTop' : 'scrollLeft'; | ||
var ret = isWindow ? target[prop] : target[method]; | ||
if (isWindow && typeof ret !== 'number') { | ||
ret = document.documentElement[method]; | ||
} | ||
return ret; | ||
} | ||
//# sourceMappingURL=getScroll.js.map |
@@ -48,3 +48,3 @@ import React from 'react'; | ||
* **/ | ||
export declare const GetStyledCloneComponent: <T = any, M = Record<string, any>>(props: GetStyledCloneComponentProps<T, M>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.FunctionComponentElement<{ | ||
export declare const GetStyledCloneComponent: <T = any, M = Record<string, any>>(props: GetStyledCloneComponentProps<T, M>) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.FunctionComponentElement<{ | ||
children?: React.ReactNode; | ||
@@ -51,0 +51,0 @@ }>; |
@@ -5,3 +5,2 @@ import _extends from "@babel/runtime/helpers/extends"; | ||
import React from 'react'; | ||
/** | ||
@@ -18,2 +17,3 @@ * @description: 转换驼峰命名 | ||
}; | ||
/** | ||
@@ -25,3 +25,2 @@ * `css 变量`转换成`主题变量`规则 :css变量去除标识(`--w-`)之后,进行转换 驼峰命名 | ||
*/ | ||
export var transformationVariable = (cssVariable, ident) => { | ||
@@ -32,3 +31,2 @@ var Variable = {}; | ||
var name = transformationHump(key, ident); | ||
if (Reg.test(ident)) { | ||
@@ -44,3 +42,2 @@ // 这种是变量的方式 | ||
}; | ||
/** | ||
@@ -56,17 +53,12 @@ * @description: 获取主题变量值 | ||
} = options; | ||
if (field) { | ||
var defaultValue = (defaultTheme || {})[field]; | ||
var value = (theme || {})[field]; | ||
if (value || typeof value === 'number') { | ||
return value; | ||
} | ||
return defaultValue; | ||
} | ||
return ''; | ||
}; | ||
/** | ||
@@ -90,10 +82,8 @@ * styled-components 当遇到 clone 子集的时候,利用 as 功能进行转换 | ||
} = props; | ||
if ( /*#__PURE__*/React.isValidElement(children)) { | ||
var _ref = oProps || {}, | ||
{ | ||
className: oClassName = '' | ||
} = _ref, | ||
rest = _objectWithoutPropertiesLoose(_ref, _excluded); | ||
{ | ||
className: oClassName = '' | ||
} = _ref, | ||
rest = _objectWithoutPropertiesLoose(_ref, _excluded); | ||
var childProps = (children == null ? void 0 : children.props) || {}; | ||
@@ -107,3 +97,2 @@ var className = (childProps == null ? void 0 : childProps.className) || ''; | ||
} | ||
return /*#__PURE__*/React.createElement(React.Fragment, { | ||
@@ -113,9 +102,9 @@ children | ||
}; | ||
/** | ||
* 通过 className 获取 react-transition-group 状态 | ||
* **/ | ||
export var getTransitionGroupStatusType = (pix, className) => { | ||
var reg = new RegExp("^" + pix); // 字符串进行分割数组 | ||
var reg = new RegExp("^" + pix); | ||
// 字符串进行分割数组 | ||
var classArr = className.split(' ').filter(name => reg.test(name)).map(name => name.replace(reg, '')).filter(Boolean); | ||
@@ -122,0 +111,0 @@ return classArr; |
{ | ||
"name": "@uiw/utils", | ||
"version": "5.0.0-bate-5", | ||
"version": "5.0.0-bate-6", | ||
"description": "utils tools for uiw", | ||
@@ -5,0 +5,0 @@ "author": "Kenny Wong <wowohoo@qq.com>", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
782
54547