@stacksjs/stx
Version:
A performant UI Framework. Powered by Bun.
62 lines • 1.72 kB
TypeScript
/**
* Generate presets panel HTML
*/
export declare function getPresetsPanelHtml(presets: PropPreset[]): string;
/**
* Generate presets panel styles
*/
export declare function getPresetsPanelStyles(): string;
/**
* Generate presets client script
*/
export declare function getPresetsScript(): string;
/**
* Prop preset
*/
export declare interface PropPreset {
id: string
name: string
description?: string
props: Record<string, any>
componentId?: string
created: number
lastUsed?: number
usageCount: number
tags?: string[]
}
/**
* Presets storage
*/
export declare interface PresetsStorage {
version: number
presets: PropPreset[]
recentIds: string[]
}
/**
* Presets manager
*/
export declare class PresetsManager {
private storage: PresetsStorage;
private storagePath: string;
private dirty: any;
constructor(rootDir: string);
private loadStorage(): PresetsStorage;
private migrateStorage(data: any): PresetsStorage;
save(): Promise<void>;
createPreset(name: string, props: Record<string, any>, options?: {
description?: string
componentId?: string
tags?: string[]
}): PropPreset;
getPreset(id: string): PropPreset | undefined;
getAllPresets(): PropPreset[];
getPresetsForComponent(componentId: string): PropPreset[];
getRecentPresets(): PropPreset[];
usePreset(id: string): PropPreset | undefined;
updatePreset(id: string, updates: Partial<Omit<PropPreset, 'id' | 'created'>>): PropPreset | undefined;
deletePreset(id: string): boolean;
searchPresets(query: string): PropPreset[];
getMostUsedPresets(limit?: any): PropPreset[];
exportPresets(ids?: string[]): string;
importPresets(json: string, overwrite?: any): number;
}