canvas-editor-engine 2.0.1 → 2.0.4

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.
Files changed (79) hide show
  1. package/dist/index.d.ts +574 -18
  2. package/dist/index.mjs.js +2 -0
  3. package/dist/index.mjs.js.LICENSE.txt +8 -0
  4. package/package.json +9 -4
  5. package/dist/components/canvas.component.d.ts +0 -21
  6. package/dist/components/canvas.component.js +0 -90
  7. package/dist/components/excretions.component.d.ts +0 -32
  8. package/dist/components/excretions.component.js +0 -280
  9. package/dist/components/loading.component.d.ts +0 -14
  10. package/dist/components/loading.component.js +0 -96
  11. package/dist/components/pipette.component.d.ts +0 -23
  12. package/dist/components/pipette.component.js +0 -149
  13. package/dist/components/slot.component.d.ts +0 -10
  14. package/dist/components/slot.component.js +0 -31
  15. package/dist/config.d.ts +0 -23
  16. package/dist/config.js +0 -67
  17. package/dist/filters/collection/vague.d.ts +0 -13
  18. package/dist/filters/collection/vague.js +0 -150
  19. package/dist/filters/index.d.ts +0 -2
  20. package/dist/filters/index.js +0 -5
  21. package/dist/index.js +0 -69
  22. package/dist/services/component.service.d.ts +0 -5
  23. package/dist/services/component.service.js +0 -37
  24. package/dist/services/crop.service.d.ts +0 -7
  25. package/dist/services/crop.service.js +0 -50
  26. package/dist/services/download.service.d.ts +0 -4
  27. package/dist/services/download.service.js +0 -15
  28. package/dist/services/draw.service.d.ts +0 -17
  29. package/dist/services/draw.service.js +0 -152
  30. package/dist/services/event.service.d.ts +0 -16
  31. package/dist/services/event.service.js +0 -35
  32. package/dist/services/logger.service.d.ts +0 -20
  33. package/dist/services/logger.service.js +0 -38
  34. package/dist/services/projects.service.d.ts +0 -11
  35. package/dist/services/projects.service.js +0 -98
  36. package/dist/services/pull-project.service.d.ts +0 -8
  37. package/dist/services/pull-project.service.js +0 -34
  38. package/dist/services/store.service.d.ts +0 -6
  39. package/dist/services/store.service.js +0 -11
  40. package/dist/services/through-history.service.d.ts +0 -12
  41. package/dist/services/through-history.service.js +0 -49
  42. package/dist/services/tool-layers.service.d.ts +0 -4
  43. package/dist/services/tool-layers.service.js +0 -12
  44. package/dist/services/tool.service.d.ts +0 -10
  45. package/dist/services/tool.service.js +0 -56
  46. package/dist/store/history.state.d.ts +0 -15
  47. package/dist/store/history.state.js +0 -76
  48. package/dist/store/image.state.d.ts +0 -30
  49. package/dist/store/image.state.js +0 -70
  50. package/dist/store/store.d.ts +0 -13
  51. package/dist/store/store.js +0 -31
  52. package/dist/types/canvas.d.ts +0 -10
  53. package/dist/types/canvas.js +0 -3
  54. package/dist/types/cursor.d.ts +0 -9
  55. package/dist/types/cursor.js +0 -3
  56. package/dist/types/excretion.d.ts +0 -27
  57. package/dist/types/excretion.js +0 -5
  58. package/dist/types/general.d.ts +0 -24
  59. package/dist/types/general.js +0 -5
  60. package/dist/types/history.d.ts +0 -7
  61. package/dist/types/history.js +0 -2
  62. package/dist/types/image.d.ts +0 -48
  63. package/dist/types/image.js +0 -10
  64. package/dist/types/log.d.ts +0 -13
  65. package/dist/types/log.js +0 -5
  66. package/dist/types/pipette.d.ts +0 -1
  67. package/dist/types/pipette.js +0 -2
  68. package/dist/types/project.d.ts +0 -38
  69. package/dist/types/project.js +0 -14
  70. package/dist/utils/convert.d.ts +0 -12
  71. package/dist/utils/convert.js +0 -27
  72. package/dist/utils/filter.d.ts +0 -21
  73. package/dist/utils/filter.js +0 -150
  74. package/dist/utils/guid4.d.ts +0 -13
  75. package/dist/utils/guid4.js +0 -111
  76. package/dist/utils/project-file-serializer.d.ts +0 -13
  77. package/dist/utils/project-file-serializer.js +0 -79
  78. package/dist/web-component.d.ts +0 -30
  79. package/dist/web-component.js +0 -108
