@ma3-pro-plugins/ma3-pro-plugins-lib
Version:
TSTL Library for grandMA3 plugins
30 lines (29 loc) • 1.05 kB
TypeScript
import { Logger } from './Logger';
/**
* These types fits the generated __images/index.ts from the buildPlugin.mjs script
*/
export type ImageData = {
fileName: string;
imageBase64: string;
};
export type BuiltInImages<ImageKey extends string> = {
[key in ImageKey]: ImageData;
};
/**
* Craete Image Importer
* Runs the "UpdateContent" command which makes MA3 generate XML file for each image in the image library.
* Then resolves which XML belongs to which image file.
*
* @param {string} pluginId an id used as a sub-folder name inside the image library
* @returns An Importer that can be used to import images by their original file name.
*/
export declare function ImageLibraryUtils(pluginId: string, log: Logger): {
deleteAllImages: () => void;
imageLibraryPath: string;
importImages: (images: {
imageFileName: string;
targetIndex: number | string;
}[]) => void;
writeImageFiles: (images: ImageData[]) => void;
};
export type ImageLibraryAccess = ReturnType<typeof ImageLibraryUtils>;