-
Notifications
You must be signed in to change notification settings - Fork 63
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
Specification / recommendation for custom types #223
Comments
It's my understanding that the recommendation for custom types would be that you use one of the existing types as the {
"MyBlendingModeToken": {
"$type": "string",
"$value": "subtract",
"$extensions": {
"com.example.extendedtype": "blendingMode"
}
}
} That's how you would do it now—there are other issues open that propose various ways of formalizing custom types so that tools that have never heard of |
@lukasoppermann is there a problem, just to add your own type? I mean DTCG standardizes types but not restrict them. /**
* Grid token propoasal
*/
interface GridTokenI extends GenericTokenI {
$type: "grid";
$value: {
columnCount?: number;
columnGap?: DimensionStringType;
columnWidth?: DimensionStringType;
columnMargin?: DimensionStringType;
rowCount?: number;
rowGap?: DimensionStringType;
rowHeight?: DimensionStringType;
rowMargin?: DimensionStringType;
};
}
/**
* Blur token propoasal
*/
interface BlurTokenI extends GenericTokenI {
$type: "blur";
$value: {
role: "layer" | "background";
blur: DimensionStringType;
};
} |
@PavelLaptev this is what I currently do. I just add custom- before the type, so custom-grid. I just figured it would be great if there was a way that was defined so that it would never clash with spec types that get added. Similar to how web components need to be two words with a dash to make sure future html components don't conflict with web components. @TravisSpomer I didn't know about that, I use extensions for some other metadata but this of course makes sense in a way. Just a bit cumbersome and how would I use it for objects? There is no object type, is there? |
@lukasoppermann understand, but until there is no |
Currently the specs only cover a fairly small amount of possible token types. This makes total sense considering how the specification process works.
However from a user and tool developer perspective I very often run into situations where I have to move beyond what is specified.
One typical case is when tokens for types that are not defined are needed.
I think it would be valuable for this case to define how one should create custom types.
The main issue I see is how to create a custom
$type
property name?Additionally it would be interesting when it is recommended to use composite types, vs. e.g. an array for multiple numeric values.
The text was updated successfully, but these errors were encountered: