@momo-kits/native-kits 0.169.10-beta.1-debug → 0.169.10

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 (189) hide show
  1. package/ios/Application/DesignSystemKits.swift +2 -3
  2. package/ios/Application/LanguageSource.swift +2 -3
  3. package/ios/Application/Localize.swift +4 -7
  4. package/ios/Application/LocalizeModifier.swift +2 -3
  5. package/ios/Badge/Badge.swift +5 -7
  6. package/ios/Button/Button.swift +2 -3
  7. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +3 -5
  8. package/ios/Carousel/Carousel.swift +2 -3
  9. package/ios/Collapse/Collapse.swift +17 -11
  10. package/ios/Extensions/ActiveOpacityButtonStyle.swift +2 -3
  11. package/ios/Icon/Icon.swift +2 -3
  12. package/ios/IconButton/IconButton.swift +2 -3
  13. package/ios/Input/InputSearch.swift +6 -23
  14. package/ios/Layout/ModalLayout.swift +2 -3
  15. package/ios/Layout/ScreenLayout.swift +10 -12
  16. package/ios/Layout/Section.swift +2 -3
  17. package/ios/Navigation/BottomSheet.swift +6 -9
  18. package/ios/Navigation/BottomTab/BottomTab.swift +6 -9
  19. package/ios/Navigation/BottomTab/BottomTabBar.swift +4 -6
  20. package/ios/Navigation/BottomTab/CurvedContainer.swift +2 -3
  21. package/ios/Navigation/BottomTab/DuoBarCompression.swift +2 -3
  22. package/ios/Navigation/BottomTab/DuoTabBar.swift +6 -6
  23. package/ios/Navigation/BottomTab/TabBarMetrics.swift +4 -6
  24. package/ios/Navigation/Component/Header.swift +46 -31
  25. package/ios/Navigation/Component/HeaderJourney.swift +1 -2
  26. package/ios/Navigation/Component/HeaderLocation.swift +1 -2
  27. package/ios/Navigation/Component/HeaderRight.swift +15 -18
  28. package/ios/Navigation/Component/HeaderUser.swift +1 -2
  29. package/ios/Navigation/Component/SideBar.swift +15 -7
  30. package/ios/Navigation/HostBackGestureBridge.swift +2 -3
  31. package/ios/Navigation/ModalScreen.swift +13 -11
  32. package/ios/Navigation/Navigation.swift +3 -9
  33. package/ios/Navigation/NavigationContainer.swift +4 -6
  34. package/ios/Navigation/Navigator.swift +12 -18
  35. package/ios/Navigation/StackScreen.swift +25 -40
  36. package/ios/Navigation/StackTransition.swift +7 -6
  37. package/ios/Skeleton/Skeleton.swift +3 -6
  38. package/ios/Steps/Steps.swift +20 -15
  39. package/ios/TabView/TabView.swift +2 -3
  40. package/ios/Title/Title.swift +1 -3
  41. package/ios/Typography/FontScale.swift +6 -9
  42. package/ios/Typography/Text.swift +2 -3
  43. package/ios/Typography/Typography.swift +3 -4
  44. package/ios/native-kits.podspec +1 -1
  45. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  46. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +2 -11
  47. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +0 -11
  48. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +1 -1
  49. package/package.json +1 -1
  50. package/build.gradle.kts +0 -11
  51. package/compose/build.gradle.kts +0 -198
  52. package/compose/compose.podspec +0 -47
  53. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -19
  54. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  55. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
  56. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  57. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -154
  58. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +0 -17
  59. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +0 -6
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -110
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +0 -62
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -1067
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -267
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -82
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -356
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -115
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -482
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -86
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -224
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -195
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -473
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -113
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -263
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -228
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -280
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -183
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -40
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -82
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -39
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -363
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -108
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -307
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -88
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -306
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -457
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -205
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -89
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -542
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -120
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -201
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -498
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -210
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -180
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -12
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -194
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -292
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/HeaderLayout.kt +0 -67
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -50
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +0 -184
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -316
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  132. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  133. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  134. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  135. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  136. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -397
  137. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
  138. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -153
  139. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -118
  140. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -205
  141. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -422
  142. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  143. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -747
  144. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
  145. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
  146. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -242
  147. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -400
  148. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -100
  149. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +0 -97
  150. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +0 -207
  151. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +0 -132
  152. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -167
  153. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -446
  154. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -105
  155. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
  156. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -74
  157. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -398
  158. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -39
  159. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -363
  160. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +0 -197
  161. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -133
  162. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
  163. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
  164. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -114
  165. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
  166. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -76
  167. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +0 -7
  168. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +0 -22
  169. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  170. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  171. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  172. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -118
  173. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -42
  174. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
  175. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
  176. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
  177. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
  178. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -218
  179. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +0 -48
  180. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +0 -144
  181. package/gradle/libs.versions.toml +0 -67
  182. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  183. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  184. package/gradle.properties +0 -24
  185. package/gradlew +0 -252
  186. package/gradlew.bat +0 -94
  187. package/ios/Layout/HeaderLayout.swift +0 -67
  188. package/ios-demo/README.md +0 -120
  189. package/settings.gradle.kts +0 -64
