Skip to content

chore: implement storybook#932

Open
jakehwll wants to merge 99 commits into
mainfrom
jakehwll/implement-storybook
Open

chore: implement storybook#932
jakehwll wants to merge 99 commits into
mainfrom
jakehwll/implement-storybook

Conversation

@jakehwll
Copy link
Copy Markdown

@jakehwll jakehwll commented May 4, 2026

This PR was modified by Coder Agents on behalf of Jake Howell.

Adds Storybook support for developing and previewing webview components in isolation outside of VS Code. Includes stories for all tasks package components with a dark/light theme switcher that mirrors VS Code CSS custom properties.

  • Add .storybook/ config with Vite integration, workspace alias resolution, codicon injection, and acquireVsCodeApi mock
  • Add dark-v2 and light-v2 themes (sourced from vscode-elements/webview-playground) with a toolbar switcher in globalTypes
  • Add 17 component stories under packages/tasks/src/components/ covering all major UI states
  • Add test/webview/decorators.tsx with a shared withQueryClient decorator for stories using React Query
  • Add storybook and build-storybook scripts to root package.json
  • Add Storybook dependencies to workspace catalog

Comment thread package.json Outdated
Comment thread .storybook/themes/dark-v2.ts
Comment thread packages/tasks/src/utils/storybook.ts Outdated
Comment thread .storybook/tsconfig.json
Comment thread .storybook/preview.ts Outdated
Comment thread package.json Outdated
Comment thread packages/tasks/src/components/TasksPanel.stories.tsx Outdated
Comment thread packages/tasks/src/components/AgentChatHistory.stories.tsx Outdated
Comment thread packages/tasks/src/components/ActionMenu.stories.tsx Outdated
Comment thread packages/tasks/src/components/NotSupportedState.stories.tsx Outdated
@jakehwll jakehwll force-pushed the jakehwll/implement-storybook branch from b650dcc to b0ec3f2 Compare May 8, 2026 02:13
jakehwll added 3 commits May 8, 2026 02:17
… loading

Move per-package CSS injection from a runtime decorator inside src/ to
a storybook.preview.ts entry point at the package root. Stories no
longer need to import or apply the decorator manually.
…orybook

# Conflicts:
#	pnpm-lock.yaml
#	pnpm-workspace.yaml
@jakehwll
Copy link
Copy Markdown
Author

jakehwll commented May 8, 2026

tasks-actionmenu--opened, the loading item is not aligned with the others:

Not going to fix just yet, will wait for this branch to merge to tightly scope and follow up 🙂

tasks-errorbanner--default, should we align the view logs to the right?

Not going to fix just yet, will wait for this branch to merge to tightly scope and follow up 🙂

tasks-statepanel--error, the retry here is not a button while it is a button in the error state. Was this intentional or a storybook styling issue 🤔?

Hmm, fair enough. I've imported both those components to the story 🙂

The status indicators are not applying the right styles it seems, like this is just a pure square:

Looks like the display: inline was zorping these. I've added a wrapper decorator for it now!

tasks-tasklist--default could mix and match other states and descriptions IMO for better coverage

Good idea!

This is the "Task Selection" test but I do not see it selecting a task (or inside a selected task):

Oops, I think I nuked this by accident.

@jakehwll jakehwll requested a review from EhabY May 8, 2026 03:58
Copy link
Copy Markdown
Collaborator

@EhabY EhabY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few follow ups in the chromatic one but this one is good!

Comment thread scripts/sync-vscode-themes.mjs
jakehwll added 10 commits May 11, 2026 14:11
Wire eslint-plugin-storybook into the eslint config using the
flat/recommended preset. Disable storybook/no-renderer-packages
since @storybook/react-vite at v8 doesn't re-export Meta/StoryObj.
- Use declare global Window augmentation for acquireVsCodeApi mock
  instead of manual type casts
- Remove getDefaultFontStack() — themes already provide
  --vscode-font-family via CSS custom properties
- Add .storybook typecheck as 4th concurrent run in typecheck script
- Update all @storybook packages from ^8.6.18 to ^10.3.6
- Consolidate @storybook/test into storybook/test (v10 subpath)
- Remove @storybook/addon-essentials (built into core in v10)
- Remove direct @storybook/react dep (use @storybook/react-vite)
- Add @storybook/addon-docs as explicit addon
- Restore catalog: references in package.json (automigration hardcoded)
- Update storybook-utils to import Decorator from @storybook/react-vite
- Remove stale storybook/no-renderer-packages eslint disable
- Remove dead args: {} from NotSupportedState story
- Lift shared task data to module scope in TasksPanel stories
- Lift shared log entries to meta.args in AgentChatHistory stories
ActionMenu Opened relied on vscode-icon custom element registration
which fails in Chromatic's headless browser. TaskSelection depended
on IPC-driven navigation that cannot resolve in isolation.

Both stories remain as visual-only snapshots.
@jakehwll jakehwll force-pushed the jakehwll/implement-storybook branch from f98c65a to 62bb158 Compare May 11, 2026 09:04
The upstream vscode-elements theme data does not include
--vscode-font-family because VS Code injects it at runtime.
Without it, global.css falls back to the browser default
serif font, causing every Chromatic snapshot to diff.
@jakehwll jakehwll force-pushed the jakehwll/implement-storybook branch from f76e3b5 to 32dd1bf Compare May 11, 2026 09:10
Copy link
Copy Markdown
Collaborator

@EhabY EhabY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good again, looks great!

Comment thread eslint.config.mjs Outdated
Comment thread .gitignore Outdated
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.

2 participants