@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
- // 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
 
@@ -1,12 +1,3 @@
1
- //
2
- // PaginationDot.swift
3
- // MoMoUIKits
4
- //
5
- // Native SwiftUI port of Compose's PaginationDot.
6
- // An active dot is a 12x4 pill in `activeColor`; inactive dots are 4x4
7
- // rounded squares in the pressed-background token.
8
- //
9
-
10
1
  import SwiftUI
11
2
 
12
3
  // MARK: - Dot
@@ -1,11 +1,3 @@
1
- //
2
- // PaginationNumber.swift
3
- // MoMoUIKits
4
- //
5
- // Native SwiftUI port of Compose's PaginationNumber.
6
- // Renders "current/total" text on a translucent black rounded chip.
7
- //
8
-
9
1
  import SwiftUI
10
2
 
11
3
  // MARK: - PaginationNumber
@@ -29,7 +21,7 @@ public struct PaginationNumber: View {
29
21
  .padding(.horizontal, Spacing.S)
30
22
  .background(
31
23
  RoundedRectangle(cornerRadius: Radius.L)
32
- .fill(Color.black.opacity(0.2)) // Color(0x33000000)
24
+ .fill(Colors.opacityBlack20)
33
25
  )
34
26
  }
35
27
  }
@@ -1,12 +1,3 @@
1
- //
2
- // PaginationScroll.swift
3
- // MoMoUIKits
4
- //
5
- // Native SwiftUI port of Compose's PaginationScroll.
6
- // Wraps arbitrary horizontally-scrollable content and renders a
7
- // progress-bar style indicator whose position tracks the scroll offset.
8
- //
9
-
10
1
  import SwiftUI
11
2
 
12
3
  // MARK: - Constants
@@ -22,10 +13,8 @@ private func calculateOffset(currentPosition: CGFloat, maxBound: CGFloat) -> CGF
22
13
 
23
14
  // MARK: - PaginationScroll
24
15
 
25
- /// Mirrors Compose's `PaginationScroll(modifier, content)`.
26
- ///
27
- /// The trailing-closure `content` is laid out in a horizontal scroll view and
28
- /// the indicator below reflects the current scroll progress.
16
+ /// Mirrors Compose's `PaginationScroll(modifier, content)`: horizontal scroll content with a
17
+ /// progress indicator below that tracks the scroll offset.
29
18
  public struct PaginationScroll<Content: View>: View {
30
19
  @Environment(\.appTheme) private var theme
31
20
 
@@ -76,7 +65,6 @@ public struct PaginationScroll<Content: View>: View {
76
65
  .onPreferenceChange(ScrollOffsetKey.self) { scrollOffset = max($0, 0) }
77
66
  .padding(.bottom, Spacing.L)
78
67
 
79
- // Progress indicator
80
68
  ZStack(alignment: .leading) {
81
69
  RoundedRectangle(cornerRadius: Spacing.XS)
82
70
  .fill(theme.colors.background.pressed)
@@ -1,12 +1,3 @@
1
- //
2
- // PaginationWhiteDot.swift
3
- // MoMoUIKits
4
- //
5
- // Native SwiftUI port of Compose's PaginationWhiteDot.
6
- // Same dot layout as PaginationDot, but the active color is white
7
- // (black_01) and the row sits on a translucent black rounded surface.
8
- //
9
-
10
1
  import SwiftUI
11
2
 
12
3
  // MARK: - PaginationWhiteDot
@@ -31,7 +22,7 @@ public struct PaginationWhiteDot: View {
31
22
  .padding(Spacing.XS)
32
23
  .background(
33
24
  RoundedRectangle(cornerRadius: Radius.S)
34
- .fill(Color.black.opacity(0.2)) // Color(0x33000000)
25
+ .fill(Colors.opacityBlack20)
35
26
  )
36
27
  }
37
28
  }
@@ -108,7 +108,7 @@ public struct PopupDisplay: View {
108
108
  }
109
109
  .fixedSize(horizontal: false, vertical: true)
110
110
  .background(theme.colors.background.surface)
111
- .clipShape(RoundedRectangle(cornerRadius: layout.popupRadius()))
111
+ .clipShape(RoundedRectangle(cornerRadius: layout.popupRadius))
112
112
 
113
113
  if isShowCloseIcon {
114
114
  ModalIconButton(icon: "navigation_close", accessibilityId: "ic_popup_close", action: onClose)
@@ -116,8 +116,8 @@ public struct PopupDisplay: View {
116
116
  .padding(.trailing, Spacing.M)
117
117
  }
118
118
  }
119
- .frame(maxWidth: layout.popupMaxWidth)
120
- .padding(.horizontal, layout.popupHorizontalPadding(12))
119
+ // window minus 24 a side on phones too, host padding included (PopupNotify parity)
120
+ .frame(maxWidth: layout.modalLayout.popup.maxWidth)
121
121
  .accessibilityElement(children: .contain)
122
122
  .accessibilityIdentifier("popup_notify")
123
123
  }
@@ -61,7 +61,7 @@ public struct PopupInput: View {
61
61
  .padding(.trailing, Spacing.M)
62
62
  }
63
63
  }
