;
53 | }
54 |
55 | export interface ExpandInteractiveArea {
56 | top?: number;
57 | left?: number;
58 | right?: number;
59 | bottom?: number;
60 | }
61 |
--------------------------------------------------------------------------------
/src/utils.ts:
--------------------------------------------------------------------------------
1 | export function isValidNumber(num?: number): num is number {
2 | return typeof num === 'number' && num === num;
3 | }
4 |
5 | export function noop() {}
6 |
7 | export function omit(
8 | props: P,
9 | ignoreKeys: K[],
10 | ): Omit
{
11 | type IgnoreKeyMap = Partial>;
12 |
13 | const ignoreKeyMap = ignoreKeys.reduce(
14 | (map, key) => {
15 | map[key] = true;
16 | return map;
17 | },
18 | {} as IgnoreKeyMap,
19 | );
20 |
21 | return (Object.keys(props) as (keyof P)[]).reduce(
22 | (newProps, key) => {
23 | if (ignoreKeyMap[key]) {
24 | return newProps;
25 | } else {
26 | newProps[key] = props[key];
27 | return newProps;
28 | }
29 | },
30 | {} as P,
31 | );
32 | }
33 |
--------------------------------------------------------------------------------
/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src"]
4 | }
5 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "dist/",
4 | "declaration": true,
5 | "removeComments": true,
6 | "preserveConstEnums": true,
7 | "allowSyntheticDefaultImports": true,
8 | "experimentalDecorators": true,
9 | "noUnusedParameters": true,
10 | "noUnusedLocals": true,
11 | "noImplicitAny": true,
12 | "strict": true,
13 | "noImplicitReturns": true,
14 | "moduleResolution": "node",
15 | "lib": ["dom", "es2015"],
16 | "jsx": "react",
17 | "target": "es5"
18 | },
19 | "include": ["src", "demo"]
20 | }
21 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "tslint-react",
4 | "tslint-eslint-rules",
5 | "tslint-sonarts"
6 | ],
7 | "defaultSeverity": "error",
8 | "rules": {
9 | "array-bracket-spacing": [true, "never", {
10 | "arraysInArrays": false,
11 | "singleValue": false,
12 | "objectsInArrays": false
13 | }],
14 | "jsx-boolean-value": false,
15 | "block-spacing": [true, "always"],
16 | "import-spacing": true,
17 | "no-boolean-literal-compare": true,
18 | "no-console": [true, "log", "time", "trace"],
19 | "no-duplicate-variable": true,
20 | "no-multi-spaces": true,
21 | "no-return-await": true,
22 | "no-string-literal": true,
23 | "no-string-throw": true,
24 | "no-trailing-whitespace": true,
25 | "no-unnecessary-initializer": true,
26 | "no-var-keyword": true,
27 | "object-curly-spacing": [true, "always"],
28 | "one-variable-per-declaration": [true, "ignore-for-loop"],
29 | "prefer-const": true,
30 | "quotemark": [true, "single", "jsx-double"],
31 | "ter-arrow-spacing": [true, { "before": true, "after": true }],
32 | "triple-equals": [true, "allow-null-check", "allow-undefined-check"],
33 | "whitespace": [
34 | true,
35 | "check-branch",
36 | "check-decl",
37 | "check-operator",
38 | "check-module",
39 | "check-separator",
40 | "check-rest-spread",
41 | "check-type",
42 | "check-typecast",
43 | "check-type-operator",
44 | "check-preblock"
45 | ],
46 | "interface-over-type-literal": true,
47 | "no-consecutive-blank-lines": true,
48 | "space-before-function-paren": [true, {
49 | "anonymous": "never",
50 | "named": "never",
51 | "asyncArrow": "always"
52 | }],
53 | "space-within-parens": [true, 0],
54 | "jsx-curly-spacing": [true, "never"],
55 | "jsx-no-multiline-js": false,
56 | "jsx-equals-spacing": false,
57 | "jsx-no-bind": true,
58 | "jsx-key": true,
59 | "jsx-no-lambda": true,
60 | "jsx-no-string-ref": true,
61 | "jsx-wrap-multiline": true,
62 | "jsx-self-close": true,
63 | "cognitive-complexity": false,
64 | "no-duplicate-string": false,
65 | "no-big-function": false,
66 | "no-small-switch": false,
67 | "max-union-size": [true, 20],
68 | "parameters-max-number": false
69 | }
70 | }
71 |
--------------------------------------------------------------------------------