peachsim 0.1.686 → 0.1.688

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 (116) hide show
  1. package/cli/cloud-client.ts +3 -3
  2. package/cli/command-registry.ts +2 -0
  3. package/cli/commands/control.ts +1 -0
  4. package/cli/commands/debug.ts +10 -33
  5. package/cli/commands/do-chain.ts +56 -6
  6. package/cli/commands/inspect/core.ts +2 -0
  7. package/cli/commands/inspect/list.ts +2 -1
  8. package/cli/commands/inspect/settling.ts +17 -3
  9. package/cli/commands/inspect/shared.ts +2 -0
  10. package/cli/commands/inspect/wait-idle.ts +2 -2
  11. package/cli/commands/inspect/wait-ready.ts +3 -3
  12. package/cli/commands/inspect.ts +33 -7
  13. package/cli/commands/location.ts +164 -0
  14. package/cli/commands/platform.ts +1 -1
  15. package/cli/drivers/playwright-sim-host.ts +46 -25
  16. package/cli/main.ts +6 -0
  17. package/detox/index.ts +13 -8
  18. package/dist-lib/agent-daemon-client.cjs +1 -1
  19. package/dist-lib/agent-events.cjs +1 -1
  20. package/dist-lib/agent-identity.cjs +1 -1
  21. package/dist-lib/agent-sessions.cjs +1 -1
  22. package/dist-lib/attached-projects.cjs +1 -1
  23. package/dist-lib/auth/shared-session.cjs +1 -1
  24. package/dist-lib/backend-origin.cjs +1 -1
  25. package/dist-lib/beta.cjs +1 -1
  26. package/dist-lib/beta.mjs +1 -1
  27. package/dist-lib/bridge-constants.cjs +4 -3
  28. package/dist-lib/bridge-contract-input.cjs +12 -1
  29. package/dist-lib/bridge-contract-input.mjs +12 -1
  30. package/dist-lib/bridge-contract.cjs +4 -3
  31. package/dist-lib/bridge-contract.mjs +4 -3
  32. package/dist-lib/capture-contract.cjs +1 -1
  33. package/dist-lib/capture-contract.mjs +1 -1
  34. package/dist-lib/cli-constants.cjs +1 -1
  35. package/dist-lib/cloud-contract.cjs +2 -1
  36. package/dist-lib/cloud-contract.mjs +2 -1
  37. package/dist-lib/cloud-test-args.cjs +1 -1
  38. package/dist-lib/cloud-test-args.mjs +1 -1
  39. package/dist-lib/cloud.cjs +2 -1
  40. package/dist-lib/cloud.mjs +2 -1
  41. package/dist-lib/config.cjs +1 -1
  42. package/dist-lib/detox/index.cjs +1197 -65
  43. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  44. package/dist-lib/home-paths.cjs +1 -1
  45. package/dist-lib/host/bridge-host.cjs +402 -113
  46. package/dist-lib/host/fetch-proxy-handler.cjs +50 -40
  47. package/dist-lib/host/fetch-proxy-overrides.cjs +50 -6
  48. package/dist-lib/host/fetch-proxy-overrides.mjs +48 -5
  49. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  50. package/dist-lib/host/websocket-proxy.cjs +1 -1
  51. package/dist-lib/index.cjs +29 -11
  52. package/dist-lib/jump-to-source-babel.cjs +1 -1
  53. package/dist-lib/jump-to-source-native.cjs +1 -1
  54. package/dist-lib/kotlin-host.cjs +89 -13
  55. package/dist-lib/menu.cjs +1 -1
  56. package/dist-lib/menu.mjs +1 -1
  57. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  58. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  59. package/dist-lib/metro-production-bundle.cjs +1 -1
  60. package/dist-lib/metro-production-bundle.mjs +1 -1
  61. package/dist-lib/metro.cjs +5 -3
  62. package/dist-lib/native-app-identity.cjs +8 -3
  63. package/dist-lib/native-app-identity.mjs +8 -3
  64. package/dist-lib/native-firebase-metadata.cjs +1 -1
  65. package/dist-lib/native-firebase-metadata.mjs +1 -1
  66. package/dist-lib/plist.cjs +1 -1
  67. package/dist-lib/plist.mjs +1 -1
  68. package/dist-lib/profiles.cjs +1 -1
  69. package/dist-lib/public-brand.cjs +1 -1
  70. package/dist-lib/react-native-host-modules.cjs +1 -1
  71. package/dist-lib/react-native-host-modules.mjs +1 -1
  72. package/dist-lib/render-mode.cjs +1 -1
  73. package/dist-lib/scripts/dev-server-scanner.cjs +2 -2
  74. package/dist-lib/sdk.cjs +21 -6
  75. package/dist-lib/sdk.mjs +21 -6
  76. package/dist-lib/skills.cjs +441 -135
  77. package/dist-lib/swift-compile.cjs +317 -27
  78. package/dist-lib/swift-compile.mjs +315 -27
  79. package/dist-lib/swift-package.cjs +1 -1
  80. package/dist-lib/swift-package.mjs +1 -1
  81. package/dist-lib/swift-submit.cjs +2 -2
  82. package/dist-lib/swift-submit.mjs +2 -2
  83. package/dist-lib/swift-toolchain.cjs +10 -10
  84. package/dist-lib/swift.cjs +1 -1
  85. package/dist-lib/vite-swift.cjs +320 -49
  86. package/dist-lib/vite.cjs +1 -1
  87. package/kotlin/AppSources/android/content/res/Configuration.kt +2 -0
  88. package/kotlin/AppSources/android/content/res/Resources.kt +6 -3
  89. package/kotlin/AppSources/android/util/DisplayMetrics.kt +12 -0
  90. package/kotlin/AppSources/androidx/compose/ui/res/PainterResources.kt +70 -0
  91. package/kotlin/AppSources/dev/peach/app/PeachApp.kt +12 -10
  92. package/kotlin/AppSources/dev/peach/app/PeachDrawable.kt +95 -0
  93. package/kotlin/fixtures/kotlin-app-variants/Bitmaps.kt +50 -0
  94. package/kotlin/fixtures/kotlin-app-variants/Drawables.kt +53 -0
  95. package/package.json +2 -2
  96. package/scripts/dev-server-scanner.ts +3 -1
  97. package/skills/contrast/SKILL.md +1 -0
  98. package/src/android-drawables.ts +315 -0
  99. package/src/android-theme.ts +9 -0
  100. package/src/bridge-constants.ts +3 -2
  101. package/src/bridge-contract-input.ts +11 -0
  102. package/src/bridge-contract.ts +45 -3
  103. package/src/cloud-contract.ts +1 -0
  104. package/src/host/fetch-proxy-handler.ts +13 -49
  105. package/src/host/fetch-proxy-overrides.ts +69 -12
  106. package/src/kotlin-app.ts +6 -0
  107. package/src/kotlin-host.ts +103 -15
  108. package/src/native-app-identity.ts +16 -3
  109. package/src/swift-compile.ts +426 -29
  110. package/src/swift-distribution-contract.ts +11 -4
  111. package/src/swift-distribution.lock.json +11 -9
  112. package/src/swift-distribution.ts +4 -4
  113. package/src/swift-icu.ts +8 -11
  114. package/src/swift-submit.ts +13 -1
  115. package/src/swift-toolchain.ts +17 -9
  116. package/src/vite-plugin.ts +86 -34
