canvas-editor-engine 2.3.17 → 2.3.19

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.
Files changed (56) hide show
  1. package/dist/components/canvas.component.js +102 -0
  2. package/dist/components/excretions.component.js +258 -0
  3. package/dist/components/loading.component.js +71 -0
  4. package/dist/components/pipette.component.js +120 -0
  5. package/dist/components/slot.component.js +45 -0
  6. package/dist/config.js +95 -0
  7. package/dist/filters/collection/vague.js +168 -0
  8. package/dist/filters/index.js +2 -0
  9. package/dist/index.d.ts +2 -1
  10. package/dist/index.js +75 -0
  11. package/dist/services/component.service.js +40 -0
  12. package/dist/services/crop.service.js +60 -0
  13. package/dist/services/download.service.js +16 -0
  14. package/dist/services/draw-accumulator.service.d.ts +25 -0
  15. package/dist/services/draw-accumulator.service.js +222 -0
  16. package/dist/services/draw-layers.service.d.ts +17 -0
  17. package/dist/services/draw-layers.service.js +72 -0
  18. package/dist/services/draw-leayers.service.js +72 -0
  19. package/dist/services/draw.service.d.ts +1 -21
  20. package/dist/services/draw.service.js +259 -0
  21. package/dist/services/event.service.js +45 -0
  22. package/dist/services/logger.service.js +57 -0
  23. package/dist/services/projects.service.js +103 -0
  24. package/dist/services/pull-project.service.js +40 -0
  25. package/dist/services/serize.service.js +23 -0
  26. package/dist/services/store.service.js +14 -0
  27. package/dist/services/through-history.service.js +51 -0
  28. package/dist/services/tool-layers.service.js +13 -0
  29. package/dist/services/tool.service.js +59 -0
  30. package/dist/store/draw-layers.state.js +85 -0
  31. package/dist/store/history.state.js +77 -0
  32. package/dist/store/image.state.js +80 -0
  33. package/dist/store/store.js +41 -0
  34. package/dist/store/storeRepository.js +6 -0
  35. package/dist/types/canvas.js +2 -0
  36. package/dist/types/cursor.js +2 -0
  37. package/dist/types/draw-layers.js +3 -0
  38. package/dist/types/draw-service.js +2 -0
  39. package/dist/types/excretion.js +4 -0
  40. package/dist/types/general.js +5 -0
  41. package/dist/types/history.js +1 -0
  42. package/dist/types/image.js +9 -0
  43. package/dist/types/log.js +4 -0
  44. package/dist/types/pipette.js +1 -0
  45. package/dist/types/project.js +14 -0
  46. package/dist/types/temp-canvas.js +2 -0
  47. package/dist/utils/convert.js +27 -0
  48. package/dist/utils/filter.js +153 -0
  49. package/dist/utils/generation.js +7 -0
  50. package/dist/utils/guid4.js +122 -0
  51. package/dist/utils/project-file-serializer.js +77 -0
  52. package/dist/utils/reflect.js +30 -0
  53. package/dist/utils/temp-canvas.js +19 -0
  54. package/dist/web-component.d.ts +4 -3
  55. package/dist/web-component.js +179 -0
  56. package/package.json +1 -1
