Package-level declarations

Types

Link copied to clipboard
class BoundedBlockTextMapping(val coveredSourceRange: TextRange, visualTextRange: TextRange? = null) : TextMapping
Link copied to clipboard
data object Copy : TextInputCommand
Link copied to clipboard
data class CursorPosition(val componentId: InteractiveId, val visualOffset: Int)

Used as mutable state. Must stay a value object.

Link copied to clipboard
data object Cut : TextInputCommand
Link copied to clipboard
data class Delete(val direction: Delete.Direction, val size: Delete.Size) : TextInputCommand
Link copied to clipboard
data class InteractiveComponent(val id: InteractiveId, val scrollIndex: Int?, layoutCoordinates: LayoutCoordinates?, val visualTextRange: TextRange, val textMapping: TextMapping, val textLayoutResult: TextLayoutResult?, val userData: UserData = UserData.empty)

Class representing an interactive GUI element. Best created in onGloballyPositioned modifier.

Link copied to clipboard
typealias InteractiveId = Long
Link copied to clipboard
data class InteractiveScope(val focusRequester: FocusRequester = FocusRequester(), containerLayoutCoordinates: LayoutCoordinates? = null)
Link copied to clipboard
data class NavigableLazyListScope(lazyListScope: LazyListScope, val navigation: Navigation)
Link copied to clipboard
interface Navigation
Link copied to clipboard
Link copied to clipboard
data object Paste : TextInputCommand
Link copied to clipboard
data object Redo : TextInputCommand
Link copied to clipboard
data class ReplaceRange(val sourceRange: TextRange, val newSource: String, val sourceCursorOffset: Int = 0) : TextInputCommand
Link copied to clipboard
class ScrollPageDown(val fraction: Float = 1.0f) : ScrollRequest
Link copied to clipboard
class ScrollPageUp(val fraction: Float = 1.0f) : ScrollRequest
Link copied to clipboard
sealed interface ScrollRequest
Link copied to clipboard
data class ScrollToAnchor(val anchor: String) : ScrollRequest
Link copied to clipboard
data class ScrollToComponent(val interactiveComponent: InteractiveComponent) : ScrollRequest
Link copied to clipboard
data class ScrollToIndex(val scrollIndex: Int) : ScrollRequest
Link copied to clipboard
data class ScrollToMakeVisible(val range: IntRange) : ScrollRequest
Link copied to clipboard
data class Selection(val start: CursorPosition, val end: CursorPosition)
Link copied to clipboard
data class SelectionStyle(val fillColor: Color = Color.Cyan.copy(alpha = 0.5f), val stroke: SelectionStyle.Stroke = Stroke())
Link copied to clipboard
sealed interface TextInputCommand
Link copied to clipboard
interface TextMapping

Maps ranges of rendered text to ranges of source code and back.

Link copied to clipboard
data class Type(val text: String) : TextInputCommand
Link copied to clipboard
data object Undo : TextInputCommand
Link copied to clipboard
data class UserData(val dataByType: Map<KClass<*>, Any> = emptyMap())
Link copied to clipboard

Properties

Link copied to clipboard
val LocalInteractiveInputHandler: ProvidableCompositionLocal<(TextInputCommand) -> Unit>
Link copied to clipboard
val LocalInteractiveScope: ProvidableCompositionLocal<InteractiveScope?>
Link copied to clipboard
val LocalNavigation: ProvidableCompositionLocal<Navigation>
Link copied to clipboard
val LocalScrollIndex: ProvidableCompositionLocal<Int?>
Link copied to clipboard
val LocalSelectionStyle: ProvidableCompositionLocal<SelectionStyle>

Functions

Link copied to clipboard
fun Modifier.annotationClickDetector(textLayoutResult: TextLayoutResult?, activeTags: Set<String>, activePointerIcon: PointerIcon = PointerIcon.Hand, onClick: (Int, List<AnnotatedString.Range<String>>) -> Unit): Modifier

Detects annotations tagged by a specific tag in the annotated text, which is shown in the component. If a mouse pointer hovers over such text, its icon is changed and if clicked, the onClick handler will be called.

Link copied to clipboard

Find the visual position of the cursor in the layout.

Link copied to clipboard
@Composable
fun DisabledInteractiveContainer(interactiveContent: @Composable () -> Unit)

Delimits a region where interaction is disabled.

Link copied to clipboard
@Composable
fun InteractiveContainer(scope: InteractiveScope? = rememberInteractiveScope(), selectionStyle: SelectionStyle = SelectionStyle(), modifier: Modifier = Modifier, onInput: (TextInputCommand) -> Unit = {}, onCursorMovement: (CursorPosition) -> Unit = { scope?.cursorPosition = it }, interactiveContent: @Composable () -> Unit)

Delimits region where all the interactive components will be considered parts of the same document.

Link copied to clipboard
@Composable
fun InteractiveText(interactiveId: InteractiveId, text: String, textMapping: TextMapping, style: TextStyle, modifier: Modifier = Modifier, userData: UserData = UserData.empty, activeAnnotationTags: Set<String> = setOf(), onAnnotationCLick: (Int, List<AnnotatedString.Range<String>>) -> Unit = { _, _ -> })
@Composable
fun InteractiveText(interactiveId: InteractiveId, text: AnnotatedString, textMapping: TextMapping, style: TextStyle, modifier: Modifier = Modifier, inlineContent: Map<String, InlineTextContent> = mapOf(), userData: UserData = UserData.empty, activeAnnotationTags: Set<String> = setOf(), onAnnotationCLick: (Int, List<AnnotatedString.Range<String>>) -> Unit = { _, _ -> })
Link copied to clipboard
fun Modifier.interactiveText(interactiveId: InteractiveId, textLayoutResult: TextLayoutResult?, textMapping: TextMapping, textLength: Int, userData: UserData = UserData.empty): Modifier
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@Composable
fun NavigableLazyColumn(modifier: Modifier = Modifier, state: LazyListState = rememberLazyListState(), contentPadding: PaddingValues = PaddingValues(0.dp), reverseLayout: Boolean = false, verticalArrangement: Arrangement.Vertical = if (!reverseLayout) Arrangement.Top else Arrangement.Bottom, horizontalAlignment: Alignment.Horizontal = Alignment.Start, flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(), userScrollEnabled: Boolean = true, navigation: Navigation = LocalNavigation.current, content: NavigableLazyListScope.() -> Unit)
Link copied to clipboard
fun Modifier.paintSelection(interactiveScope: InteractiveScope, interactiveId: InteractiveId): Modifier
Link copied to clipboard
operator fun TextMapping.plus(other: TextMapping): TextMapping
Link copied to clipboard
@Composable
fun rememberInteractiveScope(vararg keys: Any?): InteractiveScope
Link copied to clipboard
fun Modifier.textInput(onInput: (TextInputCommand) -> Unit): Modifier