[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7435":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":25,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":30,"discoverSource":31},7435,"mosaic","JakeWharton\u002Fmosaic","JakeWharton","Build terminal UI in Kotlin using Jetpack Compose","",null,"Kotlin",2701,95,32,52,0,2,3,41,6,67.55,"Apache License 2.0",false,"trunk",true,[],"2026-06-12 04:00:33","# Mosaic\n\nAn experimental tool for building console UI in Kotlin using the Jetpack Compose compiler\u002Fruntime.\nInspired by [Ink](https:\u002F\u002Fgithub.com\u002Fvadimdemedes\u002Fink).\n\n\u003Cimg src=\"samples\u002Fjest\u002Fdemo.gif\">\n\nJump to:\n[Introduction](#Introduction) |\n[Usage](#Usage) |\n[Samples](#Samples) |\n[FAQ](#FAQ) |\n[License](#License)\n\n\n## Introduction\n\nThe entrypoint to Mosaic is the `runMosaic` function.\nThe lambda passed to this function is responsible for both output and performing work.\n\n```kotlin\nsuspend fun main() = runMosaic {\n  Text(\"The count is: 0\")\n}\n```\n\nTo change the output dynamically we can use local properties to hold state.\nLet's update our counter to actually count to 20.\n\n```kotlin\nsuspend fun main() = runMosaic {\n  var count by remember { mutableIntStateOf(0) }\n\n  Text(\"The count is: $count\")\n\n  LaunchedEffect(Unit) {\n    for (i in 1..20) {\n      delay(250)\n      count = i\n    }\n  }\n}\n```\n\n(Note: You may need to add imports for `androidx.compose.runtime.getValue` and `import androidx.compose.runtime.setValue` manually.)\n\n\u003Cimg src=\"samples\u002Fcounter\u002Fdemo.gif\">\n\nThat is the most basic sample of Mosaic.\nFrom there, the limit is only your imagination.\n\n\u003Cimg src=\"samples\u002Fjest\u002Fdemo.gif\">\n\n\u003Cimg src=\"samples\u002Frrtop\u002Fdemo.gif\">\n\n_(Note: graphs in the above have rendering problems due to asciinema\u002Fagg which do not appear in the real output)_\n\n## Usage\n\nMosaic is a library for Compose, and it relies on JetBrains' Kotlin Compose plugin to be present for use.\nAny module which wants to call `runMosaic` or define `@Composable` functions for use with Mosaic must have this plugin applied.\nFor more information, see [the JetBrains Compose compiler documentation](https:\u002F\u002Fwww.jetbrains.com\u002Fhelp\u002Fkotlin-multiplatform-dev\u002Fcompose-compiler.html).\n\nMosaic itself can then be added like any other dependency:\n\n```groovy\ndependencies {\n  implementation(\"com.jakewharton.mosaic:mosaic-runtime:0.18.0\")\n}\n```\n\nDocumentation is available at [jakewharton.github.io\u002Fmosaic\u002Fdocs\u002F0.x\u002F](https:\u002F\u002Fjakewharton.github.io\u002Fmosaic\u002Fdocs\u002F0.x\u002F).\n\n\u003Cdetails>\n\u003Csummary>Snapshots of the development version are available in the Central Portal Snapshots repository.\u003C\u002Fsummary>\n\u003Cp>\n\n```groovy\nrepository {\n  mavenCentral()\n  maven {\n    url 'https:\u002F\u002Fcentral.sonatype.com\u002Frepository\u002Fmaven-snapshots\u002F'\n  }\n}\ndependencies {\n  implementation(\"com.jakewharton.mosaic:mosaic-runtime:0.19.0-SNAPSHOT\")\n}\n```\n\nSnapshot documentation is available at [jakewharton.github.io\u002Fmosaic\u002Fdocs\u002Flatest\u002F](https:\u002F\u002Fjakewharton.github.io\u002Fmosaic\u002Fdocs\u002Flatest\u002F).\n\n\u003C\u002Fp>\n\u003C\u002Fdetails>\n\n\n## Samples\n\nRun `.\u002Fgradlew installDist` to build the sample binaries.\n\n * [Counter](samples\u002Fcounter): A simple increasing number from 0 until 20.\n\n   `.\u002Fsamples\u002Fcounter\u002Fbuild\u002Finstall\u002Fcounter\u002Fbin\u002Fcounter`\n\n * [Demo](samples\u002Fdemo): A playground for demonstrating many features of Mosaic.\n\n   `.\u002Fsamples\u002Fdemo\u002Fbuild\u002Finstall\u002Fdemo\u002Fbin\u002Fdemo`\n\n * [Jest](samples\u002Fjest): Example output of a test framework (such as JS's 'Jest').\n\n   `.\u002Fsamples\u002Fjest\u002Fbuild\u002Finstall\u002Fjest\u002Fbin\u002Fjest`\n\n * [Robot](samples\u002Frobot): An interactive, game-like program with keyboard control.\n\n   `.\u002Fsamples\u002Frobot\u002Fbuild\u002Finstall\u002Frobot\u002Fbin\u002Frobot`\n\n * [rrtop](samples\u002Frrtop): An example inspired by [rrtop](https:\u002F\u002Fgithub.com\u002Fwojciech-zurek\u002Frrtop).\n\n   `.\u002Fsamples\u002Frrtop\u002Fbuild\u002Finstall\u002Frrtop\u002Fbin\u002Frrtop`\n\n * [snake](samples\u002Fsnake): Snake game.\n\n   `.\u002Fsamples\u002Fsnake\u002Fbuild\u002Finstall\u002Fsnake\u002Fbin\u002Fsnake`\n\n## FAQ\n\n### I thought Compose was a UI toolkit for Android?\n\nCompose is, at its core, a general-purpose compiler and runtime to do state tracking and tree node\nand property manipulation. This can be used on any platform supported by Kotlin for any kind of\nstate or with any tree. It's an amazing piece of technology.\n\nCompose UI is the modern UI toolkit for Android which also runs on the desktop, iOS, and the web.\nThe lack of differentiation between these two technologies has unfortunately caused Compose UI to\novershadow the core under the single \"Compose\" moniker in an unforced marketing error.\n\nOther examples of non-Compose UI-based Compose projects are Cash App's Redwood,\nJetBrains' Compose HTML, or Google's Jetpack Glance.\n\n### Broken output with `.\u002Fgradlew run` and\u002For inside IntelliJ IDEA\n\nRunning within Gradle or IntelliJ IDEA will not work. These tools do not provide access to the TTY\nin order to be interactive. And for non-interactive programs, both will strip ANSI control\ncharacters which prevent Mosaic from redrawing over a previous frame. The output will likely just\nrender in successive lines instead.\n\nRun your programs directly in a terminal emulator–no IDE and no Gradle.\n\n\n# License\n\n    Copyright 2020 Jake Wharton\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","Mosaic 是一个使用 Jetpack Compose 在 Kotlin 中构建终端用户界面的实验性工具。它允许开发者通过熟悉的 Compose 语法来创建动态和交互式的控制台应用，支持状态管理和异步更新等功能。核心功能包括利用 `runMosaic` 函数作为入口点，并通过声明式 UI 的方式轻松实现界面逻辑与视图的分离。此项目特别适合需要在命令行环境中提供丰富用户体验的应用场景，如测试框架输出、监控仪表盘等。基于 Apache License 2.0 发布，拥有活跃的社区支持。","2026-06-11 03:12:18","top_language"]