@momo-kits/native-kits 0.162.3-debug → 0.162.3-fontscale.1-debug

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/.codegraph/.gitignore +5 -0
  2. package/CLAUDE.md +78 -0
  3. package/compose/build.gradle.kts +12 -8
  4. package/compose/build.gradle.kts.backup +11 -7
  5. package/compose/compose.podspec +1 -1
  6. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +2 -7
  7. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +3 -11
  8. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +6 -24
  9. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +4 -19
  10. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +1 -10
  11. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +2 -2
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +1 -1
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +1 -1
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +6 -17
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +1 -1
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +6 -101
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +5 -19
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +8 -33
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +1 -1
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +1 -6
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +27 -29
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +3 -26
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +27 -26
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +3 -13
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -5
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +3 -11
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +3 -18
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +11 -11
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +3 -11
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +69 -26
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +1 -5
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +84 -59
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +13 -71
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +10 -51
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +6 -1
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +4 -21
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +1 -1
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +16 -75
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +5 -26
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +1 -1
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +3 -11
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +16 -40
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +3 -9
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -28
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +2 -13
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +4 -10
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +3 -28
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +8 -47
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +4 -25
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +2 -11
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +1 -17
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +1 -6
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +50 -111
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +1 -5
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +1 -5
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +1 -12
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +4 -96
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +5 -7
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +2 -12
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +9 -21
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +2 -2
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +9 -14
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +8 -11
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +1 -1
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +3 -18
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +1 -1
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -5
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -2
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +94 -4
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -2
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +2 -2
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +3 -7
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +5 -15
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +42 -24
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +48 -33
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +58 -57
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +28 -25
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +13 -31
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +1 -1
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +6 -24
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +11 -6
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +2 -1
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +9 -6
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +1 -1
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +3 -13
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +3 -2
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +1 -40
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -2
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -8
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +2 -17
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +1 -1
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +3 -3
  94. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +2 -3
  95. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -2
  96. package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Example.xcscheme +32 -0
  97. package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  98. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  99. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/WorkspaceSettings.xcsettings +16 -0
  100. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +6 -0
  101. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +5 -0
  102. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +58 -0
  103. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Pods-Example.xcscheme +58 -0
  104. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImage.xcscheme +58 -0
  105. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +58 -0
  106. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SkeletonUI.xcscheme +58 -0
  107. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios-LottiePrivacyInfo.xcscheme +58 -0
  108. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios.xcscheme +58 -0
  109. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +60 -0
  110. package/gradle/libs.versions.toml +2 -0
  111. package/gradle.properties +1 -1
  112. package/ios/Application/Components.swift +1 -0
  113. package/ios/Application/FloatingButton.swift +1 -0
  114. package/ios/Badge/Badge.swift +1 -0
  115. package/ios/Badge/BadgeRibbon.swift +2 -0
  116. package/ios/Button/Button.swift +1 -1
  117. package/ios/Checkbox/Checkbox.swift +1 -0
  118. package/ios/Information/Information.swift +151 -0
  119. package/ios/Input/Input.swift +1 -0
  120. package/ios/Input/InputPhoneNumber.swift +1 -0
  121. package/ios/Input/InputSearch.swift +3 -0
  122. package/ios/Input/InputTextArea.swift +1 -0
  123. package/ios/OTPKeyboard/KeyboardButton.swift +1 -1
  124. package/ios/Popup/PopupDisplay.swift +6 -0
  125. package/ios/Popup/PopupInput.swift +2 -0
  126. package/ios/Template/TrustBanner/TrustBanner.swift +2 -0
  127. package/ios/Typography/Text.swift +1 -0
  128. package/ios/Typography/Typography.swift +14 -5
  129. package/local.properties +8 -0
  130. package/package.json +1 -1
@@ -10,13 +10,7 @@ import androidx.compose.foundation.lazy.LazyColumn
10
10
  import androidx.compose.foundation.lazy.LazyListState
