@momo-kits/native-kits 0.0.1-beta.4 → 0.0.2-alpha.1

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 (296) hide show
  1. package/CLAUDE.md +99 -0
  2. package/PUBLISH_GUIDE.md +675 -0
  3. package/README.md +184 -5
  4. package/ios/Application/ApplicationEnvironment.swift +71 -0
  5. package/ios/Application/Components.swift +270 -0
  6. package/ios/Application/ComposeApi.swift +22 -0
  7. package/ios/Application/FloatingButton.swift +174 -0
  8. package/ios/Application/HeaderRight.swift +306 -0
  9. package/ios/Application/LanguageSource.swift +93 -0
  10. package/ios/Application/Localize.swift +378 -0
  11. package/ios/Application/LocalizeModifier.swift +30 -0
  12. package/ios/Application/MaxApi.swift +18 -0
  13. package/ios/Application/Navigation/BottomTab/BottomTab.swift +104 -0
  14. package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +215 -0
  15. package/ios/Application/Navigation/BottomTab/CurvedContainer.swift +65 -0
  16. package/ios/Application/Navigation/HeaderBackProps.swift +66 -0
  17. package/ios/Application/Navigation/HeaderTitle.swift +57 -0
  18. package/ios/Application/Navigation/HeaderUser.swift +209 -0
  19. package/ios/Application/Navigation/NavigationContainer.swift +213 -0
  20. package/ios/Application/Navigation/NavigationOptions.swift +109 -0
  21. package/ios/Application/Navigation/Navigator.swift +453 -0
  22. package/ios/Application/Navigation/NavigatorManager.swift +22 -0
  23. package/ios/Application/Navigation/Overplay/BottomSheet.swift +256 -0
  24. package/ios/Application/Navigation/Overplay/ModalScreen.swift +74 -0
  25. package/ios/Application/Navigation/Overplay/SnackBar.swift +144 -0
  26. package/ios/Application/Navigation/Tracking/ScreenTracker.swift +117 -0
  27. package/ios/Application/Navigation/component/Header.swift +178 -0
  28. package/ios/Application/Navigation/component/HeaderBackground.swift +83 -0
  29. package/ios/Application/Navigation/component/HeaderColor.swift +65 -0
  30. package/ios/Application/Navigation/component/HeaderRightWidthKey.swift +11 -0
  31. package/ios/Application/Navigation/component/NavigationFooter.swift +90 -0
  32. package/ios/Application/Navigation/component/NavigationHeaderRight.swift +196 -0
  33. package/ios/Application/Screen.swift +250 -0
  34. package/ios/Application/StackScreen.swift +492 -0
  35. package/ios/Avatar/Avatar.swift +193 -0
  36. package/ios/Badge/Badge.swift +84 -0
  37. package/ios/Badge/BadgeDot.swift +31 -0
  38. package/ios/Badge/BadgeRibbon.swift +319 -0
  39. package/ios/BaselineView/BaselineView.swift +163 -0
  40. package/ios/Button/Button.swift +232 -84
  41. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +126 -0
  42. package/ios/Carousel/Carousel.swift +196 -0
  43. package/ios/Checkbox/Checkbox.swift +77 -0
  44. package/ios/Chip/Chip.swift +120 -0
  45. package/ios/Collapse/Collapse.swift +192 -0
  46. package/ios/{Colors+Spacing → Colors+Radius+Spacing}/Colors.swift +42 -37
  47. package/ios/Colors+Radius+Spacing/Radius.swift +22 -0
  48. package/ios/{Colors+Spacing → Colors+Radius+Spacing}/Spacing.swift +3 -1
  49. package/ios/Colors+Radius+Spacing/Theme.swift +295 -0
  50. package/ios/DateTimePicker/DateTimePicker.swift +212 -0
  51. package/ios/DateTimePicker/DateTimePickerTypes.swift +55 -0
  52. package/ios/DateTimePicker/DateTimePickerUtils.swift +167 -0
  53. package/ios/DateTimePicker/WheelPicker.swift +165 -0
  54. package/ios/Divider/Divider.swift +16 -0
  55. package/ios/Extensions/ActiveOpacityButtonStyle.swift +14 -0
  56. package/ios/Extensions/Color++.swift +32 -0
  57. package/ios/Icon/Icon.swift +69 -0
  58. package/ios/IconButton/IconButton.swift +140 -0
  59. package/ios/Image/Image.swift +87 -0
  60. package/ios/Information/Information.swift +156 -0
  61. package/ios/Input/ErrorView.swift +58 -0
  62. package/ios/Input/Input.swift +461 -77
  63. package/ios/Input/InputPhoneNumber.swift +192 -0
  64. package/ios/Input/InputSearch.swift +301 -0
  65. package/ios/Input/InputTextArea.swift +318 -0
  66. package/ios/InputDropDown/InputDropDown.swift +201 -0
  67. package/ios/InputMoney/InputMoney.swift +405 -0
  68. package/ios/InputOTP/InputOTP.swift +211 -0
  69. package/ios/Layout/GridContext.swift +30 -0
  70. package/ios/Layout/Item.swift +42 -0
  71. package/ios/Layout/Section.swift +134 -0
  72. package/ios/Loader/Loader.swift +113 -0
  73. package/ios/Lottie/LottieView.swift +86 -0
  74. package/ios/MoMoUIKits.podspec +5 -0
  75. package/ios/OTPKeyboard/KeyboardButton.swift +13 -5
  76. package/ios/OTPKeyboard/OTPKeyboard.swift +1 -1
  77. package/ios/Pagination/PaginationDot.swift +61 -0
  78. package/ios/Pagination/PaginationNumber.swift +35 -0
  79. package/ios/Pagination/PaginationScroll.swift +101 -0
  80. package/ios/Pagination/PaginationWhiteDot.swift +37 -0
  81. package/ios/Popup/PopupDisplay.swift +279 -0
  82. package/ios/Popup/PopupInput.swift +92 -0
  83. package/ios/Popup/PopupNotify.swift +219 -0
  84. package/ios/Popup/PopupPromotion.swift +74 -0
  85. package/ios/PopupView/FullscreenPopup.swift +251 -0
  86. package/ios/{Popup → PopupView}/Modifiers.swift +6 -20
  87. package/ios/{Popup → PopupView}/PopupView.swift +38 -146
  88. package/ios/PopupView/Utils++.swift +281 -0
  89. package/ios/ProgressInfo/ProgressInfo.swift +297 -0
  90. package/ios/Radio/Radio.swift +69 -0
  91. package/ios/Rating/Rating.swift +83 -0
  92. package/{example/ios/Example/Preview Content/Preview Assets.xcassets/Contents.json → ios/Resources/MoMoUIKitsColors.xcassets/AccentColor.colorset/Contents.json} +5 -0
  93. package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Text.colorset/Contents.json +3 -3
  94. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/Contents.json +9 -0
  95. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-default.colorset/Contents.json +38 -0
  96. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-disable.colorset/Contents.json +38 -0
  97. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-pressed.colorset/Contents.json +38 -0
  98. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-selected.colorset/Contents.json +38 -0
  99. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-surface.colorset/Contents.json +38 -0
  100. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-tonal.colorset/Contents.json +38 -0
  101. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-default.colorset/Contents.json +38 -0
  102. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-disable.colorset/Contents.json +38 -0
  103. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/gradient.colorset/Contents.json +38 -0
  104. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/primary.colorset/Contents.json +38 -0
  105. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/secondary.colorset/Contents.json +38 -0
  106. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-container.colorset/Contents.json +38 -0
  107. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-primary.colorset/Contents.json +38 -0
  108. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-secondary.colorset/Contents.json +38 -0
  109. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-default.colorset/Contents.json +38 -0
  110. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-disable.colorset/Contents.json +38 -0
  111. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-hint.colorset/Contents.json +38 -0
  112. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-secondary.colorset/Contents.json +38 -0
  113. package/ios/ScrollIndicator/ScrollIndicator.swift +110 -0
  114. package/ios/Skeleton/Skeleton.swift +99 -0
  115. package/ios/Slider/Slider.swift +237 -0
  116. package/ios/StatusBarTap/StatusBarTap.h +13 -0
  117. package/ios/StatusBarTap/StatusBarTap.m +75 -0
  118. package/ios/Stepper/Stepper.swift +221 -0
  119. package/ios/Steps/Steps.swift +467 -0
  120. package/ios/SuggestAction/SuggestAction.swift +100 -0
  121. package/ios/Swipeable/SwipeCell.swift +226 -31
  122. package/ios/Swipeable/SwipeCellModel.swift +21 -0
  123. package/ios/Switch/Switch.swift +69 -0
  124. package/ios/TabView/TabView.swift +534 -0
  125. package/ios/Tag/Tag.swift +99 -0
  126. package/ios/Template/Logo/Logo.swift +75 -0
  127. package/ios/Template/TrustBanner/TrustBanner.swift +123 -0
  128. package/ios/Title/Title.swift +270 -0
  129. package/ios/Tooltip/Tooltip.swift +486 -0
  130. package/ios/Typography/FontScale.swift +103 -0
  131. package/ios/Typography/FontScaleStore.swift +58 -0
  132. package/ios/Typography/KitDesignSystem.swift +17 -0
  133. package/ios/Typography/Text.swift +262 -0
  134. package/ios/Typography/Typography.swift +80 -23
  135. package/ios/Uploader/Uploader.swift +174 -0
  136. package/ios/native-kits.podspec +73 -13
  137. package/ios-demo/MoMoUIKitsDemo.podspec +20 -0
  138. package/ios-demo/Resources/dot_loading.json +558 -0
  139. package/ios-demo/Resources/icon.json +4052 -0
  140. package/ios-demo/Resources/lottie_circle_loader.json +1 -0
  141. package/ios-demo/Sources/MoMoUIKitsDemo/DemoScaffold.swift +48 -0
  142. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsBadgeDemoView.swift +25 -0
  143. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsButtonDemoView.swift +26 -0
  144. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsCheckboxDemoView.swift +19 -0
  145. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsChipDemoView.swift +33 -0
  146. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsInputDemoView.swift +48 -0
  147. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsPopupDemoView.swift +21 -0
  148. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsRadioDemoView.swift +17 -0
  149. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsTypographyDemoView.swift +28 -0
  150. package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoContext.swift +31 -0
  151. package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoFactory.swift +24 -0
  152. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +110 -0
  153. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AvatarDemo.swift +107 -0
  154. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +75 -0
  155. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BaselineView.swift +117 -0
  156. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +89 -0
  157. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ButtonDemo.swift +108 -0
  158. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +96 -0
  159. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +60 -0
  160. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +76 -0
  161. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +102 -0
  162. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +107 -0
  163. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +100 -0
  164. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DemoScreen.swift +420 -0
  165. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +56 -0
  166. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/HeaderUserDemo.swift +49 -0
  167. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +276 -0
  168. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +93 -0
  169. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconDemo.swift +81 -0
  170. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +65 -0
  171. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +96 -0
  172. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +117 -0
  173. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +94 -0
  174. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +94 -0
  175. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +88 -0
  176. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +120 -0
  177. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +85 -0
  178. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +87 -0
  179. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +73 -0
  180. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +235 -0
  181. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +241 -0
  182. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +68 -0
  183. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PlaygroundData.swift +76 -0
  184. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +175 -0
  185. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +95 -0
  186. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +67 -0
  187. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +101 -0
  188. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +64 -0
  189. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +68 -0
  190. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SectionDemo.swift +83 -0
  191. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +61 -0
  192. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +90 -0
  193. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +82 -0
  194. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +93 -0
  195. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +114 -0
  196. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +90 -0
  197. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +107 -0
  198. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +58 -0
  199. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +114 -0
  200. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +86 -0
  201. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +181 -0
  202. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +104 -0
  203. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +118 -0
  204. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +87 -0
  205. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +85 -0
  206. package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +53 -0
  207. package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +15 -0
  208. package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +73 -0
  209. package/package.json +6 -6
  210. package/publish.sh +554 -20
  211. package/scripts/gen-ios-color.mjs +136 -0
  212. package/CODE_OF_CONDUCT.md +0 -133
  213. package/CONTRIBUTING.md +0 -114
  214. package/LICENSE +0 -20
  215. package/android/build.gradle +0 -82
  216. package/android/gradle.properties +0 -5
  217. package/android/src/main/AndroidManifest.xml +0 -4
  218. package/android/src/main/java/com/momoplatform/nativekits/NativeKitsPackage.kt +0 -17
  219. package/android/src/main/java/com/momoplatform/nativekits/NativeKitsViewManager.kt +0 -20
  220. package/example/ios/Example/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -63
  221. package/example/ios/Example/ComponentDetail.swift +0 -35
  222. package/example/ios/Example/ComponentItem.swift +0 -24
  223. package/example/ios/Example/ComponentModel.swift +0 -33
  224. package/example/ios/Example/ContentView.swift +0 -53
  225. package/example/ios/Example/Example.entitlements +0 -10
  226. package/example/ios/Example/Foundation/ButtonDemo.swift +0 -80
  227. package/example/ios/Example/Foundation/Popup/ActionSheets.swift +0 -136
  228. package/example/ios/Example/Foundation/Popup/Floats.swift +0 -127
  229. package/example/ios/Example/Foundation/Popup/Popups.swift +0 -101
  230. package/example/ios/Example/Foundation/PopupDemo.swift +0 -366
  231. package/example/ios/Example/Foundation/TextInputDemo.swift +0 -31
  232. package/example/ios/Example/Foundation/TypographyDemo.swift +0 -53
  233. package/example/ios/Example/Foundation.swift +0 -26
  234. package/example/ios/Example/Info.plist +0 -18
  235. package/example/ios/Example/Library/SwipeableDemo.swift +0 -105
  236. package/example/ios/Example/Library.swift +0 -26
  237. package/example/ios/Example/Main.swift +0 -11
  238. package/example/ios/Example/Overview.swift +0 -20
  239. package/example/ios/Example/Resource/SFProText-Black.ttf +0 -0
  240. package/example/ios/Example/Resource/SFProText-Bold.ttf +0 -0
  241. package/example/ios/Example/Resource/SFProText-Heavy.ttf +0 -0
  242. package/example/ios/Example/Resource/SFProText-Light.ttf +0 -0
  243. package/example/ios/Example/Resource/SFProText-Medium.ttf +0 -0
  244. package/example/ios/Example/Resource/SFProText-Regular.ttf +0 -0
  245. package/example/ios/Example/Resource/SFProText-Semibold.ttf +0 -0
  246. package/example/ios/Example/Resource/SFProText-Thin.ttf +0 -0
  247. package/example/ios/Example/Resource/SFProText-Ultralight.ttf +0 -0
  248. package/example/ios/Example/Resource/foundation.json +0 -33
  249. package/example/ios/Example/Resource/library.json +0 -8
  250. package/example/ios/Example/Utils.swift +0 -30
  251. package/example/ios/Example/ViewModifier/DarkViewModifier.swift +0 -22
  252. package/example/ios/Example.xcodeproj/project.pbxproj +0 -570
  253. package/example/ios/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  254. package/example/ios/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  255. package/example/ios/Example.xcodeproj/project.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  256. package/example/ios/Example.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  257. package/example/ios/Example.xcworkspace/contents.xcworkspacedata +0 -10
  258. package/example/ios/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  259. package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  260. package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -6
  261. package/example/ios/Podfile +0 -6
  262. package/example/ios/Podfile.lock +0 -16
  263. package/example/ios/Pods/Local Podspecs/MoMoUIKits.podspec.json +0 -29
  264. package/example/ios/Pods/Manifest.lock +0 -16
  265. package/example/ios/Pods/Pods.xcodeproj/project.pbxproj +0 -661
  266. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +0 -58
  267. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/Pods-Example.xcscheme +0 -58
  268. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +0 -25
  269. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-dummy.m +0 -5
  270. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-prefix.pch +0 -12
  271. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-umbrella.h +0 -16
  272. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.debug.xcconfig +0 -12
  273. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.modulemap +0 -6
  274. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.release.xcconfig +0 -12
  275. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.markdown +0 -3
  276. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.plist +0 -29
  277. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-dummy.m +0 -5
  278. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-umbrella.h +0 -16
  279. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig +0 -14
  280. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.modulemap +0 -6
  281. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig +0 -14
  282. package/ios/Colors+Spacing/Radius.swift +0 -11
  283. package/ios/Popup/Utils++.swift +0 -163
  284. package/ios/Theme.md +0 -18
  285. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Background.colorset/Contents.json +0 -0
  286. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Border.colorset/Contents.json +0 -0
  287. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Card.colorset/Contents.json +0 -0
  288. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Contents.json +0 -0
  289. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Error.colorset/Contents.json +0 -0
  290. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Primary.colorset/Contents.json +0 -0
  291. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/PrimaryDark.colorset/Contents.json +0 -0
  292. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/PrimaryLight.colorset/Contents.json +0 -0
  293. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Secondary.colorset/Contents.json +0 -0
  294. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Success.colorset/Contents.json +0 -0
  295. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/TextSecondary.colorset/Contents.json +0 -0
  296. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Warning.colorset/Contents.json +0 -0
