import React from 'react'; import { type ThemeData } from '@deephaven/components'; import { type PluginModule, type PluginModuleMap, type ElementMap, type WidgetMiddlewarePlugin, type WidgetMiddlewareComponentProps, type WidgetMiddlewarePanelProps, type WidgetComponentProps, type WidgetPanelProps, type LegacyPlugin, type Plugin, type WidgetDashboardPlugin } from './PluginTypes'; export declare function pluginSupportsType(plugin: PluginModule | undefined, type: string): boolean; /** * Check if the given plugin supports opening a widget of the given type as a dashboard. * @param plugin Plugin to check * @param type Widget type * @returns True if plugin supports opening it as a dashboard */ export declare function pluginSupportsTypeAsDashboard(plugin: PluginModule | undefined, type: string): boolean; export declare function getIconForPlugin(plugin: PluginModule): React.ReactElement; /** * Extract theme data from theme plugins in the given plugin map. * @param pluginMap */ export declare function getThemeDataFromPlugins(pluginMap: PluginModuleMap): ThemeData[]; /** * Get a mapping of element names to their React components from the given plugin map. * @param pluginMap The plugin map to extract element plugins from. * @returns A Map of element names to their React components. */ export declare function getPluginsElementMap(pluginMap: PluginModuleMap): ElementMap; /** * Creates a component that chains middleware around a base component. * Each middleware wraps the next, with the base component at the innermost layer. */ export declare function createChainedComponent(baseComponent: React.ComponentType>, middleware: WidgetMiddlewarePlugin[]): React.ComponentType>; /** * Creates a panel component that chains middleware around a base panel component. * Each middleware panel wraps the next, with the base panel at the innermost layer. * * The chain forwards the `ref` injected by golden-layout (on the registered * panel) all the way down to `basePanelComponent`. Golden-layout uses that ref * to bind a class panel's React state into its serialized `componentState`; * forwarding it keeps that persistence working through transparent middleware, * so wrapped panels still restore sorts/filters/column moves on reload. */ export declare function createChainedPanelComponent(basePanelComponent: React.ComponentType>, middleware: WidgetMiddlewarePlugin[]): React.ComponentType>; /** * What a middleware body hook returns. Both fields are optional: * * - `inject`: extra props merged onto the wrapped `Component`, threaded down * the middleware chain. Use it to forward IrisGrid-aware props (e.g. * `transformModel`, `transformTableOptions`, `onModelChanged`) without * hand-writing the widening cast on `Component`. * - `wrap`: an optional wrapper placed *around* the wrapped component (e.g. a * context provider). Receives the already-rendered child element and must * return an element that renders it. */ export interface MiddlewareBodyResult { inject?: Record; wrap?: (child: React.ReactElement) => React.ReactElement; } /** * A hook implementing the body of a middleware. Receives the incoming props * (without `Component`) and returns an optional set of props to inject plus an * optional wrapper. The same body hook can back both a panel and a widget * middleware (see {@link createPanelMiddleware} / {@link createWidgetMiddleware}), * so a plugin expresses its behavior once. * * Type the `props` parameter as wide as the middleware needs (e.g. intersect * with `IrisGridTableOptionsWidgetProps`) — the factory passes the runtime * props through unchanged. */ export type MiddlewareBody

= (props: P) => MiddlewareBodyResult; /** * Builds a panel-path middleware component from a single body hook, owning the * `React.forwardRef` ceremony and ref forwarding that golden-layout state * persistence depends on. * * The returned component is ref-capable and always forwards its `ref` to the * wrapped `Component`, so a middleware author can never accidentally drop it * (which would silently break `componentState` persistence — sorts, filters, * column moves — on reload). The body hook only decides what to inject and how * to wrap; it never sees the ref. */ export declare function createPanelMiddleware = WidgetPanelProps>(useBody: MiddlewareBody

, displayName?: string): React.ForwardRefExoticComponent & React.RefAttributes>; /** * Builds a widget-path middleware component from a single body hook. The widget * path takes no ref, so this is a plain function component; otherwise it mirrors * {@link createPanelMiddleware} (same `inject` / `wrap` contract), letting a * plugin reuse one body hook for both paths. */ export declare function createWidgetMiddleware = WidgetComponentProps>(useBody: MiddlewareBody

, displayName?: string): React.ComponentType>; export type PluginManifestPluginInfo = { name: string; main: string; version: string; /** * Optional loader namespace, copied verbatim from the plugin package's * `package.json` "loader" field by the manifest packing script. It is kept * as a nested object so plugin authors cannot shadow core manifest fields * like name/version/main. */ loader?: { /** * The npm package name for this plugin (e.g. `@deephaven/js-plugin-pivot`). * When provided, the plugin's exports are registered in the module resolve * map under this key, making this plugin importable by other plugins at * runtime. If omitted, the plugin is not available for cross-plugin * imports. */ package?: string; /** * Package names this plugin depends on at runtime. These must match the * `package` field of other plugins in the manifest. Plugins are * topologically sorted so that dependencies are loaded first. If omitted, * the plugin has no cross-plugin dependencies. */ dependencies?: string[]; }; }; export type PluginManifest = { plugins: PluginManifestPluginInfo[]; }; /** * Get the PluginModule value from a loaded module export. Handles: * - Direct Plugin exports (`export default myPlugin`) * - Named default exports (`{ default: myPlugin, ...namedExports }`) * - Legacy plugin formats (`{ DashboardPlugin, AuthPlugin, TablePlugin }`) * * TypeScript builds CJS default exports differently depending on whether * there are also named exports. If the default is the only export, it will * be the value. If there are also named exports, it will be assigned to * the `default` property on the value. */ export declare function getPluginModuleValue(value: LegacyPlugin | Plugin | { default: Plugin; }): PluginModule | null; /** * Register a plugin in the plugin map. If a plugin with the same name is * already registered, the duplicate is skipped and a warning is logged. * @param pluginMap The plugin map to register the plugin in * @param name The name to register the plugin under * @param plugin The plugin to register * @param version Optional version to attach to the plugin */ export declare function registerPlugin(pluginMap: PluginModuleMap, name: string, plugin: PluginModule, version?: string): void; /** * Process a loaded plugin module: extract the plugin value, register in the * resolve map for cross-plugin imports, flatten MultiPlugins, and register * each resulting plugin in the plugin map. * * @param pluginMap The plugin map to register plugins in * @param resolveMap The module resolve map for cross-plugin imports * @param pluginExports The raw module exports from loading the plugin * @param name The manifest name of the plugin * @param packageName Optional package name for resolve map registration * @param version Optional version to attach to registered plugins */ export declare function processLoadedModule(pluginMap: PluginModuleMap, resolveMap: Record, pluginExports: unknown, name: string, packageName?: string | null, version?: string): void; /** * Group plugins into dependency levels for parallel loading. Plugins in the * same level have no dependencies on each other and can be loaded concurrently. * Each level's dependencies are fully contained in earlier levels. * * Handles cycles gracefully by placing remaining plugins into a final level * and logging an error. * * @param plugins The plugin list from the manifest * @returns An array of levels, where each level is an array of plugins */ export declare function groupByDependencyLevel>(plugins: readonly T[]): T[][]; /** * Get the WidgetPlugin that supports opening a widget of the given type as a dashboard. * @param pluginMap Map of available plugins * @param type Type of widget to check * @returns The WidgetPlugin that supports opening this widget as a dashboard, or null if no matching plugin is found */ export declare function getWidgetDashboardPlugin(pluginMap: PluginModuleMap, type: string): WidgetDashboardPlugin | null; //# sourceMappingURL=PluginUtils.d.ts.map