@momo-kits/native-kits 0.169.4-beta.1-debug → 0.169.4-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 CHANGED
@@ -42,7 +42,7 @@ xcodebuild -project sample/iosApp/Pods/Pods.xcodeproj -scheme MoMoUIKits -sdk ip
42
42
  -destination 'generic/platform=iOS Simulator' build
43
43
  ```
44
44
 
45
- Publishing is automated (`.gitlab-ci.yml` → `publish.sh`; see `PUBLISH_GUIDE.md`): `main` → npm latest + 1 patch (tag `latest`; a manual run with `RELEASE_VERSION` sets the sprint version), other branches on `[ci build]` → `<npm latest + 1 patch>-beta.N`. The version is never stored in the repo — `scripts/ci/resolve-version.mjs` bases it on npm and only takes a number free on **both** npm (incl. `-debug`) and GitLab Maven. Do not publish manually unless asked; `bash publish.sh beta --dry-run` shows the version and packs the tarballs without uploading.
45
+ Publishing is automated (`.gitlab-ci.yml` → `publish.sh`; see `PUBLISH_GUIDE.md`): `main` → npm latest + 1 patch (tag `latest`; a manual run with `RELEASE_VERSION` sets the sprint version), other branches on `[ci build]` → `<npm latest + 1 patch>-beta.N`. The version is never stored in the repo — `scripts/ci/resolve-version.mjs` bases it on npm and only takes a number free on **both** npm (incl. `-debug`) and GitLab Maven. Locally, `bash publish.sh local` publishes a beta of the working tree as is (uncommitted changes too, any branch; same beta numbering); `release` is CI-only. Do not publish unless asked; `bash publish.sh local --dry-run` shows the version and packs the tarballs without uploading.
46
46
 
47
47
  ## Architecture essentials
48
48
 
package/PUBLISH_GUIDE.md CHANGED
@@ -28,11 +28,18 @@ GitLab → **Build → Pipelines → Run pipeline** → chọn `main` → `RELEA
28
28
  ## Chạy local
29
29
 
30
30
  ```bash
31
- bash publish.sh build # build tất cả artifact sẽ publish (không upload)
32
- bash publish.sh beta --dry-run # xem version sẽ ra + pack tarball npm vào build/npm
33
- bash publish.sh release --version 0.170.1 # publish thật
31
+ bash publish.sh build # build tất cả artifact sẽ publish (không upload)
32
+ bash publish.sh local --dry-run # xem version sẽ ra + pack tarball npm vào build/npm
33
+ bash publish.sh local # publish beta thật từ working tree hiện tại
34
+ yarn publish:local # như trên (thêm --dry-run để chạy thử)
34
35
  ```
35
36
 
37
+ - `local` chỉ publish **beta**, ở bất kỳ nhánh nào, và lấy **nguyên working tree**, kể cả thay đổi chưa commit. Dùng khi cần nhanh một version để test mà chưa muốn commit.
38
+ - Version theo đúng quy tắc beta của CI: `<npm latest + 1 patch>-beta.N`, npm tag `beta`, và số phải còn trống trên cả npm lẫn Maven. Beta local và beta CI dùng chung dãy `N`.
39
+ - `release` (npm tag `latest`) chỉ chạy trên CI. Chạy ở local sẽ bị chặn, trừ khi có `--dry-run`.
40
+ - Local không giữ khoá `kits-publish` của CI. Vì vậy script build xong mới chọn version, để khoảng thời gian có thể bị trùng số với một job CI đang chạy là ngắn nhất.
41
+ - `gitHead` trên npm trỏ tới commit HEAD, nhưng package có thể chứa cả thay đổi chưa commit.
42
+
36
43
  Các file bị sửa trong lúc publish được trả lại nguyên trạng khi script kết thúc, kể cả khi fail.
37
44
 
38
45
  ## CI/CD variables
@@ -40,7 +40,7 @@ kotlin {
40
40
  }
41
41
 
