canvas-editor-engine 2.1.9 → 2.1.11
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.mjs +133 -131
- package/dist/web-component.d.ts +6 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1720,137 +1720,6 @@ var PullProjectService = function() {
|
|
|
1720
1720
|
return PullProjectService;
|
|
1721
1721
|
}();
|
|
1722
1722
|
|
|
1723
|
-
reflect();
|
|
1724
|
-
|
|
1725
|
-
var WebComponentWrapper = function() {
|
|
1726
|
-
function WebComponentWrapper() {
|
|
1727
|
-
var base = document.createElement("div");
|
|
1728
|
-
base.className = "wc-editor";
|
|
1729
|
-
base.style.position = "relative";
|
|
1730
|
-
base.style.display = "flex";
|
|
1731
|
-
base.style.overflow = "hidden";
|
|
1732
|
-
var stylesWrap = document.createElement("div");
|
|
1733
|
-
stylesWrap.className = "styles-wrap";
|
|
1734
|
-
var editorWrap = document.createElement("div");
|
|
1735
|
-
editorWrap.className = "editor-wrap";
|
|
1736
|
-
editorWrap.style.position = "relative";
|
|
1737
|
-
editorWrap.style.display = "flex";
|
|
1738
|
-
editorWrap.style.overflow = "hidden";
|
|
1739
|
-
var toolsWrap = document.createElement("div");
|
|
1740
|
-
toolsWrap.className = "tools-wrap";
|
|
1741
|
-
toolsWrap.style.position = "relative";
|
|
1742
|
-
toolsWrap.style.display = "flex";
|
|
1743
|
-
base.appendChild(stylesWrap);
|
|
1744
|
-
base.appendChild(editorWrap);
|
|
1745
|
-
base.appendChild(toolsWrap);
|
|
1746
|
-
this.baseElement = base;
|
|
1747
|
-
this.stylesWrapElement = stylesWrap;
|
|
1748
|
-
this.editorWrapElement = editorWrap;
|
|
1749
|
-
this.toolsWrapElement = toolsWrap;
|
|
1750
|
-
this._baseStyle();
|
|
1751
|
-
}
|
|
1752
|
-
Object.defineProperty(WebComponentWrapper.prototype, "base", {
|
|
1753
|
-
get: function() {
|
|
1754
|
-
return this._methods(this.baseElement);
|
|
1755
|
-
},
|
|
1756
|
-
enumerable: false,
|
|
1757
|
-
configurable: true
|
|
1758
|
-
});
|
|
1759
|
-
Object.defineProperty(WebComponentWrapper.prototype, "editorWrap", {
|
|
1760
|
-
get: function() {
|
|
1761
|
-
return this._methods(this.editorWrapElement);
|
|
1762
|
-
},
|
|
1763
|
-
enumerable: false,
|
|
1764
|
-
configurable: true
|
|
1765
|
-
});
|
|
1766
|
-
Object.defineProperty(WebComponentWrapper.prototype, "stylesWrap", {
|
|
1767
|
-
get: function() {
|
|
1768
|
-
return this._methods(this.stylesWrapElement);
|
|
1769
|
-
},
|
|
1770
|
-
enumerable: false,
|
|
1771
|
-
configurable: true
|
|
1772
|
-
});
|
|
1773
|
-
Object.defineProperty(WebComponentWrapper.prototype, "toolsWrap", {
|
|
1774
|
-
get: function() {
|
|
1775
|
-
return this._methods(this.toolsWrapElement);
|
|
1776
|
-
},
|
|
1777
|
-
enumerable: false,
|
|
1778
|
-
configurable: true
|
|
1779
|
-
});
|
|
1780
|
-
WebComponentWrapper.prototype._methods = function(elementWrapper) {
|
|
1781
|
-
var _this = this;
|
|
1782
|
-
return {
|
|
1783
|
-
add: function(component, style) {
|
|
1784
|
-
return _this._add(elementWrapper, component, style);
|
|
1785
|
-
}
|
|
1786
|
-
};
|
|
1787
|
-
};
|
|
1788
|
-
WebComponentWrapper.prototype._add = function(elementWrapper, component, style) {
|
|
1789
|
-
var componentElement = elementWrapper.appendChild(component);
|
|
1790
|
-
if (!!style) {
|
|
1791
|
-
this.stylesWrapElement.appendChild(style);
|
|
1792
|
-
}
|
|
1793
|
-
return componentElement;
|
|
1794
|
-
};
|
|
1795
|
-
WebComponentWrapper.prototype._baseStyle = function() {
|
|
1796
|
-
var style = document.createElement("style");
|
|
1797
|
-
style.innerHTML = "\n * {\n user-select: none;\n }\n ";
|
|
1798
|
-
this.stylesWrapElement.appendChild(style);
|
|
1799
|
-
};
|
|
1800
|
-
return WebComponentWrapper;
|
|
1801
|
-
}();
|
|
1802
|
-
|
|
1803
|
-
var WebComponent = function(_super) {
|
|
1804
|
-
__extends(WebComponent, _super);
|
|
1805
|
-
function WebComponent() {
|
|
1806
|
-
var _this = _super.call(this) || this;
|
|
1807
|
-
var shadowRoot = _this.attachShadow({
|
|
1808
|
-
mode: "open"
|
|
1809
|
-
});
|
|
1810
|
-
_this.webComponentWrapper = new WebComponentWrapper;
|
|
1811
|
-
shadowRoot.appendChild(_this.webComponentWrapper.baseElement);
|
|
1812
|
-
return _this;
|
|
1813
|
-
}
|
|
1814
|
-
WebComponent.prototype.init = function(appConfig) {
|
|
1815
|
-
this.appConfig = appConfig;
|
|
1816
|
-
this.projectsService = new ProjectsService;
|
|
1817
|
-
this.loggerService = new LoggerService;
|
|
1818
|
-
this.toolLayerService = new ToolLayerService(this.appConfig);
|
|
1819
|
-
this.eventService = new EventService;
|
|
1820
|
-
this.canvasComponent = new CanvasComponent(this.appConfig, this.loggerService, this.toolLayerService);
|
|
1821
|
-
this.toolService = new ToolService(this.canvasComponent);
|
|
1822
|
-
this.appStoreRepository = new AppStoreRepository;
|
|
1823
|
-
this.throughHistoryService = new ThroughHistoryService(this.appConfig, this.appStoreRepository);
|
|
1824
|
-
this.appStore = new AppStore(this.throughHistoryService, this.appStoreRepository);
|
|
1825
|
-
this.pullProjectService = new PullProjectService(this.throughHistoryService, this.appStoreRepository);
|
|
1826
|
-
var _a = this.canvasComponent.getComponent(), canvasTemplate = _a.canvasTemplate, canvasStyle = _a.canvasStyle;
|
|
1827
|
-
this.canvasElement = this.webComponentWrapper.editorWrap.add(canvasTemplate, canvasStyle);
|
|
1828
|
-
var pipetteComponent = new PipetteComponent(this.toolService, this.loggerService, this.canvasComponent);
|
|
1829
|
-
var _b = pipetteComponent.getComponent(), pipetteTemplate = _b.pipetteTemplate, pipetteStyle = _b.pipetteStyle;
|
|
1830
|
-
this.webComponentWrapper.editorWrap.add(pipetteTemplate, pipetteStyle);
|
|
1831
|
-
var slotComponent = new SlotComponent(this.loggerService);
|
|
1832
|
-
var _c = slotComponent.getComponent("tools"), slotTemplate = _c.slotTemplate, slotStyle = _c.slotStyle;
|
|
1833
|
-
this.webComponentWrapper.toolsWrap.add(slotTemplate, slotStyle);
|
|
1834
|
-
this.excretionsComponent = new ExcretionsComponent(this.toolService, this.loggerService, this.toolLayerService, this.canvasComponent);
|
|
1835
|
-
this.cropService = new CropService(this.appConfig, this.appStoreRepository, this.excretionsComponent);
|
|
1836
|
-
var _d = this.excretionsComponent.getComponent(), excretionsTemplate = _d.excretionsTemplate, excretionsStyle = _d.excretionsStyle;
|
|
1837
|
-
this.webComponentWrapper.editorWrap.add(excretionsTemplate, excretionsStyle);
|
|
1838
|
-
var loadingComponent = new LoadingComponent(this.loggerService, this.eventService);
|
|
1839
|
-
var _e = loadingComponent.getComponent(), loadingTemplate = _e.loadingTemplate, loadingStyle = _e.loadingStyle;
|
|
1840
|
-
this.webComponentWrapper.editorWrap.add(loadingTemplate, loadingStyle);
|
|
1841
|
-
this.canvasComponent.simulateSubscriptions();
|
|
1842
|
-
this.eventService.applyEvents(this.webComponentWrapper.baseElement);
|
|
1843
|
-
return this.initial();
|
|
1844
|
-
};
|
|
1845
|
-
WebComponent.prototype.initial = function() {
|
|
1846
|
-
return {
|
|
1847
|
-
editorElement: this.canvasElement,
|
|
1848
|
-
canvasSelector: this.canvasComponent.getCanvasSelector()
|
|
1849
|
-
};
|
|
1850
|
-
};
|
|
1851
|
-
return WebComponent;
|
|
1852
|
-
}(HTMLElement);
|
|
1853
|
-
|
|
1854
1723
|
var VagueFilter = function(_super) {
|
|
1855
1724
|
__extends(VagueFilter, _super);
|
|
1856
1725
|
function VagueFilter(appConfig, ctx, options) {
|
|
@@ -2190,6 +2059,139 @@ var DownloadService = function() {
|
|
|
2190
2059
|
|
|
2191
2060
|
reflect();
|
|
2192
2061
|
|
|
2062
|
+
var WebComponentWrapper = function() {
|
|
2063
|
+
function WebComponentWrapper() {
|
|
2064
|
+
var base = document.createElement("div");
|
|
2065
|
+
base.className = "wc-editor";
|
|
2066
|
+
base.style.position = "relative";
|
|
2067
|
+
base.style.display = "flex";
|
|
2068
|
+
base.style.overflow = "hidden";
|
|
2069
|
+
var stylesWrap = document.createElement("div");
|
|
2070
|
+
stylesWrap.className = "styles-wrap";
|
|
2071
|
+
var editorWrap = document.createElement("div");
|
|
2072
|
+
editorWrap.className = "editor-wrap";
|
|
2073
|
+
editorWrap.style.position = "relative";
|
|
2074
|
+
editorWrap.style.display = "flex";
|
|
2075
|
+
editorWrap.style.overflow = "hidden";
|
|
2076
|
+
var toolsWrap = document.createElement("div");
|
|
2077
|
+
toolsWrap.className = "tools-wrap";
|
|
2078
|
+
toolsWrap.style.position = "relative";
|
|
2079
|
+
toolsWrap.style.display = "flex";
|
|
2080
|
+
base.appendChild(stylesWrap);
|
|
2081
|
+
base.appendChild(editorWrap);
|
|
2082
|
+
base.appendChild(toolsWrap);
|
|
2083
|
+
this.baseElement = base;
|
|
2084
|
+
this.stylesWrapElement = stylesWrap;
|
|
2085
|
+
this.editorWrapElement = editorWrap;
|
|
2086
|
+
this.toolsWrapElement = toolsWrap;
|
|
2087
|
+
this._baseStyle();
|
|
2088
|
+
}
|
|
2089
|
+
Object.defineProperty(WebComponentWrapper.prototype, "base", {
|
|
2090
|
+
get: function() {
|
|
2091
|
+
return this._methods(this.baseElement);
|
|
2092
|
+
},
|
|
2093
|
+
enumerable: false,
|
|
2094
|
+
configurable: true
|
|
2095
|
+
});
|
|
2096
|
+
Object.defineProperty(WebComponentWrapper.prototype, "editorWrap", {
|
|
2097
|
+
get: function() {
|
|
2098
|
+
return this._methods(this.editorWrapElement);
|
|
2099
|
+
},
|
|
2100
|
+
enumerable: false,
|
|
2101
|
+
configurable: true
|
|
2102
|
+
});
|
|
2103
|
+
Object.defineProperty(WebComponentWrapper.prototype, "stylesWrap", {
|
|
2104
|
+
get: function() {
|
|
2105
|
+
return this._methods(this.stylesWrapElement);
|
|
2106
|
+
},
|
|
2107
|
+
enumerable: false,
|
|
2108
|
+
configurable: true
|
|
2109
|
+
});
|
|
2110
|
+
Object.defineProperty(WebComponentWrapper.prototype, "toolsWrap", {
|
|
2111
|
+
get: function() {
|
|
2112
|
+
return this._methods(this.toolsWrapElement);
|
|
2113
|
+
},
|
|
2114
|
+
enumerable: false,
|
|
2115
|
+
configurable: true
|
|
2116
|
+
});
|
|
2117
|
+
WebComponentWrapper.prototype._methods = function(elementWrapper) {
|
|
2118
|
+
var _this = this;
|
|
2119
|
+
return {
|
|
2120
|
+
add: function(component, style) {
|
|
2121
|
+
return _this._add(elementWrapper, component, style);
|
|
2122
|
+
}
|
|
2123
|
+
};
|
|
2124
|
+
};
|
|
2125
|
+
WebComponentWrapper.prototype._add = function(elementWrapper, component, style) {
|
|
2126
|
+
var componentElement = elementWrapper.appendChild(component);
|
|
2127
|
+
if (!!style) {
|
|
2128
|
+
this.stylesWrapElement.appendChild(style);
|
|
2129
|
+
}
|
|
2130
|
+
return componentElement;
|
|
2131
|
+
};
|
|
2132
|
+
WebComponentWrapper.prototype._baseStyle = function() {
|
|
2133
|
+
var style = document.createElement("style");
|
|
2134
|
+
style.innerHTML = "\n * {\n user-select: none;\n }\n ";
|
|
2135
|
+
this.stylesWrapElement.appendChild(style);
|
|
2136
|
+
};
|
|
2137
|
+
return WebComponentWrapper;
|
|
2138
|
+
}();
|
|
2139
|
+
|
|
2140
|
+
var WebComponent = function(_super) {
|
|
2141
|
+
__extends(WebComponent, _super);
|
|
2142
|
+
function WebComponent() {
|
|
2143
|
+
var _this = _super.call(this) || this;
|
|
2144
|
+
var shadowRoot = _this.attachShadow({
|
|
2145
|
+
mode: "open"
|
|
2146
|
+
});
|
|
2147
|
+
_this.webComponentWrapper = new WebComponentWrapper;
|
|
2148
|
+
shadowRoot.appendChild(_this.webComponentWrapper.baseElement);
|
|
2149
|
+
return _this;
|
|
2150
|
+
}
|
|
2151
|
+
WebComponent.prototype.init = function(appConfig) {
|
|
2152
|
+
this.appConfig = appConfig;
|
|
2153
|
+
this.projectsService = new ProjectsService;
|
|
2154
|
+
this.loggerService = new LoggerService;
|
|
2155
|
+
this.toolLayerService = new ToolLayerService(this.appConfig);
|
|
2156
|
+
this.eventService = new EventService;
|
|
2157
|
+
this.canvasComponent = new CanvasComponent(this.appConfig, this.loggerService, this.toolLayerService);
|
|
2158
|
+
this.toolService = new ToolService(this.canvasComponent);
|
|
2159
|
+
this.appStoreRepository = new AppStoreRepository;
|
|
2160
|
+
this.throughHistoryService = new ThroughHistoryService(this.appConfig, this.appStoreRepository);
|
|
2161
|
+
this.appStore = new AppStore(this.throughHistoryService, this.appStoreRepository);
|
|
2162
|
+
this.pullProjectService = new PullProjectService(this.throughHistoryService, this.appStoreRepository);
|
|
2163
|
+
this.drawService = new DrawService(this.appConfig, this.appStoreRepository, this.eventService);
|
|
2164
|
+
this.downloadService = new DownloadService(this.canvasComponent);
|
|
2165
|
+
var _a = this.canvasComponent.getComponent(), canvasTemplate = _a.canvasTemplate, canvasStyle = _a.canvasStyle;
|
|
2166
|
+
this.canvasElement = this.webComponentWrapper.editorWrap.add(canvasTemplate, canvasStyle);
|
|
2167
|
+
var pipetteComponent = new PipetteComponent(this.toolService, this.loggerService, this.canvasComponent);
|
|
2168
|
+
var _b = pipetteComponent.getComponent(), pipetteTemplate = _b.pipetteTemplate, pipetteStyle = _b.pipetteStyle;
|
|
2169
|
+
this.webComponentWrapper.editorWrap.add(pipetteTemplate, pipetteStyle);
|
|
2170
|
+
var slotComponent = new SlotComponent(this.loggerService);
|
|
2171
|
+
var _c = slotComponent.getComponent("tools"), slotTemplate = _c.slotTemplate, slotStyle = _c.slotStyle;
|
|
2172
|
+
this.webComponentWrapper.toolsWrap.add(slotTemplate, slotStyle);
|
|
2173
|
+
this.excretionsComponent = new ExcretionsComponent(this.toolService, this.loggerService, this.toolLayerService, this.canvasComponent);
|
|
2174
|
+
this.cropService = new CropService(this.appConfig, this.appStoreRepository, this.excretionsComponent);
|
|
2175
|
+
var _d = this.excretionsComponent.getComponent(), excretionsTemplate = _d.excretionsTemplate, excretionsStyle = _d.excretionsStyle;
|
|
2176
|
+
this.webComponentWrapper.editorWrap.add(excretionsTemplate, excretionsStyle);
|
|
2177
|
+
var loadingComponent = new LoadingComponent(this.loggerService, this.eventService);
|
|
2178
|
+
var _e = loadingComponent.getComponent(), loadingTemplate = _e.loadingTemplate, loadingStyle = _e.loadingStyle;
|
|
2179
|
+
this.webComponentWrapper.editorWrap.add(loadingTemplate, loadingStyle);
|
|
2180
|
+
this.canvasComponent.simulateSubscriptions();
|
|
2181
|
+
this.eventService.applyEvents(this.webComponentWrapper.baseElement);
|
|
2182
|
+
return this.initial();
|
|
2183
|
+
};
|
|
2184
|
+
WebComponent.prototype.initial = function() {
|
|
2185
|
+
return {
|
|
2186
|
+
editorElement: this.canvasElement,
|
|
2187
|
+
canvasSelector: this.canvasComponent.getCanvasSelector()
|
|
2188
|
+
};
|
|
2189
|
+
};
|
|
2190
|
+
return WebComponent;
|
|
2191
|
+
}(HTMLElement);
|
|
2192
|
+
|
|
2193
|
+
reflect();
|
|
2194
|
+
|
|
2193
2195
|
var CanvasEditorEngine = function() {
|
|
2194
2196
|
function CanvasEditorEngine() {}
|
|
2195
2197
|
CanvasEditorEngine.prototype.getInitial = function() {
|
package/dist/web-component.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ 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";
|
|
19
|
+
import DownloadService from "./services/download.service";
|
|
18
20
|
export declare class WebComponentWrapper {
|
|
19
21
|
baseElement: HTMLDivElement;
|
|
20
22
|
editorWrapElement: HTMLDivElement;
|
|
@@ -39,6 +41,8 @@ export declare class WebComponentWrapper {
|
|
|
39
41
|
}
|
|
40
42
|
export default class WebComponent extends HTMLElement {
|
|
41
43
|
appConfig: AppConfig;
|
|
44
|
+
appStoreRepository: AppStoreRepository;
|
|
45
|
+
appStore: AppStore;
|
|
42
46
|
webComponentWrapper: WebComponentWrapper;
|
|
43
47
|
canvasElement: HTMLDivElement;
|
|
44
48
|
canvasComponent: CanvasComponent;
|
|
@@ -53,9 +57,9 @@ export default class WebComponent extends HTMLElement {
|
|
|
53
57
|
throughHistoryService: ThroughHistoryService;
|
|
54
58
|
projectsService: ProjectsService;
|
|
55
59
|
pullProjectService: PullProjectService;
|
|
56
|
-
appStore: AppStore;
|
|
57
60
|
loggerService: LoggerService;
|
|
58
|
-
|
|
61
|
+
drawService: DrawService;
|
|
62
|
+
downloadService: DownloadService;
|
|
59
63
|
constructor();
|
|
60
64
|
init(appConfig: AppConfig): {
|
|
61
65
|
editorElement: HTMLDivElement;
|