Skip to content

Commit 6e396d2

Browse files
committed
Migrate Material symbols to standart StandardImport approach, move common files in new package
1 parent 7c83d70 commit 6e396d2

89 files changed

Lines changed: 677 additions & 1165 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

sdk/compose/foundation/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/foundation/animation/RememberShimmer.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import androidx.compose.animation.core.infiniteRepeatable
77
import androidx.compose.animation.core.rememberInfiniteTransition
88
import androidx.compose.animation.core.tween
99
import androidx.compose.runtime.Composable
10+
import androidx.compose.runtime.Stable
1011
import androidx.compose.runtime.State
12+
import androidx.compose.runtime.remember
1113
import androidx.compose.ui.Modifier
1214
import androidx.compose.ui.draw.drawWithContent
1315
import androidx.compose.ui.geometry.CornerRadius
@@ -18,6 +20,7 @@ import androidx.compose.ui.unit.Dp
1820
import androidx.compose.ui.unit.dp
1921

2022
/** Container holding shared shimmer animation state. */
23+
@Stable
2124
class Shimmer internal constructor(
2225
internal val translateState: State<Float>,
2326
internal val gradientWidthFactor: Float,
@@ -46,7 +49,9 @@ fun rememberShimmer(
4649
),
4750
label = "RememberShimmerTranslate",
4851
)
49-
return Shimmer(translateState, gradientWidthFactor)
52+
return remember(gradientWidthFactor) {
53+
Shimmer(translateState, gradientWidthFactor)
54+
}
5055
}
5156

5257
/** Apply a remembered shimmer to this modifier. */

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/service/PersistentSettings.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import io.github.composegears.valkyrie.jewel.tooling.GlobalPreviewState
1010
import io.github.composegears.valkyrie.sdk.shared.ValkyrieMode
1111
import io.github.composegears.valkyrie.service.PersistentSettings.ValkyrieState
1212
import io.github.composegears.valkyrie.ui.domain.model.PreviewType
13-
import io.github.composegears.valkyrie.ui.screen.webimport.material.domain.model.font.MaterialFontSettings.Companion.DEFAULT_FILL
14-
import io.github.composegears.valkyrie.ui.screen.webimport.material.domain.model.font.MaterialFontSettings.Companion.DEFAULT_GRADE
15-
import io.github.composegears.valkyrie.ui.screen.webimport.material.domain.model.font.MaterialFontSettings.Companion.DEFAULT_OPTICAL_SIZE
16-
import io.github.composegears.valkyrie.ui.screen.webimport.material.domain.model.font.MaterialFontSettings.Companion.DEFAULT_WEIGHT
17-
import io.github.composegears.valkyrie.ui.screen.webimport.standard.common.model.SizeSettings.Companion.DEFAULT_SIZE
13+
import io.github.composegears.valkyrie.ui.screen.webimport.common.domain.settings.SizeSettings.Companion.DEFAULT_SIZE
14+
import io.github.composegears.valkyrie.ui.screen.webimport.standard.materialsymbols.domain.model.MaterialFontSettings.Companion.DEFAULT_FILL
15+
import io.github.composegears.valkyrie.ui.screen.webimport.standard.materialsymbols.domain.model.MaterialFontSettings.Companion.DEFAULT_GRADE
16+
import io.github.composegears.valkyrie.ui.screen.webimport.standard.materialsymbols.domain.model.MaterialFontSettings.Companion.DEFAULT_OPTICAL_SIZE
17+
import io.github.composegears.valkyrie.ui.screen.webimport.standard.materialsymbols.domain.model.MaterialFontSettings.Companion.DEFAULT_WEIGHT
1818