@@ -0,0 +1,84 @@
1
+ import SwiftUI
2
+
3
+ public struct Badge: View {
4
+ @Environment(\.appTheme) private var theme
5
+ @Environment(\.momoFontScale) private var fontScale
6
+ let label: String
7
+ let backgroundColor: Color?
8
+
9
+ private var primaryColors: [Color] {
10
+ [
11
+ Colors.black03,
12
+ Colors.pink03,
13
+ Colors.violet03,
14
+ Colors.indigo03,
15
+ Colors.blue03,
16
+ Colors.mint03,
17
+ Colors.green03,
18
+ Colors.lime03,
19
+ Colors.yellow03,
20
+ Colors.gold03,
21
+ Colors.orange03,
22
+ Colors.red03
23
+ ]
24
+ }
25
+
26
+ public init(label: String = "Label", backgroundColor: Color? = nil) {
27
+ self.label = label
28
+ self.backgroundColor = backgroundColor
29
+ }
30
+
31
+ private func isNumber(_ text: String) -> Bool {
32
+ return text.range(of: "^\\d+$", options: .regularExpression) != nil
33
+ }
34
+
35
+ private func formatTitle(_ text: String) -> String {
36
+ if isNumber(text), let number = Int(text), number > 99 {
37
+ return "99+"
38
+ }
39
+ return text
40
+ }
41
+
42
+ private var badgeColor: Color {
43
+ // Default colors based on label type
44
+ let defaultColor: Color = isNumber(label)
45
+ ? theme.colors.error.primary
46
+ : theme.colors.warning.primary
47
+
48
+ // Mirror Compose: only apply backgroundColor when it is one of the
49
+ // allowed primaryColors; otherwise fall back to the label-based default.
50
+ if let bgColor = backgroundColor, primaryColors.contains(bgColor) {
51
+ return bgColor
52
+ }
53
+ return defaultColor
54
+ }
55
+
56
+ public var body: some View {
57
+ MomoText(formatTitle(label), typography: .actionXxsBold, color: Colors.black01)
58
+ .padding(.horizontal, Spacing.XS)
59
+ .frame(minWidth: fontScale(16), minHeight: fontScale(16))
60
+ .background(badgeColor)
61
+ .cornerRadius(Radius.M)
62
+ .overlay(
63
+ RoundedRectangle(cornerRadius: Radius.M)
64
+ .stroke(Colors.black01, lineWidth: 1)
65
+ )
66
+ }
67
+ }
68
+
69
+ // MARK: - Preview
70
+ #if DEBUG
71
+ struct Badge_Previews: PreviewProvider {
72
+ static var previews: some View {
73
+ VStack(spacing: 20) {
74
+ Badge(label: "5")
75
+ Badge(label: "99")
76
+ Badge(label: "100")
77
+ Badge(label: "New")
78
+ Badge(label: "Hot", backgroundColor: Colors.pink03)
79
+ }
80
+ .padding()
81
+ .previewLayout(.sizeThatFits)
82
+ }
83
+ }
84
+ #endif
@@ -0,0 +1,31 @@
1
+ import SwiftUI
2
+
3
+ public enum DotSize {
4
+ case small
5
+ case large
6
+
7
+ var size: CGFloat {
8
+ switch self {
9
+ case .small: return 10
10
+ case .large: return 16
11
+ }
12
+ }
13
+ }
14
+
15
+ public struct BadgeDot: View {
16
+ var size: DotSize
17
+
18
+ public init(size: DotSize = .large) {
19
+ self.size = size
20
+ }
21
+
22
+ public var body: some View {
23
+ Circle()
24
+ .fill(Colors.red03)
25
+ .frame(width: size.size, height: size.size)
26
+ .overlay(
27
+ Circle()
28
+ .stroke(Colors.black01, lineWidth: 1)
29
+ )
30
+ }
31
+ }
@@ -0,0 +1,319 @@
1
+ import SwiftUI
2
+
3
+ // MARK: - Custom Shape for Rounded Corners
4
+ struct RoundedCorners: Shape {
5
+ var topLeft: CGFloat = 0.0
6
+ var topRight: CGFloat = 0.0
7
+ var bottomLeft: CGFloat = 0.0
8
+ var bottomRight: CGFloat = 0.0
9
+
10
+ func path(in rect: CGRect) -> Path {
11
+ var path = Path()
12
+
13
+ let width = rect.size.width
14
+ let height = rect.size.height
15
+
16
+ // Start from top left
17
+ path.move(to: CGPoint(x: topLeft, y: 0))
18
+
19
+ // Top edge and top right corner
20
+ path.addLine(to: CGPoint(x: width - topRight, y: 0))
21
+ if topRight > 0 {
22
+ path.addArc(
23
+ center: CGPoint(x: width - topRight, y: topRight),
24
+ radius: topRight,
25
+ startAngle: Angle(degrees: -90),
26
+ endAngle: Angle(degrees: 0),
27
+ clockwise: false
28
+ )
29
+ }
30
+
31
+ // Right edge and bottom right corner
32
+ path.addLine(to: CGPoint(x: width, y: height - bottomRight))
33
+ if bottomRight > 0 {
34
+ path.addArc(
35
+ center: CGPoint(x: width - bottomRight, y: height - bottomRight),
36
+ radius: bottomRight,
37
+ startAngle: Angle(degrees: 0),
38
+ endAngle: Angle(degrees: 90),
39
+ clockwise: false
40
+ )
41
+ }
42
+
43
+ // Bottom edge and bottom left corner
44
+ path.addLine(to: CGPoint(x: bottomLeft, y: height))
45
+ if bottomLeft > 0 {
46
+ path.addArc(
47
+ center: CGPoint(x: bottomLeft, y: height - bottomLeft),
48
+ radius: bottomLeft,
49
+ startAngle: Angle(degrees: 90),
50
+ endAngle: Angle(degrees: 180),
51
+ clockwise: false
52
+ )
53
+ }
54
+
55
+ // Left edge and top left corner
56
+ path.addLine(to: CGPoint(x: 0, y: topLeft))
57
+ if topLeft > 0 {
58
+ path.addArc(
59
+ center: CGPoint(x: topLeft, y: topLeft),
60
+ radius: topLeft,
61
+ startAngle: Angle(degrees: 180),
62
+ endAngle: Angle(degrees: 270),
63
+ clockwise: false
64
+ )
65
+ }
66
+
67
+ path.closeSubpath()
68
+ return path
69
+ }
70
+ }
71
+
72
+ public enum RibbonPosition {
73
+ case topLeft
74
+ case topRight
75
+ case bottomLeft
76
+ case bottomRight
77
+ }
78
+
79
+ public struct BadgeRibbon: View {
80
+ @Environment(\.appTheme) private var theme
81
+ let position: RibbonPosition
82
+ let label: String
83
+ let isRound: Bool
84
+ let backgroundColor: Color?
85
+
86
+ public init(
87
+ position: RibbonPosition = .topRight,
88
+ label: String = "Label",
89
+ isRound: Bool = false,
90
+ backgroundColor: Color? = nil
91
+ ) {
92
+ self.position = position
93
+ self.label = label
94
+ self.isRound = isRound
95
+ self.backgroundColor = backgroundColor
96
+ }
97
+
98
+ private var rotation: Angle {
99
+ switch position {
100
+ case .topRight, .bottomRight:
101
+ return .degrees(180)
102
+ case .topLeft, .bottomLeft:
103
+ return .zero
104
+ }
105
+ }
106
+
107
+ private var useUpTail: Bool {
108
+ position == .bottomLeft || position == .topRight
109
+ }
110
+
111
+ private var verticalAlignment: VerticalAlignment {
112
+ switch position {
113
+ case .topLeft, .bottomRight:
114
+ return .top
115
+ case .bottomLeft, .topRight:
116
+ return .bottom
117
+ }
118
+ }
119
+
120
+ public var body: some View {
121
+ let bgColor = backgroundColor ?? theme.colors.warning.primary
122
+
123
+ HStack(alignment: verticalAlignment, spacing: 0) {
124
+ if useUpTail {
125
+ upTail
126
+ } else {
127
+ downTail
128
+ }
129
+
130
+ if isRound {
131
+ roundContent(backgroundColor: bgColor)
132
+ } else {
133
+ skewContent(backgroundColor: bgColor)
134
+ }
135
+ }
136
+ .frame(height: RibbonConstants.ribbonHeight)
137
+ .rotationEffect(rotation)
138
+ }
139
+
140
+ private func roundContent(backgroundColor: Color) -> some View {
141
+ HStack(spacing: 0) {
142
+ MomoText(label, typography: .labelXsMedium, color: Colors.black01, maxLines: 1)
143
+ .rotationEffect(rotation)
144
+ }
145
+ .frame(height: RibbonConstants.roundHeight)
146
+ .padding(.trailing, RibbonConstants.roundPaddingEnd)
147
+ .background(
148
+ RoundedCorners(
149
+ topLeft: 0,
150
+ topRight: RibbonConstants.roundRightRadius,
151
+ bottomLeft: 0,
152
+ bottomRight: RibbonConstants.roundRightRadius
153
+ )
154
+ .fill(backgroundColor)
155
+ )
156
+ }
157
+
158
+ private func skewContent(backgroundColor: Color) -> some View {
159
+ HStack(spacing: 0) {
160
+ MomoText(label, typography: .labelXsMedium, color: Colors.black01, maxLines: 1)
161
+ .rotationEffect(rotation)
162
+ .frame(height: RibbonConstants.skewBodyHeight)
163
+ .padding(.horizontal, 8)
164
+ .background(backgroundColor)
165
+
166
+ rightTail
167
+ }
168
+ }
169
+
170
+ private var upTail: some View {
171
+ ImageView(
172
+ "https://static.momocdn.net/app/img/kits/utils/Head_down_4x.png",
173
+ placeholder: AnyView(Color.clear)
174
+ )
175
+ .frame(width: RibbonConstants.headTailWidth, height: RibbonConstants.headTailHeight)
176
+ .rotationEffect(.degrees(180))
177
+ .offset(x: 1)
178
+ .clipped()
179
+ }
180
+
181
+ private var downTail: some View {
182
+ ImageView(
183
+ "https://static.momocdn.net/app/img/kits/utils/Head_4x.png",
184
+ placeholder: AnyView(Color.clear)
185
+ )
186
+ .frame(width: RibbonConstants.headTailWidth, height: RibbonConstants.headTailHeight)
187
+ .offset(x: 1)
188
+ .clipped()
189
+ }
190
+
191
+ private var rightTail: some View {
192
+ ImageView(
193
+ "https://static.momocdn.net/app/img/kits/utils/Tail_4x.png",
194
+ placeholder: AnyView(Color.clear)
195
+ )
196
+ .frame(width: RibbonConstants.skewTailWidth, height: RibbonConstants.skewTailHeight)
197
+ .offset(x: -2)
198
+ .clipped()
199
+ }
200
+ }
201
+
202
+ /// Ported from Compose's `RoundedBadgeRibbon` (BadgeRibbon.kt:164-326): a canvas-drawn
203
+ /// ribbon shape sized to its text, mirrored per corner via scaleX/scaleY (never an actual
204
+ /// rotation) — the label gets the same scale applied a second time so it stays right-reading
205
+ /// while only the ribbon shape flips.
206
+ public struct RoundedBadgeRibbon: View {
207
+ @Environment(\.momoFontScale) private var fontScale
208
+ let text: String
209
+ let position: RibbonPosition
210
+
211
+ public init(text: String = "Label", position: RibbonPosition = .topLeft) {
212
+ self.text = text
213
+ self.position = position
214
+ }
215
+
216
+ private var scale: (x: CGFloat, y: CGFloat) {
217
+ switch position {
218
+ case .topLeft: return (-1, 1)
219
+ case .topRight: return (1, 1)
220
+ case .bottomRight: return (1, -1)
221
+ case .bottomLeft: return (-1, -1)
222
+ }
223
+ }
224
+
225
+ private var measuredTextSize: CGSize {
226
+ let fontSize = fontScale(TypographyStyle.labelXsMedium.fontSize)
227
+ let font = UIFont.systemFont(ofSize: fontSize, weight: .medium)
228
+ return text.size(withAttributes: [.font: font])
229
+ }
230
+
231
+ public var body: some View {
232
+ let textSize = measuredTextSize
233
+ let minRibbonHeight = max(textSize.height * 1.2, 16)
234
+ let padding = minRibbonHeight / 4
235
+ let badgeHeight = minRibbonHeight + padding
236
+ let badgeWidth = max(textSize.width + padding * 2, 28)
237
+
238
+ ZStack {
239
+ Canvas { context, size in
240
+ let ribbonHeight = size.height - padding
241
+ let cornerRadius = (badgeHeight - padding) / 2
242
+ let mainColor = Colors.orange03
243
+ let tailColor = Colors.red01
244
+
245
+ let headWidth: CGFloat = 4
246
+ // Kotlin computes `leftSectionWidth` + `middleSectionWidth` here, but those
247
+ // cancel algebraically to `width - headWidth` — kept as the direct result.
248
+ let rightX = size.width - headWidth
249
+
250
+ let leftMiddlePath = RoundedCorners(topLeft: cornerRadius, topRight: 0, bottomLeft: cornerRadius, bottomRight: 0)
251
+ .path(in: CGRect(x: 0, y: 0, width: rightX + 1, height: ribbonHeight))
252
+ context.fill(leftMiddlePath, with: .color(mainColor))
253
+
254
+ let headPath = RoundedCorners(topLeft: 0, topRight: cornerRadius, bottomLeft: 0, bottomRight: 0)
255
+ .path(in: CGRect(x: rightX, y: 0, width: headWidth, height: ribbonHeight))
256
+ context.fill(headPath, with: .color(mainColor))
257
+
258
+ let halfHeadWidth = headWidth / 2
259
+ let tailStartX = rightX + headWidth - halfHeadWidth
260
+ let tailY = ribbonHeight
261
+ let tailHeight = padding
262
+
263
+ context.fill(
264
+ Path(CGRect(x: tailStartX, y: tailY, width: halfHeadWidth, height: halfHeadWidth)),
265
+ with: .color(mainColor)
266
+ )
267
+
268
+ let tailRightPath = RoundedCorners(topLeft: 0, topRight: tailHeight, bottomLeft: 0, bottomRight: tailHeight)
269
+ .path(in: CGRect(x: tailStartX, y: tailY, width: halfHeadWidth, height: tailHeight))
270
+ context.fill(tailRightPath, with: .color(tailColor))
271
+ }
272
+
273
+ MomoText(text, typography: .labelXsMedium, color: Colors.black01, maxLines: 1)
274
+ .padding(.bottom, padding)
275
+ .padding(.horizontal, padding / 2)
276
+ .scaleEffect(x: scale.x, y: scale.y)
277
+ }
278
+ .frame(width: badgeWidth, height: badgeHeight)
279
+ .scaleEffect(x: scale.x, y: scale.y)
280
+ }
281
+ }
282
+
283
+ // MARK: - Constants
284
+ private struct RibbonConstants {
285
+ static let ribbonHeight: CGFloat = 20
286
+ static let roundHeight: CGFloat = 16
287
+ static let skewBodyHeight: CGFloat = 16
288
+ static let roundRightRadius: CGFloat = 8
289
+ static let roundPaddingEnd: CGFloat = 6
290
+ static let skewTailWidth: CGFloat = 8
291
+ static let skewTailHeight: CGFloat = 16
292
+ static let headTailWidth: CGFloat = 5
293
+ static let headTailHeight: CGFloat = 20
294
+ }
295
+
296
+ // MARK: - String Extension for Text Size
297
+ extension String {
298
+ func size(withAttributes attributes: [NSAttributedString.Key: Any]?) -> CGSize {
299
+ let size = (self as NSString).size(withAttributes: attributes)
300
+ return size
301
+ }
302
+ }
303
+
304
+ // MARK: - Preview
305
+ #if DEBUG
306
+ struct BadgeRibbon_Previews: PreviewProvider {
307
+ static var previews: some View {
308
+ VStack(spacing: 30) {
309
+ // Basic ribbon examples
310
+ BadgeRibbon(position: .topRight, label: "New")
311
+ BadgeRibbon(position: .topLeft, label: "Hot", isRound: true)
312
+ BadgeRibbon(position: .bottomLeft, label: "Sale")
313
+ BadgeRibbon(position: .bottomRight, label: "50% OFF", isRound: true)
314
+ }
315
+ .padding()
316
+ .previewLayout(.sizeThatFits)
317
+ }
318
+ }
319
+ #endif
@@ -0,0 +1,163 @@
1
+ import SwiftUI
2
+
3
+ public struct BaselineView: View {
4
+ private let enabled: Bool
5
+
6
+ public init(enabled: Bool = true) {
7
+ self.enabled = enabled
8
+ }
9
+
10
+ public var body: some View {
11
+ if enabled {
12
+ GeometryReader { geometry in
13
+ let topInset = geometry.safeAreaInsets.top
14
+ let bottomInset = min(geometry.safeAreaInsets.bottom, 21)
15
+
16
+ ZStack(alignment: .topLeading) {
17
+ dangerZones(topInset: topInset, bottomInset: bottomInset)
18
+ guideLines(
19
+ topInset: topInset,
20
+ bottomInset: bottomInset,
21
+ width: geometry.size.width
22
+ )
23
+ }
24
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
25
+ .ignoresSafeArea()
26
+ .allowsHitTesting(false)
27
+ .accessibilityHidden(true)
28
+ }
29
+ }
30
+ }
31
+
32
+ private func dangerZones(topInset: CGFloat, bottomInset: CGFloat) -> some View {
33
+ let safeBackground = Color.red.opacity(0.15)
34
+
35
+ return ZStack(alignment: .topLeading) {
36
+ safeBackground
37
+ .frame(maxWidth: .infinity)
38
+ .frame(height: topInset)
39
+
40
+ HStack(spacing: 0) {
41
+ safeBackground
42
+ .frame(width: 12)
43
+ Spacer(minLength: 0)
44
+ safeBackground
45
+ .frame(width: 12)
46
+ }
47
+ .padding(.top, topInset)
48
+ .padding(.bottom, bottomInset)
49
+
50
+ VStack(spacing: 0) {
51
+ Spacer(minLength: 0)
52
+ safeBackground
53
+ .frame(maxWidth: .infinity)
54
+ .frame(height: bottomInset)
55
+ }
56
+ }
57
+ }
58
+
59
+ private func guideLines(topInset: CGFloat, bottomInset: CGFloat, width: CGFloat) -> some View {
60
+ ZStack(alignment: .topLeading) {
61
+ baselineLine(isDotted: false, color: Color(hex: 0xE400FF))
62
+ .offset(y: topInset)
63
+
64
+ baselineLine(color: Color(hex: 0xE400FF))
65
+ .offset(y: topInset + 52)
66
+
67
+ baselineLine(color: Color(hex: 0xE400FF))
68
+ .offset(y: topInset + 104)
69
+
70
+ bottomLine(bottomInset: bottomInset + 64, color: Color(hex: 0xE400FF))
71
+
72
+ bottomLine(bottomInset: bottomInset, isDotted: false, color: Color(hex: 0xE400FF))
73
+
74
+ baselineLine(orientation: .vertical, isDotted: false, color: Color(hex: 0xE400FF))
75
+ .offset(x: 12)
76
+
77
+ baselineLine(orientation: .vertical, isDotted: false, color: Color(hex: 0xE400FF))
78
+ .offset(x: width - 12)
79
+
80
+ baselineLine(color: Color(hex: 0xFF7A00))
81
+ .offset(y: topInset + 26)
82
+
83
+ bottomLine(bottomInset: bottomInset + 56, color: Color(hex: 0xFFCC00))
84
+
85
+ bottomLine(bottomInset: bottomInset + 8, color: Color(hex: 0xFFCC00))
86
+
87
+ baselineLine(orientation: .vertical, color: Color(hex: 0x00C520))
88
+ .frame(height: 52)
89
+ .offset(x: 40, y: topInset)
90
+
91
+ baselineLine(orientation: .vertical, color: Color(hex: 0x00C520))
92
+ .frame(height: 52)
93
+ .offset(x: 48, y: topInset)
94
+ }
95
+ }
96
+
97
+ private func bottomLine(
98
+ bottomInset: CGFloat,
99
+ isDotted: Bool = true,
100
+ color: Color
101
+ ) -> some View {
102
+ VStack(spacing: 0) {
103
+ Spacer(minLength: 0)
104
+ baselineLine(isDotted: isDotted, color: color)
105
+ .padding(.bottom, bottomInset)
106
+ }
107
+ }
108
+
109
+ private func baselineLine(
110
+ orientation: BaselineOrientation = .horizontal,
111
+ isDotted: Bool = true,
112
+ color: Color
113
+ ) -> some View {
114
+ BaselineLineShape(orientation: orientation)
115
+ .stroke(
116
+ color,
117
+ style: StrokeStyle(
118
+ lineWidth: 1,
119
+ lineCap: .round,
120
+ dash: isDotted ? [8, 8] : []
121
+ )
122
+ )
123
+ .frame(
124
+ maxWidth: orientation == .horizontal ? .infinity : 1,
125
+ maxHeight: orientation == .vertical ? .infinity : 1
126
+ )
127
+ }
128
+ }
129
+
130
+ public enum BaselineOrientation: Sendable {
131
+ case horizontal
132
+ case vertical
133
+ }
134
+
135
+ private struct BaselineLineShape: Shape {
136
+ let orientation: BaselineOrientation
137
+
138
+ func path(in rect: CGRect) -> Path {
139
+ var path = Path()
140
+
141
+ switch orientation {
142
+ case .horizontal:
143
+ path.move(to: CGPoint(x: rect.minX, y: rect.midY))
144
+ path.addLine(to: CGPoint(x: rect.maxX, y: rect.midY))
145
+ case .vertical:
146
+ path.move(to: CGPoint(x: rect.midX, y: rect.minY))
147
+ path.addLine(to: CGPoint(x: rect.midX, y: rect.maxY))
148
+ }
149
+
150
+ return path
151
+ }
152
+ }
153
+
154
+ #if DEBUG
155
+ struct BaselineView_Previews: PreviewProvider {
156
+ static var previews: some View {
157
+ ZStack {
158
+ Colors.black01
159
+ BaselineView()
160
+ }
161
+ }
162
+ }
163
+ #endif