Repository navigation
Split the pickers into colorpicker-foundation and colorpicker-material3 - #357
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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; andcodes.side:colorpicker-material3, the Material components from #356, built on it.Modules
colorpickerbecomescolorpicker-foundation. The Material components, the theme and their tests move tocolorpicker-material3, in one package,codes.side.colorpicker.material3, where 1.x haduiandtheme.LocalColorPickerEnabled, which a part drawn outside every slot scope reads to look disabled with the picker, andrememberCheckerboardBrush. The controlled Material pickers wrapBasicColorPicker's controlled forms.apiand Material asimplementation. The iOS framework CI links moves to material3.Build
build-logicholds the library modules' targets, SDK levels, JVM target, explicit API mode and publication in one convention plugin,codes.side.library. The POMs ofcolor,color-composeand the picker module come out byte-identical.:colorpicker-foundation:checkNoMaterialfails 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.shtakes 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
labelandvalueLabelslots followinteractionSource, with the other slots.The sample has a Built on foundation section: a
BasicColorPickerwith round thumbs, pill tracks and a rounded plane, and no Material in it. The README installscolorpicker-material3, says when to takecolorpicker-foundationinstead 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.