Providers
@nsx/ngx-glint-models
provides a set of injection tokens that allow plugins to extend the core functionality of the
editor. By using these tokens, you can contribute new views, actions, and other features.
warning
When providing a new feature, you must use multi: true
to prevent your provider from overriding other existing
features. This ensures that all plugins can contribute their functionality without conflict.
Example:
import {PROJECT_FACET_PROVIDERS} from '@nsx/ngx-glint-models';
export class MyPluginBuilder {
// ...
async build(): Promise<PluginBuildResult> {
return {
providers: [
{
provide: ACTIONS,
useValue: getModelActions(),
multi: true // Required for all feature providers
}
]
};
}
}
The following table details the available injection tokens and their purposes:
Injection Token | Expected Type | Description | |
---|---|---|---|
PROJECT_VIEW | ProjectView[] | Provides a complete editor view layout for a specific element type. The view will be displayed when the element type and view name match the current selection. | Link |
PROJECT_FACET_PROVIDERS | ProjectFacetProvider | Contributes navigation options to the editor. This is the primary way to add custom navigation within a project view. | Link |
ACTIONS | ElementClassAction[] | Defines context menu actions for specific element types. These actions appear when a user interacts with a matching element, allowing for custom functionality. | Link |
ELEMENT_CLASS_COLOR | ElementClassColor[] | Associates a specific color with an element type. This is used to visually distinguish detail views for different element types. | Link |
TREE_COMPONENT | ModelComponent<TreeComponent>[] | Provides a Tree view representation for a specific element type. This is used in tree-like navigation and visualization components. | Link |
TREE_EXTENSION | ModelComponent<TreeComponent>[] | Provides a Tree view representation specifically as part of a Model Extension. This is useful for extending the visualization of an existing model. | Link |
DETAIL_COMPONENT | ModelComponent<DetailComponent>[] | Provides a detail view for a specific element type. This is typically displayed when an element is selected. | Link |
DIAGRAM | ModelComponent<DiagramComponent>[] | Provides a diagram view for a specific element type. These diagrams are used for visualizing relationships and structure. | Link |
DETAIL_LINK | ModelLink[] | Provides a link to a sub-type for a specific element type. This is particularly useful for abstract super-types that need to link to their concrete implementations. | Link |
COMMAND_PALETTE_PROVIDERS | CommandProviderService[] | Contributes command actions to the command dialog. The user can type commands to perform actions quickly. | Link |