image-editor-canva
Version:
A Canva-like image editor plugin for React
51 lines (50 loc) • 1.35 kB
TypeScript
/**
* Interface for PSD file structure
* Made compatible with @webtoon/psd's Psd class
*/
export interface PsdFile {
width: number;
height: number;
children?: PsdNode[] | unknown[];
[key: string]: unknown;
}
/**
* Interface for a node in the PSD document
*/
interface PsdNode {
type: string;
text?: string;
width?: number;
height?: number;
name?: string;
opacity?: number;
isHidden?: boolean;
children?: PsdNode[];
left?: number;
top?: number;
textProperties?: {
EngineDict?: {
StyleRun?: {
RunArray?: Array<{
StyleSheet?: {
StyleSheetData?: {
FontSize?: number;
FillColor?: {
Values?: number[];
};
Tracking?: number;
};
};
}>;
};
};
};
composite?: () => Promise<Uint8Array | Uint8ClampedArray>;
}
/**
* Converts a PSD file to Fabric.js compatible JSON
* @param psdFile - The PSD file structure from @webtoon/psd
* @returns A promise that resolves to the JSON string
*/
export declare function psdToJson(psdFile: PsdFile): Promise<string>;
export default psdToJson;