@@ -0,0 +1,41 @@
1
+ import { DrawLayersState } from "./draw-layers.state";
2
+ import { HistoryState } from "./history.state";
3
+ import { ImageState } from "./image.state";
4
+ var Store = /** @class */ (function () {
5
+ function Store(imageState, historyState, drawLayersState) {
6
+ this.imageState = imageState;
7
+ this.historyState = historyState;
8
+ this.drawLayersState = drawLayersState;
9
+ }
10
+ ;
11
+ Store.prototype.reset = function () {
12
+ this.imageState.reset();
13
+ this.historyState.reset();
14
+ this.drawLayersState.reset();
15
+ };
16
+ return Store;
17
+ }());
18
+ export { Store };
19
+ var AppStore = /** @class */ (function () {
20
+ function AppStore(throughHistoryService, appStoreRepository) {
21
+ this.throughHistoryService = throughHistoryService;
22
+ this.appStoreRepository = appStoreRepository;
23
+ this.appStoreRepository.store = new Store(new ImageState(this.appStoreRepository), new HistoryState(this.throughHistoryService), new DrawLayersState(this.appStoreRepository));
24
+ }
25
+ AppStore.prototype.subscribe = function (to, completeIt) {
26
+ if (to === 'history') {
27
+ this.appStoreRepository.store.historyState.emerge(completeIt);
28
+ }
29
+ else if (to === 'layers') {
30
+ this.appStoreRepository.store.drawLayersState.emerge(completeIt);
31
+ }
32
+ };
33
+ AppStore.prototype.getHistoryLines = function () {
34
+ return this.appStoreRepository.store.historyState.historyLines;
35
+ };
36
+ AppStore.prototype.getLayers = function () {
37
+ return this.appStoreRepository.store.drawLayersState.layers;
38
+ };
39
+ return AppStore;
40
+ }());
41
+ export default AppStore;
@@ -0,0 +1,6 @@
1
+ var AppStoreRepository = /** @class */ (function () {
2
+ function AppStoreRepository() {
3
+ }
4
+ return AppStoreRepository;
5
+ }());
6
+ export default AppStoreRepository;
@@ -0,0 +1,2 @@
1
+ ;
2
+ export {};
@@ -0,0 +1,2 @@
1
+ ;
2
+ export {};
@@ -0,0 +1,3 @@
1
+ ;
2
+ ;
3
+ export {};
@@ -0,0 +1,2 @@
1
+ ;
2
+ export {};
@@ -0,0 +1,4 @@
1
+ ;
2
+ ;
3
+ ;
4
+ export {};
@@ -0,0 +1,5 @@
1
+ import { reflect } from "../utils/reflect";
2
+ reflect();
3
+ ;
4
+ ;
5
+ ;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ ;
2
+ ;
3
+ ;
4
+ ;
5
+ ;
6
+ ;
7
+ ;
8
+ ;
9
+ export {};
@@ -0,0 +1,4 @@
1
+ ;
2
+ ;
3
+ ;
4
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ var Project = /** @class */ (function () {
2
+ function Project() {
3
+ this.id = null;
4
+ this.name = null;
5
+ this.description = null;
6
+ this.state = null;
7
+ this.createdAt = new Date(Date.now()).toString();
8
+ this.updatedAt = new Date(Date.now()).toString();
9
+ }
10
+ return Project;
11
+ }());
12
+ export { Project };
13
+ ;
14
+ ;
@@ -0,0 +1,2 @@
1
+ ;
2
+ export {};
@@ -0,0 +1,27 @@
1
+ var Convert = /** @class */ (function () {
2
+ function Convert() {
3
+ }
4
+ Convert.byteRGBToHEX = function (color) {
5
+ var red = color[0];
6
+ var green = color[1];
7
+ var blue = color[2];
8
+ return Convert.rgbToHex(red, green, blue);
9
+ };
10
+ Convert.rgbToHex = function (r, g, b) {
11
+ return "#".concat(Convert.componentToHEX(r)).concat(Convert.componentToHEX(g)).concat(Convert.componentToHEX(b));
12
+ };
13
+ Convert.hexToRgb = function (hex) {
14
+ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
15
+ return result ? {
16
+ r: parseInt(result[1], 16),
17
+ g: parseInt(result[2], 16),
18
+ b: parseInt(result[3], 16)
19
+ } : null;
20
+ };
21
+ Convert.componentToHEX = function (colorComponent) {
22
+ var hex = colorComponent.toString(16);
23
+ return hex.length == 1 ? "0" + hex : hex;
24
+ };
25
+ return Convert;
26
+ }());
27
+ export { Convert };
@@ -0,0 +1,153 @@
1
+ import { Convert } from "./convert";
2
+ import { range } from './generation';
3
+ var Filter = /** @class */ (function () {
4
+ function Filter(appConfig, ctx) {
5
+ this.appConfig = appConfig;
6
+ this.ctx = ctx;
7
+ }
8
+ Filter.prototype.setImageSize = function (size) {
9
+ this.imageSize = size;
10
+ };
11
+ Filter.prototype.copy = function (options) {
12
+ var width = (options === null || options === void 0 ? void 0 : options.width) ? options.width : this.appConfig.CANVAS_SIZE.width;
13
+ var height = (options === null || options === void 0 ? void 0 : options.height) ? options.height : this.appConfig.CANVAS_SIZE.height;
14
+ var imgData = this.ctx.getImageData(options.x, options.y, width, height);
15
+ return imgData;
16
+ };
17
+ Filter.prototype.copyExtendedModel = function (options) {
18
+ var width = (options === null || options === void 0 ? void 0 : options.width) ? options.width : this.appConfig.CANVAS_SIZE.width;
19
+ var height = (options === null || options === void 0 ? void 0 : options.height) ? options.height : this.appConfig.CANVAS_SIZE.height;
20
+ var imgData = this.ctx.getImageData(options.x, options.y, width, height);
21
+ var extendedImageData = this.clearEmptyPixels(imgData);
22
+ return extendedImageData;
23
+ };
24
+ Filter.prototype.update = function (imgData, options) {
25
+ this.ctx.clearRect(0, 0, this.appConfig.CANVAS_SIZE.width, this.appConfig.CANVAS_SIZE.height);
26
+ this.ctx.putImageData(imgData, options.x, options.y);
27
+ };
28
+ Filter.prototype.clearEmptyPixels = function (imageData) {
29
+ var rowRGBABuff = this.getRowRGBABuff(imageData);
30
+ var RGBAMatrix = this.getRGBAMatrix(rowRGBABuff, { width: imageData.width, height: imageData.height });
31
+ var beforeSize = {
32
+ width: imageData.width,
33
+ height: imageData.height,
34
+ };
35
+ var tempSize = this.getSizeOfSparseMatrix(RGBAMatrix, beforeSize);
36
+ var cleared = rowRGBABuff.filter(function (byteArray) {
37
+ var alpha = byteArray[3 /* E_RGBA.a */];
38
+ return !!alpha;
39
+ });
40
+ var clearedBuff = cleared.flat();
41
+ var tempCanvas = document.createElement('canvas');
42
+ var tempCtx = tempCanvas.getContext('2d');
43
+ var tempImageData = tempCtx.createImageData(tempSize.width, tempSize.height);
44
+ clearedBuff.forEach(function (_, i) { return tempImageData.data[i] = clearedBuff[i]; });
45
+ return {
46
+ imageData: tempImageData,
47
+ size: tempSize
48
+ };
49
+ };
50
+ Filter.prototype.getSizeOfSparseMatrix = function (RGBAMatrix, tempSize) {
51
+ // case 1: Xcanvas -> Ximage && Ycanvas -> Yimage
52
+ var leftIndex;
53
+ var upIndex;
54
+ for (var iy = 0; iy < RGBAMatrix.length; iy++) {
55
+ var row = RGBAMatrix[iy];
56
+ for (var ix = 0; ix < row.length; ix++) {
57
+ var rowItem = row[ix];
58
+ var isNotEmpty = rowItem[3 /* E_RGBA.a */] !== 0;
59
+ if (isNotEmpty) {
60
+ leftIndex = ix;
61
+ upIndex = iy;
62
+ break;
63
+ }
64
+ }
65
+ if (leftIndex !== undefined && upIndex !== undefined) {
66
+ break;
67
+ }
68
+ }
69
+ // case 2 reverse matrix: Ximage <- Xcanvas && Yimage <- Ycanvas
70
+ var rightIndex;
71
+ var downIndex;
72
+ for (var iy = RGBAMatrix.length - 1; iy >= 0; iy--) {
73
+ var row = RGBAMatrix[iy];
74
+ for (var ix = row.length - 1; ix >= 0; ix--) {
75
+ var rowItem = row[ix];
76
+ var isNotEmpty = rowItem[3 /* E_RGBA.a */] !== 0;
77
+ if (isNotEmpty) {
78
+ rightIndex = row.length - 1 - ix;
79
+ downIndex = RGBAMatrix.length - 1 - iy;
80
+ break;
81
+ }
82
+ }
83
+ if (rightIndex !== undefined && downIndex !== undefined) {
84
+ break;
85
+ }
86
+ }
87
+ var reduceWidth = function (tempWidth) { return tempWidth - (leftIndex + rightIndex); };
88
+ var reduceHeight = function (tempHeight) { return tempHeight - (upIndex + downIndex); };
89
+ var resultSize = {
90
+ width: reduceWidth(tempSize.width),
91
+ height: reduceHeight(tempSize.height),
92
+ };
93
+ return resultSize;
94
+ };
95
+ Filter.prototype.getBuffCollection = function (imageData) {
96
+ var rowRGBABuff = this.getRowRGBABuff(imageData);
97
+ var hexBuff = rowRGBABuff.map(Convert.byteRGBToHEX);
98
+ var buff = this.getBuff(hexBuff);
99
+ return { rowRGBABuff: rowRGBABuff, hexBuff: hexBuff, buff: buff };
100
+ };
101
+ Filter.prototype.getBuff = function (hexBuff) {
102
+ var _this = this;
103
+ var distanceRow = range(0, this.imageSize.height).map(function (i) { return _this.imageSize.width * i; });
104
+ var buff = [];
105
+ var indexOfDistance = 0;
106
+ hexBuff.forEach(function (pxColor, pxIndex) {
107
+ var _a;
108
+ if (pxIndex >= distanceRow[indexOfDistance + 1]) {
109
+ indexOfDistance++;
110
+ }
111
+ (_a = buff[indexOfDistance]) !== null && _a !== void 0 ? _a : (buff[indexOfDistance] = []);
112
+ buff[indexOfDistance].push(pxColor);
113
+ });
114
+ return buff;
115
+ };
116
+ Filter.prototype.getRGBAMatrix = function (rowRGBABuff, size) {
117
+ var maybeSize = {
118
+ width: size.width || this.imageSize.width,
119
+ height: size.height || this.imageSize.height,
120
+ };
121
+ var distanceRow = range(0, maybeSize.height).map(function (i) { return maybeSize.width * i; });
122
+ var buff = [];
123
+ var indexOfDistance = 0;
124
+ rowRGBABuff.forEach(function (pxRGBA, pxIndex) {
125
+ var _a;
126
+ if (pxIndex >= distanceRow[indexOfDistance + 1]) {
127
+ indexOfDistance++;
128
+ }
129
+ (_a = buff[indexOfDistance]) !== null && _a !== void 0 ? _a : (buff[indexOfDistance] = []);
130
+ buff[indexOfDistance].push(pxRGBA);
131
+ });
132
+ return buff;
133
+ };
134
+ Filter.prototype.getRowRGBABuff = function (imageData) {
135
+ var rowRGBABuff = []; // [ [0, 0, 0, 0], [0, 0, 0, 0], ... ]
136
+ var colorIndx = 0;
137
+ var colorRGBAIndx = 0;
138
+ imageData.data.forEach(function (pxColor) {
139
+ var _a;
140
+ if (colorIndx >= 4) {
141
+ colorIndx = 0;
142
+ colorRGBAIndx++;
143
+ }
144
+ colorIndx++;
145
+ // @ts-ignore
146
+ (_a = rowRGBABuff[colorRGBAIndx]) !== null && _a !== void 0 ? _a : (rowRGBABuff[colorRGBAIndx] = []);
147
+ rowRGBABuff[colorRGBAIndx].push(pxColor);
148
+ });
149
+ return rowRGBABuff;
150
+ };
151
+ return Filter;
152
+ }());
153
+ export { Filter };
@@ -0,0 +1,7 @@
1
+ export var range = function (start, end) {
2
+ var result = [];
3
+ for (var i = start; i < end; i++) {
4
+ result.push(i);
5
+ }
6
+ return result;
7
+ };
@@ -0,0 +1,122 @@
1
+ var Guid4 = /** @class */ (function () {
2
+ function Guid4() {
3
+ this.stack = [];
4
+ // generateWithFactor not working
5
+ // this.generateWithFactor(this.attempt);
6
+ }
7
+ Guid4.prototype.generate = function () {
8
+ return this.Guid4;
9
+ };
10
+ Object.defineProperty(Guid4.prototype, "finite", {
11
+ get: function () {
12
+ var _a;
13
+ var guid4 = this.stack[(_a = this.stack) === null || _a === void 0 ? void 0 : _a.length];
14
+ if (!!guid4) {
15
+ return guid4;
16
+ }
17
+ else {
18
+ throw new Error("Guid4 not generate");
19
+ }
20
+ },
21
+ enumerable: false,
22
+ configurable: true
23
+ });
24
+ ;
25
+ Guid4.prototype.generateWithFactor = function (attempt) {
26
+ var factor = this.getFactor(this.guid4);
27
+ attempt.use('withError').run(factor);
28
+ };
29
+ Guid4.prototype.getFactor = function (guid4) {
30
+ var _this = this;
31
+ return function (attempt) {
32
+ guid4 = _this.Guid4;
33
+ if (!_this.stack.includes(guid4)) {
34
+ attempt.current = attempt.max;
35
+ _this.stack.push(guid4);
36
+ }
37
+ };
38
+ };
39
+ Object.defineProperty(Guid4.prototype, "attempt", {
40
+ get: function () {
41
+ var attemptConfig = {
42
+ attempt: {
43
+ current: 1,
44
+ max: 5,
45
+ },
46
+ error: {
47
+ message: '[Fatal Error] Guid4 module cannot generate unique guid4'
48
+ }
49
+ };
50
+ var attempt = new GenerateAttempt(attemptConfig.attempt, attemptConfig.error);
51
+ return attempt;
52
+ },
53
+ enumerable: false,
54
+ configurable: true
55
+ });
56
+ Object.defineProperty(Guid4.prototype, "Guid4", {
57
+ get: function () {
58
+ var base = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
59
+ var regex = /[xy]/g;
60
+ var guid4 = base.replace(regex, this.formating);
61
+ return guid4;
62
+ },
63
+ enumerable: false,
64
+ configurable: true
65
+ });
66
+ Guid4.prototype.formating = function (char) {
67
+ var preformer = Math.random() * 16 | 0;
68
+ var formattedChar = (char == 'x') ? preformer : (preformer & 0x3 | 0x8);
69
+ return formattedChar.toString(16);
70
+ };
71
+ return Guid4;
72
+ }());
73
+ export { Guid4 };
74
+ ;
75
+ var GenerateAttempt = /** @class */ (function () {
76
+ function GenerateAttempt(config, error) {
77
+ this._attempt = config;
78
+ if (!!error)
79
+ this._error = error;
80
+ }
81
+ GenerateAttempt.prototype.use = function (strategy) {
82
+ if (strategy === void 0) { strategy = 'default'; }
83
+ var context = this;
84
+ switch (strategy) {
85
+ case 'default':
86
+ return {
87
+ run: function (action) {
88
+ context.defaultRun(action);
89
+ },
90
+ };
91
+ case 'withError':
92
+ return {
93
+ run: function (action) {
94
+ context.withErrorRun(action);
95
+ },
96
+ };
97
+ }
98
+ };
99
+ GenerateAttempt.prototype.defaultRun = function (action) {
100
+ var attemptCondition = this._attempt.current <= this._attempt.max;
101
+ while (attemptCondition) {
102
+ action(this._attempt);
103
+ this._attempt.current++;
104
+ }
105
+ };
106
+ GenerateAttempt.prototype.withErrorRun = function (action) {
107
+ var attemptCondition = this._attempt.current <= this._attempt.max;
108
+ var errorCondition = this._attempt.current === this._attempt.max;
109
+ var errorMessage = this._error.message;
110
+ while (attemptCondition) {
111
+ this.throwError(errorCondition, errorMessage);
112
+ action(this._attempt);
113
+ this._attempt.current++;
114
+ }
115
+ };
116
+ GenerateAttempt.prototype.throwError = function (condition, message) {
117
+ if (condition) {
118
+ throw new Error(message);
119
+ }
120
+ };
121
+ return GenerateAttempt;
122
+ }());
@@ -0,0 +1,77 @@
1
+ var ProjectFileSerializer = /** @class */ (function () {
2
+ function ProjectFileSerializer(file) {
3
+ this.projects = [];
4
+ this.file = file;
5
+ this.projects = this.load();
6
+ }
7
+ ;
8
+ ProjectFileSerializer.prototype.load = function () {
9
+ var rowProjects = JSON.parse(this.file);
10
+ var imageDataProcessor = function (temp) {
11
+ var data;
12
+ var size;
13
+ if (temp === null || temp === void 0 ? void 0 : temp.current) {
14
+ data = Object.values(temp === null || temp === void 0 ? void 0 : temp.current.imageData.data);
15
+ size = temp === null || temp === void 0 ? void 0 : temp.current.size;
16
+ }
17
+ else if (temp === null || temp === void 0 ? void 0 : temp.state) {
18
+ data = Object.values(temp === null || temp === void 0 ? void 0 : temp.state.tempImageData.data);
19
+ size = temp === null || temp === void 0 ? void 0 : temp.state.size;
20
+ }
21
+ var tempImageData = new ImageData(size.width, size.height);
22
+ data.forEach(function (colorAtom, index) {
23
+ tempImageData.data[index] = colorAtom;
24
+ });
25
+ return tempImageData;
26
+ };
27
+ var projects = rowProjects.map(function (project) {
28
+ project.state.current.imageData = imageDataProcessor({ current: project.state.current });
29
+ project.state.history = project.state.history.map(function (historyLine) {
30
+ historyLine.stateValue.tempImageData = imageDataProcessor({ state: historyLine.stateValue });
31
+ return historyLine;
32
+ });
33
+ project.state.cache = project.state.cache.map(function (historyLine) {
34
+ historyLine.stateValue.tempImageData = imageDataProcessor({ state: historyLine.stateValue });
35
+ return historyLine;
36
+ });
37
+ return project;
38
+ });
39
+ return projects;
40
+ };
41
+ ProjectFileSerializer.prototype.saveProjects = function (projects) {
42
+ // TODO: not sure if this works
43
+ this.file.save(JSON.stringify(projects));
44
+ };
45
+ ProjectFileSerializer.prototype.getProjects = function () {
46
+ return this.projects;
47
+ };
48
+ ProjectFileSerializer.prototype.getProject = function (projectId) {
49
+ return this.projects.find(function (project) { return project.id === projectId; });
50
+ };
51
+ ProjectFileSerializer.prototype.saveProject = function (project) {
52
+ var index = this.projects.findIndex(function (p) { return p.id === project.id; });
53
+ if (index !== -1) {
54
+ this.projects[index] = project;
55
+ }
56
+ else {
57
+ this.projects.push(project);
58
+ }
59
+ this.saveProjects(this.projects);
60
+ };
61
+ ProjectFileSerializer.prototype.removeProject = function (projectId) {
62
+ var index = this.projects.findIndex(function (p) { return p.id === projectId; });
63
+ if (index !== -1) {
64
+ this.projects.splice(index, 1);
65
+ this.saveProjects(this.projects);
66
+ }
67
+ };
68
+ ProjectFileSerializer.prototype.updateProject = function (project) {
69
+ var index = this.projects.findIndex(function (p) { return p.id === project.id; });
70
+ if (index !== -1) {
71
+ this.projects[index] = project;
72
+ this.saveProjects(this.projects);
73
+ }
74
+ };
75
+ return ProjectFileSerializer;
76
+ }());
77
+ export { ProjectFileSerializer };
@@ -0,0 +1,30 @@
1
+ export var reflect = function () {
2
+ if (
3
+ // No Reflect, no classes, no need for shim because native custom elements
4
+ // require ES2015 classes or Reflect.
5
+ window.Reflect === undefined ||
6
+ window.customElements === undefined ||
7
+ // The webcomponentsjs custom elements polyfill doesn't require
8
+ // ES2015-compatible construction (`super()` or `Reflect.construct`).
9
+ // @ts-ignore
10
+ window.customElements.polyfillWrapFlushCallback) {
11
+ return;
12
+ }
13
+ var BuiltInHTMLElement = HTMLElement;
14
+ /**
15
+ * With jscompiler's RECOMMENDED_FLAGS the function name will be optimized away.
16
+ * However, if we declare the function as a property on an object literal, and
17
+ * use quotes for the property name, then closure will leave that much intact,
18
+ * which is enough for the JS VM to correctly set Function.prototype.name.
19
+ */
20
+ var wrapperForTheName = {
21
+ 'HTMLElement': /** @this {!Object} */ function HTMLElement() {
22
+ return Reflect.construct(BuiltInHTMLElement, [], /** @type {!Function} */ (this.constructor));
23
+ }
24
+ };
25
+ // @ts-ignore
26
+ window.HTMLElement = wrapperForTheName['HTMLElement'];
27
+ HTMLElement.prototype = BuiltInHTMLElement.prototype;
28
+ HTMLElement.prototype.constructor = HTMLElement;
29
+ Object.setPrototypeOf(HTMLElement, BuiltInHTMLElement);
30
+ };
@@ -0,0 +1,19 @@
1
+ var TempCanvas = /** @class */ (function () {
2
+ function TempCanvas() {
3
+ this.canvas = document.createElement('canvas');
4
+ this.ctx = this.canvas.getContext('2d', { willReadFrequently: true });
5
+ }
6
+ TempCanvas.prototype.bindOptions = function (options) {
7
+ this.canvas.width = options.width;
8
+ this.canvas.height = options.height;
9
+ this.ctx = this.canvas.getContext('2d', { willReadFrequently: true });
10
+ };
11
+ TempCanvas.prototype.destroy = function () {
12
+ this.canvas.remove();
13
+ };
14
+ TempCanvas.prototype.getImageData = function () {
15
+ return this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
16
+ };
17
+ return TempCanvas;
18
+ }());
19
+ export { TempCanvas };
@@ -15,11 +15,12 @@ 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, { DrawAccumulator } from "./services/draw.service";
18
+ import DrawService from "./services/draw.service";
19
19
  import DownloadService from "./services/download.service";
20
20
  import ResizeService from "./services/serize.service";
21
- import DrawLayersService from "./services/draw-leayers.service";
21
+ import DrawLayersService from "./services/draw-layers.service";
22
22
  import { ILayer } from "./types/draw-layers";
23
+ import DrawAccumulatorService from "./services/draw-accumulator.service";
23
24
  export declare class WebComponentWrapper {
24
25
  baseElement: HTMLDivElement;
25
26
  editorWrapElement: HTMLDivElement;
@@ -64,7 +65,7 @@ export default class WebComponent extends HTMLElement {
64
65
  drawService: DrawService;
65
66
  downloadService: DownloadService;
66
67
  resizeService: ResizeService;
67
- drawAccumulator: DrawAccumulator;
68
+ drawAccumulatorService: DrawAccumulatorService;
68
69
  drawLayersService: DrawLayersService;
69
70
  constructor();
70
71
  init(appConfig: AppConfig): {