@momo-kits/native-kits 0.162.2-beta.26-debug → 0.162.2-beta.27-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 +1 -1
- 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 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +55 -40
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +2 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +75 -93
- package/gradle.properties +1 -1
- package/ios/Application/ApplicationEnvironment.swift +0 -11
- package/ios/Application/Components.swift +44 -34
- package/ios/Application/FloatingButton.swift +9 -10
- package/ios/Application/HeaderRight.swift +45 -79
- package/ios/Application/Screen.swift +1 -2
- package/ios/Badge/Badge.swift +14 -11
- package/ios/Badge/BadgeRibbon.swift +21 -12
- package/ios/Button/Button.swift +22 -61
- package/ios/Checkbox/Checkbox.swift +13 -14
- package/ios/Chip/Chip.swift +9 -23
- package/ios/Colors+Radius+Spacing/Colors.swift +12 -12
- package/ios/Extensions/Color++.swift +0 -32
- package/ios/Icon/Icon.swift +1 -6
- package/ios/Input/Input.swift +25 -41
- package/ios/Input/InputPhoneNumber.swift +19 -20
- package/ios/Input/InputSearch.swift +47 -100
- package/ios/Input/InputTextArea.swift +40 -66
- package/ios/Popup/PopupDisplay.swift +16 -8
- package/ios/Popup/PopupInput.swift +8 -2
- package/ios/Swipeable/SwipeCell.swift +0 -185
- package/ios/Swipeable/SwipeCellModel.swift +0 -21
- package/ios/Typography/Text.swift +5 -79
- package/ios/Typography/Typography.swift +0 -3
- package/ios/native-kits.podspec +8 -61
- package/package.json +1 -1
- package/publish.sh +0 -50
- package/.claude/settings.local.json +0 -39
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +0 -22
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
- package/ios/Application/Navigation/BottomTab/BottomTab.swift +0 -103
- package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +0 -215
- package/ios/Application/Navigation/BottomTab/CurvedContainer.swift +0 -65
- package/ios/Application/Navigation/HeaderBackProps.swift +0 -66
- package/ios/Application/Navigation/HeaderTitle.swift +0 -57
- package/ios/Application/Navigation/HeaderUser.swift +0 -209
- package/ios/Application/Navigation/NavigationContainer.swift +0 -176
- package/ios/Application/Navigation/NavigationOptions.swift +0 -109
- package/ios/Application/Navigation/Navigator.swift +0 -364
- package/ios/Application/Navigation/Overplay/BottomSheet.swift +0 -188
- package/ios/Application/Navigation/Overplay/ModalScreen.swift +0 -68
- package/ios/Application/Navigation/Overplay/SnackBar.swift +0 -144
- package/ios/Application/Navigation/component/Header.swift +0 -178
- package/ios/Application/Navigation/component/HeaderBackground.swift +0 -83
- package/ios/Application/Navigation/component/HeaderColor.swift +0 -65
- package/ios/Application/StackScreen.swift +0 -453
- package/ios/Avatar/Avatar.swift +0 -193
- package/ios/BaselineView/BaselineView.swift +0 -163
- package/ios/Carousel/Carousel.swift +0 -181
- package/ios/Collapse/Collapse.swift +0 -182
- package/ios/Colors+Radius+Spacing/Theme.swift +0 -295
- package/ios/DateTimePicker/DateTimePicker.swift +0 -210
- package/ios/DateTimePicker/DateTimePickerTypes.swift +0 -55
- package/ios/DateTimePicker/DateTimePickerUtils.swift +0 -167
- package/ios/DateTimePicker/WheelPicker.swift +0 -161
- package/ios/Divider/Divider.swift +0 -16
- package/ios/IconButton/IconButton.swift +0 -112
- package/ios/InputDropDown/InputDropDown.swift +0 -198
- package/ios/InputMoney/InputMoney.swift +0 -335
- package/ios/InputOTP/InputOTP.swift +0 -210
- package/ios/Loader/Loader.swift +0 -113
- package/ios/MoMoUIKits.podspec +0 -5
- package/ios/Pagination/PaginationDot.swift +0 -61
- package/ios/Pagination/PaginationNumber.swift +0 -35
- package/ios/Pagination/PaginationScroll.swift +0 -101
- package/ios/Pagination/PaginationWhiteDot.swift +0 -37
- package/ios/Popup/PopupNotify.swift +0 -219
- package/ios/ProgressInfo/ProgressInfo.swift +0 -294
- package/ios/Radio/Radio.swift +0 -70
- package/ios/Rating/Rating.swift +0 -82
- package/ios/Resources/MoMoUIKitsColors.xcassets/AccentColor.colorset/Contents.json +0 -11
- package/ios/Resources/MoMoUIKitsColors.xcassets/Background.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Border.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Card.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Contents.json +0 -6
- package/ios/Resources/MoMoUIKitsColors.xcassets/Error.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Primary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryDark.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryLight.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Secondary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Success.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Text.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/TextSecondary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/Contents.json +0 -9
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-default.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-disable.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-pressed.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-selected.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-surface.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-tonal.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-default.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-disable.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/gradient.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/primary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/secondary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-container.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-primary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-secondary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-default.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-disable.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-hint.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-secondary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Warning.colorset/Contents.json +0 -38
- package/ios/Skeleton/Skeleton.swift +0 -99
- package/ios/Slider/Slider.swift +0 -237
- package/ios/Stepper/Stepper.swift +0 -220
- package/ios/Steps/Steps.swift +0 -451
- package/ios/SuggestAction/SuggestAction.swift +0 -97
- package/ios/TabView/TabView.swift +0 -530
- package/ios/Tag/Tag.swift +0 -98
- package/ios/Title/Title.swift +0 -269
- package/ios/Tooltip/Tooltip.swift +0 -482
- package/ios/Typography/FontScaleStore.swift +0 -19
- package/ios/Uploader/Uploader.swift +0 -183
- package/ios-demo/MoMoUIKitsDemo.podspec +0 -20
- package/ios-demo/README.md +0 -120
- package/ios-demo/Resources/dot_loading.json +0 -558
- package/ios-demo/Resources/icon.json +0 -4052
- package/ios-demo/Resources/lottie_circle_loader.json +0 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/DemoScaffold.swift +0 -48
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsBadgeDemoView.swift +0 -25
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsButtonDemoView.swift +0 -26
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsCheckboxDemoView.swift +0 -19
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsChipDemoView.swift +0 -33
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsInputDemoView.swift +0 -48
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsPopupDemoView.swift +0 -21
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsRadioDemoView.swift +0 -17
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsTypographyDemoView.swift +0 -28
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoContext.swift +0 -31
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoFactory.swift +0 -24
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +0 -110
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AvatarDemo.swift +0 -93
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +0 -269
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BaselineView.swift +0 -117
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +0 -89
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ButtonDemo.swift +0 -100
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +0 -126
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +0 -63
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +0 -20
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +0 -93
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +0 -107
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +0 -124
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +0 -14
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/HeaderUserDemo.swift +0 -49
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +0 -278
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +0 -58
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +0 -78
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +0 -138
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +0 -111
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +0 -136
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +0 -107
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +0 -73
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +0 -100
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +0 -32
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +0 -57
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +0 -70
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +0 -227
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +0 -72
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +0 -175
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +0 -121
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +0 -76
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +0 -89
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +0 -32
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +0 -56
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +0 -32
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +0 -150
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +0 -138
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +0 -103
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +0 -94
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +0 -79
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +0 -152
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +0 -33
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +0 -190
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +0 -34
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +0 -182
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +0 -109
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +0 -187
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +0 -87
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +0 -131
- package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +0 -51
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +0 -15
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +0 -73
- package/local.properties +0 -8
- package/scripts/gen-ios-color.mjs +0 -136
package/CLAUDE.md
CHANGED
|
@@ -40,7 +40,7 @@ Publishing is automated (`publish.sh` + GitLab CI on `[ci build]` / `main`). Do
|
|
|
40
40
|
## Architecture essentials
|
|
41
41
|
|
|
42
42
|
- **Entry point:** wrap content in `NavigationContainer(...)` from `navigation/`. It builds the `Navigator`, takes a host-supplied `Localize` (falls back to an empty one), and provides the CompositionLocals below. **Do not use** `ApplicationContainer` (`application/NavigationContainer.kt`) — deprecated and does **not** wire `LocalLocalize` / `LocalNavigator` / `LocalMaxApi`.
|
|
43
|
-
- **Configuration flows via CompositionLocals**, not params. Public ones: `AppTheme`, `AppStatusBar`, `AppNavigationBar` (`const/Theme.kt`); `ApplicationContext`, `AppConfig`, `AppLanguage`, `LocalLocalize` (`application/`); `LocalNavigator`, `LocalMaxApi` (`navigation/`). Read with `X.current`.
|
|
43
|
+
- **Configuration flows via CompositionLocals**, not params. Public ones: `AppTheme`, `AppStatusBar`, `AppNavigationBar` (`const/Theme.kt`); `ApplicationContext`, `AppConfig`, `AppLanguage`, `LocalLocalize`, `ScaleSizeMaxRate` (`application/`); `LocalNavigator`, `LocalMaxApi` (`navigation/`). Read with `X.current`.
|
|
44
44
|
- **Platform code** goes through `expect`/`actual` in `platform/` — never reference Android/iOS APIs from `commonMain` directly.
|
|
45
45
|
- **Native bridge:** `IMaxApi` (`vn.momo.maxapi`, exposed as `LocalMaxApi`) is the host-app bridge (dismiss, tracking, device info, language).
|
|
46
46
|
- Navigation uses a runtime `DynamicScreenRegistry`; overlays (modal/bottom-sheet/snackbar) go through `Navigator` + `OverplayComponentRegistry`.
|
package/compose/build.gradle.kts
CHANGED
package/compose/compose.podspec
CHANGED
|
@@ -29,8 +29,6 @@ data class MiniAppContext(
|
|
|
29
29
|
val permissions: List<Map<String, Any>>? = emptyList(),
|
|
30
30
|
val features: FeatureFlags? = null,
|
|
31
31
|
val scaleSizeMaxRate: Float? = null,
|
|
32
|
-
val userScaleRate: Float? = null,
|
|
33
|
-
val useOSScaleRate: Boolean? = null,
|
|
34
32
|
) {
|
|
35
33
|
companion object {
|
|
36
34
|
|
|
@@ -63,8 +61,6 @@ data class MiniAppContext(
|
|
|
63
61
|
permissions = if (!parent.permissions.isNullOrEmpty()) parent.permissions else child.permissions,
|
|
64
62
|
features = mergeFeatureFlags(parent.features, child.features),
|
|
65
63
|
scaleSizeMaxRate = parent.scaleSizeMaxRate ?: child.scaleSizeMaxRate,
|
|
66
|
-
userScaleRate = parent.userScaleRate ?: child.userScaleRate,
|
|
67
|
-
useOSScaleRate = parent.useOSScaleRate ?: child.useOSScaleRate,
|
|
68
64
|
)
|
|
69
65
|
}
|
|
70
66
|
|
|
@@ -102,5 +98,4 @@ val LocalComponentInformation = staticCompositionLocalOf<ComponentInformation?>
|
|
|
102
98
|
null
|
|
103
99
|
}
|
|
104
100
|
|
|
105
|
-
@Deprecated("Max font scale is fixed at MAX_FONT_SCALE (1.5); this CompositionLocal is no longer read.")
|
|
106
101
|
val ScaleSizeMaxRate = staticCompositionLocalOf<Float?> { null }
|
|
@@ -7,7 +7,6 @@ import androidx.compose.ui.Modifier
|
|
|
7
7
|
import androidx.compose.ui.unit.Dp
|
|
8
8
|
import vn.momo.kits.const.*
|
|
9
9
|
import vn.momo.kits.modifier.DeprecatedModifier
|
|
10
|
-
import vn.momo.kits.platform.ProvideOsFontScale
|
|
11
10
|
import vn.momo.kits.platform.getStatusBarHeight
|
|
12
11
|
|
|
13
12
|
@Deprecated("Use IMaxApi instead", ReplaceWith("IMaxApi"))
|
|
@@ -94,7 +93,6 @@ fun ApplicationContainer(
|
|
|
94
93
|
|
|
95
94
|
val appStatusBarHeight = statusBarHeight ?: getStatusBarHeight()
|
|
96
95
|
|
|
97
|
-
ProvideOsFontScale {
|
|
98
96
|
CompositionLocalProvider(
|
|
99
97
|
AppTheme provides appTheme,
|
|
100
98
|
PlatformApi provides composeApi,
|
|
@@ -105,6 +103,5 @@ fun ApplicationContainer(
|
|
|
105
103
|
content()
|
|
106
104
|
}
|
|
107
105
|
}
|
|
108
|
-
}
|
|
109
106
|
|
|
110
107
|
}
|
|
@@ -5,7 +5,6 @@ import androidx.compose.foundation.border
|
|
|
5
5
|
import androidx.compose.foundation.clickable
|
|
6
6
|
import androidx.compose.foundation.layout.Box
|
|
7
7
|
import androidx.compose.foundation.layout.size
|
|
8
|
-
import androidx.compose.foundation.shape.CircleShape
|
|
9
8
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
10
9
|
import androidx.compose.runtime.Composable
|
|
11
10
|
import androidx.compose.runtime.remember
|
|
@@ -13,7 +12,6 @@ import androidx.compose.ui.Alignment
|
|
|
13
12
|
import androidx.compose.ui.Modifier
|
|
14
13
|
import androidx.compose.ui.draw.clip
|
|
15
14
|
import androidx.compose.ui.graphics.Color
|
|
16
|
-
import androidx.compose.ui.graphics.Shape
|
|
17
15
|
import androidx.compose.ui.unit.Dp
|
|
18
16
|
import androidx.compose.ui.unit.dp
|
|
19
17
|
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
@@ -23,58 +21,69 @@ import vn.momo.kits.const.Radius
|
|
|
23
21
|
import vn.momo.kits.modifier.conditional
|
|
24
22
|
|
|
25
23
|
data class IconSpecs(
|
|
26
|
-
val
|
|
27
|
-
val
|
|
24
|
+
val width: Dp,
|
|
25
|
+
val height: Dp,
|
|
26
|
+
val radius: Dp,
|
|
27
|
+
val size: Dp
|
|
28
28
|
)
|
|
29
29
|
|
|
30
30
|
enum class IconSize(val value: IconSpecs) {
|
|
31
|
-
LARGE(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
LARGE(
|
|
32
|
+
IconSpecs(
|
|
33
|
+
height = 48.dp,
|
|
34
|
+
radius = Radius.XL,
|
|
35
|
+
width = 48.dp,
|
|
36
|
+
size = 48.dp
|
|
37
|
+
)
|
|
38
|
+
),
|
|
39
|
+
SMALL(
|
|
40
|
+
IconSpecs(
|
|
41
|
+
height = 40.dp,
|
|
42
|
+
radius = Radius.XL,
|
|
43
|
+
width = 40.dp,
|
|
44
|
+
size = 40.dp
|
|
45
|
+
)
|
|
46
|
+
)
|
|
39
47
|
}
|
|
40
48
|
|
|
41
|
-
//
|
|
42
|
-
private val
|
|
49
|
+
// Pre-computed shape to avoid repeated creation
|
|
50
|
+
private val iconButtonShape = RoundedCornerShape(Radius.XL)
|
|
43
51
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
// Cache for icon sizes to avoid repeated calculations
|
|
53
|
+
private val iconSizeMap = mapOf(
|
|
54
|
+
IconSize.SMALL to 16.dp,
|
|
55
|
+
IconSize.LARGE to 24.dp
|
|
56
|
+
)
|
|
48
57
|
|
|
49
58
|
@Composable
|
|
50
|
-
internal fun getIconStyle(type: ButtonType,
|
|
59
|
+
internal fun getIconStyle(type: ButtonType, color: Color? = null): Modifier {
|
|
51
60
|
val theme = AppTheme.current
|
|
52
61
|
|
|
53
|
-
return remember(type,
|
|
62
|
+
return remember(type, color, theme) {
|
|
54
63
|
when (type) {
|
|
55
64
|
ButtonType.DISABLED -> Modifier
|
|
56
|
-
.background(theme.colors.background.disable,
|
|
57
|
-
.border(0.dp, Color.Unspecified,
|
|
65
|
+
.background(theme.colors.background.disable, iconButtonShape)
|
|
66
|
+
.border(0.dp, Color.Unspecified, iconButtonShape)
|
|
58
67
|
|
|
59
68
|
ButtonType.PRIMARY -> Modifier
|
|
60
|
-
.background(theme.colors.primary,
|
|
61
|
-
.border(0.dp, Color.Unspecified,
|
|
69
|
+
.background(theme.colors.primary, iconButtonShape)
|
|
70
|
+
.border(0.dp, Color.Unspecified, iconButtonShape)
|
|
62
71
|
|
|
63
72
|
ButtonType.SECONDARY -> Modifier
|
|
64
|
-
.background(theme.colors.background.surface,
|
|
65
|
-
.border(1.dp, theme.colors.border.default,
|
|
73
|
+
.background(theme.colors.background.surface, iconButtonShape)
|
|
74
|
+
.border(1.dp, theme.colors.border.default, iconButtonShape)
|
|
66
75
|
|
|
67
76
|
ButtonType.OUTLINE -> Modifier
|
|
68
|
-
.background(theme.colors.background.surface,
|
|
69
|
-
.border(1.dp, color ?: theme.colors.primary,
|
|
77
|
+
.background(theme.colors.background.surface, iconButtonShape)
|
|
78
|
+
.border(1.dp, color ?: theme.colors.primary, iconButtonShape)
|
|
70
79
|
|
|
71
80
|
ButtonType.TONAL -> Modifier
|
|
72
|
-
.background(theme.colors.background.tonal,
|
|
73
|
-
.border(0.dp, Color.Unspecified,
|
|
81
|
+
.background(theme.colors.background.tonal, iconButtonShape)
|
|
82
|
+
.border(0.dp, Color.Unspecified, iconButtonShape)
|
|
74
83
|
|
|
75
84
|
ButtonType.DANGER -> Modifier
|
|
76
|
-
.background(theme.colors.error.primary,
|
|
77
|
-
.border(0.dp, Color.Unspecified,
|
|
85
|
+
.background(theme.colors.error.primary, iconButtonShape)
|
|
86
|
+
.border(0.dp, Color.Unspecified, iconButtonShape)
|
|
78
87
|
|
|
79
88
|
ButtonType.TEXT -> Modifier
|
|
80
89
|
}
|
|
@@ -94,32 +103,38 @@ fun IconButton(
|
|
|
94
103
|
onClick: () -> Unit,
|
|
95
104
|
type: ButtonType = ButtonType.PRIMARY,
|
|
96
105
|
size: IconSize = IconSize.SMALL,
|
|
97
|
-
shape: IconShape = IconShape.CIRCLE,
|
|
98
106
|
icon: String = "",
|
|
99
107
|
) {
|
|
100
|
-
|
|
108
|
+
// Memoize icon size calculation
|
|
109
|
+
val iconSize = remember(size) {
|
|
110
|
+
iconSizeMap[size] ?: 16.dp
|
|
111
|
+
}
|
|
101
112
|
|
|
113
|
+
// Memoize enabled state
|
|
102
114
|
val isEnabled = remember(type) {
|
|
103
115
|
type != ButtonType.DISABLED
|
|
104
116
|
}
|
|
105
117
|
|
|
106
|
-
|
|
118
|
+
// Memoize radius for clipping
|
|
119
|
+
val radius = remember(size) {
|
|
120
|
+
size.value.radius
|
|
121
|
+
}
|
|
107
122
|
|
|
108
123
|
Box(
|
|
109
124
|
modifier = Modifier
|
|
110
|
-
.size(
|
|
111
|
-
.then(getIconStyle(type
|
|
125
|
+
.size(size.value.size)
|
|
126
|
+
.then(getIconStyle(type))
|
|
112
127
|
.conditional(IsShowBaseLineDebug) {
|
|
113
128
|
border(1.dp, Colors.blue_03)
|
|
114
129
|
}
|
|
115
|
-
.clip(
|
|
130
|
+
.clip(RoundedCornerShape(radius))
|
|
116
131
|
.clickable(enabled = isEnabled, onClick = onClick),
|
|
117
132
|
contentAlignment = Alignment.Center
|
|
118
133
|
) {
|
|
119
134
|
Icon(
|
|
120
135
|
source = icon,
|
|
121
136
|
color = getIconColor(type),
|
|
122
|
-
size =
|
|
137
|
+
size = iconSize,
|
|
123
138
|
)
|
|
124
139
|
}
|
|
125
|
-
}
|
|
140
|
+
}
|
|
@@ -4,10 +4,6 @@ import androidx.compose.runtime.Composable
|
|
|
4
4
|
import androidx.compose.runtime.CompositionLocalProvider
|
|
5
5
|
import vn.momo.kits.application.ScaleSizeMaxRate
|
|
6
6
|
|
|
7
|
-
@Deprecated(
|
|
8
|
-
"Max font scale is fixed at MAX_FONT_SCALE (1.5); this override is no longer applied. Remove the wrapper.",
|
|
9
|
-
ReplaceWith("content()"),
|
|
10
|
-
)
|
|
11
7
|
@Composable
|
|
12
8
|
fun ScaleSizeScope(
|
|
13
9
|
scaleSizeMaxRate: Float? = null,
|
|
@@ -11,7 +11,7 @@ import androidx.compose.ui.unit.*
|
|
|
11
11
|
import org.jetbrains.compose.resources.Font
|
|
12
12
|
import org.jetbrains.compose.resources.FontResource
|
|
13
13
|
import org.jetbrains.compose.resources.InternalResourceApi
|
|
14
|
-
import vn.momo.kits.application.
|
|
14
|
+
import vn.momo.kits.application.ScaleSizeMaxRate
|
|
15
15
|
import vn.momo.kits.platform.getScreenDimensions
|
|
16
16
|
import vn.momo.uikits.resources.*
|
|
17
17
|
import kotlin.math.max
|
|
@@ -23,13 +23,7 @@ const val MAX_DEVICE_SCALE = 5
|
|
|
23
23
|
|
|
24
24
|
@Composable
|
|
25
25
|
fun scaleSize(size: Float): Float {
|
|
26
|
-
val
|
|
27
|
-
// Host-pushed context wins; otherwise fall back to the app-wide KitFontScale holder.
|
|
28
|
-
val useOsScale = context?.useOSScaleRate ?: KitFontScale.useOSScaleRate
|
|
29
|
-
if (!useOsScale) {
|
|
30
|
-
return size * (context?.userScaleRate ?: KitFontScale.userScaleRate)
|
|
31
|
-
}
|
|
32
|
-
val scaleSizeMaxRate: Float = MAX_FONT_SCALE
|
|
26
|
+
val scaleSizeMaxRate: Float = ScaleSizeMaxRate.current ?: MAX_FONT_SCALE
|
|
33
27
|
val deviceWidth = getScreenDimensions().width
|
|
34
28
|
val deviceScale = deviceWidth / DEFAULT_SCREEN_SIZE
|
|
35
29
|
|
|
@@ -1,35 +1,17 @@
|
|
|
1
1
|
package vn.momo.kits.navigation
|
|
2
2
|
|
|
3
|
+
import androidx.compose.animation.*
|
|
3
4
|
import androidx.compose.animation.core.tween
|
|
4
|
-
import androidx.compose.
|
|
5
|
-
import androidx.compose.animation.slideInHorizontally
|
|
6
|
-
import androidx.compose.animation.slideInVertically
|
|
7
|
-
import androidx.compose.animation.slideOutHorizontally
|
|
8
|
-
import androidx.compose.animation.slideOutVertically
|
|
9
|
-
import androidx.compose.runtime.Composable
|
|
10
|
-
import androidx.compose.runtime.CompositionLocalProvider
|
|
11
|
-
import androidx.compose.runtime.DisposableEffect
|
|
12
|
-
import androidx.compose.runtime.LaunchedEffect
|
|
13
|
-
import androidx.compose.runtime.mutableStateOf
|
|
14
|
-
import androidx.compose.runtime.remember
|
|
5
|
+
import androidx.compose.runtime.*
|
|
15
6
|
import androidx.compose.runtime.saveable.rememberSaveable
|
|
16
|
-
import androidx.compose.runtime.staticCompositionLocalOf
|
|
17
7
|
import androidx.compose.ui.unit.Dp
|
|
18
8
|
import androidx.navigation.compose.NavHost
|
|
19
9
|
import androidx.navigation.compose.composable
|
|
20
10
|
import androidx.navigation.compose.rememberNavController
|
|
21
11
|
import androidx.navigation.toRoute
|
|
22
|
-
import vn.momo.kits.application
|
|
23
|
-
import vn.momo.kits.
|
|
24
|
-
import vn.momo.kits.application.Localize
|
|
25
|
-
import vn.momo.kits.application.MiniAppContext
|
|
26
|
-
import vn.momo.kits.const.AppNavigationBar
|
|
27
|
-
import vn.momo.kits.const.AppStatusBar
|
|
28
|
-
import vn.momo.kits.const.AppTheme
|
|
29
|
-
import vn.momo.kits.const.Theme
|
|
30
|
-
import vn.momo.kits.const.defaultTheme
|
|
12
|
+
import vn.momo.kits.application.*
|
|
13
|
+
import vn.momo.kits.const.*
|
|
31
14
|
import vn.momo.kits.platform.ProvideNavigationEventDispatcherOwner
|
|
32
|
-
import vn.momo.kits.platform.ProvideOsFontScale
|
|
33
15
|
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
34
16
|
import vn.momo.kits.utils.getNavigationBarHeight
|
|
35
17
|
import vn.momo.maxapi.IMaxApi
|
|
@@ -45,7 +27,7 @@ fun NavigationContainer(
|
|
|
45
27
|
setNavigator: ((Navigator) -> Unit)? = null,
|
|
46
28
|
statusBarHeight: Dp? = null,
|
|
47
29
|
localize: Localize? = null,
|
|
48
|
-
)
|
|
30
|
+
){
|
|
49
31
|
val navController = rememberNavController()
|
|
50
32
|
val registry = remember { DynamicScreenRegistry() }
|
|
51
33
|
val navigator = remember { Navigator(navController = navController, maxApi = maxApi, registry = registry) }
|
|
@@ -75,79 +57,77 @@ fun NavigationContainer(
|
|
|
75
57
|
registry.bind(screenId, initialScreenName, initialScreen, options)
|
|
76
58
|
val startDestination = remember(screenId) { DynamicScreenRoute(screenId) }
|
|
77
59
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
LocalLocalize provides resolvedLocalize,
|
|
60
|
+
ProvideNavigationEventDispatcherOwner {
|
|
61
|
+
CompositionLocalProvider(
|
|
62
|
+
LocalNavigator provides navigator,
|
|
63
|
+
LocalDynamicScreenRegistry provides registry,
|
|
64
|
+
LocalMaxApi provides maxApi,
|
|
65
|
+
AppTheme provides theme.value,
|
|
66
|
+
AppStatusBar provides statusBarHeight,
|
|
67
|
+
AppNavigationBar provides navigationBarHeight,
|
|
68
|
+
LocalContext provides mergedContext,
|
|
69
|
+
LocalLocalize provides resolvedLocalize,
|
|
89
70
|
) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
71
|
+
LaunchedEffect(Unit) {
|
|
72
|
+
setNavigator?.invoke(navigator)
|
|
73
|
+
}
|
|
93
74
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
75
|
+
NavHost(navController, startDestination = startDestination) {
|
|
76
|
+
composable<DynamicScreenRoute>(
|
|
77
|
+
enterTransition = {
|
|
78
|
+
slideInHorizontally(
|
|
79
|
+
animationSpec = tween(300),
|
|
80
|
+
initialOffsetX = { it }
|
|
81
|
+
)
|
|
82
|
+
},
|
|
83
|
+
exitTransition = null,
|
|
84
|
+
popEnterTransition = { fadeIn(animationSpec = tween(0)) },
|
|
85
|
+
popExitTransition = {
|
|
86
|
+
slideOutHorizontally(
|
|
87
|
+
animationSpec = tween(300),
|
|
88
|
+
targetOffsetX = { it }
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
) { backStackEntry ->
|
|
92
|
+
val route = backStackEntry.toRoute<DynamicScreenRoute>()
|
|
93
|
+
val screen = registry.getScreen(route.id)
|
|
94
|
+
|
|
95
|
+
if (screen != null) {
|
|
96
|
+
StackScreen(
|
|
97
|
+
id = route.id,
|
|
98
|
+
name = screen.name,
|
|
99
|
+
content = screen.content,
|
|
100
|
+
navigationOptions = screen.options
|
|
101
|
+
)
|
|
122
102
|
}
|
|
103
|
+
}
|
|
123
104
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
105
|
+
composable<DynamicDialogRoute>(
|
|
106
|
+
enterTransition = {
|
|
107
|
+
slideInVertically(
|
|
108
|
+
animationSpec = tween(300),
|
|
109
|
+
initialOffsetY = { it }
|
|
110
|
+
)
|
|
111
|
+
},
|
|
112
|
+
exitTransition = null,
|
|
113
|
+
popEnterTransition = { fadeIn(animationSpec = tween(0)) },
|
|
114
|
+
popExitTransition = {
|
|
115
|
+
slideOutVertically(
|
|
116
|
+
animationSpec = tween(300),
|
|
117
|
+
targetOffsetY = { it }
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
) { backStackEntry ->
|
|
121
|
+
val route = backStackEntry.toRoute<DynamicDialogRoute>()
|
|
122
|
+
val screen = registry.getScreen(route.id)
|
|
123
|
+
|
|
124
|
+
if (screen != null) {
|
|
125
|
+
StackScreen(
|
|
126
|
+
id = route.id,
|
|
127
|
+
name = screen.name,
|
|
128
|
+
content = screen.content,
|
|
129
|
+
navigationOptions = screen.options
|
|
130
|
+
)
|
|
151
131
|
}
|
|
152
132
|
}
|
|
153
133
|
}
|
|
@@ -162,7 +142,9 @@ fun NavigationContainer(
|
|
|
162
142
|
}
|
|
163
143
|
}
|
|
164
144
|
|
|
165
|
-
val LocalMaxApi = staticCompositionLocalOf<IMaxApi?> {
|
|
145
|
+
val LocalMaxApi = staticCompositionLocalOf<IMaxApi?> {
|
|
146
|
+
error("No MaxApi provided")
|
|
147
|
+
}
|
|
166
148
|
|
|
167
149
|
private fun parseLanguage(raw: Map<String, Any?>?): String? {
|
|
168
150
|
val code = (raw?.get("response") as? String)?.trim()?.lowercase()
|
package/gradle.properties
CHANGED
|
@@ -48,14 +48,3 @@ public class ApplicationEnvironment: ObservableObject {
|
|
|
48
48
|
self.config = config
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
private struct ApplicationEnvironmentKey: EnvironmentKey {
|
|
53
|
-
static let defaultValue = ApplicationEnvironment()
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
public extension EnvironmentValues {
|
|
57
|
-
var applicationEnvironment: ApplicationEnvironment {
|
|
58
|
-
get { self[ApplicationEnvironmentKey.self] }
|
|
59
|
-
set { self[ApplicationEnvironmentKey.self] = newValue }
|
|
60
|
-
}
|
|
61
|
-
}
|