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.
- package/dist/components/canvas.component.d.ts +20 -13
- package/dist/components/excretions.component.d.ts +34 -25
- package/dist/components/loading.component.d.ts +13 -8
- package/dist/components/pipette.component.d.ts +22 -15
- package/dist/components/slot.component.d.ts +7 -4
- package/dist/config.d.ts +11 -15
- package/dist/filters/collection/vague.d.ts +2 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.mjs +1224 -1157
- package/dist/services/component.service.d.ts +2 -2
- package/dist/services/crop.service.d.ts +11 -4
- package/dist/services/download.service.d.ts +5 -2
- package/dist/services/draw.service.d.ts +15 -7
- package/dist/services/event.service.d.ts +4 -4
- package/dist/services/logger.service.d.ts +7 -7
- package/dist/services/projects.service.d.ts +5 -4
- package/dist/services/pull-project.service.d.ts +10 -5
- package/dist/services/through-history.service.d.ts +13 -8
- package/dist/services/tool-layers.service.d.ts +5 -2
- package/dist/services/tool.service.d.ts +10 -7
- package/dist/store/history.state.d.ts +3 -1
- package/dist/store/image.state.d.ts +3 -1
- package/dist/store/store.d.ts +6 -2
- package/dist/store/storeRepository.d.ts +4 -0
- package/dist/utils/filter.d.ts +3 -1
- package/dist/web-component.d.ts +9 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IWrapOptions } from "../types/general";
|
|
2
2
|
export default class ComponentService {
|
|
3
|
-
protected
|
|
4
|
-
protected
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
3
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
18
|
-
private
|
|
19
|
-
private
|
|
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
|
|
5
|
-
private
|
|
6
|
-
|
|
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
|
|
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
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
3
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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(): {
|
package/dist/store/store.d.ts
CHANGED
|
@@ -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
|
-
|
|
12
|
-
|
|
13
|
+
private throughHistoryService;
|
|
14
|
+
private appStoreRepository;
|
|
15
|
+
constructor(throughHistoryService: ThroughHistoryService, appStoreRepository: AppStoreRepository);
|
|
16
|
+
subscribe(to: 'history', completeIt: (...args: any) => void): void;
|
|
13
17
|
}
|
package/dist/utils/filter.d.ts
CHANGED
|
@@ -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;
|
package/dist/web-component.d.ts
CHANGED
|
@@ -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
|
}
|