diff --git a/packages/klighd-core/package.json b/packages/klighd-core/package.json index 6abb4798..8b420388 100644 --- a/packages/klighd-core/package.json +++ b/packages/klighd-core/package.json @@ -26,11 +26,13 @@ "dependencies": { "@kieler/klighd-interactive": "^0.5.0", "@types/file-saver": "^2.0.7", + "elkjs": "^0.8.2", "feather-icons": "^4.29.1", "file-saver": "^2.0.5", "inversify": "^6.0.2", "snabbdom": "^3.5.1", "sprotty": "^1.3.0", + "sprotty-elk": "^1.3.0", "sprotty-protocol": "^1.3.0" }, "devDependencies": { diff --git a/packages/klighd-core/src/di.config.ts b/packages/klighd-core/src/di.config.ts index f31ccb7e..3de3d0d7 100644 --- a/packages/klighd-core/src/di.config.ts +++ b/packages/klighd-core/src/di.config.ts @@ -16,8 +16,10 @@ */ import { interactiveModule } from '@kieler/klighd-interactive/lib/interactive-module' +import ElkConstructor from 'elkjs/lib/elk.bundled' import { Container, ContainerModule, interfaces } from 'inversify' import { + boundsModule, configureActionHandler, configureModelElement, ConsoleLogger, @@ -44,6 +46,7 @@ import { viewportModule, ViewRegistry, } from 'sprotty' +import { ElkFactory, ElkLayoutEngine, elkLayoutModule, ILayoutConfigurator } from 'sprotty-elk' import actionModule from './actions/actions-module' // import bookmarkModule from './bookmarks/bookmark-module'; import { DISymbol } from './di.symbols' @@ -53,6 +56,7 @@ import { KlighdHoverMouseListener } from './hover/hover' import { PopupModelProvider } from './hover/popup-provider' import { KlighdMouseTool } from './klighd-mouse-tool' import { KlighdSvgExporter } from './klighd-svg-exporter' +import { KielerLayoutConfigurator } from './layout-config' import { KlighdModelViewer } from './model-viewer' import { ResetPreferencesAction, SetPreferencesAction } from './options/actions' import { optionsModule } from './options/options-module' @@ -74,6 +78,16 @@ const kGraphDiagramModule = new ContainerModule( bind(TYPES.ModelSource).to(KlighdDiagramServer).inSingletonScope() rebind(TYPES.ILogger).to(ConsoleLogger).inSingletonScope() rebind(TYPES.LogLevel).toConstantValue(LogLevel.warn) + + // required binding for elkjs to work + bind(TYPES.IModelLayoutEngine).toService(ElkLayoutEngine) + + // Our own layout configurator that just copies the element's poperties as the layout options. + bind(KielerLayoutConfigurator).toSelf().inSingletonScope() + rebind(ILayoutConfigurator).to(KielerLayoutConfigurator).inSingletonScope() + const elkFactory: ElkFactory = () => new ElkConstructor({ algorithms: ['layered'] }) // See elkjs documentation + bind(ElkFactory).toConstantValue(elkFactory) + rebind(TYPES.CommandStackOptions).toConstantValue({ // Override the default animation speed to be 500 ms, as the default value is too quick. defaultDuration: 500, @@ -126,6 +140,8 @@ export default function createContainer(widgetId: string): Container { const container = new Container() container.load( defaultModule, + boundsModule, + elkLayoutModule, selectModule, interactiveModule, viewportModule, @@ -144,8 +160,9 @@ export default function createContainer(widgetId: string): Container { ) // FIXME: bookmarkModule is currently broken due to wrong usage of Sprotty commands. action handling needs to be reimplemented for this to work. overrideViewerOptions(container, { - needsClientLayout: false, - needsServerLayout: true, + // These are ignored ignored and overwritten by the current needsClientLayout preference during model request. + needsClientLayout: false, // client layout = micro layout (Sprotty/Sprotty+KLighD) + needsServerLayout: true, // server layout = macro layout (ELK/elkjs). false here to not forward it to the Java server (the model source), but keep and handle it directly on the diagram server proxy manually baseDiv: widgetId, hiddenDiv: `${widgetId}_hidden`, // TODO: We should be able to completely deactivate Sprotty's zoom limits to not limit top down layout. diff --git a/packages/klighd-core/src/diagram-server.ts b/packages/klighd-core/src/diagram-server.ts index dbf682dd..78c6325f 100644 --- a/packages/klighd-core/src/diagram-server.ts +++ b/packages/klighd-core/src/diagram-server.ts @@ -48,13 +48,18 @@ import { import { Action, ActionMessage, + ComputedBoundsAction, BringToFrontAction, findElement, generateRequestId, + IModelLayoutEngine, + RequestModelAction, GetViewportAction, RequestPopupModelAction, SelectAction, + SetModelAction, SetPopupModelAction, + SModelRoot, UpdateModelAction, ViewportResult, } from 'sprotty-protocol' @@ -79,7 +84,7 @@ import { import { RequestKlighdPopupModelAction } from './hover/hover' import { PopupModelProvider } from './hover/popup-provider' import { RenderOptionsRegistry, ResizeToFit } from './options/render-options-registry' -import { IncrementalDiagramGeneratorOption, PreferencesRegistry } from './preferences-registry' +import { ClientLayoutOption, IncrementalDiagramGeneratorOption, PreferencesRegistry } from './preferences-registry' import { Connection, ServiceTypes, SessionStorage } from './services' import { SetSynthesisAction } from './syntheses/actions' import { UpdateDepthMapModelAction } from './update/update-depthmap-model' @@ -106,6 +111,8 @@ export class KlighdDiagramServer extends DiagramServerProxy { @inject(DISymbol.BookmarkRegistry) @optional() private bookmarkRegistry: BookmarkRegistry + @inject(TYPES.IModelLayoutEngine) @optional() protected layoutEngine?: IModelLayoutEngine + constructor(@inject(ServiceTypes.Connection) connection: Connection) { super() this._connection = connection @@ -301,6 +308,53 @@ export class KlighdDiagramServer extends DiagramServerProxy { return false } + // Super class behavior, except taking the needsClientLayout preference into account instead of the client option. + override handleRequestModel(action: RequestModelAction): boolean { + const needsClientLayout = !!this.preferencesRegistry.getValue(ClientLayoutOption) + const needsServerLayout = !needsClientLayout + + const newOptions = { + needsClientLayout, + needsServerLayout, + ...action.options, + } + const newAction = { + ...action, + options: newOptions, + } + this.forwardToServer(newAction) + return false + } + + // Behavior adapted from the super class and modified to the behavior of the DiagramServer to allow this proxy to the Java diagram server to still be able to perform the layout locally. + handleComputedBounds(action: ComputedBoundsAction): boolean { + if (!this.preferencesRegistry.getValue(ClientLayoutOption)) { + return false + } + const root = this.currentRoot + this.computedBoundsApplicator.apply(root, action) + this.doSubmitModel(root, root.type === this.lastSubmittedModelType, action) + return false + } + + // Behavior taken from the DiagramServer to allow this proxy to the Java diagram server to still be able to perform the layout locally. + private async doSubmitModel(newRoot: SModelRoot, update: boolean, cause?: Action): Promise { + if (this.layoutEngine) { + newRoot = await this.layoutEngine.layout(newRoot) + } + const modelType = newRoot.type + if (cause && cause.kind === RequestModelAction.KIND) { + const { requestId } = cause as RequestModelAction + const response = SetModelAction.create(newRoot, requestId) + this.actionDispatcher.dispatch(response) + } else if (update && modelType === this.lastSubmittedModelType) { + this.actionDispatcher.dispatch(UpdateModelAction.create(newRoot)) + } else { + this.actionDispatcher.dispatch(SetModelAction.create(newRoot)) + } + this.lastSubmittedModelType = modelType + } + handleRequestDiagramPiece(action: RequestDiagramPieceAction): void { this.forwardToServer(action) } diff --git a/packages/klighd-core/src/layout-config.ts b/packages/klighd-core/src/layout-config.ts new file mode 100644 index 00000000..92b29dbb --- /dev/null +++ b/packages/klighd-core/src/layout-config.ts @@ -0,0 +1,41 @@ +/* + * KIELER - Kiel Integrated Environment for Layout Eclipse RichClient + * + * http://rtsys.informatik.uni-kiel.de/kieler + * + * Copyright 2024 by + * + Kiel University + * + Department of Computer Science + * + Real-Time and Embedded Systems Group + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + */ + +import { LayoutOptions } from 'elkjs' +import { DefaultLayoutConfigurator } from 'sprotty-elk' +import { SModelElement, SModelIndex } from 'sprotty-protocol' + +/** + * This layout configurator copies all layout options from the KGraph element's properties. + */ +export class KielerLayoutConfigurator extends DefaultLayoutConfigurator { + override apply(element: SModelElement, _index: SModelIndex): LayoutOptions | undefined { + // Only apply to elements with properties. + if ((element as any).properties === undefined) { + return undefined + } + const properties = (element as any).properties as Record + + // map properties to layout options and stringify values + const layoutOptions: LayoutOptions = {} + Object.entries(properties).forEach(([key, value]) => { + layoutOptions[key] = JSON.stringify(value) + }) + + return layoutOptions + } +} diff --git a/packages/klighd-core/src/options/general-panel.tsx b/packages/klighd-core/src/options/general-panel.tsx index 6372dbea..89112042 100644 --- a/packages/klighd-core/src/options/general-panel.tsx +++ b/packages/klighd-core/src/options/general-panel.tsx @@ -19,9 +19,11 @@ import { inject, injectable, postConstruct } from 'inversify' import { VNode } from 'snabbdom' import { html } from 'sprotty' // eslint-disable-line @typescript-eslint/no-unused-vars +import { RefreshDiagramAction } from '@kieler/klighd-interactive/lib/actions' import { DISymbol } from '../di.symbols' import { FeatherIcon } from '../feather-icons-snabbdom/feather-icons-snabbdom' import { + ClientLayoutOption, IncrementalDiagramGeneratorOption, PreferencesRegistry, ShouldSelectDiagramOption, @@ -123,6 +125,16 @@ export class GeneralPanel extends SidebarPanel { ) : ( '' )} + {(this.renderOptionsRegistry.getValue(DebugOptions) as boolean) ? ( + + ) : ( + '' + )} ) @@ -134,6 +146,14 @@ export class GeneralPanel extends SidebarPanel { private handlePreferenceChange(key: string, newValue: any) { this.actionDispatcher.dispatch(SetPreferencesAction.create([{ id: key, value: newValue }])) + if (key === ClientLayoutOption.ID) { + this.actionDispatcher.dispatch( + RefreshDiagramAction.create({ + needsClientLayout: newValue, + needsServerLayout: !newValue, + }) + ) + } } get icon(): VNode { diff --git a/packages/klighd-core/src/options/render-options-registry.ts b/packages/klighd-core/src/options/render-options-registry.ts index 07d7fdc9..77c6f3d2 100644 --- a/packages/klighd-core/src/options/render-options-registry.ts +++ b/packages/klighd-core/src/options/render-options-registry.ts @@ -3,7 +3,7 @@ * * http://rtsys.informatik.uni-kiel.de/kieler * - * Copyright 2021-2022 by + * Copyright 2021-2024 by * + Kiel University * + Department of Computer Science * + Real-Time and Embedded Systems Group @@ -509,8 +509,6 @@ export class DebugOptions implements RenderOption { readonly description = 'Whether debug options should be shown.' currentValue = false - - debug = true } export interface RenderOptionType { diff --git a/packages/klighd-core/src/preferences-registry.ts b/packages/klighd-core/src/preferences-registry.ts index 5201bba4..887ccdb6 100644 --- a/packages/klighd-core/src/preferences-registry.ts +++ b/packages/klighd-core/src/preferences-registry.ts @@ -3,7 +3,7 @@ * * http://rtsys.informatik.uni-kiel.de/kieler * - * Copyright 2021 by + * Copyright 2021-2024 by * + Kiel University * + Department of Computer Science * + Real-Time and Embedded Systems Group @@ -87,6 +87,31 @@ export class IncrementalDiagramGeneratorOption implements Preference { debug = true } +/** + * Switch between client-only and server-only layout. + */ +export class ClientLayoutOption implements Preference { + static readonly ID: string = 'diagram.clientLayout' + + static readonly NAME: string = 'Client Layout' + + readonly description: string | undefined = 'Switch between client-only and server-only layout.' + + readonly id: string = ClientLayoutOption.ID + + readonly name: string = ClientLayoutOption.NAME + + readonly type: TransformationOptionType = TransformationOptionType.CHECK + + readonly initialValue: boolean = false + + currentValue = false + + notifyServer = true + + debug = true +} + export interface PreferenceType { readonly ID: string readonly NAME: string @@ -116,6 +141,7 @@ export class PreferencesRegistry extends Registry { this.register(ShouldSelectDiagramOption) this.register(ShouldSelectTextOption) this.register(IncrementalDiagramGeneratorOption) + this.register(ClientLayoutOption) } @postConstruct() @@ -184,6 +210,7 @@ export class PreferencesRegistry extends Registry { 'diagram.shouldSelectDiagram': this.getValue(ShouldSelectDiagramOption), 'diagram.shouldSelectText': this.getValue(ShouldSelectTextOption), 'diagram.incrementalDiagramGenerator': this.getValue(IncrementalDiagramGeneratorOption), + 'diagram.clientLayout': this.getValue(ClientLayoutOption), } this.connection.sendNotification(NotificationType.SetPreferences, obj) }) diff --git a/packages/klighd-core/src/skgraph-models.ts b/packages/klighd-core/src/skgraph-models.ts index 91dfb0ff..4a52511a 100644 --- a/packages/klighd-core/src/skgraph-models.ts +++ b/packages/klighd-core/src/skgraph-models.ts @@ -18,6 +18,7 @@ import { KEdge, KGraphData, KNode, SKGraphElement } from '@kieler/klighd-interactive/lib/constraint-classes' import { boundsFeature, + layoutContainerFeature, moveFeature, popupFeature, RectangularPort, @@ -40,6 +41,8 @@ export class SKNode extends KNode { hasFeature(feature: symbol): boolean { return ( feature === selectFeature || + feature === boundsFeature || + feature === layoutContainerFeature || (feature === moveFeature && (this.parent as SKNode).properties && ((this.parent as SKNode).properties['org.eclipse.elk.interactiveLayout'] as boolean)) || @@ -61,7 +64,7 @@ export class SKPort extends RectangularPort implements SKGraphElement { areNonChildAreaChildrenRendered = false hasFeature(feature: symbol): boolean { - return feature === selectFeature || feature === popupFeature + return feature === selectFeature || feature === boundsFeature || feature === popupFeature } properties: Record diff --git a/packages/klighd-core/src/views-common.ts b/packages/klighd-core/src/views-common.ts index e03482aa..cebaf61b 100644 --- a/packages/klighd-core/src/views-common.ts +++ b/packages/klighd-core/src/views-common.ts @@ -3,7 +3,7 @@ * * http://rtsys.informatik.uni-kiel.de/kieler * - * Copyright 2019-2023 by + * Copyright 2019-2024 by * + Kiel University * + Department of Computer Science * + Real-Time and Embedded Systems Group @@ -420,14 +420,14 @@ export function findBoundsAndTransformationData( } } } - // Error check: If there are no bounds or decoration, at least try to fall back to possible size and position attributes in the parent element. + // Error check: If there are no bounds or decoration, at least try to fall back to possible position attributes in the parent element. // If the parent element has no bounds either, the object can not be rendered. - if (decoration === undefined && bounds === undefined && 'size' in parent && 'position' in parent) { + if (decoration === undefined && bounds === undefined && 'bounds' in parent) { bounds = { - x: (parent as any).position.x, - y: (parent as any).position.y, - width: (parent as any).size.width, - height: (parent as any).size.height, + x: 0, + y: 0, + width: (parent as any).bounds.width, + height: (parent as any).bounds.height, } } else if (decoration === undefined && bounds === undefined) { return undefined @@ -573,16 +573,33 @@ export function findTextBoundsAndTransformationData( bounds.height = decoration.bounds.height } } - // Error check: If there are no bounds or decoration, at least try to fall back to possible size and position attributes in the parent element. - // If the parent element has no bounds either, the object can not be rendered. - if (decoration === undefined && bounds.x === undefined && 'size' in parent && 'position' in parent) { - bounds.x = (parent as any).position.x - bounds.y = (parent as any).position.y - bounds.width = (parent as any).size.width - bounds.height = (parent as any).size.height - } else if (decoration === undefined && bounds.x === undefined) { - return undefined - } + } + // Error check: If there are no bounds or decoration, at least try to fall back to possible size attributes in the parent element. + // If the parent element has no bounds either, the object can not be rendered. + if (decoration === undefined && bounds.x === undefined && 'bounds' in parent) { + const parentBounds = { + x: 0, + y: 0, + width: (parent as any).bounds.width, + height: (parent as any).bounds.height, + } + + bounds.x = calculateX( + parentBounds.x, + parentBounds.width, + styles.kHorizontalAlignment ?? DEFAULT_K_HORIZONTAL_ALIGNMENT, + parentBounds.width + ) + bounds.y = calculateY( + parentBounds.y, + parentBounds.height, + styles.kVerticalAlignment ?? DEFAULT_K_VERTICAL_ALIGNMENT, + lines + ) + bounds.width = parent.bounds.width + bounds.height = parent.bounds.height + } else if (decoration === undefined && bounds.x === undefined) { + return undefined } // If still no bounds are found, set all by default to 0. diff --git a/packages/klighd-interactive/src/actions.ts b/packages/klighd-interactive/src/actions.ts index c482d346..f3c1c48f 100644 --- a/packages/klighd-interactive/src/actions.ts +++ b/packages/klighd-interactive/src/actions.ts @@ -3,7 +3,7 @@ * * http://rtsys.informatik.uni-kiel.de/kieler * - * Copyright 2020-2021 by + * Copyright 2020-2024 by * + Kiel University * + Department of Computer Science * + Real-Time and Embedded Systems Group @@ -17,7 +17,7 @@ // We follow Sprotty's way of redeclaring the interface and its create function, so disable this lint check for this file. /* eslint-disable no-redeclare */ -import { Action } from 'sprotty-protocol' +import { Action, JsonMap } from 'sprotty-protocol' import { DeleteConstraint } from './layered/constraint-types' /** @@ -25,14 +25,16 @@ import { DeleteConstraint } from './layered/constraint-types' */ export interface RefreshDiagramAction extends Action { kind: typeof RefreshDiagramAction.KIND + options?: JsonMap } export namespace RefreshDiagramAction { export const KIND = 'refreshDiagram' - export function create(): RefreshDiagramAction { + export function create(options?: JsonMap): RefreshDiagramAction { return { kind: KIND, + options, } } } diff --git a/schema/klighd/SKGraphSchema.json b/schema/klighd/SKGraphSchema.json new file mode 100644 index 00000000..fb86effc --- /dev/null +++ b/schema/klighd/SKGraphSchema.json @@ -0,0 +1,336 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/SKGraphSchema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "SKElement", + "type": "object", + "required": ["data", "properties", "type"], + "properties": { + "data": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/KGraphData" + } + ], + "default": [] + }, + "properties": { + "type": "object", + "default": {} + }, + "type": { + "type": "string" + } + }, + "definitions": { + "SModelElement": { + "type": "object", + "required": ["type", "id", "children"], + "properties": { + "type": { + "type": "string" + }, + "id": { + "type": "string" + }, + "children": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/SModelElement" + } + ], + "default": [] + }, + "trace": { + "type": "string" + } + } + }, + "SShapeElement": { + "allOf": [{"$ref": "#/definitions/SModelElement"}], + "required": ["size"], + "properties": { + "size": { + "type": "object", + "properties": { + "width": { + "type": "number" + }, + "height": { + "type": "number" + } + }, + "default": { "width": 0.0, "height": 0.0 } + }, + "position": { + "type": "object", + "properties": { + "x": { + "type": "number" + }, + "y": { + "type": "number" + } + }, + "default": { "x": 0.0, "y": 0.0 } + } + } + + }, + "SKGraph": { + "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SModelElement"}], + "required": ["type", "revision"], + "properties": { + "type": { + "type": "string", + "default": "graph" + }, + "revision": { + "type": "number" + }, + "children": { + "type": "array", + "required": ["items"], + "items": [ + { + "$ref": "#/definitions/SModelElement" + } + ], + "default": [], + "minItems": 1, + "maxItems": 1 + } + } + }, + "SKNode": { + "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SShapeElement"}], + "required": ["type"], + "properties": { + "type": { + "type": "string", + "default": "node" + } + } + }, + "SKLabel": { + "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SModelElement"}], + "required": ["type", "text"], + "properties": { + "text": { + "type": "string" + }, + "type": { + "type": "string", + "default": "label" + } + } + }, + "SKEdge": { + "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SModelElement"}], + "required": ["type", "sourceId", "targetId"], + "properties": { + "sourceId": { + "type": "string" + }, + "targetId": { + "type": "string" + }, + "junctionPoints": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "x": { + "type": "number" + }, + "y": { + "type": "number" + } + } + } + ], + "default": [] + }, + "type": { + "type": "string", + "default": "edge" + } + } + }, + "SKPort": { + "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SShapeElement"}], + "properties": { + "type": { + "type": "string", + "default": "port" + } + } + }, + "KGraphData": { + "properties": { + "properties": { + "type": "object", + "default": {} + } + } + }, + "KRendering": { + "allOf": [{"$ref": "#/definitions/KGraphData"}], + "properties": { + "placementData": { + "$ref": "#/definitions/KPlacementData" + }, + "styles": { + "type": "array", + "default": [] + }, + "actions": { + "type": "array", + "default": [] + }, + "type": { + "type": "string", + "default": "KRenderingImpl" + } + } + }, + "KContainerRendering": { + "allOf": [{"$ref": "#/definitions/KRendering"}], + "properties": { + "children": { + "type": "array", + "items": [ + {"$ref": "#/definitions/KRendering"} + ], + "default": [] + + }, + "childPlacement": { + + }, + "type": { + "type": "string", + "default": "KContainerRenderingImpl" + } + } + }, + "KRectangle": { + "allOf": [{"$ref": "#/definitions/KContainerRendering"}], + "properties": { + "type": { + "type": "string", + "default": "KRectangleImpl" + } + } + }, + "KRoundedRectangle": { + "allOf": [{"$ref": "#/definitions/KRectangle"}], + "properties": { + "cornerWidth": { + "type": "number" + }, + "cornerHeight": { + "type": "number" + }, + "type": { + "type": "string", + "default": "KRoundedRectangleImpl" + } + } + }, + "KPolyline": { + "allOf": [{"$ref": "#/definitions/KContainerRendering"}], + "properties": { + "type": { + "type": "string", + "default": "KPolylineImpl" + }, + "junctionPointRendering": { + "$ref": "#/definitions/KRendering" + } + } + }, + "KPolygon": { + "allOf": [{"$ref": "#/definitions/KPolyline"}], + "properties": { + "type": { + "type": "string", + "default": "KPolygonImpl" + } + } + }, + "KSpline": { + "allOf": [{"$ref": "#/definitions/KPolyline"}], + "properties": { + "type": { + "type": "string", + "default": "KSplineImpl" + } + } + }, + "KImage": { + "allOf": [{"$ref": "#/definitions/KContainerRendering"}], + "properties": { + "bundleName": { + "type": "string" + }, + "imagePath": { + "type": "string" + }, + "type": { + "type": "string", + "default": "KImageImpl" + } + } + }, + "KEllipse": { + "allOf": [{"$ref": "#/definitions/KContainerRendering"}], + "properties": { + "type": { + "type": "string", + "default": "KEllipseImpl" + } + } + }, + "KArc": { + "allOf": [{"$ref": "#/definitions/KContainerRendering"}], + "properties": { + "startAngle": { + "type": "number" + }, + "arcAngle": { + "type": "number" + }, + "type": { + "type": "string", + "default": "KArcImpl" + } + } + }, + "KText": { + "allOf": [{"$ref": "#/definitions/KContainerRendering"}], + "properties": { + "text": { + "type": "string" + }, + "clip": { + "type": "boolean" + }, + "type": { + "type": "string", + "default": "KTextImpl" + } + } + }, + "KPlacementData": { + "type": "object", + "properties": { + "stub": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/ValuedSynthesisOption.json b/schema/klighd/ValuedSynthesisOption.json new file mode 100644 index 00000000..b5705837 --- /dev/null +++ b/schema/klighd/ValuedSynthesisOption.json @@ -0,0 +1,141 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/ValuedSynthesisOption.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ValuedSynthesisOption", + "type": "object", + "required": ["synthesisOption", "currentValue"], + "properties": { + "synthesisOption": { + "anyOf": [ + {"$ref": "#/definitions/checkSynthesisOption"}, + {"$ref": "#/definitions/choiceSynthesisOption"}, + {"$ref": "#/definitions/rangeSynthesisOption"}, + {"$ref": "#/definitions/textSynthesisOption"}, + {"$ref": "#/definitions/separatorSynthesisOption"}, + {"$ref": "#/definitions/categorySynthesisOption"} + ] + }, + "currentValue": { + "type": ["string", "number", "boolean"] + } + }, + "definitions": { + "SynthesisOption": { + "type": "object", + "required": ["id", "name", "type", "sourceHash", "initialValue"], + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "number", + "enum": [0, 1, 2, 3, 4, 5] + }, + "updateAction": { + "type": "string" + }, + "category": { + "$ref": "#/definitions/categorySynthesisOption" + }, + "sourceHash": { + "type": "string" + }, + "initialValue": {} + } + }, + "checkSynthesisOption": { + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], + "properties": { + "type": { + "type": "number", + "enum": [0] + }, + "initialValue": { + "type": "boolean" + } + } + }, + "choiceSynthesisOption": { + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], + "required": ["values"], + "properties": { + "type": { + "type": "number", + "enum": [1] + }, + "initialValue": { + "type": "string" + }, + "values": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "rangeSynthesisOption": { + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], + "required": ["range", "stepSize"], + "properties": { + "type": { + "type": "number", + "enum": [2] + }, + "initialValue": { + "type": "number" + }, + "range": { + "type": "object", + "properties": { + "first": { + "type": "number" + }, + "second": { + "type": "number" + } + } + }, + "stepSize": { + "type": "number" + } + } + }, + "textSynthesisOption": { + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], + "properties": { + "type": { + "type": "number", + "enum": [3] + }, + "initialValue": { + "type": "string" + } + } + }, + "separatorSynthesisOption": { + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], + "properties": { + "type": { + "type": "number", + "enum": [4] + } + } + }, + "categorySynthesisOption": { + "allOf": [{"$ref": "#/definitions/SynthesisOption"}], + "properties": { + "type": { + "type": "number", + "enum": [5] + }, + "initialValue": { + "type": "boolean" + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/checkImages.json b/schema/klighd/actions/checkImages.json new file mode 100644 index 00000000..c5c7006a --- /dev/null +++ b/schema/klighd/actions/checkImages.json @@ -0,0 +1,34 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/checkImages.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "checkImages", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind", "images"], + "properties": { + "kind": { + "type": "string", + "enum": ["checkImages"] + }, + "images": { + "type": "array", + "items": { + "$ref": "#/definitions/image" + } + } + }, + "definitions": { + "image": { + "type": "object", + "required": ["bundleName", "imagePath"], + "properties": { + "bundleName": { + "type": "string" + }, + "imagePath": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/checkedImages.json b/schema/klighd/actions/checkedImages.json new file mode 100644 index 00000000..6e5445cc --- /dev/null +++ b/schema/klighd/actions/checkedImages.json @@ -0,0 +1,37 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/checkedImages.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "checkedImages", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind", "notCached", "responseId"], + "properties": { + "kind": { + "type": "string", + "enum": ["checkedImages"] + }, + "notCached": { + "type": "array", + "items": { + "$ref": "#/definitions/notCachedImage" + } + }, + "responseId": { + "type": "string" + } + }, + "definitions": { + "notCachedImage": { + "type": "object", + "required": ["k", "v"], + "properties": { + "k": { + "type": "string" + }, + "v": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/performAction.json b/schema/klighd/actions/performAction.json new file mode 100644 index 00000000..0dfe923d --- /dev/null +++ b/schema/klighd/actions/performAction.json @@ -0,0 +1,26 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/performAction.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "performAction", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], + "required": ["kind", "actionId", "kGraphElementId", "kRenderingId", "revision"], + "properties": { + "kind": { + "type": "string", + "enum": ["performAction"] + }, + "actionId": { + "type": "string" + }, + "kGraphElementId": { + "type": "string" + }, + "kRenderingId": { + "type": "string" + }, + "revision": { + "type": "number" + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/refreshDiagram.json b/schema/klighd/actions/refreshDiagram.json new file mode 100644 index 00000000..bda306d8 --- /dev/null +++ b/schema/klighd/actions/refreshDiagram.json @@ -0,0 +1,25 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/refreshDiagram.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "refreshDiagram", + "type": "object", + "allOf": [{ "$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json" }], + "required": ["kind"], + "properties": { + "kind": { + "type": "string", + "enum": ["refreshDiagram"] + }, + "options": { + "type": "object", + "properties": { + "needsClientLayout": { + "type": "boolean" + }, + "needsServerLayout": { + "type": "boolean" + } + } + } + } +} diff --git a/schema/klighd/actions/refreshLayout.json b/schema/klighd/actions/refreshLayout.json new file mode 100644 index 00000000..0f322b89 --- /dev/null +++ b/schema/klighd/actions/refreshLayout.json @@ -0,0 +1,14 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/refreshLayout.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "refreshLayout", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind"], + "properties": { + "kind": { + "type": "string", + "enum": ["refreshLayout"] + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/requestDiagramPiece.json b/schema/klighd/actions/requestDiagramPiece.json new file mode 100644 index 00000000..9d92c8eb --- /dev/null +++ b/schema/klighd/actions/requestDiagramPiece.json @@ -0,0 +1,17 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/requestDiagramPiece.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "requestDiagramPiece", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind", "modelElementId"], + "properties": { + "kind": { + "type": "string", + "enum": ["requestDiagramPiece"] + }, + "modelElementId": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/setDiagramPiece.json b/schema/klighd/actions/setDiagramPiece.json new file mode 100644 index 00000000..b538bb30 --- /dev/null +++ b/schema/klighd/actions/setDiagramPiece.json @@ -0,0 +1,17 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/setDiagramPiece.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "setDiagramPiece", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind", "diagramPiece"], + "properties": { + "kind": { + "type": "string", + "enum": ["setDiagramPiece"] + }, + "diagramPiece": { + "$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/SKGraphSchema.json#/definitions/SKNode" + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/setSyntheses.json b/schema/klighd/actions/setSyntheses.json new file mode 100644 index 00000000..37aae4a3 --- /dev/null +++ b/schema/klighd/actions/setSyntheses.json @@ -0,0 +1,34 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/setSyntheses.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "setSyntheses", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind", "syntheses"], + "properties": { + "kind": { + "type": "string", + "enum": ["setSyntheses"] + }, + "syntheses": { + "type": "array", + "items": { + "$ref": "#/definitions/synthesis" + } + } + }, + "definitions": { + "synthesis": { + "type": "object", + "required": ["id", "displayName"], + "properties": { + "id": { + "type": "string" + }, + "displayName": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/setSynthesis.json b/schema/klighd/actions/setSynthesis.json new file mode 100644 index 00000000..1cdc4d50 --- /dev/null +++ b/schema/klighd/actions/setSynthesis.json @@ -0,0 +1,17 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/setSynthesis.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "setSynthesis", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind", "id"], + "properties": { + "kind": { + "type": "string", + "enum": ["setSynthesis"] + }, + "id": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/storeImages.json b/schema/klighd/actions/storeImages.json new file mode 100644 index 00000000..c58f4c66 --- /dev/null +++ b/schema/klighd/actions/storeImages.json @@ -0,0 +1,27 @@ + +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/storeImages.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "storeImages", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind", "images"], + "properties": { + "kind": { + "type": "string", + "enum": ["storeImages"] + }, + "images": { + "type": "object", + "required": ["k", "v"], + "properties": { + "k": { + "$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/actions/checkedImages.json#/definitions/notCachedImage" + }, + "v": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/actions/updateOptions.json b/schema/klighd/actions/updateOptions.json new file mode 100644 index 00000000..8084bf9a --- /dev/null +++ b/schema/klighd/actions/updateOptions.json @@ -0,0 +1,29 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/actions/updateOptions.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "updateOptions", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}], + "required": ["kind", "valuedSynthesisOptions", "layoutOptions", "actions", "modelUri"], + "properties": { + "kind": { + "type": "string", + "enum": ["updateOptions"] + }, + "valuedSynthesisOptions": { + "type": "array", + "items": { + "$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/valuedSynthesisOption.json" + } + }, + "layoutOptions": { + "type": "array" + }, + "actions": { + "type": "array" + }, + "modelUri": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/schema/klighd/messages/diagramOptionsPerformAction.json b/schema/klighd/messages/diagramOptionsPerformAction.json new file mode 100644 index 00000000..48628e22 --- /dev/null +++ b/schema/klighd/messages/diagramOptionsPerformAction.json @@ -0,0 +1,25 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/messages/diagramOptionsPerformAction.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "keith/diagramOptions/performAction", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/requestMessage.json"}], + "required": ["method", "params"], + "properties": { + "method": { + "type": "string", + "enum": ["keith/diagramOptions/performAction"] + }, + "params": { + "type": "object", + "required": ["actionId", "uri"], + "properties": { + "actionId": { + "type": "string" + }, + "uri": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/messages/diagramOptionsSetLayoutOptions.json b/schema/klighd/messages/diagramOptionsSetLayoutOptions.json new file mode 100644 index 00000000..cacc7e8e --- /dev/null +++ b/schema/klighd/messages/diagramOptionsSetLayoutOptions.json @@ -0,0 +1,35 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/messages/diagramOptionsSetLayoutOptions.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "keith/diagramOptions/setLayoutOptions", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/requestMessage.json"}], + "required": ["method", "params"], + "properties": { + "method": { + "type": "string", + "enum": ["keith/diagramOptions/setLayoutOptions"] + }, + "params": { + "type": "object", + "required": ["layoutOptions", "uri"], + "properties": { + "layoutOptions": { + "type": "array", + "items": { + "type": "object", + "required": ["optionId", "value"], + "properties": { + "optionId": { + "type": "string" + }, + "value": {} + } + } + }, + "uri": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/messages/diagramOptionsSetSynthesisOptions.json b/schema/klighd/messages/diagramOptionsSetSynthesisOptions.json new file mode 100644 index 00000000..6d60dae1 --- /dev/null +++ b/schema/klighd/messages/diagramOptionsSetSynthesisOptions.json @@ -0,0 +1,28 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/messages/diagramOptionsSetSynthesisOptions.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "keith/diagramOptions/setSynthesisOptions", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/requestMessage.json"}], + "required": ["method", "params"], + "properties": { + "method": { + "type": "string", + "enum": ["keith/diagramOptions/setSynthesisOptions"] + }, + "params": { + "type": "object", + "required": ["synthesisOptions"], + "properties": { + "synthesisOptions": { + "type": "array", + "items": { + "$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/valuedSynthesisOption.json" + } + }, + "uri": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/schema/klighd/messages/preferencesSetPreferences.json b/schema/klighd/messages/preferencesSetPreferences.json new file mode 100644 index 00000000..e5019394 --- /dev/null +++ b/schema/klighd/messages/preferencesSetPreferences.json @@ -0,0 +1,31 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/messages/preferencesSetPreferences.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "keith/preferences/setPreferences", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/requestMessage.json"}], + "required": ["method", "params"], + "properties": { + "method": { + "type": "string", + "enum": ["keith/preferences/setPreferences"] + }, + "params": { + "type": "object", + "required": ["diagram.shouldSelectDiagram", "diagram.shouldSelectText", "diagram.incrementalDiagramGenerator"], + "properties": { + "diagram.shouldSelectDiagram": { + "type": "boolean" + }, + "diagram.shouldSelectText": { + "type": "boolean" + }, + "diagram.incrementalDiagramGenerator": { + "type": "boolean" + }, + "diagram.clientLayout": { + "type": "boolean" + } + } + } + } +} \ No newline at end of file diff --git a/schema/lsp/generalSendMessage.json b/schema/lsp/generalSendMessage.json new file mode 100644 index 00000000..6da08838 --- /dev/null +++ b/schema/lsp/generalSendMessage.json @@ -0,0 +1,19 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/generalSendMessage.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "general/sendMessage", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/requestMessage.json"}], + "required": ["method", "params"], + "properties": { + "method": { + "type": "string", + "enum": ["general/sendMessage"] + }, + "params": { + "type": "array", + "items": { + "type": "string" + } + } + } +} \ No newline at end of file diff --git a/schema/lsp/initialize.json b/schema/lsp/initialize.json new file mode 100644 index 00000000..ae7b5766 --- /dev/null +++ b/schema/lsp/initialize.json @@ -0,0 +1,56 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/initialize.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "initialize", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/requestMessage.json"}], + "required": ["method", "params"], + "properties": { + "method": { + "type": "string", + "enum": ["initialize"] + }, + "params": { + "type": "object", + "properties": { + "processId": {}, + "workspaceFolders": {}, + "rootUri": {}, + "clientInfo": { + "type": "object", + "properties": { + "name": { + "type": "string" + } + } + }, + "capabilities": { + "type": "object" + }, + "initializationOptions": { + "type": "object", + "properties": { + "clientDiagramOptions": { + "$ref": "#/definitions/ClientDiagramOptions" + } + } + } + } + } + }, + "definitions": { + "ClientDiagramOptions": { + "type": "object", + "properties": { + "preference": { + "type": "object" + }, + "render": { + "type": "object" + }, + "synthesis": { + "type": "object" + } + } + } + } +} \ No newline at end of file diff --git a/schema/lsp/message.json b/schema/lsp/message.json new file mode 100644 index 00000000..ef38af37 --- /dev/null +++ b/schema/lsp/message.json @@ -0,0 +1,13 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/message.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "message", + "type": "object", + "required": ["jsonrpc"], + "properties": { + "jsonrpc": { + "type": "string", + "enum": ["2.0"] + } + } +} \ No newline at end of file diff --git a/schema/lsp/range.json b/schema/lsp/range.json new file mode 100644 index 00000000..47f7a90a --- /dev/null +++ b/schema/lsp/range.json @@ -0,0 +1,29 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/range.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "range", + "type": "object", + "required": ["start", "end"], + "properties": { + "start": { + "$ref": "#/definitions/editorPosition.json" + }, + "end": { + "$ref": "#/definitions/editorPosition.json" + } + }, + "definitions": { + "editorPosition.json": { + "type": "object", + "required": ["line", "character"], + "properties": { + "line": { + "type": "integer" + }, + "character": { + "type": "integer" + } + } + } + } +} \ No newline at end of file diff --git a/schema/lsp/requestMessage.json b/schema/lsp/requestMessage.json new file mode 100644 index 00000000..03924db3 --- /dev/null +++ b/schema/lsp/requestMessage.json @@ -0,0 +1,19 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/requestmessage.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "message", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/message.json"}], + "required": ["method"], + "properties": { + "id": { + "type": ["number", "string"] + }, + "method": { + "type": "string", + "enum": ["requestMessage"] + }, + "params": { + "type": ["array", "object"] + } + } +} \ No newline at end of file diff --git a/schema/lsp/responseMessage.json b/schema/lsp/responseMessage.json new file mode 100644 index 00000000..48db567e --- /dev/null +++ b/schema/lsp/responseMessage.json @@ -0,0 +1,15 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/requestmessage.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "message", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/message.json"}], + "required": ["id"], + "oneOf": [{"required": ["result"]}, {"required": ["error"]}], + "properties": { + "id": { + "type": ["number", "string", "null"] + }, + "result": {}, + "error": {} + } +} \ No newline at end of file diff --git a/schema/lsp/textDocumentDocumentHighlight.json b/schema/lsp/textDocumentDocumentHighlight.json new file mode 100644 index 00000000..998e3fbe --- /dev/null +++ b/schema/lsp/textDocumentDocumentHighlight.json @@ -0,0 +1,29 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/textDocumentDocumentHighlight.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "textDocument/documentHighlight", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/requestMessage.json"}], + "required": ["method", "params"], + "properties": { + "method": { + "type": "string", + "enum": ["textDocument/documentHighlight"] + }, + "params": { + "type": "object", + "properties": { + "textDocument": { + "type":"object", + "properties": { + "uri": { + "type": "string" + } + } + }, + "position": { + "$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/position.json" + } + } + } + } +} \ No newline at end of file diff --git a/schema/sprotty/actions/action.json b/schema/sprotty/actions/action.json new file mode 100644 index 00000000..2cb2fa92 --- /dev/null +++ b/schema/sprotty/actions/action.json @@ -0,0 +1,15 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "action", + "type": "object", + "required": ["kind"], + "properties": { + "kind": { + "type": "string" + }, + "requestId": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/schema/sprotty/actions/allSelected.json b/schema/sprotty/actions/allSelected.json new file mode 100644 index 00000000..1214c45a --- /dev/null +++ b/schema/sprotty/actions/allSelected.json @@ -0,0 +1,17 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/actions/allSelected.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "allSelected", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], + "required": ["kind", "select"], + "properties": { + "kind": { + "type": "string", + "enum": ["allSelected"] + }, + "select": { + "type": "boolean" + } + } +} \ No newline at end of file diff --git a/schema/sprotty/actions/elementSelected.json b/schema/sprotty/actions/elementSelected.json new file mode 100644 index 00000000..f19c3619 --- /dev/null +++ b/schema/sprotty/actions/elementSelected.json @@ -0,0 +1,29 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/actions/elementSelected.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "elementSelected", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], + "required": ["kind", "selectedElementsIDs", "deselectedElementsIDs", "preventOpenSelection"], + "properties": { + "kind": { + "type": "string", + "enum": ["elementSelected"] + }, + "selectedElementsIDs": { + "type": "array", + "items": { + "type": "string" + } + }, + "deselectedElementsIDs": { + "type": "array", + "items": { + "type": "string" + } + }, + "preventOpenSelection": { + "type": "boolean" + } + } +} \ No newline at end of file diff --git a/schema/sprotty/actions/fit.json b/schema/sprotty/actions/fit.json new file mode 100644 index 00000000..9a82a5cf --- /dev/null +++ b/schema/sprotty/actions/fit.json @@ -0,0 +1,26 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/actions/fit.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "fit", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], + "required": ["kind", "elementIds", "maxZoom", "animate"], + "properties": { + "kind": { + "type": "string", + "enum": ["fit"] + }, + "elementIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "maxZoom": { + "type": "number" + }, + "animate": { + "type": "boolean" + } + } +} \ No newline at end of file diff --git a/schema/sprotty/actions/requestBounds.json b/schema/sprotty/actions/requestBounds.json new file mode 100644 index 00000000..9ad3dd50 --- /dev/null +++ b/schema/sprotty/actions/requestBounds.json @@ -0,0 +1,17 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/actions/requestBounds.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "requestBounds", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], + "required": ["kind", "newRoot"], + "properties": { + "kind": { + "type": "string", + "enum": ["requestBounds"] + }, + "newRoot": { + "$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/SKGraphSchema#/definitions/SKGraph" + } + } +} \ No newline at end of file diff --git a/schema/sprotty/actions/requestModel.json b/schema/sprotty/actions/requestModel.json new file mode 100644 index 00000000..9f837ac4 --- /dev/null +++ b/schema/sprotty/actions/requestModel.json @@ -0,0 +1,35 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/actions/requestModel.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "requestModel", + "type": "object", + "allOf": [{ "$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json" }], + "required": ["kind", "options", "requestId"], + "properties": { + "kind": { + "type": "string", + "enum": ["requestModel"] + }, + "options": { + "type": "object", + "properties": { + "needsClientLayout": { + "type": "boolean" + }, + "needsServerLayout": { + "type": "boolean" + }, + "sourceUri": { + "type": "string" + }, + "diagramType": { + "type": "string", + "enum": ["keith-diagram"] + } + } + }, + "requestId": { + "type": "string" + } + } +} diff --git a/schema/sprotty/actions/setModel.json b/schema/sprotty/actions/setModel.json new file mode 100644 index 00000000..ff8d309d --- /dev/null +++ b/schema/sprotty/actions/setModel.json @@ -0,0 +1,17 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/actions/setModel.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "setModel", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], + "required": ["kind", "newRoot"], + "properties": { + "kind": { + "type": "string", + "enum": ["setModel"] + }, + "newRoot": { + "$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/SKGraphSchema#/definitions/SKGraph" + } + } +} \ No newline at end of file diff --git a/schema/sprotty/actions/updateModel.json b/schema/sprotty/actions/updateModel.json new file mode 100644 index 00000000..a6c1a1b8 --- /dev/null +++ b/schema/sprotty/actions/updateModel.json @@ -0,0 +1,17 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/actions/updateModel.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "updateModel", + "type": "object", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}], + "required": ["kind", "newRoot"], + "properties": { + "kind": { + "type": "string", + "enum": ["updateModel"] + }, + "newRoot": { + "$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/SKGraphSchema#/definitions/SKGraph" + } + } +} \ No newline at end of file diff --git a/schema/sprotty/diagramAccept.json b/schema/sprotty/diagramAccept.json new file mode 100644 index 00000000..531bb740 --- /dev/null +++ b/schema/sprotty/diagramAccept.json @@ -0,0 +1,26 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/messages/diagramAccept.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "diagram/accept", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/requestMessage.json"}], + "required": ["method", "params"], + "properties": { + "method": { + "type": "string", + "enum": ["diagram/accept"] + }, + "params": { + "type": "object", + "required": ["clientId", "action"], + "properties": { + "clientId": { + "type": "string", + "enum": ["sprotty"] + }, + "action": { + "$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json" + } + } + } + } +} \ No newline at end of file diff --git a/schema/sprotty/diagramOpenInTextEditor.json b/schema/sprotty/diagramOpenInTextEditor.json new file mode 100644 index 00000000..0be1cbd9 --- /dev/null +++ b/schema/sprotty/diagramOpenInTextEditor.json @@ -0,0 +1,39 @@ +{ + "$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/messages/diagramOpenInTextEditor.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "diagram/openInTextEditor", + "allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/requestMessage.json"}], + "required": ["method", "params"], + "properties": { + "method": { + "type": "string", + "enum": ["diagram/openInTextEditor"] + }, + "params": { + "type": "object", + "required": ["location", "forceOpen"], + "properties": { + "location": { + "$ref": "#/definitions/location" + }, + "forceOpen": { + "type": "boolean" + } + } + } + }, + "definitions": { + "location": { + "type": "object", + "required": ["uri", "range"], + "properties": { + "uri": { + "type": "string" + }, + "range": { + "$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/range.json" + } + } + } + } +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 9689aecb..2c00c992 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3827,6 +3827,11 @@ electron-to-chromium@^1.4.535: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.585.tgz#7b3cb6846bb5cc10a8d5904c351a9b8aaa76ea90" integrity sha512-B4yBlX0azdA3rVMxpYwLQfDpdwOgcnLCkpvSOd68iFmeedo+WYjaBJS3/W58LVD8CB2nf+o7C4K9xz1l09RkWg== +elkjs@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/elkjs/-/elkjs-0.8.2.tgz#c37763c5a3e24e042e318455e0147c912a7c248e" + integrity sha512-L6uRgvZTH+4OF5NE/MBbzQx/WYpru1xCBE9respNj6qznEewGUIfhzmm7horWWxbNO2M0WckQypGctR8lH79xQ== + elliptic@^6.5.3: version "6.5.4" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" @@ -8685,6 +8690,16 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= +sprotty-elk@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/sprotty-elk/-/sprotty-elk-1.3.0.tgz#2cffc8ff280f899ca791c011d67ccb4a0cd50e5e" + integrity sha512-P8AZxWj99RziRK+mA6D/J99PvpT4z+gAVbfvaHJHhYXW+1jDP5vJSNzhW305BykfFugN+2V0HVSLZKana+aUHg== + dependencies: + elkjs "^0.8.2" + sprotty-protocol "^1.3.0" + optionalDependencies: + inversify "~6.0.2" + sprotty-protocol@^1.0.0, sprotty-protocol@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/sprotty-protocol/-/sprotty-protocol-1.3.0.tgz#78a6a69cc5eb8b94b352882a83d0f339fd828a0d"