@momo-kits/native-kits 0.300.7 → 0.300.8-beta.1-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 (256) hide show
  1. package/CLAUDE.md +12 -8
  2. package/README.md +8 -7
  3. package/build.gradle.kts +13 -0
  4. package/compose/build.gradle.kts +195 -0
  5. package/compose/build.gradle.kts.backup +195 -0
  6. package/compose/compose.podspec +47 -0
  7. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +19 -0
  8. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
  9. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +12 -0
  10. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
  11. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +154 -0
  12. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +17 -0
  13. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +6 -0
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +110 -0
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +61 -0
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/application/KitsBinding.kt +60 -0
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/application/KitsHost.kt +32 -0
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +1067 -0
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +268 -0
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +55 -0
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +81 -0
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +354 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +115 -0
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +130 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +482 -0
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +49 -0
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +86 -0
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +125 -0
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +224 -0
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +137 -0
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +473 -0
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +113 -0
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +262 -0
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +237 -0
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +228 -0
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +280 -0
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +183 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +342 -0
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +40 -0
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +82 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +39 -0
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +362 -0
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +108 -0
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +304 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +21 -0
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +88 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +308 -0
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +218 -0
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +456 -0
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +205 -0
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +89 -0
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +542 -0
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +86 -0
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +175 -0
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +201 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +498 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +176 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +208 -0
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +180 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +325 -0
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +12 -0
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +194 -0
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +291 -0
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +54 -0
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/HeaderLayout.kt +71 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +50 -0
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +184 -0
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +315 -0
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +41 -0
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +54 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +397 -0
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +58 -0
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +153 -0
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +118 -0
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +212 -0
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +422 -0
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +750 -0
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +152 -0
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +35 -0
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +244 -0
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +398 -0
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +103 -0
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +93 -0
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +208 -0
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +133 -0
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +167 -0
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +446 -0
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +105 -0
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +106 -0
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +74 -0
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +387 -0
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +39 -0
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +363 -0
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HelpCenterRequest.kt +33 -0
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +197 -0
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +133 -0
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/ToolkitRequests.kt +38 -0
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +135 -0
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +12 -0
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +114 -0
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +7 -0
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +76 -0
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +7 -0
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +21 -0
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +117 -0
  131. package/compose/src/commonTest/kotlin/vn/momo/kits/application/KitsHostTest.kt +44 -0
  132. package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/HelpCenterRequestTest.kt +39 -0
  133. package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/ToolkitRequestsTest.kt +53 -0
  134. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +42 -0
  135. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +45 -0
  136. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +31 -0
  137. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +38 -0
  138. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +65 -0
  139. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +217 -0
  140. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +48 -0
  141. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +143 -0
  142. package/gradle/libs.versions.toml +66 -0
  143. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  144. package/gradle/wrapper/gradle-wrapper.properties +8 -0
  145. package/gradle.properties +24 -0
  146. package/gradlew +252 -0
  147. package/gradlew.bat +94 -0
  148. package/ios/Application/ApplicationEnvironment.swift +6 -4
  149. package/ios/Application/DesignSystemKits.swift +59 -13
  150. package/ios/Application/DesignSystemKitsPayload.swift +0 -8
  151. package/ios/Application/LanguageSource.swift +2 -11
  152. package/ios/Application/Localize.swift +8 -35
  153. package/ios/Application/LocalizeModifier.swift +2 -11
  154. package/ios/Application/MaxApi.swift +3 -11
  155. package/ios/Avatar/Avatar.swift +0 -1
  156. package/ios/Badge/Badge.swift +5 -8
  157. package/ios/Badge/BadgeRibbon.swift +2 -5
  158. package/ios/Button/Button.swift +4 -8
  159. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +5 -7
  160. package/ios/Carousel/Carousel.swift +4 -17
  161. package/ios/Checkbox/Checkbox.swift +0 -2
  162. package/ios/Collapse/Collapse.swift +17 -11
  163. package/ios/Colors+Radius+Spacing/Theme.swift +0 -7
  164. package/ios/DateTimePicker/DateTimePicker.swift +4 -10
  165. package/ios/DateTimePicker/DateTimePickerTypes.swift +1 -3
  166. package/ios/DateTimePicker/DateTimePickerUtils.swift +0 -3
  167. package/ios/DateTimePicker/WheelPicker.swift +2 -4
  168. package/ios/Extensions/ActiveOpacityButtonStyle.swift +2 -3
  169. package/ios/Extensions/Color++.swift +2 -4
  170. package/ios/Extensions/SkeletonUICompat.swift +0 -8
  171. package/ios/Icon/Icon.swift +3 -6
  172. package/ios/IconButton/IconButton.swift +2 -5
  173. package/ios/Input/ErrorView.swift +0 -7
  174. package/ios/Input/Input.swift +9 -20
  175. package/ios/Input/InputPhoneNumber.swift +37 -20
  176. package/ios/Input/InputSearch.swift +23 -12
  177. package/ios/Input/InputTextArea.swift +4 -13
  178. package/ios/InputDropDown/InputDropDown.swift +1 -11
  179. package/ios/InputMoney/InputMoney.swift +9 -28
  180. package/ios/InputOTP/InputOTP.swift +2 -9
  181. package/ios/Layout/HeaderLayout.swift +72 -0
  182. package/ios/Layout/Item.swift +1 -2
  183. package/ios/Layout/ModalLayout.swift +144 -0
  184. package/ios/Layout/ScreenLayout.swift +48 -31
  185. package/ios/Layout/Section.swift +2 -3
  186. package/ios/Loader/Loader.swift +3 -12
  187. package/ios/Lottie/LottieView.swift +0 -11
  188. package/ios/Navigation/BottomSheet.swift +73 -94
  189. package/ios/Navigation/BottomTab/BottomTab.swift +58 -73
  190. package/ios/Navigation/BottomTab/BottomTabBar.swift +286 -121
  191. package/ios/Navigation/BottomTab/CurvedContainer.swift +52 -54
  192. package/ios/Navigation/BottomTab/DuoBarCompression.swift +5 -12
  193. package/ios/Navigation/BottomTab/DuoTabBar.swift +67 -202
  194. package/ios/Navigation/BottomTab/TabBarMetrics.swift +97 -0
  195. package/ios/Navigation/Component/FloatingButton.swift +4 -11
  196. package/ios/Navigation/Component/Header.swift +35 -54
  197. package/ios/Navigation/Component/HeaderBackground.swift +2 -8
  198. package/ios/Navigation/Component/HeaderJourney.swift +4 -8
  199. package/ios/Navigation/Component/HeaderLocation.swift +4 -8
  200. package/ios/Navigation/Component/HeaderRight.swift +20 -22
  201. package/ios/Navigation/Component/HeaderTitle.swift +1 -6
  202. package/ios/Navigation/Component/HeaderUser.swift +4 -10
  203. package/ios/Navigation/Component/SideBar.swift +6 -21
  204. package/ios/Navigation/Component/SnackBar.swift +9 -13
  205. package/ios/Navigation/HostBackGestureBridge.swift +2 -9
  206. package/ios/Navigation/ModalScreen.swift +24 -13
  207. package/ios/Navigation/Navigation.swift +35 -19
  208. package/ios/Navigation/NavigationContainer.swift +4 -15
  209. package/ios/Navigation/Navigator.swift +21 -39
  210. package/ios/Navigation/StackScreen.swift +64 -51
  211. package/ios/Navigation/StackTransition.swift +7 -14
  212. package/ios/Navigation/SwipeBackHaptic.swift +2 -7
  213. package/ios/Navigation/Tracking/ScreenTracker.swift +2 -7
  214. package/ios/Pagination/PaginationDot.swift +0 -9
  215. package/ios/Pagination/PaginationNumber.swift +1 -9
  216. package/ios/Pagination/PaginationScroll.swift +2 -14
  217. package/ios/Pagination/PaginationWhiteDot.swift +1 -10
  218. package/ios/Popup/PopupDisplay.swift +7 -5
  219. package/ios/Popup/PopupInput.swift +6 -4
  220. package/ios/Popup/PopupLayout.swift +17 -9
  221. package/ios/Popup/PopupNotify.swift +32 -25
  222. package/ios/PopupView/FullscreenPopup.swift +3 -4
  223. package/ios/PopupView/PopupView.swift +2 -2
  224. package/ios/PopupView/Utils++.swift +1 -2
  225. package/ios/ProgressInfo/ProgressInfo.swift +2 -13
  226. package/ios/Skeleton/Skeleton.swift +5 -16
  227. package/ios/Slider/Slider.swift +5 -12
  228. package/ios/StatusBarTap/StatusBarTap.h +2 -3
  229. package/ios/StatusBarTap/StatusBarTap.m +3 -16
  230. package/ios/Stepper/Stepper.swift +8 -27
  231. package/ios/Steps/Steps.swift +29 -26
  232. package/ios/Swipeable/SwipeCell.swift +2 -2
  233. package/ios/Swipeable/SwipeCellModel.swift +3 -6
  234. package/ios/TabView/TabView.swift +14 -28
  235. package/ios/Template/TrustBanner/TrustBanner.swift +2 -9
  236. package/ios/Title/Title.swift +1 -3
  237. package/ios/Tooltip/Tooltip.swift +4 -9
  238. package/ios/Typography/FontScale.swift +79 -24
  239. package/ios/Typography/Text.swift +6 -12
  240. package/ios/Typography/Typography.swift +8 -11
  241. package/ios/Uploader/Uploader.swift +2 -17
  242. package/ios-demo/README.md +120 -0
  243. package/ios-demo/Resources/tabbar_scan_qr_button.json +1 -0
  244. package/ios-demo/Resources/tabbar_scan_qr_label.json +1 -0
  245. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +11 -2
  246. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +296 -59
  247. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +15 -4
  248. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +0 -8
  249. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +114 -0
  250. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +29 -1
  251. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +16 -0
  252. package/package.json +1 -1
  253. package/publish.sh +8 -2
  254. package/scripts/ci/build-swiftui.sh +22 -0
  255. package/scripts/ci/resolve-version.mjs +144 -0
  256. package/settings.gradle.kts +63 -0
