Open plantec opened 5 months ago
@Nyan11 👀
We can also use slots for this and I would avoid chaining md sys color shadow if this is just names. The first things would be to hide the use of valueOfTokenNamed: from the user and get "normal" variables.
In Style Dictionary not all pathes are values. For example:
color-background-red
can be equal in Pharo to ^Color red
.
But,
color-background
do not return anything
Therefor the chaining of messages is complicated because certain chains will return nothing.
The current style sheet rules are like this:
self
when: ToPressedLookEvent
write: (self property: #'background-color')
with: [ :e | e valueOfTokenNamed: #'color-primary-pressed' ]
animation: nil.
I suggest to do something like this:
self
when: ToPressedLookEvent
write: self properties backgroundColor
with: [ :e | e tokens colorPrimaryPressed ]
animation: nil.
We can also use slots for this and I would avoid chaining md sys color shadow if this is just names. The first things would be to hide the use of valueOfTokenNamed: from the user and get "normal" variables.
I like chaining of message sends instead of flatten names because it matches a token organization. to be discussed :)
The current style sheet rules are like this:
self when: ToPressedLookEvent write: (self property: #'background-color') with: [ :e | e valueOfTokenNamed: #'color-primary-pressed' ] animation: nil.
I suggest to do something like this:
self when: ToPressedLookEvent write: self properties backgroundColor with: [ :e | e tokens colorPrimaryPressed ] animation: nil.
self when: ToPressedLookEvent write: self properties backgroundColor with: [ :e | e palette primaryPressed ] animation: nil.
but I have to dig more
could you talk with marcus because I would like him to think about this?
Hello, did something happens about this?
I think not (:
No but it would be great to use slot to abstract this string base API. @tinchodias could you ping marcus?
it is based on a string. we should kill it. and use message instead. example in material design: md.sys.color.shadow
this could be implemented with: md sys color shadow
thus, getting the value of a token is simply done through message sending.
Now we need also a kind of infrastructure to specify the object hierarchies. As an example, Style dictionary would be a good approach see https://github.com/amzn/style-dictionary