@momo-kits/native-kits 0.164.1-beta.9-debug → 0.164.1-headerconfig.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 (53) hide show
  1. package/.claude/settings.local.json +7 -178
  2. package/CLAUDE.md +2 -0
  3. package/compose/build.gradle.kts +1 -1
  4. package/compose/compose.podspec +1 -1
  5. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +3 -3
  6. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +2 -1
  7. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +18 -0
  8. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +6 -1
  9. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +30 -4
  10. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +1 -1
  11. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +3 -1
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +8 -1
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +9 -4
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +4 -1
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +3 -0
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +104 -22
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +3 -9
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +8 -4
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +2 -1
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitDesignSystem.kt +18 -0
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +2 -2
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +38 -5
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +58 -0
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +3 -0
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +20 -11
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +10 -23
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +20 -23
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +11 -27
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +4 -10
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +19 -0
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +41 -3
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +3 -1
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +106 -0
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +75 -0
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +3 -0
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +5 -1
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +5 -8
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +3 -1
  39. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +45 -0
  40. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +6 -3
  41. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +8 -23
  42. package/gradle/libs.versions.toml +1 -1
  43. package/gradle.properties +1 -1
  44. package/ios/Application/Navigation/NavigatorManager.swift +0 -27
  45. package/ios/Colors+Radius+Spacing/Theme.swift +2 -2
  46. package/ios/Typography/KitDesignSystem.swift +17 -0
  47. package/ios/Typography/Text.swift +25 -1
  48. package/ios/native-kits.podspec +1 -1
  49. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  50. package/local.properties +2 -2
  51. package/package.json +1 -1
  52. package/publish.sh +25 -0
  53. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ComposeBackGesture.ios.kt +0 -65
package/gradle.properties CHANGED
@@ -18,7 +18,7 @@ kotlin.apple.xcodeCompatibility.nowarn=true
18
18
  name="ComposeKits"
19
19
  group=vn.momo.kits
20
20
  artifact.id=kits
21
- version=0.164.1-beta.9
21
+ version=0.164.1-headerconfig.1
22
22
 
23
23
  repo=GitLab
24
24
  url=https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven
@@ -1,19 +1,3 @@
1
- //
2
- // NavigatorManager.swift
3
- // MoMoUIKits
4
- //
5
- // Host bridge for the native iOS edge-swipe back — the SwiftUI mirror of Compose's
6
- // `ComposeNavigatorManager` (momo-app `vn.momo.compose.uikits.ComposeNavigatorManager`).
7
- //
8
- // The kit does NOT own the swipe gesture. In the host app a kit screen lives inside a
9
- // `UIHostingController` hosted by the mini-app container VC, and that VC owns the
10
- // `UIScreenEdgePanGestureRecognizer`. When the swipe fires the host asks this manager
11
- // whether a kit stack is mounted (`checkCanPop`) and, if so, routes the back into it
12
- // (`pop` → `Navigator.onBackSafe`) instead of dismissing the whole mini-app. Standalone
13
- // (no such host, e.g. the demo app) there is no edge swipe — same as Compose on iOS,
14
- // whose `BackHandler` is a no-op and which relies entirely on the host.
15
- //
16
-
17
1
  import Foundation
18
2
 
19
3
  @available(iOS 16.0, *)
@@ -21,28 +5,17 @@ public final class NavigatorManager {
21
5
  public static let shared = NavigatorManager()
22
6
  private init() {}
23
7
 
24
- /// Stack of mounted navigators; the last one is the visible top (nested mini-apps
25
- /// push more than one). Held strongly, mirroring `ComposeNavigatorManager` — entries
26
- /// are released by `NavigationContainer` on disappear, not by ARC.
27
8
  private var navigators: [Navigator] = []
28
9
 
29
- /// Idempotent: SwiftUI can re-run a view's `onAppear`, and a double push would need a
30
- /// matching double remove to unwind.
31
10
  public func push(_ navigator: Navigator) {
32
11
  guard !navigators.contains(where: { $0 === navigator }) else { return }
33
12
  navigators.append(navigator)
34
13
  }
35
14
 
36
- /// Removes by identity rather than `removeLast` so a spurious disappear of a covered
37
- /// (non-top) container can't drop the wrong navigator.
38
15
  public func remove(_ navigator: Navigator) {
39
16
  navigators.removeAll { $0 === navigator }
40
17
  }
41
18
 
42
- /// True while any kit stack is mounted — tells the host to route the back into the kit
43
- /// instead of dismissing the mini-app. Matches `ComposeNavigatorManager.checkCanPop`:
44
- /// it does not inspect stack depth; `onBackSafe` handles the at-root case itself by
45
- /// asking the host to dismiss (via `composeApi`).
46
19
  public func checkCanPop() -> Bool { !navigators.isEmpty }
47
20
 
48
21
  public func pop() { navigators.last?.onBackSafe() }
@@ -221,7 +221,7 @@ public let defaultTheme = Theme(
221
221
  container: Colors.blue08
222
222
  )
223
223
  ),
