-
-
Notifications
You must be signed in to change notification settings - Fork 634
/
Copy pathindex.ts
45 lines (41 loc) · 1.33 KB
/
index.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
/* If editing these values check babel-plugin-also */
export const enum VNodeFlags {
/* First set of bits define shape of vNode */
HtmlElement = 1,
ComponentUnknown = 1 << 1,
ComponentClass = 1 << 2,
ComponentFunction = 1 << 3,
Text = 1 << 4,
/* Special flags */
SvgElement = 1 << 5,
InputElement = 1 << 6,
TextareaElement = 1 << 7,
SelectElement = 1 << 8,
Void = 1 << 9,
Portal = 1 << 10,
ReCreate = 1 << 11,
ContentEditable = 1 << 12,
Fragment = 1 << 13,
InUse = 1 << 14,
ForwardRef = 1 << 15,
Normalized = 1 << 16,
/* Masks */
ForwardRefComponent = ForwardRef | ComponentFunction,
FormElement = InputElement | TextareaElement | SelectElement,
Element = HtmlElement | SvgElement | FormElement,
Component = ComponentFunction | ComponentClass | ComponentUnknown,
DOMRef = Element | Text | Void | Portal,
InUseOrNormalized = InUse | Normalized,
ClearInUse = ~InUse
}
// Combinations are not possible, its bitwise only to reduce vNode size
export const enum ChildFlags {
UnknownChildren = 0, // When zero is passed children will be normalized
/* Second set of bits define shape of children */
HasInvalidChildren = 1,
HasVNodeChildren = 1 << 1,
HasNonKeyedChildren = 1 << 2,
HasKeyedChildren = 1 << 3,
HasTextChildren = 1 << 4,
MultipleChildren = HasNonKeyedChildren | HasKeyedChildren
}