canvas-editor-engine 2.1.3 → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -17,18 +17,16 @@ import ProjectsService from "./services/projects.service";
17
17
  import PullProjectService from "./services/pull-project.service";
18
18
  import AppStore from "./store/store";
19
19
  declare class CanvasEditorEngine {
20
- private appConfig;
21
- constructor(appConfig: AppConfig);
20
+ constructor();
22
21
  getInitial(): {
23
- tag: string;
24
22
  component: typeof WebComponent;
25
23
  };
26
24
  }
27
25
  declare class StaticCanvasEditorEngine extends CanvasEditorEngine {
28
- constructor(appConfig: AppConfig);
26
+ constructor();
29
27
  init(): void;
30
28
  }
31
29
  declare class VueCanvasEditorEngine extends CanvasEditorEngine {
32
- constructor(appConfig: AppConfig);
30
+ constructor();
33
31
  }
34
32
  export { AppConfig, PipetteComponent, CanvasComponent, ExcretionComponent, SlotComponent, LoadingComponent, ToolService, DrawService, LoggerService, CropService, DownloadService, ToolLayerService, EventService, ThroughHistoryService, ProjectsService, PullProjectService, StaticCanvasEditorEngine, VueCanvasEditorEngine, AppStore, };
package/dist/index.mjs CHANGED
@@ -1567,43 +1567,39 @@ var WebComponent = function(_super) {
1567
1567
  var shadowRoot = _this.attachShadow({
1568
1568
  mode: "open"
1569
1569
  });
1570
+ _this.webComponentWrapper = new WebComponentWrapper;
1571
+ shadowRoot.appendChild(_this.webComponentWrapper.baseElement);
1572
+ return _this;
1573
+ }
1574
+ WebComponent.prototype.init = function(appConfig) {
1575
+ this.appConfig = appConfig;
1570
1576
  var loggerService = new LoggerService;
1571
- var toolLayerService = new ToolLayerService(_this.appConfig);
1577
+ var toolLayerService = new ToolLayerService(this.appConfig);
1572
1578
  var eventService = new EventService;
1573
- var webComponentWrapper = new WebComponentWrapper;
1574
- _this.canvasComponent = new CanvasComponent(_this.appConfig, loggerService, toolLayerService);
1575
- var toolService = new ToolService(_this.canvasComponent);
1579
+ this.canvasComponent = new CanvasComponent(this.appConfig, loggerService, toolLayerService);
1580
+ var toolService = new ToolService(this.canvasComponent);
1576
1581
  var appStoreRepository = new AppStoreRepository;
1577
- var throughHistoryService = new ThroughHistoryService(_this.appConfig, appStoreRepository);
1582
+ var throughHistoryService = new ThroughHistoryService(this.appConfig, appStoreRepository);
1578
1583
  new AppStore(throughHistoryService, appStoreRepository);
1579
- var _a = _this.canvasComponent.getComponent(), canvasTemplate = _a.canvasTemplate, canvasStyle = _a.canvasStyle;
1580
- _this.canvasElement = webComponentWrapper.editorWrap.add(canvasTemplate, canvasStyle);
1581
- var pipetteComponent = new PipetteComponent(toolService, loggerService, _this.canvasComponent);
1584
+ var _a = this.canvasComponent.getComponent(), canvasTemplate = _a.canvasTemplate, canvasStyle = _a.canvasStyle;
1585
+ this.canvasElement = this.webComponentWrapper.editorWrap.add(canvasTemplate, canvasStyle);
1586
+ var pipetteComponent = new PipetteComponent(toolService, loggerService, this.canvasComponent);
1582
1587
  var _b = pipetteComponent.getComponent(), pipetteTemplate = _b.pipetteTemplate, pipetteStyle = _b.pipetteStyle;
1583
- webComponentWrapper.editorWrap.add(pipetteTemplate, pipetteStyle);
1588
+ this.webComponentWrapper.editorWrap.add(pipetteTemplate, pipetteStyle);
1584
1589
  var slotComponent = new SlotComponent(loggerService);
1585
1590
  var _c = slotComponent.getComponent("tools"), slotTemplate = _c.slotTemplate, slotStyle = _c.slotStyle;
1586
- webComponentWrapper.toolsWrap.add(slotTemplate, slotStyle);
1587
- var excretionsComponent = new ExcretionsComponent(toolService, loggerService, toolLayerService, _this.canvasComponent);
1588
- new CropService(_this.appConfig, appStoreRepository, excretionsComponent);
1591
+ this.webComponentWrapper.toolsWrap.add(slotTemplate, slotStyle);
1592
+ var excretionsComponent = new ExcretionsComponent(toolService, loggerService, toolLayerService, this.canvasComponent);
1593
+ new CropService(this.appConfig, appStoreRepository, excretionsComponent);
1589
1594
  var _d = excretionsComponent.getComponent(), excretionsTemplate = _d.excretionsTemplate, excretionsStyle = _d.excretionsStyle;
1590
- webComponentWrapper.editorWrap.add(excretionsTemplate, excretionsStyle);
1595
+ this.webComponentWrapper.editorWrap.add(excretionsTemplate, excretionsStyle);
1591
1596
  var loadingComponent = new LoadingComponent(loggerService, eventService);
1592
1597
  var _e = loadingComponent.getComponent(), loadingTemplate = _e.loadingTemplate, loadingStyle = _e.loadingStyle;
1593
- webComponentWrapper.editorWrap.add(loadingTemplate, loadingStyle);
1594
- shadowRoot.appendChild(webComponentWrapper.baseElement);
1595
- _this.canvasComponent.simulateSubscriptions();
1596
- eventService.applyEvents(webComponentWrapper.baseElement);
1597
- _this.addEventListener("initial", (function() {
1598
- _this.dispatchEvent(new CustomEvent("get-editor-element", {
1599
- detail: {
1600
- editorElement: _this.canvasElement,
1601
- canvasSelector: _this.canvasComponent.getCanvasSelector()
1602
- }
1603
- }));
1604
- }));
1605
- return _this;
1606
- }
1598
+ this.webComponentWrapper.editorWrap.add(loadingTemplate, loadingStyle);
1599
+ this.canvasComponent.simulateSubscriptions();
1600
+ eventService.applyEvents(this.webComponentWrapper.baseElement);
1601
+ return this.initial();
1602
+ };
1607
1603
  WebComponent.prototype.initial = function() {
1608
1604
  return {
1609
1605
  editorElement: this.canvasElement,
@@ -2206,15 +2202,9 @@ var PullProjectService = function() {
2206
2202
  reflect();
2207
2203
 
2208
2204
  var CanvasEditorEngine = function() {
2209
- function CanvasEditorEngine(appConfig) {
2210
- this.appConfig = appConfig;
2211
- }
2205
+ function CanvasEditorEngine() {}
2212
2206
  CanvasEditorEngine.prototype.getInitial = function() {
2213
- Object.defineProperty(WebComponent.prototype, "appConfig", {
2214
- value: this.appConfig
2215
- });
2216
2207
  return {
2217
- tag: this.appConfig.WEB_COMPONENT_TAG_NAME,
2218
2208
  component: WebComponent
2219
2209
  };
2220
2210
  };
@@ -2223,21 +2213,21 @@ var CanvasEditorEngine = function() {
2223
2213
 
2224
2214
  var StaticCanvasEditorEngine = function(_super) {
2225
2215
  __extends(StaticCanvasEditorEngine, _super);
2226
- function StaticCanvasEditorEngine(appConfig) {
2227
- return _super.call(this, appConfig) || this;
2216
+ function StaticCanvasEditorEngine() {
2217
+ return _super.call(this) || this;
2228
2218
  }
2229
2219
  StaticCanvasEditorEngine.prototype.init = function() {
2230
2220
  var customElementRegistry = window.customElements;
2231
- var _a = this.getInitial(), tag = _a.tag, component = _a.component;
2232
- customElementRegistry.define(tag, component);
2221
+ var component = this.getInitial().component;
2222
+ customElementRegistry.define("canvas-editor-engine", component);
2233
2223
  };
2234
2224
  return StaticCanvasEditorEngine;
2235
2225
  }(CanvasEditorEngine);
2236
2226
 
2237
2227
  var VueCanvasEditorEngine = function(_super) {
2238
2228
  __extends(VueCanvasEditorEngine, _super);
2239
- function VueCanvasEditorEngine(appConfig) {
2240
- return _super.call(this, appConfig) || this;
2229
+ function VueCanvasEditorEngine() {
2230
+ return _super.call(this) || this;
2241
2231
  }
2242
2232
  return VueCanvasEditorEngine;
2243
2233
  }(CanvasEditorEngine);
@@ -27,7 +27,12 @@ export default class WebComponent extends HTMLElement {
27
27
  appConfig: AppConfig;
28
28
  canvasComponent: CanvasComponent;
29
29
  canvasElement: HTMLDivElement;
30
+ webComponentWrapper: WebComponentWrapper;
30
31
  constructor();
32
+ init(appConfig: AppConfig): {
33
+ editorElement: HTMLDivElement;
34
+ canvasSelector: string;
35
+ };
31
36
  initial(): {
32
37
  editorElement: HTMLDivElement;
33
38
  canvasSelector: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",