UNPKG

@kieler/klighd-core

Version:

Core KLighD diagram visualization with Sprotty

108 lines 4.21 kB
import { SGraphImpl } from 'sprotty'; import { Action, ExportSvgAction, ExportSvgOptions, FitToScreenAction, RequestAction, RequestExportSvgAction, ResponseAction } from 'sprotty-protocol'; import { SKGraphModelRenderer } from '../skgraph-model-renderer'; import { KImage } from '../skgraph-models'; /** * Sent from the server to the client to store images in base64 format needed for rendering on the client. * * @author nre */ export interface StoreImagesAction extends Action { kind: typeof StoreImagesAction.KIND; images: Pair<Pair<string, string>, string>[]; } export declare namespace StoreImagesAction { const KIND = "storeImages"; function create(images: Pair<Pair<string, string>, string>[]): StoreImagesAction; } /** * A key-value pair matching the interface of org.eclipse.xtext.xbase.lib.Pair */ export interface Pair<K, V> { k: K; v: V; } /** * Sent from the server to the client to check if the {@link KImage}s provided in the message are cached or if they need * to be sent to the client again. */ export interface CheckImagesAction extends RequestAction<CheckedImagesAction> { kind: typeof CheckImagesAction.KIND; images: KImage[]; } export declare namespace CheckImagesAction { const KIND = "checkImages"; function create(images: KImage[], requestId?: string): CheckImagesAction; } /** * Sent from the client to the server to inform it whether images need to be sent to the client before accepting the next diagram. */ export interface CheckedImagesAction extends ResponseAction { kind: typeof CheckedImagesAction.KIND; notCached: Pair<string, string>[]; } export declare namespace CheckedImagesAction { const KIND = "checkedImages"; function create(notCached: Pair<string, string>[], responseId?: string): CheckedImagesAction; } /** * Sent from the client to the diagram server to perform a klighd action on the model. * Causes the server to update the diagram accordingly to the action. */ export interface PerformActionAction extends Action { kind: typeof PerformActionAction.KIND; actionId: string; kGraphElementId: string; kRenderingId: string; revision?: number; } export declare namespace PerformActionAction { const KIND = "performAction"; function create(actionId: string, kGraphElementId: string, kRenderingId: string, revision?: number): PerformActionAction; } /** * A sprotty action to refresh the layout. Send from client to server. */ export interface RefreshLayoutAction extends Action { kind: typeof RefreshLayoutAction.KIND; } export declare namespace RefreshLayoutAction { const KIND = "refreshLayout"; function create(): RefreshLayoutAction; } /** * Extended {@link FitToScreenAction} that always fits the root element with a padding * of 10px. Most of the time this is the wanted behavior in the `klighd-core`. */ export type KlighdFitToScreenAction = FitToScreenAction; export declare namespace KlighdFitToScreenAction { function create(animate?: boolean): FitToScreenAction; } /** Contains the model and RenderingContext to be sent from the view to where it's needed. */ export interface SendModelContextAction extends Action { kind: typeof SendModelContextAction.KIND; model: SGraphImpl; context: SKGraphModelRenderer; } export declare namespace SendModelContextAction { const KIND = "sendModelContextAction"; function create(model: SGraphImpl, context: SKGraphModelRenderer): SendModelContextAction; } /** * Extended {@link RequestExportSvgAction} to create a request action of a {@link KlighdExportSvgAction}. */ export type KlighdRequestExportSvgAction = RequestExportSvgAction; export declare namespace KlighdRequestExportSvgAction { function create(options?: ExportSvgOptions): KlighdRequestExportSvgAction; } /** * Extended {@link ExportSvgAction} by a uri for a better name of the saved diagram. */ export interface KlighdExportSvgAction extends ExportSvgAction { uri: string; } export declare namespace KlighdExportSvgAction { const KIND = "exportSvg"; function create(svg: string, requestId: string, uri: string, options?: ExportSvgOptions): KlighdExportSvgAction; } //# sourceMappingURL=actions.d.ts.map