1919
@State(name = "Valkyrie.Settings", storages = [Storage("valkyrie_settings.xml")])
2020
class PersistentSettings : SimplePersistentStateComponent<ValkyrieState>(ValkyrieState()) {

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/settings/InMemorySettings.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import io.github.composegears.valkyrie.service.PersistentSettings.Companion.pers
99
import io.github.composegears.valkyrie.ui.domain.model.PreviewType
1010
import io.github.composegears.valkyrie.ui.extension.or
1111
import io.github.composegears.valkyrie.ui.extension.updateState
12-
import io.github.composegears.valkyrie.ui.screen.webimport.material.domain.model.font.MaterialFontSettings.Companion.DEFAULT_FILL
13-
import io.github.composegears.valkyrie.ui.screen.webimport.material.domain.model.font.MaterialFontSettings.Companion.DEFAULT_GRADE
14-
import io.github.composegears.valkyrie.ui.screen.webimport.material.domain.model.font.MaterialFontSettings.Companion.DEFAULT_OPTICAL_SIZE
15-
import io.github.composegears.valkyrie.ui.screen.webimport.material.domain.model.font.MaterialFontSettings.Companion.DEFAULT_WEIGHT
16-
import io.github.composegears.valkyrie.ui.screen.webimport.standard.common.model.SizeSettings.Companion.DEFAULT_SIZE
12+
import io.github.composegears.valkyrie.ui.screen.webimport.common.domain.settings.SizeSettings.Companion.DEFAULT_SIZE
13+
import io.github.composegears.valkyrie.ui.screen.webimport.standard.materialsymbols.domain.model.MaterialFontSettings.Companion.DEFAULT_FILL
14+
import io.github.composegears.valkyrie.ui.screen.webimport.standard.materialsymbols.domain.model.MaterialFontSettings.Companion.DEFAULT_GRADE
15+
import io.github.composegears.valkyrie.ui.screen.webimport.standard.materialsymbols.domain.model.MaterialFontSettings.Companion.DEFAULT_OPTICAL_SIZE
16+
import io.github.composegears.valkyrie.ui.screen.webimport.standard.materialsymbols.domain.model.MaterialFontSettings.Companion.DEFAULT_WEIGHT
1717
import java.util.Collections.emptyList
1818
import kotlinx.coroutines.flow.MutableStateFlow
1919
import kotlinx.coroutines.flow.asStateFlow

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/WebImportFlow.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import com.composegears.tiamat.compose.Navigation
66
import com.composegears.tiamat.compose.navDestination
77
import com.composegears.tiamat.compose.navigationSlideInOut
88
import com.composegears.tiamat.compose.rememberNavController
9-
import io.github.composegears.valkyrie.ui.screen.webimport.material.MaterialSymbolsImportScreen
109
import io.github.composegears.valkyrie.ui.screen.webimport.standard.bootstrap.BootstrapImportScreen
1110
import io.github.composegears.valkyrie.ui.screen.webimport.standard.boxicons.BoxIconsImportScreen
1211
import io.github.composegears.valkyrie.ui.screen.webimport.standard.eva.EvaImportScreen
1312
import io.github.composegears.valkyrie.ui.screen.webimport.standard.feather.FeatherImportScreen
1413
import io.github.composegears.valkyrie.ui.screen.webimport.standard.fontawesome.FontAwesomeImportScreen
1514
import io.github.composegears.valkyrie.ui.screen.webimport.standard.ionicons.IoniconsImportScreen
1615
import io.github.composegears.valkyrie.ui.screen.webimport.standard.lucide.LucideImportScreen
16+
import io.github.composegears.valkyrie.ui.screen.webimport.standard.materialsymbols.MaterialSymbolsImportScreen
1717
import io.github.composegears.valkyrie.ui.screen.webimport.standard.remix.RemixImportScreen
1818
import io.github.composegears.valkyrie.ui.screen.webimport.standard.tabler.TablerImportScreen
1919

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/WebImportSelectorScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ import io.github.composegears.valkyrie.ui.screen.webimport.IconProviders.Ionicon
4242
import io.github.composegears.valkyrie.ui.screen.webimport.IconProviders.Lucide
4343
import io.github.composegears.valkyrie.ui.screen.webimport.IconProviders.Remix
4444
import io.github.composegears.valkyrie.ui.screen.webimport.IconProviders.Tabler
45-
import io.github.composegears.valkyrie.ui.screen.webimport.material.MaterialSymbolsImportScreen
4645
import io.github.composegears.valkyrie.ui.screen.webimport.standard.bootstrap.BootstrapImportScreen
4746
import io.github.composegears.valkyrie.ui.screen.webimport.standard.boxicons.BoxIconsImportScreen
4847
import io.github.composegears.valkyrie.ui.screen.webimport.standard.eva.EvaImportScreen
4948
import io.github.composegears.valkyrie.ui.screen.webimport.standard.feather.FeatherImportScreen
5049
import io.github.composegears.valkyrie.ui.screen.webimport.standard.fontawesome.FontAwesomeImportScreen
5150
import io.github.composegears.valkyrie.ui.screen.webimport.standard.ionicons.IoniconsImportScreen
5251
import io.github.composegears.valkyrie.ui.screen.webimport.standard.lucide.LucideImportScreen
52+
import io.github.composegears.valkyrie.ui.screen.webimport.standard.materialsymbols.MaterialSymbolsImportScreen
5353
import io.github.composegears.valkyrie.ui.screen.webimport.standard.remix.RemixImportScreen
5454
import io.github.composegears.valkyrie.ui.screen.webimport.standard.tabler.TablerImportScreen
5555
import io.github.composegears.valkyrie.util.stringResource

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/common/StandardIconViewModel.kt renamed to tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/common/StandardIconViewModel.kt

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.composegears.valkyrie.ui.screen.webimport.standard.common
1+
package io.github.composegears.valkyrie.ui.screen.webimport.common
22

33
import androidx.compose.runtime.Stable
44
import androidx.lifecycle.ViewModel
@@ -8,21 +8,22 @@ import com.composegears.tiamat.navigation.asStateFlow
88
import com.composegears.tiamat.navigation.recordOf
99
import io.github.composegears.valkyrie.parser.unified.util.IconNameFormatter
1010
import io.github.composegears.valkyrie.sdk.core.extensions.safeAs
11-
import io.github.composegears.valkyrie.ui.screen.webimport.common.model.FontByteArray
12-
import io.github.composegears.valkyrie.ui.screen.webimport.common.model.GridItem
13-
import io.github.composegears.valkyrie.ui.screen.webimport.standard.common.domain.StandardIconProvider
14-
import io.github.composegears.valkyrie.ui.screen.webimport.standard.common.model.IconStyle
15-
import io.github.composegears.valkyrie.ui.screen.webimport.standard.common.model.InferredCategory
16-
import io.github.composegears.valkyrie.ui.screen.webimport.standard.common.model.SizeSettings
17-
import io.github.composegears.valkyrie.ui.screen.webimport.standard.common.model.StandardIcon
18-
import io.github.composegears.valkyrie.ui.screen.webimport.standard.common.model.StandardIconConfig
19-
import io.github.composegears.valkyrie.ui.screen.webimport.standard.common.util.filterByCategory
11+
import io.github.composegears.valkyrie.ui.screen.webimport.common.domain.StandardIconProvider
12+
import io.github.composegears.valkyrie.ui.screen.webimport.common.domain.category.InferredCategory
13+
import io.github.composegears.valkyrie.ui.screen.webimport.common.domain.font.FontByteArray
14+
import io.github.composegears.valkyrie.ui.screen.webimport.common.domain.icon.GridItem
15+
import io.github.composegears.valkyrie.ui.screen.webimport.common.domain.icon.IconStyle
16+
import io.github.composegears.valkyrie.ui.screen.webimport.common.domain.icon.StandardIcon
17+
import io.github.composegears.valkyrie.ui.screen.webimport.common.domain.icon.StandardIconConfig
18+
import io.github.composegears.valkyrie.ui.screen.webimport.common.domain.settings.SizeSettings
19+
import io.github.composegears.valkyrie.ui.screen.webimport.common.util.filterByCategory
2020
import kotlinx.coroutines.Dispatchers
2121
import kotlinx.coroutines.Job
2222
import kotlinx.coroutines.channels.Channel
2323
import kotlinx.coroutines.flow.receiveAsFlow
2424
import kotlinx.coroutines.launch
2525
import kotlinx.coroutines.withContext
26+
import kotlinx.coroutines.yield
2627

2728
class StandardIconViewModel(
2829
savedState: MutableSavedState,
@@ -67,6 +68,8 @@ class StandardIconViewModel(
6768
val styleKey = normalizedSelectedStyle?.id
6869
restoredFont?.let { fontCache[styleKey] = it }
6970

71+
provider.onStyleChanged(normalizedSelectedStyle)
72+
7073
if (restoredFont == null) {
7174
downloadFont(normalizedSelectedStyle)
7275
}
@@ -105,6 +108,7 @@ class StandardIconViewModel(
105108
settings = SizeSettings(size = provider.persistentSize),
106109
selectedStyle = selectedStyle,
107110
)
111+
provider.onStyleChanged(selectedStyle)
108112
downloadFont(selectedStyle)
109113
prefetchStyleFonts(
110114
styles = config.styles,
@@ -128,10 +132,17 @@ class StandardIconViewModel(
128132

129133
if (cachedFont == null) {
130134
updateSuccess { it.copy(fontByteArray = null) }
135+
// Yield so Compose renders the skeleton before font bytes arrive.
136+
// Without this, providers with in-memory caches (suspendLazy) return
137+
// instantly — both state updates are batched into one frame and the
138+
// skeleton is never visible.
139+
yield()
131140
runCatching {
132141
val bytes = provider.loadFontBytes(resolvedStyle)
133142
fontCache[styleKey] = bytes
134143
updateSuccess { it.copy(fontByteArray = bytes) }
144+
}.onFailure {
145+
updateSuccess { it.copy(fontByteArray = null) }
135146
}
136147
} else {
137148
updateSuccess { it.copy(fontByteArray = cachedFont) }
@@ -177,6 +188,7 @@ class StandardIconViewModel(
177188
val cachedFont = withContext(Dispatchers.Main.immediate) {
178189
fontCache[style.id]
179190
}
191+
provider.onStyleChanged(style)
180192
updateSuccess { state ->
181193
state.copy(
182194
selectedStyle = style,
@@ -269,6 +281,7 @@ sealed interface StandardState {
269281
val searchQuery: String = "",
270282
val settings: SizeSettings = SizeSettings(),
271283
val fontByteArray: FontByteArray? = null,
284+
val fontLoadFailed: Boolean = false,
272285
) : StandardState
273286

274287
data class Error(val message: String) : StandardState

0 commit comments

Comments
 (0)