From d546bc7a3a1610dbcd92993014bf1f513d698624 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Fri, 16 Oct 2026 13:08:54 +0100 Subject: [PATCH] Migrate the graph, panes, rail and sheet onto the geometry tokens Move the workflow-graph package (WorkflowGraph, the StageDetailPane sheet, Artifacts, ArtifactViewer, ArtifactImage) off its remaining raw dp literals and onto the geometry tokens, all substitutions value-equal so the visuals are unchanged. - ui/theme/Dimens.kt gains the off-scale component and graph-chrome sizes: the run legend's GRAPH_LEGEND_PAD_X/PAD_Y/GAP, the collapsed GRAPH_PANEL_MIN_HEIGHT (moved off WorkflowGraph.kt, now imported by its test), the gallery's ARTIFACT_TILE_DP/THUMB_DP/BADGE_DP/PROGRESS_DP/ PROGRESS_STROKE_DP, and the stage-type chip's STAGE_CHIP_PAD_H. - Artifact tile/row and thumbnail corner radii derive from the Material shape scale (MaterialTheme.shapes.medium/.small), matching the graph's existing node corners. - DimensTest.kt's allow-list shrinks from 24 to 21 entries: 24.dp, 56.dp and 96.dp are gone now that their last call sites migrated. The structural hairlines/zeros, the not-yet-migrated app shell and Settings literals, and the sp type values owned by Typography.kt remain. - WorkflowGraphTest.kt imports the moved GRAPH_PANEL_MIN_HEIGHT. - android/README.md documents the change and its verification evidence. Verified: gradle :app:assembleDebug :app:testDebugUnitTest --rerun-tasks BUILD SUCCESSFUL, 30 XMLs / 259 tests, 0 failures/errors/skipped; the enforcement test fails on a deliberately introduced literal and passes once removed; before/after captures at both window widths differ only on the status-bar clock and live relative-time text. --- android/README.md | 85 +++++++++++++++++++ .../awan/pipelines/ui/graph/ArtifactImage.kt | 10 +-- .../awan/pipelines/ui/graph/ArtifactViewer.kt | 10 ++- .../net/awan/pipelines/ui/graph/Artifacts.kt | 37 ++++---- .../pipelines/ui/graph/StageDetailPane.kt | 12 ++- .../awan/pipelines/ui/graph/WorkflowGraph.kt | 18 ++-- .../net/awan/pipelines/ui/theme/Dimens.kt | 38 +++++++++ .../pipelines/ui/graph/WorkflowGraphTest.kt | 1 + .../net/awan/pipelines/ui/theme/DimensTest.kt | 16 ++-- 9 files changed, 179 insertions(+), 48 deletions(-) diff --git a/android/README.md b/android/README.md index 92a1d048..9ad86191 100644 --- a/android/README.md +++ b/android/README.md @@ -2414,6 +2414,91 @@ Not verified in this pass: `:app:lintDebug` (not run); the Runs-list and run-detail before/after pairs are not byte-identical because their live relative-time text and artifact thumbnails load asynchronously. +## The graph, panes, rail and sheet on the geometry tokens (16 Oct 2026) + +`android/` only. Every replacement is value-equal, so the workflow graph, the +artifact gallery/viewer and the pane surfaces render exactly as before. No new +dependency, no server/Go/installer/Docker file touched, no run started from the +app, and every `adb`/emulator command targeted `emulator-5554` only (never +`emulator-5556` or the attached Pixel). + +- **Scope.** The workflow-graph package (`ui/graph/WorkflowGraph.kt`, + `StageDetailPane.kt` — the stage detail *sheet* — `Artifacts.kt`, + `ArtifactViewer.kt`, `ArtifactImage.kt`) plus the two navigation components the + previous item left with their literals: the sliding *pane* + (`ui/components/SlidingPaneStack.kt`) and the detail *rail* + (`ui/components/DetailTabs.kt`). The pane and the rail already derive every + width and offset from tokens, so their only remaining literal is the structural + `0.dp` recorded in the allow-list; the graph/sheet/gallery files carried the + rest. +- **Spacing.** Every 2/4/8/12/16/24dp padding, gap, arrangement and offset on + those files now references `SPACING_XXS/XS/S/M/L/XL`; no value changed. +- **New tokens.** The off-scale component and graph-chrome sizes move into + `ui/theme/Dimens.kt`: the run legend's `GRAPH_LEGEND_PAD_X` (6dp), + `GRAPH_LEGEND_PAD_Y` (3dp) and `GRAPH_LEGEND_GAP` (10dp); the collapsed + `GRAPH_PANEL_MIN_HEIGHT` (320dp, moved off `WorkflowGraph.kt` and now imported + by its test); the gallery's `ARTIFACT_TILE_DP` (96dp), `ARTIFACT_THUMB_DP` + (56dp), `ARTIFACT_BADGE_DP` (16dp), `ARTIFACT_PROGRESS_DP` (24dp) and + `ARTIFACT_PROGRESS_STROKE_DP` (2dp); and the stage-type chip's + `STAGE_CHIP_PAD_H` (10dp). The artifact tile/row and thumbnail corner radii + derive from the Material shape scale (`MaterialTheme.shapes.medium`/`.small`), + exactly as the graph's own node corners already do, so no radius literal + remains. +- **The allow-list shrinks.** `ui/theme/DimensTest.kt`'s allow-list drops from + **24 to 21 entries**: `24.dp`, `56.dp` and `96.dp` are gone because their last + call site migrated onto a token. The remaining entries are the structural + hairlines/zeros (0/2/3/6dp), the spacing values still used by the not-yet- + migrated app shell and Settings screen, and the `sp` type values owned by + `Typography.kt`. + +Evidence (macOS, JDK 17 from Homebrew `openjdk@17`, +`ANDROID_HOME=~/Library/Android/sdk`, Gradle 9.7.1, `--offline`): + +- `gradle :app:assembleDebug :app:testDebugUnitTest --rerun-tasks --console=plain` + → `BUILD SUCCESSFUL`; `--rerun-tasks` re-ran all 30 result XMLs to **259 tests, + 0 failures, 0 errors, 0 skipped**. `app/build/outputs/apk/debug/app-debug.apk` + is 17,995,009 bytes, sha256 + `c5da095aec8a01120d4d847da69f71fa2fe0f937290f3c9a5190a9de8b813b0f`. +- **Allow-list shrinks.** `git show HEAD:…DimensTest.kt` counts 24 entries; the + working tree counts 21. +- **Enforcement proof.** Appending `private val PROBE_RAW_LITERAL = 123.dp` to + `ui/graph/Artifacts.kt` made + `gradle :app:testDebugUnitTest --tests net.awan.pipelines.ui.theme.DimensTest` + `FAILED` with `raw dimension literals outside + net/awan/pipelines/ui/theme/Dimens.kt: + [net/awan/pipelines/ui/graph/Artifacts.kt:497: 123.dp]`; removing the line made + the same task `BUILD SUCCESSFUL`. The probe was reverted. +- **Before/after screenshots on `emulator-5554` only** (fold AVD, 2076x2152 / + 390dpi; narrow 1080x2340 and wide 2000x3400 via `wm size`; never + `emulator-5556` or the attached Pixel), against the live server at + `ws://10.0.2.2:8080/connect`, each frame captured and validated with + `scripts/capture_png.sh -s emulator-5554`. The **before** APK was built from a + `git archive HEAD` tree (`3765fdf`, sha256 `d40d7b78…`, byte-identical to the + previous item's published APK); the **after** APK from the working tree (sha256 + `c5da095a…`). Three surfaces were captured at both widths — the Pipelines list + (the *panes*), the "Friend demo" pipeline **Graph** tab, and the opened stage + detail **sheet** — as `graph-*`, `sheet-*` and `list-{narrow,wide}-{before,after}.png` + in `~/.local/share/pipelines/data/artifacts/125/1/`. `captures/imgdiff.py` + reports a mean channel difference of `0.0` for the wide sheet, `0.01` for the + wide/narrow graph and the wide list, and `0.03` for the narrow sheet — the only + differing pixels are the status-bar clock; the list pairs also differ on their + live relative-time text. The layout itself is unchanged. +- `adb -s emulator-5554 logcat -d` held 0 `FATAL EXCEPTION` / 0 + `E AndroidRuntime` lines; `animator_duration_scale` was left at 1; no run was + started from the app. +- **APK publish.** `app-debug.apk` copied to + `~/.local/share/pipelines/data/artifacts/125/1/pipelines-debug-wip-3765fdf.apk` + (`3765fdf` = `git rev-parse --short HEAD`; the working tree is uncommitted WIP + on top of it), sha256 `c5da095a…`. `curl -I + http://10.0.0.249:8080/artifacts/125/1/pipelines-debug-wip-3765fdf.apk` + returned `HTTP/1.1 200 OK`, `Content-Type: + application/vnd.android.package-archive`, `Content-Length: 17995009`, and a + streamed `GET | shasum -a 256` returned the same `c5da095a…`. + +Not verified in this pass: `:app:lintDebug` (not run); the app shell +(`PipelinesApp.kt`) and the Settings screen still keep their literals, so those +allow-list entries remain. + ## An app-owned run-status palette (16 Oct 2026) Run status had the wrong hue for its two most important states because it was diff --git a/android/app/src/main/java/net/awan/pipelines/ui/graph/ArtifactImage.kt b/android/app/src/main/java/net/awan/pipelines/ui/graph/ArtifactImage.kt index 96394c65..d08faec2 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/graph/ArtifactImage.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/graph/ArtifactImage.kt @@ -23,9 +23,11 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.dp import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext +import net.awan.pipelines.ui.theme.ARTIFACT_PROGRESS_DP +import net.awan.pipelines.ui.theme.ARTIFACT_PROGRESS_STROKE_DP +import net.awan.pipelines.ui.theme.ARTIFACT_THUMB_DP /** * Encoded artifact bytes, fetched at most once per url and kept in memory so a @@ -85,7 +87,7 @@ internal fun ArtifactImage( maxDim: Int, fetchBytes: suspend (String) -> ByteArray?, modifier: Modifier = Modifier, - size: Dp = 56.dp, + size: Dp = ARTIFACT_THUMB_DP, ) { val state = rememberArtifactBitmap(url, maxDim, fetchBytes) Box(modifier.size(size), contentAlignment = Alignment.Center) { @@ -173,7 +175,3 @@ private fun decodeSampled(bytes: ByteArray, maxDim: Int): Bitmap? = try { } catch (_: Throwable) { null } - -/** The loading indicator's size and stroke, a small inline spinner. */ -private val ARTIFACT_PROGRESS_DP = 24.dp -private val ARTIFACT_PROGRESS_STROKE_DP = 2.dp diff --git a/android/app/src/main/java/net/awan/pipelines/ui/graph/ArtifactViewer.kt b/android/app/src/main/java/net/awan/pipelines/ui/graph/ArtifactViewer.kt index eb4b2158..f32013ce 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/graph/ArtifactViewer.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/graph/ArtifactViewer.kt @@ -49,12 +49,14 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalView import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.unit.dp import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.DialogProperties import androidx.compose.ui.window.DialogWindowProvider import net.awan.pipelines.ui.components.copyText import net.awan.pipelines.ui.components.paneSafeArea +import net.awan.pipelines.ui.theme.SPACING_M +import net.awan.pipelines.ui.theme.SPACING_XL +import net.awan.pipelines.ui.theme.SPACING_XS import net.awan.pipelines.ui.theme.pipelinesText import kotlin.math.abs @@ -250,9 +252,9 @@ private fun ZoomableArtifact( private fun ViewerMessage(text: String, spinner: Boolean = false) { Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { Column( - modifier = Modifier.padding(24.dp), + modifier = Modifier.padding(SPACING_XL), horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.spacedBy(12.dp), + verticalArrangement = Arrangement.spacedBy(SPACING_M), ) { if (spinner) CircularProgressIndicator() Text( @@ -282,7 +284,7 @@ private fun ArtifactViewerActions( color = MaterialTheme.colorScheme.scrim.copy(alpha = ARTIFACT_ACTION_SCRIM_ALPHA), shape = CircleShape, ), - horizontalArrangement = Arrangement.spacedBy(4.dp), + horizontalArrangement = Arrangement.spacedBy(SPACING_XS), ) { IconButton(onClick = { openArtifact(context, url) }) { Icon(Icons.AutoMirrored.Filled.OpenInNew, contentDescription = "Open $name externally") diff --git a/android/app/src/main/java/net/awan/pipelines/ui/graph/Artifacts.kt b/android/app/src/main/java/net/awan/pipelines/ui/graph/Artifacts.kt index 33d7218c..03dfaf6a 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/graph/Artifacts.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/graph/Artifacts.kt @@ -16,7 +16,6 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.InsertDriveFile import androidx.compose.material.icons.automirrored.filled.OpenInNew @@ -55,6 +54,13 @@ import net.awan.pipelines.ui.artifactMetaLine import net.awan.pipelines.ui.artifactsSummary import net.awan.pipelines.ui.components.copyText import net.awan.pipelines.ui.isImageContentType +import net.awan.pipelines.ui.theme.ARTIFACT_BADGE_DP +import net.awan.pipelines.ui.theme.ARTIFACT_THUMB_DP +import net.awan.pipelines.ui.theme.ARTIFACT_TILE_DP +import net.awan.pipelines.ui.theme.SPACING_M +import net.awan.pipelines.ui.theme.SPACING_S +import net.awan.pipelines.ui.theme.SPACING_XS +import net.awan.pipelines.ui.theme.SPACING_XXS import net.awan.pipelines.ui.theme.pipelinesText /** @@ -81,7 +87,7 @@ internal fun ArtifactsSection( val artifacts = remember(step) { step.artifacts.orEmpty() } val summary = remember(step) { artifactsSummary(step) } val notes = remember(step) { artifactCaptureNotes(step) } - Column(modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(4.dp)) { + Column(modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(SPACING_XS)) { Text(summary, style = text.label, color = MaterialTheme.colorScheme.primary) if (configuredServerUrl.isBlank()) { Text( @@ -135,7 +141,7 @@ internal fun ArtifactGallery( preferred = ARTIFACT_TILE_DP, spacing = ARTIFACT_TILE_SPACING_DP, ) - Column(Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(8.dp)) { + Column(Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(SPACING_S)) { groups.forEach { group -> if (showHeaders) { Text( @@ -240,10 +246,10 @@ private fun ArtifactTile( Box( Modifier .size(tile) - .clip(RoundedCornerShape(12.dp)) + .clip(MaterialTheme.shapes.medium) .then( if (selected) { - Modifier.border(3.dp, MaterialTheme.colorScheme.secondary, RoundedCornerShape(12.dp)) + Modifier.border(3.dp, MaterialTheme.colorScheme.secondary, MaterialTheme.shapes.medium) } else { Modifier }, @@ -279,7 +285,7 @@ private fun ArtifactTile( Box( Modifier .align(Alignment.TopStart) - .padding(4.dp) + .padding(SPACING_XS) .background(MaterialTheme.colorScheme.secondaryContainer, CircleShape), contentAlignment = Alignment.Center, ) { @@ -287,7 +293,7 @@ private fun ArtifactTile( imageVector = Icons.Default.Check, contentDescription = null, tint = MaterialTheme.colorScheme.onSecondaryContainer, - modifier = Modifier.padding(4.dp).size(16.dp), + modifier = Modifier.padding(SPACING_XS).size(ARTIFACT_BADGE_DP), ) } } @@ -346,7 +352,7 @@ private fun ArtifactRow( val selected = selection.contains(artifact.url) Surface( - shape = RoundedCornerShape(12.dp), + shape = MaterialTheme.shapes.medium, color = if (selected) { MaterialTheme.colorScheme.secondaryContainer } else { @@ -373,12 +379,12 @@ private fun ArtifactRow( .semantics { this.selected = selected }, ) { Row( - modifier = Modifier.padding(horizontal = 8.dp, vertical = 8.dp), + modifier = Modifier.padding(horizontal = SPACING_S, vertical = SPACING_S), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(12.dp), + horizontalArrangement = Arrangement.spacedBy(SPACING_M), ) { Box( - Modifier.size(56.dp).clip(RoundedCornerShape(8.dp)), + Modifier.size(ARTIFACT_THUMB_DP).clip(MaterialTheme.shapes.small), contentAlignment = Alignment.Center, ) { Icon( @@ -387,7 +393,7 @@ private fun ArtifactRow( tint = LocalContentColor.current, ) } - Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(2.dp)) { + Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(SPACING_XXS)) { Text( artifact.name.ifBlank { "(unnamed artifact)" }, style = text.cardTitle, @@ -410,7 +416,7 @@ private fun ArtifactRow( Icon( imageVector = Icons.Default.Check, contentDescription = null, - modifier = Modifier.padding(horizontal = 12.dp), + modifier = Modifier.padding(horizontal = SPACING_M), ) } } else { @@ -485,8 +491,5 @@ internal fun openArtifact(context: Context, url: String?) { /** Longest edge of a list thumbnail decode. */ private const val THUMBNAIL_MAX_DIM = 160 -/** Preferred side of one square gallery thumbnail tile (the named size token). */ -private val ARTIFACT_TILE_DP = 96.dp - /** Gap between gallery thumbnails; shared by the row arrangement and the fitting. */ -private val ARTIFACT_TILE_SPACING_DP = 8.dp +private val ARTIFACT_TILE_SPACING_DP = SPACING_S diff --git a/android/app/src/main/java/net/awan/pipelines/ui/graph/StageDetailPane.kt b/android/app/src/main/java/net/awan/pipelines/ui/graph/StageDetailPane.kt index eda00623..44097a17 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/graph/StageDetailPane.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/graph/StageDetailPane.kt @@ -56,6 +56,10 @@ import net.awan.pipelines.ui.fileChangesSummary import net.awan.pipelines.ui.formatDuration import net.awan.pipelines.ui.notificationLine import net.awan.pipelines.ui.screens.runTimeline +import net.awan.pipelines.ui.theme.SPACING_L +import net.awan.pipelines.ui.theme.SPACING_S +import net.awan.pipelines.ui.theme.SPACING_XS +import net.awan.pipelines.ui.theme.STAGE_CHIP_PAD_H import net.awan.pipelines.ui.theme.pipelinesText /** @@ -439,8 +443,8 @@ private fun StageDetailBody( Column( modifier = columnModifier .verticalScroll(rememberScrollState()) - .padding(horizontal = 16.dp, vertical = 8.dp), - verticalArrangement = Arrangement.spacedBy(4.dp), + .padding(horizontal = SPACING_L, vertical = SPACING_S), + verticalArrangement = Arrangement.spacedBy(SPACING_XS), ) { Text( GraphSemantics.nodeLabel(stageKey), @@ -453,7 +457,7 @@ private fun StageDetailBody( selectedTabIndex = clampedVisit, edgePadding = 0.dp, containerColor = paneContainerColor(), - modifier = Modifier.fillMaxWidth().padding(top = 8.dp), + modifier = Modifier.fillMaxWidth().padding(top = SPACING_S), ) { runSteps.forEachIndexed { index, _ -> Tab( @@ -619,7 +623,7 @@ internal fun StageTypeChip(label: String) { text = label, style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSecondaryContainer, - modifier = Modifier.padding(horizontal = 10.dp, vertical = 4.dp), + modifier = Modifier.padding(horizontal = STAGE_CHIP_PAD_H, vertical = SPACING_XS), ) } } diff --git a/android/app/src/main/java/net/awan/pipelines/ui/graph/WorkflowGraph.kt b/android/app/src/main/java/net/awan/pipelines/ui/graph/WorkflowGraph.kt index e6aea6be..157e81c0 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/graph/WorkflowGraph.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/graph/WorkflowGraph.kt @@ -101,6 +101,9 @@ import net.awan.pipelines.ui.theme.GRAPH_EDGE_LANE_SPACING import net.awan.pipelines.ui.theme.GRAPH_EDGE_TRACK_STEP import net.awan.pipelines.ui.theme.GRAPH_ELAPSED_INSET import net.awan.pipelines.ui.theme.GRAPH_FIT_PADDING +import net.awan.pipelines.ui.theme.GRAPH_LEGEND_GAP +import net.awan.pipelines.ui.theme.GRAPH_LEGEND_PAD_X +import net.awan.pipelines.ui.theme.GRAPH_LEGEND_PAD_Y import net.awan.pipelines.ui.theme.GRAPH_LEGEND_SWATCH_HEIGHT import net.awan.pipelines.ui.theme.GRAPH_LEGEND_SWATCH_WIDTH import net.awan.pipelines.ui.theme.GRAPH_MIN_VISIBLE @@ -111,9 +114,11 @@ import net.awan.pipelines.ui.theme.GRAPH_NODE_MIN_HEIGHT import net.awan.pipelines.ui.theme.GRAPH_NODE_PORT_SPACING import net.awan.pipelines.ui.theme.GRAPH_NODE_WIDTH import net.awan.pipelines.ui.theme.GRAPH_PAD +import net.awan.pipelines.ui.theme.GRAPH_PANEL_MIN_HEIGHT import net.awan.pipelines.ui.theme.GRAPH_ROUTE_CORNER_RADIUS import net.awan.pipelines.ui.theme.GRAPH_TERMINAL_ROW_GAP import net.awan.pipelines.ui.theme.PipelinesTextStyles +import net.awan.pipelines.ui.theme.SPACING_XS import net.awan.pipelines.ui.theme.pipelinesText internal data class NodeLayout( @@ -428,16 +433,16 @@ fun WorkflowGraph( Row( modifier = Modifier .align(Alignment.TopStart) - .padding(4.dp) + .padding(SPACING_XS) .background(MaterialTheme.colorScheme.surface.copy(alpha = 0.85f)) - .padding(horizontal = 6.dp, vertical = 3.dp), + .padding(horizontal = GRAPH_LEGEND_PAD_X, vertical = GRAPH_LEGEND_PAD_Y), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(10.dp), + horizontalArrangement = Arrangement.spacedBy(GRAPH_LEGEND_GAP), ) { GRAPH_LEGEND.forEach { entry -> Row( verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(4.dp), + horizontalArrangement = Arrangement.spacedBy(SPACING_XS), ) { LegendSwatch(entry.executed, colors) Text(entry.label, style = MaterialTheme.typography.labelSmall) @@ -446,7 +451,7 @@ fun WorkflowGraph( } } Row( - modifier = Modifier.align(Alignment.TopEnd).padding(4.dp), + modifier = Modifier.align(Alignment.TopEnd).padding(SPACING_XS), ) { IconButton( onClick = { @@ -1819,6 +1824,3 @@ internal fun collapsedGraphHeight(screenHeightDp: Int): Dp = /** Expanded graph-panel height: (approximately) the full available window height. */ internal fun expandedGraphHeight(screenHeightDp: Int): Dp = (screenHeightDp * 0.92f).dp - -/** Floor that still fits a 4-stage graph with its terminal row (see above). */ -internal val GRAPH_PANEL_MIN_HEIGHT = 320.dp diff --git a/android/app/src/main/java/net/awan/pipelines/ui/theme/Dimens.kt b/android/app/src/main/java/net/awan/pipelines/ui/theme/Dimens.kt index 9e5eb49a..80f9712f 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/theme/Dimens.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/theme/Dimens.kt @@ -166,3 +166,41 @@ internal val GRAPH_FIT_PADDING = 16.dp /** Least graph span kept visible when clamping pan. */ internal val GRAPH_MIN_VISIBLE = 48.dp + +/** Horizontal padding inside the run legend chip (tighter than the spacing scale). */ +internal val GRAPH_LEGEND_PAD_X = 6.dp + +/** Vertical padding inside the run legend chip (tighter than the spacing scale). */ +internal val GRAPH_LEGEND_PAD_Y = 3.dp + +/** Gap between the run legend's entries. */ +internal val GRAPH_LEGEND_GAP = 10.dp + +/** Collapsed graph-panel floor: fits a 4-stage layout plus its terminal row. */ +internal val GRAPH_PANEL_MIN_HEIGHT = 320.dp + +// ---- Artifacts gallery (ui/graph/Artifacts.kt, ArtifactImage.kt) ----------- +// The gallery's tile geometry. Like the graph's, it is named here so the +// artifact files import tokens instead of writing raw dp literals; the values are +// unchanged. Corner radii derive from the app's Material shape scale (the graph +// does the same for its nodes), so only the sizes live here. + +/** Preferred side of one square gallery thumbnail tile. */ +internal val ARTIFACT_TILE_DP = 96.dp + +/** Side of an inline artifact thumbnail and a non-image row's leading glyph box. */ +internal val ARTIFACT_THUMB_DP = 56.dp + +/** Check-badge glyph on a selected gallery tile. */ +internal val ARTIFACT_BADGE_DP = 16.dp + +/** Size of the inline artifact loading spinner. */ +internal val ARTIFACT_PROGRESS_DP = 24.dp + +/** Stroke of the inline artifact loading spinner. */ +internal val ARTIFACT_PROGRESS_STROKE_DP = 2.dp + +// ---- Stage detail sheet (ui/graph/StageDetailPane.kt) ---------------------- + +/** Horizontal padding inside the stage-type chip (wider than the shared chip). */ +internal val STAGE_CHIP_PAD_H = 10.dp diff --git a/android/app/src/test/java/net/awan/pipelines/ui/graph/WorkflowGraphTest.kt b/android/app/src/test/java/net/awan/pipelines/ui/graph/WorkflowGraphTest.kt index 43206f00..8bfd584f 100644 --- a/android/app/src/test/java/net/awan/pipelines/ui/graph/WorkflowGraphTest.kt +++ b/android/app/src/test/java/net/awan/pipelines/ui/graph/WorkflowGraphTest.kt @@ -9,6 +9,7 @@ import net.awan.pipelines.data.protocol.Protocol import net.awan.pipelines.data.protocol.RunGraphState import net.awan.pipelines.data.protocol.Stage import net.awan.pipelines.data.protocol.edges +import net.awan.pipelines.ui.theme.GRAPH_PANEL_MIN_HEIGHT import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse import org.junit.Assert.assertNull diff --git a/android/app/src/test/java/net/awan/pipelines/ui/theme/DimensTest.kt b/android/app/src/test/java/net/awan/pipelines/ui/theme/DimensTest.kt index 934409c4..caaf4ff1 100644 --- a/android/app/src/test/java/net/awan/pipelines/ui/theme/DimensTest.kt +++ b/android/app/src/test/java/net/awan/pipelines/ui/theme/DimensTest.kt @@ -26,8 +26,8 @@ class DimensTest { private val allowList: Map = mapOf( // Structural / hairline values that are not design dimensions. "0.dp" to "Structural zero: no inset, clamped-to-zero, or an empty-guard comparison.", - "2.dp" to "Progress/divider hairline strokes (progress indicators, graph hairlines); half the 4dp base step.", - "3.dp" to "Tonal and border hairline (elevation/border), not a layout dimension.", + "2.dp" to "Progress-indicator hairline stroke (the run row's spinner); half the 4dp base step.", + "3.dp" to "Tonal and border hairline (a selected tile's ring, elevation), not a layout dimension.", "6.dp" to "Pill shadow elevation only; not layout geometry.", // Members of the 4dp spacing scale (see Dimens' SPACING_* tokens). @@ -35,19 +35,17 @@ class DimensTest { "8.dp" to "Two 4dp steps (SPACING_S): standard stack/row gap and icon inset.", "12.dp" to "Three 4dp steps (SPACING_M): standard inter-item arrangement gap.", "16.dp" to "Four 4dp steps (SPACING_L): standard screen, card and app-bar padding.", - "24.dp" to "Artifact progress glyph and artifact-viewer padding (ui/graph); not yet migrated.", "10.dp" to "Dense row padding finer than the 4dp scale (10dp vertical); kept verbatim.", // Component glyph sizes still outside the token file (the list/detail // screens' 14/18/20/24dp glyphs moved onto Dimens' ICON_* tokens). - "48.dp" to "Minimum touch target and graph minimum visible span (48dp).", + "48.dp" to "The destination pill's icon touch target (DESTINATION_ITEM_SIZE).", - // Workflow-graph pixel geometry now lives in ui/theme/Dimens.kt as the - // GRAPH_* tokens, so no graph literal remains here. + // Workflow-graph, artifact-gallery and stage-sheet pixel geometry now + // lives in ui/theme/Dimens.kt as named tokens, so no graph/artifact + // literal remains here. - // Component container sizes. - "56.dp" to "Artifact thumbnail size (coincides with PEEK_WIDTH_DP but is content size here).", - "96.dp" to "Artifact grid preferred tile edge (ARTIFACT_TILE_DP).", + // The one container size still outside the token file. "320.dp" to "Code block maximum height (CODE_BLOCK_MAX_HEIGHT).", // Typography (sp), which is owned by Typography.kt, not the dimension file.