Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
df33940
feat: implement storybook config
jakehwll May 4, 2026
d47927c
feat: implement basic stories + theme
jakehwll May 4, 2026
77adc50
fix: use `fontFamily` over `font-family`
jakehwll May 4, 2026
5a1abb8
fix: resolve codicons
jakehwll May 4, 2026
dc8dc2e
feat: add `Opened` variant of `<ActionMenu />` story
jakehwll May 4, 2026
1d1fc50
feat: add queryclient helper
jakehwll May 4, 2026
e1d726c
fix: resolve rendering
jakehwll May 4, 2026
0798669
fix: resolve max-width size
jakehwll May 4, 2026
34dd889
feat: missing args in `<PromptInput />`
jakehwll May 4, 2026
23ae3a2
fix: resolve background color
jakehwll May 4, 2026
ea85877
fix: resolve theme and imports
jakehwll May 4, 2026
b2779b9
fix: prepend `void `
jakehwll May 4, 2026
7d3b120
fix: resolve story type
jakehwll May 4, 2026
7ac9626
fix: add future expansion
jakehwll May 4, 2026
90768d4
fix: document `getDefaultFontStack`
jakehwll May 4, 2026
a0324cb
fix: remove unnecessary themes
jakehwll May 4, 2026
ada1dcb
fix: resolve `acquireVsCodeApi`
jakehwll May 4, 2026
162bc3a
chore: reusable entities
jakehwll May 5, 2026
5587a8d
Merge branch 'main' into jakehwll/implement-storybook
jakehwll May 5, 2026
9dd27f4
fix: resolve rendering of `TasksPanel`
jakehwll May 5, 2026
76a6f3e
feat: move `testHelpers` to `mock`
jakehwll May 5, 2026
12d7c2b
fix: move to existing mock helpers
jakehwll May 5, 2026
eed89ac
feat: implement theme switcher
jakehwll May 5, 2026
fba820c
fix: debroaden `tsconfig.json`
jakehwll May 5, 2026
9def7ca
fix: improve imports
jakehwll May 5, 2026
08d95ac
fix: remove unnecessary `satisfies`
jakehwll May 5, 2026
8861bb5
fix: prefer use of `fn()`
jakehwll May 5, 2026
468b87c
fix: use `fn()` not `() => fn()`
jakehwll May 5, 2026
d28e7ae
fix: move to using `fn()` (again)
jakehwll May 5, 2026
5261c61
fix: use `import type`
jakehwll May 5, 2026
a501c75
chore: cleanup inputs
jakehwll May 5, 2026
cdae85b
fix: remove "useless ecapes"
jakehwll May 5, 2026
c85a0d5
fix: no children as props
jakehwll May 5, 2026
f21ab72
fix: no async `viteFinal`
jakehwll May 5, 2026
1271eef
fix: cleanup `preview.ts` lint
jakehwll May 5, 2026
01544dc
chore: document source of colorSchemes
jakehwll May 5, 2026
901d0d6
fix: use `StoryObj<typeof Foo>`
jakehwll May 5, 2026
ca15391
chore: stale `tsconfig.json`
jakehwll May 5, 2026
763cbea
fix: `rootDir` definition
jakehwll May 5, 2026
6a825dc
chore: comment feedback
jakehwll May 5, 2026
64b5fc6
chore: resolve pnpm lock
jakehwll May 5, 2026
5227a74
feat: `<TasksPanel />` stories
jakehwll May 5, 2026
d08350c
fix: resolve stories
jakehwll May 5, 2026
a47f0f0
chore: lint fix
jakehwll May 5, 2026
af22f0d
fix: taskspanel ids
jakehwll May 5, 2026
4672a84
fix: resolve test
jakehwll May 5, 2026
ca614fa
fix: `useRef` for `queryClient`
jakehwll May 5, 2026
181a491
fix: `createElement` story to preserve side-effects
jakehwll May 5, 2026
82385b8
fix: remove unused comment
jakehwll May 5, 2026
ea16883
fix: dynamically imported tasks css
jakehwll May 5, 2026
6d225a5
fix: describe sidebar width
jakehwll May 5, 2026
93a3e85
fix: rename story
jakehwll May 5, 2026
ecf7da1
fix: unique task IDs in TaskList story, clarify loading assertion in …
jakehwll May 5, 2026
ee1d2a6
fix: add missing assertions in ActionMenu and PromptInput stories
jakehwll May 5, 2026
144ea5e
fix: backport `storybook:build`
jakehwll May 6, 2026
7b5e825
fix: inline storybook dependencies
jakehwll May 6, 2026
cfedf94
fix: remove storybook artifacts from `.vscodeignore`
jakehwll May 6, 2026
0d5d139
fix: storybook `.gitignore`
jakehwll May 6, 2026
e346f15
fix: remove `getDefaultFontStack()`
jakehwll May 6, 2026
90c39bc
fix: resolve storybook to `tsconfig.packages.json`
jakehwll May 6, 2026
9350f36
fix: remove unnecessary values from `preview.ts`
jakehwll May 6, 2026
6ac98ab
fix: minify `WebviewApi`
jakehwll May 6, 2026
3411417
fix: add `@repo/storybook-utils`
jakehwll May 6, 2026
d534058
feat: implement `@repo/mocks`
jakehwll May 6, 2026
1d716b1
refactor: move tasks CSS to per-package withTasksStyles decorator
jakehwll May 6, 2026
563c07c
refactor: move withTasksStyles to utils/storybook.ts
jakehwll May 6, 2026
0983d78
refactor: use useState initializer for QueryClient in withQueryClient
jakehwll May 6, 2026
1e6e091
refactor: remove manual workspace alias resolution from Storybook
jakehwll May 6, 2026
5a94c21
fix: add missing deps to storybook-utils, fix lint errors
jakehwll May 6, 2026
1440080
fix: add tsconfigs for new packages, fix lint errors
jakehwll May 6, 2026
6b3aa21
fix: restore original coder dependency SHA in pnpm-lock.yaml
jakehwll May 6, 2026
93243c2
fix: `.prettierignore` and `eslint.config.mjs` ignore
jakehwll May 6, 2026
eef9896
chore: prettier format
jakehwll May 6, 2026
7f12290
fix: remove spurious workspaces/overrides from package.json
jakehwll May 6, 2026
c0321a6
revert: restore getDefaultFontStack in preview.ts
jakehwll May 6, 2026
f05a685
fix: reoslve `TasksPanel.stories.tsx` `CollapsibleToggle`
jakehwll May 6, 2026
19f74de
fix: remove brittle play functions from TasksPanel stories
jakehwll May 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ pnpm-debug.log

