mirror of
https://github.com/JetBrains/intellij-platform-plugin-template.git
synced 2026-02-10 09:59:22 +00:00
Drop 'internal' modifier for readability and shortness of examples
This commit is contained in:
parent
edb8fb0b28
commit
8fe4926fb7
@ -36,7 +36,7 @@ import org.jetbrains.plugins.template.weatherApp.services.SearchAutoCompletionIt
|
||||
|
||||
@OptIn(ExperimentalJewelApi::class)
|
||||
@Composable
|
||||
internal fun <T> SearchBarWithAutoCompletion(
|
||||
fun <T> SearchBarWithAutoCompletion(
|
||||
modifier: Modifier = Modifier,
|
||||
searchAutoCompletionItemProvider: SearchAutoCompletionItemProvider<T>,
|
||||
textFieldState: TextFieldState,
|
||||
@ -120,7 +120,7 @@ internal fun <T> SearchBarWithAutoCompletion(
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun CloseIconButton(onClick: () -> Unit) {
|
||||
fun CloseIconButton(onClick: () -> Unit) {
|
||||
val interactionSource = remember { MutableInteractionSource() }
|
||||
var hovered by remember { mutableStateOf(false) }
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ import androidx.compose.runtime.Immutable
|
||||
* @property id A derived unique identifier for the location in the format `name, country`.
|
||||
*/
|
||||
@Immutable
|
||||
internal data class Location(val name: String, val country: String) : PreviewableItem, Searchable {
|
||||
data class Location(val name: String, val country: String) : PreviewableItem, Searchable {
|
||||
val id: String = "$name, $country"
|
||||
|
||||
override fun isSearchApplicable(query: String): Boolean {
|
||||
@ -31,4 +31,4 @@ internal data class Location(val name: String, val country: String) : Previewabl
|
||||
}
|
||||
|
||||
@Immutable
|
||||
internal data class SelectableLocation(val location: Location, val isSelected: Boolean)
|
||||
data class SelectableLocation(val location: Location, val isSelected: Boolean)
|
||||
@ -3,6 +3,6 @@ package org.jetbrains.plugins.template.weatherApp.model
|
||||
/**
|
||||
* Represents an entity that can be filtered by a search query.
|
||||
*/
|
||||
internal interface Searchable {
|
||||
interface Searchable {
|
||||
fun isSearchApplicable(query: String): Boolean
|
||||
}
|
||||
@ -7,7 +7,7 @@ import java.time.LocalDateTime
|
||||
/**
|
||||
* Data class representing a daily weather forecast.
|
||||
*/
|
||||
internal data class DailyForecast(
|
||||
data class DailyForecast(
|
||||
val date: LocalDateTime,
|
||||
val temperature: Float,
|
||||
val weatherType: WeatherType,
|
||||
@ -19,7 +19,7 @@ internal data class DailyForecast(
|
||||
/**
|
||||
* Data class representing weather information to be displayed in the Weather Card.
|
||||
*/
|
||||
internal data class WeatherForecastData(
|
||||
data class WeatherForecastData(
|
||||
val location: Location,
|
||||
val currentWeatherForecast: DailyForecast,
|
||||
val dailyForecasts: List<DailyForecast> = emptyList()
|
||||
|
||||
@ -7,7 +7,7 @@ import kotlinx.coroutines.flow.asStateFlow
|
||||
import org.jetbrains.plugins.template.weatherApp.model.Location
|
||||
|
||||
@Service
|
||||
internal class LocationsProvider : SearchAutoCompletionItemProvider<Location> {
|
||||
class LocationsProvider : SearchAutoCompletionItemProvider<Location> {
|
||||
private val locationStateFlow = MutableStateFlow(
|
||||
listOf(
|
||||
Location("Munich", "Germany"),
|
||||
|
||||
@ -16,7 +16,7 @@ import org.jetbrains.plugins.template.weatherApp.model.WeatherForecastData
|
||||
* a flow to observe the list of selectable locations. Implementations are expected to handle
|
||||
* location-related logic and state management.
|
||||
*/
|
||||
internal interface MyLocationsViewModelApi {
|
||||
interface MyLocationsViewModelApi {
|
||||
fun onAddLocation(locationToAdd: Location)
|
||||
|
||||
fun onDeleteLocation(locationToDelete: Location)
|
||||
@ -30,7 +30,7 @@ internal interface MyLocationsViewModelApi {
|
||||
* Interface representing a ViewModel for managing weather-related data
|
||||
* and user interactions.
|
||||
*/
|
||||
internal interface WeatherViewModelApi {
|
||||
interface WeatherViewModelApi {
|
||||
val weatherForecast: Flow<WeatherForecastData>
|
||||
|
||||
fun onLoadWeatherForecast(location: Location)
|
||||
@ -39,7 +39,7 @@ internal interface WeatherViewModelApi {
|
||||
}
|
||||
|
||||
@Service
|
||||
internal class MyLocationsViewModel(cs: CoroutineScope) : MyLocationsViewModelApi, WeatherViewModelApi {
|
||||
class MyLocationsViewModel(cs: CoroutineScope) : MyLocationsViewModelApi, WeatherViewModelApi {
|
||||
|
||||
private val weatherService = service<WeatherForecastService>()
|
||||
|
||||
|
||||
@ -11,6 +11,6 @@ import org.jetbrains.plugins.template.weatherApp.model.Searchable
|
||||
*
|
||||
* @param T The type of items provided by this interface, which must extend [Searchable].
|
||||
*/
|
||||
internal interface SearchAutoCompletionItemProvider<T : Searchable> {
|
||||
interface SearchAutoCompletionItemProvider<T : Searchable> {
|
||||
fun provideSearchableItems(searchTerm: String): List<T>
|
||||
}
|
||||
@ -15,7 +15,7 @@ import java.time.LocalTime
|
||||
import kotlin.random.Random
|
||||
|
||||
@Service
|
||||
internal class WeatherForecastService(private val cs: CoroutineScope) {
|
||||
class WeatherForecastService(private val cs: CoroutineScope) {
|
||||
private val _weatherForecast: MutableStateFlow<WeatherForecastData> = MutableStateFlow(WeatherForecastData.EMPTY)
|
||||
|
||||
val weatherForecast: StateFlow<WeatherForecastData> = _weatherForecast.asStateFlow()
|
||||
|
||||
@ -32,7 +32,7 @@ import org.jetbrains.plugins.template.weatherApp.ui.components.SearchToolbarMenu
|
||||
import org.jetbrains.plugins.template.weatherApp.ui.components.WeatherDetailsCard
|
||||
|
||||
@Composable
|
||||
internal fun WeatherAppSample(
|
||||
fun WeatherAppSample(
|
||||
myLocationViewModel: MyLocationsViewModelApi,
|
||||
weatherViewModelApi: WeatherViewModelApi,
|
||||
searchAutoCompletionItemProvider: SearchAutoCompletionItemProvider<Location>
|
||||
@ -85,7 +85,7 @@ private fun LeftColumn(
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun MyLocationsListWithEmptyListPlaceholder(
|
||||
fun MyLocationsListWithEmptyListPlaceholder(
|
||||
modifier: Modifier = Modifier,
|
||||
myLocationsViewModelApi: MyLocationsViewModelApi
|
||||
) {
|
||||
|
||||
@ -17,7 +17,7 @@ import javax.xml.transform.stream.StreamResult
|
||||
import javax.xml.xpath.XPathConstants
|
||||
import javax.xml.xpath.XPathFactory
|
||||
|
||||
internal object EmbeddedToInlineCssSvgTransformerHint : PainterSvgPatchHint {
|
||||
object EmbeddedToInlineCssSvgTransformerHint : PainterSvgPatchHint {
|
||||
private val CSS_STYLEABLE_TAGS = listOf(
|
||||
"linearGradient", "radialGradient", "pattern",
|
||||
"filter", "clipPath", "mask", "symbol",
|
||||
|
||||
@ -20,7 +20,7 @@ import org.jetbrains.plugins.template.weatherApp.model.Searchable
|
||||
import org.jetbrains.plugins.template.weatherApp.services.SearchAutoCompletionItemProvider
|
||||
|
||||
@Composable
|
||||
internal fun <T> SearchToolbarMenu(
|
||||
fun <T> SearchToolbarMenu(
|
||||
searchAutoCompletionItemProvider: SearchAutoCompletionItemProvider<T>,
|
||||
confirmButtonText: String = "Confirm",
|
||||
onSearchPerformed: (T) -> Unit = {},
|
||||
|
||||
@ -44,7 +44,7 @@ import java.util.*
|
||||
*/
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
internal fun WeatherDetailsCard(
|
||||
fun WeatherDetailsCard(
|
||||
modifier: Modifier = Modifier,
|
||||
weatherForecastData: WeatherForecastData,
|
||||
onReloadWeatherData: (Location) -> Unit
|
||||
|
||||
Loading…
Reference in New Issue
Block a user