@@ -20,9 +20,8 @@ public struct DesignSystemKitsConfigs: Equatable {
20
20
  }
21
21
  }
22
22
 
23
- /// Mirrors Compose's `DesignSystemKits`; Swift reserves `init`, so there is no `init(source:)`: the host pushes
24
- /// `setConfigs(_:)` at startup and on every change. Also tracks the OS Dynamic Type factor. Views re-render
25
- /// only under `.momoFontScale()` (`NavigationContainer` applies it).
23
+ /// Compose's `DesignSystemKits` without `init(source:)` (Swift reserves `init`): the host pushes `setConfigs(_:)` at
24
+ /// startup and on every change. Also tracks Dynamic Type; views re-render only under `.momoFontScale()`.
26
25
  public final class DesignSystemKits: ObservableObject {
27
26
  public static let shared = DesignSystemKits()
28
27
 
@@ -9,9 +9,8 @@ public protocol LanguageSource: AnyObject {
9
9
  func stopObserving()
10
10
  }
11
11
 
12
- /// Reads the language the MoMo host app persists in `UserDefaults`. All three host writers
13
- /// (the `RNResource` RN bridge, `JSONLocalization`, and the KMP `LocalizationProvider`) write the
14
- /// same key on `UserDefaults.standard` in-process, so KVO on it sees every one of them.
12
+ /// All three host writers (RN bridge `RNResource`, `JSONLocalization`, KMP `LocalizationProvider`) write the same
13
+ /// `UserDefaults.standard` key in-process, so KVO on it sees every language change.
15
14
  public final class UserDefaultsLanguageSource: NSObject, LanguageSource {
16
15
  public static let defaultKey = "language"
17
16
 
@@ -318,9 +318,8 @@ public final class Localize: ObservableObject {
318
318
  )
319
319
  }
320
320
 
321
- /// Snapshots `currentLanguage` alongside the instance so SwiftUI sees an environment
322
- /// *change* on `changeLanguage`: the `Localize` reference alone never changes, and
323
- /// `@Environment` does not subscribe to `@Published` the way `@EnvironmentObject` does.
321
+ /// Snapshots `currentLanguage` so `changeLanguage` is an environment *change*: the reference never changes, and
322
+ /// `@Environment` doesn't subscribe to `@Published` the way `@EnvironmentObject` does.
324
323
  private struct LocalizeBox: Equatable {
325
324
  let localize: Localize
326
325
  let language: String
@@ -339,10 +338,8 @@ private struct LocalizeBox: Equatable {
339
338
  }
340
339
 
341
340
  private struct LocalizeKey: EnvironmentKey {
342
- /// Carries the full kit dictionary, so an un-injected consumer still renders instead of
343
- /// trapping the way `@EnvironmentObject` does.
344
- /// A `static let`, never rebuilt: without `.momoLocalize()` (or `NavigationContainer`) the
345
- /// language is right on first render but does not live-update.
341
+ /// Never traps like `@EnvironmentObject`, but as a `static let` it is never rebuilt: without `.momoLocalize()`
342
+ /// (or `NavigationContainer`) the language is right on first render but does not live-update.
346
343
  static let defaultValue = LocalizeBox(Localize.shared)
347
344
  }
348
345
 
@@ -8,9 +8,8 @@ public extension View {
8
8
  }
9
9
  }
10
10
 
11
- /// `@ObservedObject` is load-bearing: `@Environment(\.localize)` only invalidates when the boxed
12
- /// value changes, which requires *this* body to re-run on every publish. A plain helper that just
13
- /// set `\.localize` would inject a snapshot that never updates.
11
+ /// `@ObservedObject` is load-bearing: `@Environment(\.localize)` invalidates only when *this* body re-runs on a
12
+ /// publish; a helper that just set `\.localize` would inject a snapshot that never updates.
14
13
  private struct MomoLocalizeModifier: ViewModifier {
15
14
  @ObservedObject var localize: Localize
16
15
 
@@ -41,16 +41,14 @@ public struct Badge: View {
41
41
  }
42
42
 
43
43
  private var badgeColor: Color {
44
- let defaultColor: Color = isNumber(label)
45
- ? theme.colors.error.primary
46
- : theme.colors.warning.primary
47
-
48
- // Mirror Compose: only apply backgroundColor when it is one of the
49
- // allowed primaryColors; otherwise fall back to the label-based default.
44
+ // Mirrors Compose: backgroundColor applies only when it is one of primaryColors.
50
45
  if let bgColor = backgroundColor, primaryColors.contains(bgColor) {
51
46
  return bgColor
52
47
  }
53
- return defaultColor
48
+ if isNumber(label) {
49
+ return theme.colors.error.primary
50
+ }
51
+ return theme.colors.warning.primary
54
52
  }
55
53
 
56
54
  public var body: some View {
@@ -229,9 +229,8 @@ public struct Button: View {
229
229
  }
230
230
  }
231
231
 
232
- /// Mirrors Compose's press feedback: the background shrinks via an animated
233
- /// horizontal inset and the whole button (background included) fades to 0.5,
234
- /// matching `animatedPadding`/`alpha` in Button.kt.
232
+ /// Compose's press feedback (`animatedPadding` / `alpha` in Button.kt): the background shrinks by an animated
233
+ /// horizontal inset and the whole button fades to 0.5.
235
234
  private struct ButtonPressFeedbackStyle: ButtonStyle {
236
235
  let isEnabled: Bool
237
236
  let background: Color
@@ -92,11 +92,9 @@ public struct CalculatorKeyboard: View {
92
92
 
93
93
  var result = terms[0]
94
94
  for (sign, term) in zip(signs, terms.dropFirst()) {
95
- let (next, overflow) = sign == "+"
96
- ? result.addingReportingOverflow(term)
97
- : result.subtractingReportingOverflow(term)
98
- if overflow { return nil }
99
- result = next
95
+ let step = sign == "+" ? result.addingReportingOverflow(term) : result.subtractingReportingOverflow(term)
96
+ if step.overflow { return nil }
97
+ result = step.partialValue
100
98
  }
101
99
  return result
102
100
  }
@@ -1,8 +1,7 @@
1
1
  import SwiftUI
2
2
 
3
- /// Compose `Carousel`; `content` and the snap / scroll-index callbacks get the real (modulo) index.
4
- /// A custom drag-driven pager, not a ScrollView or `TabView(.page)`, which can't express the loop
5
- /// virtualization or the inactive-slide opacity/scale effects.
3
+ /// Compose `Carousel`; `content` and the snap / scroll-index callbacks get the real (modulo) index. A drag-driven
4
+ /// pager, as ScrollView and `TabView(.page)` can't express the loop virtualization or inactive-slide effects.
6
5
  public struct Carousel<Content: View>: View {
7
6
  // MARK: Lifecycle
8
7
 
@@ -94,11 +94,7 @@ public struct Collapse<Content: View>: View {
94
94
  content()
95
95
  }
96
96
  .frame(maxWidth: .infinity)
97
- .overlay(
98
- showBorder
99
- ? Rectangle().strokeBorder(theme.colors.border.default, lineWidth: 1)
100
- : nil
101
- )
97
+ .overlay(contentBorder)
102
98
  .transition(.move(edge: .top))
103
99
  }
104
100
  }
@@ -108,17 +104,27 @@ public struct Collapse<Content: View>: View {
108
104
  .frame(maxWidth: .infinity)
109
105
  .background(resolvedBackgroundColor)
110
106
  .clipShape(RoundedRectangle(cornerRadius: Radius.S, style: .continuous))
111
- .overlay(
112
- showBorder
113
- ? RoundedRectangle(cornerRadius: Radius.S, style: .continuous)
114
- .strokeBorder(theme.colors.border.default, lineWidth: 1)
115
- : nil
116
- )
107
+ .overlay(containerBorder)
117
108
  // `.contain` keeps the children's own identifiers instead of overriding them.
118
109
  .accessibilityElement(children: .contain)
119
110
  .accessibilityIdentifier(automationId)
120
111
  }
121
112
 
113
+ @ViewBuilder
114
+ private var contentBorder: some View {
115
+ if showBorder {
116
+ Rectangle().strokeBorder(theme.colors.border.default, lineWidth: 1)
117
+ }
118
+ }
119
+
120
+ @ViewBuilder
121
+ private var containerBorder: some View {
122
+ if showBorder {
123
+ RoundedRectangle(cornerRadius: Radius.S, style: .continuous)
124
+ .strokeBorder(theme.colors.border.default, lineWidth: 1)
125
+ }
126
+ }
127
+
122
128
  private var header: some View {
123
129
  SwiftUI.Button(action: {
124
130
  onPress?(expanded)
@@ -1,8 +1,7 @@
1
1
  import SwiftUI
2
2
 
3
- /// Mirrors Compose's `Modifier.activeOpacityClickable(activeOpacity:)` (modifier/Clickable.kt):
4
- /// fades the whole tappable subtree to `activeOpacity` while pressed, animated, instead of
5
- /// relying on a platform-default press indication.
3
+ /// Compose's `Modifier.activeOpacityClickable(activeOpacity:)`: the whole tappable subtree fades to `activeOpacity`
4
+ /// while pressed, instead of a platform-default press indication.
6
5
  struct ActiveOpacityButtonStyle: ButtonStyle {
7
6
  var activeOpacity: Double = 0.2
8
7
 
@@ -16,9 +16,8 @@ let iconSources: [String: String] = {
16
16
  return kitIcons.merging(hostIcons.mapValues(\.uri)) { kit, _ in kit }
17
17
  }()
18
18
 
19
- // Compose defaults `color` to the theme text color while `color = null` means "no tint".
20
- // Swift can't tell an omitted argument from an explicit `nil`, so the default is this
21
- // unrepresentable sentinel: omitted -> theme text color, `nil` -> untinted.
19
+ // Compose defaults `color` to the theme text color, `null` meaning no tint. Swift can't tell an omitted argument
20
+ // from `nil`, so the default is this unrepresentable sentinel: omitted -> theme text color, `nil` -> untinted.
22
21
  public let iconThemeColor = Color(.sRGB, red: -1, green: -1, blue: -1, opacity: -1)
23
22
 
24
23
  public struct Icon: View {
@@ -118,9 +118,8 @@ public struct IconButton: View {
118
118
  }
119
119
  }
120
120
 
121
- /// Type-erased shape switch (`Circle` vs a fixed `Radius.S` rounded rect) — mirrors
122
- /// Compose's `IconShape.toShape()`. `AnyShape` needs iOS 17+, so this hand-rolls the same
123
- /// erasure at the deployment target's iOS 15 floor.
121
+ /// Compose's `IconShape.toShape()` (`Circle` or a `Radius.S` rounded rect), type-erased by hand: `AnyShape` needs
122
+ /// iOS 17+ and the pod supports iOS 15.
124
123
  private struct IconButtonShape: InsettableShape {
125
124
  let shape: IconShape
126
125
  var insetAmount: CGFloat = 0
@@ -1,13 +1,5 @@
1
1
  import SwiftUI
2
2
 
3
- /// Body searches keep 36 / 24; the header search matches the 32pt header buttons.
4
- enum InputSearchSize {
5
- case `default`, header
6
-
7
- var height: CGFloat { self == .header ? HeaderLayoutMetrics.searchHeight : 36 }
8
- var iconSize: CGFloat { self == .header ? HeaderLayoutMetrics.iconSize : 24 }
9
- }
10
-
11
3
  // MARK: - RenderRightIconSearch
12
4
 
13
5
  struct RenderRightIconSearch: View {
@@ -15,7 +7,6 @@ struct RenderRightIconSearch: View {
15
7
  let loading: Bool
16
8
  let icon: String
17
9
  let color: Color
18
- var size: InputSearchSize = .default
19
10
  let onClick: () -> Void
20
11
 
21
12
  var body: some View {
@@ -26,13 +17,13 @@ struct RenderRightIconSearch: View {
26
17
  .padding(.horizontal, Spacing.S)
27
18
  }
28
19
  if !icon.isEmpty {
29
- // Compose: a 1pt rule inset S from the top and bottom of the bar.
20
+ // Compose: a 1pt rule inset S from the top and bottom of the 36pt bar.
30
21
  Rectangle()
31
22
  .fill(theme.colors.primary)
32
- .frame(width: 1, height: size.height - Spacing.S * 2)
23
+ .frame(width: 1, height: 36 - Spacing.S * 2)
33
24
  .padding(.leading, Spacing.S)
34
25
 
35
- Icon(source: icon, size: size.iconSize, color: color)
26
+ Icon(source: icon, size: 24, color: color)
36
27
  .padding(.leading, Spacing.S)
37
28
  .onTapGesture(perform: onClick)
38
29
  }
@@ -146,7 +137,6 @@ public struct InputSearch: View {
146
137
  var clearCondition: (() -> Bool)? = nil
147
138
  var onClearPress: () -> Void = {}
148
139
  var onSubmit: () -> Void = {}
149
- var size: InputSearchSize = .default
150
140
 
151
141
  @State private var isFocused = false
152
142
  @State private var isBlurred = false
@@ -236,7 +226,7 @@ public struct InputSearch: View {
236
226
  if let searchIcon = searchIcon {
237
227
  searchIcon()
238
228
  } else {
239
- Icon(source: "navigation_search", size: size.iconSize, color: theme.colors.text.hint)
229
+ Icon(source: "navigation_search", size: 24, color: theme.colors.text.hint)
240
230
  .padding(.trailing, Spacing.XS)
241
231
  }
242
232
 
@@ -285,11 +275,11 @@ public struct InputSearch: View {
285
275
  .padding(.leading, Spacing.XS)
286
276
  }
287
277
 
288
- RenderRightIconSearch(loading: loading, icon: icon, color: iconColor, size: size, onClick: onRightIconPressed)
278
+ RenderRightIconSearch(loading: loading, icon: icon, color: iconColor, onClick: onRightIconPressed)
289
279
  }
290
280
  .padding(.horizontal, Spacing.M)
291
281
  .frame(maxWidth: .infinity, alignment: .leading)
292
- .frame(height: size.height)
282
+ .frame(height: 36)
293
283
  .background(
294
284
  RoundedRectangle(cornerRadius: Radius.XL)
295
285
  .fill(backgroundColor ?? theme.colors.background.surface)
@@ -308,13 +298,6 @@ public struct InputSearch: View {
308
298
  }
309
299
  }
310
300
 
311
- /// The header search: 32pt tall with a 20pt icon, level with the header buttons.
312
- func headerSize() -> InputSearch {
313
- var copy = self
314
- copy.size = .header
315
- return copy
316
- }
317
-
318
301
  // MARK: - Helper Functions
319
302
 
320
303
  func getBorderColor(isFocused: Bool, error: String, disabled: Bool) -> Color {
@@ -56,9 +56,8 @@ public extension ScreenLayout {
56
56
  }
57
57
 
58
58
  public extension ModalLayout {
59
- /// Popup / bottom sheet geometry from plain window metrics, for hosts without a kits screen
60
- /// (`ScreenLayout.current.modalLayout` covers the key window). Points, window coordinates; on iPhone
61
- /// Duo `safeInsets` also carries the control column and `hinge` is the half-fold hinge (nil while flat).
59
+ /// For hosts without a kits screen (`ScreenLayout.current.modalLayout` covers the key window); window points.
60
+ /// On iPhone Duo `safeInsets` includes the control column and `hinge` is the half-fold hinge (nil while flat).
62
61
  static func resolve(
63
62
  width: CGFloat,
64
63
  height: CGFloat,
@@ -147,9 +147,10 @@ extension ScreenLayout {
147
147
  // Activities; region frames already include the system's margin
148
148
  let occlusion = stripOcclusion(reservedRegions, stripLeft: stripLeft, stripRight: stripLeft + sideInset, windowHeight: height)
149
149
 
150
- var top = statusBarClearance != nil
151
- ? headerHeight + Spacing.M
152
- : insets.top + HeaderMetrics.barHeight + Spacing.M
150
+ var top = insets.top + HeaderMetrics.barHeight + Spacing.M
151
+ if statusBarClearance != nil {
152
+ top = headerHeight + Spacing.M
153
+ }
153
154
  if insets.top < HeaderMetrics.statusBarMinInset {
154
155
  // status bar lives in the strip: start under its cluster, as the native bar does
155
156
  if width <= height {
@@ -206,9 +207,8 @@ extension ScreenLayout {
206
207
  return (height, max(0, centerY * 2 - height))
207
208
  }
208
209
 
209
- /// How far system regions reach into a side strip from its top and from its bottom end
210
- /// (e.g. the camera, which sits at either end depending on the rotation), and the center y
211
- /// of the region reaching furthest from the top.
210
+ /// How far system regions (e.g. the camera, at either end by rotation) reach into a side strip from its top and
211
+ /// bottom ends, and the center y of the one reaching furthest from the top.
212
212
  private static func stripOcclusion(
213
213
  _ regions: [CGRect],
214
214
  stripLeft: CGFloat,
@@ -270,9 +270,8 @@ public func isIPhoneDuoDevice(windowSize: CGSize? = nil) -> Bool {
270
270
  return FoldableDevice.isFoldable(measuredIn: keyWindow) || insets.map { $0.left != $0.right } == true
271
271
  }
272
272
 
273
- /// Apple's foldable check (as the host's `SideTabRailView.isFoldableDevice`): only a device with a
274
- /// hinge reports a `.division` region, inactive while flat but still there. Screen size cannot tell
275
- /// it apart from a large iPhone in landscape or a narrowed window.
273
+ /// Apple's foldable check (host `SideTabRailView.isFoldableDevice`): only a hinged device reports a `.division`
274
+ /// region, even inactive while flat. Screen size can't tell it from a landscape iPhone or a narrowed window.
276
275
  enum FoldableDevice {
277
276
  // a hinge never goes away, so a positive answer is kept
278
277
  private static var isKnownFoldable = false
@@ -311,9 +310,8 @@ enum FoldableDevice {
311
310
 
312
311
  // MARK: - Reserved regions
313
312
 
314
- /// System occlusion regions (iOS 27.1+) in window coordinates: the iPhone Duo camera, and the
315
- /// status bar cluster as it grows for a call or a Live Activity. Empty before iOS 27.1.
316
- /// `division` is the active hinge region, there only while the device is half folded.
313
+ /// System occlusion regions (iOS 27.1+, else empty) in window coordinates: the iPhone Duo camera and the status bar
314
+ /// cluster, which grows for a call or a Live Activity. `division` is the hinge, there only while half folded.
317
315
  enum ReservedRegions {
318
316
  // last report of a probe, so `ScreenLayout.current` includes it
319
317
  private(set) static var current: [CGRect] = []
@@ -1,8 +1,7 @@
1
1
  import SwiftUI
2
2
 
3
- /// Grid section container (12 columns, 24 when the content is wider than 600pt): horizontal
4
- /// margin, optional background image, and a wrapping row of children that read their span
5
- /// size from `\.gridContext`. Mirrors `vn.momo.kits.layout.Section`.
3
+ /// Compose `layout.Section`: a 12-column grid (24 when wider than 600pt) with margin, optional background image
4
+ /// and a wrapping row of children that read their span from `\.gridContext`.
6
5
  public struct SectionView<Content: View>: View {
7
6
  // MARK: Lifecycle
8
7
 
@@ -100,9 +100,8 @@ struct BottomSheetView<Content: View>: View {
100
100
  return progress * maxDynamicAlpha
101
101
  }
102
102
 
103
- /// Mirrors Compose's `alpha = (backgroundAlpha + dynamicAlpha) * scrimOpacity`: additive, so the
104
- /// scrim peaks at `scrimOpacity` at rest and only fades to half of it while dragging
105
- /// (backgroundAlpha holds steady until an explicit close()).
103
+ /// Compose's `(backgroundAlpha + dynamicAlpha) * scrimOpacity`: additive, so a drag fades the scrim only to half
104
+ /// of `scrimOpacity` (backgroundAlpha holds until an explicit close()).
106
105
  private var totalScrimAlpha: CGFloat { (backgroundAlpha + dynamicAlpha) * modal.scrimOpacity }
107
106
 
108
107
  var body: some View {
@@ -281,9 +280,8 @@ struct BottomSheetView<Content: View>: View {
281
280
  }
282
281
  }
283
282
 
284
- /// Compose's `heightIn(max:)`. `.frame(maxHeight:)` grows to the cap whenever the proposal is
285
- /// larger, leaving a gap above the header; this sizes the sheet to its content and only caps it
286
- /// when taller.
283
+ /// Compose's `heightIn(max:)`: sizes the sheet to its content, capped only when taller. `.frame(maxHeight:)` grows
284
+ /// to the cap whenever the proposal is larger, leaving a gap above the header.
287
285
  private struct CapHeight: ViewModifier {
288
286
  let maxHeight: CGFloat
289
287
 
@@ -296,9 +294,8 @@ private struct CapHeight: ViewModifier {
296
294
  }
297
295
  }
298
296
 
299
- /// iOS 15 has no `Layout`: the sheet hugs its ideal height until that outgrows the cap, then is
300
- /// held at the cap. A capped sheet can't read its ideal height (that needs a second copy of the
301
- /// content), so it is re-measured only when the cap grows, e.g. once the keyboard goes down.
297
+ /// iOS 15 (no `Layout`): hugs the ideal height until it outgrows the cap. A capped sheet can't read its ideal height
298
+ /// without a second copy of the content, so it is re-measured only when the cap grows (e.g. the keyboard hides).
302
299
  private struct CapHeightFallback: ViewModifier {
303
300
  let maxHeight: CGFloat
304
301
  @State private var capped = false
@@ -1,6 +1,5 @@
1
- // SwiftUI mirror of Compose's `navigation/bottomtab/BottomTab.kt`: tabbed screens, each in
2
- // `StackScreen` chrome built from its own `Navigation`, over a `BottomTabBar` (or the iPhone Duo
3
- // rail / floating bar). Switching tabs cross-fades + scales the content.
1
+ // SwiftUI mirror of Compose's `navigation/bottomtab/BottomTab.kt`: tabs in `StackScreen` chrome, each with its own
2
+ // `Navigation`, over a `BottomTabBar` (or the iPhone Duo rail / floating bar); a switch cross-fades + scales.
4
3
 
5
4
  import SwiftUI
6
5
  import UIKit
@@ -25,9 +24,8 @@ public struct BottomTab: View {
25
24
  @State private var expandedBar: DuoBar?
26
25
  @State private var openedBar: DuoBar?
27
26
 
28
- /// `compressionBehavior`: on iPhone Duo, the bar that starts compressed when the side bar can't hold
29
- /// both (tapping it swaps them). `onTabPress` gets every press with the switch to run, e.g. after a
30
- /// login gate. `backToInitialTab`: back off another tab returns to the initial one first.
27
+ /// `compressionBehavior`: iPhone Duo bar that starts compressed when the side bar can't hold both (a tap swaps).
28
+ /// `onTabPress` gets the switch to run, e.g. after a login gate. `backToInitialTab`: back goes to it first.
31
29
  public init(
32
30
  items: [BottomTabItem],
33
31
  floatingButton: BottomTabFloatingButton? = nil,
@@ -179,9 +177,8 @@ private struct TabScreenHost: View {
179
177
 
180
178
  // MARK: - Tab host
181
179
 
182
- /// Compose's tab NavHost with `saveState` / `restoreState`: a tab keeps its UIHostingController from
183
- /// first selection, so state and scroll survive a switch; while hidden it is out of the window and
184
- /// gets onDisappear / onAppear (re-running screen tracking). Same scheme as `StackController`.
180
+ /// Compose's tab NavHost with `saveState` / `restoreState`: a tab keeps its UIHostingController (state, scroll).
181
+ /// Hidden, it leaves the window and gets onDisappear / onAppear, re-running screen tracking, as in `StackController`.
185
182
  private struct TabHost: UIViewControllerRepresentable {
186
183
  let selectedIndex: Int
187
184
  let count: Int
@@ -1,6 +1,5 @@
1
- // SwiftUI mirror of Compose's `navigation/bottomtab/BottomTabBar.kt`.
2
- // Horizontal navigation bar (Figma "Specs Navigation", DS-984): floating container, items split
3
- // evenly with a tonal active indicator, badges/dots, and the Special type's center action in a notch.
1
+ // SwiftUI mirror of Compose's `navigation/bottomtab/BottomTabBar.kt` (Figma "Specs Navigation", DS-984): floating
2
+ // container, evenly split items with a tonal active indicator, badges/dots, the Special center action in a notch.
4
3
 
5
4
  import SwiftUI
6
5
 
@@ -102,9 +101,8 @@ struct BottomTabBar: View {
102
101
  }
103
102
  }
104
103
 
105
- /// Horizontal navigation bar: floating container, items split evenly; Special type puts the center
106
- /// action in a notch in the middle, rising ctaLift above the container. One active indicator slides
107
- /// behind the selected item.
104
+ /// One active indicator slides behind the selected item; the Special type's center action rises ctaLift above
105
+ /// the container's notch.
108
106
  struct HorizontalTabBar: View {
109
107
  let items: [BottomTabItem]
110
108
  let floatingButton: BottomTabFloatingButton?
@@ -40,9 +40,8 @@ struct NotchedBarShape: Shape {
40
40
  }
41
41
  }
42
42
 
43
- /// Navigation bar container: one translucent surface fill (Figma .Nav/Background) with the floating
44
- /// shadow following the shape. Opaque shadow layers under it would make the glass solid, so both
45
- /// shadows go over the fill (compositingGroup keeps the first from being re-cast).
43
+ /// Translucent fill (Figma .Nav/Background) with the shadow following the shape. Shadows go over the fill, as opaque
44
+ /// layers under it would make the glass solid (compositingGroup keeps the first from being re-cast).
46
45
  struct TabBarContainer<S: Shape>: ViewModifier {
47
46
  let shape: S
48
47
 
@@ -31,9 +31,8 @@ struct DuoBarCompression {
31
31
  /// Back, then the single button the toolbar folds into.
32
32
  private static let compressedToolbarHeight = 2 * DuoMetrics.controlSize + Spacing.M
33
33
 
34
- /// Both fit: both stay whole. One fits beside the other compressed: it is compressed and tapping it
35
- /// swaps them. Otherwise both rest compressed; tapping one opens it for a moment (the rail closes
36
- /// again once a tab is picked).
34
+ /// Both fit: both whole. One fits beside the other compressed: it is compressed and a tap swaps them. Otherwise
35
+ /// both rest compressed and a tap opens one for a moment (the rail closes again once a tab is picked).
37
36
  static func resolve(
38
37
  layout: ScreenLayout,
39
38
  tabCount: Int,
@@ -26,9 +26,10 @@ extension EnvironmentValues {
26
26
 
27
27
  /// Rail container plus the center action under it; compressed, the rail is a single button.
28
28
  func duoRailHeight(itemCount: Int, hasQr: Bool, compressed: Bool = false) -> CGFloat {
29
- let rail = compressed
30
- ? compactSize
31
- : CGFloat(itemCount) * TabBarMetrics.railItemHeight + TabBarMetrics.railPaddingBottom
29
+ var rail = CGFloat(itemCount) * TabBarMetrics.railItemHeight + TabBarMetrics.railPaddingBottom
30
+ if compressed {
31
+ rail = compactSize
32
+ }
32
33
  return rail + (hasQr ? TabBarMetrics.railCtaGap + TabBarMetrics.railCtaHeight : 0)
33
34
  }
34
35
 
@@ -71,9 +72,8 @@ struct DuoTabBar: View {
71
72
  }
72
73
  }
73
74
 
74
- /// Vertical bar anchored to the bottom of the side bar, center action below it.
75
- /// When the side bar is short it can shrink to one button showing the current tab
76
- /// (HIG "Tab bar compressed"); tapping it expands the rail and compresses the toolbar.
75
+ /// Vertical bar at the bottom of the side bar, center action below. A short side bar shrinks it to one button showing
76
+ /// the current tab (HIG "Tab bar compressed"); a tap expands the rail and compresses the toolbar.
77
77
  private struct DuoRailTabBar: View {
78
78
  let sideBar: SideBarLayout
79
79
  let items: [BottomTabItem]
@@ -1,6 +1,5 @@
1
- // Navigation bar measurements (Figma "Specs Navigation", DS-984), mirrored from Compose's
2
- // `navigation/bottomtab/TabBarMetrics.kt` and RN `BottomTab/metrics.ts`. Horizontal: floating
3
- // container, center action in a notch; vertical: iPhone Duo rail, center action under it.
1
+ // Navigation bar measurements (Figma "Specs Navigation", DS-984), mirrored from Compose's `TabBarMetrics.kt` and RN
2
+ // `BottomTab/metrics.ts`. Horizontal: floating, center action in a notch; vertical: iPhone Duo rail, action under it.
4
3
 
5
4
  import SwiftUI
6
5
 
@@ -44,9 +43,8 @@ enum TabBarMetrics {
44
43
  static let ctaLift: CGFloat = 22
45
44
  static let ctaLabelGap = Spacing.M
46
45
  static let ctaLabelHeight: CGFloat = 18
47
- // notch dipped into the container top edge under the center action (Figma "Backgroud" path):
48
- // starts notchHalfWidth left of the center, then cubic segments of control1, control2, end,
49
- // each point as (dx from the center, dy below the top edge)
46
+ // container-top notch under the center action (Figma "Backgroud" path): from notchHalfWidth left of the center,
47
+ // cubic segments [control1, control2, end], each point (dx from the center, dy below the top edge)
50
48
  static let notchHalfWidth: CGFloat = 50.758
51
49
  static let notchCurves: [[CGPoint]] = [
52
50
  [CGPoint(x: -39.749, y: 0), CGPoint(x: -31.231, y: 9.765), CGPoint(x: -24.563, y: 18.526)],