64
- .background(theme.colors.background.surface.cornerRadius(layout.popupRadius(8)))
64
+ .background(theme.colors.background.surface.cornerRadius(layout.popupRadius))
65
65
  .shadow(color: .black.opacity(0.08), radius: 2, x: 0, y: 0)
66
66
  .shadow(color: .black.opacity(0.16), radius: 24, x: 0, y: 0)
67
67
  .frame(maxWidth: layout.popupMaxWidth)
@@ -19,9 +19,9 @@ extension ScreenLayout {
19
19
  modalLayout.popup.maxHeight
20
20
  }
21
21
 
22
- func popupRadius(_ regular: CGFloat = Radius.L) -> CGFloat {
23
- let modal = modalLayout
24
- return modal.isFoldable ? modal.popup.radius : regular
22
+ /// Popup corner radius on every device (`modalLayout`, Compose `popupRadius`).
23
+ var popupRadius: CGFloat {
24
+ modalLayout.popup.radius
25
25
  }
26
26
  }
27
27
 
@@ -1,10 +1,9 @@
1
-
2
1
  import Foundation
3
2
  import SwiftUI
4
3
 
5
4
  public struct FullscreenPopup<Item: Equatable, PopupContent: View>: ViewModifier {
6
5
 
7
- // MARK: - Presentaion
6
+ // MARK: - Presentation
8
7
  @Binding var isPresented: Bool
9
8
  @Binding var item: Item?
10
9
 
@@ -56,7 +55,7 @@ public struct FullscreenPopup<Item: Equatable, PopupContent: View>: ViewModifier
56
55
  @State private var dispatchWorkHolder = DispatchWorkHolder()
57
56
 
58
57
  // MARK: - Internal
59
- /// Set dismiss souce to pass to dismiss callback
58
+ /// Set dismiss source to pass to dismiss callback
60
59
  @State private var dismissSource: DismissSource?
61
60
 
62
61
  init(isPresented: Binding<Bool>,
@@ -190,7 +189,7 @@ public struct FullscreenPopup<Item: Equatable, PopupContent: View>: ViewModifier
190
189
  showContent = true // immediately load popup body
191
190
  performWithDelay(0.01) {
192
191
  shouldShowContent = true // this will cause currentOffset change thus triggering the sliding showing animation
193
- opacity = 1 // this will cause cross disolving animation for background color
192
+ opacity = 1 // this will cause cross dissolving animation for background color
194
193
  setupAutohide()
195
194
  }
196
195
  } else {
@@ -1,7 +1,7 @@
1
1
  import SwiftUI
2
2
 
3
3
  public enum DismissSource {
4
- case binding // set isPresented to false ot item to nil
4
+ case binding // set isPresented to false or item to nil
5
5
  case tapInside
6
6
  case tapOutside
7
7
  case drag
@@ -140,7 +140,7 @@ public struct Popup<Item: Equatable, PopupContent: View>: ViewModifier {
140
140
  /// is called on any close action
141
141
  var dismissCallback: (DismissSource) -> ()
142
142
 
143
- /// Set dismiss souce to pass to dismiss callback
143
+ /// Set dismiss source to pass to dismiss callback
144
144
  @Binding private var dismissSource: DismissSource?
145
145
 
146
146
  /// called on showing/hiding sliding animation completed
@@ -128,7 +128,7 @@ struct AnimatableModifierDouble: AnimatableModifier {
128
128
  // Set animatableData to the new value. But SwiftUI again directly
129
129
  // and gradually varies the value while the body
130
130
  // is being called to animate. Following line serves the purpose of
131
- // associating the extenal argument with the animatableData.
131
+ // associating the external argument with the animatableData.
132
132
  self.animatableData = bindedValue
133
133
  targetValue = bindedValue
134
134
  AnimatableModifierDouble.done = false
@@ -139,7 +139,6 @@ struct AnimatableModifierDouble: AnimatableModifier {
139
139
  let delta = 0.1
140
140
  if animatableData > targetValue - delta &&
141
141
  animatableData < targetValue + delta {
142
- //print("check", animatableData, targetValue)
143
142
  AnimatableModifierDouble.done = true
144
143
  DispatchQueue.main.async {
145
144
  self.completion()
@@ -27,19 +27,8 @@ public enum ProgressInfoAlign {
27
27
 
28
28
  // MARK: - Public entry-point
29
29
 
30
- /// Display-only step progress indicator.
31
- ///
32
- /// - Parameters:
33
- /// - steps: Ordered list of steps; each has a title and an optional description.
34
- /// - horizontal: When `true` renders steps in a horizontal row with connector lines;
35
- /// when `false` (default) renders a vertical column.
36
- /// - size: Icon diameter: `.small` = 16, `.large` = 24 (default).
37
- /// - useNumber: Show the 1-based step index inside the icon instead of the default dot.
38
- /// - align: Alignment of icon + text for the horizontal variant.
39
- /// - showTitle: Whether step titles are rendered (default `true`).
40
- /// - showDescription: Whether step descriptions are rendered (default `true`).
41
- /// - customIcon: Icon source key rendered inside each step circle (overrides the dot;
42
- /// itself overridden by `useNumber`).
30
+ /// Display-only step progress. Each step icon shows the 1-based index with `useNumber`, else
31
+ /// `customIcon`, else a dot; `align` applies to the horizontal variant only.
43
32
  public struct ProgressInfo: View {
44
33
  private let steps: [ProgressInfoItem]
45
34
  private let horizontal: Bool
@@ -1,14 +1,8 @@
1
1
  import Foundation
2
2
  import SwiftUI
3
3
 
4
- /// Native SwiftUI port of the Compose `Skeleton` component.
5
- ///
6
- /// Fills the available space with a base placeholder color and overlays a
7
- /// horizontal shimmer gradient that animates left-to-right on an infinite loop.
8
- ///
9
- /// Mirrors the Compose surface: `Skeleton()` takes no required arguments and
10
- /// fills its container. The shimmer animation parameters match the Compose
11
- /// defaults (`durationMillis = 1000`, shimmer band = 60% of container width).
4
+ /// Compose `Skeleton`: fills its container with a placeholder color under a shimmer band
5
+ /// that loops left to right, with Compose's defaults (1000ms, band 60% of the width).
12
6
  public struct Skeleton: View {
13
7
  // Matches Compose `DEFAULT_DURATION_MILLIS = 1000`.
14
8
  private let durationMillis: Int
@@ -31,7 +25,6 @@ public struct Skeleton: View {
31
25
  angleOfAxisY: angleOfAxisY
32
26
  )
33
27
  }
34
- // Compose base background (`Colors.black_05`).
35
28
  .background(Colors.black05)
36
29
  }
37
30
  }
@@ -47,7 +40,6 @@ private struct ShimmerLoading: View {
47
40
  // Matches Compose `SHADOW_BRUSH_PERCENTAGE = 0.6f`.
48
41
  private static let shadowBrushPercentage: CGFloat = 0.6
49
42
 
50
- // Pre-computed shimmer colors (Colors.black_05, black_03, black_05).
51
43
  private static let shimmerColors: [Color] = [
52
44
  Colors.black05,
53
45
  Colors.black03,
@@ -1,13 +1,13 @@
1
1
  import SwiftUI
2
2
 
3
- // ── Design constants ─────────────────────────────────────────────────────────
3
+ // MARK: - Constants
4
4
 
5
5
  private let THUMB_SIZE: CGFloat = 20
6
6
  private let THUMB_BORDER: CGFloat = 3
7
7
  private let TRACK_HEIGHT: CGFloat = 4
8
8
  private let LABEL_GAP: CGFloat = 4 // space between label and thumb top (Spacing.XS)
9
9
 
10
- // ── Pure helpers (mirrors Compose / RN helpers) ──────────────────────────────
10
+ // MARK: - Helpers (Compose / RN parity)
11
11
 
12
12
  private func clampF(_ value: CGFloat, _ minV: CGFloat, _ maxV: CGFloat) -> CGFloat {
13
13
  Swift.min(Swift.max(value, minV), maxV)
@@ -55,12 +55,10 @@ private func formatLabel(_ value: CGFloat) -> String {
55
55
  return String(Double((value * 10).rounded(.towardZero)) / 10)
56
56
  }
57
57
 
58
- // ── Component ─────────────────────────────────────────────────────────────────
58
+ // MARK: - MomoSlider
59
59
 
60
- /// Range slider (or single-thumb when `disableRange` = true), ported from Compose.
61
- ///
62
- /// SwiftUI ships a built-in `Slider`; this custom type is named `MomoSlider`
63
- /// (convention, like `MomoText`) to avoid module-wide shadowing.
60
+ /// Compose range slider (one thumb with `disableRange`), named `MomoSlider` like `MomoText`
61
+ /// to avoid shadowing SwiftUI's `Slider`.
64
62
  public struct MomoSlider: View {
65
63
  @Environment(\.appTheme) private var theme
66
64
 
@@ -130,7 +128,6 @@ public struct MomoSlider: View {
130
128
  let activeWidth = availableWidth * (activeEndFraction - activeStartFraction)
131
129
 
132
130
  ZStack(alignment: .topLeading) {
133
- // ── Floating label ────────────────────────────────────────────
134
131
  if floatingLabel && isDragging {
135
132
  let activeFraction = draggingLow ? lowFraction : highFraction
136
133
  let activeValue = draggingLow ? lowValue : highValue
@@ -142,13 +139,11 @@ public struct MomoSlider: View {
142
139
  .offset(x: availableWidth * activeFraction, y: 0)
143
140
  }
144
141
 
145
- // ── Inactive track (full width) ───────────────────────────────
146
142
  Capsule()
147
143
  .fill(trackInactiveColor)
148
144
  .frame(width: max(trackWidth - THUMB_SIZE, 0), height: TRACK_HEIGHT)
149
145
  .offset(x: THUMB_SIZE / 2, y: topPad + (THUMB_SIZE - TRACK_HEIGHT) / 2)
150
146
 
151
- // ── Active track (selected range / single value) ──────────────
152
147
  if activeWidth > 0 {
153
148
  Capsule()
154
149
  .fill(trackActiveColor)
@@ -156,11 +151,9 @@ public struct MomoSlider: View {
156
151
  .offset(x: activeStartX, y: topPad + (THUMB_SIZE - TRACK_HEIGHT) / 2)
157
152
  }
158
153
 
159
- // ── Low thumb ─────────────────────────────────────────────────
160
154
  thumb
161
155
  .offset(x: availableWidth * lowFraction, y: topPad)
162
156
 
163
- // ── High thumb (range mode only) ──────────────────────────────
164
157
  if !disableRange {
165
158
  thumb
166
159
  .offset(x: availableWidth * highFraction, y: topPad)
@@ -2,9 +2,8 @@
2
2
 
3
3
  NS_ASSUME_NONNULL_BEGIN
4
4
 
5
- /// Posts `MoMoStatusBarTap.notificationName` on every status-bar tap.
6
- /// The swizzle installs automatically at framework load (`+load`) — calling
7
- /// `install` is a no-op kept for explicit/manual triggering.
5
+ /// Posts `MoMoStatusBarTap.notificationName` on every status-bar tap once `install` has run.
6
+ /// Opt-in: there is no `+load` auto-install; `install` is idempotent.
8
7
  @interface MoMoStatusBarTap : NSObject
9
8
  @property (class, nonatomic, readonly) NSNotificationName notificationName;
10
9
  + (void)install;
@@ -3,7 +3,6 @@
3
3
  #import <objc/runtime.h>
4
4
  #import "StatusBarTap.h"
5
5
 
6
- // Performs the actual swizzle once per process. Safe to call multiple times.
7
6
  static void mm_installStatusBarTapSwizzleOnce(void) {
8
7
  static dispatch_once_t onceToken;
9
8
  dispatch_once(&onceToken, ^{
@@ -15,9 +14,7 @@ static void mm_installStatusBarTapSwizzleOnce(void) {
15
14
  Method swizzledMethod = class_getInstanceMethod(cls, swizzledSelector);
16
15
  if (!originalMethod || !swizzledMethod) return;
17
16
 
18
- // Verify the original method matches the (id) -> void shape we expect.
19
- // Encoding may include byte offsets (e.g. "v32@0:8@16") so we filter
20
- // digits out before comparing.
17
+ // Bail unless the original is (id) -> void; the encoding carries byte offsets ("v32@0:8@16").
21
18
  const char *encPtr = method_getTypeEncoding(originalMethod);
22
19
  if (encPtr) {
23
20
  NSMutableString *enc = [NSMutableString string];
@@ -48,24 +45,14 @@ static void mm_installStatusBarTapSwizzleOnce(void) {
48
45
  @end
49
46
 
50
47
  // MARK: - Swizzle target on UIStatusBarManager
51
- // `mm_handleTapAction:` is the replacement IMP. After the add/exchange,
52
- // this selector points at the original UIKit IMP — calling it inside
53
- // the body invokes UIKit's real handler so UIScrollView.scrollsToTop
54
- // and any other side effects continue to work.
48
+ // After the swizzle `mm_handleTapAction:` points at UIKit's original IMP, so calling it runs the
49
+ // real handler (UIScrollView.scrollsToTop and other side effects) before posting.
55
50
 
56
51
  @interface UIStatusBarManager (MoMoStatusBarTap)
57
52
  @end
58
53
 
59
54
  @implementation UIStatusBarManager (MoMoStatusBarTap)
60
55
 
61
- // Auto-install at framework load. Commented out so the swizzle stays
62
- // opt-in via `[MoMoStatusBarTap install]`. Uncomment to revert to
63
- // auto-installation before main().
64
- //
65
- // + (void)load {
66
- // mm_installStatusBarTapSwizzleOnce();
67
- // }
68
-
69
56
  - (void)mm_handleTapAction:(id)action {
70
57
  [self mm_handleTapAction:action];
71
58
  [[NSNotificationCenter defaultCenter] postNotificationName:MoMoStatusBarTap.notificationName
@@ -1,8 +1,6 @@
1
1
  import SwiftUI
2
2
 
3
- // ---------------------------------------------------------------------------
4
- // Size variant
5
- // ---------------------------------------------------------------------------
3
+ // MARK: - Size
6
4
 
7
5
  public enum StepperSize {
8
6
  case large
@@ -25,10 +23,9 @@ private func stepperSizeSpec(_ size: StepperSize) -> StepperSizeSpec {
25
23
  }
26
24
  }
27
25
 
28
- // ---------------------------------------------------------------------------
29
- // Disabled spec — mirrors Compose `disabled: Any` (Bool or per-part array)
30
- // ---------------------------------------------------------------------------
26
+ // MARK: - Disabled
31
27
 
28
+ /// Compose's `disabled: Any`: one Bool for every part, or per part.
32
29
  public struct StepperDisabled {
33
30
  let minus: Bool
34
31
  let plus: Bool
@@ -40,7 +37,6 @@ public struct StepperDisabled {
40
37
  self.plus = plus
41
38
  }
42
39
 
43
- /// All parts share the same disabled state.
44
40
  public init(_ all: Bool) {
45
41
  self.minus = all
46
42
  self.plus = all
@@ -53,9 +49,7 @@ extension StepperDisabled: ExpressibleByBooleanLiteral {
53
49
  }
54
50
  }
55
51
 
56
- // ---------------------------------------------------------------------------
57
- // Private sub-views
58
- // ---------------------------------------------------------------------------
52
+ // MARK: - Sub-views
59
53
 
60
54
  private struct StepperButton: View {
61
55
  @Environment(\.appTheme) private var theme
@@ -119,23 +113,10 @@ private struct StepperNumberView: View {
119
113
  }
120
114
  }
121
115
 
122
- // ---------------------------------------------------------------------------
123
- // Public API — MomoStepper
124
- // ---------------------------------------------------------------------------
125
-
126
- /// MomoStepper — quantity +/- control. Layout: [- button] [value] [+ button].
127
- ///
128
- /// Named `MomoStepper` to avoid shadowing SwiftUI's built-in `Stepper`.
129
- ///
130
- /// - Parameters:
131
- /// - value: Binding to the current value. Clamped to `min...max`.
132
- /// - min: Minimum allowed value (default 0). Minus auto-disables at this bound.
133
- /// - max: Maximum allowed value (default 100). Plus auto-disables at this bound.
134
- /// - step: Amount added/subtracted per press (default 1).
135
- /// - size: Visual size variant (default `.large`).
136
- /// - disabled: Disable state — `true` for everything, or `StepperDisabled(minus:plus:)`.
137
- /// - editable: When `true` the number display becomes a keyboard input (default false).
138
- /// - onValueChange: Callback invoked with the new value on every change.
116
+ // MARK: - MomoStepper
117
+
118
+ /// Quantity +/- control, named `MomoStepper` to avoid shadowing SwiftUI's `Stepper`.
119
+ /// `value` is clamped to `min...max`; each button disables itself at its bound.
139
120
  public struct MomoStepper: View {
140
121
  @Binding private var value: Int
141
122
  private let min: Int