Open ln-12 opened 1 month ago
I am using Showkase in combination with the PreviewParameterProvider class. With that, we can also pass in a limit argument so that only a certain amount of items from the sequence is used. The code looks something like this:
PreviewParameterProvider
limit
@Composable @Preview fun SomePreview( @PreviewParameter(SomePreviewParameterProvider::class, limit = 3) state: SomeState, ) { ... } class SomePreviewParameterProvider : PreviewParameterProvider<SomeState> { override val values = sequenceOf( SomeState(...), SomeState(...), SomeState(...), SomeState(...), SomeState(...), ) }
After Showkase generated the module, I get the following code which does not respect this parameter but instead simply uses all values:
public val SomePreviewDefaultGroupSomePreview: List<ShowkaseBrowserComponent> = SomePreviewParameterProvider() .values .iterator() .asSequence() .mapIndexed { index, previewParam -> ShowkaseBrowserComponent( group = "Default Group", componentName = "SomePreview", componentKDoc = "", componentKey = """com.example.app.SomePreview_null_DefaultGroup_SomePreview_0_null_$index""", isDefaultStyle = false, component = @Composable { SomePreview(state = previewParam) } ) } .toList()
Would it be possible to add support for the limit argument?
I am using Showkase in combination with the
PreviewParameterProvider
class. With that, we can also pass in alimit
argument so that only a certain amount of items from the sequence is used. The code looks something like this:After Showkase generated the module, I get the following code which does not respect this parameter but instead simply uses all values:
Would it be possible to add support for the
limit
argument?