@momo-kits/native-kits 0.169.13-beta.4-debug → 0.169.13-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 (40) hide show
  1. package/CLAUDE.md +1 -4
  2. package/compose/build.gradle.kts +1 -5
  3. package/compose/compose.podspec +1 -1
  4. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +12 -4
  5. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +11 -3
  6. package/gradle/libs.versions.toml +0 -2
  7. package/gradle.properties +1 -1
  8. package/ios/Navigation/BottomTab/BottomTabBar.swift +14 -4
  9. package/ios/native-kits.podspec +1 -1
  10. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  11. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +16 -3
  12. package/package.json +1 -1
  13. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiActionsTest.kt +0 -647
  14. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiExprTest.kt +0 -1411
  15. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiHostTest.kt +0 -130
  16. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiKitArgsTest.kt +0 -524
  17. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiKitNodesTest.kt +0 -559
  18. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiRenderPlanTest.kt +0 -741
  19. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiRenderReuseTest.kt +0 -221
  20. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiRendererPropsTest.kt +0 -270
  21. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiStylePlanTest.kt +0 -849
  22. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiStyleTest.kt +0 -212
  23. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiTrackingTest.kt +0 -239
  24. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiViewTest.kt +0 -252
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiActions.kt +0 -154
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiExpr.kt +0 -1038
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiKitNodes.kt +0 -848
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiLog.kt +0 -47
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiModel.kt +0 -39
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiPropsRenderer.kt +0 -463
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiRenderer.kt +0 -1146
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiStyle.kt +0 -667
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiTracking.kt +0 -240
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiValidate.kt +0 -185
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiView.kt +0 -200
  36. package/scripts/sdui-visual/README.md +0 -64
  37. package/scripts/sdui-visual/diff.py +0 -65
  38. package/scripts/sdui-visual/drive.py +0 -234
  39. package/scripts/sdui-visual/plan.json +0 -713
  40. package/scripts/sdui-visual/run.sh +0 -92
package/CLAUDE.md CHANGED
@@ -22,18 +22,15 @@ Guidance for working in this repo. Keep it accurate — update it when structure
22
22
  - `navigation/` — `NavigationContainer.kt` (**canonical entry point**), `Navigator.kt`, `Navigation.kt`, `StackScreen.kt`, `bottomtab/`, `component/`, `tracking/`.
23
23
  - `const/` — design tokens: `Theme.kt`, `Colors.kt`, `Typography.kt`, `Spacing.kt`, `Radius.kt`.
24
24
  - `layout/`, `modifier/`, `utils/`.
25
- - `sdui/` — `SduiView(spec, modifier, onError, maxApi)`: embeddable server-driven-UI renderer (JSON spec -> kit components). No host seams: output goes only through the view's MaxApi (`maxApi`, else `LocalMaxApi`) - tracking events via `track` (Trackify), errors/warnings via `logFile` (spec-level identifiers only, deduped, capped). CornerStone / PlatformWidget are not supported: like any unknown type they draw nothing and report `sdui_node_error` (`unsupported_type`); any other child-node failure (`expr_failed`, `unknown_token`, `invalid_action`) is reported the same way, never capped. There is no click/action event: spec authors track clicks with their own `trackEvent` action. Actions use `maxApi` or `LocalMaxApi`; only typed actions exist (`type`: `startFeatureCode` | `trackEvent` | `setState`, required), an action without `type` (or with fields the runtime does not read, e.g. `code`) fails structure validation (SPEC_SHAPE); the runtime skip-and-warn guards are defence only. SduiView draws a section only: screen-level top-level keys (`header`, `footer`, `tabs`, `onMount`, `actions`, ...) fail validation. Device storage (`storage` get/set, MaxApi getItem/setItem) is not supported: such action fields fail structure validation. Expressions (`SduiExpr.kt`) follow JavaScript semantics for every supported construct, with one nullish value (null: `undefined`/missing names convert like JS null; a null optional argument counts as omitted); derived `spec.data` keys (`"{expr}"`) are re-evaluated on every read (memo only within one `evalExpr`), so they track state and repeat locals. Version: `SduiView.VERSION` (semver, set by hand, sent as `sduiVersion` on every tracking event) - bump PATCH for a renderer fix, MINOR for a new node / prop / action, MAJOR when a spec that used to work no longer does; `SduiView.RENDER_VERSION` is the feature level checked against `meta.minRenderVersion`. Tests: `compose/src/androidUnitTest/.../sdui/` (read the gallery/block specs from `sample/shared/.../composeResources/files/sdui/`).
26
25
  - `platform/` — `Platform.kt` `expect` declarations, actualized in `androidMain` / `iosMain` (`Platform.android.kt`, `Platform.ios.kt`).
