@kieler/klighd-core
Version:
Core KLighD diagram visualization with Sprotty
191 lines • 5.79 kB
TypeScript
import { FeatherIconNames } from 'feather-icons';
import { Action } from 'sprotty-protocol';
/** Base option. */
export interface Option {
id: string;
name: string;
type: TransformationOptionType;
initialValue: any;
currentValue: any;
description?: string;
/** The values this RenderOption has, if it's type is {@link TransformationOptionType.CHOICE}. */
values?: any[];
}
/** Option that is rendered as a UI input. */
export interface RenderOption extends Option {
/** The category this RenderOption is part of. */
renderCategory?: string;
/** Whether the option should be shown in the sidebar when debug options are enabled. Default undefined is false. */
debug?: boolean;
}
/** Type for available quick actions. */
export type PossibleQuickAction = 'center' | 'fit' | 'layout' | 'refresh' | 'export' | 'create-bookmark' | 'pin-sidebar';
export interface QuickActionOption {
key: PossibleQuickAction;
title: string;
/** Icon id of a feather icon. */
iconId: FeatherIconNames;
/** Action to be executed on click. */
action: Action | undefined;
/** If the quick action button should be marked as clicked. */
state?: boolean;
/**
* An additional effect which does not have to be an action to be executed
* on click before executing the action.
*/
effect?: () => void;
}
export interface Preference extends RenderOption {
notifyServer: boolean;
}
/**
* The different types a SynthesisOption can have.
*/
export declare enum TransformationOptionType {
CHECK = 0,
CHOICE = 1,
RANGE = 2,
TEXT = 3,
SEPARATOR = 4,
CATEGORY = 5
}
/**
* Holds an option defined by the diagram synthesis.
* This is the counterpart to the KLighD's java implementation of the SynthesisOption.
* Also adds a sourceHash that contains the hash code of the corresponding java instance for this option.
*/
export interface SynthesisOption extends Option {
values: any[];
category?: SynthesisOption;
}
/**
* This is just a SynthesisOption with the ability to represent its current value.
*/
export interface ValuedSynthesisOption {
synthesisOption: SynthesisOption;
currentValue: any;
}
/**
* A SynthesisOption with the RANGE type.
*/
export interface RangeOption extends SynthesisOption {
range: Range;
stepSize: number;
}
/**
* A value range between a first and second value.
*/
export interface Range {
first: number;
second: number;
}
/**
* Data class to hold the result of a keith/diagramOptions/getOptions message.
* Includes a list of the synthesisOptions with their current value, a list of the layout options and a list of the
* actions performable for the current diagram.
*/
export interface GetOptionsResult {
/**
* The list of all displayed synthesis options for the diagram for the given URI.
*/
valuedSynthesisOptions: ValuedSynthesisOption[];
/**
* The list of all displayed layout options for the diagram for the given URI.
*/
layoutOptions: LayoutOptionUIData[];
/**
* The list of all displayed actions for the diagram for the given URI.
*/
actions: DisplayedActionData[];
}
export interface LayoutOptionUIData {
/** identifier of the layout option. */
optionId: string;
/** the default value of this option. */
defaultValue: Pair<any, string>;
/** type of the layout option. */
type: Type;
/** user friendly name of the layout option. */
name: string;
/** a description to be displayed in the UI. */
description: string;
/** cached value of the available choices. */
choices: string[];
/** the minimal value for the option, or {@code undefined} */
minValue: number;
/** the maximal value for the option, or {@code undefined} */
maxValue: number;
/** the set of values to offer, or {@code undefined} */
availableValues: Pair<any[], string[]>;
/** The current value of this option, if necessary */
currentValue: any;
}
export interface LayoutOptionValue {
/**
* Identifier of the layout option.
*/
optionId: string;
/**
* The new value of this option.
*/
value: any;
}
export interface PreferenceValue {
id: string;
value: any;
}
/**
* A key-value pair matching the interface of org.eclipse.xtext.xbase.lib.Pair
*/
export interface Pair<K, V> {
k: K;
v: V;
}
/**
* Enumeration of data types for layout options.
* From java class org.eclipse.elk.core.data.Type
*/
export declare enum Type {
/** undefined type. */
UNDEFINED = 0,
/** boolean type. */
BOOLEAN = 1,
/** integer type. */
INT = 2,
/** string type. */
STRING = 3,
/** double type. */
DOUBLE = 4,
/** enumeration type. */
ENUM = 5,
/** enumeration set type. */
ENUMSET = 6,
/** {@link IDataObject} type. */
OBJECT = 7
}
/**
* From java class org.eclipse.elk.graph.properties.IProperty:
* Interface for property identifiers. Properties have a type and a default value, and
* they have an internal mechanism for identification, which should be compatible
* with their {@link java.lang.Object#equals(Object)} and {@link java.lang.Object#hashCode()}
* implementations.
*
* @param <T> type of the property
*/
export interface IProperty<T> {
default: T;
id: string;
lowerBound: any;
upperBound: any;
}
/**
* From java class de.cau.cs.kieler.klighd.DisplayedActionData:
* A concise helper record class accommodating the required information for
* {@link de.cau.cs.kieler.klighd.IAction IAction}'s offered in the UI's side bar.
*/
export interface DisplayedActionData {
actionId: string;
displayedName: string;
tooltipText: string;
}
//# sourceMappingURL=option-models.d.ts.map