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
#![allow(unused)]
pub const NUMERIC: &str = "Numeric";
pub const SIZE: &str = "Size";
pub const ROTATION: &str = "Rotation";
pub const STRING_BOX: &str = "StringBox";
pub const DEGREES: &str = "Degrees";
pub const RADIANS: &str = "Radians";
pub const PIXELS: &str = "Pixels";
pub const PERCENT: &str = "Percent";
pub const INTEGER: &str = "Integer";
pub const I64: &str = "I64";
pub const F64: &str = "F64";
pub const TRUE: &str = "true";
pub const COLOR: &str = "Color";
pub const COLOR_CHANNEL: &str = "ColorChannel";

pub const TYPE_ID_IF: &str = "IF";
pub const TYPE_ID_REPEAT: &str = "REPEAT";
pub const TYPE_ID_SLOT: &str = "SLOT";
pub const TYPE_ID_COMMENT: &str = "COMMENT";

pub const COMMON_PROPERTIES: [&str; 13] = [
    "id",
    "x",
    "y",
    "scale_x",
    "scale_y",
    "skew_x",
    "skew_y",
    "anchor_x",
    "anchor_y",
    "rotate",
    "transform",
    "width",
    "height",
];

pub fn is_intoable_downstream_type(type_to_check: &str) -> bool {
    BLESSED_INTOABLE_DOWNSTREAM_TYPES
        .iter()
        .any(|bidt| type_to_check.contains(*bidt))
}

// Only when parsing values for one of the types in this slice
// will we look ahead and parse for an IntoableLiteral value.
const BLESSED_INTOABLE_DOWNSTREAM_TYPES: [&'static str; 5] = [
    "pax_engine::api::Size",
    "pax_engine::api::Rotation",
    "pax_engine::api::ColorChannel",
    "pax_std::types::Stroke",
    "pax_std::types::Fill",
];

pub const COMMON_PROPERTIES_TYPE: [(&str, &str); 13] = [
    ("id", "String"),
    ("x", "pax_engine::api::Size"),
    ("y", "pax_engine::api::Size"),
    ("scale_x", "pax_engine::api::Size"),
    ("scale_y", "pax_engine::api::Size"),
    ("skew_x", "f64"),
    ("skew_y", "f64"),
    ("anchor_x", "pax_engine::api::Size"),
    ("anchor_y", "pax_engine::api::Size"),
    ("rotate", "pax_engine::api::Rotation"),
    ("transform", "pax_engine::api::Transform2D"),
    ("width", "pax_engine::api::Size"),
    ("height", "pax_engine::api::Size"),
];