@@ -1,20 +0,0 @@
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
- }
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class LoggerService {
4
- static log = {
5
- components: [],
6
- services: [],
7
- planed: [],
8
- };
9
- static get components() {
10
- return LoggerService.getMethods('components');
11
- }
12
- ;
13
- static get services() {
14
- return LoggerService.getMethods('services');
15
- }
16
- ;
17
- static get planed() {
18
- return LoggerService.getMethods('planed');
19
- }
20
- ;
21
- static getMethods(fields) {
22
- return {
23
- add(logItem) {
24
- LoggerService._add(fields, logItem);
25
- },
26
- get(...args) {
27
- LoggerService._get(...args);
28
- },
29
- };
30
- }
31
- static _add(field, logItem) {
32
- LoggerService.log[field].push(logItem);
33
- }
34
- static _get(field, name) {
35
- return LoggerService.log[field].find((logItem) => logItem.info.name === name);
36
- }
37
- }
38
- exports.default = LoggerService;
@@ -1,11 +0,0 @@
1
- import { IProjectModule, TProjectModuleName } from "../types/project";
2
- import { ProjectFileSerializer } from "../utils/project-file-serializer";
3
- export default class ProjectsService {
4
- private static _modules;
5
- private static _serializer;
6
- static on(moduleName: TProjectModuleName): {
7
- getSerializerInstance: (file: any) => ProjectFileSerializer;
8
- instance: IProjectModule;
9
- };
10
- private static _addModule;
11
- }
@@ -1,98 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const project_file_serializer_1 = require("../utils/project-file-serializer");
4
- class LocalStorageProjectModule {
5
- projectsKey = 'cee-projects';
6
- getProjectsFromLocalStorage() {
7
- const projects = localStorage.getItem(this.projectsKey);
8
- return projects ? JSON.parse(projects) : [];
9
- }
10
- getProjectFromLocalStorage(projectId) {
11
- const projects = this.getProjectsFromLocalStorage();
12
- return projects.find((project) => project.id === projectId);
13
- }
14
- saveProjectsToLocalStorage(projects) {
15
- localStorage.setItem(this.projectsKey, JSON.stringify(projects));
16
- }
17
- saveProjectToLocalStorage(project) {
18
- const projects = this.getProjectsFromLocalStorage();
19
- projects.push(project);
20
- localStorage.setItem(this.projectsKey, JSON.stringify(projects));
21
- }
22
- removeProjectFromLocalStorage(projectId) {
23
- const projects = this.getProjectsFromLocalStorage();
24
- const index = projects.findIndex((project) => project.id === projectId);
25
- projects.splice(index, 1);
26
- localStorage.setItem(this.projectsKey, JSON.stringify(projects));
27
- }
28
- updateProjectInLocalStorage(project) {
29
- const projects = this.getProjectsFromLocalStorage();
30
- const index = projects.findIndex((p) => p.id === project.id);
31
- projects[index] = project;
32
- localStorage.setItem(this.projectsKey, JSON.stringify(projects));
33
- }
34
- getProjects() {
35
- return this.getProjectsFromLocalStorage();
36
- }
37
- getProject(projectId) {
38
- return this.getProjectFromLocalStorage(projectId);
39
- }
40
- saveProjects(projects) {
41
- this.saveProjectsToLocalStorage(projects);
42
- }
43
- saveProject(project) {
44
- this.saveProjectToLocalStorage(project);
45
- }
46
- removeProject(projectId) {
47
- this.removeProjectFromLocalStorage(projectId);
48
- }
49
- updateProject(project) {
50
- this.updateProjectInLocalStorage(project);
51
- }
52
- }
53
- class ProjectFileProjectModule {
54
- static _serializer;
55
- static setSerializer(serializer) {
56
- ProjectFileProjectModule._serializer = serializer;
57
- }
58
- getProjects() {
59
- return ProjectFileProjectModule._serializer.getProjects();
60
- }
61
- getProject(projectId) {
62
- return ProjectFileProjectModule._serializer.getProject(projectId);
63
- }
64
- saveProject(project) {
65
- return ProjectFileProjectModule._serializer.saveProject(project);
66
- }
67
- saveProjects(projects) {
68
- return ProjectFileProjectModule._serializer.saveProjects(projects);
69
- }
70
- removeProject(projectId) {
71
- return ProjectFileProjectModule._serializer.removeProject(projectId);
72
- }
73
- updateProject(project) {
74
- return ProjectFileProjectModule._serializer.updateProject(project);
75
- }
76
- }
77
- class ProjectsService {
78
- static _modules = [];
79
- static _serializer = project_file_serializer_1.ProjectFileSerializer;
80
- static on(moduleName) {
81
- const module = ProjectsService._modules.find((module) => module.name === moduleName);
82
- if (!module) {
83
- throw new Error(`Module ${moduleName} not found`);
84
- }
85
- return {
86
- getSerializerInstance: (file) => new ProjectsService._serializer(file),
87
- instance: module.instance,
88
- };
89
- }
90
- static {
91
- ProjectsService._addModule('LocalStorage', new LocalStorageProjectModule());
92
- ProjectsService._addModule('File', new ProjectFileProjectModule());
93
- }
94
- static _addModule(name, module) {
95
- ProjectsService._modules.push({ name, instance: module });
96
- }
97
- }
98
- exports.default = ProjectsService;
@@ -1,8 +0,0 @@
1
- import { IUpdateProject, Project } from "../types/project";
2
- 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;
8
- }
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const store_1 = require("../store/store");
4
- const project_1 = require("../types/project");
5
- const guid4_1 = require("../utils/guid4");
6
- const through_history_service_1 = require("./through-history.service");
7
- class PullProjectService {
8
- static _project = new project_1.Project();
9
- static get project() {
10
- return this._project;
11
- }
12
- static refreshProject() {
13
- PullProjectService._project = new project_1.Project();
14
- }
15
- static updateProject(project) {
16
- Object.keys(project).forEach((key) => {
17
- PullProjectService._project[key] = project[key];
18
- });
19
- }
20
- static pull(name, description) {
21
- const project = new project_1.Project();
22
- const state = {
23
- cache: through_history_service_1.default.cache,
24
- history: store_1.default.store.historyState.historyLines,
25
- current: store_1.default.store.imageState.getEntry(),
26
- };
27
- project.id = new guid4_1.Guid4().generate();
28
- project.description = description || 'New Project';
29
- project.name = name || 'New Project';
30
- project.state = state;
31
- this._project = project;
32
- }
33
- }
34
- exports.default = PullProjectService;
@@ -1,6 +0,0 @@
1
- export declare abstract class StateService {
2
- abstract reset(): void;
3
- }
4
- export declare abstract class StoreService {
5
- abstract reset(): void;
6
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StoreService = exports.StateService = void 0;
4
- class StateService {
5
- }
6
- exports.StateService = StateService;
7
- ;
8
- class StoreService {
9
- }
10
- exports.StoreService = StoreService;
11
- ;
@@ -1,12 +0,0 @@
1
- import { IHistoryLine } from "../types/history";
2
- import { Project } from "../types/project";
3
- 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;
12
- }
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const store_1 = require("../store/store");
4
- const filter_1 = require("../utils/filter");
5
- class ThroughHistoryService {
6
- static cache = [];
7
- static current() {
8
- const history = store_1.default.store.historyState.historyLines;
9
- const lastIndex = history.length - 1;
10
- return history[lastIndex];
11
- }
12
- static prev() {
13
- const history = store_1.default.store.historyState.historyLines;
14
- const prevIndex = history.length - 2;
15
- return history[prevIndex];
16
- }
17
- static undo(ctx) {
18
- const current = ThroughHistoryService.current();
19
- const prev = ThroughHistoryService.prev();
20
- if (!!current?.stateValue) {
21
- ThroughHistoryService.cache.unshift(current);
22
- store_1.default.store.historyState.reduce('UNDO');
23
- if (prev?.stateValue) {
24
- ThroughHistoryService.updateCanvas(ctx, prev.stateValue);
25
- }
26
- }
27
- }
28
- ;
29
- static redo(ctx) {
30
- const firstInCache = ThroughHistoryService.cache.shift();
31
- if (!!firstInCache?.stateValue) {
32
- store_1.default.store.historyState.reduce('REDO', firstInCache);
33
- ThroughHistoryService.updateCanvas(ctx, firstInCache.stateValue);
34
- }
35
- }
36
- ;
37
- static clearCache() {
38
- ThroughHistoryService.cache = [];
39
- }
40
- static recovery(project) {
41
- store_1.default.store.historyState.reduce('SET_HISTORY', { historyLines: project.state.history });
42
- ThroughHistoryService.cache = project.state.cache;
43
- }
44
- static updateCanvas(ctx, stateValue) {
45
- const filter = new filter_1.Filter(ctx);
46
- filter.update(stateValue.tempImageData, stateValue.position);
47
- }
48
- }
49
- exports.default = ThroughHistoryService;
@@ -1,4 +0,0 @@
1
- export default class ToolLayerService {
2
- static multiplier: number;
3
- static getLayerIndex(layerName: string): number;
4
- }
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const config_1 = require("../config");
4
- class ToolLayerService {
5
- static multiplier = 1000;
6
- static getLayerIndex(layerName) {
7
- const layer = config_1.default.LAYERS.find((layer) => layer.name === layerName);
8
- const zIndex = ToolLayerService.multiplier * layer.index;
9
- return zIndex;
10
- }
11
- }
12
- exports.default = ToolLayerService;
@@ -1,10 +0,0 @@
1
- import { ITool } from "../types/general";
2
- 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;
10
- }
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const canvas_component_1 = require("../components/canvas.component");
4
- class ToolService {
5
- static before = null;
6
- static active = null;
7
- static registry = [];
8
- static add(tool) {
9
- const hasRegisteredTool = ToolService.registry.find((registeredTool) => registeredTool.id === tool.id);
10
- if (hasRegisteredTool) {
11
- console.warn('Tool has been previously registered!');
12
- return false;
13
- }
14
- ToolService.registry.push(tool);
15
- return true;
16
- }
17
- static setActive(id) {
18
- if (ToolService.active?.id === id)
19
- return console.warn('Tool is already active');
20
- if (!!ToolService.active?.offAction) {
21
- ToolService.active.offAction();
22
- }
23
- const registeredTool = ToolService.registry.find((registeredTool) => registeredTool.id === id);
24
- if (!!registeredTool) {
25
- ToolService.active = registeredTool;
26
- if (!!ToolService.active?.onAction) {
27
- ToolService.active.onAction();
28
- }
29
- }
30
- else {
31
- console.warn('Tool has not previously been registered with this identifier');
32
- }
33
- }
34
- static offActive(id) {
35
- if (!!id) {
36
- if (ToolService.active.id === id) {
37
- ToolService.off();
38
- }
39
- else {
40
- return console.warn(`ID active tool is not "${id}"`);
41
- }
42
- }
43
- else {
44
- ToolService.off();
45
- }
46
- }
47
- static off() {
48
- if (!!ToolService.active?.offAction) {
49
- ToolService.active.offAction();
50
- }
51
- ToolService.before = ToolService.active;
52
- ToolService.active = null;
53
- canvas_component_1.default.cursorStyle = 'default';
54
- }
55
- }
56
- exports.default = ToolService;
@@ -1,15 +0,0 @@
1
- import { StateService } from "../services/store.service";
2
- import { IHistoryLine, TReducerNames } from "../types/history";
3
- export interface IHistoryState {
4
- historyLines: IHistoryLine[];
5
- }
6
- export declare class HistoryState implements StateService {
7
- private default;
8
- private _emergeCompleteIt;
9
- private _historyLines;
10
- get historyLines(): IHistoryState['historyLines'];
11
- constructor();
12
- reduce(name: TReducerNames, payload?: IHistoryLine | IHistoryState): void;
13
- emerge(completeIt: (history: IHistoryState['historyLines']) => void): void;
14
- reset(): void;
15
- }
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HistoryState = void 0;
4
- const through_history_service_1 = require("../services/through-history.service");
5
- ;
6
- class HistoryState {
7
- default = {
8
- historyLines: [],
9
- };
10
- _emergeCompleteIt;
11
- _historyLines = this.default.historyLines;
12
- get historyLines() { return this._historyLines; }
13
- ;
14
- constructor() {
15
- this.reset();
16
- }
17
- reduce(name, payload) {
18
- const reducer = new Reducer(this);
19
- switch (name) {
20
- case 'SET_HISTORY':
21
- reducer.setHistoryLines(payload);
22
- through_history_service_1.default.clearCache();
23
- break;
24
- case 'UPDATE_HISTORY':
25
- reducer.updateHistoryLines(payload);
26
- through_history_service_1.default.clearCache();
27
- break;
28
- case 'REDO':
29
- reducer.updateHistoryLines(payload);
30
- break;
31
- case 'UNDO':
32
- reducer.popHistoryLines();
33
- break;
34
- }
35
- }
36
- emerge(completeIt) {
37
- this._emergeCompleteIt = completeIt;
38
- }
39
- reset() {
40
- this.reduce('SET_HISTORY', this.default);
41
- }
42
- }
43
- exports.HistoryState = HistoryState;
44
- class Reducer {
45
- state;
46
- constructor(state) {
47
- this.state = state;
48
- }
49
- ;
50
- setHistoryLines(payload) {
51
- let isUpdate = false;
52
- if (!!payload?.historyLines) {
53
- this.state._historyLines = payload.historyLines;
54
- isUpdate = true;
55
- }
56
- if (isUpdate && !!this.state._emergeCompleteIt) {
57
- this.state._emergeCompleteIt(this.state._historyLines);
58
- }
59
- }
60
- updateHistoryLines(payload) {
61
- let isUpdate = false;
62
- if (!!payload?.view) {
63
- this.state._historyLines.push(payload);
64
- isUpdate = true;
65
- }
66
- if (isUpdate && !!this.state._emergeCompleteIt) {
67
- this.state._emergeCompleteIt(this.state._historyLines);
68
- }
69
- }
70
- popHistoryLines() {
71
- this.state._historyLines.pop();
72
- if (!!this.state._emergeCompleteIt) {
73
- this.state._emergeCompleteIt(this.state._historyLines);
74
- }
75
- }
76
- }
@@ -1,30 +0,0 @@
1
- import { StateService } from "../services/store.service";
2
- import { IPosition, ISize } from "../types/general";
3
- export interface IImageState {
4
- position: IPosition;
5
- size: ISize;
6
- tempImageData: ImageData | null;
7
- }
8
- export interface IImageStateReduce {
9
- position?: IImageState['position'];
10
- size?: IImageState['size'];
11
- tempImageData?: IImageState['tempImageData'];
12
- }
13
- export declare class ImageState implements StateService {
14
- private default;
15
- private _position;
16
- private _size;
17
- private _tempImageData;
18
- get position(): IImageState['position'];
19
- get size(): IImageState['size'];
20
- get tempImageData(): IImageState['tempImageData'];
21
- constructor();
22
- reduce(payload: IImageStateReduce, title?: string): void;
23
- reset(): void;
24
- getEntry(): {
25
- position: IPosition;
26
- size: ISize;
27
- imageData: ImageData;
28
- };
29
- addToHistory(title: string): void;
30
- }
@@ -1,70 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ImageState = void 0;
4
- const store_1 = require("./store");
5
- ;
6
- ;
7
- class ImageState {
8
- default = {
9
- position: {
10
- x: 0,
11
- y: 0,
12
- },
13
- size: {
14
- width: 0,
15
- height: 0,
16
- },
17
- tempImageData: null,
18
- };
19
- _position = this.default.position;
20
- _size = this.default.size;
21
- _tempImageData = this.default.tempImageData;
22
- get position() { return this._position; }
23
- ;
24
- get size() { return this._size; }
25
- ;
26
- get tempImageData() { return this._tempImageData; }
27
- ;
28
- constructor() {
29
- this.reset();
30
- }
31
- reduce(payload, title) {
32
- let isUpdate = false;
33
- if (!!payload?.position) {
34
- this._position = payload.position;
35
- }
36
- if (!!payload?.size) {
37
- this._size = payload.size;
38
- }
39
- if (!!payload?.tempImageData) {
40
- this._tempImageData = payload.tempImageData;
41
- isUpdate = true;
42
- }
43
- if (isUpdate) {
44
- this.addToHistory(`${title || "reduce image"}`);
45
- }
46
- }
47
- reset() {
48
- this.reduce(this.default, "reset to default");
49
- }
50
- getEntry() {
51
- return {
52
- position: this._position,
53
- size: this._size,
54
- imageData: this._tempImageData,
55
- };
56
- }
57
- addToHistory(title) {
58
- const stateValue = {
59
- position: this._position,
60
- size: this._size,
61
- tempImageData: this._tempImageData,
62
- };
63
- store_1.default.store.historyState.reduce('UPDATE_HISTORY', {
64
- view: title,
65
- stateName: 'image',
66
- stateValue,
67
- });
68
- }
69
- }
70
- exports.ImageState = ImageState;
@@ -1,13 +0,0 @@
1
- import { StoreService } from "../services/store.service";
2
- import { HistoryState } from "./history.state";
3
- import { ImageState } from "./image.state";
4
- export declare class Store implements StoreService {
5
- imageState: ImageState;
6
- historyState: HistoryState;
7
- constructor(imageState: ImageState, historyState: HistoryState);
8
- reset(): void;
9
- }
10
- export default class AppStore {
11
- static store: Store;
12
- static subscribe(to: 'history', completeIt: (...args: any) => void): void;
13
- }
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Store = void 0;
4
- const history_state_1 = require("./history.state");
5
- const image_state_1 = require("./image.state");
6
- class Store {
7
- imageState;
8
- historyState;
9
- constructor(imageState, historyState) {
10
- this.imageState = imageState;
11
- this.historyState = historyState;
12
- }
13
- ;
14
- reset() {
15
- this.imageState.reset();
16
- this.historyState.reset();
17
- }
18
- }
19
- exports.Store = Store;
20
- class AppStore {
21
- static store;
22
- static {
23
- AppStore.store = new Store(new image_state_1.ImageState(), new history_state_1.HistoryState());
24
- }
25
- static subscribe(to, completeIt) {
26
- if (to === 'history') {
27
- AppStore.store.historyState.emerge(completeIt);
28
- }
29
- }
30
- }
31
- exports.default = AppStore;
@@ -1,10 +0,0 @@
1
- import { ICursorPosition } from "./cursor";
2
- export interface ICanvasSize {
3
- width: number;
4
- height: number;
5
- }
6
- export type TSubscriptionTypes = 'click' | 'mousemove' | 'mousedown' | 'mouseup';
7
- export type TSubscribeAction = (event: MouseEvent, cursorPosition?: ICursorPosition) => void;
8
- export type TSubscriptions = {
9
- [key in TSubscriptionTypes]: TSubscribeAction[];
10
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- ;
@@ -1,9 +0,0 @@
1
- export interface ICursorPosition {
2
- x: number;
3
- y: number;
4
- }
5
- export interface ICursorStyle {
6
- before: TCursorStyleName | null;
7
- current: TCursorStyleName | null;
8
- }
9
- export type TCursorStyleName = 'default' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'copy' | 'alias' | 'move' | 'not-allowed' | 'grab' | 'grabbing' | 'zoom-in' | 'zoom-out';
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- ;