224
- font: "SFProText",
224
+ font: "MomoTrustSans",
225
225
  assets: ThemeAssets(headerBackground: nil)
226
226
  )
227
227
 
@@ -277,7 +277,7 @@ public let darkTheme = Theme(
277
277
  container: Colors.blue08
278
278
  )
279
279
  ),
280
- font: "SFProText",
280
+ font: "MomoTrustSans",
281
281
  assets: ThemeAssets(headerBackground: nil)
282
282
  )
283
283
 
@@ -0,0 +1,17 @@
1
+ import Foundation
2
+
3
+ /// Design-system rollout flag for the SwiftUI kit, mirroring Compose's `KitDesignSystem`.
4
+ /// The kit is sandboxed and can't read the host config, so the host writes `update(_:)` once at
5
+ /// startup from `DesignSystemConfig`. Startup-only and non-reactive, like `FontScaleStore` was
6
+ /// before it gained live updates: there is no SwiftUI navigation container to re-render from.
7
+ public final class KitDesignSystem {
8
+ public static let shared = KitDesignSystem()
9
+
10
+ public private(set) var isWhiteList: Bool = false
11
+
12
+ private init() {}
13
+
14
+ public func update(isWhiteList: Bool) {
15
+ self.isWhiteList = isWhiteList
16
+ }
17
+ }
@@ -99,6 +99,30 @@ public extension TypographyStyle {
99
99
  }
100
100
  }
101
101
 
