sprotty-protocol
Advanced tools
Comparing version 0.15.0-next.cf488b9.2 to 0.15.0-next.e38e5d4.24
@@ -42,2 +42,6 @@ /******************************************************************************** | ||
requestId: string; | ||
/** | ||
* Used to ensure correct typing. Clients must not use this property | ||
*/ | ||
readonly _?: Res; | ||
} | ||
@@ -50,2 +54,7 @@ export declare function isRequestAction(object?: Action): object is RequestAction<ResponseAction>; | ||
/** | ||
* Configure the context in which request actions are created. This is typically either | ||
* 'client' or 'server' to avoid collisions of request IDs. | ||
*/ | ||
export declare function setRequestContext(context: string): void; | ||
/** | ||
* A response action is sent to respond to a request action. The `responseId` must match | ||
@@ -52,0 +61,0 @@ * the `requestId` of the preceding request. In case the `responseId` is empty or undefined, |
@@ -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.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; | ||
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.setRequestContext = exports.generateRequestId = exports.isRequestAction = exports.isAction = exports.isActionMessage = void 0; | ||
const object_1 = require("./utils/object"); | ||
@@ -33,2 +33,3 @@ function isActionMessage(object) { | ||
exports.isRequestAction = isRequestAction; | ||
let requestContext = ''; | ||
let nextRequestId = 1; | ||
@@ -39,6 +40,14 @@ /** | ||
function generateRequestId() { | ||
return (nextRequestId++).toString(); | ||
return `${requestContext}_${nextRequestId++}`; | ||
} | ||
exports.generateRequestId = generateRequestId; | ||
/** | ||
* Configure the context in which request actions are created. This is typically either | ||
* 'client' or 'server' to avoid collisions of request IDs. | ||
*/ | ||
function setRequestContext(context) { | ||
requestContext = context; | ||
} | ||
exports.setRequestContext = setRequestContext; | ||
/** | ||
* A response action is sent to respond to a request action. The `responseId` must match | ||
@@ -64,3 +73,3 @@ * the `requestId` of the preceding request. In case the `responseId` is empty or undefined, | ||
RejectAction.create = create; | ||
})(RejectAction = exports.RejectAction || (exports.RejectAction = {})); | ||
})(RejectAction || (exports.RejectAction = RejectAction = {})); | ||
var RequestModelAction; | ||
@@ -77,3 +86,3 @@ (function (RequestModelAction) { | ||
RequestModelAction.create = create; | ||
})(RequestModelAction = exports.RequestModelAction || (exports.RequestModelAction = {})); | ||
})(RequestModelAction || (exports.RequestModelAction = RequestModelAction = {})); | ||
var SetModelAction; | ||
@@ -90,3 +99,3 @@ (function (SetModelAction) { | ||
SetModelAction.create = create; | ||
})(SetModelAction = exports.SetModelAction || (exports.SetModelAction = {})); | ||
})(SetModelAction || (exports.SetModelAction = SetModelAction = {})); | ||
var UpdateModelAction; | ||
@@ -114,3 +123,3 @@ (function (UpdateModelAction) { | ||
UpdateModelAction.create = create; | ||
})(UpdateModelAction = exports.UpdateModelAction || (exports.UpdateModelAction = {})); | ||
})(UpdateModelAction || (exports.UpdateModelAction = UpdateModelAction = {})); | ||
var RequestPopupModelAction; | ||
@@ -128,3 +137,3 @@ (function (RequestPopupModelAction) { | ||
RequestPopupModelAction.create = create; | ||
})(RequestPopupModelAction = exports.RequestPopupModelAction || (exports.RequestPopupModelAction = {})); | ||
})(RequestPopupModelAction || (exports.RequestPopupModelAction = RequestPopupModelAction = {})); | ||
var SetPopupModelAction; | ||
@@ -141,3 +150,3 @@ (function (SetPopupModelAction) { | ||
SetPopupModelAction.create = create; | ||
})(SetPopupModelAction = exports.SetPopupModelAction || (exports.SetPopupModelAction = {})); | ||
})(SetPopupModelAction || (exports.SetPopupModelAction = SetPopupModelAction = {})); | ||
var SetBoundsAction; | ||
@@ -153,3 +162,3 @@ (function (SetBoundsAction) { | ||
SetBoundsAction.create = create; | ||
})(SetBoundsAction = exports.SetBoundsAction || (exports.SetBoundsAction = {})); | ||
})(SetBoundsAction || (exports.SetBoundsAction = SetBoundsAction = {})); | ||
var RequestBoundsAction; | ||
@@ -166,3 +175,3 @@ (function (RequestBoundsAction) { | ||
RequestBoundsAction.create = create; | ||
})(RequestBoundsAction = exports.RequestBoundsAction || (exports.RequestBoundsAction = {})); | ||
})(RequestBoundsAction || (exports.RequestBoundsAction = RequestBoundsAction = {})); | ||
var ComputedBoundsAction; | ||
@@ -182,3 +191,3 @@ (function (ComputedBoundsAction) { | ||
ComputedBoundsAction.create = create; | ||
})(ComputedBoundsAction = exports.ComputedBoundsAction || (exports.ComputedBoundsAction = {})); | ||
})(ComputedBoundsAction || (exports.ComputedBoundsAction = ComputedBoundsAction = {})); | ||
var LoggingAction; | ||
@@ -191,3 +200,3 @@ (function (LoggingAction) { | ||
LoggingAction.create = create; | ||
})(LoggingAction = exports.LoggingAction || (exports.LoggingAction = {})); | ||
})(LoggingAction || (exports.LoggingAction = LoggingAction = {})); | ||
var SelectAction; | ||
@@ -205,3 +214,3 @@ (function (SelectAction) { | ||
SelectAction.create = create; | ||
})(SelectAction = exports.SelectAction || (exports.SelectAction = {})); | ||
})(SelectAction || (exports.SelectAction = SelectAction = {})); | ||
var SelectAllAction; | ||
@@ -218,3 +227,3 @@ (function (SelectAllAction) { | ||
SelectAllAction.create = create; | ||
})(SelectAllAction = exports.SelectAllAction || (exports.SelectAllAction = {})); | ||
})(SelectAllAction || (exports.SelectAllAction = SelectAllAction = {})); | ||
var GetSelectionAction; | ||
@@ -230,3 +239,3 @@ (function (GetSelectionAction) { | ||
GetSelectionAction.create = create; | ||
})(GetSelectionAction = exports.GetSelectionAction || (exports.GetSelectionAction = {})); | ||
})(GetSelectionAction || (exports.GetSelectionAction = GetSelectionAction = {})); | ||
var SelectionResult; | ||
@@ -243,3 +252,3 @@ (function (SelectionResult) { | ||
SelectionResult.create = create; | ||
})(SelectionResult = exports.SelectionResult || (exports.SelectionResult = {})); | ||
})(SelectionResult || (exports.SelectionResult = SelectionResult = {})); | ||
var CollapseExpandAction; | ||
@@ -257,3 +266,3 @@ (function (CollapseExpandAction) { | ||
CollapseExpandAction.create = create; | ||
})(CollapseExpandAction = exports.CollapseExpandAction || (exports.CollapseExpandAction = {})); | ||
})(CollapseExpandAction || (exports.CollapseExpandAction = CollapseExpandAction = {})); | ||
var CollapseExpandAllAction; | ||
@@ -270,3 +279,3 @@ (function (CollapseExpandAllAction) { | ||
CollapseExpandAllAction.create = create; | ||
})(CollapseExpandAllAction = exports.CollapseExpandAllAction || (exports.CollapseExpandAllAction = {})); | ||
})(CollapseExpandAllAction || (exports.CollapseExpandAllAction = CollapseExpandAllAction = {})); | ||
var OpenAction; | ||
@@ -282,3 +291,3 @@ (function (OpenAction) { | ||
OpenAction.create = create; | ||
})(OpenAction = exports.OpenAction || (exports.OpenAction = {})); | ||
})(OpenAction || (exports.OpenAction = OpenAction = {})); | ||
var LayoutAction; | ||
@@ -295,3 +304,3 @@ (function (LayoutAction) { | ||
LayoutAction.create = create; | ||
})(LayoutAction = exports.LayoutAction || (exports.LayoutAction = {})); | ||
})(LayoutAction || (exports.LayoutAction = LayoutAction = {})); | ||
var CenterAction; | ||
@@ -311,3 +320,3 @@ (function (CenterAction) { | ||
CenterAction.create = create; | ||
})(CenterAction = exports.CenterAction || (exports.CenterAction = {})); | ||
})(CenterAction || (exports.CenterAction = CenterAction = {})); | ||
var FitToScreenAction; | ||
@@ -327,3 +336,3 @@ (function (FitToScreenAction) { | ||
FitToScreenAction.create = create; | ||
})(FitToScreenAction = exports.FitToScreenAction || (exports.FitToScreenAction = {})); | ||
})(FitToScreenAction || (exports.FitToScreenAction = FitToScreenAction = {})); | ||
var SetViewportAction; | ||
@@ -342,3 +351,3 @@ (function (SetViewportAction) { | ||
SetViewportAction.create = create; | ||
})(SetViewportAction = exports.SetViewportAction || (exports.SetViewportAction = {})); | ||
})(SetViewportAction || (exports.SetViewportAction = SetViewportAction = {})); | ||
var GetViewportAction; | ||
@@ -354,3 +363,3 @@ (function (GetViewportAction) { | ||
GetViewportAction.create = create; | ||
})(GetViewportAction = exports.GetViewportAction || (exports.GetViewportAction = {})); | ||
})(GetViewportAction || (exports.GetViewportAction = GetViewportAction = {})); | ||
var ViewportResult; | ||
@@ -368,3 +377,3 @@ (function (ViewportResult) { | ||
ViewportResult.create = create; | ||
})(ViewportResult = exports.ViewportResult || (exports.ViewportResult = {})); | ||
})(ViewportResult || (exports.ViewportResult = ViewportResult = {})); | ||
var BringToFrontAction; | ||
@@ -380,3 +389,3 @@ (function (BringToFrontAction) { | ||
BringToFrontAction.create = create; | ||
})(BringToFrontAction = exports.BringToFrontAction || (exports.BringToFrontAction = {})); | ||
})(BringToFrontAction || (exports.BringToFrontAction = BringToFrontAction = {})); | ||
var UndoAction; | ||
@@ -391,3 +400,3 @@ (function (UndoAction) { | ||
UndoAction.create = create; | ||
})(UndoAction = exports.UndoAction || (exports.UndoAction = {})); | ||
})(UndoAction || (exports.UndoAction = UndoAction = {})); | ||
var RedoAction; | ||
@@ -402,3 +411,3 @@ (function (RedoAction) { | ||
RedoAction.create = create; | ||
})(RedoAction = exports.RedoAction || (exports.RedoAction = {})); | ||
})(RedoAction || (exports.RedoAction = RedoAction = {})); | ||
var MoveAction; | ||
@@ -417,3 +426,3 @@ (function (MoveAction) { | ||
MoveAction.create = create; | ||
})(MoveAction = exports.MoveAction || (exports.MoveAction = {})); | ||
})(MoveAction || (exports.MoveAction = MoveAction = {})); | ||
var HoverFeedbackAction; | ||
@@ -430,3 +439,3 @@ (function (HoverFeedbackAction) { | ||
HoverFeedbackAction.create = create; | ||
})(HoverFeedbackAction = exports.HoverFeedbackAction || (exports.HoverFeedbackAction = {})); | ||
})(HoverFeedbackAction || (exports.HoverFeedbackAction = HoverFeedbackAction = {})); | ||
var CreateElementAction; | ||
@@ -443,3 +452,3 @@ (function (CreateElementAction) { | ||
CreateElementAction.create = create; | ||
})(CreateElementAction = exports.CreateElementAction || (exports.CreateElementAction = {})); | ||
})(CreateElementAction || (exports.CreateElementAction = CreateElementAction = {})); | ||
var DeleteElementAction; | ||
@@ -455,3 +464,3 @@ (function (DeleteElementAction) { | ||
DeleteElementAction.create = create; | ||
})(DeleteElementAction = exports.DeleteElementAction || (exports.DeleteElementAction = {})); | ||
})(DeleteElementAction || (exports.DeleteElementAction = DeleteElementAction = {})); | ||
var ApplyLabelEditAction; | ||
@@ -468,3 +477,3 @@ (function (ApplyLabelEditAction) { | ||
ApplyLabelEditAction.create = create; | ||
})(ApplyLabelEditAction = exports.ApplyLabelEditAction || (exports.ApplyLabelEditAction = {})); | ||
})(ApplyLabelEditAction || (exports.ApplyLabelEditAction = ApplyLabelEditAction = {})); | ||
var ReconnectAction; | ||
@@ -482,3 +491,3 @@ (function (ReconnectAction) { | ||
ReconnectAction.create = create; | ||
})(ReconnectAction = exports.ReconnectAction || (exports.ReconnectAction = {})); | ||
})(ReconnectAction || (exports.ReconnectAction = ReconnectAction = {})); | ||
//# sourceMappingURL=actions.js.map |
@@ -16,3 +16,3 @@ /******************************************************************************** | ||
********************************************************************************/ | ||
import { ServerActionHandler, ServerActionHandlerRegistry } from './action-handler'; | ||
import { ServerActionHandlerRegistry } from './action-handler'; | ||
import { Action, ResponseAction, RequestModelAction, ComputedBoundsAction, LayoutAction, RequestAction } from './actions'; | ||
@@ -37,10 +37,2 @@ import { DiagramServices, DiagramState, IDiagramGenerator, IModelLayoutEngine } from './diagram-services'; | ||
/** | ||
* @deprecated Use the `ServerActionHandlerRegistry` service instead | ||
*/ | ||
onAction<A extends Action>(kind: string, handler: ServerActionHandler<A>): void; | ||
/** | ||
* @deprecated Use the `ServerActionHandlerRegistry` service instead | ||
*/ | ||
removeActionHandler<A extends Action>(kind: string, handler: ServerActionHandler<A>): void; | ||
/** | ||
* Set the model and submit it to the client. | ||
@@ -47,0 +39,0 @@ */ |
@@ -19,3 +19,2 @@ "use strict"; | ||
exports.DiagramServer = void 0; | ||
const action_handler_1 = require("./action-handler"); | ||
const actions_1 = require("./actions"); | ||
@@ -44,19 +43,2 @@ const async_1 = require("./utils/async"); | ||
/** | ||
* @deprecated Use the `ServerActionHandlerRegistry` service instead | ||
*/ | ||
onAction(kind, handler) { | ||
if (!this.actionHandlerRegistry) { | ||
this.actionHandlerRegistry = new action_handler_1.ServerActionHandlerRegistry(); | ||
} | ||
this.actionHandlerRegistry.onAction(kind, handler); | ||
} | ||
/** | ||
* @deprecated Use the `ServerActionHandlerRegistry` service instead | ||
*/ | ||
removeActionHandler(kind, handler) { | ||
if (this.actionHandlerRegistry) { | ||
this.actionHandlerRegistry.removeActionHandler(kind, handler); | ||
} | ||
} | ||
/** | ||
* Set the model and submit it to the client. | ||
@@ -63,0 +45,0 @@ */ |
@@ -55,2 +55,11 @@ /******************************************************************************** | ||
/** | ||
* Usually the root of a model is also a viewport. | ||
*/ | ||
export interface ViewportRootElement extends SModelRoot { | ||
scroll?: Point; | ||
zoom?: number; | ||
position?: Point; | ||
size?: Dimension; | ||
} | ||
/** | ||
* A scrollable element has a scroll position, which indicates the top left corner of the | ||
@@ -57,0 +66,0 @@ * visible area. |
@@ -147,3 +147,3 @@ "use strict"; | ||
Point.maxDistance = maxDistance; | ||
})(Point = exports.Point || (exports.Point = {})); | ||
})(Point || (exports.Point = Point = {})); | ||
/** | ||
@@ -205,3 +205,3 @@ * Computes the angle in radians of the given point to the x-axis of the coordinate system. | ||
Dimension.isValid = isValid; | ||
})(Dimension = exports.Dimension || (exports.Dimension = {})); | ||
})(Dimension || (exports.Dimension = Dimension = {})); | ||
function isBounds(element) { | ||
@@ -274,3 +274,3 @@ return (0, object_1.hasOwnProperty)(element, ['x', 'y', 'width', 'height']); | ||
Bounds.includes = includes; | ||
})(Bounds = exports.Bounds || (exports.Bounds = {})); | ||
})(Bounds || (exports.Bounds = Bounds = {})); | ||
/** | ||
@@ -277,0 +277,0 @@ * Converts from radians to degrees |
{ | ||
"name": "sprotty-protocol", | ||
"version": "0.15.0-next.cf488b9.2+cf488b9", | ||
"version": "0.15.0-next.e38e5d4.24+e38e5d4", | ||
"description": "TypeScript declarations for Sprotty to be used both in browser and Node.js context", | ||
@@ -14,41 +14,17 @@ "license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)", | ||
], | ||
"homepage": "https://github.com/eclipse/sprotty", | ||
"bugs": "https://github.com/eclipse/sprotty/issues", | ||
"homepage": "https://github.com/eclipse-sprotty/sprotty", | ||
"bugs": "https://github.com/eclipse-sprotty/sprotty/issues", | ||
"author": { | ||
"name": "Eclipse Sprotty" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Miro Spönemann", | ||
"email": "miro.spoenemann@typefox.io", | ||
"url": "https://www.typefox.io" | ||
} | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/eclipse/sprotty", | ||
"url": "https://github.com/eclipse-sprotty/sprotty", | ||
"directory": "packages/sprotty-protocol" | ||
}, | ||
"devDependencies": { | ||
"@types/mocha": "^10.0.1", | ||
"@typescript-eslint/eslint-plugin": "^5.47.0", | ||
"@typescript-eslint/parser": "^5.47.0", | ||
"chai": "^4.3.7", | ||
"eslint": "^8.30.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-header": "^3.1.1", | ||
"eslint-plugin-no-null": "^1.0.2", | ||
"mocha": "^10.2.0", | ||
"rimraf": "^3.0.2", | ||
"semver": "^7.3.8", | ||
"ts-mocha": "^10.0.0", | ||
"typescript": "~5.0.4" | ||
}, | ||
"scripts": { | ||
"prepare": "yarn run clean && yarn run build", | ||
"clean": "rimraf lib artifacts", | ||
"build": "tsc -p ./tsconfig.json && yarn run lint", | ||
"watch": "tsc -w -p ./tsconfig.json", | ||
"lint": "eslint -c ../../configs/.eslintrc.js \"src/**/!(*.spec.ts*)\"", | ||
"test": "ts-mocha \"./src/**/*.spec.?(ts|tsx)\"" | ||
"clean": "shx rm -fr lib artifacts *.tsbuildinfo", | ||
"build": "tsc", | ||
"watch": "tsc --watch", | ||
"test": "vitest run --config ../../vite.config.ts" | ||
}, | ||
@@ -61,6 +37,3 @@ "files": [ | ||
"types": "lib/index", | ||
"eslintIgnore": [ | ||
"src/**/*.spec.?(ts|tsx)" | ||
], | ||
"gitHead": "cf488b9893e1405e1c1296deba2db97fc8b3afef" | ||
"gitHead": "e38e5d406be5114f7ee8013bc0431389d4fcfb70" | ||
} |
@@ -53,2 +53,7 @@ /******************************************************************************** | ||
requestId: string | ||
/** | ||
* Used to ensure correct typing. Clients must not use this property | ||
*/ | ||
readonly _?: Res; | ||
} | ||
@@ -60,2 +65,3 @@ | ||
let requestContext = ''; | ||
let nextRequestId = 1; | ||
@@ -66,6 +72,14 @@ /** | ||
export function generateRequestId(): string { | ||
return (nextRequestId++).toString(); | ||
return `${requestContext}_${nextRequestId++}`; | ||
} | ||
/** | ||
* Configure the context in which request actions are created. This is typically either | ||
* 'client' or 'server' to avoid collisions of request IDs. | ||
*/ | ||
export function setRequestContext(context: string): void { | ||
requestContext = context; | ||
} | ||
/** | ||
* A response action is sent to respond to a request action. The `responseId` must match | ||
@@ -613,3 +627,3 @@ * the `requestId` of the preceding request. In case the `responseId` is empty or undefined, | ||
*/ | ||
export interface BringToFrontAction extends Action { | ||
export interface BringToFrontAction extends Action { | ||
kind: typeof BringToFrontAction.KIND; | ||
@@ -616,0 +630,0 @@ elementIDs: string[] |
@@ -17,4 +17,3 @@ /******************************************************************************** | ||
import 'mocha'; | ||
import { expect } from 'chai'; | ||
import { expect, describe, it } from 'vitest'; | ||
import { Action, ComputedBoundsAction, RequestBoundsAction, RequestModelAction, SetModelAction } from './actions'; | ||
@@ -38,3 +37,3 @@ import { DiagramServer } from './diagram-server'; | ||
} | ||
} | ||
}; | ||
next(); | ||
@@ -54,3 +53,3 @@ }); | ||
async a => { | ||
dispatched.push(a) | ||
dispatched.push(a); | ||
}, { | ||
@@ -183,5 +182,5 @@ DiagramGenerator: { | ||
const { server, actionHandlerRegistry, dispatched } = createServer(); | ||
actionHandlerRegistry.onAction('foo', (_, state, server) => { | ||
actionHandlerRegistry.onAction('foo', (_, state, serverHandler) => { | ||
state.revision = -7; | ||
server.dispatch({ kind: 'bar' }); | ||
serverHandler.dispatch({ kind: 'bar' }); | ||
return Promise.resolve(); | ||
@@ -197,5 +196,5 @@ }); | ||
const { server, actionHandlerRegistry, dispatched } = createServer(); | ||
const handler: ServerActionHandler = (_, state, server) => { | ||
const handler: ServerActionHandler = (_, state, serverHandler) => { | ||
state.revision = -7; | ||
server.dispatch({ kind: 'bar' }); | ||
serverHandler.dispatch({ kind: 'bar' }); | ||
return Promise.resolve(); | ||
@@ -202,0 +201,0 @@ }; |
@@ -17,3 +17,3 @@ /******************************************************************************** | ||
import { ServerActionHandler, ServerActionHandlerRegistry } from './action-handler'; | ||
import { ServerActionHandlerRegistry } from './action-handler'; | ||
import { | ||
@@ -59,21 +59,2 @@ Action, isResponseAction, ResponseAction, RequestModelAction, ComputedBoundsAction, LayoutAction, RequestBoundsAction, | ||
/** | ||
* @deprecated Use the `ServerActionHandlerRegistry` service instead | ||
*/ | ||
onAction<A extends Action>(kind: string, handler: ServerActionHandler<A>) { | ||
if (!this.actionHandlerRegistry) { | ||
this.actionHandlerRegistry = new ServerActionHandlerRegistry(); | ||
} | ||
this.actionHandlerRegistry.onAction(kind, handler); | ||
} | ||
/** | ||
* @deprecated Use the `ServerActionHandlerRegistry` service instead | ||
*/ | ||
removeActionHandler<A extends Action>(kind: string, handler: ServerActionHandler<A>) { | ||
if (this.actionHandlerRegistry) { | ||
this.actionHandlerRegistry.removeActionHandler(kind, handler); | ||
} | ||
} | ||
/** | ||
* Set the model and submit it to the client. | ||
@@ -80,0 +61,0 @@ */ |
@@ -17,4 +17,3 @@ /******************************************************************************** | ||
import "mocha"; | ||
import { expect } from "chai"; | ||
import { expect, describe, it } from 'vitest'; | ||
import { SModelRoot } from './model'; | ||
@@ -21,0 +20,0 @@ import { SModelIndex } from './utils/model-utils'; |
@@ -63,2 +63,12 @@ /******************************************************************************** | ||
/** | ||
* Usually the root of a model is also a viewport. | ||
*/ | ||
export interface ViewportRootElement extends SModelRoot { | ||
scroll?: Point | ||
zoom?: number | ||
position?: Point | ||
size?: Dimension | ||
} | ||
/** | ||
* A scrollable element has a scroll position, which indicates the top left corner of the | ||
@@ -65,0 +75,0 @@ * visible area. |
@@ -17,4 +17,3 @@ /******************************************************************************** | ||
import { Deferred } from "./async"; | ||
import "mocha"; | ||
import { expect } from "chai"; | ||
import { expect, describe, it } from 'vitest'; | ||
@@ -21,0 +20,0 @@ describe('Deferred', () => { |
@@ -17,4 +17,3 @@ /******************************************************************************** | ||
import "mocha"; | ||
import { expect } from "chai"; | ||
import { expect, describe, it } from 'vitest'; | ||
import { almostEquals, Bounds, angleBetweenPoints, Point } from "./geometry"; | ||
@@ -21,0 +20,0 @@ |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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 2 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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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 2 instances in 1 package
0
4869
255234