ohzi-core 9.0.2 → 9.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ohzi-core",
3
- "version": "9.0.2",
3
+ "version": "9.2.0",
4
4
  "description": "OHZI Core Library",
5
5
  "source": "src/index.js",
6
6
  "module": "build/index.module.js",
@@ -3,6 +3,20 @@ class StringUtilities
3
3
  constructor()
4
4
  {}
5
5
 
6
+ static get_random_color()
7
+ {
8
+ const hexValues = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F'];
9
+ let hex = '#';
10
+
11
+ for (let i = 0; i < 6; i++)
12
+ {
13
+ const index = Math.floor(Math.random() * hexValues.length);
14
+ hex += hexValues[index];
15
+ }
16
+
17
+ return hex;
18
+ }
19
+
6
20
  static capitalize(string)
7
21
  {
8
22
  const words = string.split(' ');
@@ -141,10 +141,10 @@ class ViewManager
141
141
  return undefined;
142
142
  }
143
143
 
144
- set_initial_state_data(initial_state_data)
144
+ set_default_state_data(default_state_data)
145
145
  {
146
- this.transition_table.set_initial_state_data(initial_state_data);
147
- this.transition_handler.set_initial_state_data(initial_state_data);
146
+ this.transition_table.set_default_state_data(default_state_data);
147
+ this.transition_handler.set_default_state_data(default_state_data);
148
148
  }
149
149
 
150
150
  __change_browser_url(url)
@@ -5,18 +5,18 @@ import { DrawIOAnimationSheet } from './DrawIOAnimationSheet';
5
5
 
6
6
  class ActionSequencerBuilder
7
7
  {
8
- constructor(initial_state_data)
8
+ constructor(default_state_data)
9
9
  {
10
- this.initial_state_data = initial_state_data;
10
+ this.default_state_data = default_state_data;
11
11
  }
12
12
 
13
13
  from_animation_sheet(animation_data, current_context, initial_context)
14
14
  {
15
- initial_context = initial_context || this.initial_state_data;
15
+ initial_context = initial_context || this.default_state_data;
16
16
  const tracks = animation_data.animation_tracks;
17
17
  const triggers = animation_data.triggers;
18
18
 
19
- const initial_tracks = this.state_to_tracks(this.initial_state_data, this.get_longest_time(animation_data.animation_tracks));
19
+ const initial_tracks = this.state_to_tracks(this.default_state_data, this.get_longest_time(animation_data.animation_tracks));
20
20
 
21
21
  for (let i = 0; i < initial_tracks.length; i++)
22
22
  {
@@ -5,7 +5,7 @@ class TransitionTable
5
5
  constructor()
6
6
  {
7
7
  this.transitions = [];
8
- this.initial_state_data = {};
8
+ this.default_state_data = {};
9
9
  }
10
10
 
11
11
  get(from_state_name, to_state_name, current_context)
@@ -14,7 +14,7 @@ class TransitionTable
14
14
  {
15
15
  if (this.transitions[i].from === from_state_name && this.transitions[i].to === to_state_name)
16
16
  {
17
- const action_sequencer = new ActionSequencerBuilder(this.initial_state_data).from_animation_sheet(this.transitions[i].data, current_context);
17
+ const action_sequencer = new ActionSequencerBuilder(this.default_state_data).from_animation_sheet(this.transitions[i].data, current_context);
18
18
  return action_sequencer;
19
19
  }
20
20
  }
@@ -23,7 +23,7 @@ class TransitionTable
23
23
  {
24
24
  if (this.transitions[i].to === to_state_name && this.transitions[i].from === undefined)
25
25
  {
26
- const action_sequencer = new ActionSequencerBuilder(this.initial_state_data).from_animation_sheet(this.transitions[i].data, current_context);
26
+ const action_sequencer = new ActionSequencerBuilder(this.default_state_data).from_animation_sheet(this.transitions[i].data, current_context);
27
27
  return action_sequencer;
28
28
  }
29
29
  }
@@ -45,9 +45,9 @@ class TransitionTable
45
45
  this.transitions = transitions;
46
46
  }
47
47
 
48
- set_initial_state_data(initial_state_data)
48
+ set_default_state_data(default_state_data)
49
49
  {
50
- this.initial_state_data = initial_state_data;
50
+ this.default_state_data = default_state_data;
51
51
  }
52
52
  }
53
53
 
@@ -8,7 +8,7 @@ class ViewStateTransitionHandler
8
8
  this.last_state = new ViewState();
9
9
  this.current_state = new ViewState();
10
10
 
11
- this.initial_state_data = {};
11
+ this.default_state_data = {};
12
12
  this.current_state_data = {};
13
13
 
14
14
  this.transition_table = transition_table;
@@ -71,10 +71,10 @@ class ViewStateTransitionHandler
71
71
  this.current_state = state;
72
72
  }
