Skip to content

Commit 4510e18

Browse files
committed
Add unit enum types
1 parent 8cd5b46 commit 4510e18

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

CSSObject/enums/IUnit.js

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/**
2+
* @enum IUnit
3+
* CSS Units of value
4+
*/
5+
const IUnit = {
6+
7+
/**
8+
* Others type of value
9+
*/
10+
NO_UNIT: 'NO_UNIT',
11+
12+
// Absolute Lengths
13+
14+
/** Centimeters Unit */
15+
CENTIMETERS: 'cm',
16+
17+
/** Millimetters Unit */
18+
MILLIMETERS: 'mm',
19+
20+
/** Inches Unit (1in = 96px = 2.54cm) */
21+
INCHES: 'in', //
22+
23+
/** Pixels Unit (1px = 1/96th of 1in) */
24+
PIXELS: 'px',
25+
26+
/** Points Unit (1pt = 1/72 of 1in) */
27+
28+
/** Picas Unit (1pc = 12 pt) */
29+
PICAS: 'pc',
30+
31+
// Relative Lengths
32+
33+
/**
34+
* Em Unit
35+
* Relative to the font-size of the element
36+
* (2em means 2 times the size of the current font)
37+
*/
38+
EM: 'em',
39+
40+
/**
41+
* Rem Unit
42+
* Relative to font-size of the root element
43+
*/
44+
REM: 'rem',
45+
46+
/**
47+
* Ex Unit
48+
* relative to the x-height of the current font (rarely used)
49+
*/
50+
EX: 'ex',
51+
52+
/**
53+
* Ch Unit
54+
* Relative to the width of the "0" (zero)
55+
*/
56+
CH: 'ch',
57+
58+
/** Viewport Width Unit */
59+
VIEWPORT_WIDTH: 'vw',
60+
61+
/**
62+
* Viewport Height Unit
63+
* (2 times the size of the current font)
64+
*/
65+
VIEWPORT_HEIGHT: 'vh',
66+
67+
/**
68+
* Viewport smaller dimension Unit
69+
* Relative to 1% of viewport's smaller dimension
70+
*/
71+
VMIN: 'vmin',
72+
73+
/**
74+
* Viewport larger dimension Unit
75+
* Relative to 1% of viewport's* larger dimension
76+
*/
77+
VMAX: 'vmax',
78+
79+
/**
80+
* Percentage Unit
81+
* Relative to the parent element
82+
*/
83+
PERCENTAGE: '%',
84+
85+
/**
86+
* Milliseconds Unit Time
87+
*/
88+
MILLISECONDS: 'ms',
89+
90+
/**
91+
* Seconds Unit Time
92+
*/
93+
SECONDS: 's',
94+
95+
}
96+
97+
98+
export default IUnit

0 commit comments

Comments
 (0)