Skip to content
This repository was archived by the owner on Dec 28, 2022. It is now read-only.

Commit 23436f1

Browse files
author
Jiří Třečák
committed
Added base structure for the entire exporter, plus blueprint stubs with comments about what it does in place (no implementation just yet)
1 parent d2baf61 commit 23436f1

16 files changed

+288
-3
lines changed

exporter.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"supernova": "1.0.0"
1717
},
1818
"tags": [
19-
"Flutter"
19+
"CSS",
20+
"Tokens",
21+
"Styles"
2022
]
2123
}

output.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,31 @@
22
"blueprints": [
33
{
44
"invoke": "colors.pr",
5-
"write_to": "styles/colors.css"
5+
"write_to": "colors.css"
6+
},
7+
{
8+
"invoke": "borders.pr",
9+
"write_to": "borders.css"
10+
},
11+
{
12+
"invoke": "gradients.pr",
13+
"write_to": "gradients.css"
14+
},
15+
{
16+
"invoke": "measures.pr",
17+
"write_to": "measures.css"
18+
},
19+
{
20+
"invoke": "radii.pr",
21+
"write_to": "radii.css"
22+
},
23+
{
24+
"invoke": "shadows.pr",
25+
"write_to": "shadows.css"
26+
},
27+
{
28+
"invoke": "typography.pr",
29+
"write_to": "typography.css"
630
}
731
]
832
}

src/borders.pr

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{*
2+
3+
Generate all tokens as named variables.
4+
Tokens are named by their group path and then name,
5+
and their value rendered using `rendered-color` blueprint
6+
7+
*}

src/colors.pr

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
{* Export example code goes here *}
1+
{*
2+
3+
Generate all tokens as named variables.
4+
Tokens are named by their group path and then name,
5+
and their value rendered using `rendered-color` blueprint
6+
7+
*}

src/gradients.pr

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{*
2+
3+
Generate all tokens as named variables.
4+
Tokens are named by their group path and then name,
5+
and their value rendered using `rendered-color` blueprint
6+
7+
*}

src/measures.pr

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{*
2+
3+
Generate all tokens as named variables.
4+
Tokens are named by their group path and then name,
5+
and their value rendered using `rendered-color` blueprint
6+
7+
*}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{*
2+
3+
Rendered to present Border token as CSS string.
4+
Note that this only converts the value, actual name is provided somewhere else
5+
6+
7+
Source data: Border Value (https://developers.supernova.io/design-system-data/tokens/borders)
8+
Note: Value is passed as `context` property because it is injected
9+
10+
{
11+
"context": {
12+
"color": {
13+
"hex": string
14+
"r": int (0-255),
15+
"g": int (0-255),
16+
"b": int (0-255),
17+
"a": int (0-255),
18+
"referencedToken": Color | null
19+
},
20+
"width": {
21+
"unit": "px",
22+
"measure": double
23+
"referencedToken": Measure | null
24+
},
25+
"position": "Inside" | "Center" | "Outside"
26+
"referencedToken": Border | null
27+
}
28+
}
29+
30+
31+
Rendered as:
32+
33+
Xpx solid (rendered-color.pr);
34+
35+
*}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{*
2+
3+
Renderer to convert Color token as CSS string.
4+
Note that this only converts the value, actual name is provided somewhere else
5+
6+
7+
Source data: Color Value (https://developers.supernova.io/design-system-data/tokens/colors)
8+
Note: Value is passed as `context` property because it is injected
9+
10+
{
11+
Note: Value is passed as `context` because it is injected
12+
"context": {
13+
"hex": string
14+
"r": int (0-255),
15+
"g": int (0-255),
16+
"b": int (0-255),
17+
"a": int (0-255),
18+
"referencedToken": Color | null
19+
}
20+
}
21+
22+
23+
Rendered as:
24+
25+
#XXXXXX if it is fully opaque color
26+
rgba(r, g, b, a) if it is semi-transparent color
27+
28+
*}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{*
2+
3+
Rendered to present Gradient token as CSS string.
4+
Note that this only converts the value, actual name is provided somewhere else
5+
6+
7+
Source data: Color Value (https://developers.supernova.io/design-system-data/tokens/gradients)
8+
Note: Value is passed as `context` property because it is injected
9+
10+
{
11+
"value": {
12+
"from": {
13+
"x": double
14+
"y": double
15+
},
16+
"to": {
17+
"x": double
18+
"y": double
19+
},
20+
"type": "Linear" | "Radial" | "Angular",
21+
"aspectRatio": double
22+
"stops": [Gradient Stop],
23+
"referencedToken": Gradient | null
24+
}
25+
}
26+
27+
28+
Rendered as:
29+
30+
Xpx solid (rendered-color.pr);
31+
32+
*}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{*
2+
3+
Rendered to present Measure token as CSS string.
4+
Note that this only converts the value, actual name is provided somewhere else
5+
6+
7+
Source data: Measure Value (https://developers.supernova.io/design-system-data/tokens/measures)
8+
Note: Value is passed as `context` property because it is injected
9+
10+
{
11+
"context": {
12+
"unit": "Pixels" | "Points" | "Percent" | "Ems",
13+
"measure": double
14+
"referencedToken": Measure | null
15+
}
16+
}
17+
18+
*}

0 commit comments

Comments
 (0)