import { Dialog } from "./interface/dialog"; import { Filesystem } from "./file_system"; export declare const Plugins: { /** * The plugins window */ dialog: null | Dialog; Vue: Vue | null; /** * Data about which plugins are installed */ installed: PluginInstallation[]; json: any; download_stats: Record; update_info: Record | undefined; /** * All loaded plugins, including plugins from the store that are not installed */ all: Plugin[]; registered: Record; currently_loading: string; loading_promise: null | Promise; /** * The currently used path to the plugin API */ api_path: string; path: string; /** * Plugin files saved on install, so the web app has its own copy the way the desktop app keeps one on disk */ source_cache: { db: null | IDBDatabase; open(): Promise; get(id: string): Promise; save(id: string, content: string): Promise; remove(id: string): Promise; }; /** * Dev reload all side-loaded plugins */ devReload(): void; /** * Update sort order of existing plugins */ sort(): void; }; type PluginVariant = 'desktop' | 'web' | 'both'; type PluginSource = 'store' | 'file' | 'url'; type PluginDetails = { version: string; last_modified: string; creation_date: string; last_modified_full: string; creation_date_full: string; min_version: string; max_version: string; website: string; repository: string; bug_tracker: string; contributors: string; author: string; variant: PluginVariant | string; permissions: string; weekly_installations: string; }; type PluginInstallation = { id: string; version: string; path: string; source: PluginSource; dependencies?: string[]; disabled?: boolean; }; type PluginChangelog = Record; interface PluginOptions { title: string; author: string; /** * Description text in the plugin browser */ description: string; /** * The about text appears when the user unfolds the plugin in the plugin browser. It can contain additional information and usage instructions */ about?: string; /** * The version of the plugin. */ version?: string; icon: string; /** * Plugin tags that will show up in the plugin store. You can provide up to 3 tags. */ tags?: [string, string?, string?]; /** * Where the plugin can be installed. Desktop refers to the electron app, web refers to the web app and PWA */ variant: 'both' | 'desktop' | 'web'; /** * Minimum Blockbench version in which the plugin can be installed */ min_version?: string; /** * Maximum Blockbench version in which the plugin can be installed */ max_version?: string; /** * Set to true if the plugin must finish loading before a project is opened, i. e. because it adds a format */ await_loading?: boolean; /** * Use the new repository format where plugin, iron, and about are stored in a separate folder */ new_repository_format?: boolean; /** * Can be used to specify which features a plugin adds. This allows Blockbench to be aware of and suggest even plugins that are not installed. */ contributes?: { formats?: string[]; open_extensions?: string[]; }; creation_date?: string; has_changelog?: boolean; /** * In combination with a "Deprecated" tag, this can be used to provide context on why a plugin is deprecated */ deprecation_note?: string; website?: string; repository?: string; bug_tracker?: string; contributors?: string[]; disabled?: boolean; /** * Runs when the plugin loads */ onload?(): void; /** * Runs when the plugin unloads */ onunload?(): void; /** * Runs when the user manually installs the plugin */ oninstall?(): void; /** * Runs when the user manually uninstalls the plugin */ onuninstall?(): void; } interface PluginSetupOptions { disabled?: boolean; version?: string; } export declare class Plugin { #private; id: string; installed: boolean; title: string; author: string; description: string; about: string; icon: string; tags: string[]; dependencies: string[]; contributors: string[]; version: string; variant: PluginVariant; min_version: string; max_version: string; deprecation_note: string; path: string; website: string; repository: string; bug_tracker: string; source: PluginSource; creation_date: number; /** * Can be used to specify which features a plugin adds. This allows Blockbench to be aware of and suggest even plugins that are not installed. */ contributes?: { formats?: string[]; open_extensions?: string[]; }; await_loading: boolean; has_changelog: boolean; changelog: null | PluginChangelog; about_fetched: boolean; changelog_fetched: boolean; update_available: false | string; disabled: boolean; new_repository_format: boolean; cache_version: number; menu: Menu; details: null | PluginDetails; uuid: UUID; onload?: () => void; onunload?: () => void; oninstall?: () => void; onuninstall?: () => void; constructor(id?: string, data?: PluginOptions | PluginSetupOptions); extend(data: any): this; get name(): string; install(): Promise; load(first?: boolean, cb?: (this: Plugin) => void): Promise; runOnLoad(): void; installDependencies(first: any): Promise; download(first?: boolean): Promise; loadFromFile(file: Filesystem.FileResult, first?: boolean): Promise; loadFromCache(source: PluginSource, path?: string): Promise; loadFromURL(url: string, first?: boolean): Promise; uninstall(): this; unload(): this; reload(): this; installUpdate(): this; toggleDisabled(): void; showContextMenu(event: MouseEvent): void; isReloadable(): boolean; isInstallable(): string | true; hasImageIcon(): boolean; getIcon(): string; fetchAbout(force?: boolean): Promise; fetchChangelog(force?: boolean): Promise; getPluginDetails(force_refresh?: boolean): PluginDetails; static selected: Plugin | null; static menu: import("./interface/menu").Menu; static register(id: string, data: PluginOptions): Plugin; } export declare const BBPlugin: typeof Plugin; export type BBPlugin = Plugin; export declare function loadInstalledPlugins(): Promise; declare const global: { Plugins: { /** * The plugins window */ dialog: null | Dialog; Vue: Vue | null; /** * Data about which plugins are installed */ installed: PluginInstallation[]; json: any; download_stats: Record; update_info: Record | undefined; /** * All loaded plugins, including plugins from the store that are not installed */ all: Plugin[]; registered: Record; currently_loading: string; loading_promise: null | Promise; /** * The currently used path to the plugin API */ api_path: string; path: string; /** * Plugin files saved on install, so the web app has its own copy the way the desktop app keeps one on disk */ source_cache: { db: null | IDBDatabase; open(): Promise; get(id: string): Promise; save(id: string, content: string): Promise; remove(id: string): Promise; }; /** * Dev reload all side-loaded plugins */ devReload(): void; /** * Update sort order of existing plugins */ sort(): void; }; Plugin: typeof Plugin; BBPlugin: typeof Plugin; }; declare global { const BBPlugin: typeof Plugin; type BBPlugin = import('./plugin_loader').Plugin; const Plugins: typeof global.Plugins; } export {};