@eclipse-glsp/client
Version:
A sprotty-based client for GLSP
67 lines • 4.42 kB
TypeScript
/********************************************************************************
* Copyright (c) 2021-2024 EclipseSource and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the Eclipse
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
* with the GNU Classpath Exception which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
import { BindingContext, ContainerConfiguration, FeatureModule, ViewerOptions } from '@eclipse-glsp/sprotty';
import { Container } from 'inversify';
import { IDiagramOptions } from './base/model/diagram-loader';
export declare const DEFAULT_MODULES: readonly [FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule, FeatureModule];
/**
* Wraps the {@link configureDiagramOptions} utility function in a module. Adopters can either include this
* module into the container {@link ModuleConfiguration} or configure the container after its creation
* (e.g. using the {@link configureDiagramOptions} utility function).
* @param diagramOptions The diagram instance specific configuration options
* @param viewerOptions Optional {@link ViewerOptions} that should be configured
* @returns The corresponding {@link FeatureModule}
*/
export declare function createDiagramOptionsModule(diagramOptions: IDiagramOptions, viewerOptions?: Partial<ViewerOptions>): FeatureModule;
/**
* Utility function to bind the diagram instance specific configuration options.
* In addition to binding the {@link IDiagramOptions} this function also overrides the
* {@link ViewerOptions} to match the given client id.
* @param context The binding context
* @param diagramOptions The {@link IDiagramOptions} that should be bound
* @param viewerOptions Optional {@link ViewerOptions} that should be configured
*/
export declare function configureDiagramOptions(context: BindingContext, diagramOptions: IDiagramOptions, viewerOptions?: Partial<ViewerOptions>): void;
/**
* Initializes a GLSP Diagram container with the GLSP default modules and the specified custom `modules`.
* Additional modules can be passed as direct arguments or as part of a {@link ModuleConfiguration}.
* ```typescript
* const container= createDiagramContainer(myModule1, myModule2)
* // or
* const container= createDiagramContainer({ add: [myModule1, myModule2]})
* ```
* Default modules can be excluded using {@link ModuleConfiguration}s.
* This means, you can still customize the default modules in two ways.
*
* First, you can exclude default modules and add a module with your custom code.
*
* ```typescript
* const container = createDiagramContainer({ add:myModelSourceWatcherModule, remove: modelSourceWatcherModule} );
* ```
*
* Second, you can unbind or rebind implementations that are originally bound in one of the default modules.
*
* ```typescript
* rebind(NavigationTargetResolver).to(MyNavigationTargetResolver);
* ```
* @param container The container that should be initialized
* @param containerConfigurations
* Custom modules to be loaded in addition to the default modules and/or default modules that should be excluded.
* @throws An error if the first module to load is not the `defaultModule` (or an equivalent custom replacement module)
* @returns The initialized container.
*/
export declare function initializeDiagramContainer(container: Container, ...containerConfigurations: ContainerConfiguration): Container;
//# sourceMappingURL=default-modules.d.ts.map