Skip to content

Upgrade to Panda CSS v2 and @microbit/ui 0.6 - #1382

Merged
microbit-matt-hillsdon merged 4 commits into
mainfrom
panda-v2
Oct 29, 2026
Merged

microbit-matt-hillsdon merged 4 commits into
mainfrom
panda-v2

Conversation

@microbit-matt-hillsdon

@microbit-matt-hillsdon microbit-matt-hillsdon commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Upgrades to Panda CSS ^2.4.0 with @microbit/ui 0.6 and @microbit/ui-patterns 0.8 (microbit-foundation/ui#166).

Changes

  • panda.config.ts: the optional brand preset is resolved from the app root and imported by file URL, since v2 configs can't use require. eject: true is dropped.
  • css, cx and styled are imported from styled-system rather than @microbit/ui.
  • HideSplitViewButton and the Ideas grid: workarounds for [v2] Comparing a ternary-initialised variable folds to a constant, so one branch is never extracted chakra-ui/panda#4056, which dropped the icon-mode width and the 2- and 3-column layouts.
  • The microphone threshold markers, ModuleOverlay and SideBarTab no longer combine a side-border shorthand with borderColor. Panda doesn't order those relative to each other, and v2's order turned the markers' edges dark.
  • The dialogs' "Don't show this again" link keeps its inset. v2 emits the Button recipe's link variant (padding: 0) after the lg size, so it lost the padding v1 gave it by accident.
  • One snapshot updated: v2's AspectRatio renders style before class.

Testing

  • npm run ci passes.
  • Panda's generated CSS compared against v1, with and without the private brand preset: v2 now emits the same set of classes. The remaining declaration differences are v2's equivalent rule regrouping.
  • Every element checked for overlapping border shorthands whose order changed from v1 to v2.
  • Production CSS is 9% larger raw (more layer-flattening specificity for Safari 14) but slightly smaller gzipped. -webkit-appearance is still emitted for the Safari 14 target.
  • Not yet run: e2e tests.

The private brand package needs no changes.

@microbit/ui 0.6 and ui-patterns 0.8 require Panda ^2.4.0.

- Panda v2 bundles the config into a `data:` URL module, so the optional
  brand preset can no longer be loaded with `require`. Resolve it
  against the app root and import it by file URL instead.
- `eject: true` is gone: v2 adds no presets implicitly. preset-base is
  now a direct dependency.
- @microbit/ui no longer re-exports `css`, `cx` or `styled`, which v2
  only extracts when imported from styled-system. Import them from there.
- HideSplitViewButton's icon-mode width was not extracted: Panda folds a
  ternary that tests a ternary-initialised variable to one branch
  (chakra-ui/panda#4056). Test `text` inline.
- v2's AspectRatio renders `style` before `class`; snapshot updated.

@parcel/watcher's install script is denied: prebuilt binaries cover the
platforms we build on and only `panda --watch` uses it.
@github-actions

Copy link
Copy Markdown

Preview build will be at
https://review-python.microbit.org/panda-v2/

The column count was computed into a ternary-initialised variable and
then compared in the `columns` prop. Panda v2 folds that comparison, so
only the one-column rule was emitted and the grid stayed one column at
any width (chakra-ui/panda#4056). Test the width inline instead.
A side shorthand such as borderLeft resets that side's colour, and Panda
doesn't order it relative to a separate borderColor utility. v2 emits
them in a different order from v1, which turned the microphone threshold
markers' edges dark. Use properties that don't overlap: separate
width/style/colour, a side colour longhand, or a single shorthand that
includes the colour.
The link variant sets padding: 0 and the lg size sets padding-inline, at
equal specificity. Panda 1 happened to emit lg last, which inset the
link to line up with the dialog title; Panda 2 emits link last, so it
sat flush. Set the inset on the instance so it no longer depends on
emit order.
@microbit-matt-hillsdon
microbit-matt-hillsdon merged commit 160857b into main Oct 29, 2026
2 checks passed
@microbit-matt-hillsdon
microbit-matt-hillsdon deleted the panda-v2 branch October 29, 2026 13:48
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