Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#valueOfTokenNamed: is crappy #156

Open
plantec opened this issue Jun 14, 2024 · 11 comments
Open

#valueOfTokenNamed: is crappy #156

plantec opened this issue Jun 14, 2024 · 11 comments

Comments

@plantec
Copy link
Collaborator

plantec commented Jun 14, 2024

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

@labordep
Copy link
Collaborator

@Nyan11 👀

@Ducasse
Copy link
Contributor

Ducasse commented Jun 14, 2024

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.

@Nyan11
Copy link
Collaborator

Nyan11 commented Jun 14, 2024

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

@Nyan11
Copy link
Collaborator

Nyan11 commented Jun 14, 2024

Therefor the chaining of messages is complicated because certain chains will return nothing.

@Nyan11
Copy link
Collaborator

Nyan11 commented Jun 14, 2024

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.

@plantec
Copy link
Collaborator Author

plantec commented Jun 14, 2024

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 :)

@plantec
Copy link
Collaborator Author

plantec commented Jun 14, 2024

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

@Ducasse
Copy link
Contributor

Ducasse commented Jun 16, 2024

could you talk with marcus because I would like him to think about this?

@tinchodias
Copy link
Collaborator

Hello, did something happens about this?

@labordep
Copy link
Collaborator

I think not (:

@Ducasse
Copy link
Contributor

Ducasse commented Sep 26, 2024

No but it would be great to use slot to abstract this string base API.
@tinchodias could you ping marcus?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants