canvas-editor-engine 2.1.31 → 2.2.1

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/config.d.ts CHANGED
@@ -9,7 +9,7 @@ export declare class ConfigFabric {
9
9
  protected _ZOOM: number;
10
10
  }
11
11
  export default class AppConfig extends ConfigFabric {
12
- private _canvas;
12
+ canvas: HTMLCanvasElement | null;
13
13
  constructor();
14
14
  bindCanvas(canvasElement: HTMLDivElement): void;
15
15
  get CANVAS_SIZE(): ICanvasSize;
package/dist/index.mjs CHANGED
@@ -29,6 +29,120 @@ var __assign = function() {
29
29
  return __assign.apply(this, arguments);
30
30
  };
31
31
 
32
+ function __awaiter(thisArg, _arguments, P, generator) {
33
+ function adopt(value) {
34
+ return value instanceof P ? value : new P((function(resolve) {
35
+ resolve(value);
36
+ }));
37
+ }
38
+ return new (P || (P = Promise))((function(resolve, reject) {
39
+ function fulfilled(value) {
40
+ try {
41
+ step(generator.next(value));
42
+ } catch (e) {
43
+ reject(e);
44
+ }
45
+ }
46
+ function rejected(value) {
47
+ try {
48
+ step(generator["throw"](value));
49
+ } catch (e) {
50
+ reject(e);
51
+ }
52
+ }
53
+ function step(result) {
54
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
55
+ }
56
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
57
+ }));
58
+ }
59
+
60
+ function __generator(thisArg, body) {
61
+ var _ = {
62
+ label: 0,
63
+ sent: function() {
64
+ if (t[0] & 1) throw t[1];
65
+ return t[1];
66
+ },
67
+ trys: [],
68
+ ops: []
69
+ }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
70
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
71
+ return this;
72
+ }), g;
73
+ function verb(n) {
74
+ return function(v) {
75
+ return step([ n, v ]);
76
+ };
77
+ }
78
+ function step(op) {
79
+ if (f) throw new TypeError("Generator is already executing.");
80
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
81
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y),
82
+ 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
83
+ if (y = 0, t) op = [ op[0] & 2, t.value ];
84
+ switch (op[0]) {
85
+ case 0:
86
+ case 1:
87
+ t = op;
88
+ break;
89
+
90
+ case 4:
91
+ _.label++;
92
+ return {
93
+ value: op[1],
94
+ done: false
95
+ };
96
+
97
+ case 5:
98
+ _.label++;
99
+ y = op[1];
100
+ op = [ 0 ];
101
+ continue;
102
+
103
+ case 7:
104
+ op = _.ops.pop();
105
+ _.trys.pop();
106
+ continue;
107
+
108
+ default:
109
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
110
+ _ = 0;
111
+ continue;
112
+ }
113
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
114
+ _.label = op[1];
115
+ break;
116
+ }
117
+ if (op[0] === 6 && _.label < t[1]) {
118
+ _.label = t[1];
119
+ t = op;
120
+ break;
121
+ }
122
+ if (t && _.label < t[2]) {
123
+ _.label = t[2];
124
+ _.ops.push(op);
125
+ break;
126
+ }
127
+ if (t[2]) _.ops.pop();
128
+ _.trys.pop();
129
+ continue;
130
+ }
131
+ op = body.call(thisArg, _);
132
+ } catch (e) {
133
+ op = [ 6, e ];
134
+ y = 0;
135
+ } finally {
136
+ f = t = 0;
137
+ }
138
+ if (op[0] & 5) throw op[1];
139
+ return {
140
+ value: op[0] ? op[1] : void 0,
141
+ done: true
142
+ };
143
+ }
144
+ }
145
+
32
146
  function __spreadArray(to, from, pack) {
33
147
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
34
148
  if (ar || !(i in from)) {
@@ -69,7 +183,7 @@ var AppConfig = function(_super) {
69
183
  __extends(AppConfig, _super);
70
184
  function AppConfig() {
71
185
  var _this = _super.call(this) || this;
72
- _this._canvas = null;
186
+ _this.canvas = null;
73
187
  _this._CANVAS_SIZE = {
74
188
  width: 300,
75
189
  height: 150
@@ -88,8 +202,7 @@ var AppConfig = function(_super) {
88
202
  return _this;
89
203
  }
90
204
  AppConfig.prototype.bindCanvas = function(canvasElement) {
91
- var canvas = canvasElement.querySelector("canvas");
92
- this._canvas = canvas;
205
+ this.canvas = canvasElement.querySelector("canvas");
93
206
  };
94
207
  Object.defineProperty(AppConfig.prototype, "CANVAS_SIZE", {
95
208
  get: function() {
@@ -98,9 +211,9 @@ var AppConfig = function(_super) {
98
211
  set: function(value) {
99
212
  if (!!value && !!(value === null || value === void 0 ? void 0 : value.width) && !!(value === null || value === void 0 ? void 0 : value.height)) {
100
213
  this._CANVAS_SIZE = value;
101
- if (!!this._canvas) {
102
- this._canvas.width = value.width;
103
- this._canvas.height = value.height;
214
+ if (!!this.canvas) {
215
+ this.canvas.width = value.width;
216
+ this.canvas.height = value.height;
104
217
  }
105
218
  } else {
106
219
  console.warn("CANVAS_SIZE denied");
@@ -1911,41 +2024,242 @@ var VagueFilter = function(_super) {
1911
2024
  return VagueFilter;
1912
2025
  }(Filter);
1913
2026
 
2027
+ var DrawAccumulator = function() {
2028
+ function DrawAccumulator(appConfig, appStoreRepository, eventService) {
2029
+ this.appConfig = appConfig;
2030
+ this.appStoreRepository = appStoreRepository;
2031
+ this.eventService = eventService;
2032
+ this.painters = new Proxy([], {
2033
+ get: function(target, name) {
2034
+ return target[name];
2035
+ },
2036
+ set: function(target, name, value) {
2037
+ try {
2038
+ if (typeof (value === null || value === void 0 ? void 0 : value.object) !== "undefined") {
2039
+ target[name] = value.object;
2040
+ value.update();
2041
+ return true;
2042
+ } else {
2043
+ if (name != "length") {
2044
+ console.warn("Proxy set error: object denied");
2045
+ return false;
2046
+ } else {
2047
+ var numSkipped = void 0;
2048
+ var MIN_LENGTH = -1;
2049
+ var MAX_LENGTH = __spreadArray([], Object.keys(target), true);
2050
+ if (value <= Math.max.apply(Math, __spreadArray([ MIN_LENGTH ], MAX_LENGTH, false)) + 1) {
2051
+ target.length = value;
2052
+ }
2053
+ numSkipped = 0;
2054
+ }
2055
+ return true;
2056
+ }
2057
+ } catch (error) {
2058
+ console.error("Proxy set error:", error);
2059
+ return false;
2060
+ }
2061
+ }
2062
+ });
2063
+ }
2064
+ DrawAccumulator.prototype.add = function(layer, drawType, options) {
2065
+ return __awaiter(this, void 0, void 0, (function() {
2066
+ var id, painter, inStore;
2067
+ return __generator(this, (function(_a) {
2068
+ id = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
2069
+ painter = {
2070
+ drawService: new DrawService(this.appConfig, this.appStoreRepository, this.eventService),
2071
+ drawType,
2072
+ id
2073
+ };
2074
+ painter.drawService.bindOptions(drawType, layer, options);
2075
+ this.painters.push({
2076
+ object: painter,
2077
+ update: this.update.bind(this)
2078
+ });
2079
+ inStore = true;
2080
+ this.invokePainter(drawType, painter.drawService, inStore);
2081
+ return [ 2 ];
2082
+ }));
2083
+ }));
2084
+ };
2085
+ DrawAccumulator.prototype.remove = function(id) {
2086
+ return __awaiter(this, void 0, void 0, (function() {
2087
+ var painter;
2088
+ return __generator(this, (function(_a) {
2089
+ painter = this.painters.find((function(painter) {
2090
+ return painter.id === id;
2091
+ }));
2092
+ if (!!painter) {
2093
+ this.painters = this.painters.filter((function(painter) {
2094
+ return painter.id !== id;
2095
+ }));
2096
+ }
2097
+ return [ 2 ];
2098
+ }));
2099
+ }));
2100
+ };
2101
+ DrawAccumulator.prototype.update = function() {
2102
+ this.clearCanvas();
2103
+ this.invokePaintersOnLayers();
2104
+ };
2105
+ Object.defineProperty(DrawAccumulator.prototype, "gradient", {
2106
+ get: function() {
2107
+ var gradient = [];
2108
+ this.painters.forEach((function(painter) {
2109
+ gradient.push(painter.drawService.layer);
2110
+ }));
2111
+ return gradient.sort((function(a, b) {
2112
+ return a - b;
2113
+ }));
2114
+ },
2115
+ enumerable: false,
2116
+ configurable: true
2117
+ });
2118
+ DrawAccumulator.prototype.clearCanvas = function() {
2119
+ var ctx = this.appConfig.canvas.getContext("2d");
2120
+ ctx.clearRect(0, 0, this.appConfig.CANVAS_SIZE.width, this.appConfig.CANVAS_SIZE.height);
2121
+ };
2122
+ DrawAccumulator.prototype.invokePaintersOnLayers = function() {
2123
+ var _this = this;
2124
+ var stash = [];
2125
+ this.gradient.forEach((function(order) {
2126
+ _this.painters.forEach((function(painter) {
2127
+ if (!stash.includes(painter) && painter.drawService.layer === order) {
2128
+ _this.invokePainter(painter.drawType, painter.drawService);
2129
+ stash.push(painter);
2130
+ }
2131
+ }));
2132
+ }));
2133
+ };
2134
+ DrawAccumulator.prototype.invokePainter = function(drawType_1, painter_1) {
2135
+ return __awaiter(this, arguments, void 0, (function(drawType, painter, inStore) {
2136
+ var _a, reduceData, message, isAddToStore, _b, reduceData, message, isAddToStore;
2137
+ if (inStore === void 0) {
2138
+ inStore = false;
2139
+ }
2140
+ return __generator(this, (function(_c) {
2141
+ switch (_c.label) {
2142
+ case 0:
2143
+ if (!(drawType === "image")) return [ 3, 2 ];
2144
+ return [ 4, painter.drawImage(inStore) ];
2145
+
2146
+ case 1:
2147
+ _a = _c.sent(), reduceData = _a.reduceData, message = _a.message;
2148
+ isAddToStore = !!reduceData && !!message && inStore;
2149
+ if (isAddToStore) {
2150
+ this.appStoreRepository.store.imageState.reduce(reduceData, message);
2151
+ }
2152
+ return [ 3, 4 ];
2153
+
2154
+ case 2:
2155
+ if (!(drawType === "project")) return [ 3, 4 ];
2156
+ return [ 4, painter.drawProject(inStore) ];
2157
+
2158
+ case 3:
2159
+ _b = _c.sent(), reduceData = _b.reduceData, message = _b.message;
2160
+ isAddToStore = !!reduceData && !!message && inStore;
2161
+ if (isAddToStore) {
2162
+ this.appStoreRepository.store.imageState.reduce(reduceData, message);
2163
+ }
2164
+ _c.label = 4;
2165
+
2166
+ case 4:
2167
+ return [ 2 ];
2168
+ }
2169
+ }));
2170
+ }));
2171
+ };
2172
+ return DrawAccumulator;
2173
+ }();
2174
+
1914
2175
  var DrawService = function() {
1915
2176
  function DrawService(appConfig, appStoreRepository, eventService) {
1916
2177
  this.appConfig = appConfig;
1917
2178
  this.appStoreRepository = appStoreRepository;
1918
2179
  this.eventService = eventService;
2180
+ this.options = {
2181
+ image: null,
2182
+ project: null
2183
+ };
2184
+ this.id = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
1919
2185
  }
1920
- DrawService.prototype.drawImage = function(ctx, src, options) {
1921
- var _this = this;
1922
- this.imageProcessor = new SCImage(this.appConfig, src, ctx);
1923
- this.imageProcessor.draw(options).then((function() {
1924
- var filter = new Filter(_this.appConfig, ctx);
1925
- var zeroPosition = {
1926
- x: 0,
1927
- y: 0
1928
- };
1929
- var imageData = filter.copy(zeroPosition);
1930
- console.log(_this);
1931
- _this.appStoreRepository.store.imageState.reduce({
1932
- tempImageData: imageData,
1933
- position: zeroPosition,
1934
- size: _this.appConfig.CANVAS_SIZE
1935
- }, "Loaded image");
2186
+ DrawService.prototype.bindOptions = function(drawType, layer, options) {
2187
+ this.layer = layer;
2188
+ this.options[drawType] = options;
2189
+ };
2190
+ DrawService.prototype.drawImage = function() {
2191
+ return __awaiter(this, arguments, void 0, (function(isReturnReduceData) {
2192
+ var _a, src, drawImageArgs, ctx;
2193
+ var _this = this;
2194
+ if (isReturnReduceData === void 0) {
2195
+ isReturnReduceData = false;
2196
+ }
2197
+ return __generator(this, (function(_b) {
2198
+ switch (_b.label) {
2199
+ case 0:
2200
+ _a = this.options.image, src = _a.src, drawImageArgs = _a.drawImageArgs;
2201
+ ctx = this.appConfig.canvas.getContext("2d");
2202
+ this.imageProcessor = new ImageObject(this.appConfig, src, ctx);
2203
+ return [ 4, this.imageProcessor.draw(drawImageArgs).then((function() {
2204
+ var responseData = {
2205
+ reduceData: null,
2206
+ message: null
2207
+ };
2208
+ if (!isReturnReduceData) return responseData;
2209
+ var zeroPosition = {
2210
+ x: 0,
2211
+ y: 0
2212
+ };
2213
+ var filter = new Filter(_this.appConfig, ctx);
2214
+ var imageData = filter.copy(zeroPosition);
2215
+ responseData.reduceData = {
2216
+ tempImageData: imageData,
2217
+ position: zeroPosition,
2218
+ size: _this.appConfig.CANVAS_SIZE
2219
+ };
2220
+ responseData.message = "Image loaded";
2221
+ return responseData;
2222
+ })) ];
2223
+
2224
+ case 1:
2225
+ return [ 2, _b.sent() ];
2226
+ }
2227
+ }));
1936
2228
  }));
1937
2229
  };
1938
- DrawService.prototype.drawProject = function(ctx, project) {
1939
- var imageData = project.state.current.imageData;
1940
- var position = project.state.current.position;
1941
- var size = project.state.current.size;
1942
- this.imageProcessor = new PCImage(this.appConfig, project, ctx);
1943
- this.imageProcessor.draw();
1944
- this.appStoreRepository.store.imageState.reduce({
1945
- tempImageData: imageData,
1946
- position,
1947
- size
1948
- }, "Loaded project");
2230
+ DrawService.prototype.drawProject = function() {
2231
+ return __awaiter(this, arguments, void 0, (function(isReturnReduceData) {
2232
+ var project, ctx, imageData, position, size;
2233
+ var _this = this;
2234
+ if (isReturnReduceData === void 0) {
2235
+ isReturnReduceData = false;
2236
+ }
2237
+ return __generator(this, (function(_a) {
2238
+ project = this.options.project;
2239
+ ctx = this.appConfig.canvas.getContext("2d");
2240
+ imageData = project.state.current.imageData;
2241
+ position = project.state.current.position;
2242
+ size = project.state.current.size;
2243
+ this.imageProcessor = new ProjectImageObject(this.appConfig, project, ctx);
2244
+ return [ 2, new Promise((function(resolve) {
2245
+ _this.imageProcessor.draw();
2246
+ resolve(null);
2247
+ })).then((function() {
2248
+ var responseData = {
2249
+ reduceData: null,
2250
+ message: null
2251
+ };
2252
+ if (!isReturnReduceData) return responseData;
2253
+ responseData.reduceData = {
2254
+ tempImageData: imageData,
2255
+ position,
2256
+ size
2257
+ };
2258
+ responseData.message = "Project loaded";
2259
+ return responseData;
2260
+ })) ];
2261
+ }));
2262
+ }));
1949
2263
  };
1950
2264
  DrawService.prototype.drawSmoothImage = function(useStore, options, filterOptions) {
1951
2265
  var _this = this;
@@ -1998,14 +2312,14 @@ var DrawService = function() {
1998
2312
  return DrawService;
1999
2313
  }();
2000
2314
 
2001
- var SCImage = function() {
2002
- function SCImage(appConfig, src, ctx) {
2315
+ var ImageObject = function() {
2316
+ function ImageObject(appConfig, src, ctx) {
2003
2317
  this.appConfig = appConfig;
2004
2318
  this.img = new Image;
2005
2319
  this.img.src = src;
2006
2320
  this.ctx = ctx;
2007
2321
  }
2008
- SCImage.prototype.draw = function(options) {
2322
+ ImageObject.prototype.draw = function(options) {
2009
2323
  var _this = this;
2010
2324
  var proto = this;
2011
2325
  var protoImg = this.img;
@@ -2031,20 +2345,20 @@ var SCImage = function() {
2031
2345
  }
2032
2346
  }));
2033
2347
  };
2034
- SCImage.prototype.vague = function(options, filterOptions) {
2348
+ ImageObject.prototype.vague = function(options, filterOptions) {
2035
2349
  var filter = new VagueFilter(this.appConfig, this.ctx, options);
2036
2350
  return filter.on("pixel", filterOptions);
2037
2351
  };
2038
- return SCImage;
2352
+ return ImageObject;
2039
2353
  }();
2040
2354
 
2041
- var PCImage = function() {
2042
- function PCImage(appConfig, project, ctx) {
2355
+ var ProjectImageObject = function() {
2356
+ function ProjectImageObject(appConfig, project, ctx) {
2043
2357
  this.appConfig = appConfig;
2044
2358
  this.project = project;
2045
2359
  this.ctx = ctx;
2046
2360
  }
2047
- PCImage.prototype.draw = function(options) {
2361
+ ProjectImageObject.prototype.draw = function(options) {
2048
2362
  var _this = this;
2049
2363
  var _a = this.project.state.current, imageData = _a.imageData, position = _a.position;
2050
2364
  return new Promise((function(resolve, reject) {
@@ -2058,11 +2372,11 @@ var PCImage = function() {
2058
2372
  }
2059
2373
  }));
2060
2374
  };
2061
- PCImage.prototype.vague = function(options, filterOptions) {
2375
+ ProjectImageObject.prototype.vague = function(options, filterOptions) {
2062
2376
  var filter = new VagueFilter(this.appConfig, this.ctx, options);
2063
2377
  return filter.on("pixel", filterOptions);
2064
2378
  };
2065
- return PCImage;
2379
+ return ProjectImageObject;
2066
2380
  }();
2067
2381
 
2068
2382
  var DownloadService = function() {
@@ -2207,6 +2521,7 @@ var WebComponent = function(_super) {
2207
2521
  this.appStore = new AppStore(this.throughHistoryService, this.appStoreRepository);
2208
2522
  this.pullProjectService = new PullProjectService(this.throughHistoryService, this.appStoreRepository);
2209
2523
  this.drawService = new DrawService(this.appConfig, this.appStoreRepository, this.eventService);
2524
+ this.drawAccumulator = new DrawAccumulator(this.appConfig, this.appStoreRepository, this.eventService);
2210
2525
  this.downloadService = new DownloadService(this.canvasComponent);
2211
2526
  var _a = this.canvasComponent.getComponent(), canvasTemplate = _a.canvasTemplate, canvasStyle = _a.canvasStyle;
2212
2527
  this.canvasElement = this.webComponentWrapper.editorWrap.add(canvasTemplate, canvasStyle);
@@ -2234,6 +2549,16 @@ var WebComponent = function(_super) {
2234
2549
  canvasSelector: this.canvasComponent.getCanvasSelector()
2235
2550
  };
2236
2551
  };
2552
+ WebComponent.prototype.restoreJSONProjects = function(jsonProjects) {
2553
+ var _this = this;
2554
+ var projectProcessor = this.projectsService.on("File");
2555
+ var serializer = projectProcessor.getSerializerInstance(jsonProjects);
2556
+ var projects = serializer.getProjects();
2557
+ projects.forEach((function(project, index) {
2558
+ _this.drawAccumulator.add(index, "project", project);
2559
+ }));
2560
+ this.throughHistoryService.recovery(projects[0]);
2561
+ };
2237
2562
  return WebComponent;
2238
2563
  }(HTMLElement);
2239
2564
 
@@ -1,21 +1,53 @@
1
1
  import AppConfig from "../config";
2
+ import { IImageStateReduce } from "../store/image.state";
2
3
  import AppStoreRepository from "../store/storeRepository";
4
+ import { IPainter, TDrawType } from "../types/draw-service";
3
5
  import type { IDrawImageArgs, IDrawImageProcessor, IFilterOptions, IImageLoggingDataVague, IImageOptions } from "../types/image";
4
6
  import { Project } from "../types/project";
5
7
  import EventService from "./event.service";
8
+ export declare class DrawAccumulator {
9
+ private appConfig;
10
+ private appStoreRepository;
11
+ private eventService;
12
+ painters: IPainter[];
13
+ constructor(appConfig: AppConfig, appStoreRepository: AppStoreRepository, eventService: EventService);
14
+ add<DrawType extends TDrawType>(layer: number, drawType: DrawType, options: DrawService['options'][DrawType]): Promise<void>;
15
+ remove(id: string): Promise<void>;
16
+ private update;
17
+ private get gradient();
18
+ private clearCanvas;
19
+ private invokePaintersOnLayers;
20
+ private invokePainter;
21
+ }
6
22
  export default class DrawService {
7
23
  private appConfig;
8
24
  private appStoreRepository;
9
25
  private eventService;
26
+ id: string;
27
+ layer: number;
10
28
  imageProcessor: IDrawImageProcessor;
29
+ options: {
30
+ image: {
31
+ src: string;
32
+ drawImageArgs: IDrawImageArgs;
33
+ } | null;
34
+ project: Project | null;
35
+ };
11
36
  constructor(appConfig: AppConfig, appStoreRepository: AppStoreRepository, eventService: EventService);
12
- drawImage(ctx: CanvasRenderingContext2D, src: string, options: IDrawImageArgs): void;
13
- drawProject(ctx: CanvasRenderingContext2D, project: Project): void;
37
+ bindOptions<DrawType extends TDrawType>(drawType: DrawType, layer: number, options: DrawService['options'][DrawType]): void;
38
+ drawImage(isReturnReduceData?: boolean): Promise<{
39
+ reduceData: IImageStateReduce | null;
40
+ message: string | null;
41
+ }>;
42
+ drawProject(isReturnReduceData?: boolean): Promise<{
43
+ reduceData: IImageStateReduce | null;
44
+ message: string | null;
45
+ }>;
14
46
  drawSmoothImage(useStore: boolean, options: IDrawImageArgs, filterOptions: IFilterOptions): void;
15
47
  updateImageStateAfterVague(data: IImageLoggingDataVague): void;
16
48
  getFilterArgs(useStore: boolean, options: IDrawImageArgs): IImageOptions;
17
49
  }
18
- export declare class SCImage implements IDrawImageProcessor {
50
+ export declare class ImageObject implements IDrawImageProcessor {
19
51
  private appConfig;
20
52
  private img;
21
53
  private ctx;
@@ -0,0 +1,7 @@
1
+ import DrawService from "../services/draw.service";
2
+ export type TDrawType = keyof DrawService['options'];
3
+ export interface IPainter {
4
+ drawService: DrawService;
5
+ drawType: TDrawType;
6
+ id: string;
7
+ }
@@ -15,7 +15,7 @@ import ThroughHistoryService from "./services/through-history.service";
15
15
  import AppStoreRepository from "./store/storeRepository";
16
16
  import ProjectsService from "./services/projects.service";
17
17
  import PullProjectService from "./services/pull-project.service";
18
- import DrawService from "./services/draw.service";
18
+ import DrawService, { DrawAccumulator } from "./services/draw.service";
19
19
  import DownloadService from "./services/download.service";
20
20
  import ResizeService from "./services/serize.service";
21
21
  export declare class WebComponentWrapper {
@@ -62,6 +62,7 @@ export default class WebComponent extends HTMLElement {
62
62
  drawService: DrawService;
63
63
  downloadService: DownloadService;
64
64
  resizeService: ResizeService;
65
+ drawAccumulator: DrawAccumulator;
65
66
  constructor();
66
67
  init(appConfig: AppConfig): {
67
68
  editorElement: HTMLDivElement;
@@ -71,4 +72,5 @@ export default class WebComponent extends HTMLElement {
71
72
  editorElement: HTMLDivElement;
72
73
  canvasSelector: string;
73
74
  };
75
+ restoreJSONProjects(jsonProjects: string): void;
74
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "2.1.31",
3
+ "version": "2.2.1",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",