-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathmaps.js
More file actions
121 lines (110 loc) · 2.53 KB
/
Copy pathmaps.js
File metadata and controls
121 lines (110 loc) · 2.53 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
/**
* Maps text alignment integer enums to human-readable strings
* @example
* textAlignmentMap.left // => 0
*/
const textAlignmentMap = {
left: 0,
right: 1,
center: 2,
justify: 3,
};
/**
* Maps text text behaviour integer enums to human-readable strings
* @example
* textBehaviourMap.auto // => 0
*/
const textBehaviourMap = {
auto: 0,
fixedWithOverlow: 1,
fixed: 2,
};
/**
* Maps text transform integer enums to human-readable strings
* @example
* textTransformMap.uppercase // => 1
*/
const textTransformMap = {
none: 0,
uppercase: 1,
lowercase: 2,
};
Object.keys(textAlignmentMap).forEach(key => {
textAlignmentMap[textAlignmentMap[key]] = key;
});
/**
* Maps vertical alignment int enums to human-readable strings
* @example
* verticalAlignmentMap.top // => 0
*/
const verticalAlignmentMap = {
top: 0,
bottom: 1,
center: 2,
};
Object.keys(verticalAlignmentMap).forEach(key => {
verticalAlignmentMap[verticalAlignmentMap[key]] = key;
});
/**
* Maps blend modes int enums to human-readable strings
* @example
* blendModeMap.multiply // => 2
*/
const blendModeMap = {
normal: 0,
darken: 1,
multiply: 2,
colorBurn: 3,
lighten: 4,
screen: 5,
colorDodge: 6,
overlay: 7,
softLight: 8,
hardLight: 9,
difference: 10,
exclusion: 11,
hue: 12,
saturation: 13,
luminosity: 14,
plusDarker: 15,
plusLighter: 16,
};
Object.keys(blendModeMap).forEach(key => {
blendModeMap[blendModeMap[key]] = key;
});
/**
* Maps resizing contrains int enums to human-readable strings
* @example
* resizingConstraintsMap.top // => 31
*/
const resizingConstraintsMap = {
top: 31,
right: 62,
bottom: 55,
left: 59,
width: 61,
height: 47,
none: 63,
};
const containsAllItems = (needles, haystack) => needles.every(needle => haystack.includes(needle));
module.exports = {
textAlignmentMap,
verticalAlignmentMap,
textTransformMap,
textBehaviourMap,
blendModeMap,
resizingConstraintsMap,
containsAllItems,
};