forked from daybrush/selecto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsts.ts
99 lines (93 loc) · 1.93 KB
/
consts.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import styled from "css-styled";
import { SelectoOptions } from "./types";
export const injector = styled(`
:host {
position: fixed;
display: none;
border: 1px solid #4af;
background: rgba(68, 170, 255, 0.5);
z-index: 100;
}
:host {
position: absolute;
}
`);
/**
* @memberof Selecto
*/
export const CLASS_NAME = `selecto-selection ${injector.className}`;
export const PROPERTIES = [
"boundContainer",
"selectableTargets",
"selectByClick",
"selectFromInside",
"continueSelect",
"toggleContinueSelect",
"keyContainer",
"hitRate",
"scrollOptions",
"checkInput",
"preventDefault",
"ratio",
"getElementRect",
"preventDragFromInside",
"rootContainer",
"dragCondition",
] as const;
/**
* @memberof Selecto
*/
export const OPTIONS = [
// ignore target, container,
"dragContainer",
"cspNonce",
...PROPERTIES,
] as const;
export const OPTION_TYPES: { [key in keyof SelectoOptions]: any } = {
boundContainer: null,
target: null,
container: null,
dragContainer: null,
selectableTargets: Array,
selectByClick: Boolean,
selectFromInside: Boolean,
continueSelect: Boolean,
toggleContinueSelect: Array,
keyContainer: null,
hitRate: Number,
scrollOptions: Object,
checkInput: Boolean,
preventDefault: Boolean,
cspNonce: String,
ratio: Number,
getElementRect: Function,
preventDragFromInside: Boolean,
rootContainer: Object,
dragCondition: Function,
};
/**
* @memberof Selecto
*/
export const EVENTS = [
"dragStart",
"drag",
"dragEnd",
"selectStart",
"select",
"selectEnd",
"keydown",
"keyup",
"scroll",
] as const;
/**
* @memberof Selecto
*/
export const METHODS = [
"clickTarget",
"getSelectableElements",
"setSelectedTargets",
"getElementPoints",
"getSelectedTargets",
"findSelectableTargets",
"triggerDragStart",
] as const;