@momo-kits/native-kits 0.169.4-debug → 0.169.5-beta.1

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 (148) hide show
  1. package/CLAUDE.md +1 -1
  2. package/PUBLISH_GUIDE.md +3 -10
  3. package/ios/Navigation/BottomTab/BottomTabBar.swift +21 -6
  4. package/ios/Navigation/BottomTab/TabBarMetrics.swift +4 -0
  5. package/ios/Typography/FontScale.swift +28 -5
  6. package/ios/native-kits.podspec +1 -1
  7. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  8. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +21 -9
  9. package/package.json +1 -4
  10. package/publish.sh +10 -36
  11. package/build.gradle.kts +0 -11
  12. package/compose/build.gradle.kts +0 -198
  13. package/compose/compose.podspec +0 -47
  14. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -20
  15. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  16. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
  17. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  18. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -154
  19. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +0 -17
  20. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +0 -6
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -110
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +0 -62
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -1071
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -269
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -81
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -357
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -115
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -542
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -86
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -231
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -195
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -478
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -114
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -265
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -223
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -265
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -185
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -84
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -363
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -108
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -308
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -90
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -330
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -473
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -207
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -92
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -560
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -125
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -207
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -501
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -236
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -180
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -17
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -194
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -287
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -50
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +0 -187
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -316
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -393
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -153
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -113
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -205
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -422
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -739
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -239
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -389
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -94
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +0 -97
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +0 -203
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +0 -104
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -169
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -455
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -105
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -74
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -399
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -39
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -363
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +0 -192
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -133
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -92
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -76
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +0 -7
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +0 -22
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  132. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -118
  133. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -42
  134. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
  135. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
  136. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
  137. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
  138. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -219
  139. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +0 -48
  140. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +0 -144
  141. package/gradle/libs.versions.toml +0 -69
  142. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  143. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  144. package/gradle.properties +0 -24
  145. package/gradlew +0 -252
  146. package/gradlew.bat +0 -94
  147. package/ios-demo/README.md +0 -120
  148. package/settings.gradle.kts +0 -64
package/CLAUDE.md CHANGED
@@ -42,7 +42,7 @@ xcodebuild -project sample/iosApp/Pods/Pods.xcodeproj -scheme MoMoUIKits -sdk ip
42
42
  -destination 'generic/platform=iOS Simulator' build
43
43
  ```
44
44
 
45
- Publishing is automated (`.gitlab-ci.yml` → `publish.sh`; see `PUBLISH_GUIDE.md`): `main` → npm latest + 1 patch (tag `latest`; a manual run with `RELEASE_VERSION` sets the sprint version), other branches on `[ci build]` → `<npm latest + 1 patch>-beta.N`. The version is never stored in the repo — `scripts/ci/resolve-version.mjs` bases it on npm and only takes a number free on **both** npm (incl. `-debug`) and GitLab Maven. Locally, `bash publish.sh local` publishes a beta of the working tree as is (uncommitted changes too, any branch; same beta numbering); `release` is CI-only. Do not publish unless asked; `bash publish.sh local --dry-run` shows the version and packs the tarballs without uploading.
45
+ Publishing is automated (`.gitlab-ci.yml` → `publish.sh`; see `PUBLISH_GUIDE.md`): `main` → npm latest + 1 patch (tag `latest`; a manual run with `RELEASE_VERSION` sets the sprint version), other branches on `[ci build]` → `<npm latest + 1 patch>-beta.N`. The version is never stored in the repo — `scripts/ci/resolve-version.mjs` bases it on npm and only takes a number free on **both** npm (incl. `-debug`) and GitLab Maven. Do not publish manually unless asked; `bash publish.sh beta --dry-run` shows the version and packs the tarballs without uploading.
46
46
 
47
47
  ## Architecture essentials
48
48
 
package/PUBLISH_GUIDE.md CHANGED
@@ -28,18 +28,11 @@ GitLab → **Build → Pipelines → Run pipeline** → chọn `main` → `RELEA
28
28
  ## Chạy local
29
29
 
30
30
  ```bash
31
- bash publish.sh build # build tất cả artifact sẽ publish (không upload)
32
- bash publish.sh local --dry-run # xem version sẽ ra + pack tarball npm vào build/npm
33
- bash publish.sh local # publish beta thật từ working tree hiện tại
34
- yarn publish:local # như trên (thêm --dry-run để chạy thử)
31
+ bash publish.sh build # build tất cả artifact sẽ publish (không upload)
32
+ bash publish.sh beta --dry-run # xem version sẽ ra + pack tarball npm vào build/npm
33
+ bash publish.sh release --version 0.170.1 # publish thật
35
34
  ```