11
11
  import androidx.compose.foundation.lazy.rememberLazyListState
12
12
  import androidx.compose.foundation.shape.RoundedCornerShape
13
- import androidx.compose.runtime.Composable
14
- import androidx.compose.runtime.LaunchedEffect
15
- import androidx.compose.runtime.getValue
16
- import androidx.compose.runtime.mutableStateOf
17
- import androidx.compose.runtime.remember
18
- import androidx.compose.runtime.setValue
19
- import androidx.compose.runtime.snapshotFlow
13
+ import androidx.compose.runtime.*
20
14
  import androidx.compose.ui.Alignment
21
15
  import androidx.compose.ui.Modifier
22
16
  import androidx.compose.ui.draw.alpha
@@ -25,6 +19,7 @@ import androidx.compose.ui.platform.LocalDensity
25
19
  import androidx.compose.ui.unit.Dp
26
20
  import androidx.compose.ui.unit.dp
27
21
  import androidx.compose.ui.zIndex
22
+ import kotlinx.coroutines.FlowPreview
28
23
  import kotlinx.coroutines.delay
29
24
  import kotlinx.coroutines.flow.collect
30
25
  import kotlinx.coroutines.flow.debounce
@@ -36,12 +31,14 @@ import vn.momo.kits.const.Colors
36
31
  import vn.momo.kits.const.Radius
37
32
  import vn.momo.kits.const.Typography
38
33
  import kotlin.math.abs
34
+ import kotlin.time.Duration.Companion.milliseconds
39
35
 
40
36
  private val wheelItemHeight = 42.dp
41
37
  private val wheelPickerBorderWidth = 1.dp
42
38
 
39
+ @OptIn(FlowPreview::class)
43
40
  @Composable
