@sketch-hq/sketch-assistant-utils
Version:
Utility functions and types for Sketch Assistants.
28 lines • 1.2 kB
TypeScript
import { PointerMap, CancelToken, ObjectCache, JsonPointer, FileFormat, ProcessedSketchFile, SketchFile, ObjectIdSet } from '@sketch-hq/sketch-assistant-types';
/**
* Create an empty ObjectCache object.
*/
export declare const createEmptyObjectCache: () => ObjectCache;
/**
* Add a file format object to an ObjectCache instance.
*/
export declare const addObjectToCache: (object: FileFormat.AnyObject | FileFormat.Contents['document'], cache: ObjectCache) => void;
/**
* Recursively traverse a Sketch file, while populating various caches and maps.
*/
export declare const traverse: ({ target, cancelToken, pointers, objects, foreignObjects, objectIds, pointer, foreignContext, }: {
target?: Record<string, {}> | undefined;
cancelToken: CancelToken;
pointers: PointerMap;
objects: ObjectCache;
foreignObjects: ObjectCache;
objectIds: ObjectIdSet;
pointer?: string | undefined;
foreignContext?: boolean | undefined;
}) => void;
/**
* Generate a ProcessedSketchFile object from a SketchFile object.
*/
declare const process: (file: SketchFile, cancelToken: CancelToken) => Promise<ProcessedSketchFile>;
export { process };
//# sourceMappingURL=index.d.ts.map