@@ -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
  }
@@ -70,6 +70,7 @@ public struct PopupDisplay: View {
70
70
  }
71
71
  VStack(alignment: .leading, spacing: 0) {
72
72
  MomoText(title, typography: .headerDefaultBold, maxLines: 2, accessibilityId: "title_popup_permission")
73
+ .padding(.trailing, isShowCloseIcon && url.isEmpty ? ModalMetrics.iconButtonSize + Spacing.M - Spacing.XL : 0)
73
74
  .padding(.top, 24)
74
75
  .padding(.bottom, 8)
75
76
 
@@ -107,15 +108,16 @@ public struct PopupDisplay: View {
107
108
  }
108
109
  .fixedSize(horizontal: false, vertical: true)
109
110
  .background(theme.colors.background.surface)
110
- .clipShape(RoundedRectangle(cornerRadius: Radius.L))
111
+ .clipShape(RoundedRectangle(cornerRadius: layout.popupRadius))
111
112
 
112
113
  if isShowCloseIcon {
113
- PopupCloseButton(action: onClose)
114
- .offset(x: 11, y: -11)
114
+ ModalIconButton(icon: "navigation_close", accessibilityId: "ic_popup_close", action: onClose)
115
+ .padding(.top, Spacing.M)
116
+ .padding(.trailing, Spacing.M)
115
117
  }
116
118
  }