# Workspace packages
packages/*/node_modules/

# Storybook
storybook-static/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
flake.lock
pnpm-debug.log
pnpm-lock.yaml
/storybook-static/
5 changes: 5 additions & 0 deletions .storybook/css.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module "*.css";
declare module "*.css?url" {
const url: string;
export default url;
}
108 changes: 108 additions & 0 deletions .storybook/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
html {
background: var(--vscode-sideBar-background);
}

body {
margin: 0;
padding: 0;
overflow: hidden;
}

#storybook-preview-wrapper {
background-color: var(--vscode-sideBar-background);
}

#root {
overscroll-behavior-x: none;
background-color: var(--vscode-sideBar-background);
color: var(--vscode-editor-foreground);
font-family: var(--vscode-font-family);
font-weight: var(--vscode-font-weight);
font-size: var(--vscode-font-size);
margin: 0;
max-width: 100%;
/* arbitrary size choice for the rough VSCode sidebar size */
width: 300px;
Comment thread
jakehwll marked this conversation as resolved.
}

img,
video {
max-width: 100%;
max-height: 100%;
}

a,
a code {
color: var(--vscode-textLink-foreground);
}

p > a {
text-decoration: var(--text-link-decoration);
}

a:hover {
color: var(--vscode-textLink-activeForeground);
}

a:focus,
input:focus,
select:focus,
textarea:focus {
outline: 1px solid -webkit-focus-ring-color;
outline-offset: -1px;
}

code {
font-family: var(--monaco-monospace-font);
color: var(--vscode-textPreformat-foreground);
background-color: var(--vscode-textPreformat-background);
padding: 1px 3px;
border-radius: 4px;
}

pre code {
padding: 0;
}

blockquote {
background: var(--vscode-textBlockQuote-background);
border-color: var(--vscode-textBlockQuote-border);
}

kbd {
background-color: var(--vscode-keybindingLabel-background);
color: var(--vscode-keybindingLabel-foreground);
border-style: solid;
border-width: 1px;
border-radius: 3px;
border-color: var(--vscode-keybindingLabel-border);
border-bottom-color: var(--vscode-keybindingLabel-bottomBorder);
box-shadow: inset 0 -1px 0 var(--vscode-widget-shadow);
vertical-align: middle;
padding: 1px 3px;
}

::-webkit-scrollbar {
width: 10px;
height: 10px;
}

::-webkit-scrollbar-corner {
background-color: var(--vscode-editor-background);
}

