sprotty-protocol
Advanced tools
Comparing version 0.14.0-next.8373830.18 to 0.14.0-next.02bbac0.26
@@ -19,3 +19,3 @@ /******************************************************************************** | ||
import { DiagramState } from './diagram-services'; | ||
export declare type ServerActionHandler<A extends Action = Action> = (action: A, state: DiagramState, server: DiagramServer) => Promise<void>; | ||
export type ServerActionHandler<A extends Action = Action> = (action: A, state: DiagramState, server: DiagramServer) => Promise<void>; | ||
/** | ||
@@ -22,0 +22,0 @@ * Use this service to register handlers to specific actions. The `DiagramServer` queries this registry |
@@ -271,2 +271,23 @@ /******************************************************************************** | ||
/** | ||
* Request action for retrieving the current selection. | ||
*/ | ||
export interface GetSelectionAction extends RequestAction<SelectionResult> { | ||
kind: typeof GetSelectionAction.KIND; | ||
} | ||
export declare namespace GetSelectionAction { | ||
const KIND = "getSelection"; | ||
function create(): GetSelectionAction; | ||
} | ||
/** | ||
* Result for a `GetSelectionAction`. | ||
*/ | ||
export interface SelectionResult extends ResponseAction { | ||
kind: typeof SelectionResult.KIND; | ||
selectedElementsIDs: string[]; | ||
} | ||
export declare namespace SelectionResult { | ||
const KIND = "selectionResult"; | ||
function create(selectedElementsIDs: string[], requestId: string): SelectionResult; | ||
} | ||
/** | ||
* Sent from the client to the model source to recalculate a diagram when elements | ||
@@ -385,2 +406,24 @@ * are collapsed/expanded by the client. | ||
/** | ||
* Request action for retrieving the current viewport and canvas bounds. | ||
*/ | ||
export interface GetViewportAction extends RequestAction<ViewportResult> { | ||
kind: typeof GetViewportAction.KIND; | ||
} | ||
export declare namespace GetViewportAction { | ||
const KIND = "getViewport"; | ||
function create(): GetViewportAction; | ||
} | ||
/** | ||
* Response to a `GetViewportAction`. | ||
*/ | ||
export interface ViewportResult extends ResponseAction { | ||
kind: typeof ViewportResult.KIND; | ||
viewport: Viewport; | ||
canvasBounds: Bounds; | ||
} | ||
export declare namespace ViewportResult { | ||
const KIND = "viewportResult"; | ||
function create(viewport: Viewport, canvasBounds: Bounds, requestId: string): ViewportResult; | ||
} | ||
/** | ||
* Action to render the selected elements in front of others by manipulating the z-order. | ||
@@ -387,0 +430,0 @@ */ |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ReconnectAction = exports.ApplyLabelEditAction = exports.DeleteElementAction = exports.CreateElementAction = exports.HoverFeedbackAction = exports.MoveAction = exports.RedoAction = exports.UndoAction = exports.BringToFrontAction = exports.SetViewportAction = exports.FitToScreenAction = exports.CenterAction = exports.LayoutAction = exports.OpenAction = exports.CollapseExpandAllAction = exports.CollapseExpandAction = exports.SelectAllAction = exports.SelectAction = exports.LoggingAction = exports.ComputedBoundsAction = exports.RequestBoundsAction = exports.SetBoundsAction = exports.SetPopupModelAction = exports.RequestPopupModelAction = exports.UpdateModelAction = exports.SetModelAction = exports.RequestModelAction = exports.RejectAction = exports.isResponseAction = exports.generateRequestId = exports.isRequestAction = exports.isAction = exports.isActionMessage = void 0; | ||
exports.ReconnectAction = exports.ApplyLabelEditAction = exports.DeleteElementAction = exports.CreateElementAction = exports.HoverFeedbackAction = exports.MoveAction = exports.RedoAction = exports.UndoAction = exports.BringToFrontAction = exports.ViewportResult = exports.GetViewportAction = exports.SetViewportAction = exports.FitToScreenAction = exports.CenterAction = exports.LayoutAction = exports.OpenAction = exports.CollapseExpandAllAction = exports.CollapseExpandAction = exports.SelectionResult = exports.GetSelectionAction = exports.SelectAllAction = exports.SelectAction = exports.LoggingAction = exports.ComputedBoundsAction = exports.RequestBoundsAction = exports.SetBoundsAction = exports.SetPopupModelAction = exports.RequestPopupModelAction = exports.UpdateModelAction = exports.SetModelAction = exports.RequestModelAction = exports.RejectAction = exports.isResponseAction = exports.generateRequestId = exports.isRequestAction = exports.isAction = exports.isActionMessage = void 0; | ||
const object_1 = require("./utils/object"); | ||
@@ -206,2 +206,25 @@ function isActionMessage(object) { | ||
})(SelectAllAction = exports.SelectAllAction || (exports.SelectAllAction = {})); | ||
var GetSelectionAction; | ||
(function (GetSelectionAction) { | ||
GetSelectionAction.KIND = 'getSelection'; | ||
function create() { | ||
return { | ||
kind: GetSelectionAction.KIND, | ||
requestId: generateRequestId() | ||
}; | ||
} | ||
GetSelectionAction.create = create; | ||
})(GetSelectionAction = exports.GetSelectionAction || (exports.GetSelectionAction = {})); | ||
var SelectionResult; | ||
(function (SelectionResult) { | ||
SelectionResult.KIND = 'selectionResult'; | ||
function create(selectedElementsIDs, requestId) { | ||
return { | ||
kind: SelectionResult.KIND, | ||
selectedElementsIDs, | ||
responseId: requestId | ||
}; | ||
} | ||
SelectionResult.create = create; | ||
})(SelectionResult = exports.SelectionResult || (exports.SelectionResult = {})); | ||
var CollapseExpandAction; | ||
@@ -299,2 +322,26 @@ (function (CollapseExpandAction) { | ||
})(SetViewportAction = exports.SetViewportAction || (exports.SetViewportAction = {})); | ||
var GetViewportAction; | ||
(function (GetViewportAction) { | ||
GetViewportAction.KIND = 'getViewport'; | ||
function create() { | ||
return { | ||
kind: GetViewportAction.KIND, | ||
requestId: generateRequestId() | ||
}; | ||
} | ||
GetViewportAction.create = create; | ||
})(GetViewportAction = exports.GetViewportAction || (exports.GetViewportAction = {})); | ||
var ViewportResult; | ||
(function (ViewportResult) { | ||
ViewportResult.KIND = 'viewportResult'; | ||
function create(viewport, canvasBounds, requestId) { | ||
return { | ||
kind: ViewportResult.KIND, | ||
viewport, | ||
canvasBounds, | ||
responseId: requestId | ||
}; | ||
} | ||
ViewportResult.create = create; | ||
})(ViewportResult = exports.ViewportResult || (exports.ViewportResult = {})); | ||
var BringToFrontAction; | ||
@@ -301,0 +348,0 @@ (function (BringToFrontAction) { |
@@ -20,3 +20,3 @@ /******************************************************************************** | ||
import { SModelIndex } from './utils/model-utils'; | ||
export declare type DiagramOptions = JsonMap; | ||
export type DiagramOptions = JsonMap; | ||
/** | ||
@@ -23,0 +23,0 @@ * The current state captured by a `DiagramServer`. |
@@ -84,3 +84,3 @@ /******************************************************************************** | ||
*/ | ||
export declare type ModelLayoutOptions = { | ||
export type ModelLayoutOptions = { | ||
[key: string]: string | number | boolean; | ||
@@ -87,0 +87,0 @@ }; |
@@ -24,4 +24,8 @@ /******************************************************************************** | ||
readonly promise: Promise<T>; | ||
private _state; | ||
constructor(); | ||
private set state(value); | ||
get state(): DeferredState; | ||
} | ||
export type DeferredState = 'resolved' | 'rejected' | 'unresolved'; | ||
//# sourceMappingURL=async.d.ts.map |
@@ -25,2 +25,3 @@ "use strict"; | ||
constructor() { | ||
this._state = 'unresolved'; | ||
this.promise = new Promise((resolve, reject) => { | ||
@@ -30,5 +31,14 @@ this.resolve = resolve; | ||
}); | ||
this.promise.then(res => this._state = 'resolved', rej => this._state = 'rejected'); | ||
} | ||
set state(state) { | ||
if (this._state === 'unresolved') { | ||
this._state = state; | ||
} | ||
} | ||
get state() { | ||
return this._state; | ||
} | ||
} | ||
exports.Deferred = Deferred; | ||
//# sourceMappingURL=async.js.map |
@@ -16,8 +16,8 @@ /******************************************************************************** | ||
********************************************************************************/ | ||
export declare type JsonAny = JsonPrimitive | JsonMap | JsonArray | null; | ||
export declare type JsonPrimitive = string | number | boolean; | ||
export type JsonAny = JsonPrimitive | JsonMap | JsonArray | null; | ||
export type JsonPrimitive = string | number | boolean; | ||
export interface JsonMap { | ||
[key: string]: JsonAny; | ||
} | ||
export declare type JsonArray = Array<JsonAny>; | ||
export type JsonArray = Array<JsonAny>; | ||
//# sourceMappingURL=json.d.ts.map |
@@ -17,5 +17,5 @@ /******************************************************************************** | ||
export declare function isObject(data: unknown): data is Record<PropertyKey, unknown>; | ||
export declare type TypeOf<T> = T extends number ? 'number' : T extends string ? 'string' : T extends boolean ? 'boolean' : T extends bigint ? 'bigint' : T extends symbol ? 'symbol' : T extends Function ? 'function' : T extends object ? 'object' : 'undefined'; | ||
export type TypeOf<T> = T extends number ? 'number' : T extends string ? 'string' : T extends boolean ? 'boolean' : T extends bigint ? 'bigint' : T extends symbol ? 'symbol' : T extends Function ? 'function' : T extends object ? 'object' : 'undefined'; | ||
export declare function hasOwnProperty<K extends PropertyKey, T>(arg: unknown, key: K | K[], type?: TypeOf<T> | ((v: unknown) => v is T)): arg is Record<K, T>; | ||
export declare function safeAssign<T extends {}>(target: T, partial: Partial<T>): T; | ||
//# sourceMappingURL=object.d.ts.map |
{ | ||
"name": "sprotty-protocol", | ||
"version": "0.14.0-next.8373830.18+8373830", | ||
"version": "0.14.0-next.02bbac0.26+02bbac0", | ||
"description": "TypeScript declarations for Sprotty to be used both in browser and Node.js context", | ||
@@ -43,3 +43,4 @@ "license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)", | ||
"semver": "^7.3.8", | ||
"typescript": "~4.8.4" | ||
"ts-mocha": "^10.0.0", | ||
"typescript": "~5.0.4" | ||
}, | ||
@@ -52,3 +53,3 @@ "scripts": { | ||
"lint": "eslint -c ../../configs/.eslintrc.js \"src/**/!(*.spec.ts*)\"", | ||
"test": "mocha --config ../../configs/.mocharc.json \"./src/**/*.spec.?(ts|tsx)\"" | ||
"test": "ts-mocha \"./src/**/*.spec.?(ts|tsx)\"" | ||
}, | ||
@@ -64,3 +65,3 @@ "files": [ | ||
], | ||
"gitHead": "8373830dab324ec2a27328c1b4ed649375238896" | ||
"gitHead": "02bbac05b7208a23fdefadbedb174d20660bcc7a" | ||
} |
@@ -380,2 +380,38 @@ /******************************************************************************** | ||
/** | ||
* Request action for retrieving the current selection. | ||
*/ | ||
export interface GetSelectionAction extends RequestAction<SelectionResult> { | ||
kind: typeof GetSelectionAction.KIND | ||
} | ||
export namespace GetSelectionAction { | ||
export const KIND = 'getSelection'; | ||
export function create(): GetSelectionAction { | ||
return { | ||
kind: KIND, | ||
requestId: generateRequestId() | ||
}; | ||
} | ||
} | ||
/** | ||
* Result for a `GetSelectionAction`. | ||
*/ | ||
export interface SelectionResult extends ResponseAction { | ||
kind: typeof SelectionResult.KIND | ||
selectedElementsIDs: string[] | ||
} | ||
export namespace SelectionResult { | ||
export const KIND = 'selectionResult'; | ||
export function create(selectedElementsIDs: string[], requestId: string): SelectionResult { | ||
return { | ||
kind: KIND, | ||
selectedElementsIDs, | ||
responseId: requestId | ||
}; | ||
} | ||
} | ||
/** | ||
* Sent from the client to the model source to recalculate a diagram when elements | ||
@@ -535,2 +571,40 @@ * are collapsed/expanded by the client. | ||
/** | ||
* Request action for retrieving the current viewport and canvas bounds. | ||
*/ | ||
export interface GetViewportAction extends RequestAction<ViewportResult> { | ||
kind: typeof GetViewportAction.KIND; | ||
} | ||
export namespace GetViewportAction { | ||
export const KIND = 'getViewport'; | ||
export function create(): GetViewportAction { | ||
return { | ||
kind: KIND, | ||
requestId: generateRequestId() | ||
}; | ||
} | ||
} | ||
/** | ||
* Response to a `GetViewportAction`. | ||
*/ | ||
export interface ViewportResult extends ResponseAction { | ||
kind: typeof ViewportResult.KIND; | ||
viewport: Viewport | ||
canvasBounds: Bounds | ||
} | ||
export namespace ViewportResult { | ||
export const KIND = 'viewportResult'; | ||
export function create(viewport: Viewport, canvasBounds: Bounds, requestId: string): ViewportResult { | ||
return { | ||
kind: KIND, | ||
viewport, | ||
canvasBounds, | ||
responseId: requestId | ||
}; | ||
} | ||
} | ||
/** | ||
* Action to render the selected elements in front of others by manipulating the z-order. | ||
@@ -537,0 +611,0 @@ */ |
@@ -25,3 +25,5 @@ /******************************************************************************** | ||
readonly promise: Promise<T>; | ||
private _state: DeferredState = 'unresolved'; | ||
constructor() { | ||
@@ -32,3 +34,19 @@ this.promise = new Promise<T>((resolve, reject) => { | ||
}); | ||
this.promise.then( | ||
res => this._state = 'resolved', | ||
rej => this._state = 'rejected' | ||
); | ||
} | ||
private set state(state: DeferredState) { | ||
if (this._state === 'unresolved') { | ||
this._state = state; | ||
} | ||
} | ||
get state(): DeferredState { | ||
return this._state; | ||
} | ||
} | ||
export type DeferredState = 'resolved' | 'rejected' | 'unresolved'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 4 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 3 instances in 1 package
257122
62
4868
13
8