117
- .frame(maxWidth: layout.popupMaxWidth)
118
- .padding(.horizontal, 12)
119
+ // window minus 24 a side on phones too, host padding included (PopupNotify parity)
120
+ .frame(maxWidth: layout.modalLayout.popup.maxWidth)
119
121
  .accessibilityElement(children: .contain)
120
122
  .accessibilityIdentifier("popup_notify")
121
123
  }
@@ -29,6 +29,7 @@ public struct PopupInput: View {
29
29
  VStack {
30
30
  VStack(alignment: .leading) {
31
31
  MomoText(title, typography: .headerDefaultBold)
32
+ .padding(.trailing, ModalMetrics.iconButtonSize + Spacing.M - Spacing.XL)
32
33
  .padding(.top, 12)
33
34
  .padding(.bottom, 24)
34
35
 
@@ -55,15 +56,16 @@ public struct PopupInput: View {
55
56
 
56
57
  }.clipped()
57
58
 
58
- PopupCloseButton(action: onPressClose)
59
- .offset(x: 11, y: -11)
59
+ ModalIconButton(icon: "navigation_close", accessibilityId: "ic_popup_close", action: onPressClose)
60
+ .padding(.top, Spacing.M)
61
+ .padding(.trailing, Spacing.M)
60
62
  }
61
63
  }
62
- .background(theme.colors.background.surface.cornerRadius(8))
64
+ .background(theme.colors.background.surface.cornerRadius(layout.popupRadius))
63
65
  .shadow(color: .black.opacity(0.08), radius: 2, x: 0, y: 0)
64
66
  .shadow(color: .black.opacity(0.16), radius: 24, x: 0, y: 0)
65
67
  .frame(maxWidth: layout.popupMaxWidth)
66
- .padding(.horizontal, 40)
68
+ .padding(.horizontal, layout.popupHorizontalPadding(40))
67
69
  }
