canvas-editor-engine 1.0.68 → 1.0.70

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,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EventAtom = exports.ControlEvent = void 0;
4
+ const guid4_1 = require("../utils/guid4");
4
5
  class ControlEvent {
5
6
  name;
6
7
  action;
@@ -15,9 +16,8 @@ exports.EventAtom = EventAtom;
15
16
  class EventService {
16
17
  static eventList = [];
17
18
  static subcribe(controlEvent) {
18
- // const guid4 = new Guid4().finite;
19
19
  const eventAtom = {
20
- id: "42141-241241-412412-421241",
20
+ id: new guid4_1.Guid4().generate(),
21
21
  ...controlEvent
22
22
  };
23
23
  EventService.eventList.push(eventAtom);
@@ -1,12 +1,13 @@
1
1
  import { IGUID4 } from "../types/general";
2
2
  export declare class Guid4 {
3
- static stack: IGUID4[];
3
+ stack: IGUID4[];
4
4
  guid4: IGUID4;
5
5
  constructor();
6
- private generate;
6
+ generate(): `${number}-${number}-${number}-${number}`;
7
+ get finite(): IGUID4;
8
+ private generateWithFactor;
7
9
  private getFactor;
8
10
  private get attempt();
9
11
  private get Guid4();
10
12
  private formating;
11
- get finite(): IGUID4;
12
13
  }
@@ -2,21 +2,35 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Guid4 = void 0;
4
4
  class Guid4 {
5
- static stack = [];
5
+ stack = [];
6
6
  guid4;
7
7
  constructor() {
8
- this.generate(this.attempt);
8
+ // generateWithFactor not working
9
+ // this.generateWithFactor(this.attempt);
9
10
  }
10
- generate(attempt) {
11
+ generate() {
12
+ return this.Guid4;
13
+ }
14
+ get finite() {
15
+ const guid4 = this.stack[this.stack?.length];
16
+ if (!!guid4) {
17
+ return guid4;
18
+ }
19
+ else {
20
+ throw new Error("Guid4 not generate");
21
+ }
22
+ }
23
+ ;
24
+ generateWithFactor(attempt) {
11
25
  const factor = this.getFactor(this.guid4);
12
26
  attempt.use('withError').run(factor);
13
27
  }
14
28
  getFactor(guid4) {
15
29
  return (attempt) => {
16
30
  guid4 = this.Guid4;
17
- if (!Guid4.stack.includes(guid4)) {
31
+ if (!this.stack.includes(guid4)) {
18
32
  attempt.current = attempt.max;
19
- Guid4.stack.push(guid4);
33
+ this.stack.push(guid4);
20
34
  }
21
35
  };
22
36
  }
@@ -44,11 +58,6 @@ class Guid4 {
44
58
  const formattedChar = (char == 'x') ? preformer : (preformer & 0x3 | 0x8);
45
59
  return formattedChar.toString(16);
46
60
  }
47
- get finite() {
48
- const isFound = (item) => !!item;
49
- return Guid4.stack.findLast(isFound);
50
- }
51
- ;
52
61
  }
53
62
  exports.Guid4 = Guid4;
54
63
  ;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "1.0.68",
3
+ "version": "1.0.70",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",