import { EmbedComponentType, EventCallbackFn, PluginManifest, WidgetOptions } from '.'; import { AppEvent, AppEventListerKey } from './events'; import { AppNamespace } from './name_spaces/app'; import { CardNamespace } from './name_spaces/card'; import { DateNamespace } from './name_spaces/date'; import { EditorNamespace } from './name_spaces/editor'; import { EventNamespace } from './name_spaces/event'; import { FocusNamespace } from './name_spaces/focus'; import { KnowledgeBaseNamespace } from './name_spaces/knowledge_base'; import { MessagingNamespace } from './name_spaces/messaging'; import { PowerupNamespace } from './name_spaces/powerup'; import { Query_DUPE_2 } from './name_spaces/query'; import { QueueNamespace } from './name_spaces/queue'; import { ReaderNamespace } from './name_spaces/reader'; import { RemNamespace } from './name_spaces/rem'; import { RichTextNamespace } from './name_spaces/rich_text'; import { SchedulerNamespace } from './name_spaces/scheduler'; import { SearchNamespace } from './name_spaces/search'; import { SettingsNamespace } from './name_spaces/settings'; import { StorageNamespace } from './name_spaces/storage'; import { WidgetNamespace } from './name_spaces/widget'; import { WindowNamespace } from './name_spaces/window'; export { AppNamespace, CardNamespace, DateNamespace, EditorNamespace, EventNamespace, FocusNamespace, KnowledgeBaseNamespace, MessagingNamespace, PowerupNamespace, Query_DUPE_2, QueueNamespace, ReaderNamespace, RemNamespace, RichTextNamespace, SchedulerNamespace, SearchNamespace, SettingsNamespace, StorageNamespace, WidgetNamespace, WindowNamespace, }; /** * `RNPlugin` is the base API endpoint for accessing all API methods. * * View each namespace on the sidebar for methods and examples, or view a consise overview below. * * ## Getting a RNPlugin * ### Index Widget * Get the RNPlugin directly in onActivate and onDeactivate: * ```typescript * async function onActivate(plugin: ReactRNPlugin) { * plugin.settings.registerStringSetting({ * // ... * }) * } * ``` * * Towards the bottom of the file you can see s * the second plugin lifecycle method: * * ```typescript * async function onDeactivate(plugin: ReactRNPlugin) {} * ``` * * ### Other Widgets * In your other React widgets, call the `usePlugin()` or `useTracker()` hooks: * ```typescript * const plugin = usePlugin(); * plugin.settings.registerStringSetting({ * // ... * }) * ``` * * ```typescript * const reactiveVal = useTracker(plugin => { * return plugin.settings.getSetting("mySetting"); * }); * ``` */ export declare abstract class RNPlugin { /** @hidden */ private apiCallPromise; /** @hidden */ model: Record; /** @hidden */ listeners: Record>; /** @hidden */ private usedMessageIds; /** @hidden */ private widgetInstanceId; /** @hidden */ inSandbox: boolean | undefined; /** @hidden */ isNative: boolean | undefined; rootURL: string | undefined; /** @hidden */ mountDiv: HTMLElement | undefined; /** @hidden */ private widgetBodyResizeObserver; /** @hidden */ widgetOptions: WidgetOptions | undefined; /** Make sure to set the `id` property to a unique identifier for your plugin. * This is usually stored in the `manifest.json` which you can import and apply. * * For example: * ```typescript * import { id } from '../manifest.json'; * * class Plugin extends RNPlugin { * id = id; * } * ``` */ manifest: PluginManifest | undefined; id: string | undefined; /** @hidden */ private pluginLogger; /** @hidden */ private logApi; /** @hidden */ constructor(); /** @hidden */ private setDarkMode; /** @hidden */ setCustomCSS({ cssBlocks, cssUrls }: { cssBlocks: []; cssUrls: []; }): void; /** * The track function is similar to the `useTracker` hook, but it can also be used in outside of React components. * * The track function converts normal, non-reactive plugin API methods into reactive methods. "Reactive" means that the methods will be re-run in response to certain events. */ track(userFunc: (plugin: RNPlugin) => Promise): () => void; /** @hidden */ private loadManifest; /** @hidden */ receiveActivateMessage(args: { inSandbox: boolean; widgetOptions: WidgetOptions; widgetInstanceId: number; mountDiv: HTMLElement | undefined; rootURL: string; styleSheetHREFs: string[]; }): Promise; /** @hidden */ receiveDeactivateMessage(_args: {}): Promise; /** @hidden */ createMountDiv(): HTMLDivElement; /** @hidden */ abstract onActivate(mountDiv: HTMLElement | null, rootURL: string): void; /** @hidden */ abstract onDeactivate(): void; /** * Print messages to DevTools console. */ /** @hidden */ log(...args: any[]): void; /** @hidden */ protected _call(methodName: string, args: Record, namespace?: string | string[]): Promise; /** @hidden */ _receive(event: MessageEvent): Promise; /** @hidden */ private autoAdjustWidgetContainerDimension; /** @hidden */ createFakeEmbedComponent(args: { type: EmbedComponentType; id: string; top: number; left: number; width?: number | string; height?: number | string; maxHeight?: number | string; maxWidth?: number | string; externalProps: any; }): Promise; /** @hidden (should it be shown?) */ unmountFakeEmbedComponent(id: string): Promise; /** @hidden (should it be shown?) */ updateFakeEmbedComponentRect(id: string, args: { top?: number; left?: number; width?: number | string | null; height?: number | string | null; maxWidth?: number | string | null; maxHeight?: number | string | null; }): Promise; /** @hidden (should it be shown?) */ updateFakeEmbedExternalProps(id: string, externalProps: any): Promise; /** @hidden */ ping(): Promise; /** * View extensive documentation for this namespace [here](/api/classes/AppNamespace) */ app: AppNamespace; /** * View extensive documentation for this namespace [here](/api/classes/EditorNamespace) */ editor: EditorNamespace; /** * View extensive documentation for this namespace [here](/api/classes/EventNamespace) */ event: EventNamespace; /** * View extensive documentation for this namespace [here](/api/classes/MessagingNamespace) */ messaging: MessagingNamespace; /** * View extensive documentation for this namespace [here](/api/classes/FocusNamespace) */ focus: FocusNamespace; /** * View extensive documentation for this namespace [here](/api/classes/DateNamespace) */ date: DateNamespace; /** * View extensive documentation for this namespace [here](/api/classes/WidgetNamespace) */ widget: WidgetNamespace; /** * View extensive documentation for this namespace [here](/api/classes/WindowNamespace) */ window: WindowNamespace; /** * View extensive documentation for this namespace [here](/api/classes/PowerupNamespace) */ powerup: PowerupNamespace; /** * View extensive documentation for this namespace [here](/api/classes/RichTextNamespace) */ richText: RichTextNamespace; /** * View extensive documentation for this namespace [here](/api/classes/RemNamespace) */ rem: RemNamespace; /** * View extensive documentation for this namespace [here](/api/classes/CardNamespace) */ card: CardNamespace; /** * View extensive documentation for this namespace [here](/api/classes/StorageNamespace) */ storage: StorageNamespace; /** * View extensive documentation for this namespace [here](/api/classes/SettingsNamespace) */ settings: SettingsNamespace; /** * View extensive documentation for this namespace [here](/api/classes/SearchNamespace) */ search: SearchNamespace; /** * View extensive documentation for this namespace [here](/api/classes/KnowledgeBaseNamespace) */ kb: KnowledgeBaseNamespace; /** * View extensive documentation for this namespace [here](/api/classes/SchedulerNamespace) */ scheduler: SchedulerNamespace; /** * View extensive documentation for this namespace [here](/api/classes/QueueNamespace) */ queue: QueueNamespace; /** * View extensive documentation for this namespace [here](/api/classes/ReaderNamespace) */ reader: ReaderNamespace; }