Compare commits

...

45 Commits

Author SHA1 Message Date
snomiao
af20722ceb Merge origin/main into sno-storybook--settings-panel 2025-10-09 00:59:59 +00:00
snomiao
6b088394c2 Merge branch 'main' into sno-storybook--settings-panel 2025-10-02 23:31:34 +09:00
snomiao
dc5ab711f6 Merge branch 'main' into sno-storybook--settings-panel 2025-10-02 08:12:12 +09:00
snomiao
d08c408ccc chore: Remove incomplete story files causing import errors 2025-09-30 02:37:58 +00:00
snomiao
a249d206a1 fix: Update import path for useSettingStore in Storybook preview 2025-09-30 02:37:04 +00:00
snomiao
e930184004 Merge branch 'main' into sno-storybook--settings-panel 2025-09-30 02:25:37 +00:00
snomiao
3aec59a78e Merge branch 'main' into sno-storybook--settings-panel 2025-09-16 22:17:23 +09:00
snomiao
6acb1b278b Merge branch 'main' into sno-storybook--settings-panel 2025-09-07 10:36:24 +09:00
snomiao
b5e106ef8b [fix] Replace non-existent toBeOneOf test assertions with standard toBe(0) 2025-08-29 13:38:05 +00:00
snomiao
2e2e1aab0c Merge origin/main into sno-storybook--settings-panel 2025-08-29 13:24:54 +00:00
snomiao
24ce3fa5bc [fix] Add missing @iconify/tailwind dependency for tests
This resolves PostCSS errors that were causing component tests to fail after merging with origin/main.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-26 16:31:52 +00:00
snomiao
3b95daccc5 Merge remote-tracking branch 'origin/main' into sno-storybook--settings-panel 2025-08-26 16:27:34 +00:00
snomiao
257ca95fbb Merge remote-tracking branch 'origin/main' into sno-storybook--settings-panel 2025-08-23 18:31:42 +00:00
snomiao
0f06f75edd Merge remote-tracking branch 'origin/main' into sno-storybook--settings-panel 2025-08-22 04:42:26 +00:00
snomiao
b388bccdbe [feat] Improve Storybook configuration and fix store coupling
- Fix tight coupling between SettingItem and store by adding proper mock settings
- Initialize setting store with realistic mock data for all Storybook stories
- Add comprehensive setting definitions to prevent undefined.id crashes
- Improved error handling for missing settings in Storybook context
- Addresses review feedback from @viva-jinyi about store coupling issues

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-21 16:00:10 +00:00
snomiao
2c9a1f175b Merge remote-tracking branch 'origin/main' into sno-storybook--settings-panel 2025-08-19 12:05:50 +00:00
snomiao
b9e01867dc [merge] Merge origin/main 2025-08-19 04:55:46 +00:00
snomiao
13a6a20e4f restore rectangle.ts 2025-08-19 02:44:19 +00:00
snomiao
2cc7ae2bc6 [revert] Remove litegraph infrastructure changes unrelated to PR
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 02:44:19 +00:00
snomiao
f989b055b7 [auto-fix] Fix TypeScript error in Rectangle.ts - remove generic type parameter
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 02:44:19 +00:00
snomiao
4947da3d87 Revert "[bugfix] Fix TypeScript error in Rectangle.ts - remove invalid generic type parameter"
This reverts commit afe1c8cffa4963a752b3bba64a00e9d318ba9f35.
2025-08-19 02:44:19 +00:00
snomiao
84ce478c7e Revert "[bugfix] Fix TypeScript error in Rectangle subarray method"
This reverts commit d5c695ad76627d96d1f42b21d49a8e33bf79a179.
2025-08-19 02:44:18 +00:00
snomiao
8167021db2 [bugfix] Fix TypeScript error in Rectangle subarray method
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 02:44:18 +00:00
snomiao
de0130da99 [bugfix] Fix TypeScript error in Rectangle.ts - remove invalid generic type parameter
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 02:44:18 +00:00
snomiao
945e8e9984 [feat] Add Storybook configuration and settings panel stories
- Set up Storybook 9.1.2 with Vue 3, PrimeVue, and Tailwind CSS support
- Created comprehensive stories for settings panel components:
  - SettingItem: Various input types (boolean, text, number, slider, combo, color)
  - SettingGroup: Grouped settings with dividers and different categories
  - SettingsPanel: Multiple setting groups and empty states
  - PanelTemplate: Reusable panel layout with header/footer slots
  - AboutPanel: System information and project badges
  - SettingDialogContent: Complete dialog with responsive layouts
