Ketoy
Reference

Compose Adapters

The catalogued composables KBC can render today. IDs come from

dev.ketoy.bytecode.KBCAdapterIds. Standard adapter IDs are 0x00010x3FFF; app-specific are 0x4000+.

For the how-to (writing a new adapter, scan-roots directives, the KSP pipeline), see Custom Adapter.


Catalogued (fully routed end-to-end)

Every entry below is generated by the KSP processor reading adapter-scan-roots.txt. The runtime resolves these by ID; the compiler plugin uses ComposeAdapterCatalog (the KSP-emitted binary) to validate calls.

IDFQ NameNotes
0x0001androidx.compose.material3.Text15-param canonical String overload (post-1.5; minLines at pos 14). softWrap/maxLines/minLines use paramHonourDefault + coerceAtLeast(1) transform.
0x0002androidx.compose.foundation.layout.Columnmodifier, verticalArrangement, horizontalAlignment + content slot.
0x0003androidx.compose.foundation.layout.Rowmodifier, horizontalArrangement, verticalAlignment + content slot.
0x0004androidx.compose.foundation.layout.Boxmodifier, contentAlignment, propagateMinConstraints (default false).
0x0007androidx.compose.material3.ScaffoldFull Material3. Content slot resolves through getPaddingValuesContentSlot.
0x0008androidx.compose.material3.SurfaceNon-clickable overload (the clickable overload is explicitly excluded).
0x0009androidx.compose.material3.Card6-param non-clickable overload. colors, elevation built via CardDefaults.cardColors / cardElevation constructor adapters.
0x000Bandroidx.compose.foundation.layout.Spacermodifier only, width/height live on the modifier chain (Modifier.height(20.dp)).
0x000Candroidx.compose.material3.ButtononClick, enabled (honourDefault), colors, elevation, border, contentPadding, interactionSource, content.
0x000Fandroidx.compose.material3.IconButtononClick, modifier, enabled (honourDefault), colors, interactionSource, content.
0x0012androidx.compose.material3.TextFieldString overload picked explicitly. Full param list, see source.
0x0014androidx.compose.material3.Checkboxchecked, onCheckedChange, modifier, enabled (honourDefault), colors, interactionSource.
0x0016androidx.compose.material3.Switchchecked, onCheckedChange, modifier, thumbContent, enabled, colors, interactionSource.
0x0018coil.compose.AsyncImage16-arg post-1.x overload. placeholder/error/fallback Painter slots use the UnsupportedFallback (omit-on-default) classifier.
0x0019androidx.compose.material3.IconImageVector overload. Resolved via host-provided KBCImageVectorResolver.
0x001Dandroidx.compose.material3.TopAppBarPost-1.2 overload with expandedHeight: Dp at position 4. Requires @OptIn(ExperimentalMaterial3Api::class).
0x0024androidx.compose.foundation.Image7-param overload with Painter. painter slot uses paramResolver=...painter=getPainter. alignment defaults to Alignment.Center, alpha to DefaultAlpha.

Reserved (IDs exist, not yet routed)

These IDs are reserved in KBCAdapterIds but adapter-scan-roots.txt doesn't include them. KBC source referencing them fails with UnregisteredComposable.

IDComponentBlocker
0x0005LazyColumnLazyListScope receiver-typed content lambda needs SlotScope-aware codegen.
0x0006LazyRowSame.
0x000AElevatedCardNone, open to PR.
0x000DOutlinedButtonNone, open to PR.
0x000ETextButtonNone, open to PR.
0x0010FloatingActionButtonNone, open to PR.
0x0011ExtendedFloatingActionButtonNone, open to PR.
0x0013OutlinedTextFieldNone, open to PR.
0x0015RadioButtonNone, open to PR.
0x0017SliderNone, open to PR.
0x001AHorizontalDividerNone, open to PR.
0x001BCircularProgressIndicatorNone, open to PR.
0x001CLinearProgressIndicatorNone, open to PR.
0x001ENavigationBarNone, open to PR.
0x001FTabRowNone, open to PR.
0x0020AlertDialogNone, open to PR.
0x0021ModalBottomSheetNone, open to PR.
0x0022LazyVerticalGridLazyGridScope receiver lambda.
0x0023HorizontalPagerPagerScope receiver lambda.

