@momo-kits/native-kits 0.169.6 → 0.169.7

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 (91) hide show
  1. package/ios/Application/ApplicationEnvironment.swift +2 -3
  2. package/ios/Application/DesignSystemKits.swift +4 -20
  3. package/ios/Application/DesignSystemKitsPayload.swift +0 -8
  4. package/ios/Application/LanguageSource.swift +0 -8
  5. package/ios/Application/Localize.swift +7 -31
  6. package/ios/Application/LocalizeModifier.swift +0 -8
  7. package/ios/Application/MaxApi.swift +3 -11
  8. package/ios/Avatar/Avatar.swift +0 -1
  9. package/ios/Badge/Badge.swift +0 -1
  10. package/ios/Badge/BadgeRibbon.swift +2 -5
  11. package/ios/Button/Button.swift +2 -5
  12. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +2 -2
  13. package/ios/Carousel/Carousel.swift +5 -17
  14. package/ios/Checkbox/Checkbox.swift +0 -2
  15. package/ios/Colors+Radius+Spacing/Theme.swift +0 -7
  16. package/ios/DateTimePicker/DateTimePicker.swift +4 -10
  17. package/ios/DateTimePicker/DateTimePickerTypes.swift +1 -3
  18. package/ios/DateTimePicker/DateTimePickerUtils.swift +0 -3
  19. package/ios/DateTimePicker/WheelPicker.swift +2 -4
  20. package/ios/Extensions/SkeletonUICompat.swift +0 -8
  21. package/ios/Icon/Icon.swift +1 -3
  22. package/ios/IconButton/IconButton.swift +0 -2
  23. package/ios/Input/ErrorView.swift +0 -7
  24. package/ios/Input/Input.swift +6 -19
  25. package/ios/Input/InputPhoneNumber.swift +0 -11
  26. package/ios/Input/InputSearch.swift +0 -6
  27. package/ios/Input/InputTextArea.swift +1 -12
  28. package/ios/InputDropDown/InputDropDown.swift +1 -11
  29. package/ios/InputMoney/InputMoney.swift +9 -28
  30. package/ios/InputOTP/InputOTP.swift +2 -9
  31. package/ios/Layout/Item.swift +1 -2
  32. package/ios/Layout/ModalLayout.swift +7 -14
  33. package/ios/Layout/ScreenLayout.swift +2 -7
  34. package/ios/Loader/Loader.swift +3 -12
  35. package/ios/Lottie/LottieView.swift +0 -11
  36. package/ios/Navigation/BottomSheet.swift +14 -35
  37. package/ios/Navigation/BottomTab/BottomTab.swift +10 -19
  38. package/ios/Navigation/BottomTab/BottomTabBar.swift +4 -10
  39. package/ios/Navigation/BottomTab/CurvedContainer.swift +5 -11
  40. package/ios/Navigation/BottomTab/DuoBarCompression.swift +6 -12
  41. package/ios/Navigation/BottomTab/DuoTabBar.swift +2 -7
  42. package/ios/Navigation/BottomTab/TabBarMetrics.swift +3 -9
  43. package/ios/Navigation/Component/FloatingButton.swift +4 -11
  44. package/ios/Navigation/Component/Header.swift +4 -8
  45. package/ios/Navigation/Component/HeaderBackground.swift +2 -8
  46. package/ios/Navigation/Component/HeaderJourney.swift +2 -7
  47. package/ios/Navigation/Component/HeaderLocation.swift +2 -7
  48. package/ios/Navigation/Component/HeaderRight.swift +2 -7
  49. package/ios/Navigation/Component/HeaderTitle.swift +1 -6
  50. package/ios/Navigation/Component/HeaderUser.swift +2 -9
  51. package/ios/Navigation/Component/SideBar.swift +3 -8
  52. package/ios/Navigation/Component/SnackBar.swift +5 -13
  53. package/ios/Navigation/HostBackGestureBridge.swift +3 -9
  54. package/ios/Navigation/ModalScreen.swift +2 -8
  55. package/ios/Navigation/Navigation.swift +2 -15
  56. package/ios/Navigation/NavigationContainer.swift +3 -12
  57. package/ios/Navigation/Navigator.swift +15 -27
  58. package/ios/Navigation/StackScreen.swift +8 -28
  59. package/ios/Navigation/StackTransition.swift +3 -11
  60. package/ios/Navigation/SwipeBackHaptic.swift +2 -7
  61. package/ios/Navigation/Tracking/ScreenTracker.swift +2 -7
  62. package/ios/Pagination/PaginationDot.swift +0 -9
  63. package/ios/Pagination/PaginationNumber.swift +1 -9
  64. package/ios/Pagination/PaginationScroll.swift +2 -14
  65. package/ios/Pagination/PaginationWhiteDot.swift +1 -10
  66. package/ios/Popup/PopupDisplay.swift +3 -3
  67. package/ios/Popup/PopupInput.swift +1 -1
  68. package/ios/Popup/PopupLayout.swift +3 -3
  69. package/ios/PopupView/FullscreenPopup.swift +3 -4
  70. package/ios/PopupView/PopupView.swift +2 -2
  71. package/ios/PopupView/Utils++.swift +1 -2
  72. package/ios/ProgressInfo/ProgressInfo.swift +2 -13
  73. package/ios/Skeleton/Skeleton.swift +2 -10
  74. package/ios/Slider/Slider.swift +5 -12
  75. package/ios/StatusBarTap/StatusBarTap.h +2 -3
  76. package/ios/StatusBarTap/StatusBarTap.m +3 -16
  77. package/ios/Stepper/Stepper.swift +8 -27
  78. package/ios/Steps/Steps.swift +9 -11
  79. package/ios/Swipeable/SwipeCell.swift +2 -2
  80. package/ios/Swipeable/SwipeCellModel.swift +3 -6
  81. package/ios/TabView/TabView.swift +12 -25
  82. package/ios/Template/TrustBanner/TrustBanner.swift +2 -9
  83. package/ios/Tooltip/Tooltip.swift +2 -7
  84. package/ios/Typography/FontScale.swift +3 -15
  85. package/ios/Typography/Text.swift +2 -7
  86. package/ios/Typography/Typography.swift +8 -10
  87. package/ios/Uploader/Uploader.swift +2 -17
  88. package/ios/native-kits.podspec +1 -1
  89. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  90. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +0 -8
  91. package/package.json +1 -1
