@momo-kits/native-kits 0.169.6-debug → 0.169.7-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 (134) hide show
  1. package/compose/build.gradle.kts +1 -1
  2. package/compose/compose.podspec +1 -1
  3. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +1 -2
  4. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +1 -5
  5. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +2 -4
  6. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +13 -12
  7. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +2 -2
  8. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -1
  9. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +13 -73
  10. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +1 -1
  11. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +1 -8
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +3 -8
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -1
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +1 -3
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +7 -15
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +1 -3
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +1 -2
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -2
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +1 -2
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +1 -1
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +1 -2
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -2
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +6 -30
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +2 -18
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -2
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -3
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +6 -24
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -5
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +1 -7
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -3
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +1 -1
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +4 -30
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +2 -7
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +1 -2
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +4 -7
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +5 -1
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -12
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -2
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +1 -1
  40. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +1 -1
  41. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +1 -2
  42. package/gradle/libs.versions.toml +0 -2
  43. package/gradle.properties +1 -1
  44. package/ios/Application/ApplicationEnvironment.swift +2 -3
  45. package/ios/Application/DesignSystemKits.swift +4 -20
  46. package/ios/Application/DesignSystemKitsPayload.swift +0 -8
  47. package/ios/Application/LanguageSource.swift +0 -8
  48. package/ios/Application/Localize.swift +7 -31
  49. package/ios/Application/LocalizeModifier.swift +0 -8
  50. package/ios/Application/MaxApi.swift +3 -11
  51. package/ios/Avatar/Avatar.swift +0 -1
  52. package/ios/Badge/Badge.swift +0 -1
  53. package/ios/Badge/BadgeRibbon.swift +2 -5
  54. package/ios/Button/Button.swift +2 -5
  55. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +2 -2
  56. package/ios/Carousel/Carousel.swift +5 -17
  57. package/ios/Checkbox/Checkbox.swift +0 -2
  58. package/ios/Colors+Radius+Spacing/Theme.swift +0 -7
  59. package/ios/DateTimePicker/DateTimePicker.swift +4 -10
  60. package/ios/DateTimePicker/DateTimePickerTypes.swift +1 -3
  61. package/ios/DateTimePicker/DateTimePickerUtils.swift +0 -3
  62. package/ios/DateTimePicker/WheelPicker.swift +2 -4
  63. package/ios/Extensions/SkeletonUICompat.swift +0 -8
  64. package/ios/Icon/Icon.swift +1 -3
  65. package/ios/IconButton/IconButton.swift +0 -2
  66. package/ios/Input/ErrorView.swift +0 -7
  67. package/ios/Input/Input.swift +6 -19
  68. package/ios/Input/InputPhoneNumber.swift +0 -11
  69. package/ios/Input/InputSearch.swift +0 -6
  70. package/ios/Input/InputTextArea.swift +1 -12
  71. package/ios/InputDropDown/InputDropDown.swift +1 -11
  72. package/ios/InputMoney/InputMoney.swift +9 -28
  73. package/ios/InputOTP/InputOTP.swift +2 -9
  74. package/ios/Layout/Item.swift +1 -2
  75. package/ios/Layout/ModalLayout.swift +7 -14
  76. package/ios/Layout/ScreenLayout.swift +2 -7
  77. package/ios/Loader/Loader.swift +3 -12
  78. package/ios/Lottie/LottieView.swift +0 -11
  79. package/ios/Navigation/BottomSheet.swift +14 -35
  80. package/ios/Navigation/BottomTab/BottomTab.swift +10 -19
  81. package/ios/Navigation/BottomTab/BottomTabBar.swift +4 -10
  82. package/ios/Navigation/BottomTab/CurvedContainer.swift +5 -11
  83. package/ios/Navigation/BottomTab/DuoBarCompression.swift +6 -12
  84. package/ios/Navigation/BottomTab/DuoTabBar.swift +2 -7
  85. package/ios/Navigation/BottomTab/TabBarMetrics.swift +3 -9
  86. package/ios/Navigation/Component/FloatingButton.swift +4 -11
  87. package/ios/Navigation/Component/Header.swift +4 -8
  88. package/ios/Navigation/Component/HeaderBackground.swift +2 -8
  89. package/ios/Navigation/Component/HeaderJourney.swift +2 -7
  90. package/ios/Navigation/Component/HeaderLocation.swift +2 -7
  91. package/ios/Navigation/Component/HeaderRight.swift +2 -7
  92. package/ios/Navigation/Component/HeaderTitle.swift +1 -6
  93. package/ios/Navigation/Component/HeaderUser.swift +2 -9
  94. package/ios/Navigation/Component/SideBar.swift +3 -8
  95. package/ios/Navigation/Component/SnackBar.swift +5 -13
  96. package/ios/Navigation/HostBackGestureBridge.swift +3 -9
  97. package/ios/Navigation/ModalScreen.swift +2 -8
  98. package/ios/Navigation/Navigation.swift +2 -15
  99. package/ios/Navigation/NavigationContainer.swift +3 -12
  100. package/ios/Navigation/Navigator.swift +15 -27
  101. package/ios/Navigation/StackScreen.swift +8 -28
  102. package/ios/Navigation/StackTransition.swift +3 -11
  103. package/ios/Navigation/SwipeBackHaptic.swift +2 -7
  104. package/ios/Navigation/Tracking/ScreenTracker.swift +2 -7
  105. package/ios/Pagination/PaginationDot.swift +0 -9
  106. package/ios/Pagination/PaginationNumber.swift +1 -9
  107. package/ios/Pagination/PaginationScroll.swift +2 -14
  108. package/ios/Pagination/PaginationWhiteDot.swift +1 -10
  109. package/ios/Popup/PopupDisplay.swift +3 -3
  110. package/ios/Popup/PopupInput.swift +1 -1
  111. package/ios/Popup/PopupLayout.swift +3 -3
  112. package/ios/PopupView/FullscreenPopup.swift +3 -4
  113. package/ios/PopupView/PopupView.swift +2 -2
  114. package/ios/PopupView/Utils++.swift +1 -2
  115. package/ios/ProgressInfo/ProgressInfo.swift +2 -13
  116. package/ios/Skeleton/Skeleton.swift +2 -10
  117. package/ios/Slider/Slider.swift +5 -12
  118. package/ios/StatusBarTap/StatusBarTap.h +2 -3
  119. package/ios/StatusBarTap/StatusBarTap.m +3 -16
  120. package/ios/Stepper/Stepper.swift +8 -27
  121. package/ios/Steps/Steps.swift +9 -11
  122. package/ios/Swipeable/SwipeCell.swift +2 -2
  123. package/ios/Swipeable/SwipeCellModel.swift +3 -6
  124. package/ios/TabView/TabView.swift +12 -25
  125. package/ios/Template/TrustBanner/TrustBanner.swift +2 -9
  126. package/ios/Tooltip/Tooltip.swift +2 -7
  127. package/ios/Typography/FontScale.swift +3 -15
  128. package/ios/Typography/Text.swift +2 -7
  129. package/ios/Typography/Typography.swift +8 -10
  130. package/ios/Uploader/Uploader.swift +2 -17
  131. package/ios/native-kits.podspec +1 -1
  132. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  133. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +0 -8
  134. package/package.json +1 -1
@@ -1,11 +1,6 @@
1
- //
2
- // BottomTab.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/bottomtab/BottomTab.kt`: tabbed screens, each in
6
- // `StackScreen` chrome built from its own `Navigation`, over a `BottomTabBar` (or the iPhone Duo
7
- // rail / floating bar). Switching tabs cross-fades + scales the content.
8
- //
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.
9
4
 
10
5
  import SwiftUI
11
6
  import UIKit
@@ -30,10 +25,9 @@ public struct BottomTab: View {
30
25
  @State private var expandedBar: DuoBar?
31
26
  @State private var openedBar: DuoBar?
32
27
 
33
- /// `compressionBehavior`: on iPhone Duo, when the side bar can't hold both bars, which one
34
- /// starts compressed; tapping the compressed one swaps them.
35
- /// `onTabPress` gets every tab press with the switch to perform, e.g. after a login gate.
36
- /// `backToInitialTab`: back off another tab returns to the initial one before leaving the screen.
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.
37
31
  public init(
38
32
  items: [BottomTabItem],
39
33
  floatingButton: BottomTabFloatingButton? = nil,
@@ -86,7 +80,6 @@ public struct BottomTab: View {
86
80
  public var body: some View {
87
81
  let compression = compression
88
82
  ZStack(alignment: .bottom) {
89
- // Tab content area, inset above the bar.
90
83
  TabHost(selectedIndex: selectedIndex, count: items.count) { index in AnyView(tabScreen(for: index)) }
91
84
  // each tab hosts itself, so it needs the window's safe area to draw its header under the status bar
92
85
  .ignoresSafeArea(.container, edges: [.top, .horizontal])
@@ -183,10 +176,9 @@ private struct TabScreenHost: View {
183
176
 
184
177
  // MARK: - Tab host
185
178
 
186
- /// Compose's tab NavHost with `saveState` / `restoreState`. A tab gets its own UIHostingController
187
- /// on first selection and keeps it, so its state and scroll survive a switch; while hidden it is
188
- /// out of the window, so it gets onDisappear / onAppear (and re-runs screen tracking) like a NavHost
189
- /// destination or a UITabBarController tab. Same scheme as `StackController`.
179
+ /// Compose's tab NavHost with `saveState` / `restoreState`: a tab keeps its UIHostingController from
180
+ /// first selection, so state and scroll survive a switch; while hidden it is out of the window and
181
+ /// gets onDisappear / onAppear (re-running screen tracking). Same scheme as `StackController`.
190
182
  private struct TabHost: UIViewControllerRepresentable {
191
183
  let selectedIndex: Int
192
184
  let count: Int
@@ -287,7 +279,7 @@ private final class TabController: UIViewController {
287
279
  AnyView(content(index).environment(\.self, environment))
288
280
  }
289
281
 
290
- /// Bounds and center, a sliding tab carries a transform that frame doesn't work with.
282
+ /// Bounds and center, not frame: a sliding tab carries a transform.
291
283
  private func place(_ subview: UIView) {
292
284
  subview.bounds = view.bounds
293
285
  subview.center = CGPoint(x: view.bounds.midX, y: view.bounds.midY)
@@ -318,7 +310,6 @@ private final class TabController: UIViewController {
318
310
  }
319
311
  }
320
312
 
321
- /// Bottom safe-area inset (home indicator).
322
313
  private func safeAreaBottomInset() -> CGFloat {
323
314
  UIApplication.shared.connectedScenes
324
315
  .compactMap { ($0 as? UIWindowScene)?.keyWindow?.safeAreaInsets.bottom }
@@ -1,11 +1,6 @@
1
- //
2
- // BottomTabBar.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/bottomtab/BottomTabBar.kt`.
6
- // Horizontal navigation bar (Figma "Specs Navigation", DS-984): floating container, items split
7
- // evenly with a tonal active indicator, badges/dots, and the Special type's center action in a notch.
8
- //
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.
9
4
 
10
5
  import SwiftUI
11
6
 
@@ -212,8 +207,7 @@ struct ActiveIndicator: View {
212
207
  /// and the notch stay aligned.
213
208
  private let tabLabelMaxScale: CGFloat = 1.2
214
209
 
215
- /// Caps the label scale at `tabLabelMaxScale` (Compose's `CappedFontScale`): it keeps following the
216
- /// host/OS font scale but stops growing past 1.2× so it fits the fixed bar geometry.
210
+ /// Compose's `CappedFontScale`: caps the label scale at `tabLabelMaxScale` when enabled.
217
211
  struct CappedFontScale: ViewModifier {
218
212
  let enabled: Bool
219
213
 
@@ -1,10 +1,5 @@
1
- //
2
- // CurvedContainer.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `CurvedContainer.kt`: the navigation bar container shape, a rounded
6
- // rectangle with a notch cut into the top edge around the center action, and its floating shadow.
7
- //
1
+ // SwiftUI mirror of Compose's `CurvedContainer.kt`: the navigation bar container shape, a rounded
2
+ // rectangle with a notch cut into the top edge around the center action, and its floating shadow.
8
3
 
9
4
  import SwiftUI
10
5
 
@@ -45,10 +40,9 @@ struct NotchedBarShape: Shape {
45
40
  }
46
41
  }
47
42
 
48
- /// Navigation bar container: translucent glass fill (Figma .Nav/Background white 86%, Blur=On) with the
49
- /// floating shadow following the shape. A single translucent fill keeps the glass see-through — stacking
50
- /// opaque shadow layers would make it solid — so the two shadows are applied over it (compositingGroup
51
- /// keeps the first from being re-cast). iOS could back this with a real material later; see Compose note.
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).
52
46
  struct TabBarContainer<S: Shape>: ViewModifier {
53
47
  let shape: S
54
48
 
@@ -1,14 +1,9 @@
1
- //
2
- // DuoBarCompression.swift
3
- // MoMoUIKits
4
- //
5
- // Port of RN `BottomTab/DuoBarCompression.tsx` (HIG, Designing for iPhone Duo: Vertical controls):
6
- // keeps the side bar's toolbar and tab bar clear of each other.
7
- //
1
+ // Port of RN `BottomTab/DuoBarCompression.tsx` (HIG, Designing for iPhone Duo: Vertical controls):
2
+ // keeps the side bar's toolbar and tab bar clear of each other.
8
3
 
9
4
  import SwiftUI
10
5
 
11
- /// iPhone Duo: which side bar bar starts compressed when the strip cannot hold both whole.
6
+ /// iPhone Duo: which of the side bar's bars starts compressed when the strip cannot hold both whole.
12
7
  public enum DuoBarCompressionBehavior {
13
8
  case toolbar, tabBar
14
9
  }
@@ -36,10 +31,9 @@ struct DuoBarCompression {
36
31
  /// Back, then the single button the toolbar folds into.
37
32
  private static let compressedToolbarHeight = 2 * DuoMetrics.controlSize + Spacing.M
38
33
 
39
- /// - both fit: both stay whole
40
- /// - one fits whole beside the other compressed: one is compressed, tapping it swaps them
41
- /// - otherwise both rest compressed; tapping one opens it for a moment (the rail closes
42
- /// again once a tab is picked)
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).
43
37
  static func resolve(
44
38
  layout: ScreenLayout,
45
39
  tabCount: Int,
@@ -1,10 +1,5 @@
1
- //
2
- // DuoTabBar.swift
3
- // MoMoUIKits
4
- //
5
- // iPhone Duo tab bar, port of RN `BottomTab/DuoTabBar.tsx` (Figma "Specs Navigation", DS-984):
6
- // a rail in the side bar, or the horizontal bar at 65% of the short side when unfolded portrait.
7
- //
1
+ // iPhone Duo tab bar, port of RN `BottomTab/DuoTabBar.tsx` (Figma "Specs Navigation", DS-984):
2
+ // a rail in the side bar, or the horizontal bar at 65% of the short side when unfolded portrait.
8
3
 
9
4
  import SwiftUI
10
5
 
@@ -1,12 +1,6 @@
1
- //
2
- // TabBarMetrics.swift
3
- // MoMoUIKits
4
- //
5
- // Navigation bar measurements (Figma "Specs Navigation", DS-984), mirrored from Compose's
6
- // `navigation/bottomtab/TabBarMetrics.kt` and RN `BottomTab/metrics.ts`.
7
- // Horizontal: floating container with items split evenly, center action in a notch.
8
- // Vertical: iPhone Duo rail, center action under the container.
9
- //
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.
10
4
 
11
5
  import SwiftUI
12
6
 
@@ -1,25 +1,18 @@
1
- //
2
- // FloatingButton.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/FloatingButton.kt`: the screen FAB, whose
6
- // label collapses while the content scrolls down.
7
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/FloatingButton.kt`: the screen FAB, whose
2
+ // label collapses while the content scrolls down.
8
3
 
9
4
  import SwiftUI
10
5
 
11
6
  public enum FABSize {
12
7
  case small
13
8
  case `default`
14
- /// Backward-compatible alias for older iOS call sites. Compose names this
15
- /// size `DEFAULT`.
9
+ /// Older iOS name for `default` (Compose `DEFAULT`), kept for existing call sites.
16
10
  case large
17
11
  }
18
12
 
19
13
  public enum FABPosition {
20
14
  case end
21
- /// Backward-compatible alias for older iOS call sites. Compose names this
22
- /// position `END`.
15
+ /// Older iOS name for `end` (Compose `END`), kept for existing call sites.
23
16
  case right
24
17
  case center
25
18
  }
@@ -1,10 +1,5 @@
1
- //
2
- // Header.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/Header.kt`: the header bar (back button,
6
- // title, header right), its colors, opacity and the header models.
7
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/Header.kt`: the header bar (back button,
2
+ // title, header right), its colors, opacity and the header models.
8
3
 
9
4
  import SwiftUI
10
5
 
@@ -354,7 +349,8 @@ public struct NavigationHeader: View {
354
349
  /// iPhone Duo inner portrait: the row sits on the status bar, between its clusters, with 48pt controls.
355
350
  private var statusBarRow: Bool { layout.statusBarClearance != nil && !useSideBar }
356
351
 
357
- /// Max centered title width; on the status bar row the clusters are lopsided, so both sides keep the wider one's room.
352
+ /// Max centered title width; on the status bar row the clusters are lopsided, so both sides
353
+ /// keep the wider one's room.
358
354
  private var centerTitleMaxWidth: CGFloat {
359
355
  guard let clearance = layout.statusBarClearance else { return (layout.contentWidth - Spacing.M * 2) / 2 }
360
356
  let back = goBack == nil || useSideBar ? 0 : DuoMetrics.controlSize + Spacing.S
@@ -1,10 +1,5 @@
1
- //
2
- // HeaderBackground.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/HeaderBackground.kt`: the band behind the
6
- // header — the pink gradient (or the theme's header image) fading into the screen background.
7
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/HeaderBackground.kt`: the band behind the
2
+ // header — the pink gradient (or the theme's header image) fading into the screen background.
8
3
 
9
4
  import SwiftUI
10
5
 
@@ -143,7 +138,6 @@ struct DuoScrollGradient: View {
143
138
  .allowsHitTesting(false)
144
139
  }
145
140
 
146
- /// The fade spans the gradient box.
147
141
  private var gradient: LinearGradient {
148
142
  LinearGradient(
149
143
  colors: [theme.colors.gradient, theme.colors.gradient.opacity(0)],
@@ -1,10 +1,5 @@
1
- //
2
- // HeaderJourney.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/HeaderJourney.kt`: a "start → end" title
6
- // with an optional description below.
7
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/HeaderJourney.kt`: a "start → end" title
2
+ // with an optional description below.
8
3
 
9
4
  import SwiftUI
10
5
 
@@ -1,10 +1,5 @@
1
- //
2
- // HeaderLocation.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/HeaderLocation.kt`: a description above a
6
- // tappable location with a chevron.
7
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/HeaderLocation.kt`: a description above a
2
+ // tappable location with a chevron.
8
3
 
9
4
  import SwiftUI
10
5
 
@@ -1,10 +1,5 @@
1
- //
2
- // HeaderRight.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/HeaderRight.kt`: the mini-app toolkit
6
- // (shortcut / more / single tool, help center and close) in the bar or the iPhone Duo side bar.
7
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/HeaderRight.kt`: the mini-app toolkit
2
+ // (shortcut / more / single tool, help center and close) in the bar or the iPhone Duo side bar.
8
3
 
9
4
  import SwiftUI
10
5
 
@@ -1,9 +1,4 @@
1
- //
2
- // HeaderTitle.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/HeaderTitle.kt`: the plain header title.
6
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/HeaderTitle.kt`: the plain header title.
7
2
 
8
3
  import SwiftUI
9
4
 
@@ -1,12 +1,5 @@
1
- //
2
- // HeaderUser.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/HeaderUser.kt`.
6
- // Renders a `HeaderTitle.User`: an avatar group (1..n avatars with overflow),
7
- // a title with optional inline icons, and an optional subtitle. Shows a
8
- // skeleton shimmer placeholder while `isLoading`.
9
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/HeaderUser.kt`: avatar group, title with
2
+ // inline icons and an optional subtitle, or a skeleton while `isLoading`.
10
3
 
11
4
  import SwiftUI
12
5
 
@@ -1,11 +1,6 @@
1
- //
2
- // SideBar.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/SideBar.kt`. iPhone Duo: back and toolkit
6
- // leave the header bar for a column in the side safe area, as the system bars do.
7
- // Port of RN `SideBarButton.tsx` + `useSideBarItemStyle`.
8
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/SideBar.kt`. iPhone Duo: back and toolkit
2
+ // leave the header bar for a column in the side safe area, as the system bars do.
3
+ // Port of RN `SideBarButton.tsx` + `useSideBarItemStyle`.
9
4
 
10
5
  import SwiftUI
11
6
 
@@ -1,11 +1,5 @@
1
- //
2
- // SnackBar.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/SnackBar.kt`: slides up above the screen's
6
- // footer (or the home indicator), stays for `duration`, then slides back down.
7
- // `Navigator.showSnackBar(_:)` drives it through the overplay host.
8
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/SnackBar.kt`, driven by
2
+ // `Navigator.showSnackBar(_:)` through the overplay host.
9
3
 
10
4
  import Foundation
11
5
  import SwiftUI
@@ -38,8 +32,7 @@ public struct SnackBar {
38
32
  SnackBar(style: .custom, duration: duration, content: { AnyView(content()) })
39
33
  }
40
34
 
41
- /// Mirrors `SnackBar.Toast`: a placeholder with no custom content (parity with
42
- /// Compose where `Toast` currently renders nothing).
35
+ /// Mirrors `SnackBar.Toast`, which renders nothing in Compose either.
43
36
  public static func toast(duration: TimeInterval? = 3.0) -> SnackBar {
44
37
  SnackBar(style: .toast, duration: duration, content: nil)
45
38
  }
@@ -106,7 +99,7 @@ struct SnackBarView: View {
106
99
  }
107
100
  }
108
101
 
109
- // Mirrors Compose's `openEvent`: 350ms slide up.
102
+ // Compose's `openEvent`.
110
103
  private func open() {
111
104
  DispatchQueue.main.async {
112
105
  withAnimation(.easeOut(duration: 0.35)) {
@@ -115,7 +108,7 @@ struct SnackBarView: View {
115
108
  }
116
109
  }
117
110
 
118
- // Animated slide down, then remove (mirrors Compose's `closeEvent`/`hideSnackBar`).
111
+ // Slides down, then removes the overplay (Compose's `closeEvent` / `hideSnackBar`).
119
112
  private func close() {
120
113
  guard !isClosing else { return }
121
114
  isClosing = true
@@ -137,7 +130,6 @@ struct SnackBarView: View {
137
130
  private func scheduleAutoDismiss() {
138
131
  guard let duration = snackBar.duration else { return }
139
132
  let workItem = DispatchWorkItem {
140
- // Only auto-dismiss if this snack bar is still the active overplay.
141
133
  if navigator.overplay?.id == overplayId {
142
134
  navigator.hideSnackBar()
143
135
  }
@@ -1,12 +1,6 @@
1
- //
2
- // HostBackGestureBridge.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/HostBackGestureBridge.kt`: the host owns the edge-pan
6
- // recogniser and routes a back into the topmost kit stack. NavigationContainer attaches itself.
7
- // `started` / `progressed` / `completed` / `cancelled` scrub the pop transition with the finger;
8
- // a host that only calls `pop` gets the regular animated back.
9
- //
1
+ // SwiftUI mirror of Compose's `navigation/HostBackGestureBridge.kt`: the host owns the edge-pan
2
+ // recogniser and routes a back into the topmost kit stack (NavigationContainer attaches itself).
3
+ // `started` ... `cancelled` scrub the pop with the finger; a plain `pop` plays the regular back.
10
4
 
11
5
  import UIKit
12
6
 
@@ -1,11 +1,5 @@
1
- //
2
- // ModalScreen.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `ModalScreen` (navigation/ModalScreen.kt).
6
- // A centered overlay that fades + scales in over a dimmed scrim, and animates
7
- // back out before the overplay is removed. Driven by `Navigator.showModal`.
8
- //
1
+ // SwiftUI mirror of Compose's `navigation/ModalScreen.kt`, driven by `Navigator.showModal`: a
2
+ // centered overlay that fades + scales in over a dimmed scrim and animates out before removal.
9
3
 
10
4
  import SwiftUI
11
5
 
@@ -1,10 +1,5 @@
1
- //
2
- // Navigation.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/Navigation.kt`: a screen's `NavigationOptions` and the
6
- // per-screen `Navigation` that updates them at runtime.
7
- //
1
+ // SwiftUI mirror of Compose's `navigation/Navigation.kt`: a screen's `NavigationOptions` and the
2
+ // per-screen `Navigation` that updates them at runtime.
8
3
 
9
4
  import SwiftUI
10
5
 
@@ -66,11 +61,9 @@ public struct NavigationOptions {
66
61
  public var fullScreenContent: Bool
67
62
  public var hiddenBack: Bool
68
63
  public var backgroundColor: Color?
69
- // AI-GENERATED START: custom screen background view (Compose backgroundComponent)
70
64
  /// Drawn instead of `backgroundColor` over the whole window: under the header and the status bar,
71
65
  /// across the iPhone Duo side strips, and not shrunk by the keyboard. Pair with `headerTransparent`.
72
66
  public var background: (() -> AnyView)?
73
- // AI-GENERATED END: custom screen background view (Compose backgroundComponent)
74
67
  public var tintColor: Color?
75
68
  public var scrollable: Bool
76
69
  /// Compose's `ScrollData.scrollToTopCallback`, fired on a status-bar tap.
@@ -103,9 +96,7 @@ public struct NavigationOptions {
103
96
  fullScreenContent: Bool = false,
104
97
  hiddenBack: Bool = false,
105
98
  backgroundColor: Color? = nil,
106
- // AI-GENERATED START: custom screen background view (Compose backgroundComponent)
107
99
  background: (() -> AnyView)? = nil,
108
- // AI-GENERATED END: custom screen background view (Compose backgroundComponent)
109
100
  tintColor: Color? = Colors.black17,
110
101
  scrollable: Bool = true,
111
102
  scrollToTopCallback: (() -> Void)? = nil,
@@ -133,9 +124,7 @@ public struct NavigationOptions {
133
124
  self.fullScreenContent = fullScreenContent
134
125
  self.hiddenBack = hiddenBack
135
126
  self.backgroundColor = backgroundColor
136
- // AI-GENERATED START: custom screen background view (Compose backgroundComponent)
137
127
  self.background = background
138
- // AI-GENERATED END: custom screen background view (Compose backgroundComponent)
139
128
  self.tintColor = tintColor
140
129
  self.scrollable = scrollable
141
130
  self.scrollToTopCallback = scrollToTopCallback
@@ -172,9 +161,7 @@ struct OptionsStackScreen: View {
172
161
  var body: some View {
173
162
  StackScreen(
174
163
  backgroundColor: options.backgroundColor,
175
- // AI-GENERATED START: custom screen background view (Compose backgroundComponent)
176
164
  background: options.background,
177
- // AI-GENERATED END: custom screen background view (Compose backgroundComponent)
178
165
  headerTransparent: options.headerTransparent,
179
166
  fullScreenContent: options.fullScreenContent,
180
167
  tintColor: options.tintColor ?? Colors.black17,
@@ -1,11 +1,6 @@
1
- //
2
- // NavigationContainer.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/NavigationContainer.kt`: hosts the kit stack
6
- // (`StackHost`, the NavHost counterpart), injects Navigator, theme, localize and font scale, and
7
- // renders every registered screen inside `StackScreen` chrome built from its options.
8
- //
1
+ // SwiftUI mirror of Compose's `navigation/NavigationContainer.kt`: hosts the kit stack
2
+ // (`StackHost`, the NavHost counterpart), injects Navigator, theme, localize and font scale, and
3
+ // renders every registered screen inside `StackScreen` chrome built from its options.
9
4
 
10
5
  import SwiftUI
11
6
 
@@ -50,9 +45,7 @@ public struct NavigationContainer<Initial: View>: View {
50
45
  maxApi: maxApi
51
46
  )
52
47
  )
53
- // AI-GENERATED START: default to the app-language-observing shared Localize
54
48
  _localize = StateObject(wrappedValue: localize ?? Localize.shared)
55
- // AI-GENERATED END: default to the app-language-observing shared Localize
56
49
  self.composeApi = composeApi
57
50
  self.maxApi = maxApi
58
51
  self.initialTheme = initialTheme
@@ -91,7 +84,6 @@ public struct NavigationContainer<Initial: View>: View {
91
84
  setNavigator?(navigator)
92
85
  // Idempotent, so a re-appear won't double-count.
93
86
  HostBackGestureBridge.shared.attach(navigator)
94
- // AI-GENERATED START: demote the MaxApi language pull to a seed of last resort
95
87
  // Only a seed: a Localize with a language source already tracks the host in both
96
88
  // directions, so asking maxApi would just race it. `changeLanguage` normalizes the
97
89
  // raw response and hops to main itself.
@@ -99,7 +91,6 @@ public struct NavigationContainer<Initial: View>: View {
99
91
  maxApi?.getLanguage { data in
100
92
  localize.changeLanguage(data?["response"] as? String)
101
93
  }
102
- // AI-GENERATED END: demote the MaxApi language pull to a seed of last resort
103
94
  }
104
95
  .onDisappear {
105
96
  HostBackGestureBridge.shared.detach(navigator)
@@ -1,11 +1,6 @@
1
- //
2
- // Navigator.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/Navigator.kt`: Navigator, DynamicScreenRegistry and
6
- // the overplay model. Screens are registered by Int id; the stack paths store routes by id and
7
- // content is looked up from the registry on render.
8
- //
1
+ // SwiftUI mirror of Compose's `navigation/Navigator.kt`: Navigator, DynamicScreenRegistry and
2
+ // the overplay model. Screens are registered by Int id; the stack paths store routes by id and
3
+ // content is looked up from the registry on render.
9
4
 
10
5
  import SwiftUI
11
6
  import Combine
@@ -124,15 +119,12 @@ public final class Navigator: ObservableObject {
124
119
  }
125
120
  @Published public var overplay: OverplayItem?
126
121
 
127
- /// Owned per-Navigator (mirrors Compose's `remember { DynamicScreenRegistry() }` +
128
- /// disposal): screens registered by this navigator are released via ARC when the
129
- /// navigator itself deallocates, instead of accumulating in a process-wide singleton.
122
+ /// Per navigator, as Compose's `remember { DynamicScreenRegistry() }`: its screens go with
123
+ /// the navigator instead of piling up in a process-wide singleton.
130
124
  public let registry = DynamicScreenRegistry()
131
125
 
132
- /// Animated-close handler registered by the active overplay component
133
- /// (mirrors Compose's `OverplayComponentRegistry.bindClose`). When set, a
134
- /// dismiss request runs the component's exit animation before the item is
135
- /// actually removed via `finishOverplayDismiss`.
126
+ /// Exit animation of the active overplay (Compose's `OverplayComponentRegistry.bindClose`);
127
+ /// the component calls `finishOverplayDismiss` once it has played.
136
128
  private var overplayDismissHandler: (() -> Void)?
137
129
 
138
130
  public var rootRoute: DynamicScreenRoute { DynamicScreenRoute(id: entries[0].id) }
@@ -224,10 +216,9 @@ public final class Navigator: ObservableObject {
224
216
  popStep(remaining: count, callback: callback)
225
217
  }
226
218
 
227
- /// One `pop` iteration. Compose runs the loop in a coroutine and suspends over the
228
- /// overplay's exit animation before the next step; the same wait is needed here, or
229
- /// a `pop(2)` (prevent-back: close the popup, then leave) would spend both steps on
230
- /// the overplay that is still animating out and never pop the screen.
219
+ /// One `pop` iteration. Like Compose's coroutine loop it waits out the overplay's exit
220
+ /// animation, or a `pop(2)` (prevent-back: close the popup, then leave) would spend both
221
+ /// steps on the closing overplay and never pop the screen.
231
222
  private func popStep(remaining: Int, callback: (() -> Void)?) {
232
223
  guard remaining > 0 else {
233
224
  callback?()
@@ -235,9 +226,8 @@ public final class Navigator: ObservableObject {
235
226
  }
236
227
 
237
228
  if overplay?.type == .snackBar {
238
- // Mirrors Kotlin: a snackbar doesn't block back-navigation, so popping
239
- // while one is showing pops the screen underneath and clears the
240
- // snackbar immediately, without playing its dismiss animation.
229
+ // As in Compose, a snack bar doesn't block back: the screen under it pops and the
230
+ // snack bar clears without its exit animation.
241
231
  replaceOverplay(with: nil)
242
232
  guard popScreen() else {
243
233
  callback?()
@@ -316,7 +306,7 @@ public final class Navigator: ObservableObject {
316
306
  return
317
307
  }
318
308
  if let preventBack = latest?.options?.headerBackProps?.preventBack {
319
- // stored in `overplay`, so a strong self would cycle until the popup closes
309
+ // Stored in `overplay`, so a strong self would cycle until the popup closes.
320
310
  showModal { [weak self] in
321
311
  PopupNotify(
322
312
  props: PopupNotifyProps(
@@ -477,9 +467,8 @@ public final class Navigator: ObservableObject {
477
467
  overplayDismissHandler = handler
478
468
  }
479
469
 
480
- /// Removes the overplay and fires its `onDismiss` (mirrors Compose's
481
- /// `hardClearAfterDismiss`). Called by a component once its exit animation
482
- /// has completed.
470
+ /// Removes the overplay and fires its `onDismiss` (Compose's `hardClearAfterDismiss`);
471
+ /// called by the component once its exit animation has played.
483
472
  public func finishOverplayDismiss() {
484
473
  replaceOverplay(with: nil)
485
474
  }
@@ -502,7 +491,6 @@ public final class Navigator: ObservableObject {
502
491
 
503
492
  public func hideOverplay() {
504
493
  if let close = overplayDismissHandler {
505
- // Component runs its exit animation, then calls finishOverplayDismiss.
506
494
  overplayDismissHandler = nil
507
495
  close()
508
496
  } else {