36
35
 
37
- - `local` chỉ publish **beta**, ở bất kỳ nhánh nào, và lấy **nguyên working tree**, kể cả thay đổi chưa commit. Dùng khi cần nhanh một version để test mà chưa muốn commit.
38
- - Version theo đúng quy tắc beta của CI: `<npm latest + 1 patch>-beta.N`, npm tag `beta`, và số phải còn trống trên cả npm lẫn Maven. Beta local và beta CI dùng chung dãy `N`.
39
- - `release` (npm tag `latest`) chỉ chạy trên CI. Chạy ở local sẽ bị chặn, trừ khi có `--dry-run`.
40
- - Local không giữ khoá `kits-publish` của CI. Vì vậy script build xong mới chọn version, để khoảng thời gian có thể bị trùng số với một job CI đang chạy là ngắn nhất.
41
- - `gitHead` trên npm trỏ tới commit HEAD, nhưng package có thể chứa cả thay đổi chưa commit.
42
-
43
36
  Các file bị sửa trong lúc publish được trả lại nguyên trạng khi script kết thúc, kể cả khi fail.
44
37
 
45
38
  ## CI/CD variables
@@ -96,7 +96,8 @@ struct BottomTabBar: View {
96
96
  floatingButton: floatingButton,
97
97
  selectedIndex: selectedIndex,
98
98
  onTabSelected: onTabSelected,
99
- width: TabBarMetrics.horizontalBarWidth(layout)
99
+ width: TabBarMetrics.horizontalBarWidth(layout),
100
+ fixedFontScale: true
100
101
  )
101
102
  .padding(.bottom, TabBarMetrics.bottomGap(bottomInset))
102
103
  .frame(maxWidth: .infinity)
@@ -203,14 +204,19 @@ struct ActiveIndicator: View {
203
204
  }
204
205
  }
205
206
 
206
- /// Like the system tab bar, text keeps its design size instead of growing with the wide Duo displays.
207
- struct FixedFontScale: ViewModifier {
207
+ /// Tab labels follow the host/OS font scale but never grow past this, so the fixed-height container
208
+ /// and the notch stay aligned.
209
+ private let tabLabelMaxScale: CGFloat = 1.2
210
+
211
+ /// Caps the label scale at `tabLabelMaxScale` (Compose's `CappedFontScale`): it keeps following the
212
+ /// host/OS font scale but stops growing past 1.2× so it fits the fixed bar geometry.
213
+ struct CappedFontScale: ViewModifier {
208
214
  let enabled: Bool
209
215
 
210
216
  @Environment(\.momoFontScale) private var fontScale
211
217
 
212
218
  func body(content: Content) -> some View {
213
- content.environment(\.momoFontScale, enabled ? FontScale(userScaleRate: 1, useOSScaleRate: false) : fontScale)
219
+ content.environment(\.momoFontScale, enabled ? fontScale.cappedAt(tabLabelMaxScale) : fontScale)
214
220
  }
215
221
  }
216
222
 
@@ -237,7 +243,13 @@ struct TabItemContent: View {
237
243
  }
238
244
  .animation(TabBarMetrics.tintMotion, value: selected)
239
245
  .frame(maxWidth: vertical ? nil : .infinity)
240
- label.modifier(FixedFontScale(enabled: fixedFontScale))
246
+ // fixed slot so a capped-scale label overflows downward and the icon above it stays put
247
+ label
248
+ .modifier(CappedFontScale(enabled: fixedFontScale))
249
+ .frame(
250
+ height: vertical ? TabBarMetrics.railLabelHeight : TabBarMetrics.labelHeight,
251
+ alignment: .top
252
+ )
241
253
  }
242
254
  }
243
255
 
