You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Several years ago I left a comment about Typed OM stuff wherein I suggested that the CSS namespace object could host very short constructors (/ factory functions) for the common dimensions.
That is, right now if you want to make a 5px length, you have to type:
let len = new CSSLengthValue.from(5, 'px');
//or
let len = new CSSSimpleLengthValue(5, 'px');
That's long and ugly and everyone will hate us if we force them to do that everywhere. My idea was to additionally allow:
let len = CSS.px(5);
Basically we'd just add functions to the CSS namespace object for all the dimensions CSS knows about. We can possibly add more for various functions, but it looks like we wouldn't gain much. Like, for transform stuff:
// Current
let trans = new CSSTranslation(CSS.px(5), CSS.px(10));
// Potential new?
let trans = CSS.translate(CSS.px(5), CSS.px(10));
It's a bit better, but not a huge win. It also suggests that we would need to add one for every single CSS function, and somehow deal with the potential places where the same function name means different things in different contexts. (I don't think there are any, but it's potentially allowed by CSS.) I'd be fine with ignoring this, at least unless/until we discover in the wild that people want it. In other words, L2 for this stuff, but L1 for the dimensions.
The text was updated successfully, but these errors were encountered:
Several years ago I left a comment about Typed OM stuff wherein I suggested that the CSS namespace object could host very short constructors (/ factory functions) for the common dimensions.
That is, right now if you want to make a 5px length, you have to type:
That's long and ugly and everyone will hate us if we force them to do that everywhere. My idea was to additionally allow:
Basically we'd just add functions to the
CSS
namespace object for all the dimensions CSS knows about. We can possibly add more for various functions, but it looks like we wouldn't gain much. Like, for transform stuff:It's a bit better, but not a huge win. It also suggests that we would need to add one for every single CSS function, and somehow deal with the potential places where the same function name means different things in different contexts. (I don't think there are any, but it's potentially allowed by CSS.) I'd be fine with ignoring this, at least unless/until we discover in the wild that people want it. In other words, L2 for this stuff, but L1 for the dimensions.
The text was updated successfully, but these errors were encountered: