Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
179fdfb
storybook init stories
iamdavidhill Feb 19, 2026
a0ddfd0
storybook: stabilize UI story indexing
iamdavidhill Feb 19, 2026
89069e7
storybook: stabilize story ids
iamdavidhill Feb 19, 2026
61d6219
Update basic-tool.stories.tsx
iamdavidhill Feb 19, 2026
8664660
Update accordion.stories.tsx
iamdavidhill Feb 19, 2026
409dbfa
storybook: add ui story fixtures
iamdavidhill Feb 19, 2026
1399e79
storybook: update accordion story
iamdavidhill Feb 19, 2026
19af295
storybook: update app-icon story
iamdavidhill Feb 19, 2026
5d88f4a
storybook: update avatar story
iamdavidhill Feb 19, 2026
ee89640
storybook: update basic-tool story
iamdavidhill Feb 19, 2026
e72431d
storybook: update button story
iamdavidhill Feb 19, 2026
ef05ec9
storybook: update card story
iamdavidhill Feb 19, 2026
717fd6e
storybook: update checkbox story
iamdavidhill Feb 19, 2026
2e0f020
storybook: update code story
iamdavidhill Feb 19, 2026
6ea4e8c
storybook: update collapsible story
iamdavidhill Feb 19, 2026
a0f17e1
storybook: update context-menu story
iamdavidhill Feb 19, 2026
77b8887
storybook: update dialog story
iamdavidhill Feb 19, 2026
ee3457a
storybook: update diff-changes story
iamdavidhill Feb 19, 2026
b9bd437
storybook: update diff-ssr story
iamdavidhill Feb 19, 2026
88272eb
storybook: update diff story
iamdavidhill Feb 19, 2026
a13ca70
storybook: update dock-prompt story
iamdavidhill Feb 19, 2026
a1b58ae
storybook: update dropdown-menu story
iamdavidhill Feb 19, 2026
d5626e0
storybook: update favicon story
iamdavidhill Feb 19, 2026
7aec602
storybook: update file-icon story
iamdavidhill Feb 19, 2026
5c83281
storybook: update font story
iamdavidhill Feb 19, 2026
ff4c7e5
storybook: update hover-card story
iamdavidhill Feb 19, 2026
a957d9e
storybook: update icon-button story
iamdavidhill Feb 19, 2026
6299df3
storybook: update icon story
iamdavidhill Feb 19, 2026
7077f8e
storybook: update image-preview story
iamdavidhill Feb 19, 2026
4ff423d
storybook: update inline-input story
iamdavidhill Feb 19, 2026
c937c8c
storybook: update keybind story
iamdavidhill Feb 19, 2026
2858af4
storybook: update line-comment story
iamdavidhill Feb 19, 2026
db2a143
storybook: update list story
iamdavidhill Feb 19, 2026
55d7557
storybook: update logo story
iamdavidhill Feb 19, 2026
3442032
storybook: update markdown story
iamdavidhill Feb 19, 2026
5da0c16
storybook: update popover story
iamdavidhill Feb 19, 2026
ae0da3a
storybook: update progress-circle story
iamdavidhill Feb 19, 2026
89c8e3a
storybook: update progress story
iamdavidhill Feb 19, 2026
b4f5756
storybook: update provider-icon story
iamdavidhill Feb 19, 2026
f711ce2
storybook: update radio-group story
iamdavidhill Feb 19, 2026
0371829
storybook: update resize-handle story
iamdavidhill Feb 19, 2026
4847a4c
storybook: update select story
iamdavidhill Feb 19, 2026
c8f8b57
storybook: update spinner story
iamdavidhill Feb 19, 2026
afc734f
storybook: update sticky-accordion-header story
iamdavidhill Feb 19, 2026
bc26e0e
storybook: update switch story
iamdavidhill Feb 19, 2026
76be891
storybook: update tabs story
iamdavidhill Feb 19, 2026
42d3ab0
storybook: update tag story
iamdavidhill Feb 19, 2026
be28372
storybook: update text-field story
iamdavidhill Feb 19, 2026
8582058
storybook: update text-shimmer story
iamdavidhill Feb 19, 2026
023dfac
storybook: update toast story
iamdavidhill Feb 19, 2026
21fdc86
storybook: update tooltip story
iamdavidhill Feb 19, 2026
6f91f79
storybook: update typewriter story
iamdavidhill Feb 19, 2026
4702650
chore: cleanup
adamdotdevin Feb 20, 2026
bf2fb7f
storybook: add toolbar theme toggle
iamdavidhill Feb 20, 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
203 changes: 195 additions & 8 deletions bun.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions packages/storybook/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
storybook-static/
.storybook-cache/
37 changes: 37 additions & 0 deletions packages/storybook/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { defineMain } from "storybook-solidjs-vite"
import path from "node:path"
import { fileURLToPath } from "node:url"

const here = path.dirname(fileURLToPath(import.meta.url))
const ui = path.resolve(here, "../../ui")

export default defineMain({
framework: {
name: "storybook-solidjs-vite",
options: {},
},
addons: [
"@storybook/addon-onboarding",
"@storybook/addon-docs",
"@storybook/addon-links",
"@storybook/addon-a11y",
"@storybook/addon-vitest",
],
stories: ["../../ui/src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
async viteFinal(config) {
const { mergeConfig, searchForWorkspaceRoot } = await import("vite")
return mergeConfig(config, {
resolve: {
dedupe: ["solid-js", "solid-js/web", "@solidjs/meta"],
},
worker: {
format: "es",
},
server: {
fs: {
allow: [searchForWorkspaceRoot(process.cwd()), ui],
},
},
})
},
})
11 changes: 11 additions & 0 deletions packages/storybook/.storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { addons, types } from "storybook/manager-api"
import { ThemeTool } from "./theme-tool"

addons.register("opencode/theme-toggle", () => {
addons.add("opencode/theme-toggle/tool", {
type: types.TOOL,
title: "Theme",
match: ({ viewMode }) => viewMode === "story" || viewMode === "docs",
render: ThemeTool,
})
})
106 changes: 106 additions & 0 deletions packages/storybook/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import "@opencode-ai/ui/styles"

import { createEffect, onCleanup, onMount } from "solid-js"
import addonA11y from "@storybook/addon-a11y"
import addonDocs from "@storybook/addon-docs"
import { MetaProvider } from "@solidjs/meta"
import { addons } from "storybook/preview-api"
import { GLOBALS_UPDATED } from "storybook/internal/core-events"
import { createJSXDecorator, definePreview } from "storybook-solidjs-vite"
import { Code } from "@opencode-ai/ui/code"
import { CodeComponentProvider } from "@opencode-ai/ui/context/code"
import { DialogProvider } from "@opencode-ai/ui/context/dialog"
import { DiffComponentProvider } from "@opencode-ai/ui/context/diff"
import { MarkedProvider } from "@opencode-ai/ui/context/marked"
import { Diff } from "@opencode-ai/ui/diff"
import { ThemeProvider, useTheme, type ColorScheme } from "@opencode-ai/ui/theme"
import { Font } from "@opencode-ai/ui/font"

function resolveScheme(value: unknown): ColorScheme {
if (value === "light" || value === "dark" || value === "system") return value
return "system"
}

const channel = addons.getChannel()

const Scheme = (props: { value?: unknown }) => {
const theme = useTheme()
const apply = (value?: unknown) => {
theme.setColorScheme(resolveScheme(value))
}
createEffect(() => {
apply(props.value)
})
createEffect(() => {
const root = document.documentElement
root.classList.remove("light", "dark")
root.classList.add(theme.mode())
})
onMount(() => {
const handler = (event: { globals?: Record<string, unknown> }) => {
apply(event.globals?.theme)
}
channel.on(GLOBALS_UPDATED, handler)
onCleanup(() => channel.off(GLOBALS_UPDATED, handler))
})
return null
}

const frame = createJSXDecorator((Story, context) => {
const override = context.parameters?.themes?.themeOverride
const selected = context.globals?.theme
const pick = override === "light" || override === "dark" ? override : selected
const scheme = resolveScheme(pick)
return (
<MetaProvider>
<Font />
<ThemeProvider>
<Scheme value={scheme} />
<DialogProvider>
<MarkedProvider>
<DiffComponentProvider component={Diff}>
<CodeComponentProvider component={Code}>
<div
style={{
"min-height": "100vh",
padding: "24px",
"background-color": "var(--background-base)",
color: "var(--text-base)",
}}
>
<Story />
</div>
</CodeComponentProvider>
</DiffComponentProvider>
</MarkedProvider>
</DialogProvider>
</ThemeProvider>
</MetaProvider>
)
})

export default definePreview({
addons: [addonDocs(), addonA11y()],
decorators: [frame],
globalTypes: {
theme: {
name: "Theme",
description: "Global theme",
defaultValue: "light",
},
},
parameters: {
actions: {
argTypesRegex: "^on.*",
},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
a11y: {
test: "todo",
},
},
})
21 changes: 21 additions & 0 deletions packages/storybook/.storybook/theme-tool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { createElement } from "react"
import { useGlobals } from "storybook/manager-api"
import { ToggleButton } from "storybook/internal/components"

export function ThemeTool() {
const [globals, updateGlobals] = useGlobals()
const mode = globals.theme === "dark" ? "dark" : "light"
const toggle = () => {
const next = mode === "dark" ? "light" : "dark"
updateGlobals({ theme: next })
}
return createElement(
ToggleButton,
{
title: "Toggle theme",
active: mode === "dark",
onClick: toggle,
},
mode === "dark" ? "Dark" : "Light",
)
}
Loading
Loading