68
70
 
69
71
  // MARK: Internal
@@ -1,19 +1,27 @@
1
1
  import SDWebImageSwiftUI
2
2
  import SwiftUI
3
3
 
4
- // Width of a system alert on the iPhone Duo inner display, in both orientations (RN Popup/utils.ts).
5
- private let duoPopupMaxWidth: CGFloat = 440
6
-
7
4
  extension ScreenLayout {
8
- /// Card width cap (Compose `popupMaxWidth`); unbounded off iPhone Duo, where the popup's own padding sets the width.
5
+ /// Card width on foldables (`modalLayout`, Compose `popupMaxWidth`); unbounded on phones,
6
+ /// where the popup's own padding sets the width.
9
7
  var popupMaxWidth: CGFloat {
10
- isDuoDevice ? duoPopupMaxWidth : .infinity
8
+ let modal = modalLayout
9
+ return modal.isFoldable ? modal.popup.maxWidth : .infinity
10
+ }
11
+
12
+ /// The placement already keeps foldable popups off the edges, so their own side padding goes.
13
+ func popupHorizontalPadding(_ padding: CGFloat) -> CGFloat {
14
+ modalLayout.isFoldable ? 0 : padding
11
15
  }
12
16
 
13
- /// Room left for a popup on iPhone Duo, where landscape is too short for it; nil elsewhere.
17
+ /// Tallest a popup gets on foldables; nil on phones.
14
18
  var popupMaxHeight: CGFloat? {
15
- guard isDuoDevice else { return nil }
16
- return height - duoTopInset - insets.bottom - Spacing.XL * 2
19
+ modalLayout.popup.maxHeight
20
+ }
21
+
22
+ /// Popup corner radius on every device (`modalLayout`, Compose `popupRadius`).
23
+ var popupRadius: CGFloat {
24
+ modalLayout.popup.radius
17
25
  }
18
26
  }
19
27
 
@@ -80,7 +88,7 @@ extension View {
80
88
  }
81
89
  }
82
90
 
