@@ -52,44 +52,60 @@ defmodule Scenic.Primitive.Style do
52
52
53
53
# import IEx
54
54
55
- @ type t :: % { atom => any }
55
+ @ type t :: % {
56
+ [
57
+ :cap
58
+ | :fill
59
+ | :font
60
+ | :font_size
61
+ | :hidden
62
+ | :input
63
+ | :join
64
+ | :line_height
65
+ | :miter_limit
66
+ | :scissor
67
+ | :stroke
68
+ | :text_align
69
+ | :text_base
70
+ | :theme
71
+ ] => any
72
+ }
56
73
57
74
@ opts_map % {
58
- :input => Style.Input ,
59
- :hidden => Style.Hidden ,
60
- :texture_wrap => Style.TextureWrap ,
61
- :texture_filter => Style.TextureFilter ,
75
+ :cap => Style.Cap ,
62
76
:fill => Style.Fill ,
63
- :stroke => Style.Stroke ,
77
+ :font => Style.Font ,
78
+ :font_size => Style.FontSize ,
79
+ :hidden => Style.Hidden ,
80
+ :input => Style.Input ,
64
81
:join => Style.Join ,
65
- :cap => Style.Cap ,
66
82
:line_height => Style.LineHeight ,
67
83
:miter_limit => Style.MiterLimit ,
68
- :font => Style.Font ,
69
- :font_blur => Style.FontBlur ,
70
- :font_size => Style.FontSize ,
84
+ :scissor => Style.Scissor ,
85
+ :stroke => Style.Stroke ,
71
86
:text_align => Style.TextAlign ,
72
87
:text_base => Style.TextBase ,
73
- # :text_height => Style.TextHeight,
74
- :scissor => Style.Scissor ,
75
88
:theme => Style.Theme
76
89
}
77
90
91
+ @ valid_styles @ opts_map
92
+ |> Enum . map ( fn { k , _v } -> k end )
93
+ |> Enum . sort ( )
94
+
78
95
@ opts_schema [
79
- input: [ type: { :custom , Style.Input , :validate , [ ] } ] ,
80
- hidden: [ type: { :custom , Style.Hidden , :validate , [ ] } ] ,
96
+ cap: [ type: { :custom , Style.Cap , :validate , [ ] } ] ,
81
97
fill: [ type: { :custom , Style.Fill , :validate , [ ] } ] ,
82
- stroke: [ type: { :custom , Style.Stroke , :validate , [ ] } ] ,
98
+ font: [ type: { :custom , Style.Font , :validate , [ ] } ] ,
99
+ font_size: [ type: { :custom , Style.FontSize , :validate , [ ] } ] ,
100
+ hidden: [ type: { :custom , Style.Hidden , :validate , [ ] } ] ,
101
+ input: [ type: { :custom , Style.Input , :validate , [ ] } ] ,
83
102
join: [ type: { :custom , Style.Join , :validate , [ ] } ] ,
84
- cap: [ type: { :custom , Style.Cap , :validate , [ ] } ] ,
85
103
line_height: [ type: { :custom , Style.LineHeight , :validate , [ ] } ] ,
86
104
miter_limit: [ type: { :custom , Style.MiterLimit , :validate , [ ] } ] ,
87
- font : [ type: { :custom , Style.Font , :validate , [ ] } ] ,
88
- font_size : [ type: { :custom , Style.FontSize , :validate , [ ] } ] ,
105
+ scissor : [ type: { :custom , Style.Scissor , :validate , [ ] } ] ,
106
+ stroke : [ type: { :custom , Style.Stroke , :validate , [ ] } ] ,
89
107
text_align: [ type: { :custom , Style.TextAlign , :validate , [ ] } ] ,
90
108
text_base: [ type: { :custom , Style.TextBase , :validate , [ ] } ] ,
91
- # text_height: [type: {:custom, Style.TextHeight, :validate, []}],
92
- scissor: [ type: { :custom , Style.Scissor , :validate , [ ] } ] ,
93
109
theme: [ type: { :custom , Style.Theme , :validate , [ ] } ]
94
110
]
95
111
@@ -101,6 +117,9 @@ defmodule Scenic.Primitive.Style do
101
117
@ doc false
102
118
def opts_schema ( ) , do: @ opts_schema
103
119
120
+ @ doc "List of the valid style types"
121
+ def valid_styles ( ) , do: @ valid_styles
122
+
104
123
# --------------------------------------------------------
105
124
@ default_styles % {
106
125
font: :roboto ,
0 commit comments