- From: CSS Meeting Bot via GitHub <sysbot+gh@w3.org>
- Date: Thu, 26 Sep 2024 16:37:21 +0000
- To: public-css-archive@w3.org
The CSS Working Group just discussed `Proposal: Custom CSS Functions & Mixins`. <details><summary>The full IRC log of that discussion</summary> <emeyer> TabAtkins: We agreed to take on functions & mixins specification<br> <emeyer> …At this point, we have a first-draft spec for functions, but not mixins<br> <emeyer> …Not looking for resolutions, just a quick runthrough<br> <emeyer> …Custom functions are defined using an @function rule with a double-dashed identifier<br> <emeyer> …Something it resolved, a value is passed in, calculations are done, the result is passed out<br> <emeyer> …The full syntax is a little larger<br> <emeyer> …IN addition to a parameter list, there’s a dependency list<br> <emeyer> …Particularly from Lea’s feedback, it’s common to want to use defined system variables<br> <emeyer> …Having to pass them to every function is frustrating<br> <emeyer> …Functions can declare they will implicitly pull in extra variables<br> <emeyer> …Can also declare its return type<br> <emeyer> …If the custom function resolves to the wrong thing, we can detect that and act on it<br> <emeyer> …After the fact, if we see something wrong, we invalidate<br> <emeyer> …at use time<br> <lea> q+<br> <emeyer> …Just like in the other descriptor, if there are multiple results, the last one is what resolves to the value<br> <emeyer> …Conditional rules are permitted<br> <emeyer> …Things like media queries can go inside<br> <kbabbitt> draft is at https://drafts.csswg.org/css-mixins-1/<br> <emeyer> florian: Local variables, order doesn’t matter?<br> <emeyer> TabAtkins: Correct, they’re orderless<br> <emeyer> florian: I suspect this is correct, but is likely to confuse<br> <emilio> q+<br> <emeyer> TabAtkins: We hope that the fact it looks like regular styles will guide people to the right behavior<br> <emeyer> lea: SSometimes you need to access certain contexts, but the grammar looks to me like it’s easier to pass in by using<br> <emeyer> TabAtkins: You don’t pass in anything that way<br> <emeyer> …They’re automatically added to arguments at the call site<br> <emeyer> lea: It might be useful to have an aggregate syntax<br> <emeyer> TabAtkins: Please open an issue for that<br> <emeyer> s/SSometimes/Sometimes/<br> <astearns> ack lea<br> <emeyer> TabAtkins: We have a return type for the function itself<br> <lea> q+<br> <emeyer> …You can also declare grammars for individual arguments<br> <emeyer> …If you call with the wrong thing, it will invalidate the functoin<br> <emeyer> …There’s a syntax that looks like CSS grammar<br> <florian> q+ to ask what happens if you have multiple return descriptors and only one of them matches the declared type<br> <emeyer> …Authors don’t like wrapping in a string<br> <astearns> q+<br> <emeyer> …Basically, the grammar looks like custom property registrations<br> <emeyer> …There’s no change in functionality, but you don’t need to wrap in quotes<br> <lea> q+ to ask about system colors (canvas, canvastext) and currentcolor, relative units<br> <emeyer> …So you declare functions, they can use conditional queries<br> <emeyer> …If you rewrite appropriately, this should be equivalent to dropping in a nesting block<br> <Penny> (There is a noise suppression setting on the Zoom control panel set to enabled, but making changes is password protected. We'll need to engage tech support to disable it.)<br> <emeyer> …Questions?<br> <emeyer> emilio: This is a descriptor, not a property?<br> <emeyer> TabAtkins: Right<br> <emeyer> emilio: We need to sort out how this operates on the CSSOM<br> <emeyer> TabAtkins: Yeah, there could be some clashes there<br> <emeyer> emilio: This should look a lot like a style rule, right?<br> <emeyer> TabAtkins: Body will be llike a style declaration<br> <emeyer> emilio: That makes implementation... fun, but okay<br> <emeyer> s/llike/like/<br> <emeyer> lea: Making sure, system colors would resolve based on the color scheme when this is used?<br> <astearns> ack emilio<br> <astearns> ack lea<br> <Zakim> lea, you wanted to ask about system colors (canvas, canvastext) and currentcolor, relative units<br> <emeyer> TabAtkins: Yes, they’re based on the element the function is applied to<br> <matthieud> q+<br> <emeyer> …Because of the clash between functions and wider variables, vars in the body are references to (missed by scribe)<br> <astearns> ack florian<br> <Zakim> florian, you wanted to ask what happens if you have multiple return descriptors and only one of them matches the declared type<br> <lea> q+ to say the current grammar for using allows declaring types, is that intentional?<br> <emeyer> florian: If you have declared integer type and multiple returns, do you check them all against type and return the last valid or only check the last one returned against the type?<br> <emeyer> TabAtkins: I’m not sure, but I think we have flexibility<br> <fantasai> I think we want to match the type.<br> <emeyer> …We want to be consistent with other things so probably the second, but we’re not locked in either way<br> <emeyer> fantasai: I think we should take the last one that does match the type<br> <romain> +1<br> <emeyer> …They might try to do forward opt-in, which would break if we don’t do it that way<br> <kbabbitt> +1 fantasai<br> <astearns> ack astearns<br> <emeyer> astearns: The new non-string representation will also be available for custom property registration?<br> <emeyer> TabAtkins: Yes<br> <astearns> ack matthieud<br> <emeyer> matthieud: Can you only define functions at the root?<br> <emeyer> …And if it’s allowed, (missed by scribe)<br> <emeyer> TabAtkins: They are global and we don’t have a way to store the function and use it elsewhere<br> <astearns> s/(missed by scribe)/(something about closures)<br> <emeyer> lea: If they’re global only, we should not allow them to nest so we have options later<br> <emeyer> …Same for mixins, where scope is valuable<br> <fantasai> s/(missed by scribe)/can we do closures/<br> <astearns> ack lea<br> <Zakim> lea, you wanted to say the current grammar for using allows declaring types, is that intentional?<br> <emeyer> …THe using grammar allows types, is that intentional?<br> <emeyer> TabAtkins: Yes<br> <emeyer> lea: How does that work if it’s a registered variable?<br> <emeyer> TabAtkins: It still has the token representation<br> <emeyer> lea: So you could recast to a different type<br> <emeyer> TabAtkins: You can already do that by subbing<br> <keithamus> q?<br> <keithamus> q+<br> <miriam> q+<br> <astearns> ack keithamus<br> <emeyer> keithamus: Curious how these translate across shadow boundaries<br> <fantasai> s/subbing/subbing a registered variable into an unregistered variable and re-subbing into a differently-registered variable/<br> <emeyer> TabAtkins: It’s a great question<br> <emeyer> …Been thinking how to expose shadow DOM, and the answer should work but what that means exactly is undefined<br> <emeyer> …BY the time this ships we should have a reasonable answer<br> <astearns> ack miriam<br> <emeyer> miriam: Are we saying the types in the parameter list are not just for validation, they’re actually setting the type of what comes in?<br> <emeyer> TabAtkins: No, they just validate, they don’t otherwise change behavior<br> <emeyer> …We don’t have a way to trigger animations from within a function<br> <emeyer> astearns: Any other questions?<br> <emeyer> …I’m assuming this mostly spec noodling<br> <emeyer> TabAtkins: Right, nothing is imminent<br> <emeyer> astearns: Are there any resolutions you need?<br> <emeyer> TabAtkins: No<br> </details> -- GitHub Notification of comment by css-meeting-bot Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9350#issuecomment-2377443159 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 26 September 2024 16:37:22 UTC