feat(ui): add core primitives and state panels#1031
Open
EhabY wants to merge 7 commits into
Open
Conversation
1df5daf to
02a0ff1
Compare
02a0ff1 to
e1122d6
Compare
e1122d6 to
839acc7
Compare
…joining - Move the theme sync machinery into .storybook/themes/ next to its generated output: the extension-test suite becomes a real suite.cjs file instead of an escaped template string, and the fixture manifest is checked in instead of written to a temp dir at runtime (VS Code loads a manifest-only fixture; the empty extension.js shim is gone). - Pin the captured VS Code to 1.128.0 so dumps are reproducible; bump VSCODE_VERSION in sync.mjs to resync against a newer release. - Capture the startup theme (dark) last so every dump follows a real theme-change event; capturing it immediately at startup can read partially-loaded theme data. Failed activation rejects loudly instead of silently dumping the wrong theme. - Format the generated stylesheet from sync.mjs so a resync never leaves an unformatted diff for format:check. - Add a tiny cx() helper used by all components instead of the repeated filter/join expression, and reach shared internals (#cx, #codicons, #storybook) through package.json subpath imports instead of ../../ paths; the aliases are scoped to packages/ui and ship with it. - JSDoc for top-level declarations, readonly types on const collections, and list sync:vscode-themes in the AGENTS.md command table.
Typography, text color, and body margin now come from the dumped VS Code default stylesheet; keep only the sidebar background, viewport sizing, and the deliberate body-padding override.
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.
Story
PR #1030 establishes the
@repo/uiscaffold and semantic theme boundary. This stacked PR turns that scaffold into the small set of reusable primitives needed for upcoming Workspaces states without pulling workspace, task, or extension models into the package.It adds:
IconandIconButtonSpinnerandProgressBarSearchInputStatusPillwith genericneutral | info | success | warning | dangertonesEmptyStateandErrorStateWelcomePanelis intentionally omitted because the extension already uses native VS CodeviewsWelcome.Skeletonis deferred until the Workspaces first-load layout provides concrete placeholder geometry.VS Code fidelity
Components are native HTML elements styled to match VS Code's own controls, using the VS Code Elements implementation as a design reference without importing it:
Library boundary (NPM-ready)
CodiconNameis derived at type-check time from@vscode/codicons/dist/metadata.json; no generated source, no runtime icon list.@repo/*and relative cross-package imports frompackages/ui.#cx,#codicons,#storybook) are reached throughpackage.jsonsubpath imports, which resolve only inside this package and ship with it on a standalone split.--ui-*tokens only;tokens.cssis the single VS Code mapping layer.distcan be added later without changing public APIs.Storybook fidelity
pnpm sync:vscode-themes, replacing the hand-maintainedwebview-playgroundapproximations. This includes the genuine--vscode-font-familyand the real per-theme variable sets (e.g. HC-onlytoolbar-hoverOutline)..storybook/themes/next to its generated output: a thinsync.mjslauncher, the in-extension-hostsuite.cjs, and a checked-in fixture manifest (no temp-dir codegen).VSCODE_VERSION, currently 1.128.0) so dumps are reproducible; capture is deterministic — the startup theme is dumped last so every dump follows a real theme-change event, and a theme that fails to activate rejects loudly instead of silently dumping the wrong theme.sync.mjsformats the generated stylesheet itself, so a resync never leaves a diff forformat:checkto reject.Regression guards
UI/VSCodeParityrenders every control next to its@vscode-elementscounterpart under identical variables, snapshotted by Chromatic in all four themes, so drift from VS Code styling shows up as a visual diff (@vscode-elements/react-elementsis a devDependency only).components/control.css); component CSS is inherit-first and never uses line-height/vertical-padding math.Coverage
<Component>.stories.tsxper public component with a combined matrix story (10 stories total, including Foundations and a snapshot-disabled icon gallery), each snapshotted in Light, Dark, High Contrast, and High Contrast Light.git diff --check.Closes DEVEX-618.
Generated by Coder Agents on behalf of @EhabY.
Implementation plan
DEVEX-618: UI core primitives and state panels
Goal
Create a stacked PR on
feat/devex-624-ui-scaffoldthat adds concise, generic components to@repo/uiwith Storybook, visual-regression, accessibility, and focused behavioral coverage, while preserving a clean future standalone-library boundary.Scope
Implement
Icon,IconButton,Spinner,ProgressBar,SearchInput,StatusPill,EmptyState, andErrorState.Do not implement
WelcomePanel(nativeviewsWelcomeremains) orSkeleton(no concrete first-load geometry yet).Styling strategy
Match VS Code exactly with native elements rather than a custom design system or a runtime dependency on
@vscode-elements:tokens.css; component CSS uses semantic--ui-*tokens only.forced-colorsandprefers-reduced-motionmedia handling.Minimal tooling
CodiconNameas a TypeScript type from codicon metadata (resolveJsonModule); commit no generated output and expose no runtime icon array.@repo/*bans andimport-x/no-relative-packages) instead of a custom script.Storybook
One combined matrix story per component under
UI/<Component>, four-theme Chromatic modes on each matrix, interaction assertions via play functions, and a snapshot-disabled curated icon gallery. Detailed behavior stays in Vitest.Behavioral tests
Focused Testing Library/Vitest tests in
test/webview/ui/covering icon semantics, button accessibility, spinner status, progress ARIA/clamping, controlled search and clear-focus behavior, status pill tones, and state panel slots/retry.Validation
pnpm format:check,pnpm typecheck,pnpm lint,pnpm test:webview ./test/webview/ui,pnpm storybook:ci,pnpm build, andgit diff --check, plus manual Storybook review across all four themes.Git and PR
feat/devex-618-ui-state-panels, stacked onfeat/devex-624-ui-scaffold.