Adding any of these is the standard recipe:

  1. Add a composable=<fq>:0x00XX line to adapter-scan-roots.txt.
  2. Run ./gradlew :ketoy-adapters-material3:kspRelease.
  3. Done. The generated adapter handles the rest.

KBCParamSet typed getters

When an adapter is invoked, the runtime hands you a KBCParamSet containing the decoded KBCValues for each slot. Use these typed getters (all of them safely return defaults when the slot is encoded as KBCValue.Default):

GetterType
getString(idx): StringString
getStringOrNull(idx): String?String?
getInt(idx, default = 0): IntInt
getLong(idx, default = 0L): LongLong
getFloat(idx, default = 0f): FloatFloat
getDouble(idx, default = 0.0): DoubleDouble
getBoolean(idx, default = false): BooleanBoolean
getChar(idx, default = ' '): CharChar
getColor(idx): Colorresolves KBCValue.ColorARGB, ColorUnspecified
getDp(idx): Dpresolves KBCValue.Dp(...), DpUnspecified
getSp(idx): TextUnitresolves KBCValue.Sp(...), TextUnitUnspecified
getModifier(idx): Modifierfollows ModifierRef, applies dispatch lambda
getFontWeight(idx): FontWeight?from FontWeightInt
getFontStyle(idx): FontStyle?from FontStyleId
getFontFamily(idx): FontFamily?from FontFamilyTokenId or StringLiteral (via resolver)
getTextAlign(idx): TextAlign?from TextAlignId
getTextOverflow(idx): TextOverflowfrom TextOverflowId
getTextDecoration(idx): TextDecoration?from TextDecorationId
getVerticalArrangement(idx): Arrangement.Vertical
getHorizontalArrangement(idx): Arrangement.Horizontal
getHorizontalAlignment(idx): Alignment.Horizontal
getVerticalAlignment(idx): Alignment.Vertical
getContentAlignment(idx): Alignment
getContentScale(idx): ContentScale
getKeyboardType(idx): KeyboardType
getImeAction(idx): ImeAction
getCapitalization(idx): KeyboardCapitalization
getImageVector(idx): ImageVectorvia host resolver, falls back to PlaceholderImageVector
getImageVectorOrNull(idx): ImageVector?
getPainter(idx): Paintervia host resolver, falls back to ColorPainter(Transparent)
getPainterOrNull(idx): Painter?
getShape(idx): Shapefrom Register carrying a RoundedCornerShape, etc.
getLambda(idx): () -> Unit?from FunctionRef / ClosureRef
getValueChangeLambda<T>(idx): ((T) -> Unit)?for onValueChange / onCheckedChange
getContentSlot(idx): @Composable () -> Unit?for content lambdas
getItemContentSlot(idx): @Composable (Any?) -> Unit?for LazyColumn/LazyRow item slots
getPaddingValuesContentSlot(idx): @Composable (PaddingValues) -> Unit?for Scaffold content
getAnyOrNull(idx): Any?escape hatch
isDefaulted(idx): Booleantrue when the slot is KBCValue.Default

Use isDefaulted(idx) to honour a paramDefault= directive at the adapter level.


How adapter dispatch flows

KBC source        → @KetoyComposable Foo() { Text(text="hi", color=Color.Red, ...) }
       ↓ compiler plugin
KBC bytecode      → COMPOSABLE_CALL(0x0001, 2, [(0, StringLiteral(idx)), (2, ColorARGB(0xFFFF0000))])
       ↓ runtime
KBCInterpreter    → Decodes opcode, builds KBCParamSet from non-defaulted params,
                    asks adapter registry for id=0x0001

KBCComposableAdapter.invoke(params) → resolves slots via getters → calls real Text(...)

Slots that aren't encoded resolve to their Compose source default (the paramDefault= directive overrides this when set).

Next: Constructor Adapters →