-
Notifications
You must be signed in to change notification settings - Fork 498
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
Introduce undefined values for properties and struct fields #5164
Comments
We could have default value for struct like propose in #2936 , you could do something like: export struct Style {
border-radius: length,
border-top-left-radius: length = -1px,
background: brush
}
component StyledRectangle {
in property <Style> style;
Rectangle {
background: style.background;
border-radius: style.border-radius;
border-top-left-radius: style.border-top-left-radius >= 0 ? style.border-top-left-radius : style.border-radius;
}
}
export component MyExample inherits Window {
width: 600px;
height: 400px;
StyledRectangle {
style: {
background: #000000;
border-top-left-radius: 8px;
}
}
} But in general, we might want to have |
I think from user perspective that looks more like a workaround. As user I want to do something like on the |
Right, for the general case, we would need to introduced a new type like |
I have the following use case:
The following example does not work as expected, because the top left border radius of inner
Rectangle
will not be rendered with8px
but instead with0
. The problem is, that if theborder-radius
field onStyle
is not explicit set it will defaults to0
and it overwrites the setting ofborder-top-left-radius
. What could help to solve this problem is to introduceundefined
for values and use this as default e.g. forborder-radius
instead of0
, so that is handled like there is no value set on the propertyborder-radius
.The text was updated successfully, but these errors were encountered: