@aloudata/aloudata-design 1.9.17 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Checkbox/style/index.less +35 -9
- package/dist/ConfigProvider/getUserList.d.ts +13 -1
- package/dist/ConfigProvider/getUserList.js +5 -0
- package/dist/Icon/components/DragLine.d.ts +11 -0
- package/dist/Icon/components/DragLine.js +35 -0
- package/dist/Icon/index.d.ts +1 -0
- package/dist/Icon/index.js +1 -0
- package/dist/Icon/svg/drag-line.svg +5 -0
- package/dist/MemberPicker/components/MemberSelection.d.ts +1 -1
- package/dist/MemberPicker/components/MemberSelection.js +8 -3
- package/dist/MemberPicker/components/MultipleOption.d.ts +5 -2
- package/dist/MemberPicker/components/MultipleOption.js +20 -5
- package/dist/MemberPicker/components/NickLabel.d.ts +3 -3
- package/dist/MemberPicker/components/NickLabel.js +6 -6
- package/dist/MemberPicker/components/Panel.d.ts +7 -4
- package/dist/MemberPicker/components/Panel.js +70 -20
- package/dist/MemberPicker/components/PanelWrapper.d.ts +14 -0
- package/dist/MemberPicker/components/PanelWrapper.js +126 -0
- package/dist/MemberPicker/components/SelectedMemberTags.d.ts +3 -2
- package/dist/MemberPicker/components/SelectedMemberTags.js +8 -5
- package/dist/MemberPicker/components/SelectorFooter.js +1 -1
- package/dist/MemberPicker/components/SingleOption.d.ts +3 -2
- package/dist/MemberPicker/components/SingleOption.js +7 -4
- package/dist/MemberPicker/components/UserGroupSelection.d.ts +14 -0
- package/dist/MemberPicker/components/UserGroupSelection.js +130 -0
- package/dist/MemberPicker/index.d.ts +2 -0
- package/dist/MemberPicker/index.js +28 -17
- package/dist/MemberPicker/interface.d.ts +11 -5
- package/dist/MemberPicker/interface.js +6 -1
- package/dist/MemberPicker/style/index.less +18 -3
- package/dist/MemberPicker/utils/getUsersWithUserId.d.ts +4 -0
- package/dist/MemberPicker/utils/getUsersWithUserId.js +23 -2
- package/dist/MemberPicker/utils/index.d.ts +6 -0
- package/dist/MemberPicker/utils/index.js +16 -0
- package/dist/Radio/style/index.less +1 -1
- package/dist/ScrollArea/index.d.ts +1 -0
- package/dist/ScrollArea/index.js +6 -3
- package/dist/Table/components/Cell.d.ts +7 -0
- package/dist/Table/components/Cell.js +20 -0
- package/dist/Table/components/Header.d.ts +6 -0
- package/dist/Table/components/Header.js +19 -0
- package/dist/{AldTable → Table}/helper.d.ts +9 -2
- package/dist/Table/helper.js +121 -0
- package/dist/Table/hooks/useScroll.d.ts +26 -0
- package/dist/Table/hooks/useScroll.js +57 -0
- package/dist/Table/index.d.ts +3 -1
- package/dist/Table/index.js +176 -1
- package/dist/Table/style/index.less +106 -203
- package/dist/{AldTable → Table}/types.d.ts +5 -4
- package/dist/Tree/DirectoryTree.d.ts +20 -0
- package/dist/Tree/DirectoryTree.js +175 -0
- package/dist/Tree/Tree.d.ts +136 -0
- package/dist/Tree/Tree.js +131 -0
- package/dist/Tree/demo/basic/index.js +3 -2
- package/dist/Tree/demo/drag/index.d.ts +3 -0
- package/dist/Tree/demo/drag/index.js +124 -0
- package/dist/Tree/index.d.ts +19 -13
- package/dist/Tree/index.js +7 -17
- package/dist/Tree/style/checkbox.less +226 -0
- package/dist/Tree/style/directory.less +68 -0
- package/dist/Tree/style/index.less +74 -29
- package/dist/Tree/style/mixin.less +333 -0
- package/dist/Tree/style/reset.less +11 -0
- package/dist/Tree/style/rtl.less +68 -0
- package/dist/Tree/style/var.less +42 -0
- package/dist/Tree/utils/dictUtil.d.ts +9 -0
- package/dist/Tree/utils/dictUtil.js +74 -0
- package/dist/Tree/utils/dropIndicator.d.ts +9 -0
- package/dist/Tree/utils/dropIndicator.js +35 -0
- package/dist/Tree/utils/iconUtil.d.ts +5 -0
- package/dist/Tree/utils/iconUtil.js +63 -0
- package/dist/_utils/motion.d.ts +8 -0
- package/dist/_utils/motion.js +52 -0
- package/dist/_utils/reactNode.d.ts +8 -0
- package/dist/_utils/reactNode.js +15 -0
- package/dist/_utils/type.d.ts +9 -0
- package/dist/_utils/type.js +20 -0
- package/dist/index.d.ts +11 -13
- package/dist/index.js +6 -7
- package/dist/style/color/bezierEasing.less +110 -0
- package/dist/style/color/colorPalette.less +84 -0
- package/dist/style/color/colors.less +162 -0
- package/dist/style/color/tinyColor.less +1184 -0
- package/dist/style/core/index.less +2 -0
- package/dist/style/core/motion/fade.less +34 -0
- package/dist/style/core/motion/move.less +129 -0
- package/dist/style/core/motion/other.less +48 -0
- package/dist/style/core/motion/slide.less +131 -0
- package/dist/style/core/motion/zoom.less +179 -0
- package/dist/style/core/motion.less +22 -0
- package/dist/style/index.less +2 -0
- package/dist/style/mixins/index.less +1 -0
- package/dist/style/mixins/motion.less +33 -0
- package/dist/style/themes/default/default.less +24 -0
- package/dist/style/themes/default/index.less +1 -0
- package/package.json +2 -3
- package/dist/AldTable/helper.js +0 -109
- package/dist/AldTable/index.d.ts +0 -4
- package/dist/AldTable/index.js +0 -151
- package/dist/AldTable/style/index.d.ts +0 -2
- package/dist/AldTable/style/index.js +0 -2
- package/dist/AldTable/style/index.less +0 -136
- package/dist/Table/Table.d.ts +0 -6
- package/dist/Table/Table.js +0 -360
- package/dist/Table/components/Empty/index.d.ts +0 -3
- package/dist/Table/components/Empty/index.js +0 -14
- package/dist/Table/components/Loading/index.d.ts +0 -3
- package/dist/Table/components/Loading/index.js +0 -12
- package/dist/Table/components/TableBodyRowList/index.d.ts +0 -13
- package/dist/Table/components/TableBodyRowList/index.js +0 -75
- package/dist/Table/components/TableHead/index.d.ts +0 -23
- package/dist/Table/components/TableHead/index.js +0 -229
- package/dist/Table/constant.d.ts +0 -0
- package/dist/Table/constant.js +0 -0
- package/dist/Table/hooks/useFrame.d.ts +0 -7
- package/dist/Table/hooks/useFrame.js +0 -75
- package/dist/Table/interface.d.ts +0 -42
- package/dist/Table/interface.js +0 -1
- package/dist/Table/react-table-config.d.ts +0 -122
- package/dist/Table/style/variable.less +0 -4
- package/dist/Table/utils.d.ts +0 -15
- package/dist/Table/utils.js +0 -122
- /package/dist/{AldTable → Table}/types.js +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { tuple } from "./type";
|
|
2
|
+
|
|
3
|
+
// ================== Collapse Motion ==================
|
|
4
|
+
var getCollapsedHeight = function getCollapsedHeight() {
|
|
5
|
+
return {
|
|
6
|
+
height: 0,
|
|
7
|
+
opacity: 0
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
var getRealHeight = function getRealHeight(node) {
|
|
11
|
+
var scrollHeight = node.scrollHeight;
|
|
12
|
+
return {
|
|
13
|
+
height: scrollHeight,
|
|
14
|
+
opacity: 1
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
var getCurrentHeight = function getCurrentHeight(node) {
|
|
18
|
+
return {
|
|
19
|
+
height: node ? node.offsetHeight : 0
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
var skipOpacityTransition = function skipOpacityTransition(_, event) {
|
|
23
|
+
return (event === null || event === void 0 ? void 0 : event.deadline) === true || event.propertyName === 'height';
|
|
24
|
+
};
|
|
25
|
+
var collapseMotion = {
|
|
26
|
+
motionName: 'ant-motion-collapse',
|
|
27
|
+
onAppearStart: getCollapsedHeight,
|
|
28
|
+
onEnterStart: getCollapsedHeight,
|
|
29
|
+
onAppearActive: getRealHeight,
|
|
30
|
+
onEnterActive: getRealHeight,
|
|
31
|
+
onLeaveStart: getCurrentHeight,
|
|
32
|
+
onLeaveActive: getCollapsedHeight,
|
|
33
|
+
onAppearEnd: skipOpacityTransition,
|
|
34
|
+
onEnterEnd: skipOpacityTransition,
|
|
35
|
+
onLeaveEnd: skipOpacityTransition,
|
|
36
|
+
motionDeadline: 500
|
|
37
|
+
};
|
|
38
|
+
var SelectPlacements = tuple('bottomLeft', 'bottomRight', 'topLeft', 'topRight');
|
|
39
|
+
var getTransitionDirection = function getTransitionDirection(placement) {
|
|
40
|
+
if (placement !== undefined && (placement === 'topLeft' || placement === 'topRight')) {
|
|
41
|
+
return "slide-down";
|
|
42
|
+
}
|
|
43
|
+
return "slide-up";
|
|
44
|
+
};
|
|
45
|
+
var getTransitionName = function getTransitionName(rootPrefixCls, motion, transitionName) {
|
|
46
|
+
if (transitionName !== undefined) {
|
|
47
|
+
return transitionName;
|
|
48
|
+
}
|
|
49
|
+
return "".concat(rootPrefixCls, "-").concat(motion);
|
|
50
|
+
};
|
|
51
|
+
export { getTransitionName, getTransitionDirection };
|
|
52
|
+
export default collapseMotion;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const isValidElement: typeof React.isValidElement;
|
|
3
|
+
export declare function isFragment(child: any): boolean;
|
|
4
|
+
type AnyObject = Record<PropertyKey, any>;
|
|
5
|
+
type RenderProps = AnyObject | ((originProps: AnyObject) => AnyObject | void);
|
|
6
|
+
export declare function replaceElement(element: React.ReactNode, replacement: React.ReactNode, props?: RenderProps): React.ReactNode;
|
|
7
|
+
export declare function cloneElement(element: React.ReactNode, props?: RenderProps): React.ReactElement;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
var isValidElement = React.isValidElement;
|
|
3
|
+
export { isValidElement };
|
|
4
|
+
export function isFragment(child) {
|
|
5
|
+
return child && isValidElement(child) && child.type === React.Fragment;
|
|
6
|
+
}
|
|
7
|
+
export function replaceElement(element, replacement, props) {
|
|
8
|
+
if (!isValidElement(element)) {
|
|
9
|
+
return replacement;
|
|
10
|
+
}
|
|
11
|
+
return /*#__PURE__*/React.cloneElement(element, typeof props === 'function' ? props(element.props || {}) : props);
|
|
12
|
+
}
|
|
13
|
+
export function cloneElement(element, props) {
|
|
14
|
+
return replaceElement(element, element, props);
|
|
15
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const tuple: <T extends string[]>(...args: T) => T;
|
|
2
|
+
export declare const tupleNum: <T extends number[]>(...args: T) => T;
|
|
3
|
+
/**
|
|
4
|
+
* https://stackoverflow.com/a/59187769 Extract the type of an element of an array/tuple without
|
|
5
|
+
* performing indexing
|
|
6
|
+
*/
|
|
7
|
+
export type ElementOf<T> = T extends (infer E)[] ? E : T extends readonly (infer F)[] ? F : never;
|
|
8
|
+
/** https://github.com/Microsoft/TypeScript/issues/29729 */
|
|
9
|
+
export type LiteralUnion<T extends U, U> = T | (U & object);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// https://stackoverflow.com/questions/46176165/ways-to-get-string-literal-type-of-array-values-without-enum-overhead
|
|
2
|
+
export var tuple = function tuple() {
|
|
3
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4
|
+
args[_key] = arguments[_key];
|
|
5
|
+
}
|
|
6
|
+
return args;
|
|
7
|
+
};
|
|
8
|
+
export var tupleNum = function tupleNum() {
|
|
9
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
10
|
+
args[_key2] = arguments[_key2];
|
|
11
|
+
}
|
|
12
|
+
return args;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* https://stackoverflow.com/a/59187769 Extract the type of an element of an array/tuple without
|
|
17
|
+
* performing indexing
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/** https://github.com/Microsoft/TypeScript/issues/29729 */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
export type { MenuClickEventHandler } from 'rc-menu/lib/interface';
|
|
2
|
-
export { default as
|
|
3
|
-
export type { ITableColumn, ITableProps as IAldTableProps, } from './AldTable/types';
|
|
2
|
+
export { default as AProgress } from './AProgress';
|
|
4
3
|
export { default as Alert } from './Alert';
|
|
5
4
|
export type { AlertProps } from './Alert';
|
|
6
5
|
export { default as App } from './App';
|
|
7
|
-
export { default as AProgress } from './AProgress';
|
|
8
6
|
export { default as Avatar } from './Avatar';
|
|
9
7
|
export type { IAvatarProps as AvatarProps } from './Avatar';
|
|
10
8
|
export { default as Breadcrumb } from './Breadcrumb';
|
|
11
9
|
export type { BreadcrumbItemProps, BreadcrumbProps } from './Breadcrumb';
|
|
12
10
|
export { default as Button } from './Button';
|
|
13
|
-
export type {
|
|
11
|
+
export type { IButtonProps as ButtonProps, ButtonType } from './Button';
|
|
14
12
|
export { default as Card } from './Card';
|
|
15
13
|
export type { CardProps } from './Card';
|
|
16
14
|
export { default as Carousel } from './Carousel';
|
|
@@ -25,7 +23,7 @@ export { default as ColorPicker } from './ColorPicker';
|
|
|
25
23
|
export type { IColorPickerProps } from './ColorPicker';
|
|
26
24
|
export { default as ConfigProvider } from './ConfigProvider';
|
|
27
25
|
export { default as DataPreviewTable } from './DataPreviewTable';
|
|
28
|
-
export type {
|
|
26
|
+
export type { ITableProps as DataPreviewTableProps, DataPreviewTableRef, PreviewColumn, } from './DataPreviewTable/interface';
|
|
29
27
|
export { default as DatePicker } from './DatePicker';
|
|
30
28
|
export type { DatePickerProps } from './DatePicker';
|
|
31
29
|
export { default as Divider } from './Divider';
|
|
@@ -41,22 +39,19 @@ export type { FormInstance, FormItemProps, FormProps } from './Form';
|
|
|
41
39
|
export { default as Icon } from './Icon';
|
|
42
40
|
export { default as IconButton } from './IconButton';
|
|
43
41
|
export { default as Input } from './Input';
|
|
44
|
-
export type { IInputProps as InputProps, InputRef,
|
|
42
|
+
export type { IInputProps as InputProps, InputRef, TSize, TextAreaRef, } from './Input';
|
|
45
43
|
export { default as InputNumber } from './InputNumber';
|
|
46
44
|
export type { IInputNumberProps as InputNumberProps } from './InputNumber';
|
|
47
45
|
export { default as Layout } from './Layout';
|
|
48
46
|
export type { LayoutProps } from './Layout';
|
|
49
47
|
export { default as MemberPicker } from './MemberPicker';
|
|
50
|
-
export type { IMemberPickerProps as MemberPickerProps,
|
|
48
|
+
export type { IUser, IMemberPickerProps as MemberPickerProps, MemberPickerValue, } from './MemberPicker/interface';
|
|
51
49
|
export { default as Menu } from './Menu';
|
|
52
|
-
export type { IMenuProps as MenuProps
|
|
53
|
-
export { default as message } from './message';
|
|
54
|
-
export type { MessageArgsProps } from './message';
|
|
50
|
+
export type { ItemType, IMenuProps as MenuProps } from './Menu';
|
|
55
51
|
export { default as Modal } from './Modal';
|
|
56
52
|
export type { ModalFuncProps, ModalProps } from './Modal';
|
|
57
53
|
export { default as Navigator } from './Navigator';
|
|
58
54
|
export type { IMenuItem as NavigatorMenu, INavigatorProps as NavigatorProps, ISelectedMenuInfo as SelectedMenuInfo, } from './Navigator';
|
|
59
|
-
export { default as notification } from './notification';
|
|
60
55
|
export { default as Pagination } from './Pagination';
|
|
61
56
|
export { default as Popconfirm } from './Popconfirm';
|
|
62
57
|
export type { PopconfirmProps } from './Popconfirm';
|
|
@@ -83,7 +78,7 @@ export type { IStepProps as StepProps, IStepsProps as StepsProps, } from './Step
|
|
|
83
78
|
export { default as Switch } from './Switch';
|
|
84
79
|
export type { ISwitchProps as SwitchProps } from './Switch';
|
|
85
80
|
export { default as Table } from './Table';
|
|
86
|
-
export type {
|
|
81
|
+
export type { ITableColumn, ITableProps } from './Table/types';
|
|
87
82
|
export { default as Tabs } from './Tabs';
|
|
88
83
|
export type { ITabsProps as TabsProps, TabsSize } from './Tabs';
|
|
89
84
|
export { default as Tag } from './Tag';
|
|
@@ -91,8 +86,11 @@ export type { TagProps, TagType } from './Tag';
|
|
|
91
86
|
export { default as Tooltip } from './Tooltip';
|
|
92
87
|
export type { ActionType as TooltipActionType, ITooltipProps as TooltipProps, } from './Tooltip';
|
|
93
88
|
export { default as Tree } from './Tree';
|
|
94
|
-
export type {
|
|
89
|
+
export type { DataNode as TreeDataNode, AldTreeNodeProps as TreeNodeProps, TreeProps, } from './Tree';
|
|
95
90
|
export { default as Typography } from './Typography';
|
|
96
91
|
export type { TypographyProps } from './Typography';
|
|
97
92
|
export { default as Upload } from './Upload';
|
|
98
93
|
export type { UploadFile, UploadProps } from './Upload';
|
|
94
|
+
export { default as message } from './message';
|
|
95
|
+
export type { MessageArgsProps } from './message';
|
|
96
|
+
export { default as notification } from './notification';
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// / <reference path="../typings.d.ts" />
|
|
2
2
|
|
|
3
|
-
export { default as
|
|
3
|
+
export { default as AProgress } from "./AProgress";
|
|
4
4
|
export { default as Alert } from "./Alert";
|
|
5
5
|
export { default as App } from "./App";
|
|
6
|
-
export { default as AProgress } from "./AProgress";
|
|
7
6
|
export { default as Avatar } from "./Avatar";
|
|
8
7
|
export { default as Breadcrumb } from "./Breadcrumb";
|
|
9
8
|
export { default as Button } from "./Button";
|
|
@@ -28,12 +27,8 @@ export { default as InputNumber } from "./InputNumber";
|
|
|
28
27
|
export { default as Layout } from "./Layout";
|
|
29
28
|
export { default as MemberPicker } from "./MemberPicker";
|
|
30
29
|
export { default as Menu } from "./Menu";
|
|
31
|
-
export { default as message } from "./message";
|
|
32
|
-
// alias, keep API the same as antd
|
|
33
|
-
|
|
34
30
|
export { default as Modal } from "./Modal";
|
|
35
31
|
export { default as Navigator } from "./Navigator";
|
|
36
|
-
export { default as notification } from "./notification";
|
|
37
32
|
export { default as Pagination } from "./Pagination";
|
|
38
33
|
export { default as Popconfirm } from "./Popconfirm";
|
|
39
34
|
export { default as Popover } from "./Popover";
|
|
@@ -54,4 +49,8 @@ export { default as Tag } from "./Tag";
|
|
|
54
49
|
export { default as Tooltip } from "./Tooltip";
|
|
55
50
|
export { default as Tree } from "./Tree";
|
|
56
51
|
export { default as Typography } from "./Typography";
|
|
57
|
-
export { default as Upload } from "./Upload";
|
|
52
|
+
export { default as Upload } from "./Upload";
|
|
53
|
+
export { default as message } from "./message";
|
|
54
|
+
// alias, keep API the same as antd
|
|
55
|
+
|
|
56
|
+
export { default as notification } from "./notification";
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/* stylelint-disable */
|
|
2
|
+
.bezierEasingMixin() {
|
|
3
|
+
@functions: ~`(function() {
|
|
4
|
+
var NEWTON_ITERATIONS = 4;
|
|
5
|
+
var NEWTON_MIN_SLOPE = 0.001;
|
|
6
|
+
var SUBDIVISION_PRECISION = 0.0000001;
|
|
7
|
+
var SUBDIVISION_MAX_ITERATIONS = 10;
|
|
8
|
+
|
|
9
|
+
var kSplineTableSize = 11;
|
|
10
|
+
var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
|
|
11
|
+
|
|
12
|
+
var float32ArraySupported = typeof Float32Array === 'function';
|
|
13
|
+
|
|
14
|
+
function A (aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; }
|
|
15
|
+
function B (aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; }
|
|
16
|
+
function C (aA1) { return 3.0 * aA1; }
|
|
17
|
+
|
|
18
|
+
// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
|
|
19
|
+
function calcBezier (aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT; }
|
|
20
|
+
|
|
21
|
+
// Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.
|
|
22
|
+
function getSlope (aT, aA1, aA2) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1); }
|
|
23
|
+
|
|
24
|
+
function binarySubdivide (aX, aA, aB, mX1, mX2) {
|
|
25
|
+
var currentX, currentT, i = 0;
|
|
26
|
+
do {
|
|
27
|
+
currentT = aA + (aB - aA) / 2.0;
|
|
28
|
+
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
|
29
|
+
if (currentX > 0.0) {
|
|
30
|
+
aB = currentT;
|
|
31
|
+
} else {
|
|
32
|
+
aA = currentT;
|
|
33
|
+
}
|
|
34
|
+
} while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
|
|
35
|
+
return currentT;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function newtonRaphsonIterate (aX, aGuessT, mX1, mX2) {
|
|
39
|
+
for (var i = 0; i < NEWTON_ITERATIONS; ++i) {
|
|
40
|
+
var currentSlope = getSlope(aGuessT, mX1, mX2);
|
|
41
|
+
if (currentSlope === 0.0) {
|
|
42
|
+
return aGuessT;
|
|
43
|
+
}
|
|
44
|
+
var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
|
|
45
|
+
aGuessT -= currentX / currentSlope;
|
|
46
|
+
}
|
|
47
|
+
return aGuessT;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
var BezierEasing = function (mX1, mY1, mX2, mY2) {
|
|
51
|
+
if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) {
|
|
52
|
+
throw new Error('bezier x values must be in [0, 1] range');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Precompute samples table
|
|
56
|
+
var sampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
|
|
57
|
+
if (mX1 !== mY1 || mX2 !== mY2) {
|
|
58
|
+
for (var i = 0; i < kSplineTableSize; ++i) {
|
|
59
|
+
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function getTForX (aX) {
|
|
64
|
+
var intervalStart = 0.0;
|
|
65
|
+
var currentSample = 1;
|
|
66
|
+
var lastSample = kSplineTableSize - 1;
|
|
67
|
+
|
|
68
|
+
for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
|
|
69
|
+
intervalStart += kSampleStepSize;
|
|
70
|
+
}
|
|
71
|
+
--currentSample;
|
|
72
|
+
|
|
73
|
+
// Interpolate to provide an initial guess for t
|
|
74
|
+
var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
|
|
75
|
+
var guessForT = intervalStart + dist * kSampleStepSize;
|
|
76
|
+
|
|
77
|
+
var initialSlope = getSlope(guessForT, mX1, mX2);
|
|
78
|
+
if (initialSlope >= NEWTON_MIN_SLOPE) {
|
|
79
|
+
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
|
|
80
|
+
} else if (initialSlope === 0.0) {
|
|
81
|
+
return guessForT;
|
|
82
|
+
} else {
|
|
83
|
+
return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return function BezierEasing (x) {
|
|
88
|
+
if (mX1 === mY1 && mX2 === mY2) {
|
|
89
|
+
return x; // linear
|
|
90
|
+
}
|
|
91
|
+
// Because JavaScript number are imprecise, we should guarantee the extremes are right.
|
|
92
|
+
if (x === 0) {
|
|
93
|
+
return 0;
|
|
94
|
+
}
|
|
95
|
+
if (x === 1) {
|
|
96
|
+
return 1;
|
|
97
|
+
}
|
|
98
|
+
return calcBezier(getTForX(x), mY1, mY2);
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
this.colorEasing = BezierEasing(0.26, 0.09, 0.37, 0.18);
|
|
103
|
+
// less 3 requires a return
|
|
104
|
+
return '';
|
|
105
|
+
})()`;
|
|
106
|
+
}
|
|
107
|
+
// It is hacky way to make this function will be compiled preferentially by less
|
|
108
|
+
// resolve error: `ReferenceError: colorPalette is not defined`
|
|
109
|
+
// https://github.com/ant-design/ant-motion/issues/44
|
|
110
|
+
.bezierEasingMixin();
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/* stylelint-disable no-duplicate-selectors */
|
|
2
|
+
@import "bezierEasing";
|
|
3
|
+
@import "tinyColor";
|
|
4
|
+
|
|
5
|
+
// We create a very complex algorithm which take the place of original tint/shade color system
|
|
6
|
+
// to make sure no one can understand it 👻
|
|
7
|
+
// and create an entire color palette magicly by inputing just a single primary color.
|
|
8
|
+
// We are using bezier-curve easing function and some color manipulations like tint/shade/darken/spin
|
|
9
|
+
.colorPaletteMixin() {
|
|
10
|
+
@functions: ~`(function() {
|
|
11
|
+
var hueStep = 2;
|
|
12
|
+
var saturationStep = 0.16;
|
|
13
|
+
var saturationStep2 = 0.05;
|
|
14
|
+
var brightnessStep1 = 0.05;
|
|
15
|
+
var brightnessStep2 = 0.15;
|
|
16
|
+
var lightColorCount = 5;
|
|
17
|
+
var darkColorCount = 4;
|
|
18
|
+
|
|
19
|
+
var getHue = function(hsv, i, isLight) {
|
|
20
|
+
var hue;
|
|
21
|
+
if (hsv.h >= 60 && hsv.h <= 240) {
|
|
22
|
+
hue = isLight ? hsv.h - hueStep * i : hsv.h + hueStep * i;
|
|
23
|
+
} else {
|
|
24
|
+
hue = isLight ? hsv.h + hueStep * i : hsv.h - hueStep * i;
|
|
25
|
+
}
|
|
26
|
+
if (hue < 0) {
|
|
27
|
+
hue += 360;
|
|
28
|
+
} else if (hue >= 360) {
|
|
29
|
+
hue -= 360;
|
|
30
|
+
}
|
|
31
|
+
return Math.round(hue);
|
|
32
|
+
};
|
|
33
|
+
var getSaturation = function(hsv, i, isLight) {
|
|
34
|
+
if (hsv.h === 0 && hsv.s === 0) {
|
|
35
|
+
return hsv.s;
|
|
36
|
+
}
|
|
37
|
+
var saturation;
|
|
38
|
+
if (isLight) {
|
|
39
|
+
saturation = hsv.s - saturationStep * i;
|
|
40
|
+
} else if (i === darkColorCount) {
|
|
41
|
+
saturation = hsv.s + saturationStep;
|
|
42
|
+
} else {
|
|
43
|
+
saturation = hsv.s + saturationStep2 * i;
|
|
44
|
+
}
|
|
45
|
+
if (saturation > 1) {
|
|
46
|
+
saturation = 1;
|
|
47
|
+
}
|
|
48
|
+
if (isLight && i === lightColorCount && saturation > 0.1) {
|
|
49
|
+
saturation = 0.1;
|
|
50
|
+
}
|
|
51
|
+
if (saturation < 0.06) {
|
|
52
|
+
saturation = 0.06;
|
|
53
|
+
}
|
|
54
|
+
return Number(saturation.toFixed(2));
|
|
55
|
+
};
|
|
56
|
+
var getValue = function(hsv, i, isLight) {
|
|
57
|
+
var value;
|
|
58
|
+
if (isLight) {
|
|
59
|
+
value = hsv.v + brightnessStep1 * i;
|
|
60
|
+
}else{
|
|
61
|
+
value = hsv.v - brightnessStep2 * i
|
|
62
|
+
}
|
|
63
|
+
if (value > 1) {
|
|
64
|
+
value = 1;
|
|
65
|
+
}
|
|
66
|
+
return Number(value.toFixed(2))
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
this.colorPalette = function(color, index) {
|
|
70
|
+
var isLight = index <= 6;
|
|
71
|
+
var hsv = tinycolor(color).toHsv();
|
|
72
|
+
var i = isLight ? lightColorCount + 1 - index : index - lightColorCount - 1;
|
|
73
|
+
return tinycolor({
|
|
74
|
+
h: getHue(hsv, i, isLight),
|
|
75
|
+
s: getSaturation(hsv, i, isLight),
|
|
76
|
+
v: getValue(hsv, i, isLight),
|
|
77
|
+
}).toHexString();
|
|
78
|
+
};
|
|
79
|
+
})()`;
|
|
80
|
+
}
|
|
81
|
+
// It is hacky way to make this function will be compiled preferentially by less
|
|
82
|
+
// resolve error: `ReferenceError: colorPalette is not defined`
|
|
83
|
+
// https://github.com/ant-design/ant-motion/issues/44
|
|
84
|
+
.colorPaletteMixin();
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
@import 'colorPalette';
|
|
2
|
+
|
|
3
|
+
// color palettes
|
|
4
|
+
@blue-base: #1890ff;
|
|
5
|
+
@blue-1: color(~`colorPalette('@{blue-6}', 1) `);
|
|
6
|
+
@blue-2: color(~`colorPalette('@{blue-6}', 2) `);
|
|
7
|
+
@blue-3: color(~`colorPalette('@{blue-6}', 3) `);
|
|
8
|
+
@blue-4: color(~`colorPalette('@{blue-6}', 4) `);
|
|
9
|
+
@blue-5: color(~`colorPalette('@{blue-6}', 5) `);
|
|
10
|
+
@blue-6: @blue-base;
|
|
11
|
+
@blue-7: color(~`colorPalette('@{blue-6}', 7) `);
|
|
12
|
+
@blue-8: color(~`colorPalette('@{blue-6}', 8) `);
|
|
13
|
+
@blue-9: color(~`colorPalette('@{blue-6}', 9) `);
|
|
14
|
+
@blue-10: color(~`colorPalette('@{blue-6}', 10) `);
|
|
15
|
+
|
|
16
|
+
@purple-base: #722ed1;
|
|
17
|
+
@purple-1: color(~`colorPalette('@{purple-6}', 1) `);
|
|
18
|
+
@purple-2: color(~`colorPalette('@{purple-6}', 2) `);
|
|
19
|
+
@purple-3: color(~`colorPalette('@{purple-6}', 3) `);
|
|
20
|
+
@purple-4: color(~`colorPalette('@{purple-6}', 4) `);
|
|
21
|
+
@purple-5: color(~`colorPalette('@{purple-6}', 5) `);
|
|
22
|
+
@purple-6: @purple-base;
|
|
23
|
+
@purple-7: color(~`colorPalette('@{purple-6}', 7) `);
|
|
24
|
+
@purple-8: color(~`colorPalette('@{purple-6}', 8) `);
|
|
25
|
+
@purple-9: color(~`colorPalette('@{purple-6}', 9) `);
|
|
26
|
+
@purple-10: color(~`colorPalette('@{purple-6}', 10) `);
|
|
27
|
+
|
|
28
|
+
@cyan-base: #13c2c2;
|
|
29
|
+
@cyan-1: color(~`colorPalette('@{cyan-6}', 1) `);
|
|
30
|
+
@cyan-2: color(~`colorPalette('@{cyan-6}', 2) `);
|
|
31
|
+
@cyan-3: color(~`colorPalette('@{cyan-6}', 3) `);
|
|
32
|
+
@cyan-4: color(~`colorPalette('@{cyan-6}', 4) `);
|
|
33
|
+
@cyan-5: color(~`colorPalette('@{cyan-6}', 5) `);
|
|
34
|
+
@cyan-6: @cyan-base;
|
|
35
|
+
@cyan-7: color(~`colorPalette('@{cyan-6}', 7) `);
|
|
36
|
+
@cyan-8: color(~`colorPalette('@{cyan-6}', 8) `);
|
|
37
|
+
@cyan-9: color(~`colorPalette('@{cyan-6}', 9) `);
|
|
38
|
+
@cyan-10: color(~`colorPalette('@{cyan-6}', 10) `);
|
|
39
|
+
|
|
40
|
+
@green-base: #52c41a;
|
|
41
|
+
@green-1: color(~`colorPalette('@{green-6}', 1) `);
|
|
42
|
+
@green-2: color(~`colorPalette('@{green-6}', 2) `);
|
|
43
|
+
@green-3: color(~`colorPalette('@{green-6}', 3) `);
|
|
44
|
+
@green-4: color(~`colorPalette('@{green-6}', 4) `);
|
|
45
|
+
@green-5: color(~`colorPalette('@{green-6}', 5) `);
|
|
46
|
+
@green-6: @green-base;
|
|
47
|
+
@green-7: color(~`colorPalette('@{green-6}', 7) `);
|
|
48
|
+
@green-8: color(~`colorPalette('@{green-6}', 8) `);
|
|
49
|
+
@green-9: color(~`colorPalette('@{green-6}', 9) `);
|
|
50
|
+
@green-10: color(~`colorPalette('@{green-6}', 10) `);
|
|
51
|
+
|
|
52
|
+
@magenta-base: #eb2f96;
|
|
53
|
+
@magenta-1: color(~`colorPalette('@{magenta-6}', 1) `);
|
|
54
|
+
@magenta-2: color(~`colorPalette('@{magenta-6}', 2) `);
|
|
55
|
+
@magenta-3: color(~`colorPalette('@{magenta-6}', 3) `);
|
|
56
|
+
@magenta-4: color(~`colorPalette('@{magenta-6}', 4) `);
|
|
57
|
+
@magenta-5: color(~`colorPalette('@{magenta-6}', 5) `);
|
|
58
|
+
@magenta-6: @magenta-base;
|
|
59
|
+
@magenta-7: color(~`colorPalette('@{magenta-6}', 7) `);
|
|
60
|
+
@magenta-8: color(~`colorPalette('@{magenta-6}', 8) `);
|
|
61
|
+
@magenta-9: color(~`colorPalette('@{magenta-6}', 9) `);
|
|
62
|
+
@magenta-10: color(~`colorPalette('@{magenta-6}', 10) `);
|
|
63
|
+
|
|
64
|
+
// alias of magenta
|
|
65
|
+
@pink-base: #eb2f96;
|
|
66
|
+
@pink-1: color(~`colorPalette('@{pink-6}', 1) `);
|
|
67
|
+
@pink-2: color(~`colorPalette('@{pink-6}', 2) `);
|
|
68
|
+
@pink-3: color(~`colorPalette('@{pink-6}', 3) `);
|
|
69
|
+
@pink-4: color(~`colorPalette('@{pink-6}', 4) `);
|
|
70
|
+
@pink-5: color(~`colorPalette('@{pink-6}', 5) `);
|
|
71
|
+
@pink-6: @pink-base;
|
|
72
|
+
@pink-7: color(~`colorPalette('@{pink-6}', 7) `);
|
|
73
|
+
@pink-8: color(~`colorPalette('@{pink-6}', 8) `);
|
|
74
|
+
@pink-9: color(~`colorPalette('@{pink-6}', 9) `);
|
|
75
|
+
@pink-10: color(~`colorPalette('@{pink-6}', 10) `);
|
|
76
|
+
|
|
77
|
+
@red-base: #f5222d;
|
|
78
|
+
@red-1: color(~`colorPalette('@{red-6}', 1) `);
|
|
79
|
+
@red-2: color(~`colorPalette('@{red-6}', 2) `);
|
|
80
|
+
@red-3: color(~`colorPalette('@{red-6}', 3) `);
|
|
81
|
+
@red-4: color(~`colorPalette('@{red-6}', 4) `);
|
|
82
|
+
@red-5: color(~`colorPalette('@{red-6}', 5) `);
|
|
83
|
+
@red-6: @red-base;
|
|
84
|
+
@red-7: color(~`colorPalette('@{red-6}', 7) `);
|
|
85
|
+
@red-8: color(~`colorPalette('@{red-6}', 8) `);
|
|
86
|
+
@red-9: color(~`colorPalette('@{red-6}', 9) `);
|
|
87
|
+
@red-10: color(~`colorPalette('@{red-6}', 10) `);
|
|
88
|
+
|
|
89
|
+
@orange-base: #fa8c16;
|
|
90
|
+
@orange-1: color(~`colorPalette('@{orange-6}', 1) `);
|
|
91
|
+
@orange-2: color(~`colorPalette('@{orange-6}', 2) `);
|
|
92
|
+
@orange-3: color(~`colorPalette('@{orange-6}', 3) `);
|
|
93
|
+
@orange-4: color(~`colorPalette('@{orange-6}', 4) `);
|
|
94
|
+
@orange-5: color(~`colorPalette('@{orange-6}', 5) `);
|
|
95
|
+
@orange-6: @orange-base;
|
|
96
|
+
@orange-7: color(~`colorPalette('@{orange-6}', 7) `);
|
|
97
|
+
@orange-8: color(~`colorPalette('@{orange-6}', 8) `);
|
|
98
|
+
@orange-9: color(~`colorPalette('@{orange-6}', 9) `);
|
|
99
|
+
@orange-10: color(~`colorPalette('@{orange-6}', 10) `);
|
|
100
|
+
|
|
101
|
+
@yellow-base: #fadb14;
|
|
102
|
+
@yellow-1: color(~`colorPalette('@{yellow-6}', 1) `);
|
|
103
|
+
@yellow-2: color(~`colorPalette('@{yellow-6}', 2) `);
|
|
104
|
+
@yellow-3: color(~`colorPalette('@{yellow-6}', 3) `);
|
|
105
|
+
@yellow-4: color(~`colorPalette('@{yellow-6}', 4) `);
|
|
106
|
+
@yellow-5: color(~`colorPalette('@{yellow-6}', 5) `);
|
|
107
|
+
@yellow-6: @yellow-base;
|
|
108
|
+
@yellow-7: color(~`colorPalette('@{yellow-6}', 7) `);
|
|
109
|
+
@yellow-8: color(~`colorPalette('@{yellow-6}', 8) `);
|
|
110
|
+
@yellow-9: color(~`colorPalette('@{yellow-6}', 9) `);
|
|
111
|
+
@yellow-10: color(~`colorPalette('@{yellow-6}', 10) `);
|
|
112
|
+
|
|
113
|
+
@volcano-base: #fa541c;
|
|
114
|
+
@volcano-1: color(~`colorPalette('@{volcano-6}', 1) `);
|
|
115
|
+
@volcano-2: color(~`colorPalette('@{volcano-6}', 2) `);
|
|
116
|
+
@volcano-3: color(~`colorPalette('@{volcano-6}', 3) `);
|
|
117
|
+
@volcano-4: color(~`colorPalette('@{volcano-6}', 4) `);
|
|
118
|
+
@volcano-5: color(~`colorPalette('@{volcano-6}', 5) `);
|
|
119
|
+
@volcano-6: @volcano-base;
|
|
120
|
+
@volcano-7: color(~`colorPalette('@{volcano-6}', 7) `);
|
|
121
|
+
@volcano-8: color(~`colorPalette('@{volcano-6}', 8) `);
|
|
122
|
+
@volcano-9: color(~`colorPalette('@{volcano-6}', 9) `);
|
|
123
|
+
@volcano-10: color(~`colorPalette('@{volcano-6}', 10) `);
|
|
124
|
+
|
|
125
|
+
@geekblue-base: #2f54eb;
|
|
126
|
+
@geekblue-1: color(~`colorPalette('@{geekblue-6}', 1) `);
|
|
127
|
+
@geekblue-2: color(~`colorPalette('@{geekblue-6}', 2) `);
|
|
128
|
+
@geekblue-3: color(~`colorPalette('@{geekblue-6}', 3) `);
|
|
129
|
+
@geekblue-4: color(~`colorPalette('@{geekblue-6}', 4) `);
|
|
130
|
+
@geekblue-5: color(~`colorPalette('@{geekblue-6}', 5) `);
|
|
131
|
+
@geekblue-6: @geekblue-base;
|
|
132
|
+
@geekblue-7: color(~`colorPalette('@{geekblue-6}', 7) `);
|
|
133
|
+
@geekblue-8: color(~`colorPalette('@{geekblue-6}', 8) `);
|
|
134
|
+
@geekblue-9: color(~`colorPalette('@{geekblue-6}', 9) `);
|
|
135
|
+
@geekblue-10: color(~`colorPalette('@{geekblue-6}', 10) `);
|
|
136
|
+
|
|
137
|
+
@lime-base: #a0d911;
|
|
138
|
+
@lime-1: color(~`colorPalette('@{lime-6}', 1) `);
|
|
139
|
+
@lime-2: color(~`colorPalette('@{lime-6}', 2) `);
|
|
140
|
+
@lime-3: color(~`colorPalette('@{lime-6}', 3) `);
|
|
141
|
+
@lime-4: color(~`colorPalette('@{lime-6}', 4) `);
|
|
142
|
+
@lime-5: color(~`colorPalette('@{lime-6}', 5) `);
|
|
143
|
+
@lime-6: @lime-base;
|
|
144
|
+
@lime-7: color(~`colorPalette('@{lime-6}', 7) `);
|
|
145
|
+
@lime-8: color(~`colorPalette('@{lime-6}', 8) `);
|
|
146
|
+
@lime-9: color(~`colorPalette('@{lime-6}', 9) `);
|
|
147
|
+
@lime-10: color(~`colorPalette('@{lime-6}', 10) `);
|
|
148
|
+
|
|
149
|
+
@gold-base: #faad14;
|
|
150
|
+
@gold-1: color(~`colorPalette('@{gold-6}', 1) `);
|
|
151
|
+
@gold-2: color(~`colorPalette('@{gold-6}', 2) `);
|
|
152
|
+
@gold-3: color(~`colorPalette('@{gold-6}', 3) `);
|
|
153
|
+
@gold-4: color(~`colorPalette('@{gold-6}', 4) `);
|
|
154
|
+
@gold-5: color(~`colorPalette('@{gold-6}', 5) `);
|
|
155
|
+
@gold-6: @gold-base;
|
|
156
|
+
@gold-7: color(~`colorPalette('@{gold-6}', 7) `);
|
|
157
|
+
@gold-8: color(~`colorPalette('@{gold-6}', 8) `);
|
|
158
|
+
@gold-9: color(~`colorPalette('@{gold-6}', 9) `);
|
|
159
|
+
@gold-10: color(~`colorPalette('@{gold-6}', 10) `);
|
|
160
|
+
|
|
161
|
+
@preset-colors: pink, magenta, red, volcano, orange, yellow, gold, cyan, lime, green, blue, geekblue,
|
|
162
|
+
purple;
|