@@ -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 {
@@ -1,11 +1,6 @@
1
- //
2
- // StackScreen.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/StackScreen.kt`: header layer, scrollable content
6
- // (`StackScreenContent`), animated search, floating button, footer (`NavigationFooter`) and the
7
- // iPhone Duo side bar.
8
- //
1
+ // SwiftUI mirror of Compose's `navigation/StackScreen.kt`: header layer, scrollable content
2
+ // (`StackScreenContent`), animated search, floating button, footer (`NavigationFooter`) and the
3
+ // iPhone Duo side bar.
9
4
 
10
5
  import SwiftUI
11
6
 
@@ -13,9 +8,7 @@ public struct StackScreen<Content: View>: View {
13
8
  // MARK: - Properties
14
9
 
15
10
  var backgroundColor: Color?
16
- // AI-GENERATED START: custom screen background view (Compose backgroundComponent)
17
11
  var background: (() -> AnyView)?
18
- // AI-GENERATED END: custom screen background view (Compose backgroundComponent)
19
12
  var headerTransparent: Bool = false
20
13
  var fullScreenContent: Bool = false
21
14
  var tintColor: Color? = Colors.black17
@@ -46,9 +39,7 @@ public struct StackScreen<Content: View>: View {
46
39
 
47
40
  public init(
48
41
  backgroundColor: Color? = nil,
49
- // AI-GENERATED START: custom screen background view (Compose backgroundComponent)
50
42
  background: (() -> AnyView)? = nil,
51
- // AI-GENERATED END: custom screen background view (Compose backgroundComponent)
52
43
  headerTransparent: Bool = false,
53
44
  fullScreenContent: Bool = false,
54
45
  tintColor: Color = Colors.black17,
@@ -78,9 +69,7 @@ public struct StackScreen<Content: View>: View {
78
69
  @ViewBuilder content: @escaping () -> Content
79
70
  ) {
80
71
  self.backgroundColor = backgroundColor
81
- // AI-GENERATED START: custom screen background view (Compose backgroundComponent)
82
72
  self.background = background
83
- // AI-GENERATED END: custom screen background view (Compose backgroundComponent)
84
73
  self.headerTransparent = headerTransparent
85
74
  self.fullScreenContent = fullScreenContent
86
75
  self.tintColor = tintColor
@@ -245,7 +234,6 @@ public struct StackScreen<Content: View>: View {
245
234
  public var body: some View {
246
235
  GeometryReader { _ in
247
236
  ZStack(alignment: .top) {
248
- // AI-GENERATED START: custom screen background view (Compose backgroundComponent)
249
237
  Group {
250
238
  if let background {
251
239
  background()
@@ -254,7 +242,6 @@ public struct StackScreen<Content: View>: View {
254
242
  }
255
243
  }
256
244
  .edgesIgnoringSafeArea(.all)
257
- // AI-GENERATED END: custom screen background view (Compose backgroundComponent)
258
245
 
259
246
  VStack(spacing: 0) {
260
247
  ZStack(alignment: fabProps?.position == .center ? .bottom : .bottomTrailing) {
@@ -853,15 +840,9 @@ public struct NavigationFooter: View {
853
840
  max(navigationBarInset + Spacing.S - safeAreaBottom, 0)
854
841
  }
855
842
 
856
- /// Deliberately an offset and not padding: growing the footer feeds back into SwiftUI's
857
- /// keyboard avoidance, so a padding-based lift never settles at the right place.
858
- /// Negative lifts the band over the keyboard; positive shaves the few points by which
859
- /// the safe area over-reserves compared to Compose. `FloatingContent` rides the same
860
- /// amount so the FAB keeps its distance above the band.
861
- ///
862
- /// Natural position is `safeAreaBottom + bottomPadding` above the bottom of the screen;
863
- /// Compose puts it at `(AppNavigationBar - keyboard).coerceAtLeast(0) + Spacing.S` on
864
- /// top of the `imePadding()` lift — i.e. `max(navigationBar, keyboard) + Spacing.S`.
843
+ /// An offset, not padding: growing the footer feeds back into SwiftUI's keyboard avoidance and
844
+ /// never settles. Lands at Compose's `max(navigationBar, keyboard) + Spacing.S` from the bottom;
845
+ /// `FloatingContent` rides the same amount so the FAB keeps its distance above the band.
865
846
  static func verticalOffset(keyboardSize: CGFloat) -> CGFloat {
866
847
  (safeAreaBottom + bottomPadding) - (max(navigationBarInset, keyboardSize) + Spacing.S)
867
848
  }
@@ -878,9 +859,8 @@ public struct NavigationFooter: View {
878
859
  // without the margin the Spacing.S under the content goes too: negative, so the
879
860
  // content sinks into the reserve while the frame keeps its bottom edge
880
861
  .padding(.bottom, Self.bottomPadding - (Spacing.S - margin))
881
- // Compose paints the surface all the way to the bottom of the screen; the
882
- // footer's own frame stops at the safe area, so only the fill bleeds down.
883
- // With side insets (iPhone Duo) it stays inside them, off the side bar.
862
+ // Compose paints the surface down to the screen bottom: only the fill bleeds past the
863
+ // safe area, and with side insets (iPhone Duo) it stays inside them, off the side bar.
884
864
  .background(
885
865
  (transparent ? Color.clear : theme.colors.background.surface)
886
866
  .ignoresSafeArea(.container, edges: hasSideInsets ? .bottom : [.bottom, .horizontal])
@@ -1,14 +1,6 @@
1
- //
2
- // StackTransition.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/StackTransition.kt` (a 1:1 port of the RN kit's
6
- // `forStackTransitionWithOverlay`) and of the NavHost it decorates. Every stack entry lives in
7
- // its own UIHostingController, kept while the entry is on the stack and taken out of the window
8
- // while covered, as UINavigationController does: a covered screen keeps its state, stops
9
- // rendering and gets onDisappear / onAppear. The motion itself is drawn in SwiftUI, because an
10
- // `offset` never moves the safe area the way a UIKit transform would.
11
- //
1
+ // SwiftUI mirror of Compose's `navigation/StackTransition.kt` (RN `forStackTransitionWithOverlay`)
2
+ // and its NavHost. Each entry has its own UIHostingController, out of the window while covered as
3
+ // with UINavigationController; motion is a SwiftUI `offset`, which unlike a transform keeps the safe area.
12
4
 
13
5
  import SwiftUI
14
6
  import UIKit
@@ -1,10 +1,5 @@
1
- //
2
- // SwipeBackHaptic.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/SwipeBackHaptic.kt`: one light tick when the host back
6
- // gesture has dragged the screen 50pt, re-armed once it goes back under.
7
- //
1
+ // SwiftUI mirror of Compose's `navigation/SwipeBackHaptic.kt`: one light tick when the host back
2
+ // gesture has dragged the screen 50pt, re-armed once it goes back under.
8
3
 
9
4
  import UIKit
10
5
 
@@ -1,10 +1,5 @@
1
- //
2
- // ScreenTracker.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/tracking/ScreenTracker.kt`. Pure
6
- // logic, no platform dependency beyond the `MaxApi` bridge.
7
- //
1
+ // SwiftUI mirror of Compose's `navigation/tracking/ScreenTracker.kt`. Pure
2
+ // logic, no platform dependency beyond the `MaxApi` bridge.
8
3
 
9
4
  import Foundation
10
5