Skip to content

Split the pickers into colorpicker-foundation and colorpicker-material3 - #357

Merged
smelfungus merged 10 commits into
masterfrom
module-split
Sep 26, 2026
Merged

smelfungus merged 10 commits into
masterfrom
module-split

Conversation

@smelfungus

Copy link
Copy Markdown
Member

An app on a design system other than Material could not take the pickers without Material coming with them. 2.0 publishes two artifacts in place of codes.side:colorpicker: codes.side:colorpicker-foundation, holding the state, the Basic components from #355 and the strings, with no Material dependency; and codes.side:colorpicker-material3, the Material components from #356, built on it.

Modules

  • colorpicker becomes colorpicker-foundation. The Material components, the theme and their tests move to colorpicker-material3, in one package, codes.side.colorpicker.material3, where 1.x had ui and theme.
  • material3 compiles against foundation's public API alone. Two of the internals it read are public now: LocalColorPickerEnabled, which a part drawn outside every slot scope reads to look disabled with the picker, and rememberCheckerboardBrush. The controlled Material pickers wrap BasicColorPicker's controlled forms.
  • material3 takes foundation as api and Material as implementation. The iOS framework CI links moves to material3.

Build

  • build-logic holds the library modules' targets, SDK levels, JVM target, explicit API mode and publication in one convention plugin, codes.side.library. The POMs of color, color-compose and the picker module come out byte-identical.
  • :colorpicker-foundation:checkNoMaterial fails when any Material artifact reaches a target foundation publishes: the Android, JVM and wasm runtime classpaths and both iOS targets' klibraries, each walked on its own since a dependency declared for one platform reaches only that one. CI runs it.
  • scripts/check-api-removals.sh takes every module's dumps at the release and in the working tree, so the new modules' dumps are checked and a module removed since a release is reported with everything it published.

API

  • The sliders' label and valueLabel slots follow interactionSource, with the other slots.

The sample has a Built on foundation section: a BasicColorPicker with round thumbs, pill tracks and a rounded plane, and no Material in it. The README installs colorpicker-material3, says when to take colorpicker-foundation instead and shows a picker drawn without Material; the migration table maps the retired coordinate and packages, and the CHANGELOG lists both as breaking. The 28 screenshot baselines validate unchanged.

Tests: colorpicker-foundation 230 JVM, 122 Android host, 122 wasm; colorpicker-material3 140, 4, 4; color 216, 206, 206; color-compose 14, 14, 14. apiCheck, checkNoMaterial, the iOS klib compile, every sample and the 28 screenshot previews pass.

color, color-compose and colorpicker each repeated the same targets, SDK levels, JVM target, explicit API mode and publication, and the root script configured the publication of any module that applied the publish plugin. build-logic's library plugin holds all of it once, so a module takes it with one line, and the two picker modules about to replace colorpicker need nothing more. The generated POMs and the API dumps of all three modules are unchanged.
The Material components read four of foundation's internals: the disabled picker's state for their dimming, the controlled pickers' reconciliation, the track stops and the checkerboard brush. In separate modules each is a compile error, and an app drawing its own components needs the same two things Material did. LocalColorPickerEnabled and rememberCheckerboardBrush are public; the controlled Material pickers wrap BasicColorPicker's controlled forms, and ColorSlider builds its own gradient. What the Basic components use moves from ui to foundation, with the tests that reach it, and the Material tests read only public API.
The module becomes the foundation layer once the Material components leave it, so it takes the name now and its history stays on one path. It publishes codes.side:colorpicker-foundation, with the Android namespace codes.side.colorpicker.foundation. The JVM dump's ComposableSingletons getters are named after the module, so they change name with it.
An app on another design system could not take the pickers without Material coming with them. The Material components, the theme and their tests move to codes.side:colorpicker-material3, in one package, codes.side.colorpicker.material3, as androidx's material3 is, and colorpicker-foundation no longer depends on Material. The iOS framework CI links moves with them. The sample and the screenshot tests build on the new module, and the 28 baselines validate unchanged. The Material tests keep copies of three test helpers the foundation's tests define, since one module's tests cannot see another's.
Nothing stopped a new dependency, or a library the foundation depends on, from bringing Material back to apps that chose the foundation to avoid it. checkNoMaterial fails when any Material artifact is on the foundation's JVM runtime classpath, and CI runs it.
The check compared six fixed dump paths, so the two picker modules' dumps would have gone unchecked, and a module removed since a release showed only as a missing file. It now takes every module's dumps at the release and in the working tree: a module added since is compared from its first release on, and one removed since is reported with everything it published.
label and valueLabel are slots, but they sat among the sliders' plain parameters ahead of interactionSource, where every other component keeps its slots last. ColorPickerDefaults' KDoc now names the thumbs and slot factories it holds, plane()'s KDoc says a horizontal picker gives it the start half, and the dialog names the argument it passes to each slot factory.
The sample had nothing showing how to use the foundation layer. Its Built on foundation section is a BasicColorPicker with round thumbs, pill tracks and a rounded plane of its own, over the same state as the rest of the sample, with no Material in it.
The README still installed codes.side:colorpicker, which 2.0 does not publish. It installs colorpicker-material3, says when to take colorpicker-foundation instead, and shows a picker drawn without Material; the migration table maps the retired coordinates and the old packages, and the CHANGELOG lists both as breaking. The theming section no longer claims that ColorSwatch takes shapes and dimensions, and the CHANGELOG says a thumb can no longer be null.
checkNoMaterial walked jvmRuntimeClasspath alone, and each target resolves its own graph: Material declared in androidMain passed it while reaching every Android app, the foundation's main audience. It walks the Android, JVM and wasm runtime classpaths and both iOS targets' klibraries, and names each one Material is on.
@smelfungus
smelfungus merged commit 2b04671 into master Sep 26, 2026
2 checks passed
@smelfungus
smelfungus deleted the module-split branch September 26, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant