@visactor/vrender-core
Version:
```typescript import { xxx } from '@visactor/vrender-core'; ```
58 lines (38 loc) • 3.1 kB
JavaScript
import { application } from "./application";
import { GraphicService } from "./graphic/constants";
import { DynamicLayerHandlerContribution, GraphicUtil, LayerService, StaticLayerHandlerContribution, TransformUtil, VirtualLayerHandlerContribution } from "./core/constants";
import { RenderService } from "./render/constants";
import { PluginService } from "./plugins/constants";
import { PickerService } from "./picker/constants";
import { CanvasFactory, Context2dFactory } from "./canvas/constants";
import { IncrementalDrawContribution } from "./render/contributions/render/symbol";
import { DefaultWindow, WindowHandlerContribution } from "./core/window";
import { vglobal } from "./global";
import { createLegacySingletonProxy, getLegacyBindingContext, resolveLegacyNamed, resolveLegacySingleton } from "./legacy/bootstrap";
export { vglobal } from "./global";
export { preLoadAllModule, getLegacyBindingContext } from "./legacy/bootstrap";
export const container = getLegacyBindingContext();
export const graphicUtil = createLegacySingletonProxy((() => resolveLegacySingleton(GraphicUtil)));
export const transformUtil = createLegacySingletonProxy((() => resolveLegacySingleton(TransformUtil)));
export const graphicService = createLegacySingletonProxy((() => resolveLegacySingleton(GraphicService)));
export const layerService = createLegacySingletonProxy((() => resolveLegacySingleton(LayerService)));
function resolveLegacyWindowHandler(env) {
const handler = resolveLegacyNamed(WindowHandlerContribution, env);
if (!handler) throw new Error(`Window handler is not configured for env: ${env}`);
return handler;
}
export function configureLegacyApplication() {
application.global = vglobal, application.graphicUtil = graphicUtil, application.transformUtil = transformUtil,
application.graphicService = graphicService, application.layerService = layerService,
application.canvasFactory = env => resolveLegacyNamed(CanvasFactory, env), application.context2dFactory = env => resolveLegacyNamed(Context2dFactory, env),
application.windowFactory = () => new DefaultWindow(application.global), application.windowHandlerFactory = env => resolveLegacyWindowHandler(env),
application.renderServiceFactory = () => resolveLegacySingleton(RenderService),
application.renderService = createLegacySingletonProxy((() => resolveLegacySingleton(RenderService))),
application.pluginServiceFactory = () => resolveLegacySingleton(PluginService),
application.pluginService = createLegacySingletonProxy((() => resolveLegacySingleton(PluginService))),
application.pickerServiceFactory = () => resolveLegacySingleton(PickerService),
application.layerHandlerFactory = layerMode => resolveLegacySingleton("static" === layerMode ? StaticLayerHandlerContribution : "dynamic" === layerMode ? DynamicLayerHandlerContribution : VirtualLayerHandlerContribution),
application.incrementalDrawContributionFactory = () => resolveLegacySingleton(IncrementalDrawContribution);
}
configureLegacyApplication();
//# sourceMappingURL=modules.js.map