42
42
  cocoapods {
43
- version = "0.169.4-beta.1-debug"
43
+ version = "0.169.4-debug"
44
44
  summary = "IOS Shared module"
45
45
  homepage = "https://momo.vn"
46
46
  ios.deploymentTarget = "15.0"
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |spec|
2
2
  spec.name = 'compose'
3
- spec.version = '0.169.4-beta.1-debug'
3
+ spec.version = '0.169.4-debug'
4
4
  spec.homepage = 'https://momo.vn'
5
5
  spec.source = { :http=> ''}
6
6
  spec.authors = ''
@@ -21,15 +21,11 @@ const val MAX_DEVICE_SCALE = 5
21
21
  @Composable
22
22
  fun scaleSize(size: Float): Float {
23
23
  val context = LocalContext.current
24
- // opt-in ceiling: when context.scaleSizeMaxRate is set, the result never exceeds size × capRate,
25
- // in both the userScaleRate path and the OS path. Null keeps the old behavior.
26
- val capRate = context?.scaleSizeMaxRate
27
- fun cap(scaled: Float): Float = if (capRate != null) min(scaled, size * capRate) else scaled
28
24
  val useOsScale = context?.useOSScaleRate ?: DesignSystemKits.getConfigs().useOSScaleRate
29
25
  if (!useOsScale) {
30
- return cap(size * (context?.userScaleRate ?: DesignSystemKits.getConfigs().userScaleRate))
26
+ return size * (context?.userScaleRate ?: DesignSystemKits.getConfigs().userScaleRate)
31
27
  }
32
- val scaleSizeMaxRate: Float = capRate ?: MAX_FONT_SCALE
28
+ val scaleSizeMaxRate: Float = MAX_FONT_SCALE
33
29
  // Short side, not width: landscape must not inflate every font.
34
30
  val deviceWidth = getScreenDimensions().let { minOf(it.width, it.height) }
35
31
  val deviceScale = deviceWidth / DEFAULT_SCREEN_SIZE
@@ -49,11 +45,9 @@ fun scaleSize(size: Float): Float {
49
45
  fontSizeScaleOS = min(fontScale * fontSizeScaleOS, fontSizeScaleOS * scaleSizeMaxRate)
50
46
  }
51
47
 
52
- return cap(
53
- max(
54
- fontSizeScaleDevice,
55
- fontSizeScaleOS
56
- )
48
+ return max(
49
+ fontSizeScaleDevice,
50
+ fontSizeScaleOS
57
51
  )
58
52
  }
59
53
 
@@ -69,7 +69,6 @@ internal fun BottomTabBar(
69
69
  floatingButton = floatingButton,
70
70
  selectedIndex = selectedIndex,
71
71
  onTabSelected = onTabSelected,
72
- fixedFontScale = true,
73
72
  modifier = Modifier
74
73
  .offset(x = (layout.insetLeft - layout.insetRight) / 2)
75
74
  .width(horizontalBarWidth(layout.width, layout.height, layout.insetLeft, layout.insetRight)),
@@ -227,19 +226,10 @@ internal fun ColumnScope.TabItemContent(
227
226
  textAlign = TextAlign.Center,
228
227
  maxLines = 1,
229
228
  overflow = TextOverflow.Ellipsis,
230
- modifier = (if (vertical) Modifier else Modifier.fillMaxWidth())
231
- .wrapContentHeight(Alignment.Top, unbounded = true),
229
+ modifier = if (vertical) Modifier else Modifier.fillMaxWidth(),
232
230
  )
233
231
  }
234
- // fixed slot so a capped-scale label overflows downward and the icon above it stays put
235
- Box(
236
- modifier = Modifier.height(
237
- if (vertical) TabBarMetrics.railLabelHeight else TabBarMetrics.labelHeight
238
- ),
239
- contentAlignment = Alignment.TopCenter,
240
- ) {
241
- if (fixedFontScale) CappedFontScale(label) else label()
242
- }
232
+ if (fixedFontScale) FixedFontScale(label) else label()
243
233
  }
244
234
  }
245
235
 
