OXY-158: composable media-query support in the stylesheet DSL - #302
Merged
Conversation
Media queries were a raw-string one-off (MediaCSS + hand-written @media blocks) that bypassed the stylesheet DSL. This makes responsive styles first-class: - MediaQuery: composable condition type (min/max width/height, breakpoint helpers, prefers-dark/light, orientation, reduced-motion, hover/pointer, screen/print, &&/||, raw escape hatch). - media(query){ ... }: DSL block tagging every rule with the query; nests and composes with existing selectors. - StyleSheet.compile threads Option[MediaQuery] through the leaf model and emits @media (...) { selector { ... } }, merging consecutive same-query rules. - Dogfooded in OxygenStyleSheet + new MediaQueryPage showcase; MediaCSS kept as a functional shim with a scaladoc pointer to the new DSL. Also in this change: - scripts/run-example-web.sh: one-command local run of the example web server (docker db + webComp + server as two sbt invocations, so run is not consumed by webComp's input-task arg parser). - build.sbt: exclude unused sbt-git keys from sbt 2's lintUnusedKeysOnLoad (was ~84 warnings on every load). - docs + scripts/build.sh: fix stale example config path (src/main/resources/local.json -> config/local.yaml). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Kalin-Rudnicki
force-pushed
the
OXY-158
branch
from
August 15, 2026 02:27
3ee7697 to
864af3c
Compare
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.
OXY-158 — Media query support in the stylesheet DSL
Ticket: https://kr-oxygen.atlassian.net/browse/OXY-158
Problem
Oxygen has a nice, composable stylesheet DSL, but media queries were a raw-string one-off:
MediaCSS+ hand-written@media { ... }blocks (ColumnsStyle,HolyGrail.responsiveSheet, inline strings inMotion/Tooltip) that bypass the DSL entirely.StyleSheet.compilehad no@mediasupport at all.What this does
Makes responsive styles first-class — written with the same selector DSL as everything else.
MediaQuery(create/MediaQuery.scala): composable condition type —minWidth/maxWidth/minHeight/maxHeight, breakpoint helpers (smUp/mdUp/lgUp/xlUp,below*,between),prefersDark/prefersLight,portrait/landscape,reducedMotion,canHover/pointer,screen/print,&&/and,||/or, and arawescape hatch.media(query){ ... }(create/media.scala): DSL block that tags every rule emitted inside with the query (scopedMutableAdder); nests/composes with existing selectors — nested blocks AND together.StyleSheet.compilenow threadsOption[MediaQuery]through the leaf model and emits correct@media (...) { selector { ... } }, merging consecutive same-query rules into one block.OxygenStyleSheeth1 shrinks belowmd; new showcase page (MediaQueryPage) built entirely with the DSL (reflow + responsive visibility), wired into the example app nav.MediaCSSstays functional with a scaladoc pointer to the new DSL (repo builds with-Werror -deprecation, so its live raw call sites can't carry@deprecated). No existing call site changed.Emitted CSS (from tests)
Verification
oxygen-ui-web/compile✓,example-ui-web/compile✓,oxygen-ui-web/test✓ (48 passed, 3 new)🤖 Generated with Claude Code
https://claude.ai/code/session_011YxWKdsz97QT9BD7AdpSq6