Closed pinguet62 closed 9 months ago
Hi @pinguet62 , Thank you for your message and your suggestion.
We're currently planning to remove the JS tokens from the @next
version because we didn't think many people were using them.
So I'm interested to know what your use case is, to see if we need to revise our plan to remove them.
We'd be happy to talk about it :)
My use case is to reuse Mozaic's color in <MIcon color="..."
and in border/line chart.
Because I cannot reuse SCSS variables in <script>
/<template>
.
It's a limited usage (20 occurrences) but I prefered this workaround instead of copy/past RGB value. I wouldn't be disappointed if it disappeared 😉
But probably you have any other solution?
(we are waiting for @next
since 1 year 😉)
Treated with in Tokens v2
Hello @tiloyi You told me v2 for May 2023. Any news? 😜
Hi @pinguet62 , The scope and provisional timetable for V2 was announced a few months ago on Workplace.
The core redevelopment phase is due to be completed at the end of Q1.
We'll soon start organising demos and information sessions to explain & show all details.
I want to propose an evolution/improvement on
Design Tokens
Description
If I have to use a Mozaic token value, for example a color, in my application I have multiple solutions:
@mozaic-ds/tokens/build/js/token.js
In TypeScript, a solution is
But:
mozaicTokens.ColorWarning600
isstring | undefined
string
: for exampleBorderS
isnumber
, then complexdeclare module
to maintain...Describe the solution you would like
Have a type-safe solution when reuse constants like:
Describe the alternatives you considered
Better solution
Use
typescript/es6-declarations
export type of style-dictionary lib.This can be done simply by adding this line in configuration in
@mozaic-ds/tokens/config.js
in sectionconfig/platforms/js/files
:Other alternative
Like the
token.js
is a simple list of constants, the file can be simply duplicated/renamed.I tried this script in my project, but it's not beautifull:
Additional comments
I test solution locally and this seem work perfectly 👌 I can do a Pull Request if you want 😉