androidx.compose.ui.tooling.data
Interfaces
SourceContext |
Context with data for creating group nodes. |
Classes
CallGroup |
A group that represents the invocation of a component |
ContextCache |
A cache of |
Group |
A group in the slot table. |
JoinedKey |
A key that has being joined together to form one key. |
NodeGroup |
A group that represents an emitted node |
ParameterInformation |
|
SourceLocation |
Source location of the call that produced the call group. |
Annotations
Extension functions summary
Group |
Return a group tree for for the slot table that represents the entire content of the slot table. |
List<ParameterInformation> |
Return the parameters found for this |
List<R> |
@UiToolingDataApiProcesses a set of |
T? |
@UiToolingDataApiReturn a tree of custom nodes for the slot table. |
Extension properties summary
String? |
The source position of the group extracted from the key, if one exists for the group. |
Extension functions
asTree
@UiToolingDataApi
fun CompositionData.asTree(): Group
Return a group tree for for the slot table that represents the entire content of the slot table.
findParameters
@UiToolingDataApi
fun CompositionGroup.findParameters(cache: ContextCache? = null): List<ParameterInformation>
Return the parameters found for this CompositionGroup.
makeTree
@UiToolingDataApi
fun <T : Any?, R : Any?> Set<CompositionData>.makeTree(
prepareResult: (CompositionInstance) -> Unit,
createNode: (CompositionGroup, SourceContext, List<T>, List<R>) -> T?,
createResult: (CompositionInstance, T?, List<CompositionInstance>) -> R?,
cache: ContextCache = ContextCache()
): List<R>
Processes a set of CompositionData instances and constructs a list of trees of custom nodes.
This function builds a hierarchy from the provided compositions and then uses the mapTree to transform each root composition into a custom tree structure defined by the createNode. Results from mapTree that are null will be excluded from the final list.
The processing involves:
-
Building a lookup map from
CompositionInstancetoCompositionData. -
Constructing a parent-to-children hierarchy of
CompositionInstances. -
Recursively traversing the hierarchy to map each composition using the provided
createNode, potentially stitching children processed from sub-compositions.
| Parameters | |
|---|---|
Set<CompositionData> |
A set of |
prepareResult: (CompositionInstance) -> Unit |
Give the caller a chance to setup data structures for a composition. |
createNode: (CompositionGroup, SourceContext, List<T>, List<R>) -> T? |
A function that takes a |
createResult: (CompositionInstance, T?, List<CompositionInstance>) -> R? |
Create a result |
cache: ContextCache = ContextCache() |
An optional |
mapTree
@UiToolingDataApi
fun <T : Any?> CompositionData.mapTree(
factory: (CompositionGroup, SourceContext, List<T>) -> T?,
cache: ContextCache = ContextCache()
): T?
Return a tree of custom nodes for the slot table.
The factory method will be called for every CompositionGroup in the slot tree and can be used to create custom nodes based on the passed arguments. The SourceContext argument gives access to additional information encoded in the CompositionGroup.sourceInfo. A return of null from factory means that the entire subtree will be ignored.
A cache can optionally be specified. If a client is calling mapTree multiple times, this can save some time if the values of CompositionGroup.sourceInfo are not unique.
Extension properties
position
@UiToolingDataApi
val Group.position: String?
The source position of the group extracted from the key, if one exists for the group.