Skip to content

Commit

Permalink
merging issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vrrashkov committed Jul 3, 2023
1 parent 0889304 commit 6334536
Show file tree
Hide file tree
Showing 12 changed files with 210 additions and 505 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "design_token_parser"
version = "3.1.1"
version = "3.1.2"
edition = "2021"
repository = "https://github.com/vrrashkov/TokenParser"
readme = "README.md"
Expand Down
124 changes: 64 additions & 60 deletions assets/design_tokens_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ global:
files:
- "assets/figma/variables/button-sm.json"
- "assets/figma/variables/core-.json"
- combine:
file_name: "color-light"
files:
- "assets/figma/variables/color-accent-primary.json"
- "assets/figma/variables/color-accent-secondary.json"
- "assets/figma/variables/color-status-success.json"
- "assets/figma/variables/color-status-danger.json"
- "assets/figma/variables/color-light.json"
- "assets/figma/variables/palette-.json"
# - combine:
# file_name: "color-light"
# files:
# - "assets/figma/variables/color-accent-primary.json"
# - "assets/figma/variables/color-accent-secondary.json"
# - "assets/figma/variables/color-status-success.json"
# - "assets/figma/variables/color-status-danger.json"
# - "assets/figma/variables/color-light.json"
# - "assets/figma/variables/palette-.json"
- combine:
file_name: "color-dark"
files:
Expand All @@ -56,20 +56,20 @@ global:
file_name: "button-sm"
files:
- path: "assets/figma/variables/button-sm.json"
- combine:
file_name: "color-light"
files:
- path: "assets/figma/variables/color-accent-primary.json"
# if mode is set this will wrap the whole json object with a parent of the mode's value
# this helps if you have similar trees in multiple files
mode: "primary"
- path: "assets/figma/variables/color-accent-secondary.json"
mode: "secondary"
- path: "assets/figma/variables/color-status-success.json"
mode: "success"
- path: "assets/figma/variables/color-status-danger.json"
mode: "danger"
- path: "assets/figma/variables/color-light.json"
# - combine:
# file_name: "color-light"
# files:
# - path: "assets/figma/variables/color-accent-primary.json"
# # if mode is set this will wrap the whole json object with a parent of the mode's value
# # this helps if you have similar trees in multiple files
# mode: "primary"
# - path: "assets/figma/variables/color-accent-secondary.json"
# mode: "secondary"
# - path: "assets/figma/variables/color-status-success.json"
# mode: "success"
# - path: "assets/figma/variables/color-status-danger.json"
# mode: "danger"
# - path: "assets/figma/variables/color-light.json"
- combine:
file_name: "color-dark"
files:
Expand Down Expand Up @@ -102,46 +102,50 @@ templates:
# For themes
- type: color
value: "public static let {{variable_name | camel}} = {{value | color: 'Color(red: rgb_r_v1, green: rgb_g_v1, blue: rgb_b_v1, opacity: rgb_a_v1)'}} {{description | optional: '// desc = %value'}}"
# For Core
- type: string
value: "public static let {{variable_name | camel}} = {{value}} {{description | optional: '// desc = %value'}}"
- type: float
value: "public static let {{variable_name | camel}} = CGFloat({{value | as_text_or_number}}) {{description | optional: '// desc = %value'}}"
- type: boolean
value: "public static let {{variable_name | camel}} = {{value}} {{description | optional: '// desc = %value'}}"
# More complex templates
# Object
# {{easingFunction | empty}} use empty filter to initialize variable if you need it in the scope of the template without printing it
- type: "custom-transition"
value: "public static let {{variable_name | camel}} = CustomTransition(duration: {{duration}},
{{easingFunction | empty}}
x1: CGFloat({{easingFunction.x1}}),
x2: CGFloat({{easingFunction.x2}}),
y1: CGFloat({{easingFunction.y1}}),
y2: CGFloat({{easingFunction.y2}}))
"
# Array
# {{stops | empty}} use empty filter to initialize variable if you need it in the scope of the template without printing it
- type: "custom-gradient"
value: "public static let {{variable_name | camel}} = CustomGradient(gradientType: {{gradientType}}, rotation: {{rotation}},
{{stops | empty}}
- type: boxShadow
value:
- "public static let {{variable_name | camel}} = Shadow(x: CGFloat({{x-0}}), y: CGFloat({{y-0}}), color: Color(hex: \"{{color-0 | color: 'hex'}}\"), radius: CGFloat({{blur-0}}))"
- "public static let {{variable_name | camel}} = [Shadow(x: CGFloat({{x-0}}), y: CGFloat({{y-0}}), color: Color(hex: \"{{color-0 | color: 'hex'}}\"), radius: CGFloat({{blur-0}})), Shadow(x: CGFloat({{x-1}}), y: CGFloat({{y-1}}), color: Color(hex: \"{{color-1 | color: 'hex'}}\"), radius: CGFloat({{blur-1}}))]"
# # For Core
# - type: string
# value: "public static let {{variable_name | camel}} = {{value}} {{description | optional: '// desc = %value'}}"
# - type: float
# value: "public static let {{variable_name | camel}} = CGFloat({{value | as_text_or_number}}) {{description | optional: '// desc = %value'}}"
# - type: boolean
# value: "public static let {{variable_name | camel}} = {{value}} {{description | optional: '// desc = %value'}}"
# # More complex templates
# # Object
# # {{easingFunction | empty}} use empty filter to initialize variable if you need it in the scope of the template without printing it
# - type: "custom-transition"
# value: "public static let {{variable_name | camel}} = CustomTransition(duration: {{duration}},
# {{easingFunction | empty}}
# x1: CGFloat({{easingFunction.x1}}),
# x2: CGFloat({{easingFunction.x2}}),
# y1: CGFloat({{easingFunction.y1}}),
# y2: CGFloat({{easingFunction.y2}}))
# "
# # Array
# # {{stops | empty}} use empty filter to initialize variable if you need it in the scope of the template without printing it
# - type: "custom-gradient"
# value: "public static let {{variable_name | camel}} = CustomGradient(gradientType: {{gradientType}}, rotation: {{rotation}},
# {{stops | empty}}

