mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-23 16:24:06 +00:00
* [ci] ignore playwright mcp directory * [feat] add AssetBrowserModal And all related sub components * [feat] reactive filter functions * [ci] clean up storybook config * [feat] add sematic AssetCard * [fix] i love lucide * [fix] AssetCard layout issues * [fix] add AssetBadge type * [fix] simplify useAssetBrowser * [fix] modal layout * [fix] simplify useAssetBrowserDialog * [fix] add tailwind back to storybook * [fix] better reponsive layout * [fix] missed i18n string * [fix] missing i18n translations * [fix] remove erroneous prevent on keyboard.space * [feat] add asset metadata validation utilities * [fix] remove erroneous test code * [fix] remove forced min and max width on AssetCard * [fix] import statement nits
101 lines
2.4 KiB
TypeScript
101 lines
2.4 KiB
TypeScript
import { definePreset } from '@primevue/themes'
|
|
import Aura from '@primevue/themes/aura'
|
|
import { setup } from '@storybook/vue3'
|
|
import type { Preview, StoryContext, StoryFn } from '@storybook/vue3-vite'
|
|
import { createPinia } from 'pinia'
|
|
import 'primeicons/primeicons.css'
|
|
import PrimeVue from 'primevue/config'
|
|
import ConfirmationService from 'primevue/confirmationservice'
|
|
import ToastService from 'primevue/toastservice'
|
|
import Tooltip from 'primevue/tooltip'
|
|
|
|
import '@/assets/css/style.css'
|
|
import { i18n } from '@/i18n'
|
|
import '@/lib/litegraph/public/css/litegraph.css'
|
|
|
|
const ComfyUIPreset = definePreset(Aura, {
|
|
semantic: {
|
|
// @ts-expect-error fix me
|
|
primary: Aura['primitive'].blue
|
|
}
|
|
})
|
|
|
|
// Setup Vue app for Storybook
|
|
setup((app) => {
|
|
app.directive('tooltip', Tooltip)
|
|
|
|
// Create Pinia instance
|
|
const pinia = createPinia()
|
|
|
|
app.use(pinia)
|
|
app.use(i18n)
|
|
app.use(PrimeVue, {
|
|
theme: {
|
|
preset: ComfyUIPreset,
|
|
options: {
|
|
prefix: 'p',
|
|
cssLayer: {
|
|
name: 'primevue',
|
|
order: 'primevue, tailwind-utilities'
|
|
},
|
|
darkModeSelector: '.dark-theme, :root:has(.dark-theme)'
|
|
}
|
|
}
|
|
})
|
|
app.use(ConfirmationService)
|
|
app.use(ToastService)
|
|
})
|
|
|
|
// Theme and dialog decorator
|
|
export const withTheme = (Story: StoryFn, context: StoryContext) => {
|
|
const theme = context.globals.theme || 'light'
|
|
|
|
// Apply theme class to document root
|
|
if (theme === 'dark') {
|
|
document.documentElement.classList.add('dark-theme')
|
|
document.body.classList.add('dark-theme')
|
|
} else {
|
|
document.documentElement.classList.remove('dark-theme')
|
|
document.body.classList.remove('dark-theme')
|
|
}
|
|
|
|
return Story(context.args, context)
|
|
}
|
|
|
|
const preview: Preview = {
|
|
parameters: {
|
|
controls: {
|
|
matchers: {
|
|
color: /(background|color)$/i,
|
|
date: /Date$/i
|
|
}
|
|
},
|
|
backgrounds: {
|
|
default: 'light',
|
|
values: [
|
|
{ name: 'light', value: '#ffffff' },
|
|
{ name: 'dark', value: '#0a0a0a' }
|
|
]
|
|
}
|
|
},
|
|
globalTypes: {
|
|
theme: {
|
|
name: 'Theme',
|
|
description: 'Global theme for components',
|
|
defaultValue: 'light',
|
|
toolbar: {
|
|
icon: 'circlehollow',
|
|
items: [
|
|
{ value: 'light', icon: 'sun', title: 'Light' },
|
|
{ value: 'dark', icon: 'moon', title: 'Dark' }
|
|
],
|
|
showName: true,
|
|
dynamicTitle: true
|
|
}
|
|
}
|
|
},
|
|
decorators: [withTheme]
|
|
}
|
|
|
|
export default preview
|