@@ -0,0 +1,70 @@
1
+ package androidx.compose.ui.res
2
+
3
+ import android.content.res.Resources
4
+ import androidx.compose.runtime.Composable
5
+ import androidx.compose.runtime.remember
6
+ import androidx.compose.ui.graphics.ImageBitmap
7
+ import androidx.compose.ui.graphics.painter.BitmapPainter
8
+ import androidx.compose.ui.graphics.painter.Painter
9
+ import androidx.compose.ui.graphics.vector.ImageVector
10
+ import androidx.compose.ui.graphics.vector.rememberVectorPainter
11
+ import androidx.compose.ui.platform.LocalConfiguration
12
+ import androidx.compose.ui.platform.LocalResources
13
+ import dev.peach.app.PeachDrawable
14
+ import dev.peach.app.peachAppDrawables
15
+ import dev.peach.app.peachDecodeBitmap
16
+ import dev.peach.app.peachDrawable
17
+
18
+ // PainterResources.android.kt, VectorResources.android.kt and
19
+ // ImageResources.android.kt: the drawable file the display's density selects,
20
+ // a vector built for the configuration and cached per configuration as the
21
+ // image vector cache is pruned on a configuration change, or a bitmap
22
+
23
+ @Composable
24
+ fun painterResource(id: Int): Painter {
25
+ val res = LocalResources.current
26
+ val configuration = LocalConfiguration.current
27
+ return when (val drawable = res.drawable(id)) {
28
+ is PeachDrawable.Vector ->
29
+ rememberVectorPainter(remember(id, configuration) { drawable.build(res.configuration.isNight()) })
30
+ is PeachDrawable.Xml -> throw IllegalArgumentException(
31
+ "Only VectorDrawables and rasterized asset types are supported ex. PNG, JPG, WEBP",
32
+ )
33
+ is PeachDrawable.Bitmap ->
34
+ BitmapPainter(remember(drawable.path, id) { peachDecodeBitmap(drawable, res.displayMetrics.densityDpi) })
35
+ }
36
+ }
37
+
38
+ @Composable
39
+ fun ImageVector.Companion.vectorResource(id: Int): ImageVector {
40
+ val res = LocalResources.current
41
+ return remember(id, res, res.configuration) { vectorResource(res, id) }
42
+ }
43
+
44
+ fun ImageVector.Companion.vectorResource(res: Resources, resId: Int): ImageVector =
45
+ when (val drawable = res.drawable(resId)) {
46
+ is PeachDrawable.Vector -> drawable.build(res.configuration.isNight())
47
+ // the parser reads another root tag's missing viewport
48
+ else -> throw IllegalArgumentException("${drawable.path}: <VectorGraphic> tag requires viewportWidth > 0")
49
+ }
50
+
51
+ @Composable
52
+ fun ImageBitmap.Companion.imageResource(id: Int): ImageBitmap {
53
+ val res = LocalResources.current
54
+ val drawable = res.drawable(id)
55
+ return remember(drawable.path) { imageResource(res, id) }
56
+ }
57
+
58
+ // the drawable must be a BitmapDrawable
59
+ fun ImageBitmap.Companion.imageResource(res: Resources, id: Int): ImageBitmap =
60
+ when (val drawable = res.drawable(id)) {
61
+ is PeachDrawable.Bitmap -> peachDecodeBitmap(drawable, res.displayMetrics.densityDpi)
62
+ else -> throw ClassCastException("${drawable.path} is not a BitmapDrawable")
63
+ }
64
+
65
+ private fun Resources.drawable(id: Int): PeachDrawable =
66
+ peachDrawable(
67
+ peachAppDrawables[id]?.takeUnless { it.isEmpty() }
68
+ ?: throw Resources.NotFoundException("Resource ID #0x${id.toString(16)}"),
69
+ displayMetrics.densityDpi,
70
+ )
@@ -39,6 +39,8 @@ import mounts
39
39
  import preparePeachDevice
