UNPKG

flipper-plugin

Version:

Flipper Desktop plugin SDK and components

57 lines 2.53 kB
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format */ import { ActivatablePluginDetails } from 'flipper-common'; import { PluginFactory, FlipperPluginComponent } from './Plugin'; import { DevicePluginPredicate, DevicePluginFactory } from './DevicePlugin'; export type FlipperPluginAPI<T extends (...args: any[]) => object> = (pluginInstance: ReturnType<T>) => object; export type FlipperPluginInstance<T extends (...args: any[]) => object> = Parameters<FlipperPluginAPI<T>>[0]; /** * FlipperPluginModule describe the exports that are provided by a typical Flipper Desktop plugin */ export type FlipperDevicePluginModule = { /** predicate that determines if this plugin applies to the currently selcted device */ supportsDevice?: DevicePluginPredicate; /** the factory function that initializes a plugin instance */ devicePlugin: DevicePluginFactory; /** the component type that can render this plugin */ Component: FlipperPluginComponent; }; /** * FlipperPluginModule describe the exports that are provided by a typical Flipper Desktop plugin */ export type FlipperPluginModule<Factory extends PluginFactory<any, any, any, any>> = { /** the factory function that initializes a plugin instance */ plugin: Factory; /** the component type that can render this plugin */ Component: FlipperPluginComponent; }; /** * A sandy plugin definition represents a loaded plugin definition, storing two things: * the loaded JS module, and the meta data (typically coming from package.json). * * Also delegates some of the standard plugin functionality to have a similar public static api as FlipperPlugin */ export declare class SandyPluginDefinition { id: string; module: FlipperPluginModule<any> | FlipperDevicePluginModule; css?: string; details: ActivatablePluginDetails; isDevicePlugin: boolean; constructor(details: ActivatablePluginDetails, module: FlipperPluginModule<any> | FlipperDevicePluginModule, css?: string); asDevicePluginModule(): FlipperDevicePluginModule; asPluginModule(): FlipperPluginModule<any>; get packageName(): string; get title(): string; get icon(): string | undefined; get category(): string | undefined; get gatekeeper(): string | undefined; get version(): string; get keyboardActions(): never[]; } //# sourceMappingURL=SandyPluginDefinition.d.ts.map