102
+ private func momoFontName(family: String, weight: Font.Weight) -> String? {
103
+ // Ngoai whitelist thi tra nil de momoFont() roi ve .system(...), dung nhu truoc DS-791.
104
+ guard KitDesignSystem.shared.isWhiteList else { return nil }
105
+ guard family == "MomoTrustSans" else { return nil }
106
+ switch weight {
107
+ case .ultraLight, .thin: return "MomoTrustSans-ExtraLight"
108
+ case .light: return "MomoTrustSans-Light"
109
+ case .regular: return "MomoTrustSans-Regular"
110
+ case .medium: return "MomoTrustSans-Medium"
111
+ case .semibold: return "MomoTrustSans-SemiBold"
112
+ case .bold: return "MomoTrustSans-Bold"
113
+ case .heavy, .black: return "MomoTrustSans-ExtraBold"
114
+ default: return "MomoTrustSans-Regular"
115
+ }
116
+ }
117
+
118
+ private func momoFont(size: CGFloat, weight: Font.Weight, family: String) -> Font {
119
+ guard let name = momoFontName(family: family, weight: weight),
120
+ UIFont(name: name, size: size) != nil else {
121
+ return .system(size: size, weight: weight)
122
+ }
123
+ return .custom(name, fixedSize: size)
124
+ }
125
+
102
126
  public struct MomoText: View {
103
127
  @Environment(\.appTheme) private var theme
104
128
  @Environment(\.momoFontScale) private var fontScale
@@ -159,7 +183,7 @@ public struct MomoText: View {
159
183
  let isStrikethrough = strikethrough || typography.isStrikethrough
160
184
 
161
185
  var text = SwiftUI.Text(content)
162
- .font(fontScale.font(size: typography.fontSize, weight: typography.fontWeight))
186
+ .font(momoFont(size: fontScale(typography.fontSize), weight: typography.fontWeight, family: theme.font))
163
187
  .foregroundColor(textColor)
164
188
  .strikethrough(isStrikethrough, color: textColor)
165
189
  .underline(underline, color: textColor)
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKits'
3
- s.version = '0.164.1-beta.9'
3
+ s.version = '0.164.1-headerconfig.1'
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.164.1-beta.9'
3
+ s.version = '0.164.1-headerconfig.1'
4
4
  s.summary = 'Demo browser for MoMoUIKits SwiftUI components'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
package/local.properties CHANGED
@@ -4,5 +4,5 @@
4
4
  # Location of the SDK. This is only used by Gradle.
5
5
  # For customization when using a Version Control System, please read the
6
6
  # header note.
7
- #Tue Jun 02 17:05:32 ICT 2026
8
- sdk.dir=/Users/sophia/Library/Android/sdk
7
+ #Tue May 19 15:41:04 GMT+07:00 2026
8
+ sdk.dir=/Users/phuc/Library/Android/sdk
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.164.1-beta.9-debug",
3
+ "version": "0.164.1-headerconfig.1-debug",
4
4
  "private": false,
5
5
  "dependeNavigationncies": {},
6
6
  "devDependencies": {},
package/publish.sh CHANGED
@@ -372,10 +372,34 @@ phase_publish_npm() {
372
372
  # FIRST PUBLISH: DEBUG VERSION (with compose kits included)
373
373
  # ============================================================
374
374
  echo ""
375
+ # A bad token surfaces as a 404 on the PUT, after the working tree was already rewritten
376
+ # below — so verify auth first, before anything is touched.
377
+ if ! npm whoami --registry https://registry.npmjs.org >/dev/null 2>&1; then
378
+ echo "❌ Error: npm auth failed (npm whoami). Renew the token in .npmrc / ~/.npmrc and retry."
379
+ exit 1
380
+ fi
381
+
375
382
  echo "🔧 Preparing debug version with compose kits..."
376
383
 
377
384
  # Create debug version
378
385
  DEBUG_VERSION="${VERSION}-debug"
386
+
387
+ # set -e aborts mid-phase on any failure; put the tree back no matter where it stopped.
388
+ # Idempotent: the happy path already moved the backups away and reset the version.
389
+ restore_npm_workspace() {
390
+ [ -f .npmignore.backup ] && mv .npmignore.backup .npmignore
391
+ [ -f compose/build.gradle.kts.backup ] && mv compose/build.gradle.kts.backup compose/build.gradle.kts
392
+ local pkg_version
393
+ pkg_version=$(node -p "require('./package.json').version")
394
+ if [ "$pkg_version" != "$VERSION" ]; then
395
+ if [[ "$OSTYPE" == "darwin"* ]]; then
396
+ sed -i '' "s/\"version\": \"$pkg_version\"/\"version\": \"$VERSION\"/" package.json
397
+ else
398
+ sed -i "s/\"version\": \"$pkg_version\"/\"version\": \"$VERSION\"/" package.json
399
+ fi
400
+ fi
401
+ }
402
+ trap restore_npm_workspace EXIT
379
403
  echo "📦 Debug version: $DEBUG_VERSION"
380
404
 
381
405
  # Get current version from package.json (in case it's different from $VERSION)
@@ -482,6 +506,7 @@ EOF
482
506
  npm publish --tag $NPM_TAG --access=public
483
507
 
484
508
  echo "✅ Normal version published successfully!"
509
+ trap - EXIT
485
510
 
486
511
  echo ""
487
512
  echo "✅ PHASE 3 COMPLETED"
@@ -1,65 +0,0 @@
1
- package vn.momo.kits.navigation
2
-
3
- import androidx.compose.runtime.Composable
4
- import androidx.compose.runtime.DisposableEffect
5
- import androidx.compose.runtime.remember
6
- import androidx.navigationevent.NavigationEventDispatcher
7
- import androidx.navigationevent.NavigationEventInput
8
-
9
- /**
10
- * Read-only answer to "will Compose consume this back?", for the iOS host.
11
- *
12
- * Compose owns the edge-pan gesture through its own `UIKitBackGestureRecognizer`; the host reads
13
- * this to decide whether to stand down or keep driving its own recogniser, instead of guessing.
14
- * Nothing here dispatches — [ObserveBackGestureOwnership] only listens.
15
- *
16
- * Pair it with [Navigator.canPop]: the mini-app root reports an enabled handler too (it swallows
17
- * back to reach `maxApi.dismiss`), yet there the host still owns the gesture.
18
- */
19
- object ComposeBackGesture {
20
- private val observers = mutableListOf<BackHandlerObserver>()
21
-
22
- /** State of the top-most mounted container; `false` when none is mounted. */
23
- val hasEnabledHandlers: Boolean
24
- get() = observers.lastOrNull()?.hasEnabledHandlers == true
25
-
26
- internal fun attach(observer: BackHandlerObserver) {
27
- observers += observer
28
- }
29
-
30
- internal fun detach(observer: BackHandlerObserver) {
31
- observers -= observer
32
- }
33
- }
34
-
35
- /**
36
- * Publishes one [NavigationContainer]'s back-handling state to [ComposeBackGesture] while composed.
37
- *
38
- * Only called for a container whose dispatcher is the scene's — a bare-`UIView` host gets the
39
- * detached fallback dispatcher, which can never receive an edge pan, so reporting its handlers
40
- * would tell the host to stand down in favour of a gesture that does not exist.
41
- */
42
- @Composable
43
- internal fun ObserveBackGestureOwnership(dispatcher: NavigationEventDispatcher) {
44
- val observer = remember(dispatcher) { BackHandlerObserver() }
45
-
46
- DisposableEffect(dispatcher, observer) {
47
- dispatcher.addInput(observer)
48
- ComposeBackGesture.attach(observer)
49
- onDispose {
50
- ComposeBackGesture.detach(observer)
51
- dispatcher.removeInput(observer)
52
- }
53
- }
54
- }
55
-
56
- // A NavigationEventInput that never dispatches: adding an input is the only way to observe the
57
- // dispatcher's enabled-handler state without registering a handler, which would consume the gesture.
58
- internal class BackHandlerObserver : NavigationEventInput() {
59
- var hasEnabledHandlers: Boolean = false
60
- private set
61
-
62
- override fun onHasEnabledHandlersChanged(hasEnabledHandlers: Boolean) {
63
- this.hasEnabledHandlers = hasEnabledHandlers
64
- }
65
- }