- Updated TypeScript configuration to include Storybook files

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 02:44:18 +00:00
Jin Yi
26dbbb1395 feature: storybook-setting (#5088) 2025-08-19 10:37:38 +08:00
snomiao
c8772230fb [fix] Replace __dirname with process.cwd() in Storybook config
__dirname is not available in all environments. Using process.cwd()
provides better compatibility and resolves path issues in Storybook.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 01:55:59 +00:00
snomiao
171d0960ef fix(chromatic.yaml): change edit-mode from replace to append to preserve existing comments in pull request 2025-08-19 01:55:59 +00:00
snomiao
74a83fa99e [fix] Resolve Vite CJS deprecation warning in Storybook config
- Use dynamic import for mergeConfig to avoid CJS build warning
- Replace static import with dynamic import in viteFinal function
- Maintain type safety with separate type import
- Fixes "The CJS build of Vite's Node API is deprecated" warning

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 01:55:59 +00:00
snomiao
a89b9e89cd chore(chromatic.yaml): move permissions section inside the chromatic-deployment job for better organization and clarity 2025-08-19 01:55:59 +00:00
snomiao
205f45518c [feat] Optimize Chromatic workflow with automated PR status comments
- Replace complex GitHub Script actions with edumserrano/find-create-or-update-comment@v3
- Add comprehensive PR comments showing Storybook build progress and results
- Include build metrics: components, stories, visual changes, and errors
- Add direct links to Chromatic builds and Storybook previews
- Reduce workflow complexity by ~60 lines while maintaining functionality
- Use native GitHub Actions expressions for cleaner maintainability

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 01:55:59 +00:00
snomiao
62747ec896 chore(storybook): replace main.mjs with main.ts for improved type safety and maintainability
fix(storybook): remove unused import map plugins in Storybook configuration to prevent potential issues
fix(storybook): update color palette store initialization to streamline code and improve readability
2025-08-19 01:55:59 +00:00
snomiao
b2a97ee4f0 [bugfix] Fix Storybook builder require() error by converting main.ts to main.mjs
- Convert .storybook/main.ts to main.mjs to resolve ES module compatibility
- Use dynamic imports instead of static imports to avoid require() errors
- Add .storybook directory to tsconfig.json includes
- Storybook build and dev server now work correctly

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 01:55:59 +00:00
snomiao
ceec83b00e [feat] Remove bun.lock as it's now ignored 2025-08-19 01:55:59 +00:00
snomiao
cf4ab951ce fix(vite.config.mts): correct path alias for src directory to ensure proper resolution in the project
refactor(vite.config.mts): adjust templates proxy configuration for better readability and maintainability
2025-08-19 01:55:59 +00:00
snomiao
cd787c56d9 [bugfix] Fix TypeScript errors in SubgraphNode type checking
Add proper type validation for subgraph node selection before calling
SubgraphNode-specific methods. This prevents undefined values from being
passed to functions expecting SubgraphNode parameters.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 01:55:59 +00:00
snomiao
ac37a5e375 [feat] Rebase branch onto main and update Storybook configuration
- Rebase sno-storybook branch onto origin/main with latest changes
- Update .storybook/main.ts with additional plugins and component configuration
- Add icons and component resolvers for Storybook support
- Update .gitignore with new entries
- Regenerate package-lock.json after rebase conflicts

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 01:55:59 +00:00
snomiao
1e9356763a chore(chromatic.yaml): restrict push branches to main only for better workflow management 2025-08-19 01:55:59 +00:00
snomiao
141148132b [docs] Add Chromatic documentation to Storybook README
- Document Chromatic visual testing integration
- Add information about automated testing workflow
- Include best practices for visual regression testing
- Explain how to view and manage test results

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 01:55:59 +00:00
snomiao
799b760c69 [feat] Add Chromatic GitHub Action for Storybook visual testing
- Add automated visual regression testing for Storybook components
- Configure workflow to run on main branch and PRs
- Auto-accept changes on main branch for baseline updates
- Uses build-storybook script for optimized builds

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 01:55:59 +00:00
snomiao
88baf87022 [bugfix] Fix TypeScript errors in Load3D components and GLTF test
- Fix type mismatches in Load3DScene eventConfig by casting string values to proper enum types (MaterialMode, CameraType, UpDirection)
- Fix Uint8Array vs ArrayBuffer type issues in GLTF test by using .buffer property
- Remove unused @ts-expect-error comment in Rectangle.ts

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 01:55:58 +00:00
snomiao
2b86f41b01 [refactor] Remove ts-expect-error comment from Storybook preview
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 01:55:58 +00:00
snomiao
6244cafc69 [docs] Add comprehensive Storybook documentation
- Add README.md explaining Storybook usage, benefits, and comparison with other tools
- Add CLAUDE.md with development guidelines for working with Storybook
- Include best practices, troubleshooting tips, and integration notes
- Address PR review feedback for better developer onboarding

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 01:55:58 +00:00
snomiao
308b3cd334 [feat] Improve Storybook configuration and setup
- Add comprehensive PrimeVue theme setup with ComfyUI preset
- Configure proper Vue app setup with Pinia stores, i18n, and services
- Remove unused onboarding addon from Storybook dependencies
- Improve Vite configuration with better chunking and alias resolution
- Add proper CSS imports and styling for ComfyUI components

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 01:55:58 +00:00
snomiao
7be97b30ed [feat] Add Storybook setup and NodePreview story
- Install and configure Storybook v9.1.1 for Vue 3
- Set up Storybook configuration with Vite integration
- Add Pinia store support for Storybook environment
- Create comprehensive NodePreview.stories.ts with multiple node examples:
  - KSampler node (complex node with multiple inputs/outputs)
  - CLIP Text Encode node (simple text input node)
  - VAE Decode node (image processing node)
  - Example with long markdown description
- Configure project paths and aliases for Storybook
- Stories demonstrate various ComfyUI node types with realistic mock data
- Update tsconfig.eslint.json to include Storybook files
- Fix ESLint issues with imports and number precision
- Add Storybook ESLint plugin configuration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 01:55:58 +00:00
3 changed files with 379 additions and 0 deletions

View File

@@ -12,6 +12,9 @@ import Tooltip from 'primevue/tooltip'
import '@/assets/css/style.css'
import { i18n } from '@/i18n'
import '@/lib/litegraph/public/css/litegraph.css'
import { useSettingStore } from '@/platform/settings/settingStore'
import { useWidgetStore } from '@/stores/widgetStore'
import { useColorPaletteStore } from '@/stores/workspace/colorPaletteStore'
const ComfyUIPreset = definePreset(Aura, {
semantic: {
@@ -28,6 +31,122 @@ setup((app) => {
const pinia = createPinia()
app.use(pinia)
// Initialize stores
useColorPaletteStore(pinia)
useWidgetStore(pinia)
// Initialize setting store and mock settings for Storybook
const settingStore = useSettingStore(pinia)
// Initialize setting values manually for Storybook (since loadSettingValues might fail)
settingStore.$patch({
settingValues: {} // Start with empty settings values
})
// Mock common setting definitions for Storybook
const mockSettings = [
{ id: 'Comfy.Locale', name: 'Language', type: 'combo', defaultValue: 'en' },
{
id: 'Comfy.AutoSave',
name: 'Auto Save',
type: 'boolean',
defaultValue: true
},
{
id: 'Comfy.AutoSaveInterval',
name: 'Auto Save Interval',
type: 'number',
defaultValue: 30
},
{
id: 'Comfy.ColorPalette',
name: 'Color Palette',
type: 'combo',
defaultValue: 'dark'
},
{
id: 'Comfy.AccentColor',
name: 'Accent Color',
type: 'color',
defaultValue: '#007bff'
},
{
id: 'Comfy.NodeOpacity',
name: 'Node Opacity',
type: 'slider',
defaultValue: 80
},
{
id: 'Comfy.MaxConcurrentTasks',
name: 'Max Concurrent Tasks',
type: 'number',
defaultValue: 4
},
{
id: 'Comfy.EnableGPUAcceleration',
name: 'GPU Acceleration',
type: 'boolean',
defaultValue: true
},
{
id: 'Comfy.CacheSize',
name: 'Cache Size',
type: 'slider',
defaultValue: 512
},
// Mock settings used in stories
{
id: 'test.setting',
name: 'Test Setting',
type: 'boolean',
defaultValue: false
},
{
id: 'mixed.boolean',
name: 'Boolean Setting',
type: 'boolean',
defaultValue: true
},
{
id: 'mixed.text',
name: 'Text Setting',
type: 'text',
defaultValue: 'Default text'
},
{
id: 'mixed.number',
name: 'Number Setting',
type: 'number',
defaultValue: 42
},
{
id: 'mixed.slider',
name: 'Slider Setting',
type: 'slider',
defaultValue: 75
},
{
id: 'mixed.combo',
name: 'Combo Setting',
type: 'combo',
defaultValue: 'option2'
},
{
id: 'mixed.color',
name: 'Color Setting',
type: 'color',
defaultValue: '#ff6b35'
}
]
// Register mock settings
try {
mockSettings.forEach((setting) => settingStore.addSetting(setting as any))
} catch (error) {
console.warn('Failed to add settings, they might already exist:', error)
}
app.use(i18n)
app.use(PrimeVue, {
theme: {

View File

@@ -0,0 +1,63 @@
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import AboutPanel from './AboutPanel.vue'
const meta: Meta<typeof AboutPanel> = {
title: 'Components/Setting/AboutPanel',
component: AboutPanel,
parameters: {
layout: 'padded',
docs: {
description: {
component:
'The About panel displays project information, badges, and system statistics.'
}
}
},
decorators: [
() => ({
template:
'<div style="max-width: 600px; min-height: 400px; padding: 16px;"><story /></div>'
})
]
}
export default meta
type Story = StoryObj<typeof meta>
export const Default: Story = {
args: {},
parameters: {
docs: {
description: {
story:
'The default About panel showing project badges and system information.'
}
}
}
}
export const WithSystemStats: Story = {
args: {},
parameters: {
docs: {
description: {
story: 'About panel with system statistics visible.'
}
}
}
}
export const Mobile: Story = {
args: {},
parameters: {
viewport: {
defaultViewport: 'mobile1'
},
docs: {
description: {
story: 'About panel optimized for mobile devices.'
}
}
}
}

View File

@@ -0,0 +1,197 @@
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import PanelTemplate from './PanelTemplate.vue'
const meta: Meta<typeof PanelTemplate> = {
title: 'Components/Setting/PanelTemplate',
component: PanelTemplate,
parameters: {
layout: 'padded',
docs: {
description: {
component:
'A template component for settings panels that provides consistent layout with header, content, and footer slots.'
}
}
},
argTypes: {
value: {
control: 'text',
description: 'The value identifier for the tab panel'
},
class: {
control: 'text',
description: 'Additional CSS classes to apply'
}
},
decorators: [
() => ({
template:
'<div style="width: 600px; height: 400px; border: 1px solid #ddd;"><story /></div>'
})
]
}
export default meta
type Story = StoryObj<typeof meta>
export const Default: Story = {
args: {
value: 'example-panel'
},
render: (args) => ({
components: { PanelTemplate },
setup() {
return { args }
},
template: `
<PanelTemplate v-bind="args">
<div class="p-4">
<h3 class="text-lg font-semibold mb-4">Panel Content</h3>
<p class="mb-4">This is the main content area of the panel.</p>
<div class="space-y-2">
<div class="p-2 bg-gray-100 rounded">Setting Item 1</div>
<div class="p-2 bg-gray-100 rounded">Setting Item 2</div>
<div class="p-2 bg-gray-100 rounded">Setting Item 3</div>
</div>
</div>
</PanelTemplate>
`
})
}
export const WithHeader: Story = {
args: {
value: 'header-panel'
},
render: (args) => ({
components: { PanelTemplate },
setup() {
return { args }
},
template: `
<PanelTemplate v-bind="args">
<template #header>
<div class="p-3 bg-blue-50 border border-blue-200 rounded mb-4">
<h4 class="text-blue-800 font-medium">Panel Header</h4>
<p class="text-blue-600 text-sm">This is a header message for the panel.</p>
</div>
</template>
<div class="p-4">
<h3 class="text-lg font-semibold mb-4">Panel Content</h3>
<p>Content with a header message above.</p>
</div>
</PanelTemplate>
`
})
}
export const WithFooter: Story = {
args: {
value: 'footer-panel'
},
render: (args) => ({
components: { PanelTemplate },
setup() {
return { args }
},
template: `
<PanelTemplate v-bind="args">
<div class="p-4">
<h3 class="text-lg font-semibold mb-4">Panel Content</h3>
<p>Content with a footer below.</p>
</div>
<template #footer>
<div class="p-3 bg-gray-50 border-t">
<div class="flex justify-end space-x-2">
<button class="px-4 py-2 bg-gray-500 text-white rounded hover:bg-gray-600">
Cancel
</button>
<button class="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">
Save
</button>
</div>
</div>
</template>
</PanelTemplate>
`
})
}
export const WithHeaderAndFooter: Story = {
args: {
value: 'full-panel'
},
render: (args) => ({
components: { PanelTemplate },
setup() {
return { args }
},
template: `
<PanelTemplate v-bind="args">
<template #header>
<div class="p-3 bg-green-50 border border-green-200 rounded mb-4">
<h4 class="text-green-800 font-medium">Important Notice</h4>
<p class="text-green-600 text-sm">Please review all settings before saving.</p>
</div>
</template>
<div class="p-4">
<h3 class="text-lg font-semibold mb-4">Settings Content</h3>
<div class="space-y-4">
<div>
<label class="block text-sm font-medium mb-1">Setting 1</label>
<input type="text" class="w-full p-2 border rounded" value="Default value" />
</div>
<div>
<label class="block text-sm font-medium mb-1">Setting 2</label>
<select class="w-full p-2 border rounded">
<option>Option 1</option>
<option>Option 2</option>
</select>
</div>
</div>
</div>
<template #footer>
<div class="p-3 bg-gray-50 border-t">
<div class="flex justify-between items-center">
<span class="text-sm text-gray-600">Changes will be saved automatically</span>
<button class="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">
Apply Changes
</button>
</div>
</div>
</template>
</PanelTemplate>
`
})
}
export const LongContent: Story = {
args: {
value: 'long-panel'
},
render: (args) => ({
components: { PanelTemplate },
setup() {
return { args }
},
template: `
<PanelTemplate v-bind="args">
<div class="p-4">
<h3 class="text-lg font-semibold mb-4">Scrollable Content</h3>
<div class="space-y-4">
${Array.from(
{ length: 20 },
(_, i) => `
<div class="p-3 bg-gray-100 rounded">
<h4 class="font-medium">Setting Group ${i + 1}</h4>
<p class="text-sm text-gray-600">This is setting group ${i + 1} with some description text.</p>
</div>
`
).join('')}
</div>
</div>
</PanelTemplate>
`
})
}