@@ -348,7 +360,10 @@ struct CenterActionStyle: ButtonStyle {
348
360
  .shadow(color: Color.black.opacity(0.04), radius: 16, x: 0, y: 12)
349
361
  Circle().fill(theme.colors.primary)
350
362
  if let iconContent {
363
+ // custom content (e.g. an oversized Lottie) is clipped to the round button
351
364
  iconContent
365
+ .frame(width: size, height: size)
366
+ .clipShape(Circle())
352
367
  } else {
353
368
  Icon(source: icon, size: TabBarMetrics.ctaIconSize, color: Colors.black01)
354
369
  }
@@ -364,7 +379,7 @@ struct CenterActionStyle: ButtonStyle {
364
379
  maxLines: 1
365
380
  )
366
381
  .truncationMode(.tail)
367
- .modifier(FixedFontScale(enabled: fixedFontScale))
382
+ .modifier(CappedFontScale(enabled: fixedFontScale))
368
383
  .padding(.horizontal, vertical ? Spacing.XS : Spacing.XXS)
369
384
  .frame(minHeight: vertical ? nil : TabBarMetrics.ctaLabelHeight)
370
385
  .overlay(labelContent?.allowsHitTesting(false))
@@ -18,6 +18,10 @@ enum TabBarMetrics {
18
18
  static let itemGap = Spacing.XS
19
19
  static let iconSize: CGFloat = 24
20
20
  static let indicatorHeight: CGFloat = 32
21
+ // label_s_medium / label_xs_medium line heights: the label slot keeps this height so a scaled
22
+ // label overflows downward instead of pushing the icon up
23
+ static let labelHeight: CGFloat = 18
24
+ static let railLabelHeight: CGFloat = 14
21
25
  static let indicatorRadius = Radius.XL
22
26
  // home indicator / gesture bar area under the container
23
27
  static let systemIndicatorHeight: CGFloat = 24
@@ -21,22 +21,32 @@ public struct FontScale: Equatable {
21
21
  public let osFontScale: CGFloat
22
22
  // AI-GENERATED START: device scale from the app window, not UIScreen.main (fixed to one display on iPhone Duo)
23
23
  public let windowShortSide: CGFloat
24
+ /// Opt-in ceiling (Compose's `MiniAppContext.scaleSizeMaxRate`): when set, the result never
25
+ /// exceeds size × maxScaleRate, in both the userScaleRate path and the OS path. nil keeps the
26
+ /// old behavior. Used by `CappedFontScale` for the bottom-tab labels.
27
+ public let maxScaleRate: CGFloat?
24
28
 
25
29
  public init(
26
30
  userScaleRate: CGFloat = 1,
27
31
  useOSScaleRate: Bool = true,
28
32
  osFontScale: CGFloat = 1,
29
- windowShortSide: CGFloat? = nil
33
+ windowShortSide: CGFloat? = nil,
34
+ maxScaleRate: CGFloat? = nil
30
35
  ) {
31
36
  self.userScaleRate = userScaleRate
32
37
  self.useOSScaleRate = useOSScaleRate
33
38
  self.osFontScale = osFontScale
34
39
  self.windowShortSide = windowShortSide ?? DesignSystemKits.currentWindowShortSide()
40
+ self.maxScaleRate = maxScaleRate
35
41
  }
36
42
 
37
43
  /// `callAsFunction` so call sites keep reading like Compose's `scaleSize(16)`.
38
44
  public func callAsFunction(_ size: CGFloat) -> CGFloat {
39
- guard useOSScaleRate else { return size * userScaleRate }
45
+ func cap(_ scaled: CGFloat) -> CGFloat {
46
+ guard let maxScaleRate else { return scaled }
47
+ return min(scaled, size * maxScaleRate)
48
+ }
49
+ guard useOSScaleRate else { return cap(size * userScaleRate) }
40
50
 
41
51
  // Short side, not width: landscape must not inflate every font (and so every popup's height).
42
52
  let deviceScale = windowShortSide / Self.defaultScreenSize
@@ -48,9 +58,21 @@ public struct FontScale: Equatable {
48
58
  deviceScaled = min(size * deviceScale, size + Self.maxDeviceScale)
49
59
  }
50
60
  if osFontScale > 1 {
51
- osScaled = min(size * osFontScale, size * Self.maxFontScale)
61
+ osScaled = min(size * osFontScale, size * (maxScaleRate ?? Self.maxFontScale))
52
62
  }
53
- return max(deviceScaled, osScaled)
63
+ return cap(max(deviceScaled, osScaled))
64
+ }
65
+
66
+ /// A copy that caps the scale at `rate` while keeping the host/OS inputs — the SwiftUI mirror of
67
+ /// Compose's `CappedFontScale` wrapper.
68
+ public func cappedAt(_ rate: CGFloat) -> FontScale {
69
+ FontScale(
70
+ userScaleRate: userScaleRate,
71
+ useOSScaleRate: useOSScaleRate,
72
+ osFontScale: osFontScale,
73
+ windowShortSide: windowShortSide,
74
+ maxScaleRate: rate
75
+ )
54
76
  }
55
77
 
56
78
  /// `.system(size:)` is a fixed-size font — SwiftUI does not Dynamic-Type it — so the scale has to
@@ -68,8 +90,9 @@ public struct FontScale: Equatable {
68
90
  useOSScaleRate: useOSScaleRate ?? self.useOSScaleRate,
69
91
  osFontScale: osFontScale,
70
92
  // AI-GENERATED START: keep the window size through context overrides
71
- windowShortSide: windowShortSide
93
+ windowShortSide: windowShortSide,
72
94
  // AI-GENERATED END: keep the window size through context overrides
95
+ maxScaleRate: maxScaleRate
73
96
  )
74
97
  }
75
98
  }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKits'
3
- s.version = '0.169.4'
3
+ s.version = '0.169.5-beta.1'
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.4'
3
+ s.version = '0.169.5-beta.1'
4
4
  s.summary = 'Demo browser for MoMoUIKits SwiftUI components'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
@@ -7,6 +7,7 @@
7
7
  // change rebuilds the bar below. Must be hosted inside a `NavigationContainer`.
8
8
  //
9
9
 
10
+ import Combine
10
11
  import Lottie
11
12
  import MoMoUIKits
12
13
  import SwiftUI
@@ -54,14 +55,23 @@ private let ctaLottieSize: CGFloat = 77
54
55
  private let ctaLottieButtonOffset: CGFloat = 5
55
56
  private let ctaLottieLabelOffset: CGFloat = 28
56
57
 
57
- /// A Lottie bundled with the demo: in the app bundle (sample iosApp) or the demo pod's resource bundle.
58
- private func demoLottie(_ name: String) -> LottieAnimation? {
59
- let podBundle = Bundle.main.url(forResource: "MoMoUIKitsDemoResources", withExtension: "bundle").flatMap(Bundle.init(url:))
60
- return LottieAnimation.named(name, bundle: .main) ?? podBundle.flatMap { LottieAnimation.named(name, bundle: $0) }
61
- }
58
+ private let ctaLottieButtonURL = URL(string: "https://static.momocdn.net/app/app/kits/animation_scan_qr_icon_button.json")!
59
+ private let ctaLottieLabelURL = URL(string: "https://static.momocdn.net/app/app/kits/animation_scan_qr_text.json")!
60
+
61
+ /// Loads the two CTA Lotties from the CDN once (no bundled files), mirroring the kit's LottieView(url:).
62
+ private final class CtaLottieLoader: ObservableObject {
63
+ @Published var button: LottieAnimation?
64
+ @Published var label: LottieAnimation?
62
65
 
63
- private let ctaLottieButton = demoLottie("tabbar_scan_qr_button")
64
- private let ctaLottieLabel = demoLottie("tabbar_scan_qr_label")
66
+ func load() {
67
+ if button == nil {
68
+ LottieAnimation.loadedFrom(url: ctaLottieButtonURL, closure: { [weak self] in self?.button = $0 }, animationCache: nil)
69
+ }
70
+ if label == nil {
71
+ LottieAnimation.loadedFrom(url: ctaLottieLabelURL, closure: { [weak self] in self?.label = $0 }, animationCache: nil)
72
+ }
73
+ }
74
+ }
65
75
 
66
76
  // both parts read their progress from the same clock, two playing views start at different times
67
77
  private func ctaLottie(_ animation: LottieAnimation?, offset: CGFloat) -> some View {
@@ -82,6 +92,7 @@ private let badges: [(String, String?)] = [
82
92
 
83
93
  struct BottomTabDemoContent: View {
84
94
  @State private var config = DemoConfig()
95
+ @StateObject private var ctaLottieLoader = CtaLottieLoader()
85
96
  // the bar is rebuilt on every change: reopen it on the tab the user is on
86
97
  @State private var focused = DemoConfig().initialRouteName
87
98
 
@@ -110,6 +121,7 @@ struct BottomTabDemoContent: View {
110
121
  backToInitialTab: config.backToInitialTab
111
122
  )
112
123
  .id(config)
124
+ .onAppear { ctaLottieLoader.load() }
113
125
  }
114
126
 
115
127
  private var floatingButton: BottomTabFloatingButton? {
@@ -120,8 +132,8 @@ struct BottomTabDemoContent: View {
120
132
  return BottomTabFloatingButton(
121
133
  label: config.ctaLabel,
122
134
  onPress: {},
123
- iconContent: { ctaLottie(ctaLottieButton, offset: ctaLottieButtonOffset) },
124
- labelContent: { ctaLottie(ctaLottieLabel, offset: -ctaLottieLabelOffset) }
135
+ iconContent: { ctaLottie(ctaLottieLoader.button, offset: ctaLottieButtonOffset) },
136
+ labelContent: { ctaLottie(ctaLottieLoader.label, offset: -ctaLottieLabelOffset) }
125
137
  )
126
138
  }
127
139
  }
package/package.json CHANGED
@@ -1,10 +1,7 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.169.4-debug",
3
+ "version": "0.169.5-beta.1",
4
4
  "private": false,
5
- "scripts": {
6
- "publish:local": "bash publish.sh local"
7
- },
8
5
  "dependeNavigationncies": {},
9
6
  "devDependencies": {},
10
7
  "license": "MoMo"
package/publish.sh CHANGED
@@ -2,9 +2,8 @@
2
2
  # Build & publish vn.momo.kits:kits / :demo (GitLab Maven) and @momo-kits/native-kits (npm).
3
3
  #
4
4
  # bash publish.sh build # build everything that gets published, no upload
5
- # bash publish.sh local # beta of the working tree as is (uncommitted too), any branch
6
- # bash publish.sh beta # CI, other branches: <npm latest + 1 patch>-beta.N, npm tag beta
7
- # bash publish.sh release [--version 0.169.1] # CI, main only: npm tag latest; default = npm latest + 1 patch
5
+ # bash publish.sh release [--version 0.169.1] # npm tag latest; default = npm latest + 1 patch
6
+ # bash publish.sh beta # <npm latest + 1 patch>-beta.N, npm tag beta
8
7
  # --dry-run: resolve the version and pack the npm tarballs, upload nothing
9
8
  #
10
9
  # The version is never read from the repo; files touched here are put back on exit.
@@ -27,7 +26,6 @@ MODE="${1:-}"
27
26
  [ $# -gt 0 ] && shift
28
27
  RELEASE_VERSION="${RELEASE_VERSION:-}"
29
28
  DRY_RUN=false
30
- CHANNEL=""
31
29
  while [ $# -gt 0 ]; do
32
30
  case "$1" in
33
31
  --version) RELEASE_VERSION="${2:-}"; shift 2 ;;
@@ -109,20 +107,17 @@ phase_build() {
109
107
  # ----------------------------------------------------------------------------
110
108
  # version: ask the registries, then stamp package.json + podspecs.
111
109
  # ----------------------------------------------------------------------------
112
- check_npm_auth() {
113
- # A bad token only surfaces as a 404 on the PUT, so check auth before anything is uploaded.
114
- if [ "$DRY_RUN" != true ] && ! npm whoami "${NPM_ARGS[@]}" >/dev/null 2>&1; then
115
- die "npm auth failed (npm whoami): set NPM_TOKEN or renew the token in .npmrc"
116
- fi
117
- }
118
-
119
110
  phase_version() {
120
- section "📋 VERSION ($CHANNEL)"
121
- local args=("$CHANNEL")
111
+ section "📋 VERSION ($MODE)"
112
+ local args=("$MODE")
122
113
  if [ -n "$RELEASE_VERSION" ]; then
123
- [ "$CHANNEL" = "release" ] || die "--version / RELEASE_VERSION is only for release"
114
+ [ "$MODE" = "release" ] || die "--version / RELEASE_VERSION is only for release"
124
115
  args+=(--version "$RELEASE_VERSION")
125
116
  fi
117
+ # A bad token only surfaces as a 404 on the PUT, so check auth before anything is uploaded.
118
+ if [ "$DRY_RUN" != true ] && ! npm whoami "${NPM_ARGS[@]}" >/dev/null 2>&1; then
119
+ die "npm auth failed (npm whoami): set NPM_TOKEN or renew the token in .npmrc"
120
+ fi
126
121
 
127
122
  local resolved
128
123
  resolved="$(node scripts/ci/resolve-version.mjs "${args[@]}")"
@@ -198,7 +193,6 @@ build/
198
193
  .gitattributes
199
194
  .gitlab-ci.yml
200
195
  scripts/ci/
201
- local.properties
202
196
  EOF
203
197
  npm_publish
204
198
  echo "✅ $VERSION-debug done"
@@ -214,32 +208,12 @@ case "$MODE" in
214
208
  phase_build
215
209
  ;;
216
210
  release|beta)
217
- if [ "$MODE" = release ] && [ -z "${GITLAB_CI:-}" ] && [ "$DRY_RUN" != true ]; then
218
- die "release (npm tag latest) is published by CI from main only; locally use: bash publish.sh local"
219
- fi
220
- CHANNEL="$MODE"
221
- check_npm_auth
222
- phase_version
223
- phase_maven
224
- phase_npm
225
- section "🎉 $VERSION published (npm tag $NPM_TAG)"
226
- ;;
227
- local)
228
- [ -z "$RELEASE_VERSION" ] || die "local only publishes betas; --version / RELEASE_VERSION is for release"
229
- CHANNEL=beta
230
- BRANCH="$(git branch --show-current)"
231
- DIRTY=""
232
- [ -z "$(git status --porcelain)" ] || DIRTY=" + uncommitted changes"
233
- section "🏠 LOCAL beta from ${BRANCH:-detached HEAD} @ $(git rev-parse --short HEAD)$DIRTY"
234
- check_npm_auth
235
- # Outside CI's kits-publish lock: build first so the number is picked right before the upload.
236
- [ "$DRY_RUN" = true ] || phase_build
237
211
  phase_version
238
212
  phase_maven
239
213
  phase_npm
240
214
  section "🎉 $VERSION published (npm tag $NPM_TAG)"
241
215
  ;;
242
216
  *)
243
- die "Usage: bash publish.sh build | local [--dry-run] | beta [--dry-run] | release [--version x.y.z] (CI)"
217
+ die "Usage: bash publish.sh build | release [--version x.y.z] | beta [--dry-run]"
244
218
  ;;
245
219
  esac
package/build.gradle.kts DELETED
@@ -1,11 +0,0 @@
1
- plugins {
2
- // this is necessary to avoid the plugins to be loaded multiple times
3
- // in each subproject's classloader
4
- alias(libs.plugins.android.application) apply false
5
- alias(libs.plugins.android.library) apply false
6
- alias(libs.plugins.compose) apply false
7
- alias(libs.plugins.kotlin.compose.compiler) apply false
8
- alias(libs.plugins.jetbrains.kotlin.multiplatform) apply false
9
- alias(libs.plugins.jetbrains.kotlin.serialization) apply false
10
- alias(libs.plugins.vanniktech.mavenPublish) apply false
11
- }
@@ -1,198 +0,0 @@
1
- // import com.vanniktech.maven.publish.JavadocJar
2
- // import com.vanniktech.maven.publish.KotlinMultiplatform
3
- import org.jetbrains.kotlin.gradle.dsl.JvmTarget
4
-
5
- plugins {
6
- alias(libs.plugins.jetbrains.kotlin.multiplatform)
7
- alias(libs.plugins.android.library)
8
- alias(libs.plugins.compose)
9
- alias(libs.plugins.kotlin.compose.compiler)
10
- // alias(libs.plugins.vanniktech.mavenPublish)
11
- id(libs.plugins.jetbrains.kotlin.cocoapods.get().pluginId)
12
- kotlin("plugin.serialization")
13
- }
14
-
15
- val gitlabName: String = findProperty("name") as String? ?: ""
16
- val gitlabRepo: String = findProperty("repo") as String? ?: ""
17
- val gitlabUrl: String = findProperty("url") as String? ?: ""
18
- val gitlabGroup: String = findProperty("group") as String? ?: ""
19
- val gitlabArtifactId: String = findProperty("artifact.id") as String? ?: ""
20
- val gitlabVersion: String = findProperty("version") as String? ?: ""
21
- val gitlabUser: String = findProperty("gitlab.user") as String? ?: ""
22
- val gitlabKey: String = findProperty("gitlab.password") as String? ?: ""
23
-
24
- kotlin {
25
- androidTarget {
26
- compilerOptions {
27
- jvmTarget.set(JvmTarget.JVM_17)
28
- }
29
- publishLibraryVariants("release")
30
- }
31
-
32
- val fwName = gitlabArtifactId
33
- val iosTargets = listOf(iosArm64(), iosSimulatorArm64())
34
- iosTargets.forEach {
35
- it.binaries.framework {
36
- baseName = fwName
37
- binaryOption("bundleId", "$gitlabGroup.$fwName")
38
- isStatic = true
39
- }
40
- }
41
-
42
- cocoapods {
43
- version = "0.169.4-debug"
44
- summary = "IOS Shared module"
45
- homepage = "https://momo.vn"
46
- ios.deploymentTarget = "15.0"
47
-
48
- framework {
49
- baseName = fwName
50
- isStatic = true
51
- }
52
-
53
- pod("lottie-ios") {
54
- moduleName = "Lottie"
55
- version = "4.4.3"
56
- extraOpts += listOf("-compiler-option", "-fmodules")
57
- }
58
- }
59
-
60
- sourceSets {
61
- all {
62
- languageSettings.optIn("vn.momo.kits.modifier.InternalApi")
63
- }
64
- commonMain.dependencies {
65
- implementation(compose.runtime)
66
- implementation(compose.material)
67
- implementation(compose.material3)
68
- implementation(compose.components.resources)
69
- implementation(libs.compose.ui.backhandler)
70
- implementation(libs.ktor.client.core)
71
- implementation(libs.jetbrains.coroutines.core)
72
- implementation(libs.navigation.multiplatform)
73
- implementation(libs.coil.multiplatform.compose)
74
- implementation(libs.coil.multiplatform.core)
75
- implementation(libs.coil.multiplatform.network.ktor)
76
- implementation(libs.jetbrains.serialization.json)
77
- implementation(libs.kotlinx.datetime)
78
- api(libs.native.max.api)
79
- implementation(libs.compottie)
80
- implementation(libs.gif.image)
81
- }
82
- androidMain.dependencies {
83
- implementation(libs.ktor.client.okhttp)
84
- implementation(libs.airbnb.lottie)
85
- }
86
- iosMain.dependencies {
87
- implementation(libs.ktor.client.darwin)
88
- }
89
- }
90
- }
91
-
92
- android {
93
- namespace = "vn.momo.kits.kits"
94
- compileSdk = 35
95
- compileOptions {
96
- sourceCompatibility = JavaVersion.VERSION_17
97
- targetCompatibility = JavaVersion.VERSION_17
98
- }
99
- defaultConfig {
100
- minSdk = 24
101
- }
102
- }
103
-
104
- dependencies {
105
- }
106
-
107
- repositories {
108
- google {
109
- mavenContent {
110
- includeGroupAndSubgroups("androidx")
111
- includeGroupAndSubgroups("com.android")
112
- includeGroupAndSubgroups("com.google")
113
- }
114
- }
115
- mavenCentral()
116
- maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
117
- maven {
118
- url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
119
- credentials {username = "download_packages"; password = "gldt-bjDqLpU_sPcHDuXau2ws" }
120
- }
121
- maven {
122
- url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
123
- credentials {
124
- username = "viewer"
125
- password = "viewer"
126
- }
127
- isAllowInsecureProtocol = true
128
- }
129
- }
130
-
131
- compose {
132
- resources {
133
- publicResClass = true
134
- packageOfResClass = "vn.momo.uikits.resources"
135
- generateResClass = always
136
- }
137
- }
138
-
139
- // publishing {
140
- // repositories {
141
- // maven {
142
- // name = "${gitlabRepo}Packages"
143
- // credentials {
144
- // username = gitlabUser
145
- // password = gitlabKey
146
- // }
147
- // url = uri("$gitlabUrl")
148
- // }
149
- // }
150
- // }
151
-
152
- // mavenPublishing {
153
- // configure(
154
- // KotlinMultiplatform(
155
- // javadocJar = JavadocJar.Empty(),
156
- // sourcesJar = true,
157
- // androidVariantsToPublish = listOf("release")
158
- // )
159
- // )
160
- //
161
- // repositories {
162
- // maven {
163
- // name = "${gitlabRepo}Packages"
164
- // credentials { username = gitlabUser; password = gitlabKey }
165
- // url = uri("$gitlabUrl")
166
- // }
167
- // }
168
- //
169
- // coordinates(gitlabGroup.toString(), gitlabArtifactId, gitlabVersion.toString())
170
- //
171
- // pom {
172
- // name = "$gitlabName Klib"
173
- // description = "$gitlabName"
174
- // url = "https://gitlab.mservice.com.vn"
175
- // licenses {
176
- // license {
177
- // name = "The Apache License, Version 2.0"
178
- // url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
179
- // distribution = "https://www.apache.org/licenses/LICENSE-2.0.txt"
180
- // }
181
- // }
182
- // developers {
183
- // developer {
184
- // id = "kotlin-hands-on"
185
- // name = "Kotlin Developer Advocate"
186
- // url = "https://github.com/kotlin-hands-on/"
187
- // }
188
- // }
189
- // }
190
- // }
191
-
192
- // Xcode 27 rejects iOS < 15; KGP's synthetic Podfile only raises pods to 12 (KT-57741), leaving lottie-ios at 13.
193
- tasks.named("podGenIos") {
194
- doLast {
195
- val podfile = layout.buildDirectory.file("cocoapods/synthetic/ios/Podfile").get().asFile
196
- podfile.writeText(podfile.readText().replace("major < 12 ||", "major < 15 ||").replace("#{12}", "#{15}"))
197
- }
198
- }
@@ -1,47 +0,0 @@
1
- Pod::Spec.new do |spec|
2
- spec.name = 'compose'
3
- spec.version = '0.169.4-debug'
4
- spec.homepage = 'https://momo.vn'
5
- spec.source = { :http=> ''}
6
- spec.authors = ''
7
- spec.license = ''
8
- spec.summary = 'IOS Shared module'
9
- spec.vendored_frameworks = 'build/cocoapods/framework/kits.framework'
10
- spec.libraries = 'c++'
11
- spec.ios.deployment_target = '15.0'
12
- spec.dependency 'lottie-ios', '4.4.3'
13
- if !Dir.exist?('build/cocoapods/framework/kits.framework') || Dir.empty?('build/cocoapods/framework/kits.framework')
14
- raise "
15
- Kotlin framework 'kits' doesn't exist yet, so a proper Xcode project can't be generated.
16
- 'pod install' should be executed after running ':generateDummyFramework' Gradle task:
17
- ./gradlew :compose:generateDummyFramework
18
- Alternatively, proper pod installation is performed during Gradle sync in the IDE (if Podfile location is set)"
19
- end
20
- spec.xcconfig = {
21
- 'ENABLE_USER_SCRIPT_SANDBOXING' => 'NO',
22
- }
23
- spec.pod_target_xcconfig = {
24
- 'KOTLIN_PROJECT_PATH' => ':compose',
25
- 'PRODUCT_MODULE_NAME' => 'kits',
26
- }
27
- spec.script_phases = [
28
- {
29
- :name => 'Build compose',
30
- :execution_position => :before_compile,
31
- :shell_path => '/bin/sh',
32
- :script => <<-SCRIPT
33
- if [ "YES" = "$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED" ]; then
34
- echo "Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \"YES\""
35
- exit 0
36
- fi
37
- set -ev
38
- REPO_ROOT="$PODS_TARGET_SRCROOT"
39
- "$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework \
40
- -Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \
41
- -Pkotlin.native.cocoapods.archs="$ARCHS" \
42
- -Pkotlin.native.cocoapods.configuration="$CONFIGURATION"
43
- SCRIPT
44
- }
45
- ]
46
- spec.resources = ['build/compose/cocoapods/compose-resources']
47
- end
@@ -1,20 +0,0 @@
1
- package vn.momo.kits.const
2
-
3
- import androidx.compose.runtime.Composable
4
- import androidx.compose.runtime.remember
5
- import androidx.compose.ui.platform.LocalContext
6
- import androidx.compose.ui.text.font.Font
7
- import androidx.compose.ui.text.font.FontFamily
8
- import androidx.compose.ui.text.font.FontWeight
9
-
10
- @Composable
11
- internal actual fun hostFontFamily(fileName: String, weight: FontWeight): FontFamily? {
12
- val assets = LocalContext.current.applicationContext.assets
13
- return remember(fileName, weight) {
14
- val path = "fonts/$fileName"
15
- // AssetManager.open ném IOException nếu thiếu file; Font(path, assetManager) thì lỗi
16
- // muộn lúc render nên phải kiểm tra tồn tại trước.
17
- val exists = runCatching { assets.open(path).close() }.isSuccess
18
- if (exists) FontFamily(Font(path = path, assetManager = assets, weight = weight)) else null
19
- }
20
- }
@@ -1,6 +0,0 @@
1
- package vn.momo.kits.navigation
2
-
3
- import androidx.compose.runtime.Composable
4
-
5
- @Composable
6
- internal actual fun RegisterScrollToTop(callback: (() -> Unit)?) = Unit