@momo-kits/native-kits 0.167.1-duo.14-debug → 0.167.1-duo.15

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 (153) hide show
  1. package/CLAUDE.md +1 -1
  2. package/ios/Layout/ScreenLayout.swift +52 -30
  3. package/ios/Navigation/StackScreen.swift +22 -8
  4. package/ios/native-kits.podspec +1 -1
  5. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  6. package/package.json +1 -1
  7. package/build.gradle.kts +0 -11
  8. package/compose/build.gradle.kts +0 -204
  9. package/compose/build.gradle.kts.backup +0 -204
  10. package/compose/compose.podspec +0 -47
  11. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -19
  12. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  13. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
  14. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  15. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -153
  16. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +0 -6
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -52
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -124
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -183
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -207
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -39
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -293
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -831
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -269
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -110
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -378
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -81
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -357
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -115
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -542
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -76
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -231
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -189
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -478
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -114
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -265
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -223
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -265
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -185
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -84
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -361
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -108
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -308
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -90
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -330
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -473
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -207
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -92
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -560
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -125
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -207
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -501
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -236
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -180
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -16
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitDesignSystem.kt +0 -18
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +0 -22
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -188
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -297
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -50
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -232
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -338
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -137
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -106
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -205
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -393
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -708
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -218
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -231
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +0 -98
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +0 -312
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -169
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -408
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -92
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -74
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -366
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -37
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -363
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +0 -185
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -133
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -91
  132. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
  133. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -74
  134. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +0 -13
  135. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  136. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  137. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  138. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -118
  139. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -40
  140. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
  141. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
  142. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
  143. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
  144. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -217
  145. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +0 -86
  146. package/gradle/libs.versions.toml +0 -69
  147. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  148. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  149. package/gradle.properties +0 -26
  150. package/gradlew +0 -252
  151. package/gradlew.bat +0 -94
  152. package/ios-demo/README.md +0 -120
  153. package/settings.gradle.kts +0 -64
package/CLAUDE.md CHANGED
@@ -68,7 +68,7 @@ Publishing is automated (`publish.sh` + GitLab CI on `[ci build]` / `main`). Do
68
68
 
69
69
  - `layout/ScreenLayout.kt`: `getScreenLayout()` returns window size, raw top/bottom + side insets, `contentWidth`, header geometry, the iPhone Duo `sideBar` and `duoTopInset`. `NavigationContainer` computes it once and provides `LocalScreenLayout`; reactive to fold/unfold and rotation (window size + `WindowInsets`). Metrics (`DuoMetrics`, 72pt iPhone header floor, 20pt status-bar threshold) mirror RN `Layout/utils.ts` — change both together.
70
70
  - iPhone-only: everything gates on `isPhoneIdiom()` (`platform/`), never on "iOS", so iPad windows keep the regular layout. Two detectors, as in RN: `isIPhoneDuo` (window aspect < 1.6 or asymmetric side insets) drives layout; `isIPhoneDuoDevice` (short side of screen or window > 440, RN `device.ts`) drives popups, modal and bottom sheet.
71
- - Header height is `headerHeight` (not `AppStatusBar + HEADER_HEIGHT`); the bar row is `headerBarHeight` and starts `headerStatusBarHeight` below the window top. When the status bar is off the top edge (iPhone landscape, iPhone Duo) `headerStatusBarHeight` is 0 so the title stays centered — except on the Duo outer display in portrait, where the header is 76pt and the row starts at 14pt so the title centers on the camera punchout.
71
+ - Header height is `headerHeight` (not `AppStatusBar + HEADER_HEIGHT`); the bar row is `headerBarHeight` and starts `headerStatusBarHeight` below the window top. When the status bar is off the top edge (iPhone landscape, iPhone Duo) `headerStatusBarHeight` is 0 so the title stays centered — except on the Duo outer display: in portrait the header is 76pt and the row starts at 14pt so the title centers on the camera punchout; in landscape the row centers on the camera when it sits at the top end of the strip (else on the back button) and the header reaches 8pt below the back button.
72
72
  - iPhone Duo with a side strip ≥ 60pt: back + toolkit leave the bar for `HeaderSideBar` (`navigation/component/SideBar.kt`, 48pt glass controls); custom header-right stays in the bar. `sideBar.top` is 170pt in portrait, 120pt on the inner display in landscape (height ≥ 600), 24pt on the outer display in landscape, or below the header when the status bar is on top; UIKit's `statusBarFrame` is useless on Duo. Unlike RN the column is clamped above footer (24pt gap) / rail (12pt gap).
