mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-04-25 06:04:54 +00:00
- Introduced Timestamp component for displaying formatted dates and relative time. - Added Toggle component for switch-like functionality with customizable sizes. - Implemented TreeIcon component for rendering tree icons using Phosphor icons. - Created EditorActions component for explain and improve actions with icons. - Developed FileTabs component for managing open files with close functionality. - Added LazyInlineMonacoEditor and LazyMonacoEditor for lazy loading Monaco editor. - Implemented NavigationItem for navigation with badges and icons. - Created PageHeaderContent for displaying page headers with icons and descriptions. - Added JSON configuration files for various UI components and layouts. - Enhanced data binding with new computed data source hook. - Updated component registry and types for new components. - Configured Vite for improved hot module replacement experience.
28 lines
837 B
TypeScript
28 lines
837 B
TypeScript
import { useKV } from '@/hooks/use-kv'
|
|
|
|
export type DataSourceType = 'kv' | 'static'
|
|
|
|
export interface DataSourceConfig<T = any> {
|
|
type: DataSourceType
|
|
key?: string
|
|
defaultValue?: T
|
|
}
|
|
|
|
export function useKVDataSource<T = any>(key: string, defaultValue?: T) {
|
|
return useKV(key, defaultValue)
|
|
}
|
|
|
|
export function useStaticDataSource<T = any>(defaultValue: T) {
|
|
return [defaultValue, () => {}, () => {}] as const
|
|
}
|
|
|
|
export function useComputedDataSource<T = any>(expression: string | (() => T), dependencies: string[] = []) {
|
|
// Simple implementation - in a real app this would evaluate the expression
|
|
const computedValue = typeof expression === 'function' ? expression() : expression
|
|
return [computedValue, () => {}, () => {}] as const
|
|
}
|
|
|
|
export function useMultipleDataSources(_sources: DataSourceConfig[]) {
|
|
return {}
|
|
}
|