83
- /// 22pt round close button shared by the popups (Compose `PopupNotify` / `PopupPromotion`).
91
+ /// 22pt round close button under `PopupPromotion`'s image (Compose `PopupPromotion`).
84
92
  struct PopupCloseButton: View {
85
93
  @Environment(\.appTheme) private var theme
86
94
  var tapSize: CGFloat = 22
@@ -22,6 +22,7 @@ public struct PopupNotifyProps {
22
22
  public var buttonDirection: PopupActionDirection
23
23
  public var onIconClose: () -> Void
24
24
  public var isShowCloseIcon: Bool
25
+ public var highlightText: [String]
25
26
 
26
27
  public init(
27
28
  image: String = "",
@@ -32,7 +33,8 @@ public struct PopupNotifyProps {
32
33
  secondary: PopupAction? = nil,
33
34
  buttonDirection: PopupActionDirection = .row,
34
35
  onIconClose: @escaping () -> Void,
35
- isShowCloseIcon: Bool = true
36
+ isShowCloseIcon: Bool = true,
37
+ highlightText: [String] = []
36
38
  ) {
37
39
  self.image = image
38
40
  self.title = title
@@ -43,6 +45,7 @@ public struct PopupNotifyProps {
43
45
  self.buttonDirection = buttonDirection
44
46
  self.onIconClose = onIconClose
45
47
  self.isShowCloseIcon = isShowCloseIcon
48
+ self.highlightText = highlightText
46
49
  }
47
50
  }
48
51
 
@@ -55,7 +58,8 @@ public struct PopupNotify: View {
55
58
  public let props: PopupNotifyProps
56
59
 
57
60
  @State private var descriptionHeight: CGFloat = 0
58
- @State private var actionsHeight: CGFloat = 0
61
+ @State private var descriptionFrameHeight: CGFloat = 0
62
+ @State private var cardHeight: CGFloat = 0
59
63
  @State private var oneLineHeight: CGFloat = 0
60
64
  @State private var twoLinesHeight: CGFloat = 0
61
65
 
@@ -63,10 +67,13 @@ public struct PopupNotify: View {
63
67
  localize.translate("errorCode")
64
68
  }
65
69
 
66
- // ~8.5 lines as laid out (Compose measures the real lines); nominal line height until measured
70
+ // ~8.5 lines as laid out (Compose measures the real lines); nominal line height until measured.
71
+ // With a max height (foldables) only the description gives way: image, title and actions stay.
67
72
  private var maxDescriptionHeight: CGFloat {
68
- popupLinesHeight(8.5, oneLine: oneLineHeight, twoLines: twoLinesHeight)
73
+ let lines = popupLinesHeight(8.5, oneLine: oneLineHeight, twoLines: twoLinesHeight)
69
74
  ?? fontScale(TypographyStyle.bodyDefaultRegular.lineHeight) * 8.5
75
+ guard let maxHeight = layout.modalLayout.popup.maxHeight else { return lines }
76
+ return max(min(lines, maxHeight - (cardHeight - descriptionFrameHeight)), 0)
70
77
  }
71
78
 
72
79
  private var shouldUseColumnButtons: Bool {
@@ -87,33 +94,29 @@ public struct PopupNotify: View {
87
94
  }
88
95
 
89
96
  public var body: some View {
97
+ let modal = layout.modalLayout
90
98
  ZStack(alignment: .topTrailing) {
91
99
  VStack(spacing: 0) {
92
- // scrolls when iPhone Duo landscape is too short; actions stay visible
93
- PopupScrollBody(maxHeight: layout.popupMaxHeight.map { $0 - actionsHeight }) {
94
- VStack(spacing: 0) {
95
- if !props.image.isEmpty {
96
- PopupHeaderImage(url: props.image)
97
- }
98
- textContent
99
- }
100
+ if !props.image.isEmpty {
101
+ PopupHeaderImage(url: props.image)
100
102
  }
103
+ textContent
101
104
 
102
105
  actionButtons
103
106
  .padding(.horizontal, Spacing.XL)
104
107
  .padding(.bottom, Spacing.XL)
105
- .popupReadHeight($actionsHeight)
106
108
  }
107
109
  .background(theme.colors.background.surface)
108
- .clipShape(RoundedRectangle(cornerRadius: Radius.L))
110
+ .clipShape(RoundedRectangle(cornerRadius: modal.popup.radius))
111
+ .popupReadHeight($cardHeight)
109
112
 
110
113
  if props.isShowCloseIcon {
111
- PopupCloseButton(action: props.onIconClose)
112
- .offset(x: 11, y: -11)
114
+ ModalIconButton(icon: "navigation_close", accessibilityId: "ic_popup_close", action: props.onIconClose)
115
+ .padding(.top, Spacing.M)
116
+ .padding(.trailing, Spacing.M)
113
117
  }
114
118
  }
115
- .frame(maxWidth: layout.popupMaxWidth)
116
- .padding(.horizontal, Spacing.M)
119
+ .frame(minWidth: modal.popup.minWidth, maxWidth: modal.popup.maxWidth)
117
120
  .accessibilityElement(children: .contain)
118
121
  .accessibilityIdentifier("popup_notify")
119
122
  }
@@ -126,6 +129,7 @@ public struct PopupNotify: View {
126
129
  maxLines: 2,
127
130
  accessibilityId: "title_popup_permission"
128
131
  )
132
+ .padding(.trailing, props.isShowCloseIcon && props.image.isEmpty ? ModalMetrics.iconButtonSize + Spacing.M - Spacing.XL : 0)
129
133
  .padding(.bottom, Spacing.S)
130
134
 
131
135
  descriptionContent
@@ -145,23 +149,26 @@ public struct PopupNotify: View {
145
149
  .measureLineHeights(typography: .bodyDefaultRegular, oneLine: $oneLineHeight, twoLines: $twoLinesHeight)
146
150
  }
147
151
 
148
- @ViewBuilder
149
152
  private var descriptionContent: some View {
150
- if descriptionHeight > maxDescriptionHeight {
151
- ScrollView(.vertical, showsIndicators: false) {
153
+ Group {
154
+ if descriptionHeight > maxDescriptionHeight {
155
+ ScrollView(.vertical, showsIndicators: false) {
156
+ descriptionText
157
+ }
158
+ .frame(height: maxDescriptionHeight)
159
+ } else {
152
160
  descriptionText
153
161
  }
154
- .frame(height: maxDescriptionHeight)
155
- } else {
156
- descriptionText
157
162
  }
163
+ .popupReadHeight($descriptionFrameHeight)
158
164
  }
159
165
 
160
166
  private var descriptionText: some View {
161
167
  MomoText(
162
168
  props.description,
163
169
  typography: .bodyDefaultRegular,
164
- accessibilityId: "description_popup_permission"
170
+ accessibilityId: "description_popup_permission",
171
+ highlightText: props.highlightText
165
172
  )
166
173
  .frame(maxWidth: .infinity, alignment: .leading)
167
174
  .popupReadHeight($descriptionHeight)
@@ -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,14 +25,11 @@ 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
  }
38
31
 
39
- /// Internal shimmer overlay. Reproduces Compose's `Modifier.shimmerLoadingAnimation`:
40
- /// a linear gradient band (60% of the container width) translated across the
41
- /// surface on an infinite, restarting, linearly-eased loop.
32
+ /// Compose's `Modifier.shimmerLoadingAnimation`: a gradient band 60% of the width sweeps across on a linear loop.
42
33
  private struct ShimmerLoading: View {
43
34
  let size: CGSize
44
35
  let durationMillis: Int
@@ -47,7 +38,6 @@ private struct ShimmerLoading: View {
47
38
  // Matches Compose `SHADOW_BRUSH_PERCENTAGE = 0.6f`.
48
39
  private static let shadowBrushPercentage: CGFloat = 0.6
49
40
 
50
- // Pre-computed shimmer colors (Colors.black_05, black_03, black_05).
51
41
  private static let shimmerColors: [Color] = [
52
42
  Colors.black05,
53
43
  Colors.black03,
@@ -58,9 +48,8 @@ private struct ShimmerLoading: View {
58
48
  (size.width * Self.shadowBrushPercentage).rounded(.towardZero)
59
49
  }
60
50
 
61
- // Compose animates from 0 to (durationMillis + widthOfShadowBrush). Since the
62
- // band is anchored at the animated value, the meaningful travel range spans
63
- // from off-screen-left to off-screen-right: -widthOfShadowBrush ... maxWidth.
51
+ // Compose animates to `durationMillis + widthOfShadowBrush`; the band is anchored at the value, so the travel
52
+ // that shows runs from fully off-screen left to fully off-screen right: -widthOfShadowBrush ... maxWidth.
64
53
  private var animationTarget: CGFloat {
65
54
  size.width + widthOfShadowBrush
66
55
  }
@@ -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