canvas-editor-engine 2.0.21 → 2.1.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.
@@ -1,21 +1,28 @@
1
+ import AppConfig from "../config";
1
2
  import { TSubscribeAction, TSubscriptionTypes } from "../types/canvas";
2
3
  import { ICursorPosition, TCursorStyleName } from "../types/cursor";
3
4
  import ComponentService from "../services/component.service";
5
+ import LoggerService from "../services/logger.service";
6
+ import ToolLayerService from "../services/tool-layers.service";
4
7
  export default class CanvasComponent extends ComponentService {
5
- private static template;
6
- private static css;
7
- static eventListener: HTMLDivElement;
8
- static canvas: HTMLCanvasElement;
9
- static ctx: CanvasRenderingContext2D | null;
10
- private static subscriptions;
11
- private static _cursorStyle;
12
- static getComponent(): {
8
+ private appConfig;
9
+ private loggerService;
10
+ private toolLayerService;
11
+ constructor(appConfig: AppConfig, loggerService: LoggerService, toolLayerService: ToolLayerService);
12
+ private template;
13
+ private css;
14
+ eventListener: HTMLDivElement;
15
+ canvas: HTMLCanvasElement;
16
+ ctx: CanvasRenderingContext2D | null;
17
+ private subscriptions;
18
+ private _cursorStyle;
19
+ getComponent(): {
13
20
  canvasTemplate: HTMLElement;
14
21
  canvasStyle: HTMLStyleElement;
15
22
  };
16
- static getCanvasSelector(): string;
17
- static set cursorStyle(styleName: TCursorStyleName | undefined | null);
18
- static getCursorPosition(event: MouseEvent): ICursorPosition;
19
- static subscribe(eventName: TSubscriptionTypes, action: TSubscribeAction): void;
20
- static simulateSubscriptions(): void;
23
+ getCanvasSelector(): string;
24
+ set cursorStyle(styleName: TCursorStyleName | undefined | null);
25
+ getCursorPosition(event: MouseEvent): ICursorPosition;
26
+ subscribe(eventName: TSubscriptionTypes, action: TSubscribeAction): void;
27
+ simulateSubscriptions(): void;
21
28
  }
@@ -1,32 +1,41 @@
1
1
  import ComponentService from "../services/component.service";
2
+ import ToolService from "../services/tool.service";
3
+ import CanvasComponent from "./canvas.component";
2
4
  import type { IExcretionsCoords, TExcretionStyle, TExcretionToolState } from "../types/excretion";
5
+ import LoggerService from "../services/logger.service";
6
+ import ToolLayerService from "../services/tool-layers.service";
3
7
  export default class ExcretionsComponent extends ComponentService {
4
- private static template;
5
- private static templateExcretion;
6
- private static _excretionDefaultStyle;
7
- private static css;
8
- static excretionWrap: HTMLElement;
9
- private static _excretions;
10
- private static _excretionState;
11
- private static _excretionActivity;
12
- private static _excretionToolState;
13
- private static _tempCoords;
14
- static excretionsCoords: IExcretionsCoords[];
15
- private static _additionStyle;
16
- static get additionStyle(): TExcretionStyle;
17
- static set additionStyle(value: TExcretionStyle);
18
- private static applyExcretionStyle;
19
- private static determineCropStyle;
20
- private static determineDefaultStyle;
21
- private static tool;
22
- static getComponent(): {
8
+ private toolService;
9
+ private loggerService;
10
+ private toolLayerService;
11
+ private canvasComponent;
12
+ constructor(toolService: ToolService, loggerService: LoggerService, toolLayerService: ToolLayerService, canvasComponent: CanvasComponent);
13
+ private template;
14
+ private templateExcretion;
15
+ private _excretionDefaultStyle;
16
+ private css;
17
+ excretionWrap: HTMLElement;
18
+ private _excretions;
19
+ private _excretionState;
20
+ private _excretionActivity;
21
+ private _excretionToolState;
22
+ private _tempCoords;
23
+ excretionsCoords: IExcretionsCoords[];
24
+ private _additionStyle;
25
+ get additionStyle(): TExcretionStyle;
26
+ set additionStyle(value: TExcretionStyle);
27
+ private applyExcretionStyle;
28
+ private determineCropStyle;
29
+ private determineDefaultStyle;
30
+ private tool;
31
+ getComponent(): {
23
32
  excretionsTemplate: HTMLElement;
24
33
  excretionsStyle: HTMLStyleElement;
25
34
  };
26
- private static set excretionState(value);
27
- static setToolState(toolState: TExcretionToolState): void;
28
- static clearExcretionsCoords(): void;
29
- private static getTempCoords;
30
- private static endExcretion;
31
- private static emmit;
35
+ private set excretionState(value);
36
+ setToolState(toolState: TExcretionToolState): void;
37
+ clearExcretionsCoords(): void;
38
+ private getTempCoords;
39
+ private endExcretion;
40
+ private emmit;
32
41
  }
@@ -1,14 +1,19 @@
1
1
  import ComponentService from "../services/component.service";
2
+ import EventService from "../services/event.service";
3
+ import LoggerService from "../services/logger.service";
2
4
  export default class LoadingComponent extends ComponentService {
3
- private static template;
4
- private static css;
5
- static loading: HTMLElement;
6
- static getComponent(): {
5
+ private loggerService;
6
+ private eventService;
7
+ constructor(loggerService: LoggerService, eventService: EventService);
8
+ private template;
9
+ private css;
10
+ loading: HTMLElement;
11
+ getComponent(): {
7
12
  loadingTemplate: HTMLElement;
8
13
  loadingStyle: HTMLStyleElement;
9
14
  };
10
- static hide(): void;
11
- static view(): void;
12
- private static subscribeLoadingStart;
13
- private static subscribeLoadingEnd;
15
+ hide(): void;
16
+ view(): void;
17
+ private subscribeLoadingStart;
18
+ private subscribeLoadingEnd;
14
19
  }
@@ -1,23 +1,30 @@
1
1
  import { TPipetteState } from "../types/pipette";
2
2
  import { THEXColor } from "../types/general";
3
+ import CanvasComponent from "./canvas.component";
3
4
  import ComponentService from "../services/component.service";
5
+ import ToolService from "../services/tool.service";
6
+ import LoggerService from "../services/logger.service";
4
7
  export default class PipetteComponent extends ComponentService {
5
- static template: string;
6
- static css: string;
7
- static pipette: HTMLElement;
8
- private static _pipetteColor;
9
- static set pipetteColor(color: THEXColor);
10
- static get pipetteColor(): THEXColor;
11
- private static _pipetteColorElement;
12
- private static _pipetteState;
13
- private static tool;
14
- static getComponent(): {
8
+ private toolService;
9
+ private loggerService;
10
+ private canvasComponent;
11
+ constructor(toolService: ToolService, loggerService: LoggerService, canvasComponent: CanvasComponent);
12
+ template: string;
13
+ css: string;
14
+ pipette: HTMLElement;
15
+ private _pipetteColor;
16
+ set pipetteColor(color: THEXColor);
17
+ get pipetteColor(): THEXColor;
18
+ private _pipetteColorElement;
19
+ private _pipetteState;
20
+ private tool;
21
+ getComponent(): {
15
22
  pipetteTemplate: HTMLElement;
16
23
  pipetteStyle: HTMLStyleElement;
17
24
  };
18
- static setState(state: TPipetteState): void;
19
- static emmit(): void;
20
- private static setColorFromChoosenPixel;
21
- private static show;
22
- private static hide;
25
+ setState(state: TPipetteState): void;
26
+ emmit(): void;
27
+ private setColorFromChoosenPixel;
28
+ private show;
29
+ private hide;
23
30
  }
@@ -1,9 +1,12 @@
1
1
  import ComponentService from "../services/component.service";
2
+ import LoggerService from "../services/logger.service";
2
3
  export default class SlotComponent extends ComponentService {
3
- private static template;
4
- private static css;
5
- static slot: HTMLSlotElement;
6
- static getComponent(slotName: string): {
4
+ private loggerService;
5
+ constructor(loggerService: LoggerService);
6
+ private template;
7
+ private css;
8
+ slot: HTMLSlotElement;
9
+ getComponent(slotName: string): {
7
10
  slotTemplate: HTMLElement;
8
11
  slotStyle: HTMLStyleElement;
9
12
  };
package/dist/config.d.ts CHANGED
@@ -3,21 +3,17 @@ export interface ILayer {
3
3
  name: string;
4
4
  index: number;
5
5
  }
6
- export declare abstract class ConfigStore {
7
- static _WEB_COMPONENT_TAG_NAME: string;
8
- static _CANVAS_SIZE: ICanvasSize;
9
- static _LAYERS: ILayer[];
10
- }
11
- export declare class ConfigFabric implements ConfigStore {
12
- protected static _WEB_COMPONENT_TAG_NAME: string;
13
- protected static _CANVAS_SIZE: ICanvasSize;
14
- protected static _LAYERS: ILayer[];
6
+ export declare class ConfigFabric {
7
+ protected _WEB_COMPONENT_TAG_NAME: string;
8
+ protected _CANVAS_SIZE: ICanvasSize;
9
+ protected _LAYERS: ILayer[];
15
10
  }
16
11
  export default class AppConfig extends ConfigFabric {
17
- static get WEB_COMPONENT_TAG_NAME(): string;
18
- static set WEB_COMPONENT_TAG_NAME(value: string | undefined);
19
- static get CANVAS_SIZE(): ICanvasSize;
20
- static set CANVAS_SIZE(value: ICanvasSize | undefined);
21
- static get LAYERS(): ILayer[];
22
- static set LAYERS(value: ILayer[]);
12
+ constructor();
13
+ get WEB_COMPONENT_TAG_NAME(): string;
14
+ set WEB_COMPONENT_TAG_NAME(value: string | undefined);
15
+ get CANVAS_SIZE(): ICanvasSize;
16
+ set CANVAS_SIZE(value: ICanvasSize | undefined);
17
+ get LAYERS(): ILayer[];
18
+ set LAYERS(value: ILayer[]);
23
19
  }
@@ -1,9 +1,10 @@
1
1
  import type { IFilterOptions, IImageLoggingDataVague, IImageOptions, TFilterMethod } from "../../types/image";
2
2
  import { Filter } from "../../utils/filter";
3
+ import AppConfig from "../../config";
3
4
  export default class VagueFilter extends Filter {
4
5
  options: IImageOptions;
5
6
  filterList: TFilterMethod[];
6
- constructor(ctx: CanvasRenderingContext2D, options: IImageOptions);
7
+ constructor(appConfig: AppConfig, ctx: CanvasRenderingContext2D, options: IImageOptions);
7
8
  on(action: TFilterMethod, filterOptions: IFilterOptions): Promise<IImageLoggingDataVague>;
8
9
  pixel(imageData: ImageData, filterOptions: IFilterOptions): ImageData;
9
10
  private getQualityProcessedRemainder;
package/dist/index.d.ts CHANGED
@@ -17,19 +17,18 @@ 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
- constructor(webComponentTagName?: string);
20
+ private appConfig;
21
+ constructor(appConfig: AppConfig);
21
22
  getInitial(): {
22
23
  tag: string;
23
24
  component: typeof WebComponent;
24
25
  };
25
26
  }
26
27
  declare class StaticCanvasEditorEngine extends CanvasEditorEngine {
27
- constructor(webComponentTagName?: string);
28
+ constructor(appConfig: AppConfig);
28
29
  init(): void;
29
30
  }
30
31
  declare class VueCanvasEditorEngine extends CanvasEditorEngine {
31
- constructor(webComponentTagName?: string);
32
- getContext2D(): CanvasRenderingContext2D;
33
- getCanvas(): HTMLCanvasElement;
32
+ constructor(appConfig: AppConfig);
34
33
  }
35
34
  export { AppConfig, PipetteComponent, CanvasComponent, ExcretionComponent, SlotComponent, LoadingComponent, ToolService, DrawService, LoggerService, CropService, DownloadService, ToolLayerService, EventService, ThroughHistoryService, ProjectsService, PullProjectService, StaticCanvasEditorEngine, VueCanvasEditorEngine, AppStore, };