Skip to content
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

CSSOM. Unable to set gridRow and gridColumn properties #2391

Open
aerialist7 opened this issue Aug 14, 2024 · 8 comments
Open

CSSOM. Unable to set gridRow and gridColumn properties #2391

aerialist7 opened this issue Aug 14, 2024 · 8 comments
Assignees

Comments

@aerialist7
Copy link
Contributor

aerialist7 commented Aug 14, 2024

Hello,

I'm trying to make the same as in the example of grid-row from MDN, but I can't do it without unsafeCast, because there are no GridRow/GridColumn factories (even no something like array/many factories but with "/" as a separator).

gridRow = "1 / 3".unsafeCast<GridRow>()
gridRow = "auto / span 2".unsafeCast<GridRow>()
gridColumn = "auto / span 2".unsafeCast<GridColumn>()

Is there any way to do it without casting?

@turansky
Copy link
Collaborator

Which API do you expect in described cases?

@aerialist7
Copy link
Contributor Author

aerialist7 commented Aug 14, 2024

I think the generic case should be supported at least.
Because array and many already exist.
And something similar (but joining via "/") should also be available in the wrappers.

@turansky
Copy link
Collaborator

Examples of calls will be very helpful

@aerialist7
Copy link
Contributor Author

aerialist7 commented Aug 14, 2024

I wrote them in the first message.
IMO in a first approximation they can be rewritten as

gridRow = multiple(integer(1), integer(3))
gridRow = multiple(auto, array(span, integer(2)))
gridColumn = multiple(auto, array(span, integer(2)))

where multiple (name could be better of cause) is

fun <T : Any> multiple(
    vararg values: T,
): T =
    values.joinToString(" / ")
        .unsafeCast<T>()

@turansky
Copy link
Collaborator

GridRow and GridColumn have strict signatures and multiple doesn't look like solution for them

@aerialist7
Copy link
Contributor Author

Ok, then can it be done via corresponding factories for GridRow and GridColumn?

@turansky
Copy link
Collaborator

Which API do you expect in described cases?

@aerialist7
Copy link
Contributor Author

GridRow(GridRowStart, GridRowEnd)
GridColumn(GridColumnStart, GridColumnEnd)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants