canvas-editor-engine 2.0.21 → 2.1.2

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,5 +1,5 @@
1
1
  import { IWrapOptions } from "../types/general";
2
2
  export default class ComponentService {
3
- protected static getTemplate(template: string, wrapOptions?: IWrapOptions): HTMLElement | null;
4
- protected static getStyle(css: string): HTMLStyleElement | null;
3
+ protected getTemplate(template: string, wrapOptions?: IWrapOptions): HTMLElement | null;
4
+ protected getStyle(css: string): HTMLStyleElement | null;
5
5
  }
@@ -1,7 +1,14 @@
1
+ import ExcretionComponent from "../components/excretions.component";
2
+ import AppConfig from "../config";
3
+ import AppStoreRepository from "../store/storeRepository";
1
4
  import { IImageOptions } from "../types/image";
2
5
  export default class CropService {
3
- static setup(): void;
4
- static crop(ctx: CanvasRenderingContext2D): void;
5
- static viewCropButton(): void;
6
- static get options(): IImageOptions;
6
+ private appConfig;
7
+ private appStoreRepository;
8
+ private excretionComponent;
9
+ constructor(appConfig: AppConfig, appStoreRepository: AppStoreRepository, excretionComponent: ExcretionComponent);
10
+ setup(): void;
11
+ crop(ctx: CanvasRenderingContext2D): void;
12
+ viewCropButton(): void;
13
+ get options(): IImageOptions;
7
14
  }
@@ -1,4 +1,7 @@
1
+ import CanvasComponent from "../components/canvas.component";
1
2
  export default class DownloadService {
2
- static getDataUrl(): string;
3
- static download(filename?: string): void;
3
+ private canvasComponent;
4
+ constructor(canvasComponent: CanvasComponent);
5
+ getDataUrl(): string;
6
+ download(filename?: string): void;
4
7
  }
@@ -1,17 +1,25 @@
1
+ import AppConfig from "../config";
2
+ import AppStoreRepository from "../store/storeRepository";
1
3
  import type { IDrawImageArgs, IDrawImageProcessor, IFilterOptions, IImageLoggingDataVague, IImageOptions } from "../types/image";
2
4
  import { Project } from "../types/project";
5
+ import EventService from "./event.service";
3
6
  export default class DrawService {
4
- static imageProcessor: IDrawImageProcessor;
5
- static drawImage(ctx: CanvasRenderingContext2D, src: string, options: IDrawImageArgs): void;
6
- static drawProject(ctx: CanvasRenderingContext2D, project: Project): void;
7
- static drawSmoothImage(useStore: boolean, options: IDrawImageArgs, filterOptions: IFilterOptions): void;
8
- private static updateImageStateAfterVague;
9
- private static getFilterArgs;
7
+ private appConfig;
8
+ private appStoreRepository;
9
+ private eventService;
10
+ imageProcessor: IDrawImageProcessor;
11
+ constructor(appConfig: AppConfig, appStoreRepository: AppStoreRepository, eventService: EventService);
12
+ drawImage(ctx: CanvasRenderingContext2D, src: string, options: IDrawImageArgs): void;
13
+ drawProject(ctx: CanvasRenderingContext2D, project: Project): void;
14
+ drawSmoothImage(useStore: boolean, options: IDrawImageArgs, filterOptions: IFilterOptions): void;
15
+ private updateImageStateAfterVague;
16
+ private getFilterArgs;
10
17
  }
11
18
  export declare class SCImage implements IDrawImageProcessor {
19
+ private appConfig;
12
20
  private img;
13
21
  private ctx;
14
- constructor(src: string, ctx: CanvasRenderingContext2D);
22
+ constructor(appConfig: AppConfig, src: string, ctx: CanvasRenderingContext2D);
15
23
  draw(options?: IDrawImageArgs): Promise<unknown>;
16
24
  vague(options: IImageOptions, filterOptions: IFilterOptions): Promise<IImageLoggingDataVague>;
17
25
  }
@@ -9,8 +9,8 @@ export declare class EventAtom implements ControlEvent {
9
9
  action: (args?: any) => any;
10
10
  }
11
11
  export default class EventService {
12
- static eventList: EventAtom[];
13
- static subcribe(controlEvent: ControlEvent): void;
14
- static dispatch(name: ControlEvent['name'], eventArgs?: any): void;
15
- static applyEvents(baseElement: HTMLDivElement): void;
12
+ eventList: EventAtom[];
13
+ subcribe(controlEvent: ControlEvent): void;
14
+ dispatch(name: ControlEvent['name'], eventArgs?: any): void;
15
+ applyEvents(baseElement: HTMLDivElement): void;
16
16
  }
@@ -1,20 +1,20 @@
1
1
  import { ILog, ILogItem } from "../types/log";
2
2
  import ComponentService from "./component.service";