44
- fun WheelPicker(
41
+ internal fun WheelPicker(
45
42
  name: String,
46
43
  data: List<String>,
47
44
  selectedData: String,
@@ -68,7 +65,7 @@ fun WheelPicker(
68
65
  LaunchedEffect(paddedData) {
69
66
  snapshotFlow { selectedIndex }
70
67
  .distinctUntilChanged()
71
- .debounce(50)
68
+ .debounce(50.milliseconds)
72
69
  .onEach {
73
70
  val value = paddedData.getOrNull(it)
74
71
  if (!value.isNullOrEmpty()) {
@@ -95,7 +92,7 @@ fun WheelPicker(
95
92
  } else {
96
93
  -abs(firstItemOffset)
97
94
  }
98
- delay(50)
95
+ delay(50.milliseconds)
99
96
  listState.animateScrollBy(offset.toFloat())
100
97
  val centeredIndex = firstItemIdx + (if (isScrollUp) 1 else 0) + 2
101
98
  if (centeredIndex in 2 until paddedData.size - 2) {
@@ -145,7 +142,7 @@ fun WheelPicker(
145
142
  }
146
143
 
147
144
  @Composable
148
- fun WheelPickerItem(
145
+ internal fun WheelPickerItem(
149
146
  text: String,
150
147
  isSelected: Boolean,
151
148
  index: Int,
@@ -64,7 +64,7 @@ data class Theme(
64
64
  val assets: ThemeAssets
65
65
  ) {
66
66
  fun isHeaderImage(): Boolean {
67
- return assets.headerBackground != null && assets.headerBackground.isNotEmpty()
67
+ return !assets.headerBackground.isNullOrEmpty()
68
68
  }
69
69
  }
70
70
  val defaultTheme = Theme(
@@ -7,28 +7,13 @@ import androidx.compose.ui.text.TextStyle
7
7
  import androidx.compose.ui.text.font.FontFamily
8
8
  import androidx.compose.ui.text.font.FontWeight
9
9
  import androidx.compose.ui.text.style.TextDecoration
10
- import androidx.compose.ui.unit.Dp
11
- import androidx.compose.ui.unit.TextUnit
12
- import androidx.compose.ui.unit.TextUnitType
13
- import androidx.compose.ui.unit.dp
14
- import androidx.compose.ui.unit.sp
10
+ import androidx.compose.ui.unit.*
15
11
  import org.jetbrains.compose.resources.Font
16
12
  import org.jetbrains.compose.resources.FontResource
17
13
  import org.jetbrains.compose.resources.InternalResourceApi
18
14
  import vn.momo.kits.application.ScaleSizeMaxRate
19
15
  import vn.momo.kits.platform.getScreenDimensions
20
- import vn.momo.uikits.resources.Res
21
- import vn.momo.uikits.resources.momosignature
22
- import vn.momo.uikits.resources.momotrustdisplay
23
- import vn.momo.uikits.resources.sfprotext_black
24
- import vn.momo.uikits.resources.sfprotext_bold
25
- import vn.momo.uikits.resources.sfprotext_heavy
26
- import vn.momo.uikits.resources.sfprotext_light
27
- import vn.momo.uikits.resources.sfprotext_medium
28
- import vn.momo.uikits.resources.sfprotext_regular
29
- import vn.momo.uikits.resources.sfprotext_semibold
30
- import vn.momo.uikits.resources.sfprotext_thin
31
- import vn.momo.uikits.resources.sfprotext_ultralight
16
+ import vn.momo.uikits.resources.*
32
17
  import kotlin.math.max
33
18
  import kotlin.math.min
34
19
 
@@ -98,7 +83,7 @@ fun scaleSize(textStyle: TextStyle): TextStyle {
98
83
 
99
84
  @OptIn(InternalResourceApi::class)
100
85
  @Composable
101
- fun getFont(font: FontResource): FontFamily {
86
+ internal fun getFont(font: FontResource): FontFamily {
102
87
  return FontFamily(Font(font))
103
88
  }
104
89
 
@@ -18,7 +18,7 @@ data class GridContext(
18
18
  fun Item(
19
19
  heightSpan: Number = 1,
20
20
  widthSpan: Number = 1,
21
- content: @Composable() () -> Unit,
21
+ content: @Composable () -> Unit,
22
22
  modifier: Modifier = Modifier,
23
23
  grid: GridContext
24
24
  ) {
@@ -20,11 +20,6 @@ fun Modifier.setAutomationId(accessibilityId: String, mergeDescendants: Boolean
20
20
  }
21
21
  }}
22
22
 
23
- /**
24
- * Alternative for [setAutomationId]
25
- *
26
- * reason: [link](https://developer.android.com/develop/ui/compose/custom-modifiers#composable_function_modifiers_are_never_skipped)
27
- * */
28
23
  fun Modifier.kitsAutomationId(accessibilityId: String, label: String? = null) =
29
24
  this then KitsAutomationIdElement(accessibilityId, label)
30
25
 
@@ -53,8 +53,6 @@ fun Modifier.activeOpacityClickable(
53
53
  onClick
54
54
  )
55
55
  }
56
-
57
-
58
56
  fun Modifier.hideKeyboardOnTap() = composed {
59
57
  val focusManager = LocalFocusManager.current
60
58
  val keyboardManager = LocalSoftwareKeyboardController.current
@@ -1,14 +1,104 @@
1
1
  package vn.momo.kits.modifier
2
2
 
3
- import androidx.compose.foundation.background
3
+ import androidx.compose.animation.core.LinearEasing
4
+ import androidx.compose.animation.core.RepeatMode
5
+ import androidx.compose.animation.core.animateFloat
6
+ import androidx.compose.animation.core.infiniteRepeatable
7
+ import androidx.compose.animation.core.rememberInfiniteTransition
8
+ import androidx.compose.animation.core.tween
4
9
  import androidx.compose.runtime.Composable
10
+ import androidx.compose.runtime.getValue
5
11
  import androidx.compose.ui.Modifier
12
+ import androidx.compose.ui.draw.drawWithContent
13
+ import androidx.compose.ui.geometry.Offset
14
+ import androidx.compose.ui.graphics.Color
15
+ import androidx.compose.ui.graphics.drawscope.clipRect
16
+ import androidx.compose.ui.text.TextStyle
17
+ import androidx.compose.ui.text.drawText
18
+ import androidx.compose.ui.text.font.FontWeight
19
+ import androidx.compose.ui.text.rememberTextMeasurer
20
+ import androidx.compose.ui.unit.sp
6
21
  import vn.momo.kits.application.IsShowBaseLineDebug
7
22
  import vn.momo.kits.const.Colors
8
23
 
24
+ @Suppress("ExperimentalAnnotationRetention")
25
+ @RequiresOptIn(
26
+ message = "This is internal API of native-kits, become internal in next sprint",
27
+ level = RequiresOptIn.Level.WARNING,
28
+ )
29
+ @Retention(AnnotationRetention.BINARY)
30
+ @Target(
31
+ AnnotationTarget.CLASS,
32
+ AnnotationTarget.FUNCTION,
33
+ AnnotationTarget.PROPERTY,
34
+ )
35
+ annotation class InternalApi
36
+
37
+ @Composable
38
+ fun DeprecatedModifier(text: String = "Deprecated component"): Modifier = debugMarker(
39
+ label = text,
40
+ background = Colors.red_04.copy(alpha = 0.7f),
41
+ textColor = Colors.red_01,
42
+ animationLabel = "deprecatedMarquee",
43
+ )
44
+
9
45
  @Composable
10
- fun DeprecatedModifier(): Modifier {
11
- return Modifier.conditional(IsShowBaseLineDebug) {
12
- background(Colors.red_01.copy(alpha = 0.5f))
46
+ private fun debugMarker(
47
+ label: String,
48
+ background: Color,
49
+ textColor: Color,
50
+ animationLabel: String,
51
+ ): Modifier {
52
+ if (!IsShowBaseLineDebug) return Modifier
53
+
54
+ val textMeasurer = rememberTextMeasurer()
55
+ val marquee = rememberInfiniteTransition(label = animationLabel)
56
+ val progress by marquee.animateFloat(
57
+ initialValue = 0f,
58
+ targetValue = 1f,
59
+ animationSpec = infiniteRepeatable(
60
+ animation = tween(durationMillis = 4000, easing = LinearEasing),
61
+ repeatMode = RepeatMode.Restart,
62
+ ),
63
+ label = "${animationLabel}Progress",
64
+ )
65
+
66
+ return Modifier.drawWithContent {
67
+ drawContent()
68
+ drawRect(color = background)
69
+
70
+ if (size.width <= 0f || size.height <= 0f) return@drawWithContent
71
+
72
+ val fontPx = (size.width * 0.1f).coerceIn(12.sp.toPx(), 20.sp.toPx())
73
+ val style = TextStyle(
74
+ color = textColor,
75
+ fontSize = fontPx.toSp(),
76
+ fontWeight = FontWeight.Bold,
77
+ )
78
+
79
+ val intrinsic = textMeasurer.measure(
80
+ text = label,
81
+ style = style,
82
+ maxLines = 1,
83
+ softWrap = false,
84
+ )
85
+ val textW = intrinsic.size.width
86
+ val textH = intrinsic.size.height
87
+ val y = (size.height - textH) / 2f
88
+
89
+ if (textW <= size.width) {
90
+ drawText(
91
+ textLayoutResult = intrinsic,
92
+ topLeft = Offset((size.width - textW) / 2f, y),
93
+ )
94
+ } else {
95
+ clipRect(right = size.width, bottom = size.height) {
96
+ val gap = textW * 0.5f
97
+ val travel = textW + gap
98
+ val x = -progress * travel
99
+ drawText(textLayoutResult = intrinsic, topLeft = Offset(x, y))
100
+ drawText(textLayoutResult = intrinsic, topLeft = Offset(x + travel, y))
101
+ }
102
+ }
13
103
  }
14
104
  }
@@ -9,8 +9,6 @@ import androidx.compose.ui.unit.Dp
9
9
  import androidx.compose.ui.unit.dp
10
10
  import vn.momo.kits.platform.setColor
11
11
  import vn.momo.kits.platform.setMaskFilter
12
-
13
-
14
12
  fun Modifier.shadow(
15
13
  color: Color = Color.Black,
16
14
  borderRadius: Dp = 0.dp,
@@ -41,7 +41,7 @@ import vn.momo.kits.const.AppTheme
41
41
  import vn.momo.kits.const.Colors
42
42
  import vn.momo.kits.const.Radius
43
43
  import vn.momo.kits.const.Spacing
44
- import vn.momo.kits.application.ApplicationContext
44
+ import vn.momo.kits.application.LocalContext
45
45
  import vn.momo.kits.application.IsShowBaseLineDebug
46
46
  import vn.momo.kits.const.Typography
47
47
  import vn.momo.kits.navigation.tracking.ScreenTracker
@@ -73,7 +73,7 @@ internal fun BottomSheet(
73
73
  val coroutineScope = rememberCoroutineScope()
74
74
 
75
75
  val maxApi = LocalMaxApi.current
76
- val context = ApplicationContext.current
76
+ val context = LocalContext.current
77
77
 
78
78
  DisposableEffect(Unit) {
79
79
  ScreenTracker.trackPopupDisplayed(
@@ -10,11 +10,7 @@ import androidx.compose.foundation.interaction.MutableInteractionSource
10
10
  import androidx.compose.foundation.layout.Box
11
11
  import androidx.compose.foundation.layout.fillMaxSize
12
12
  import androidx.compose.foundation.layout.wrapContentSize
13
- import androidx.compose.runtime.Composable
14
- import androidx.compose.runtime.DisposableEffect
15
- import androidx.compose.runtime.LaunchedEffect
16
- import androidx.compose.runtime.remember
17
- import androidx.compose.runtime.rememberCoroutineScope
13
+ import androidx.compose.runtime.*
18
14
  import androidx.compose.ui.Alignment
19
15
  import androidx.compose.ui.Modifier
20
16
  import androidx.compose.ui.draw.alpha
@@ -22,7 +18,7 @@ import androidx.compose.ui.draw.scale
22
18
  import androidx.compose.ui.graphics.Color
23
19
  import androidx.compose.ui.unit.dp
24
20
  import kotlinx.coroutines.launch
25
- import vn.momo.kits.application.ApplicationContext
21
+ import vn.momo.kits.application.LocalContext
26
22
  import vn.momo.kits.application.IsShowBaseLineDebug
27
23
  import vn.momo.kits.const.Colors
28
24
  import vn.momo.kits.modifier.conditional
@@ -44,7 +40,7 @@ internal fun ModalScreen(
44
40
  val coroutineScope = rememberCoroutineScope()
45
41
 
46
42
  val maxApi = LocalMaxApi.current
47
- val context = ApplicationContext.current
43
+ val context = LocalContext.current
48
44
 
49
45
  DisposableEffect(Unit) {
50
46
  ScreenTracker.trackPopupDisplayed(
@@ -1,24 +1,16 @@
1
1
  package vn.momo.kits.navigation
2
2
 
3
3
  import androidx.compose.foundation.gestures.ScrollableState
4
- import androidx.compose.runtime.Composable
5
- import androidx.compose.runtime.Stable
6
- import androidx.compose.runtime.State
7
- import androidx.compose.runtime.mutableStateOf
8
- import androidx.compose.runtime.staticCompositionLocalOf
4
+ import androidx.compose.runtime.*
9
5
  import androidx.compose.ui.graphics.Color
10
6
  import vn.momo.kits.navigation.bottomtab.setBottomTabOption
11
- import vn.momo.kits.navigation.component.FloatingButtonProps
12
- import vn.momo.kits.navigation.component.HeaderBackProps
13
- import vn.momo.kits.navigation.component.HeaderRight
14
- import vn.momo.kits.navigation.component.HeaderTitle
15
- import vn.momo.kits.navigation.component.HeaderType
16
- import vn.momo.kits.navigation.component.TitlePosition
7
+ import vn.momo.kits.navigation.component.*
17
8
 
18
9
  class Navigation(
19
10
  val id: Int = -1,
20
11
  val bottomTabIndex: Int = -1,
21
- val initOptions: NavigationOptions? = null
12
+ val initOptions: NavigationOptions? = null,
13
+ private val registry: DynamicScreenRegistry? = null
22
14
  ) {
23
15
  private val _options = mutableStateOf(initOptions ?: NavigationOptions())
24
16
  val currentOptions: State<NavigationOptions> get() = _options
@@ -65,7 +57,7 @@ class Navigation(
65
57
  private fun updateOptions(updated: NavigationOptions) {
66
58
  _options.value = updated
67
59
  if (bottomTabIndex != -1) setBottomTabOption(bottomTabIndex, updated)
68
- if (id != -1) DynamicScreenRegistry.setOptions(id, updated)
60
+ if (id != -1) registry?.setOptions(id, updated)
69
61
  }
70
62
  }
71
63
 
@@ -95,8 +87,6 @@ data class KeyboardOptions(
95
87
  val keyboardShouldPersistTaps: Boolean = false,
96
88
  val useAvoidKeyboard: Boolean = true
97
89
  )
98
-
99
-
100
90
  data class ScrollData(
101
91
  val scrollable: Boolean = true,
102
92
  val scrollState: ScrollableState? = null,
@@ -22,50 +22,61 @@ fun NavigationContainer(
22
22
  initialScreen: @Composable () -> Unit,
23
23
  options: NavigationOptions? = null,
24
24
  initialTheme: Theme = defaultTheme,
25
- applicationContext: MiniAppContext? = null,
25
+ miniAppContext: MiniAppContext? = null,
26
26
  maxApi: IMaxApi? = null,
27
27
  setNavigator: ((Navigator) -> Unit)? = null,
28
28
  statusBarHeight: Dp? = null,
29
- config: KitConfig? = null,
30
- language: String? = null
29
+ localize: Localize? = null,
31
30
  ){
32
31
  val navController = rememberNavController()
33
- val navigator = remember { Navigator(navController = navController, maxApi = maxApi) }
32
+ val registry = remember { DynamicScreenRegistry() }
33
+ val navigator = remember { Navigator(navController = navController, maxApi = maxApi, registry = registry) }
34
34
  val statusBarHeight = statusBarHeight ?: getAppStatusBarHeight()
35
35
  val navigationBarHeight = getNavigationBarHeight()
36
36
 
37
- val parentContext = ApplicationContext.current
38
- val mergedContext = MiniAppContext.merge(parentContext, applicationContext)
37
+ val parentContext = LocalContext.current
38
+ val mergedContext = MiniAppContext.merge(parentContext, miniAppContext)
39
39
 
40
40
  val theme = remember { mutableStateOf(initialTheme) }
41
+ val fallbackLocalize = remember { Localize() }
41
42
 
42
- LaunchedEffect(Unit) {
43
- val headerBar = config?.headerBar
44
- if (headerBar != null && theme.value.assets.headerBackground == null) {
45
- theme.value = theme.value.copy(
46
- assets = ThemeAssets(
47
- headerBackground = headerBar
48
- )
49
- )
43
+ val resolvedLocalize = localize ?: fallbackLocalize
44
+
45
+ LaunchedEffect(maxApi, resolvedLocalize) {
46
+ val api = maxApi ?: return@LaunchedEffect
47
+ runCatching {
48
+ api.getLanguage(callback = { data ->
49
+ if (parseLanguage(data) == Localize.EN) {
50
+ resolvedLocalize.changeLanguage(Localize.EN)
51
+ }
52
+ })
53
+ }
54
+ // TEMP: verify FontScale MaxApi end-to-end via dynamic dispatch — remove after test
55
+ runCatching {
56
+ api.maxDispatcher.dispatchAsync("getFontScale", arrayOf<Any?>()) { resp ->
57
+ println("[FontScale][native-kit] getFontScale -> $resp")
58
+ }
59
+ api.maxDispatcher.dispatchAsync("setFontScale", arrayOf<Any?>(1.5f)) { resp ->
60
+ println("[FontScale][native-kit] setFontScale -> $resp")
61
+ }
50
62
  }
51
63
  }
52
64
 
53
- val screenId = rememberSaveable { DynamicScreenRegistry.nextId() }
54
- DynamicScreenRegistry.bind(screenId, initialScreenName, initialScreen, options)
65
+ val screenId = rememberSaveable { registry.nextId() }
66
+ registry.bind(screenId, initialScreenName, initialScreen, options)
55
67
  val startDestination = remember(screenId) { DynamicScreenRoute(screenId) }
56
68
 
57
69
  ProvideNavigationEventDispatcherOwner {
58
70
  CompositionLocalProvider(
59
71
  LocalNavigator provides navigator,
72
+ LocalDynamicScreenRegistry provides registry,
60
73
  LocalMaxApi provides maxApi,
61
74
  AppTheme provides theme.value,
62
75
  AppStatusBar provides statusBarHeight,
63
76
  AppNavigationBar provides navigationBarHeight,
64
- ApplicationContext provides mergedContext,
65
- AppConfig provides config,
66
- AppLanguage provides language,
67
- ScaleSizeMaxRate provides mergedContext?.scaleSizeMaxRate,
68
- ) {
77
+ LocalContext provides mergedContext,
78
+ LocalLocalize provides resolvedLocalize,
79
+ ) {
69
80
  LaunchedEffect(Unit) {
70
81
  setNavigator?.invoke(navigator)
71
82
  }
@@ -88,7 +99,7 @@ fun NavigationContainer(
88
99
  }
89
100
  ) { backStackEntry ->
90
101
  val route = backStackEntry.toRoute<DynamicScreenRoute>()
91
- val screen = DynamicScreenRegistry.getScreen(route.id)
102
+ val screen = registry.getScreen(route.id)
92
103
 
93
104
  if (screen != null) {
94
105
  StackScreen(
@@ -117,7 +128,7 @@ fun NavigationContainer(
117
128
  }
118
129
  ) { backStackEntry ->
119
130
  val route = backStackEntry.toRoute<DynamicDialogRoute>()
120
- val screen = DynamicScreenRegistry.getScreen(route.id)
131
+ val screen = registry.getScreen(route.id)
121
132
 
122
133
  if (screen != null) {
123
134
  StackScreen(
@@ -135,7 +146,7 @@ fun NavigationContainer(
135
146
  DisposableEffect(Unit) {
136
147
  onDispose {
137
148
  navigator.dispose()
138
- DynamicScreenRegistry.unregisterScreen(screenId)
149
+ registry.unregisterScreen(screenId)
139
150
  }
140
151
  }
141
152
  }
@@ -143,3 +154,10 @@ fun NavigationContainer(
143
154
  val LocalMaxApi = staticCompositionLocalOf<IMaxApi?> {
144
155
  error("No MaxApi provided")
145
156
  }
157
+
158
+ private fun parseLanguage(raw: Map<String, Any?>?): String? {
159
+ val code = (raw?.get("response") as? String)?.trim()?.lowercase()
160
+ if (code.isNullOrEmpty()) return null
161
+ return if (code.startsWith(Localize.EN)) Localize.EN else Localize.VI
162
+ }
163
+