27
26
 
28
27
  ## Build & verify
29
28
 
30
- The only unit tests are the SDUI ones (`androidUnitTest`); validate everything else by compiling the relevant target(s) and use the sample app for visual checks (the **SDUI** entry lists every bundled spec).
29
+ No unit-test suite is configured. Validate changes by compiling the relevant target(s); use the sample app for visual checks.
31
30
 
32
31
  ```bash
33
32
  ./gradlew :compose:compileCommonMainKotlinMetadata # validate commonMain (fast, do this first)
34
33
  ./gradlew :compose:compileDebugKotlinAndroid # Android target
35
- ./gradlew :compose:testDebugUnitTest # SDUI unit tests (537)
36
- scripts/sdui-visual/run.sh baseline|check # SDUI visual regression on the emulator (see scripts/sdui-visual/README.md)
37
34
  ./gradlew :compose:linkDebugFrameworkIosSimulatorArm64 # iOS framework (slow)
38
35
  ./gradlew :sample:androidApp:installDebug # run demo on device/emulator
39
36
  ```
@@ -40,7 +40,7 @@ kotlin {
40
40
  }
41
41
 
42
42
  cocoapods {
43
- version = "0.169.13-beta.4-debug"
43
+ version = "0.169.13-debug"
44
44
  summary = "IOS Shared module"
45
45
  homepage = "https://momo.vn"
46
46
  ios.deploymentTarget = "15.0"
@@ -86,10 +86,6 @@ kotlin {
86
86
  iosMain.dependencies {
87
87
  implementation(libs.ktor.client.darwin)
88
88
  }
89
- androidUnitTest.dependencies {
90
- implementation(kotlin("test"))
91
- implementation(libs.junit)
92
- }
93
89
  }
94
90
  }
95
91
 
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |spec|
2
2
  spec.name = 'compose'
3
- spec.version = '0.169.13-beta.4-debug'
3
+ spec.version = '0.169.13-debug'
4
4
  spec.homepage = 'https://momo.vn'
5
5
  spec.source = { :http=> ''}
6
6
  spec.authors = ''
@@ -246,7 +246,11 @@ internal fun ColumnScope.TabItemContent(
246
246
  }
247
247
  }
248
248
 
249
- // Badge value shown on a tab: null hides it, "" is a dot, numbers cap at 99+ ("0" hides it, RN parity).
249
+ // text badges keep 5 characters, then "..." ("Khám phá" -> "Khám...")
250
+ private const val BADGE_MAX_CHARS = 5
251
+
252
+ // Badge value shown on a tab: null hides it, "" is a dot, numbers cap at 99+ ("0" hides it, RN parity),
253
+ // text keeps its first 5 characters.
250
254
  internal fun tabBadgeLabel(item: BottomTabItem): String? {
251
255
  val label = item.badgeLabel ?: return if (item.showDot) "" else null
252
256
  if (label.isEmpty()) return ""
@@ -255,7 +259,7 @@ internal fun tabBadgeLabel(item: BottomTabItem): String? {
255
259
  if (value == 0L) return if (item.showDot) "" else null
256
260
  return if (value > 99) "99+" else label
257
261
  }
258
- return label
262
+ return if (label.length > BADGE_MAX_CHARS) label.take(BADGE_MAX_CHARS).trimEnd() + "..." else label
259
263
  }
260
264
 
261
265
  // 24 icon; badges hang off it unclipped: dot at 16/-2, label badge at 12/-7 growing right, or
@@ -287,6 +291,8 @@ internal fun TabIcon(item: BottomTabItem, tint: androidx.compose.ui.graphics.Col
287
291
  }
288
292
  }
289
293
 
294
+ private val BADGE_BORDER = 1.dp
295
+
290
296
  // Numbers use the error color, text the warning color (Figma Badge round numeric / text); the text keeps
291
297
  // its design size so it fits the 16 height on the Duo displays too.
292
298
  @Composable