3
3
  export default class LoggerService {
4
- static log: ILog<ComponentService, any, any>;
5
- static get components(): {
4
+ log: ILog<ComponentService, any, any>;
5
+ get components(): {
6
6
  add<TLogPrototype>(logItem: ILogItem<TLogPrototype>): void;
7
7
  get<TLogPrototype>(field: keyof ILog<ComponentService, any, any>, name: string): void;
8
8
  };
9
- static get services(): {
9
+ get services(): {
10
10
  add<TLogPrototype>(logItem: ILogItem<TLogPrototype>): void;
11
11
  get<TLogPrototype>(field: keyof ILog<ComponentService, any, any>, name: string): void;
12
12
  };
13
- static get planed(): {
13
+ get planed(): {
14
14
  add<TLogPrototype>(logItem: ILogItem<TLogPrototype>): void;
15
15
  get<TLogPrototype>(field: keyof ILog<ComponentService, any, any>, name: string): void;
16
16
  };
17
- private static getMethods;
18
- private static _add;
19
- private static _get;
17
+ private getMethods;
18
+ private _add;
19
+ private _get;
20
20
  }
@@ -1,11 +1,12 @@
1
1
  import { IProjectModule, TProjectModuleName } from "../types/project";
2
2
  import { ProjectFileSerializer } from "../utils/project-file-serializer";
3
3
  export default class ProjectsService {
4
- private static _modules;
5
- private static _serializer;
6
- static on(moduleName: TProjectModuleName): {
4
+ private _modules;
5
+ private _serializer;
6
+ constructor();
7
+ on(moduleName: TProjectModuleName): {
7
8
  getSerializerInstance: (file: any) => ProjectFileSerializer;
8
9
  instance: IProjectModule;
9
10
  };
10
- private static _addModule;
11
+ private _addModule;
11
12
  }
@@ -1,8 +1,13 @@
1
+ import AppStoreRepository from "../store/storeRepository";
1
2
  import { IUpdateProject, Project } from "../types/project";
3
+ import ThroughHistoryService from "./through-history.service";
2
4
  export default class PullProjectService {
3
- private static _project;
4
- static get project(): Project;
5
- static refreshProject(): void;
6
- static updateProject(project: IUpdateProject): void;
7
- static pull(name: Project['name'], description: Project['description']): void;
5
+ private throughHistoryService;
6
+ private appStoreRepository;
7
+ private _project;
8
+ constructor(throughHistoryService: ThroughHistoryService, appStoreRepository: AppStoreRepository);
9
+ get project(): Project;
10
+ refreshProject(): void;
11
+ updateProject(project: IUpdateProject): void;
12
+ pull(name: Project['name'], description: Project['description']): void;
8
13
  }
@@ -1,12 +1,17 @@
1
+ import AppConfig from "../config";
2
+ import AppStoreRepository from "../store/storeRepository";
1
3
  import { IHistoryLine } from "../types/history";
2
4
  import { Project } from "../types/project";
3
5
  export default class ThroughHistoryService {
4
- static cache: IHistoryLine[];
5
- static current(): IHistoryLine;
6
- static prev(): IHistoryLine;
7
- static undo(ctx: CanvasRenderingContext2D): void;
8
- static redo(ctx: CanvasRenderingContext2D): void;
9
- static clearCache(): void;
10
- static recovery(project: Project): void;
11
- private static updateCanvas;
6
+ private appConfig;
7
+ private appStoreRepository;
8
+ cache: IHistoryLine[];
9
+ constructor(appConfig: AppConfig, appStoreRepository: AppStoreRepository);
10
+ current(): IHistoryLine;
11
+ prev(): IHistoryLine;
12
+ undo(ctx: CanvasRenderingContext2D): void;
13
+ redo(ctx: CanvasRenderingContext2D): void;
14
+ clearCache(): void;
15
+ recovery(project: Project): void;
16
+ private updateCanvas;
12
17
  }
@@ -1,4 +1,7 @@
1
+ import AppConfig from "../config";
1
2
  export default class ToolLayerService {
2
- static multiplier: number;
3
- static getLayerIndex(layerName: string): number;
3
+ private appConfig;
4
+ multiplier: number;
5
+ constructor(appConfig: AppConfig);
6
+ getLayerIndex(layerName: string): number;
4
7
  }
@@ -1,10 +1,13 @@
1
+ import CanvasComponent from "../components/canvas.component";
1
2
  import { ITool } from "../types/general";
2
3
  export default class ToolService {
3
- static before: ITool | null;
4
- static active: ITool | null;
5
- static registry: ITool[];
6
- static add(tool: ITool): boolean;
7
- static setActive(id: ITool['id']): void;
8
- static offActive(id?: ITool['id']): void;
9
- private static off;
4
+ private canvasComponent;
5
+ before: ITool | null;
6
+ active: ITool | null;
7
+ registry: ITool[];
8
+ constructor(canvasComponent: CanvasComponent);
9
+ add(tool: ITool): boolean;
10
+ setActive(id: ITool['id']): void;
11
+ offActive(id?: ITool['id']): void;
12
+ private off;
10
13
  }
@@ -1,14 +1,16 @@
1
1
  import { StateService } from "../services/store.service";
2
+ import ThroughHistoryService from "../services/through-history.service";
2
3
  import { IHistoryLine, TReducerNames } from "../types/history";
3
4
  export interface IHistoryState {
4
5
  historyLines: IHistoryLine[];
5
6
  }
6
7
  export declare class HistoryState implements StateService {
8
+ private throughHistoryService;
7
9
  private default;
8
10
  private _emergeCompleteIt;
9
11
  private _historyLines;
10
12
  get historyLines(): IHistoryState['historyLines'];
11
- constructor();
13
+ constructor(throughHistoryService: ThroughHistoryService);
12
14
  reduce(name: TReducerNames, payload?: IHistoryLine | IHistoryState): void;
13
15
  emerge(completeIt: (history: IHistoryState['historyLines']) => void): void;
14
16
  reset(): void;
@@ -1,5 +1,6 @@
1
1
  import { StateService } from "../services/store.service";
2
2
  import { IPosition, ISize } from "../types/general";
3
+ import AppStoreRepository from "./storeRepository";
3
4
  export interface IImageState {
4
5
  position: IPosition;
5
6
  size: ISize;
@@ -11,6 +12,7 @@ export interface IImageStateReduce {
11
12
  tempImageData?: IImageState['tempImageData'];
12
13
  }
13
14
  export declare class ImageState implements StateService {
15
+ private appStoreRepository;
14
16
  private default;
15
17
  private _position;
16
18
  private _size;
@@ -18,7 +20,7 @@ export declare class ImageState implements StateService {
18
20
  get position(): IImageState['position'];
19
21
  get size(): IImageState['size'];
20
22
  get tempImageData(): IImageState['tempImageData'];
21
- constructor();
23
+ constructor(appStoreRepository: AppStoreRepository);
22
24
  reduce(payload: IImageStateReduce, title?: string): void;
23
25
  reset(): void;
24
26
  getEntry(): {
@@ -1,6 +1,8 @@
1
1
  import { StoreService } from "../services/store.service";
2
+ import ThroughHistoryService from "../services/through-history.service";
2
3
  import { HistoryState } from "./history.state";
3
4
  import { ImageState } from "./image.state";
5
+ import AppStoreRepository from "./storeRepository";
4
6
  export declare class Store implements StoreService {
5
7
  imageState: ImageState;
6
8
  historyState: HistoryState;
@@ -8,6 +10,8 @@ export declare class Store implements StoreService {
8
10
  reset(): void;
9
11
  }
10
12
  export default class AppStore {
11
- static store: Store;
12
- static subscribe(to: 'history', completeIt: (...args: any) => void): void;
13
+ private throughHistoryService;
14
+ private appStoreRepository;
15
+ constructor(throughHistoryService: ThroughHistoryService, appStoreRepository: AppStoreRepository);
16
+ subscribe(to: 'history', completeIt: (...args: any) => void): void;
13
17
  }
@@ -0,0 +1,4 @@
1
+ import { Store } from "./store";
2
+ export default class AppStoreRepository {
3
+ store: Store;
4
+ }
@@ -1,9 +1,11 @@
1
+ import AppConfig from "../config";
1
2
  import { IExtendedImageDataModel, type IImageOptions, type IImageSize, type TBuff, type TRGBABuff } from "../types/image";
2
3
  import type { ISize, THEXColor } from '../types/general';
3
4
  export declare class Filter {
5
+ private appConfig;
4
6
  ctx: CanvasRenderingContext2D;
5
7
  imageSize: IImageSize;
6
- constructor(ctx: CanvasRenderingContext2D);
8
+ constructor(appConfig: AppConfig, ctx: CanvasRenderingContext2D);
7
9
  setImageSize(size: IImageSize): void;
8
10
  copy(options: IImageOptions): ImageData;
9
11
  copyExtendedModel(options: IImageOptions): IExtendedImageDataModel;
@@ -1,4 +1,6 @@
1
+ import CanvasComponent from "./components/canvas.component";
1
2
  import { TComponent } from "./types/general";
3
+ import AppConfig from "./config";
2
4
  export declare class WebComponentWrapper {
3
5
  baseElement: HTMLDivElement;
4
6
  editorWrapElement: HTMLDivElement;
@@ -22,5 +24,12 @@ export declare class WebComponentWrapper {
22
24
  private _baseStyle;
23
25
  }
24
26
  export default class WebComponent extends HTMLElement {
27
+ appConfig: AppConfig;
28
+ canvasComponent: CanvasComponent;
29
+ canvasElement: HTMLDivElement;
25
30
  constructor();
31
+ get initial(): {
32
+ editorElement: HTMLDivElement;
33
+ canvasSelector: string;
34
+ };
26
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "2.0.21",
3
+ "version": "2.1.2",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",