73
73
  - Reserved regions (iOS 27.1 `reservedRegionsOfKind:`, reached through the ObjC runtime so older SDKs still build): a probe `UIView` (`platform/ReservedRegions.ios.kt` on the Compose root view; `ReservedRegionsProbe` inside SwiftUI `momoScreenLayout()`) re-reads them in `layoutSubviews`, which UIKit re-runs when they change. They push `sideBar.top` below the status cluster as it grows for calls / Live Activities, and `sideBar.bottom` (≥ 24pt) above a camera at the bottom end of the strip.
74
74
  - Tab bar on Duo is `bottomtab/DuoTabBar.kt`: a rail in the side strip (`sideBar.bottom` above the window bottom, QR below it) or, without a side bar, a floating bar spanning 6/8 grid columns. Both overlay the content; `duoFloatingTabBarInset` pads tab content, footer and FAB.
@@ -110,6 +110,12 @@ extension ScreenLayout {
110
110
  let sideInset = max(insets.leading, insets.trailing)
111
111
  // narrower strips cannot host a control 12pt from the inner edge
112
112
  if sideInset >= DuoMetrics.controlSize + Spacing.M {
113
+ let edge: SideBarEdge = insets.trailing >= insets.leading ? .right : .left
114
+ let stripLeft = edge == .right ? width - sideInset : 0
115
+ // clear of the camera and of the status bar cluster, which grows for calls and Live
116
+ // Activities; region frames already include the system's margin
117
+ let occlusion = stripOcclusion(reservedRegions, stripLeft: stripLeft, stripRight: stripLeft + sideInset, windowHeight: height)
118
+
113
119
  var top = insets.top + HeaderMetrics.barHeight + Spacing.M
114
120
  if insets.top < HeaderMetrics.statusBarMinInset {
115
121
  // status bar lives in the strip: start under its cluster, as the native bar does
@@ -118,8 +124,11 @@ extension ScreenLayout {
118
124
  } else if height >= DuoMetrics.innerMinHeight {
119
125
  top = DuoMetrics.firstItemTopLandscape
120
126
  } else {
121
- // outer display in landscape: no status bar in the strip
127
+ // outer display in landscape: no status bar in the strip, the title row centers
128
+ // on the camera when it sits at the top end, otherwise on the back button
122
129
  top = DuoMetrics.edgeInset
130
+ let titleCenterY = occlusion.top > top ? occlusion.topCenter : top + DuoMetrics.controlSize / 2
131
+ (headerHeight, headerStatusBarHeight) = centeredHeaderGeometry(centerY: titleCenterY)
123
132
  }
124
133
 
125
134
  if height > width && width < DuoMetrics.innerMinHeight {
@@ -129,11 +138,6 @@ extension ScreenLayout {
129
138
  }
130
139
  }
131
140
 
132
- let edge: SideBarEdge = insets.trailing >= insets.leading ? .right : .left
133
- let stripLeft = edge == .right ? width - sideInset : 0
134
- // clear of the camera and of the status bar cluster, which grows for calls and Live
135
- // Activities; region frames already include the system's margin
136
- let occlusion = stripOcclusion(reservedRegions, stripLeft: stripLeft, stripRight: stripLeft + sideInset, windowHeight: height)
137
141
  sideBar = SideBarLayout(
138
142
  edge: edge,
139
143
  width: sideInset,
@@ -159,18 +163,29 @@ extension ScreenLayout {
159
163
  )
160
164
  }
161
165
 
166
+ /// Bar row centered on a window y, at least iPhoneMinHeight tall and reaching 8pt below
167
+ /// a side bar control centered there.
168
+ private static func centeredHeaderGeometry(centerY: CGFloat) -> (CGFloat, CGFloat) {
169
+ let height = max(HeaderMetrics.iPhoneMinHeight, centerY + DuoMetrics.controlSize / 2 + Spacing.S)
170
+ return (height, max(0, centerY * 2 - height))
171
+ }
172
+
162
173
  /// How far system regions reach into a side strip from its top and from its bottom end
163
- /// (e.g. the camera, which sits at either end depending on the rotation).
174
+ /// (e.g. the camera, which sits at either end depending on the rotation), and the center y
175
+ /// of the region reaching furthest from the top.
164
176
  private static func stripOcclusion(
165
177
  _ regions: [CGRect],
166
178
  stripLeft: CGFloat,
167
179
  stripRight: CGFloat,
168
180
  windowHeight: CGFloat
169
- ) -> (top: CGFloat, bottom: CGFloat) {
170
- regions.reduce(into: (top: CGFloat(0), bottom: CGFloat(0))) { occlusion, region in
181
+ ) -> (top: CGFloat, topCenter: CGFloat, bottom: CGFloat) {
182
+ regions.reduce(into: (top: CGFloat(0), topCenter: CGFloat(0), bottom: CGFloat(0))) { occlusion, region in
171
183
  guard region.minX < stripRight && region.maxX > stripLeft else { return }
172
184
  if region.midY < windowHeight / 2 {
173
- occlusion.top = max(occlusion.top, region.maxY)
185
+ if region.maxY > occlusion.top {
186
+ occlusion.top = region.maxY
187
+ occlusion.topCenter = region.midY
188
+ }
174
189
  } else {
175
190
  occlusion.bottom = max(occlusion.bottom, windowHeight - region.minY)
176
191
  }
@@ -204,16 +219,20 @@ public func isIPhoneDuoDevice(windowSize: CGSize? = nil) -> Bool {
204
219
  /// System occlusion regions (iOS 27.1+) in window coordinates: the iPhone Duo camera, and the
205
220
  /// status bar cluster as it grows for a call or a Live Activity. Empty before iOS 27.1.
206
221
  enum ReservedRegions {
207
- // last report of the probe, so `ScreenLayout.current` includes it
208
- static var current: [CGRect] = []
222
+ // last report of a probe, so `ScreenLayout.current` includes it
223
+ private(set) static var current: [CGRect] = []
224
+ static let didChange = Notification.Name("MoMoUIKitsReservedRegionsDidChange")
225
+
226
+ fileprivate static func publish(_ regions: [CGRect]) {
227
+ guard regions != current else { return }
228
+ current = regions
229
+ NotificationCenter.default.post(name: didChange, object: nil)
230
+ }
209
231
  }
210
232
 
211
233
  /// Invisible probe: reading the regions in layoutSubviews makes UIKit run it again when they
212
234
  /// change, so nothing polls. Port of RN `@momo-kits/reserved-regions`.
213
235
  private final class ReservedRegionsProbe: UIView {
214
- var onChange: (() -> Void)?
215
- private var last: [CGRect]?
216
-
217
236
  override init(frame: CGRect) {
218
237
  super.init(frame: frame)
219
238
  isUserInteractionEnabled = false
@@ -223,12 +242,19 @@ private final class ReservedRegionsProbe: UIView {
223
242
 
224
243
  override func layoutSubviews() {
225
244
  super.layoutSubviews()
245
+ // read even when not publishing, so UIKit keeps re-running this when they change
226
246
  let regions = occlusionRegions()
227
- guard regions != last else { return }
228
- last = regions
229
- ReservedRegions.current = regions
247
+ // every screen has a probe but the regions are window-wide: one sliding in on a push or
248
+ // a present, or off the window, would overwrite them with a partial read
249
+ guard spansWindow else { return }
230
250
  // layout pass: publish on the next turn instead of mutating SwiftUI state mid-update
231
- DispatchQueue.main.async { [weak self] in self?.onChange?() }
251
+ DispatchQueue.main.async { ReservedRegions.publish(regions) }
252
+ }
253
+
254
+ private var spansWindow: Bool {
255
+ guard let window else { return false }
256
+ let frame = convert(bounds, to: nil)
257
+ return abs(frame.minX) < 1 && abs(frame.maxX - window.bounds.width) < 1 && abs(frame.minY) < 1
232
258
  }
233
259
 
234
260
  override func didMoveToWindow() {
@@ -250,17 +276,9 @@ private final class ReservedRegionsProbe: UIView {
250
276
  }
251
277
 
252
278
  private struct ReservedRegionsProbeView: UIViewRepresentable {
253
- let onChange: () -> Void
279
+ func makeUIView(context: Context) -> ReservedRegionsProbe { ReservedRegionsProbe() }
254
280
 
255
- func makeUIView(context: Context) -> ReservedRegionsProbe {
256
- let probe = ReservedRegionsProbe()
257
- probe.onChange = onChange
258
- return probe
259
- }
260
-
261
- func updateUIView(_ probe: ReservedRegionsProbe, context: Context) {
262
- probe.onChange = onChange
263
- }
281
+ func updateUIView(_ probe: ReservedRegionsProbe, context: Context) {}
264
282
  }
265
283
 
266
284
  // MARK: - Environment
@@ -292,7 +310,11 @@ private struct ScreenLayoutReader: ViewModifier {
292
310
  .onChange(of: proxy.safeAreaInsets) { _ in refresh() }
293
311
  }
294
312
  )
295
- .background(ReservedRegionsProbeView { refresh() }.ignoresSafeArea())
313
+ .background(ReservedRegionsProbeView().ignoresSafeArea())
314
+ // any screen's probe may report, so every reader follows the shared value
315
+ .onReceive(NotificationCenter.default.publisher(for: ReservedRegions.didChange)) { _ in
316
+ refresh()
317
+ }
296
318
  .onReceive(NotificationCenter.default.publisher(for: UIDevice.orientationDidChangeNotification)) { _ in
297
319
  refresh()
298
320
  }
@@ -431,13 +431,23 @@ public struct StackScreen<Content: View>: View {
431
431
  // top-aligned: an extended band runs past the bar, under the content
432
432
  .background(alignment: .top) {
433
433
  ZStack(alignment: .top) {
434
- NavigationHeaderBackground(
435
- headerType: headerType,
436
- scrollState: scrollOffset,
437
- headerTransparent: headerTransparent,
438
- fullScreenContent: fullScreenContent,
439
- backgroundColor: backgroundColor
440
- )
434
+ if layout.sideBar != nil && inputSearchType != .none && !headerTransparent {
435
+ // RN HeaderExtendHeader with search on the side bar layout: the
436
+ // gradient fades out within the header box, as without the search
437
+ DuoScrollGradient(
438
+ scrollOffset: scrollOffset,
439
+ headerHeight: layout.headerHeight,
440
+ extended: headerType == .extended
441
+ )
442
+ } else {
443
+ NavigationHeaderBackground(
444
+ headerType: headerType,
445
+ scrollState: scrollOffset,
446
+ headerTransparent: headerTransparent,
447
+ fullScreenContent: fullScreenContent,
448
+ backgroundColor: backgroundColor
449
+ )
450
+ }
441
451
  HeaderBarBackground(opacity: opacity, transparent: headerTransparent || headerType == .none)
442
452
  }
443
453
  .edgesIgnoringSafeArea([.top, .horizontal])
@@ -688,6 +698,7 @@ public struct NavigationFooter: View {
688
698
  }
689
699
 
690
700
  @Environment(\.appTheme) private var theme
701
+ @Environment(\.screenLayout) private var layout
691
702
 
692
703
  /// Read from the window, not from an enclosing `GeometryProxy`: the proxy's bottom
693
704
  /// inset grows to the keyboard height while the keyboard is up.
@@ -733,9 +744,10 @@ public struct NavigationFooter: View {
733
744
  .padding(.bottom, Self.bottomPadding - (Spacing.S - margin))
734
745
  // Compose paints the surface all the way to the bottom of the screen; the
735
746
  // footer's own frame stops at the safe area, so only the fill bleeds down.
747
+ // With side insets (iPhone Duo) it stays inside them, off the side bar.
736
748
  .background(
737
749
  (transparent ? Color.clear : theme.colors.background.surface)
738
- .ignoresSafeArea(.container, edges: [.bottom, .horizontal])
750
+ .ignoresSafeArea(.container, edges: hasSideInsets ? .bottom : [.bottom, .horizontal])
739
751
  )
740
752
  .overlay(alignment: .top) {
741
753
  if !transparent { shadow }
@@ -744,6 +756,8 @@ public struct NavigationFooter: View {
744
756
  }
745
757
  }
746
758
 
759
+ private var hasSideInsets: Bool { layout.insetLeft > 0 || layout.insetRight > 0 }
760
+
747
761
  /// Compose offsets the shadow box by -6dp, so it lands on the content above the
748
762
  /// footer rather than on the footer surface itself.
749
763
  private var shadow: some View {
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKits'
3
- s.version = '0.167.1-beta.4'
3
+ s.version = '0.167.1-duo.15'
4
4
  s.summary = 'MoMoUIKits for iOS'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKitsDemo'
3
- s.version = '0.167.1-beta.4'
3
+ s.version = '0.167.1-duo.15'
4
4
  s.summary = 'Demo browser for MoMoUIKits SwiftUI components'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.167.1-duo.14-debug",
3
+ "version": "0.167.1-duo.15",
4
4
  "private": false,
5
5
  "dependeNavigationncies": {},
6
6
  "devDependencies": {},
package/build.gradle.kts DELETED
@@ -1,11 +0,0 @@
1
- plugins {
2
- // this is necessary to avoid the plugins to be loaded multiple times
3
- // in each subproject's classloader
4
- alias(libs.plugins.android.application) apply false
5
- alias(libs.plugins.android.library) apply false
6
- alias(libs.plugins.compose) apply false
7
- alias(libs.plugins.kotlin.compose.compiler) apply false
8
- alias(libs.plugins.jetbrains.kotlin.multiplatform) apply false
9
- alias(libs.plugins.jetbrains.kotlin.serialization) apply false
10
- alias(libs.plugins.vanniktech.mavenPublish) apply false
11
- }
@@ -1,204 +0,0 @@
1
- // import com.vanniktech.maven.publish.JavadocJar
2
- // import com.vanniktech.maven.publish.KotlinMultiplatform
3
- import org.jetbrains.kotlin.gradle.dsl.JvmTarget
4
-
5
- plugins {
6
- alias(libs.plugins.jetbrains.kotlin.multiplatform)
7
- alias(libs.plugins.android.library)
8
- alias(libs.plugins.compose)
9
- alias(libs.plugins.kotlin.compose.compiler)
10
- // alias(libs.plugins.vanniktech.mavenPublish)
11
- id(libs.plugins.jetbrains.kotlin.cocoapods.get().pluginId)
12
- kotlin("plugin.serialization")
13
- }
14
-
15
- val gitlabName: String = findProperty("name") as String? ?: ""
16
- val gitlabRepo: String = findProperty("repo") as String? ?: ""
17
- val gitlabUrl: String = findProperty("url") as String? ?: ""
18
- val gitlabGroup: String = findProperty("group") as String? ?: ""
19
- val gitlabArtifactId: String = findProperty("artifact.id") as String? ?: ""
20
- val gitlabVersion: String = findProperty("version") as String? ?: ""
21
- val gitlabUser: String = findProperty("gitlab.user") as String? ?: ""
22
- val gitlabKey: String = findProperty("gitlab.password") as String? ?: ""
23
-
24
- kotlin {
25
- androidTarget {
26
- compilerOptions {
27
- jvmTarget.set(JvmTarget.JVM_17)
28
- }
29
- publishLibraryVariants("release")
30
- }
31
-
32
- val fwName = gitlabArtifactId
33
- val iosTargets = listOf(iosArm64(), iosSimulatorArm64())
34
- iosTargets.forEach {
35
- it.binaries.framework {
36
- baseName = fwName
37
- binaryOption("bundleId", "$gitlabGroup.$fwName")
38
- isStatic = true
39
- }
40
- }
41
-
42
- cocoapods {
43
- version = "0.167.1-duo.14-debug"
44
- summary = "IOS Shared module"
45
- homepage = "https://momo.vn"
46
- ios.deploymentTarget = "15.0"
47
-
48
- framework {
49
- baseName = fwName
50
- isStatic = true
51
- }
52
-
53
- pod("lottie-ios") {
54
- moduleName = "Lottie"
55
- version = "4.4.3"
56
- extraOpts += listOf("-compiler-option", "-fmodules")
57
- }
58
- }
59
-
60
- sourceSets {
61
- all {
62
- languageSettings.optIn("vn.momo.kits.modifier.InternalApi")
63
- }
64
- commonMain.dependencies {
65
- implementation(compose.runtime)
66
- implementation(compose.material)
67
- implementation(compose.material3)
68
- implementation(compose.components.resources)
69
- implementation(libs.compose.ui.backhandler)
70
- implementation(libs.ktor.client.core)
71
- implementation(libs.jetbrains.coroutines.core)
72
- implementation(libs.navigation.multiplatform)
73
- implementation(libs.coil.multiplatform.compose)
74
- implementation(libs.coil.multiplatform.core)
75
- implementation(libs.coil.multiplatform.network.ktor)
76
- implementation(libs.jetbrains.serialization.json)
77
- implementation(libs.kotlinx.datetime)
78
- api(libs.native.max.api)
79
- implementation(libs.compottie)
80
- implementation(libs.gif.image)
81
- }
82
- androidMain.dependencies {
83
- implementation(libs.ktor.client.okhttp)
84
- implementation(libs.airbnb.lottie)
85
- }
86
- iosMain.dependencies {
87
- implementation(libs.ktor.client.darwin)
88
- }
89
- }
90
- }
91
-
92
- android {
93
- namespace = "vn.momo.kits.kits"
94
- compileSdk = 35
95
- compileOptions {
96
- sourceCompatibility = JavaVersion.VERSION_17
97
- targetCompatibility = JavaVersion.VERSION_17
98
- }
99
- defaultConfig {
100
- minSdk = 24
101
- }
102
- }
103
-
104
- dependencies {
105
- }
106
-
107
- repositories {
108
- google {
109
- mavenContent {
110
- includeGroupAndSubgroups("androidx")
111
- includeGroupAndSubgroups("com.android")
112
- includeGroupAndSubgroups("com.google")
113
- }
114
- }
115
- mavenCentral()
116
- maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
117
- maven {
118
- url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
119
- credentials {username = "download_packages"; password = "gldt-bjDqLpU_sPcHDuXau2ws" }
120
- }
121
- maven {
122
- url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
123
- credentials {
124
- username = "viewer"
125
- password = "viewer"
126
- }
127
- isAllowInsecureProtocol = true
128
- }
129
- }
130
-
131
- compose {
132
- resources {
133
- publicResClass = true
134
- packageOfResClass = "vn.momo.uikits.resources"
135
- generateResClass = always
136
- }
137
- }
138
-
139
- // publishing {
140
- // repositories {
141
- // maven {
142
- // name = "${gitlabRepo}Packages"
143
- // credentials {
144
- // username = gitlabUser
145
- // password = gitlabKey
146
- // }
147
- // url = uri("$gitlabUrl")
148
- // }
149
- // }
150
- // }
151
-
152
- // mavenPublishing {
153
- // configure(
154
- // KotlinMultiplatform(
155
- // javadocJar = JavadocJar.Empty(),
156
- // sourcesJar = true,
157
- // androidVariantsToPublish = listOf("release")
158
- // )
159
- // )
160
- //
161
- // repositories {
162
- // maven {
163
- // name = "${gitlabRepo}Packages"
164
- // credentials { username = gitlabUser; password = gitlabKey }
165
- // url = uri("$gitlabUrl")
166
- // }
167
- // }
168
- //
169
- // coordinates(gitlabGroup.toString(), gitlabArtifactId, gitlabVersion.toString())
170
- //
171
- // pom {
172
- // name = "$gitlabName Klib"
173
- // description = "$gitlabName"
174
- // url = "https://gitlab.mservice.com.vn"
175
- // licenses {
176
- // license {
177
- // name = "The Apache License, Version 2.0"
178
- // url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
179
- // distribution = "https://www.apache.org/licenses/LICENSE-2.0.txt"
180
- // }
181
- // }
182
- // developers {
183
- // developer {
184
- // id = "kotlin-hands-on"
185
- // name = "Kotlin Developer Advocate"
186
- // url = "https://github.com/kotlin-hands-on/"
187
- // }
188
- // }
189
- // }
190
- // }
191
-
192
- // Xcode 27 rejects pods below iOS 15 (lottie-ios 4.4.3 declares 13.0), and the synthetic Podfile has no post_install hook.
193
- val syntheticPodsProject = layout.buildDirectory.file("cocoapods/synthetic/ios/Pods/Pods.xcodeproj/project.pbxproj")
194
- tasks.matching { it.name.startsWith("podInstallSynthetic") }.configureEach {
195
- doLast {
196
- val pbxproj = syntheticPodsProject.get().asFile
197
- if (!pbxproj.exists()) return@doLast
198
- val target = Regex("IPHONEOS_DEPLOYMENT_TARGET = ([0-9.]+);")
199
- pbxproj.writeText(pbxproj.readText().replace(target) { match ->
200
- val major = match.groupValues[1].substringBefore('.').toIntOrNull() ?: 0
201
- if (major < 15) "IPHONEOS_DEPLOYMENT_TARGET = 15.0;" else match.value
202
- })
203
- }
204
- }
@@ -1,204 +0,0 @@
1
- import com.vanniktech.maven.publish.JavadocJar
2
- import com.vanniktech.maven.publish.KotlinMultiplatform
3
- import org.jetbrains.kotlin.gradle.dsl.JvmTarget
4
-
5
- plugins {
6
- alias(libs.plugins.jetbrains.kotlin.multiplatform)
7
- alias(libs.plugins.android.library)
8
- alias(libs.plugins.compose)
9
- alias(libs.plugins.kotlin.compose.compiler)
10
- alias(libs.plugins.vanniktech.mavenPublish)
11
- id(libs.plugins.jetbrains.kotlin.cocoapods.get().pluginId)
12
- kotlin("plugin.serialization")
13
- }
14
-
15
- val gitlabName: String = findProperty("name") as String? ?: ""
16
- val gitlabRepo: String = findProperty("repo") as String? ?: ""
17
- val gitlabUrl: String = findProperty("url") as String? ?: ""
18
- val gitlabGroup: String = findProperty("group") as String? ?: ""
19
- val gitlabArtifactId: String = findProperty("artifact.id") as String? ?: ""
20
- val gitlabVersion: String = findProperty("version") as String? ?: ""
21
- val gitlabUser: String = findProperty("gitlab.user") as String? ?: ""
22
- val gitlabKey: String = findProperty("gitlab.password") as String? ?: ""
23
-
24
- kotlin {
25
- androidTarget {
26
- compilerOptions {
27
- jvmTarget.set(JvmTarget.JVM_17)
28
- }
29
- publishLibraryVariants("release")
30
- }
31
-
32
- val fwName = gitlabArtifactId
33
- val iosTargets = listOf(iosArm64(), iosSimulatorArm64())
34
- iosTargets.forEach {
35
- it.binaries.framework {
36
- baseName = fwName
37
- binaryOption("bundleId", "$gitlabGroup.$fwName")
38
- isStatic = true
39
- }
40
- }
41
-
42
- cocoapods {
43
- version = gitlabVersion
44
- summary = "IOS Shared module"
45
- homepage = "https://momo.vn"
46
- ios.deploymentTarget = "15.0"
47
-
48
- framework {
49
- baseName = fwName
50
- isStatic = true
51
- }
52
-
53
- pod("lottie-ios") {
54
- moduleName = "Lottie"
55
- version = "4.4.3"
56
- extraOpts += listOf("-compiler-option", "-fmodules")
57
- }
58
- }
59
-
60
- sourceSets {
61
- all {
62
- languageSettings.optIn("vn.momo.kits.modifier.InternalApi")
63
- }
64
- commonMain.dependencies {
65
- implementation(compose.runtime)
66
- implementation(compose.material)
67
- implementation(compose.material3)
68
- implementation(compose.components.resources)
69
- implementation(libs.compose.ui.backhandler)
70
- implementation(libs.ktor.client.core)
71
- implementation(libs.jetbrains.coroutines.core)
72
- implementation(libs.navigation.multiplatform)
73
- implementation(libs.coil.multiplatform.compose)
74
- implementation(libs.coil.multiplatform.core)
75
- implementation(libs.coil.multiplatform.network.ktor)
76
- implementation(libs.jetbrains.serialization.json)
77
- implementation(libs.kotlinx.datetime)
78
- api(libs.native.max.api)
79
- implementation(libs.compottie)
80
- implementation(libs.gif.image)
81
- }
82
- androidMain.dependencies {
83
- implementation(libs.ktor.client.okhttp)
84
- implementation(libs.airbnb.lottie)
85
- }
86
- iosMain.dependencies {
87
- implementation(libs.ktor.client.darwin)
88
- }
89
- }
90
- }
91
-
92
- android {
93
- namespace = "$gitlabGroup.$gitlabArtifactId"
94
- compileSdk = libs.versions.android.compileSdk.get().toInt()
95
- compileOptions {
96
- sourceCompatibility = JavaVersion.VERSION_17
97
- targetCompatibility = JavaVersion.VERSION_17
98
- }
99
- defaultConfig {
100
- minSdk = libs.versions.android.minSdk.get().toInt()
101
- }
102
- }
103
-
104
- dependencies {
105
- }
106
-
107
- repositories {
108
- google {
109
- mavenContent {
110
- includeGroupAndSubgroups("androidx")
111
- includeGroupAndSubgroups("com.android")
112
- includeGroupAndSubgroups("com.google")
113
- }
114
- }
115
- mavenCentral()
116
- maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
117
- maven {
118
- url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
119
- credentials {username = "download_packages"; password = "gldt-bjDqLpU_sPcHDuXau2ws" }
120
- }
121
- maven {
122
- url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
123
- credentials {
124
- username = "viewer"
125
- password = "viewer"
126
- }
127
- isAllowInsecureProtocol = true
128
- }
129
- }
130
-
131
- compose {
132
- resources {
133
- publicResClass = true
134
- packageOfResClass = "vn.momo.uikits.resources"
135
- generateResClass = always
136
- }
137
- }
138
-
139
- publishing {
140
- repositories {
141
- maven {
142
- name = "${gitlabRepo}Packages"
143
- credentials {
144
- username = gitlabUser
145
- password = gitlabKey
146
- }
147
- url = uri("$gitlabUrl")
148
- }
149
- }
150
- }
151
-
152
- mavenPublishing {
153
- configure(
154
- KotlinMultiplatform(
155
- javadocJar = JavadocJar.Empty(),
156
- sourcesJar = true,
157
- androidVariantsToPublish = listOf("release")
158
- )
159
- )
160
-
161
- repositories {
162
- maven {
163
- name = "${gitlabRepo}Packages"
164
- credentials { username = gitlabUser; password = gitlabKey }
165
- url = uri("$gitlabUrl")
166
- }
167
- }
168
-
169
- coordinates(gitlabGroup.toString(), gitlabArtifactId, gitlabVersion.toString())
170
-
171
- pom {
172
- name = "$gitlabName Klib"
173
- description = "$gitlabName"
174
- url = "https://gitlab.mservice.com.vn"
175
- licenses {
176
- license {
177
- name = "The Apache License, Version 2.0"
178
- url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
179
- distribution = "https://www.apache.org/licenses/LICENSE-2.0.txt"
180
- }
181
- }
182
- developers {
183
- developer {
184
- id = "kotlin-hands-on"
185
- name = "Kotlin Developer Advocate"
186
- url = "https://github.com/kotlin-hands-on/"
187
- }
188
- }
189
- }
190
- }
191
-
192
- // Xcode 27 rejects pods below iOS 15 (lottie-ios 4.4.3 declares 13.0), and the synthetic Podfile has no post_install hook.
193
- val syntheticPodsProject = layout.buildDirectory.file("cocoapods/synthetic/ios/Pods/Pods.xcodeproj/project.pbxproj")
194
- tasks.matching { it.name.startsWith("podInstallSynthetic") }.configureEach {
195
- doLast {
196
- val pbxproj = syntheticPodsProject.get().asFile
197
- if (!pbxproj.exists()) return@doLast
198
- val target = Regex("IPHONEOS_DEPLOYMENT_TARGET = ([0-9.]+);")
199
- pbxproj.writeText(pbxproj.readText().replace(target) { match ->
200
- val major = match.groupValues[1].substringBefore('.').toIntOrNull() ?: 0
201
- if (major < 15) "IPHONEOS_DEPLOYMENT_TARGET = 15.0;" else match.value
202
- })
203
- }
204
- }