color1: Style1(
{% for stop in stops %}
# color1: Style1(
# {% for stop in stops %}

{{stop.color | color: 'Color(red: rgb_r_v1, green: rgb_g_v1, blue: rgb_b_v1, opacity: rgb_a_v1)'}}
{% if forloop.last == false -%}, {% endif %}
{% endfor -%}
),
# {{stop.color | color: 'Color(red: rgb_r_v1, green: rgb_g_v1, blue: rgb_b_v1, opacity: rgb_a_v1)'}}
# {% if forloop.last == false -%}, {% endif %}
# {% endfor -%}
# ),

color2: Style2(
{% assign colors = stops | map: 'color' %}
{% for item in colors %}
# color2: Style2(
# {% assign colors = stops | map: 'color' %}
# {% for item in colors %}

{{item | color: 'Color(red: rgb_r_v2, green: rgb_g_v2, blue: rgb_b_v2, opacity: rgb_a_v2)'}}
{% if forloop.last == false -%}, {% endif %}
{% endfor %}
)
"
# {{item | color: 'Color(red: rgb_r_v2, green: rgb_g_v2, blue: rgb_b_v2, opacity: rgb_a_v2)'}}
# {% if forloop.last == false -%}, {% endif %}
# {% endfor %}
# )
# "


179 changes: 32 additions & 147 deletions assets/figma/variables/color-dark.json
Original file line number Diff line number Diff line change
@@ -1,153 +1,38 @@
{
"success": {
"hover": {
"bg": {
"type": "color",
"value": "{dark.success.success}",
"description": ""
},
"text": {
"type": "color",
"value": "{dark.success.fr.l60}",
"description": ""
}
},
"disabled": {
"bg": {
"type": "color",
"value": "{dark.success.fr.l45}",
"description": ""
},
"text": {
"type": "color",
"value": "{dark.success.bg}",
"description": ""
}
},
"text": {
"type": "color",
"value": "{dark.success.fr.l60}",
"description": ""
},
"bg": {
"type": "color",
"value": "{dark.success.bg}",
"description": ""
}
},
"danger": {
"hover": {
"bg": {
"type": "color",
"value": "{dark.danger.hover}",
"description": ""
},
"text": {
"type": "color",
"value": "{dark.danger.fr.l60}",
"description": ""
}
},
"disabled": {
"bg": {
"type": "color",
"value": "{dark.danger.fr.l30}",
"description": ""
},
"text": {
"type": "color",
"value": "{dark.danger.bg}",
"description": ""
}
},
"text": {
"type": "color",
"value": "{dark.danger.fr.l60}",
"description": ""
},
"bg": {
"type": "color",
"value": "{dark.danger.bg}",
"description": ""
}
},
"secondary": {
"hover": {
"bg": {
"type": "color",
"value": "{dark.accent2.hover}",
"description": ""
},
"text": {
"type": "color",
"value": "{dark.accent2.fr.l75}",
"description": ""
}
},
"disabled": {
"bg": {
"type": "color",
"value": "{dark.accent2.fr.l60}",
"description": ""
},
"text": {
"type": "color",
"value": "{dark.accent2.bg}",
"description": ""
}
},
"bg": {
"type": "color",
"value": "{dark.accent2.bg}",
"description": ""
},
"text": {
"type": "color",
"value": "{dark.accent2.fr.l75}",
"description": ""
}
},
"primary": {
"hover": {
"bg": {
"type": "color",
"value": "{dark.accent1.hover}",
"description": ""
},
"text": {
"type": "color",
"value": "{dark.accent1.fr.l60}",
"description": ""
}
},
"disabled": {
"text": {
"type": "color",
"value": "{dark.accent1.bg}",
"description": ""
},
"bg": {
"type": "color",
"value": "{dark.accent1.fr.l60}",
"description": ""
}
},
"text": {
"type": "color",
"value": "{dark.accent1.fr.l60}",
"description": ""
},
"bg": {
"type": "color",
"value": "{dark.accent1.bg}",
"description": ""
"reg": {
"home": {
"card": {
"type": "boxShadow",
"value": {
"blur": "10",
"color": "rgba(0,0,0,0.25)",
"spread": "0",
"type": "dropShadow",
"x": "0",
"y": "4"
}
}
}
},
"box": {
"neutral1": {
"type": "color",
"value": "{dark.n1.bg}",
"description": ""
"tabBar": {
"type": "boxShadow",
"value": [
{
"blur": "20",
"color": "rgba(0,0,0,0.1)",
"spread": "0",
"type": "dropShadow",
"x": "0",
"y": "0"
},
{
"blur": "8",
"color": "rgba(0,0,0,0.1)",
"spread": "0",
"type": "dropShadow",
"x": "0",
"y": "4"
}
]
}
}
Loading

0 comments on commit 6334536

Please sign in to comment.