::-webkit-scrollbar-thumb {
background-color: var(--vscode-scrollbarSlider-background);
}
::-webkit-scrollbar-thumb:hover {
background-color: var(--vscode-scrollbarSlider-hoverBackground);
}
::-webkit-scrollbar-thumb:active {
background-color: var(--vscode-scrollbarSlider-activeBackground);
}
::highlight(find-highlight) {
background-color: var(--vscode-editor-findMatchHighlightBackground);
}
::highlight(current-find-highlight) {
background-color: var(--vscode-editor-findMatchBackground);
}
19 changes: 19 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { mergeConfig } from "vite";

import type { StorybookConfig } from "@storybook/react-vite";

const config: StorybookConfig = {
stories: ["../packages/*/src/**/*.stories.@(ts|tsx)"],
addons: ["@storybook/addon-essentials", "@storybook/addon-a11y"],
framework: {
name: "@storybook/react-vite",
options: {},
},
viteFinal(baseConfig) {
return mergeConfig(baseConfig, {
assetsInclude: ["**/*.ttf", "**/*.woff", "**/*.woff2"],
});
},
};

export default config;
104 changes: 104 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import codiconCssUrl from "@vscode/codicons/dist/codicon.css?url";
import { createElement, useEffect } from "react";

import "./global.css";
import { darkTheme } from "./themes/dark-v2";
import { lightTheme } from "./themes/light-v2";

import type { Preview } from "@storybook/react";
import type { WebviewApi } from "vscode-webview";

// Mock the acquireVsCodeApi function for Storybook, so that components
// that rely on it can function without errors.
if (
typeof window !== "undefined" &&
!(window as { acquireVsCodeApi?: () => WebviewApi<unknown> }).acquireVsCodeApi
) {
(window as { acquireVsCodeApi: () => WebviewApi<unknown> }).acquireVsCodeApi =
() => ({
postMessage: () => undefined,
getState: () => undefined,
setState: (state) => state,
});
Comment on lines +11 to +22
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

After the tsconfig is slimmed (separate comment), @types/vscode-webview is ambient. Add a Window augmentation and the casts go away:

declare global {
	interface Window {
		acquireVsCodeApi?: <T = unknown>() => WebviewApi<T>;
	}
}

if (typeof window !== "undefined") {
	window.acquireVsCodeApi ??= () => ({
		postMessage: () => undefined,
		getState: () => undefined,
		setState: (state) => state,
	});
}

}

// Inject codicon stylesheet immediately (before any components render)
// Must be a <link> element with id "vscode-codicon-stylesheet" for vscode-elements
if (
typeof document !== "undefined" &&
!document.getElementById("vscode-codicon-stylesheet")
) {
const link = document.createElement("link");
link.id = "vscode-codicon-stylesheet";
link.rel = "stylesheet";
link.href = codiconCssUrl;
document.head.appendChild(link);
}

// This allows the system viewing the storybook to use the same font
// stack as vscode, which is important for accurate rendering of text.
const getDefaultFontStack = () => {
if (navigator.userAgent.includes("Linux")) {
return 'system-ui, "Ubuntu", "Droid Sans", sans-serif';
} else if (navigator.userAgent.includes("Mac")) {
return "-apple-system, BlinkMacSystemFont, sans-serif";
} else if (navigator.userAgent.includes("Windows")) {
return '"Segoe WPC", "Segoe UI", sans-serif';
} else {
return "sans-serif";
}
};

const preview: Preview = {
parameters: {
layout: "centered",
},
globalTypes: {
theme: {
description: "Global theme for components",
defaultValue: "dark",
toolbar: {
title: "Theme",
icon: "circlehollow",
items: [
{ value: "light", icon: "circlehollow", title: "Light" },
{ value: "dark", icon: "circle", title: "Dark" },
],
dynamicTitle: true,
},
},
},
decorators: [
(Story, context) => {
const selectedTheme =
context.globals.theme === "light" ? lightTheme : darkTheme;

useEffect(() => {
// Apply CSS custom properties to the document root
selectedTheme.forEach(([property, value]) => {
document.documentElement.style.setProperty(property, value);
});

// Cleanup function to remove properties when unmounting
return () => {
selectedTheme.forEach(([property]) => {
document.documentElement.style.removeProperty(property);
});
};
}, [selectedTheme]);

return createElement(
"div",
Comment thread
jakehwll marked this conversation as resolved.
{
id: "root",
style: {
fontFamily: getDefaultFontStack(),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There is an issue with how this is used actually, style={{ fontFamily }} on #root is overridden by descendants like packages/tasks/src/index.css:8 that read var(--vscode-font-family) directly.

Set it as a CSS variable instead (extend the theme arrays or call setProperty next to the theme loop), then drop the inline style.

},
},
createElement(Story),
);
},
],
};

export default preview;
Loading
Loading