@@ -297,9 +303,11 @@ private fun TabBadge(label: String, modifier: Modifier) {
297
303
  modifier = modifier
298
304
  .height(16.dp)
299
305
  .widthIn(min = 16.dp, max = TabBarMetrics.badgeMaxWidth)
306
+ // the 1 ring is drawn under the label: Modifier.border would paint over the text
307
+ .background(colors.background.surface, CircleShape)
308
+ .padding(BADGE_BORDER)
300
309
  .background(if (isNumber) colors.error.primary else colors.warning.primary, CircleShape)
301
- .border(1.dp, colors.background.surface, CircleShape)
302
- .padding(horizontal = Spacing.XS),
310
+ .padding(horizontal = Spacing.XS - BADGE_BORDER),
303
311
  contentAlignment = Alignment.Center,
304
312
  ) {
305
313
  ScaleSizeScope(1f) {
@@ -19,7 +19,9 @@ import androidx.compose.ui.unit.DpOffset
19
19
  import androidx.compose.ui.unit.LayoutDirection
20
20
  import androidx.compose.ui.unit.dp
21
21
  import androidx.compose.foundation.background
22
- import androidx.compose.foundation.border
22
+ import androidx.compose.ui.graphics.drawOutline
23
+ import androidx.compose.ui.graphics.drawscope.Stroke
24
+ import androidx.compose.ui.draw.drawBehind
23
25
  import androidx.compose.runtime.Composable
24
26
  import vn.momo.kits.const.AppTheme
25
27
 
@@ -89,6 +91,7 @@ internal fun Modifier.spreadShadow(shape: Shape, shadow: Shadow): Modifier {
89
91
  // Floating shadow follows the shape (Figma Shadow/floating: 12% blur 24, 4% y12 blur 32 spread -16).
90
92
  @Composable
91
93
  internal fun Modifier.tabBarContainer(shape: Shape): Modifier {
94
+ val borderColor = AppTheme.current.colors.border.default
92
95
  return dropShadow(shape, Shadow(radius = 24.dp, color = Color.Black, alpha = 0.12f))
93
96
  .spreadShadow(
94
97
  shape,
@@ -98,6 +101,11 @@ internal fun Modifier.tabBarContainer(shape: Shape): Modifier {
98
101
  AppTheme.current.colors.background.surface.copy(alpha = TabBarMetrics.backgroundOpacity),
99
102
  shape,
100
103
  )
101
- // Figma .Nav/Background: 1px light-gray hairline defining the pill edge
102
- .border(1.dp, AppTheme.current.colors.border.default, shape)
104
+ // Figma .Nav/Background: 1px light-gray hairline defining the pill edge, drawn under the items
105
+ // (Modifier.border paints over children, cutting a badge that reaches the rounded end)
106
+ .drawBehind {
107
+ val hairline = 1.dp.toPx()
108
+ val outline = InsetShape(shape, 0.5.dp).createOutline(size, layoutDirection, this)
109
+ drawOutline(outline, borderColor, style = Stroke(hairline))
110
+ }
103
111
  }
@@ -5,7 +5,6 @@ android-targetSdk = "36"
5
5
  ktor-version = "3.0.0-rc-1"
6
6
  coroutines = "1.9.0"
7
7
  kotlin = "2.3.10"
8
- junit = "4.13.2"
9
8
  kSerialize = "1.7.1"
10
9
  compose = "1.10.3"
11
10
  navigation-multiplatform = "2.9.2"
@@ -30,7 +29,6 @@ ktor-client-darwin = { group = "io.ktor", name = "ktor-client-darwin", version.r
30
29
  ktor-client-okhttp = { group = "io.ktor", name = "ktor-client-okhttp", version.ref = "ktor-version" }
31
30
  jetbrains-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutines" }
32
31
  jetbrains-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" }
33
- junit = { group = "junit", name = "junit", version.ref = "junit" }
34
32
  jetbrains-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutines" }
35
33
  jetbrains-serialization = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization", version.ref = "kSerialize" }
36
34
  jetbrains-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kSerialize" }
package/gradle.properties CHANGED
@@ -18,7 +18,7 @@ kotlin.apple.xcodeCompatibility.nowarn=true
18
18
  name="ComposeKits"
19
19
  group=vn.momo.kits
20
20
  artifact.id=kits
21
- version=0.169.13-beta.4
21
+ version=0.169.13
22
22
 
23
23
  repo=GitLab
24
24
  url=https://artifacts.mservice.com.vn/repository/maven-momo-app/
@@ -250,7 +250,11 @@ struct TabItemContent: View {
250
250
  }
251
251
  }
252
252
 
253
- /// Badge value shown on a tab: nil hides it, "" is a dot, numbers cap at 99+ ("0" hides it, RN parity).
253
+ /// Text badges keep 5 characters, then "..." ("Khám phá" -> "Khám...").
254
+ private let badgeMaxChars = 5
255
+
256
+ /// Badge value shown on a tab: nil hides it, "" is a dot, numbers cap at 99+ ("0" hides it, RN parity),
257
+ /// text keeps its first 5 characters.
254
258
  func tabBadgeLabel(_ item: BottomTabItem) -> String? {
255
259
  guard let label = item.badgeLabel else { return item.showDot ? "" : nil }
256
260
  if label.isEmpty { return "" }
@@ -259,7 +263,9 @@ func tabBadgeLabel(_ item: BottomTabItem) -> String? {
259
263
  if value == 0 { return item.showDot ? "" : nil }
260
264
  return value > 99 ? "99+" : label
261
265
  }
262
- return label
266
+ guard label.count > badgeMaxChars else { return label }
267
+ let head = String(label.prefix(badgeMaxChars))
268
+ return head.trimmingCharacters(in: .whitespaces) + "..."
263
269
  }
264
270
 
265
271
  /// 24 icon, active and inactive tints cross-faded; badges hang off it: dot at 16/-2, label badge at
@@ -314,8 +320,12 @@ private struct TabBadge: View {
314
320
  .scaleSizeMaxRate(1)
315
321
  .padding(.horizontal, Spacing.XS)
316
322
  .frame(minWidth: 16, maxWidth: TabBarMetrics.badgeMaxWidth, minHeight: 16, maxHeight: 16)
317
- .background(Capsule().fill(isNumber ? theme.colors.error.primary : theme.colors.warning.primary))
318
- .overlay(Capsule().strokeBorder(theme.colors.background.surface, lineWidth: 1))
323
+ // the ring sits under the label: an overlay stroke would paint over the text
324
+ .background(
325
+ Capsule()
326
+ .fill(isNumber ? theme.colors.error.primary : theme.colors.warning.primary)
327
+ .overlay(Capsule().strokeBorder(theme.colors.background.surface, lineWidth: 1))
328
+ )
319
329
  }
320
330
  }
321
331
 
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKits'
3
- s.version = '0.169.13-beta.4'
3
+ s.version = '0.169.13'
4
4
  s.summary = 'MoMoUIKits for iOS'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKitsDemo'
3
- s.version = '0.169.13-beta.4'
3
+ s.version = '0.169.13'
4
4
  s.summary = 'Demo browser for MoMoUIKits SwiftUI components'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
@@ -89,7 +89,18 @@ private func ctaLottie(_ animation: LottieAnimation?, offset: CGFloat) -> some V
89
89
  }
90
90
  private let badges: [(String, String?)] = [
91
91
  ("Không", nil), ("Dot \"\"", ""), ("\"0\"", "0"), ("\"5\"", "5"),
92
- ("\"1999\"", "1999"), ("\"Mới\"", "Mới"), ("Chữ dài", "Khuyến mãi lớn"),
92
+ ("\"1999\"", "1999"), ("\"Mới\"", "Mới"),
93
+ ]
94
+
95
+ /// "Chữ dài" picks one of these at random on every tap.
96
+ private let longBadges = [
97
+ "Khuyến mãi lớn",
98
+ "Khám phá ngay",
99
+ "Ưu đãi cực sốc",
100
+ "Quà tặng hấp dẫn",
101
+ "Hoàn tiền mỗi ngày",
102
+ "Siêu sale cuối tuần",
103
+ "Thanh toán hóa đơn",
93
104
  ]
94
105
 
95
106
  struct BottomTabDemoContent: View {
@@ -175,10 +186,12 @@ private struct TabContent: View {
175
186
  Section(title: "Tab đang mở · \(name)") {
176
187
  IconOptions(title: "icon", icons: icons, value: tab.icon) { icon in updateTab { $0.icon = icon } }
177
188
  Options(title: "badgeLabel",
178
- hint: "\"\" là dot, \"0\" ẩn badge, số > 99 hiện 99+, chữ dài bị cắt ở 58",
189
+ hint: "\"\" là dot, \"0\" ẩn badge, số > 99 hiện 99+, chữ > 5 ký tự cắt thành 5 ký tự + \"...\"",
179
190
  options: badges.map { title, value in
180
191
  Option(title: title, selected: tab.badgeLabel == value) { updateTab { $0.badgeLabel = value } }
181
- })
192
+ } + [Option(title: "Chữ dài", selected: longBadges.contains(tab.badgeLabel ?? "")) {
193
+ updateTab { $0.badgeLabel = longBadges.randomElement() }
194
+ }])
182
195
  Options(title: "showDot",
183
196
  hint: "Hiện dot khi không có badgeLabel hoặc badgeLabel là \"0\"",
184
197
  options: yesNo(tab.showDot) { value in updateTab { $0.showDot = value } })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.169.13-beta.4-debug",
3
+ "version": "0.169.13-debug",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "publish:local": "bash publish.sh local"