40
40
  import robotoFamily
41
41
  import org.json.JSONObject
42
+ import android.util.DisplayMetrics
43
+ import kotlin.math.roundToInt
42
44
 
43
45
  // what the manifest, Gradle files and theme resolved: the launcher component
44
46
  // the intent names (an alias stays the alias), the activity class it runs, what
@@ -160,7 +162,10 @@ internal fun peachStartApp(
160
162
  try {
161
163
  require(backend == "graphite" || backend == "raster")
162
164
  preparePeachDevice(locale)
163
- processResources = Resources(deviceConfiguration(night, locale))
165
+ val metrics = DisplayMetrics()
166
+ metrics.densityDpi = (density * DisplayMetrics.DENSITY_DEFAULT).roundToInt()
167
+ metrics.density = metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT.toFloat()
168
+ processResources = Resources(deviceConfiguration(night, locale), metrics)
164
169
  val application = spec.createApplication()
165
170
  application.onCreate()
166
171
  val app = AppProcess(
@@ -216,7 +221,7 @@ private fun launchActivity(app: AppProcess, lastNonConfigurationInstance: Any?):
216
221
  }
217
222
  // the theme the activity is created under: a relaunch after a night
218
223
  // change takes the other one
219
- val theme = if (isNight(processResources.configuration)) spec.nightWindow else spec.dayWindow
224
+ val theme = if (processResources.configuration.isNight()) spec.nightWindow else spec.dayWindow
220
225
  window = Window(activity, theme, host)
221
226
  activity.attach(
222
227
  app.application,
@@ -234,10 +239,10 @@ private fun launchActivity(app: AppProcess, lastNonConfigurationInstance: Any?):
234
239
  app.paused = false
235
240
  app.stopped = false
236
241
  app.state = null
237
- app.reportedNight = isNight(activity.resources.configuration)
242
+ app.reportedNight = activity.resources.configuration.isNight()
238
243
  mount = PeachComposeMount(
239
244
  app.density, app.fontScale, app.locale, app.gpu, app.stencilBits, app.fonts, app.invalidate,
240
- night = isNight(activity.resources.configuration),
245
+ night = activity.resources.configuration.isNight(),
241
246
  owners = componentActivity?.let(::ActivityOwners),
242
247
  insets = DeviceInsets(window, app.insets) { app.ime },
243
248
  clockRunning = { componentActivity == null || componentActivity.lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED) },
@@ -327,21 +332,18 @@ internal fun peachAppTask(foreground: Boolean) {
327
332
  // configChanges uiMode. true when it relaunched.
328
333
  private fun reportConfiguration(app: AppProcess): Boolean {
329
334
  val configuration = processResources.configuration
330
- if (isNight(configuration) == app.reportedNight) return false
335
+ if (configuration.isNight() == app.reportedNight) return false
331
336
  if (!app.spec.handlesUiMode) {
332
337
  relaunch(app)
333
338
  return true
334
339
  }
335
- app.reportedNight = isNight(configuration)
340
+ app.reportedNight = configuration.isNight()
336
341
  app.activity.performConfigurationChanged(Configuration().apply { setTo(configuration) })
337
342
  app.configuration.value = Configuration().apply { setTo(configuration) }
338
343
  app.mount.night = app.reportedNight
339
344
  return false
340
345
  }
341
346
 
342
- private fun isNight(configuration: Configuration) =
343
- configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES
344
-
345
347
  // the software keyboard moved: its inset reaches the window's content
346
348
  internal fun peachAppIme(bottom: Int) {
347
349
  val app = runningApp()
@@ -356,7 +358,7 @@ internal fun peachAppIme(bottom: Int) {
356
358
  internal fun peachAppNight(night: Boolean) {
357
359
  val app = runningApp()
358
360
  val configuration = processResources.configuration
359
- if (isNight(configuration) == night) return
361
+ if (configuration.isNight() == night) return
360
362
  configuration.setTo(deviceConfiguration(night, app.locale))
361
363
  app.application.onConfigurationChanged(Configuration().apply { setTo(configuration) })
362
364
  if (!app.stopped) reportConfiguration(app)
@@ -0,0 +1,95 @@
1
+ package dev.peach.app
2
+
3
+ import androidx.compose.ui.graphics.Brush
4
+ import androidx.compose.ui.graphics.Color
5
+ import androidx.compose.ui.graphics.ImageBitmap
6
+ import androidx.compose.ui.graphics.SolidColor
7
+ import androidx.compose.ui.graphics.toComposeImageBitmap
8
+ import androidx.compose.ui.graphics.vector.ImageVector
9
+ import kotlin.io.encoding.Base64
10
+ import kotlin.io.encoding.ExperimentalEncodingApi
11
+ import org.jetbrains.skia.BlendMode
12
+ import org.jetbrains.skia.FilterMipmap
13
+ import org.jetbrains.skia.FilterMode
14
+ import org.jetbrains.skia.Image
15
+ import org.jetbrains.skia.MipmapMode
16
+ import org.jetbrains.skia.Paint
17
+ import org.jetbrains.skia.Rect
18
+ import org.jetbrains.skia.Surface
19
+
20
+ // one file a drawable resource resolves to under a density (ResTable_config's
21
+ // value, 0 for an unqualified directory) and a platform version: a vector the
22
+ // build translated into ImageVector.Builder calls for a day or night
23
+ // configuration, a non-vector XML drawable, or an encoded bitmap
24
+ internal sealed class PeachDrawable(val path: String, val density: Int, val version: Int) {
25
+ class Vector(path: String, density: Int, version: Int, val build: (night: Boolean) -> ImageVector) :
26
+ PeachDrawable(path, density, version)
27
+ class Xml(path: String, density: Int, version: Int) : PeachDrawable(path, density, version)
28
+ class Bitmap(path: String, density: Int, version: Int, val ninePatch: Boolean, val data: String) :
29
+ PeachDrawable(path, density, version)
30
+ }
31
+
32
+ private const val DENSITY_DEFAULT = 0
33
+ private const val DENSITY_MEDIUM = 160
34
+ private const val DENSITY_ANY = 0xfffe
35
+ private const val DENSITY_NONE = 0xffff
36
+
37
+ // the file the resource table picks for the display's density, then the
38
+ // highest platform version
39
+ internal fun peachDrawable(files: List<PeachDrawable>, densityDpi: Int): PeachDrawable =
40
+ files.reduce { best, file -> if (isBetter(file, best, densityDpi)) file else best }
41
+
42
+ // ResTable_config::isBetterThan's density rule: anydpi wins, then between two
43
+ // densities on one side of the request the nearer, across it the larger
44
+ // unless the smaller is close enough
45
+ private fun isBetter(a: PeachDrawable, b: PeachDrawable, requested: Int): Boolean {
46
+ if (a.density != b.density) {
47
+ val thisDensity = if (a.density == DENSITY_DEFAULT) DENSITY_MEDIUM else a.density
48
+ val otherDensity = if (b.density == DENSITY_DEFAULT) DENSITY_MEDIUM else b.density
49
+ if (thisDensity == DENSITY_ANY) return true
50
+ if (otherDensity == DENSITY_ANY) return false
51
+ var high = thisDensity
52
+ var low = otherDensity
53
+ var bigger = true
54
+ if (low > high) {
55
+ high = otherDensity
56
+ low = thisDensity
57
+ bigger = false
58
+ }
59
+ if (requested >= high) return bigger
60
+ if (low >= requested) return !bigger
61
+ return if ((2 * low - requested) * high > requested * requested) !bigger else bigger
62
+ }
63
+ return a.version > b.version
64
+ }
65
+
66
+ // ImageDecoder.computeDensity, which resources decode drawables through: a
67
+ // bitmap drawn for a higher density than the display's is scaled down, its
68
+ // size rounded, through a linear filtered draw with the source blend; one
69
+ // drawn for a lower density, or nodpi, keeps its pixels, as from API 28 the
70
+ // upscale is left to draw time, which BitmapPainter does not do
71
+ @OptIn(ExperimentalEncodingApi::class)
72
+ internal fun peachDecodeBitmap(drawable: PeachDrawable.Bitmap, targetDensity: Int): ImageBitmap {
73
+ if (drawable.ninePatch)
74
+ throw UnsupportedOperationException("peach kotlin: the nine-patch drawable ${drawable.path} is not drawn yet")
75
+ val image = Image.makeFromEncoded(Base64.decode(drawable.data))
76
+ val density = if (drawable.density == DENSITY_DEFAULT) DENSITY_MEDIUM else drawable.density
77
+ if (drawable.density == DENSITY_NONE || density <= targetDensity) return image.toComposeImageBitmap()
78
+ val scale = targetDensity.toFloat() / density
79
+ val width = maxOf((image.width * scale + 0.5f).toInt(), 1)
80
+ val height = maxOf((image.height * scale + 0.5f).toInt(), 1)
81
+ val surface = Surface.makeRasterN32Premul(width, height)
82
+ surface.canvas.scale(width.toFloat() / image.width, height.toFloat() / image.height)
83
+ surface.canvas.drawImageRect(
84
+ image,
85
+ Rect.makeWH(image.width.toFloat(), image.height.toFloat()),
86
+ Rect.makeWH(image.width.toFloat(), image.height.toFloat()),
87
+ FilterMipmap(FilterMode.LINEAR, MipmapMode.NONE),
88
+ Paint().apply { blendMode = BlendMode.SRC },
89
+ false,
90
+ )
91
+ return surface.makeImageSnapshot().toComposeImageBitmap()
92
+ }
93
+
94
+ // ComplexColorCompat.willDraw: a transparent solid color draws nothing
95
+ internal fun peachBrush(argb: Int): Brush? = if (argb != 0) SolidColor(Color(argb)) else null
@@ -0,0 +1,50 @@
1
+ package dev.contrast.kotlinapp
2
+
3
+ import androidx.compose.foundation.Image
4
+ import androidx.compose.foundation.background
5
+ import androidx.compose.foundation.layout.Arrangement
6
+ import androidx.compose.foundation.layout.Column
7
+ import androidx.compose.foundation.layout.Row
8
+ import androidx.compose.foundation.layout.fillMaxSize
9
+ import androidx.compose.foundation.layout.padding
10
+ import androidx.compose.foundation.layout.safeDrawingPadding
11
+ import androidx.compose.foundation.layout.size
12
+ import androidx.compose.material3.Text
13
+ import androidx.compose.runtime.Composable
14
+ import androidx.compose.ui.Modifier
15
+ import androidx.compose.ui.graphics.Color
16
+ import androidx.compose.ui.graphics.ImageBitmap
17
+ import androidx.compose.ui.graphics.painter.Painter
18
+ import androidx.compose.ui.res.imageResource
19
+ import androidx.compose.ui.res.painterResource
20
+ import androidx.compose.ui.unit.dp
21
+
22
+ // bitmap drawables: each one's size after the decoder scales it from its
23
+ // density bucket to the display's, drawn at that size and stretched
24
+ @Composable
25
+ fun BitmapsScreen() {
26
+ val photo = painterResource(R.drawable.photo)
27
+ val plain = ImageBitmap.imageResource(R.drawable.plain)
28
+ val raw = painterResource(R.drawable.raw)
29
+ val near = painterResource(R.drawable.near)
30
+ val far = painterResource(R.drawable.far)
31
+ fun size(painter: Painter) = "${painter.intrinsicSize.width.toInt()}x${painter.intrinsicSize.height.toInt()}"
32
+ Column(
33
+ Modifier.fillMaxSize().background(Color(0xFFE8EEF8)).safeDrawingPadding().padding(16.dp),
34
+ verticalArrangement = Arrangement.spacedBy(16.dp),
35
+ ) {
36
+ Text("Bitmaps: ${size(photo)} ${plain.width}x${plain.height} ${size(raw)} ${size(near)} ${size(far)}")
37
+ Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
38
+ Image(photo, "photo")
39
+ Image(plain, "plain")
40
+ Image(raw, "raw")
41
+ Image(near, "near")
42
+ Image(far, "far")
43
+ }
44
+ Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
45
+ Image(photo, "photo large", Modifier.size(120.dp, 90.dp))
46
+ Image(plain, "plain large", Modifier.size(120.dp, 90.dp))
47
+ Image(raw, "raw large", Modifier.size(120.dp, 90.dp))
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,53 @@
1
+ package dev.contrast.kotlinapp
2
+
3
+ import android.content.res.Resources
4
+ import androidx.compose.foundation.Image
5
+ import androidx.compose.foundation.background
6
+ import androidx.compose.foundation.isSystemInDarkTheme
7
+ import androidx.compose.foundation.layout.Arrangement
8
+ import androidx.compose.foundation.layout.Column
9
+ import androidx.compose.foundation.layout.Row
10
+ import androidx.compose.foundation.layout.fillMaxSize
11
+ import androidx.compose.foundation.layout.padding
12
+ import androidx.compose.foundation.layout.safeDrawingPadding
13
+ import androidx.compose.foundation.layout.size
14
+ import androidx.compose.material3.Text
15
+ import androidx.compose.runtime.Composable
16
+ import androidx.compose.runtime.remember
17
+ import androidx.compose.ui.Modifier
18
+ import androidx.compose.ui.graphics.Color
19
+ import androidx.compose.ui.graphics.vector.ImageVector
20
+ import androidx.compose.ui.platform.LocalResources
21
+ import androidx.compose.ui.res.painterResource
22
+ import androidx.compose.ui.res.vectorResource
23
+ import androidx.compose.ui.unit.dp
24
+
25
+ // vector drawables through painterResource and vectorResource: fills and
26
+ // strokes, groups with transforms and a clip path, trim, tint, a platform
27
+ // version override and a color values-night redefines
28
+ @Composable
29
+ fun DrawablesScreen() {
30
+ val resources = LocalResources.current
31
+ remember(resources) {
32
+ check(R.drawable.only_v99 != 0)
33
+ check(runCatching {
34
+ ImageVector.vectorResource(res = resources, resId = R.drawable.only_v99)
35
+ }.exceptionOrNull() is Resources.NotFoundException)
36
+ }
37
+ Column(
38
+ Modifier.fillMaxSize().background(Color(0xFFE8EEF8)).safeDrawingPadding().padding(16.dp),
39
+ verticalArrangement = Arrangement.spacedBy(16.dp),
40
+ ) {
41
+ Text("Drawables: dark " + isSystemInDarkTheme())
42
+ Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
43
+ Image(painterResource(R.drawable.ic_heart), "heart", Modifier.size(96.dp))
44
+ Image(painterResource(R.drawable.ic_group), "group", Modifier.size(96.dp))
45
+ Image(painterResource(R.drawable.ic_trim), "trim", Modifier.size(96.dp))
46
+ }
47
+ Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
48
+ Image(ImageVector.vectorResource(R.drawable.ic_tinted), "tinted", Modifier.size(96.dp))
49
+ Image(painterResource(R.drawable.ic_versioned), "versioned", Modifier.size(96.dp))
50
+ Image(painterResource(R.drawable.ic_heart), "intrinsic")
51
+ }
52
+ }
53
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.686",
3
+ "version": "0.1.688",
4
4
  "description": "Vite and Metro plugins, testing drivers, and SDK exports for peach.",
5
5
  "author": "Tamagui LLC",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -349,7 +349,7 @@
349
349
  "peach-kit": "workspace:*",
350
350
  "peach-cloud-box": "workspace:*",
351
351
  "peach-engine": "workspace:*",
352
- "typescript": "7.0.2",
352
+ "typescript": "7.1.0-dev.20261003.1",
353
353
  "vite": "^8.2.2",
354
354
  "json5": "^2.2.3",
355
355
  "yaml": "^2.8.3"
@@ -1328,5 +1328,7 @@ export async function scanDevServers(
1328
1328
  if (!livePids.has(pid)) cwdByPid.delete(pid)
1329
1329
  }
1330
1330
 
1331
- return results.filter((r) => !isSootSimSelfServer(r))
1331
+ // cached ports land before freshly probed ones, so arrival order changes
1332
+ // whenever a cache entry expires; port order keeps the dock from reshuffling
1333
+ return results.filter((r) => !isSootSimSelfServer(r)).sort((a, b) => a.port - b.port)
1332
1334
  }
@@ -28,6 +28,7 @@ automation, inspecting the render tree, and managing sims.
28
28
  | `peach film` | record a flow on the flat canvas, play it back on the 3d device stage under a camera cinematic, save a clip |
29
29
  | `peach storage` | manage guest app storage and launch profiles |
30
30
  | `peach permissions` | inspect and change simulated operating-system permissions |
31
+ | `peach location` | control the simulator's simulated device location |
31
32
  | `peach perf` | CPU, React render, shell frame, and scroll-layer profiling |
32
33
  | `peach describe` | curated human-readable UI summary (default inspection tool) |
33
34
  | `peach find` | locate nodes by text / testID / role / type / predicate |