@@ -253,21 +243,6 @@ internal fun FixedFontScale(content: @Composable () -> Unit) {
253
243
  CompositionLocalProvider(LocalContext provides fixedScale, content = content)
254
244
  }
255
245
 
256
- // Tab labels follow the OS/host font scale but never grow past this, so the fixed-height container
257
- // and the notch stay aligned.
258
- private const val TAB_LABEL_MAX_SCALE = 1.2f
259
-
260
- // Caps the label scale at TAB_LABEL_MAX_SCALE: it keeps following the host/OS font scale but stops
261
- // growing past 1.2× so it fits the fixed bar geometry.
262
- @Composable
263
- internal fun CappedFontScale(content: @Composable () -> Unit) {
264
- val context = LocalContext.current
265
- val capped = remember(context) {
266
- (context ?: MiniAppContext()).copy(scaleSizeMaxRate = TAB_LABEL_MAX_SCALE)
267
- }
268
- CompositionLocalProvider(LocalContext provides capped, content = content)
269
- }
270
-
271
246
  // Badge value shown on a tab: null hides it, "" is a dot, numbers cap at 99+ ("0" hides it, RN parity).
272
247
  internal fun tabBadgeLabel(item: BottomTabItem): String? {
273
248
  val label = item.badgeLabel ?: return if (item.showDot) "" else null
@@ -384,7 +359,7 @@ internal fun CenterActionLabel(label: String, overlay: (@Composable () -> Unit)?
384
359
  .padding(horizontal = if (vertical) Spacing.XS else Spacing.XXS),
385
360
  contentAlignment = Alignment.Center,
386
361
  ) {
387
- if (fixedFontScale) CappedFontScale(text) else text()
362
+ if (fixedFontScale) FixedFontScale(text) else text()
388
363
  overlay?.let {
389
364
  Box(Modifier.matchParentSize().wrapContentSize(Alignment.Center, unbounded = true)) { it() }
390
365
  }
@@ -22,10 +22,6 @@ internal object TabBarMetrics {
22
22
  val itemGap = Spacing.XS
23
23
  val iconSize = 24.dp
24
24
  val indicatorHeight = 32.dp
25
- // label_s_medium / label_xs_medium line heights: the label slot keeps this height so a scaled
26
- // label overflows downward instead of pushing the icon up
27
- val labelHeight = 18.dp
28
- val railLabelHeight = 14.dp
29
25
  // active indicator behind the icon: 24 icon + XS·M padding
30
26
  val indicatorPaddingHorizontal = Spacing.M
31
27
  val indicatorRadius = Radius.XL
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.169.4-beta.1
21
+ version=0.169.4
22
22
 
23
23
  repo=GitLab
24
24
  url=https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven
@@ -96,8 +96,7 @@ struct BottomTabBar: View {
96
96
  floatingButton: floatingButton,
97
97
  selectedIndex: selectedIndex,
98
98
  onTabSelected: onTabSelected,
99
- width: TabBarMetrics.horizontalBarWidth(layout),
100
- fixedFontScale: true
99
+ width: TabBarMetrics.horizontalBarWidth(layout)
101
100
  )
102
101
  .padding(.bottom, TabBarMetrics.bottomGap(bottomInset))
103
102
  .frame(maxWidth: .infinity)
@@ -204,19 +203,14 @@ struct ActiveIndicator: View {
204
203
  }
205
204
  }
206
205
 
207
- /// Tab labels follow the host/OS font scale but never grow past this, so the fixed-height container
208
- /// and the notch stay aligned.
209
- private let tabLabelMaxScale: CGFloat = 1.2
210
-
211
- /// Caps the label scale at `tabLabelMaxScale` (Compose's `CappedFontScale`): it keeps following the
212
- /// host/OS font scale but stops growing past 1.2× so it fits the fixed bar geometry.
213
- struct CappedFontScale: ViewModifier {
206
+ /// Like the system tab bar, text keeps its design size instead of growing with the wide Duo displays.
207
+ struct FixedFontScale: ViewModifier {
214
208
  let enabled: Bool
215
209
 
216
210
  @Environment(\.momoFontScale) private var fontScale
217
211
 
218
212
  func body(content: Content) -> some View {
219
- content.environment(\.momoFontScale, enabled ? fontScale.cappedAt(tabLabelMaxScale) : fontScale)
213
+ content.environment(\.momoFontScale, enabled ? FontScale(userScaleRate: 1, useOSScaleRate: false) : fontScale)
220
214
  }
221
215
  }
222
216
 
@@ -243,13 +237,7 @@ struct TabItemContent: View {
243
237
  }
244
238
  .animation(TabBarMetrics.tintMotion, value: selected)
245
239
  .frame(maxWidth: vertical ? nil : .infinity)
246
- // fixed slot so a capped-scale label overflows downward and the icon above it stays put
247
- label
248
- .modifier(CappedFontScale(enabled: fixedFontScale))
249
- .frame(
250
- height: vertical ? TabBarMetrics.railLabelHeight : TabBarMetrics.labelHeight,
251
- alignment: .top
252
- )
240
+ label.modifier(FixedFontScale(enabled: fixedFontScale))
253
241
  }
254
242
  }
255
243
 
@@ -376,7 +364,7 @@ struct CenterActionStyle: ButtonStyle {
376
364
  maxLines: 1
377
365
  )
378
366
  .truncationMode(.tail)
379
- .modifier(CappedFontScale(enabled: fixedFontScale))
367
+ .modifier(FixedFontScale(enabled: fixedFontScale))
380
368
  .padding(.horizontal, vertical ? Spacing.XS : Spacing.XXS)
381
369
  .frame(minHeight: vertical ? nil : TabBarMetrics.ctaLabelHeight)
382
370
  .overlay(labelContent?.allowsHitTesting(false))
@@ -18,10 +18,6 @@ enum TabBarMetrics {
18
18
  static let itemGap = Spacing.XS
19
19
  static let iconSize: CGFloat = 24
20
20
  static let indicatorHeight: CGFloat = 32
21
- // label_s_medium / label_xs_medium line heights: the label slot keeps this height so a scaled
22
- // label overflows downward instead of pushing the icon up
23
- static let labelHeight: CGFloat = 18
24
- static let railLabelHeight: CGFloat = 14
25
21
  static let indicatorRadius = Radius.XL
26
22
  // home indicator / gesture bar area under the container
27
23
  static let systemIndicatorHeight: CGFloat = 24
@@ -21,32 +21,22 @@ public struct FontScale: Equatable {
21
21
  public let osFontScale: CGFloat
22
22
  // AI-GENERATED START: device scale from the app window, not UIScreen.main (fixed to one display on iPhone Duo)
23
23
  public let windowShortSide: CGFloat
24
- /// Opt-in ceiling (Compose's `MiniAppContext.scaleSizeMaxRate`): when set, the result never
25
- /// exceeds size × maxScaleRate, in both the userScaleRate path and the OS path. nil keeps the
26
- /// old behavior. Used by `CappedFontScale` for the bottom-tab labels.
27
- public let maxScaleRate: CGFloat?
28
24
 
29
25
  public init(
30
26
  userScaleRate: CGFloat = 1,
31
27
  useOSScaleRate: Bool = true,
32
28
  osFontScale: CGFloat = 1,
33
- windowShortSide: CGFloat? = nil,
34
- maxScaleRate: CGFloat? = nil
29
+ windowShortSide: CGFloat? = nil
35
30
  ) {
36
31
  self.userScaleRate = userScaleRate
37
32
  self.useOSScaleRate = useOSScaleRate
38
33
  self.osFontScale = osFontScale
39
34
  self.windowShortSide = windowShortSide ?? DesignSystemKits.currentWindowShortSide()
40
- self.maxScaleRate = maxScaleRate
41
35
  }
42
36
 
43
37
  /// `callAsFunction` so call sites keep reading like Compose's `scaleSize(16)`.
44
38
  public func callAsFunction(_ size: CGFloat) -> CGFloat {
45
- func cap(_ scaled: CGFloat) -> CGFloat {
46
- guard let maxScaleRate else { return scaled }
47
- return min(scaled, size * maxScaleRate)
48
- }
49
- guard useOSScaleRate else { return cap(size * userScaleRate) }
39
+ guard useOSScaleRate else { return size * userScaleRate }
50
40
 
51
41
  // Short side, not width: landscape must not inflate every font (and so every popup's height).
52
42
  let deviceScale = windowShortSide / Self.defaultScreenSize
@@ -58,21 +48,9 @@ public struct FontScale: Equatable {
58
48
  deviceScaled = min(size * deviceScale, size + Self.maxDeviceScale)
59
49
  }
60
50
  if osFontScale > 1 {
61
- osScaled = min(size * osFontScale, size * (maxScaleRate ?? Self.maxFontScale))
51
+ osScaled = min(size * osFontScale, size * Self.maxFontScale)
62
52
  }
63
- return cap(max(deviceScaled, osScaled))
64
- }
65
-
66
- /// A copy that caps the scale at `rate` while keeping the host/OS inputs — the SwiftUI mirror of
67
- /// Compose's `CappedFontScale` wrapper.
68
- public func cappedAt(_ rate: CGFloat) -> FontScale {
69
- FontScale(
70
- userScaleRate: userScaleRate,
71
- useOSScaleRate: useOSScaleRate,
72
- osFontScale: osFontScale,
73
- windowShortSide: windowShortSide,
74
- maxScaleRate: rate
75
- )
53
+ return max(deviceScaled, osScaled)
76
54
  }
77
55
 
78
56
  /// `.system(size:)` is a fixed-size font — SwiftUI does not Dynamic-Type it — so the scale has to
@@ -90,9 +68,8 @@ public struct FontScale: Equatable {
90
68
  useOSScaleRate: useOSScaleRate ?? self.useOSScaleRate,
91
69
  osFontScale: osFontScale,
92
70
  // AI-GENERATED START: keep the window size through context overrides
93
- windowShortSide: windowShortSide,
71
+ windowShortSide: windowShortSide
94
72
  // AI-GENERATED END: keep the window size through context overrides
95
- maxScaleRate: maxScaleRate
96
73
  )
97
74
  }
98
75
  }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKits'
3
- s.version = '0.169.4-beta.1'
3
+ s.version = '0.169.4'
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.169.4-beta.1'
3
+ s.version = '0.169.4'
4
4
  s.summary = 'Demo browser for MoMoUIKits SwiftUI components'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.169.4-beta.1-debug",
3
+ "version": "0.169.4-debug",
4
4
  "private": false,
5
+ "scripts": {
6
+ "publish:local": "bash publish.sh local"
7
+ },
5
8
  "dependeNavigationncies": {},
6
9
  "devDependencies": {},
7
10
  "license": "MoMo"
package/publish.sh CHANGED
@@ -2,8 +2,9 @@
2
2
  # Build & publish vn.momo.kits:kits / :demo (GitLab Maven) and @momo-kits/native-kits (npm).
3
3
  #
4
4
  # bash publish.sh build # build everything that gets published, no upload
5
- # bash publish.sh release [--version 0.169.1] # npm tag latest; default = npm latest + 1 patch
6
- # bash publish.sh beta # <npm latest + 1 patch>-beta.N, npm tag beta
5
+ # bash publish.sh local # beta of the working tree as is (uncommitted too), any branch
6
+ # bash publish.sh beta # CI, other branches: <npm latest + 1 patch>-beta.N, npm tag beta
7
+ # bash publish.sh release [--version 0.169.1] # CI, main only: npm tag latest; default = npm latest + 1 patch
7
8
  # --dry-run: resolve the version and pack the npm tarballs, upload nothing
8
9
  #
9
10
  # The version is never read from the repo; files touched here are put back on exit.
@@ -26,6 +27,7 @@ MODE="${1:-}"
26
27
  [ $# -gt 0 ] && shift
27
28
  RELEASE_VERSION="${RELEASE_VERSION:-}"
28
29
  DRY_RUN=false
30
+ CHANNEL=""
29
31
  while [ $# -gt 0 ]; do
30
32
  case "$1" in
31
33
  --version) RELEASE_VERSION="${2:-}"; shift 2 ;;
@@ -107,17 +109,20 @@ phase_build() {
107
109
  # ----------------------------------------------------------------------------
108
110
  # version: ask the registries, then stamp package.json + podspecs.
109
111
  # ----------------------------------------------------------------------------
110
- phase_version() {
111
- section "📋 VERSION ($MODE)"
112
- local args=("$MODE")
113
- if [ -n "$RELEASE_VERSION" ]; then
114
- [ "$MODE" = "release" ] || die "--version / RELEASE_VERSION is only for release"
115
- args+=(--version "$RELEASE_VERSION")
116
- fi
112
+ check_npm_auth() {
117
113
  # A bad token only surfaces as a 404 on the PUT, so check auth before anything is uploaded.
118
114
  if [ "$DRY_RUN" != true ] && ! npm whoami "${NPM_ARGS[@]}" >/dev/null 2>&1; then
119
115
  die "npm auth failed (npm whoami): set NPM_TOKEN or renew the token in .npmrc"
120
116
  fi
117
+ }
118
+
119
+ phase_version() {
120
+ section "📋 VERSION ($CHANNEL)"
121
+ local args=("$CHANNEL")
122
+ if [ -n "$RELEASE_VERSION" ]; then
123
+ [ "$CHANNEL" = "release" ] || die "--version / RELEASE_VERSION is only for release"
124
+ args+=(--version "$RELEASE_VERSION")
125
+ fi
121
126
 
122
127
  local resolved
123
128
  resolved="$(node scripts/ci/resolve-version.mjs "${args[@]}")"
@@ -193,6 +198,7 @@ build/
193
198
  .gitattributes
194
199
  .gitlab-ci.yml
195
200
  scripts/ci/
201
+ local.properties
196
202
  EOF
197
203
  npm_publish
198
204
  echo "✅ $VERSION-debug done"
@@ -208,12 +214,32 @@ case "$MODE" in
208
214
  phase_build
209
215
  ;;
210
216
  release|beta)
217
+ if [ "$MODE" = release ] && [ -z "${GITLAB_CI:-}" ] && [ "$DRY_RUN" != true ]; then
218
+ die "release (npm tag latest) is published by CI from main only; locally use: bash publish.sh local"
219
+ fi
220
+ CHANNEL="$MODE"
221
+ check_npm_auth
222
+ phase_version
223
+ phase_maven
224
+ phase_npm
225
+ section "🎉 $VERSION published (npm tag $NPM_TAG)"
226
+ ;;
227
+ local)
228
+ [ -z "$RELEASE_VERSION" ] || die "local only publishes betas; --version / RELEASE_VERSION is for release"
229
+ CHANNEL=beta
230
+ BRANCH="$(git branch --show-current)"
231
+ DIRTY=""
232
+ [ -z "$(git status --porcelain)" ] || DIRTY=" + uncommitted changes"
233
+ section "🏠 LOCAL beta from ${BRANCH:-detached HEAD} @ $(git rev-parse --short HEAD)$DIRTY"
234
+ check_npm_auth
235
+ # Outside CI's kits-publish lock: build first so the number is picked right before the upload.
236
+ [ "$DRY_RUN" = true ] || phase_build
211
237
  phase_version
212
238
  phase_maven
213
239
  phase_npm
214
240
  section "🎉 $VERSION published (npm tag $NPM_TAG)"
215
241
  ;;
216
242
  *)
217
- die "Usage: bash publish.sh build | release [--version x.y.z] | beta [--dry-run]"
243
+ die "Usage: bash publish.sh build | local [--dry-run] | beta [--dry-run] | release [--version x.y.z] (CI)"
218
244
  ;;
219
245
  esac