@knotx/plugins-history 0.0.5 → 0.0.7

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/index.cjs CHANGED
@@ -74,9 +74,8 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
74
74
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
75
75
  var _destroy_dec, _init_dec, _edgesManager_dec, _nodesManager_dec, _registerDataManager_dec, _ref_dec, _canRedo_dec, _canUndo_dec, _a, _init;
76
76
  class History extends (_a = core.BasePlugin, _canUndo_dec = [decorators.register("canUndo")], _canRedo_dec = [decorators.register("canRedo")], _ref_dec = [decorators.register("ref")], _registerDataManager_dec = [decorators.register("registerDataManager")], _nodesManager_dec = [decorators.inject.nodesManager()], _edgesManager_dec = [decorators.inject.edgesManager()], _init_dec = [decorators.OnInit], _destroy_dec = [decorators.OnDestroy], _a) {
77
- constructor(options = {}) {
78
- var _a2;
79
- super();
77
+ constructor() {
78
+ super(...arguments);
80
79
  __runInitializers(_init, 5, this);
81
80
  __publicField(this, "name", "history");
82
81
  __publicField(this, "history", []);
@@ -97,12 +96,13 @@ class History extends (_a = core.BasePlugin, _canUndo_dec = [decorators.register
97
96
  __publicField(this, "nodesManager", __runInitializers(_init, 20, this)), __runInitializers(_init, 23, this);
98
97
  __publicField(this, "edgesManager", __runInitializers(_init, 24, this)), __runInitializers(_init, 27, this);
99
98
  __publicField(this, "dataManagers", /* @__PURE__ */ new Map());
100
- this.maxHistory = (_a2 = options.maxHistory) != null ? _a2 : 50;
101
99
  }
102
100
  get ref() {
103
101
  return this;
104
102
  }
105
- init() {
103
+ init(config) {
104
+ var _a2;
105
+ this.maxHistory = (_a2 = config.maxHistory) != null ? _a2 : 50;
106
106
  this.dataManagers.set(this.nodesManager.tag, this.nodesManager);
107
107
  this.dataManagers.set(this.edgesManager.tag, this.edgesManager);
108
108
  this.dataManagers.forEach((dataManager) => {
package/dist/index.d.cts CHANGED
@@ -22,16 +22,15 @@ interface HistoryState<T extends Record<string, IData> = Record<string, any>> {
22
22
  };
23
23
  timestamp: number;
24
24
  }
25
- interface HistoryOptions {
25
+ interface HistoryConfig {
26
26
  maxHistory?: number;
27
27
  }
28
- declare class History<T extends Record<string, IData> = Record<string, any>> extends BasePlugin<'history'> {
28
+ declare class History<T extends Record<string, IData> = Record<string, any>> extends BasePlugin<'history', HistoryConfig> {
29
29
  name: "history";
30
30
  private history;
31
31
  private currentIndex;
32
32
  private isUndoRedo;
33
33
  private maxHistory;
34
- constructor(options?: HistoryOptions);
35
34
  canUndo: boolean;
36
35
  canRedo: boolean;
37
36
  get ref(): this;
@@ -39,7 +38,7 @@ declare class History<T extends Record<string, IData> = Record<string, any>> ext
39
38
  private nodesManager;
40
39
  private edgesManager;
41
40
  private dataManagers;
42
- init(): void;
41
+ init(config: HistoryConfig): void;
43
42
  destroy(): void;
44
43
  private addOperationPipe;
45
44
  private enrichOperation;
@@ -50,4 +49,4 @@ declare class History<T extends Record<string, IData> = Record<string, any>> ext
50
49
  private reverseOperation;
51
50
  }
52
51
 
53
- export { History, type HistoryOptions, type HistoryState, type IHistory };
52
+ export { History, type HistoryConfig, type HistoryState, type IHistory };
package/dist/index.d.mts CHANGED
@@ -22,16 +22,15 @@ interface HistoryState<T extends Record<string, IData> = Record<string, any>> {
22
22
  };
23
23
  timestamp: number;
24
24
  }
25
- interface HistoryOptions {
25
+ interface HistoryConfig {
26
26
  maxHistory?: number;
27
27
  }
28
- declare class History<T extends Record<string, IData> = Record<string, any>> extends BasePlugin<'history'> {
28
+ declare class History<T extends Record<string, IData> = Record<string, any>> extends BasePlugin<'history', HistoryConfig> {
29
29
  name: "history";
30
30
  private history;
31
31
  private currentIndex;
32
32
  private isUndoRedo;
33
33
  private maxHistory;
34
- constructor(options?: HistoryOptions);
35
34
  canUndo: boolean;
36
35
  canRedo: boolean;
37
36
  get ref(): this;
@@ -39,7 +38,7 @@ declare class History<T extends Record<string, IData> = Record<string, any>> ext
39
38
  private nodesManager;
40
39
  private edgesManager;
41
40
  private dataManagers;
42
- init(): void;
41
+ init(config: HistoryConfig): void;
43
42
  destroy(): void;
44
43
  private addOperationPipe;
45
44
  private enrichOperation;
@@ -50,4 +49,4 @@ declare class History<T extends Record<string, IData> = Record<string, any>> ext
50
49
  private reverseOperation;
51
50
  }
52
51
 
53
- export { History, type HistoryOptions, type HistoryState, type IHistory };
52
+ export { History, type HistoryConfig, type HistoryState, type IHistory };
package/dist/index.d.ts CHANGED
@@ -22,16 +22,15 @@ interface HistoryState<T extends Record<string, IData> = Record<string, any>> {
22
22
  };
23
23
  timestamp: number;
24
24
  }
25
- interface HistoryOptions {
25
+ interface HistoryConfig {
26
26
  maxHistory?: number;
27
27
  }
28
- declare class History<T extends Record<string, IData> = Record<string, any>> extends BasePlugin<'history'> {
28
+ declare class History<T extends Record<string, IData> = Record<string, any>> extends BasePlugin<'history', HistoryConfig> {
29
29
  name: "history";
30
30
  private history;
31
31
  private currentIndex;
32
32
  private isUndoRedo;
33
33
  private maxHistory;
34
- constructor(options?: HistoryOptions);
35
34
  canUndo: boolean;
36
35
  canRedo: boolean;
37
36
  get ref(): this;
@@ -39,7 +38,7 @@ declare class History<T extends Record<string, IData> = Record<string, any>> ext
39
38
  private nodesManager;
40
39
  private edgesManager;
41
40
  private dataManagers;
42
- init(): void;
41
+ init(config: HistoryConfig): void;
43
42
  destroy(): void;
44
43
  private addOperationPipe;
45
44
  private enrichOperation;
@@ -50,4 +49,4 @@ declare class History<T extends Record<string, IData> = Record<string, any>> ext
50
49
  private reverseOperation;
51
50
  }
52
51
 
53
- export { History, type HistoryOptions, type HistoryState, type IHistory };
52
+ export { History, type HistoryConfig, type HistoryState, type IHistory };
package/dist/index.mjs CHANGED
@@ -72,9 +72,8 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
72
72
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
73
73
  var _destroy_dec, _init_dec, _edgesManager_dec, _nodesManager_dec, _registerDataManager_dec, _ref_dec, _canRedo_dec, _canUndo_dec, _a, _init;
74
74
  class History extends (_a = BasePlugin, _canUndo_dec = [register("canUndo")], _canRedo_dec = [register("canRedo")], _ref_dec = [register("ref")], _registerDataManager_dec = [register("registerDataManager")], _nodesManager_dec = [inject.nodesManager()], _edgesManager_dec = [inject.edgesManager()], _init_dec = [OnInit], _destroy_dec = [OnDestroy], _a) {
75
- constructor(options = {}) {
76
- var _a2;
77
- super();
75
+ constructor() {
76
+ super(...arguments);
78
77
  __runInitializers(_init, 5, this);
79
78
  __publicField(this, "name", "history");
80
79
  __publicField(this, "history", []);
@@ -95,12 +94,13 @@ class History extends (_a = BasePlugin, _canUndo_dec = [register("canUndo")], _c
95
94
  __publicField(this, "nodesManager", __runInitializers(_init, 20, this)), __runInitializers(_init, 23, this);
96
95
  __publicField(this, "edgesManager", __runInitializers(_init, 24, this)), __runInitializers(_init, 27, this);
97
96
  __publicField(this, "dataManagers", /* @__PURE__ */ new Map());
98
- this.maxHistory = (_a2 = options.maxHistory) != null ? _a2 : 50;
99
97
  }
100
98
  get ref() {
101
99
  return this;
102
100
  }
103
- init() {
101
+ init(config) {
102
+ var _a2;
103
+ this.maxHistory = (_a2 = config.maxHistory) != null ? _a2 : 50;
104
104
  this.dataManagers.set(this.nodesManager.tag, this.nodesManager);
105
105
  this.dataManagers.set(this.edgesManager.tag, this.edgesManager);
106
106
  this.dataManagers.forEach((dataManager) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@knotx/plugins-history",
3
3
  "type": "module",
4
- "version": "0.0.5",
4
+ "version": "0.0.7",
5
5
  "description": "History Plugin for Knotx",
6
6
  "author": "boenfu",
7
7
  "license": "MIT",
@@ -30,14 +30,14 @@
30
30
  ],
31
31
  "dependencies": {
32
32
  "rxjs": "^7.8.1",
33
- "@knotx/core": "0.0.5",
34
- "@knotx/decorators": "0.0.5"
33
+ "@knotx/core": "0.0.7",
34
+ "@knotx/decorators": "0.0.7"
35
35
  },
36
36
  "devDependencies": {
37
- "@knotx/build-config": "0.0.5",
38
- "@knotx/eslint-config": "0.0.5",
39
- "@knotx/jsx": "0.0.5",
40
- "@knotx/typescript-config": "0.0.5"
37
+ "@knotx/build-config": "0.0.7",
38
+ "@knotx/eslint-config": "0.0.7",
39
+ "@knotx/jsx": "0.0.7",
40
+ "@knotx/typescript-config": "0.0.7"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "unbuild --failOnWarn=false",