@momo-kits/native-kits 0.167.1-beta.15-debug → 0.167.1-beta.16-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.
- package/CLAUDE.md +6 -4
- package/compose/build.gradle.kts +1 -1
- package/compose/compose.podspec +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -14
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +62 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +5 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +2 -2
- package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -38
- package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Example.xcscheme +32 -0
- package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/WorkspaceSettings.xcsettings +16 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +6 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +5 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Pods-Example.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImage.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SkeletonUI.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios-LottiePrivacyInfo.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +60 -0
- package/gradle.properties +1 -1
- package/ios/Application/ApplicationEnvironment.swift +13 -6
- package/ios/Application/DesignSystemKits.swift +100 -0
- package/ios/Application/DesignSystemKitsPayload.swift +68 -0
- package/ios/Template/TrustBanner/TrustBanner.swift +39 -7
- package/ios/Typography/FontScale.swift +14 -11
- package/ios/Typography/Text.swift +19 -7
- package/ios/Typography/Typography.swift +2 -2
- package/ios/native-kits.podspec +1 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/local.properties +8 -0
- package/package.json +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitDesignSystem.kt +0 -18
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +0 -22
- package/ios/Typography/FontScaleStore.swift +0 -58
- package/ios/Typography/KitDesignSystem.swift +0 -17
|
@@ -10,12 +10,12 @@ public extension View {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
public extension Font {
|
|
13
|
-
/// Non-reactive: resolves against the current `
|
|
13
|
+
/// Non-reactive: resolves against the current `DesignSystemKits` font scale at each access. The
|
|
14
14
|
/// styles below are computed properties for that reason — as stored `static let`s they would
|
|
15
15
|
/// freeze the scale at first access and never pick up a Dynamic Type change.
|
|
16
16
|
/// Inside a view, `@Environment(\.momoFontScale)` + `fontScale.font(size:weight:)` also re-renders.
|
|
17
17
|
static func appFont(size: CGFloat) -> Font {
|
|
18
|
-
|
|
18
|
+
DesignSystemKits.shared.fontScale.font(size: size)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
// New supported typography styles
|
package/ios/native-kits.podspec
CHANGED
package/local.properties
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## This file must *NOT* be checked into Version Control Systems,
|
|
2
|
+
# as it contains information specific to your local configuration.
|
|
3
|
+
#
|
|
4
|
+
# Location of the SDK. This is only used by Gradle.
|
|
5
|
+
# For customization when using a Version Control System, please read the
|
|
6
|
+
# header note.
|
|
7
|
+
#Tue Apr 08 11:13:31 ICT 2025
|
|
8
|
+
sdk.dir=/Users/sonnguyen/Library/Android/sdk
|
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.const
|
|
2
|
-
|
|
3
|
-
import androidx.compose.runtime.getValue
|
|
4
|
-
import androidx.compose.runtime.mutableStateOf
|
|
5
|
-
import androidx.compose.runtime.setValue
|
|
6
|
-
|
|
7
|
-
// Design-system rollout holder, same shape as KitFontScale: the kit is sandboxed and can't read the
|
|
8
|
-
// host config, so the host seeds this once at startup from DesignSystemConfig. getFontFamily() reads
|
|
9
|
-
// it to decide whether the new default font applies, so every screen follows the flag with no prop
|
|
10
|
-
// threading. Backed by snapshot state: writes recompose text automatically.
|
|
11
|
-
object KitDesignSystem {
|
|
12
|
-
var isWhiteList by mutableStateOf(false)
|
|
13
|
-
private set
|
|
14
|
-
|
|
15
|
-
fun update(isWhiteList: Boolean) {
|
|
16
|
-
this.isWhiteList = isWhiteList
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.const
|
|
2
|
-
|
|
3
|
-
import androidx.compose.runtime.getValue
|
|
4
|
-
import androidx.compose.runtime.mutableStateOf
|
|
5
|
-
import androidx.compose.runtime.setValue
|
|
6
|
-
|
|
7
|
-
// App-wide font-scale holder. The kit is sandboxed and can't read the host cache directly, so the
|
|
8
|
-
// host (which sees both core and this kit) seeds this once at startup and pushes runtime updates into
|
|
9
|
-
// it. scaleSize() reads it as the fallback, so every screen — including direct NavigationContainer
|
|
10
|
-
// screens with no host-pushed MiniAppContext — scales with no per-render prop and no async flicker.
|
|
11
|
-
// Backed by snapshot state: writes recompose text automatically.
|
|
12
|
-
object KitFontScale {
|
|
13
|
-
var userScaleRate by mutableStateOf(1f)
|
|
14
|
-
private set
|
|
15
|
-
var useOSScaleRate by mutableStateOf(true)
|
|
16
|
-
private set
|
|
17
|
-
|
|
18
|
-
fun update(userScaleRate: Float, useOSScaleRate: Boolean) {
|
|
19
|
-
this.userScaleRate = userScaleRate
|
|
20
|
-
this.useOSScaleRate = useOSScaleRate
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import SwiftUI
|
|
2
|
-
|
|
3
|
-
/// App-wide font-scale inputs for the SwiftUI kit, and the single place they publish from.
|
|
4
|
-
/// The host writes `update(...)` at startup (from the cache-backed `FontScaleProvider`) and again
|
|
5
|
-
/// whenever the in-app font-size preference changes; the OS Dynamic Type factor is tracked here.
|
|
6
|
-
/// Mirrors Compose's `KitFontScale` + `ProvideOsFontScale` pair, including its live behaviour —
|
|
7
|
-
/// views re-render on change as long as the subtree got `.momoFontScale()` (`NavigationContainer`
|
|
8
|
-
/// applies it). When `useOSScaleRate` is false the kit applies `userScaleRate` instead of the OS factor.
|
|
9
|
-
public final class FontScaleStore: ObservableObject {
|
|
10
|
-
public static let shared = FontScaleStore()
|
|
11
|
-
|
|
12
|
-
@Published public private(set) var userScaleRate: CGFloat = 1
|
|
13
|
-
@Published public private(set) var useOSScaleRate: Bool = true
|
|
14
|
-
@Published public private(set) var osFontScale: CGFloat = FontScaleStore.currentOsFontScale()
|
|
15
|
-
|
|
16
|
-
private init() {
|
|
17
|
-
NotificationCenter.default.addObserver(
|
|
18
|
-
self,
|
|
19
|
-
selector: #selector(contentSizeCategoryDidChange),
|
|
20
|
-
name: UIContentSizeCategory.didChangeNotification,
|
|
21
|
-
object: nil
|
|
22
|
-
)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public var snapshot: FontScale {
|
|
26
|
-
FontScale(
|
|
27
|
-
userScaleRate: userScaleRate,
|
|
28
|
-
useOSScaleRate: useOSScaleRate,
|
|
29
|
-
osFontScale: osFontScale
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public func update(userScaleRate: CGFloat, useOSScaleRate: Bool) {
|
|
34
|
-
onMain {
|
|
35
|
-
// Re-assigning an unchanged value would still publish and invalidate every kit subtree.
|
|
36
|
-
if self.userScaleRate != userScaleRate { self.userScaleRate = userScaleRate }
|
|
37
|
-
if self.useOSScaleRate != useOSScaleRate { self.useOSScaleRate = useOSScaleRate }
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@objc private func contentSizeCategoryDidChange() {
|
|
42
|
-
let next = Self.currentOsFontScale()
|
|
43
|
-
guard next != osFontScale else { return }
|
|
44
|
-
osFontScale = next
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/// Same factor Compose's iOS `ProvideOsFontScale` derives from
|
|
48
|
-
/// `UIFont.preferredFont(forTextStyle: .body).pointSize / 17`, so both iOS surfaces scale alike.
|
|
49
|
-
static func currentOsFontScale() -> CGFloat {
|
|
50
|
-
let base = UIFont.systemFont(ofSize: UIFont.labelFontSize)
|
|
51
|
-
return UIFontMetrics.default.scaledFont(for: base).pointSize / base.pointSize
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/// Synchronous when already on main — an async hop would defer the change by a frame.
|
|
55
|
-
private func onMain(_ work: @escaping () -> Void) {
|
|
56
|
-
if Thread.isMainThread { work() } else { DispatchQueue.main.async(execute: work) }
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
}
|