Prelude
- Why to read this book
- What this book is not about
- Why to write about internals
- Keep the sources close
- Code snippets and examples
1. Composable functions
- The meaning of Composable functions
- Properties of Composable functions
- Calling context
- Idempotent
- Free of uncontrolled side effects
- Restartable
- Fast execution
- Positional memoization
- Similarities with suspend functions
- The color of Composable functions
- Composable function types
2. The Compose compiler
- A Kotlin compiler plugin
- Compose annotations
- Registering Compiler extensions
- Kotlin Compiler version
- Static analysis
- Static Checkers
- Call checks
- Type checks
- Declaration checks
- Diagnostic suppression
- Runtime version check
- Code generation
- The Kotlin IR
- Lowering
- Inferring class stability
- Enabling live literals
- Compose lambda memoization
- Injecting the Composer
- Comparison propagation
- Default parameters
- Control flow group generation
- Klib and decoy generation
3. The Compose runtime
- The slot table and the list of changes
- The slot table in depth
- The list of changes
- The Composer
- Feeding the Composer
- Modeling the Changes
- Optimizing when to write
- Writing and reading groups
- Remembering values
- Recompose scopes
- SideEffects in the Composer
- Storing CompositionLocals
- Storing source information
- Linking Compositions via CompositionContext
- Accessing the current State snapshot
- Navigating the nodes
- Keeping reader and writer in sync
- Applying the changes
- Performance when building the node tree
- How changes are applied
- Attaching and drawing the nodes
- Composition
- Creating a Composition
- The initial Composition process
- Applying changes after initial Composition
- Additional information about the Composition
- The Recomposer
- Spawning the Recomposer
- Recomposition process
- Concurrent recomposition
- Recomposer states
4. Compose UI
- Integrating UI with the Compose runtime
- Mapping scheduled changes to actual changes to the tree
- Composition from the point of view of Compose UI
- Subcomposition from the point of view of Compose UI
- Reflecting changes in the UI
- Different types of Appliers
- Materializing a new LayoutNode
- Closing the circle
- Materializing a change to remove nodes
- Materializing a change to move nodes
- Materializing a change to clear all the nodes
- Measuring in Compose UI
- Measuring policies
- Intrinsic measurements
- Layout Constraints
- LookaheadLayout
- Modeling modifier chains
- Setting modifiers to the LayoutNode
- How LayoutNode ingests new modifiers
- Drawing the node tree
- Semantics in Jetpack Compose
- Notifying about semantic changes
- Merged and unmerged semantic trees
5. State snapshot system
- What snapshot state is
- Concurrency control systems
- Multiversion concurrency control (MCC or MVCC)
- The Snapshot
- The snapshot tree
- Snapshots and threading
- Observing reads and writes
- MutableSnapshots
- GlobalSnapshot and nested snapshots
- StateObjects and StateRecords
- Reading and writing state
- Removing or reusing obsolete records
- Change propagation
- Merging write conflicts
6. Effects and effect handlers
- Introducing side effects
- Side effects in Compose
- What we need
- Effect Handlers
- Non suspended effects
- Suspended effects
- Third party library adapters
7. Advanced Compose Runtime use cases
- Compose runtime vs Compose UI
- (Re-) Introducing composition
- Composition of vector graphics
- Building vector image tree
- Integrating vector composition into Compose UI
- Managing DOM with Compose
- Standalone composition in the browser
- Conclusion
