Skip to content

Commit bfb6973

Browse files
Remove Chakra migration residue
The migration is complete: swept Chakra/gotcha/playbook references from comments and docs, normalised agent notes to plain app/tooling notes (pointing at ui's docs/hints.md), and removed fidelity leftovers.
1 parent 71a9bac commit bfb6973

33 files changed

Lines changed: 66 additions & 103 deletions

.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module.exports = {
3535
rules: {
3636
// More trouble than it's worth
3737
"react/no-unescaped-entities": "off",
38-
// False positives from library imports from Chakra UI
38+
// False positives from library imports
3939
"@typescript-eslint/unbound-method": "off",
4040
"@typescript-eslint/no-misused-promises": [
4141
"error",

AGENTS.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
## Styling/theming
44

5-
This app uses react-aria-components + Panda CSS via `@microbit/ui`
6-
(migrated from Chakra UI, July 2026). **Read the gotcha catalog in
7-
`../ui/docs/migration-playbook.md` before styling/theming/UI work**
8-
Panda's static extraction rules and RAC behaviours catalogued there still
9-
apply to new code. The private theme package is the sibling repo
5+
This app uses react-aria-components + Panda CSS via `@microbit/ui`.
6+
Read `../ui/docs/hints.md` before styling/theming/UI work.
7+
The private theme package is the sibling repo
108
`../python-editor-v3-microbit` (consumed via a manual `node_modules`
119
symlink locally — re-create it after `npm install`).
1210

@@ -15,8 +13,7 @@ symlink locally — re-create it after `npm install`).
1513
want whenever a change spans the library and this app — symlink
1614
`node_modules/@microbit/ui` to `../ui/packages/ui`, the same arrangement as the
1715
theme package above. Re-create it after `npm install` (which restores the pinned
18-
version), and regenerate clean afterwards (`rm -rf styled-system && npm run
19-
panda`) — incremental codegen does not detect external preset changes.
16+
version), and regenerate clean afterwards (`rm -rf styled-system && npm run panda`) — incremental codegen does not detect external preset changes.
2017
`resolve.dedupe` in `vite.config.ts` is what stops the symlinked package loading
2118
its own copies of React and friends, so leave it in place either way.
2219

docs/tech-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The document assumes some familiarity with the app as a user. [Try it out](http:
88

99
The editor is written in [TypeScript](https://www.typescriptlang.org/) using [React](https://reactjs.org/).
1010

11-
We use the [Chakra UI component library](https://chakra-ui.com/docs/getting-started) which provides a base set of accessible components. We're currently using Chakra UI 2.x.
11+
The user interface is built with the Foundation's shared `@microbit/ui` component library, which combines [react-aria-components](https://react-spectrum.adobe.com/react-aria/) for accessible component behaviour with [Panda CSS](https://panda-css.com/) for styling.
1212

1313
The project is bundled using [Vite](https://vitejs.dev/). The test runner is [Vitest](https://vitest.dev/) and we're using [eslint](https://eslint.org/).
1414

panda.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { appPreset } from "./src/deployment/default/panda-preset";
1212
// alias swap in vite.config.ts. When the private package is installed it
1313
// overrides brand tokens (colour ramps, code palette, semantic tokens);
1414
// otherwise the OSS default preset stands alone. Panda merges them at codegen
15-
// time — the build-time equivalent of Chakra's runtime theme swap.
15+
// time.
1616
//
1717
// Panda loads this config as CommonJS, so `require` is the real (sync) require;
1818
// Node 24 resolves the ESM private package through it.
@@ -29,12 +29,12 @@ export default defineConfig({
2929
preflight: true,
3030
jsxFramework: "react",
3131
// Drop Panda's default theme preset; the preset stack below supplies the full
32-
// token system (ported from Chakra). preset-base still provides the utilities.
32+
// token system. preset-base still provides the utilities.
3333
eject: true,
3434
// Later presets override earlier ones: @microbit/ui's base preset (the
3535
// complete design system + recipes, OSS default brand values), the shared
3636
// dense preset (this app's × 0.88 spacing / × 0.9 font-size density, shared
37-
// with classroom — see playbook gotcha #25), this app's own preset, then the
37+
// with classroom), this app's own preset, then the
3838
// optional private brand preset which overrides the OSS brand values.
3939
// staticCss lives in the base preset.
4040
presets: [

src/common/ConfirmDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const ConfirmDialog = ({
3737
<ModalBody>{body}</ModalBody>
3838
<ModalFooter>
3939
{/* Least-destructive initial focus: RAC honours autoFocus within the
40-
dialog's FocusScope, replacing Chakra's leastDestructiveRef. */}
40+
dialog's FocusScope. */}
4141
<Button autoFocus onPress={() => callback(false)}>
4242
<FormattedMessage id="cancel-action" />
4343
</Button>

src/common/ExpandCollapseIcon.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ interface ExpandCollapseIconProps extends Omit<IconProps, "as"> {
1010
open: boolean;
1111
}
1212

13-
// The Material arrow glyphs are the same paths as the Chakra chevron icons
14-
// this replaced.
1513
const ExpandCollapseIcon = ({ open, ...props }: ExpandCollapseIconProps) =>
1614
open ? (
1715
<Icon as={MdKeyboardArrowUp} {...props} />

src/common/SplitView/HideSplitViewButton.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ const HideSplitViewButton = React.forwardRef(
7878
width: mode === "icon" ? "20px" : "auto",
7979
background: "#eaecf1",
8080
// The flat background is a utility, which beats the ghost
81-
// variant's recipe-layer hover/active — restate them (Chakra's
82-
// ghost-over-gray values).
81+
// variant's recipe-layer hover/active — restate them.
8382
_hover: { background: "gray.100" },
8483
_active: { background: "gray.200" },
8584
// Likewise a flat boxShadow from a call site (e.g. Simulator's

src/deployment/default/panda-preset.ts

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,17 @@ import { definePreset } from "@pandacss/dev";
1010
* after the shared-ui base preset (@microbit/ui) and before the optional
1111
* private brand preset (see panda.config.ts). Kept minimal — the base preset
1212
* already supplies the token scales, recipes, `radii.button`, focus shadows,
13-
* Helvetica fonts and most semantic tokens.
14-
*
15-
* Values mirror the OSS Chakra theme (src/deployment/default) as converged
16-
* during the semantic-token pre-work; the private brand preset overrides the
17-
* brand-divergent token values.
13+
* Helvetica fonts and most semantic tokens. The private brand preset overrides
14+
* the brand-divergent token values.
1815
*/
1916
export const appPreset = definePreset({
2017
name: "python-editor-v3",
2118
theme: {
2219
extend: {
2320
tokens: {
2421
// This app's stacking contexts, calibrated against third-party
25-
// layers (xterm.js ~10, the library's Chakra-derived overlay scale
26-
// from 1000). Token references are required in Panda styles: an
22+
// layers (xterm.js ~10, the library's overlay scale from 1000).
23+
// Token references are required in Panda styles: an
2724
// imported constant in a zIndex prop is not statically extractable
2825
// (silently unstyled).
2926
zIndex: {
@@ -45,16 +42,15 @@ export const appPreset = definePreset({
4542
},
4643
colors: {
4744
// This app's very light grays differ slightly from the family base
48-
// preset's (gray.75 is #f5f6f8 here vs #f5f5f5): mirror the OSS
49-
// Chakra theme's values (src/deployment/default/colors.ts).
45+
// preset's (gray.75 is #f5f6f8 here vs #f5f5f5).
5046
gray: {
5147
10: { value: "#fcfcfc" },
5248
75: { value: "#f5f6f8" },
5349
},
5450
// Syntax-highlight / code-block palette. Consumed outside React as
5551
// CSS vars (CodeMirror highlight styles, structure highlighting), so
5652
// it's an app-preset token category; the private preset overrides the
57-
// values. OSS values are the Chakra defaults the old theme resolved.
53+
// values.
5854
code: {
5955
blockBorder: { value: "#A0AEC0" }, // gray.400
6056
blockBackground: { value: "rgba(185, 185, 185, 0.1)" },
@@ -94,35 +90,29 @@ export const appPreset = definePreset({
9490
},
9591
},
9692
recipes: {
97-
// The Chakra theme defaulted Text to `md` — 0.9rem on this app's
98-
// shrunken scale, vs the 16px an unsized <Text> would inherit.
99-
// App-level because other apps rely on inheritance (Text.recipe.ts).
93+
// Default Text to `md` — 0.9rem on this app's shrunken scale, vs the
94+
// 16px an unsized <Text> would inherit. App-level because other apps
95+
// rely on inheritance (Text.recipe.ts).
10096
text: {
10197
defaultVariants: { size: "md" },
10298
},
103-
// python-editor's default button variant is `outline` (census: the
104-
// OSS theme applies withDefaultVariant("outline"); the family base
105-
// recipe defaults to `secondary`). Ported from the Chakra `outline`
106-
// variant, resolved at the brand colorScheme (the app applies
107-
// withDefaultColorScheme("brand")): brand text over a transparent,
108-
// brand-bordered button. Non-brand outline cases use `warning`.
99+
// python-editor's default button variant is `outline` (the family
100+
// base recipe defaults to `secondary`): brand text over a
101+
// transparent, brand-bordered button. Non-brand outline cases use
102+
// `warning`.
109103
button: {
110104
variants: {
111105
variant: {
112106
// Icon buttons on the app's dark chrome (sidebar header,
113-
// serial bar): white glyph, white pill on hover. The Chakra
114-
// variant was ghost-based with callers passing color="white";
115-
// the base colour is folded in here instead (both call sites
116-
// used white).
107+
// serial bar): white glyph, white pill on hover.
117108
sidebar: {
118109
color: "white",
119110
bg: "transparent",
120111
_hover: { bg: "white", color: "gray.700" },
121112
_active: { bg: "white", color: "gray.800" },
122113
},
123-
// The editor zoom / undo-redo pill pairs: Chakra solid+gray
124-
// with darker hover/active. (The Chakra theme comment said
125-
// "ideally we'd drop this variant" — carried as-is.)
114+
// The editor zoom / undo-redo pill pairs: gray fill with
115+
// darker hover/active.
126116
zoom: {
127117
color: "gray.800",
128118
bg: "gray.100",

src/documentation/api/ApiNode.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,6 @@ const ApiNodeChildren = ({ docs, anchor }: ApiNodeChildrenProps) => {
271271
(childKind) =>
272272
groupedChildren?.get(childKind as any) && (
273273
<Box mb="5" key={childKind}>
274-
{/* The Chakra original had fontWeight="lg", an invalid
275-
token that never resolved, so this renders normal. */}
276274
<Text mb="2">{groupHeading(intl, kind, childKind)}</Text>
277275
{groupedChildren?.get(childKind as any)?.map((c) => (
278276
<ApiNode

src/documentation/common/DocumentationTopLevelItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ const DocumentationTopLevelItem = ({
5959
size="sm"
6060
css={{ color: "brand.200", fontSize: "2xl" }}
6161
variant="ghost"
62-
// The Chakra button relied on its click bubbling to the list
63-
// item's onClick; react-aria's press handling suppresses that.
62+
// react-aria's press handling doesn't produce a click that
63+
// bubbles to the list item's onClick, so forward explicitly.
6464
onPress={onForward}
6565
>
6666
<RiArrowRightLine />

0 commit comments

Comments
 (0)