canvas-editor-engine 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const config_1 = require("../config");
4
4
  const component_service_1 = require("../services/component.service");
5
+ const logger_service_1 = require("../services/logger.service");
5
6
  class CanvasComponent extends component_service_1.default {
7
+ ;
6
8
  static getComponent() {
7
9
  const canvasTemplate = CanvasComponent.getTemplate(CanvasComponent.template);
8
10
  const canvasStyle = CanvasComponent.getStyle(CanvasComponent.css);
@@ -72,4 +74,13 @@ CanvasComponent._cursorStyle = {
72
74
  before: null,
73
75
  current: 'default',
74
76
  };
77
+ (() => {
78
+ logger_service_1.default.components.add({
79
+ info: {
80
+ name: 'canvas',
81
+ description: 'canvas component',
82
+ },
83
+ prototype: CanvasComponent,
84
+ });
85
+ })();
75
86
  exports.default = CanvasComponent;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const component_service_1 = require("../services/component.service");
4
4
  const tool_service_1 = require("../services/tool.service");
5
5
  const canvas_component_1 = require("./canvas.component");
6
+ const logger_service_1 = require("../services/logger.service");
6
7
  class ExcretionsComponent extends component_service_1.default {
7
8
  static getComponent() {
8
9
  const wrapOptions = {
@@ -188,5 +189,12 @@ ExcretionsComponent.tool = {
188
189
  };
189
190
  (() => {
190
191
  tool_service_1.default.add(ExcretionsComponent.tool);
192
+ logger_service_1.default.components.add({
193
+ info: {
194
+ name: 'excretion',
195
+ description: 'excretion component',
196
+ },
197
+ prototype: ExcretionsComponent,
198
+ });
191
199
  })();
192
200
  exports.default = ExcretionsComponent;
@@ -4,6 +4,7 @@ const convert_1 = require("../utils/convert");
4
4
  const canvas_component_1 = require("./canvas.component");
5
5
  const component_service_1 = require("../services/component.service");
6
6
  const tool_service_1 = require("../services/tool.service");
7
+ const logger_service_1 = require("../services/logger.service");
7
8
  class PipetteComponent extends component_service_1.default {
8
9
  static set pipetteColor(color) {
9
10
  PipetteComponent._pipetteColor = color;
@@ -134,5 +135,12 @@ PipetteComponent.tool = {
134
135
  };
135
136
  (() => {
136
137
  tool_service_1.default.add(PipetteComponent.tool);
138
+ logger_service_1.default.components.add({
139
+ info: {
140
+ name: 'pipette',
141
+ description: 'pipette component',
142
+ },
143
+ prototype: PipetteComponent,
144
+ });
137
145
  })();
138
146
  exports.default = PipetteComponent;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const component_service_1 = require("../services/component.service");
4
+ const logger_service_1 = require("../services/logger.service");
4
5
  class SlotComponent extends component_service_1.default {
5
6
  static getComponent(slotName) {
6
7
  const wrapOptions = {
@@ -17,4 +18,13 @@ SlotComponent.template = `
17
18
  <slot class="slot"></slot>
18
19
  `;
19
20
  SlotComponent.css = ``;
21
+ (() => {
22
+ logger_service_1.default.components.add({
23
+ info: {
24
+ name: 'slot',
25
+ description: 'slot component',
26
+ },
27
+ prototype: SlotComponent,
28
+ });
29
+ })();
20
30
  exports.default = SlotComponent;
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ import ExcretionComponent from "./components/excretions.component";
6
6
  import SlotComponent from "./components/slot.component";
7
7
  import DrawService from "./services/draw.service";
8
8
  import ToolService from "./services/tool.service";
9
+ import LoggerService from "./services/logger.service";
9
10
  declare class CanvasEditorEngine {
10
11
  constructor(webComponentTagName?: string);
11
12
  getInitial(): {
@@ -22,4 +23,4 @@ declare class VueCanvasEditorEngine extends CanvasEditorEngine {
22
23
  getContext2D(): CanvasRenderingContext2D;
23
24
  getCanvas(): HTMLCanvasElement;
24
25
  }
25
- export { AppConfig, PipetteComponent, CanvasComponent, ExcretionComponent, SlotComponent, ToolService, DrawService, StaticCanvasEditorEngine, VueCanvasEditorEngine, };
26
+ export { AppConfig, PipetteComponent, CanvasComponent, ExcretionComponent, SlotComponent, ToolService, DrawService, LoggerService, StaticCanvasEditorEngine, VueCanvasEditorEngine, };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VueCanvasEditorEngine = exports.StaticCanvasEditorEngine = exports.DrawService = exports.ToolService = exports.SlotComponent = exports.ExcretionComponent = exports.CanvasComponent = exports.PipetteComponent = exports.AppConfig = void 0;
3
+ exports.VueCanvasEditorEngine = exports.StaticCanvasEditorEngine = exports.LoggerService = exports.DrawService = exports.ToolService = exports.SlotComponent = exports.ExcretionComponent = exports.CanvasComponent = exports.PipetteComponent = exports.AppConfig = void 0;
4
4
  const config_1 = require("./config");
5
5
  exports.AppConfig = config_1.default;
6
6
  const web_component_1 = require("./web-component");
@@ -16,6 +16,8 @@ const draw_service_1 = require("./services/draw.service");
16
16
  exports.DrawService = draw_service_1.default;
17
17
  const tool_service_1 = require("./services/tool.service");
18
18
  exports.ToolService = tool_service_1.default;
19
+ const logger_service_1 = require("./services/logger.service");
20
+ exports.LoggerService = logger_service_1.default;
19
21
  class CanvasEditorEngine {
20
22
  constructor(webComponentTagName) {
21
23
  config_1.default.WEB_COMPONENT_TAG_NAME = webComponentTagName;
@@ -0,0 +1,20 @@
1
+ import { ILog, ILogItem } from "../types/log";
2
+ import ComponentService from "./component.service";
3
+ export default class LoggerService {
4
+ static log: ILog<ComponentService, any, any>;
5
+ static get components(): {
6
+ add<TLogPrototype>(logItem: ILogItem<TLogPrototype>): void;
7
+ get<TLogPrototype>(field: keyof ILog<ComponentService, any, any>, name: string): void;
8
+ };
9
+ static get services(): {
10
+ add<TLogPrototype>(logItem: ILogItem<TLogPrototype>): void;
11
+ get<TLogPrototype>(field: keyof ILog<ComponentService, any, any>, name: string): void;
12
+ };
13
+ static get planed(): {
14
+ add<TLogPrototype>(logItem: ILogItem<TLogPrototype>): void;
15
+ get<TLogPrototype>(field: keyof ILog<ComponentService, any, any>, name: string): void;
16
+ };
17
+ private static getMethods;
18
+ private static _add;
19
+ private static _get;
20
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class LoggerService {
4
+ static get components() {
5
+ return LoggerService.getMethods('components');
6
+ }
7
+ ;
8
+ static get services() {
9
+ return LoggerService.getMethods('services');
10
+ }
11
+ ;
12
+ static get planed() {
13
+ return LoggerService.getMethods('planed');
14
+ }
15
+ ;
16
+ static getMethods(fields) {
17
+ return {
18
+ add(logItem) {
19
+ LoggerService._add(fields, logItem);
20
+ },
21
+ get(...args) {
22
+ LoggerService._get(...args);
23
+ },
24
+ };
25
+ }
26
+ static _add(field, logItem) {
27
+ LoggerService.log[field].push(logItem);
28
+ }
29
+ static _get(field, name) {
30
+ return LoggerService.log[field].find((logItem) => logItem.info.name === name);
31
+ }
32
+ }
33
+ LoggerService.log = {
34
+ components: [],
35
+ services: [],
36
+ planed: [],
37
+ };
38
+ exports.default = LoggerService;
@@ -0,0 +1,13 @@
1
+ export interface ILog<A, R, P> {
2
+ components: ILogItem<A>[];
3
+ services: ILogItem<R>[];
4
+ planed: ILogItem<P>[];
5
+ }
6
+ export interface ILogItem<TLogPrototype> {
7
+ info: ILogItemInfo;
8
+ prototype: TLogPrototype;
9
+ }
10
+ export interface ILogItemInfo {
11
+ name: string;
12
+ description: string;
13
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ ;
4
+ ;
5
+ ;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",