SequenceDiagram/scripts/sequence/components/BaseComponent.js

89 lines
1.3 KiB
JavaScript

define(() => {
'use strict';
class BaseComponent {
makeState(/*state*/) {
}
resetState(state) {
this.makeState(state);
}
separationPre(/*stage, {
theme,
agentInfos,
visibleAgents,
textSizer,
addSpacing,
addSeparation,
state,
components,
}*/) {
}
separation(/*stage, {
theme,
agentInfos,
visibleAgents,
textSizer,
addSpacing,
addSeparation,
state,
components,
}*/) {
}
renderPre(/*stage, {
theme,
agentInfos,
textSizer,
state,
components,
}*/) {
// return {topShift, agentNames, asynchronousY}
}
render(/*stage, {
topY,
primaryY,
blockLayer,
shapeLayer,
labelLayer,
theme,
agentInfos,
textSizer,
SVGTextBlockClass,
addDef,
makeRegion,
state,
components,
}*/) {
// return bottom Y coordinate
}
}
BaseComponent.cleanRenderPreResult = ({
topShift = 0,
agentNames = [],
asynchronousY = null,
} = {}, currentY = null) => {
return {
topShift,
agentNames,
asynchronousY: (asynchronousY !== null) ? asynchronousY : currentY,
};
};
const components = new Map();
BaseComponent.register = (name, component) => {
components.set(name, component);
};
BaseComponent.getComponents = () => {
return components;
};
return BaseComponent;
});