73
73
 
74
- set_initial_state_data(initial_state_data)
74
+ set_default_state_data(default_state_data)
75
75
  {
76
- Object.assign(this.initial_state_data, initial_state_data);
77
- Object.assign(this.current_state_data, initial_state_data);
76
+ Object.assign(this.default_state_data, default_state_data);
77
+ Object.assign(this.current_state_data, default_state_data);
78
78
  }
79
79
 
80
80
  __update_transitions()
@@ -1,4 +1,5 @@
1
1
  export class StringUtilities {
2
+ static get_random_color(): string;
2
3
  static capitalize(string: any): any;
3
4
  static capitalize_first_letter(string: any): any;
4
5
  static snake_to_camelcase(string: any): any;
@@ -18,7 +18,7 @@ import { ViewState } from "ohzi-core/types/view_components/ViewState";
18
18
  static get(view_name: any): any;
19
19
  static get_view_by_url(url: any): void;
20
20
  static get_by_url(url: any): any;
21
- static set_initial_state_data(initial_state_data: any): void;
21
+ static set_default_state_data(default_state_data: any): void;
22
22
  static __change_browser_url(url: any): void;
23
23
  }
24
24
 
@@ -1,8 +1,8 @@
1
1
  import { ActionSequencer } from "ohzi-core";
2
2
 
3
3
  export class ActionSequencerBuilder {
4
- constructor(initial_state_data: any);
5
- initial_state_data: any;
4
+ constructor(default_state_data: any);
5
+ default_state_data: any;
6
6
  from_animation_sheet(animation_data: any, current_context: any, initial_context: any): ActionSequencer;
7
7
  state_to_tracks(state: any): {
8
8
  attribute_name: string;
@@ -1,8 +1,8 @@
1
1
  export class TransitionTable {
2
2
  transitions: any[];
3
- initial_state_data: {};
3
+ default_state_data: {};
4
4
  get(to_state: any, current_context: any): import("../../action_sequencer/ActionSequencer").default;
5
5
  add_transitions(transitions: any): void;
6
6
  set_transitions(transitions: any): void;
7
- set_initial_state_data(initial_state_data: any): void;
7
+ set_default_state_data(default_state_data: any): void;
8
8
  }
@@ -4,7 +4,7 @@ export class ViewStateTransitionHandler {
4
4
  constructor(transition_table: any);
5
5
  last_state: ViewState;
6
6
  current_state: ViewState;
7
- initial_state_data: {};
7
+ default_state_data: {};
8
8
  current_state_data: {};
9
9
  transition_table: any;
10
10
  transitioning: boolean;
@@ -12,5 +12,5 @@ export class ViewStateTransitionHandler {
12
12
  action_sequencer: any;
13
13
  update(): void;
14
14
  set_state(state: any): void;
15
- set_initial_state_data(initial_state_data: any): void;
15
+ set_default_state_data(default_state_data: any): void;
16
16
  }