Skip to content

Commit

Permalink
draft themes in place
Browse files Browse the repository at this point in the history
  • Loading branch information
StoneCypher committed Aug 19, 2022
1 parent 9209392 commit 2f81a26
Show file tree
Hide file tree
Showing 35 changed files with 756 additions and 130 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.long.md
Expand Up @@ -2,7 +2,7 @@

All notable changes to this project will be documented in this file.

1034 merges; 148 releases
1035 merges; 148 releases



Expand All @@ -18,6 +18,21 @@ Published tags:



 

 

## [Untagged] - 8/17/2022 10:02:39 PM

Commit [9209392cd7e025b365da88aa29649c63b241074d](https://github.com/StoneCypher/jssm/commit/9209392cd7e025b365da88aa29649c63b241074d)

Author: `John Haugeland <stonecypher@gmail.com>`

* mostly done, just have to surface the themes then do testing




&nbsp;

&nbsp;
Expand Down
34 changes: 17 additions & 17 deletions CHANGELOG.md
Expand Up @@ -2,7 +2,7 @@

All notable changes to this project will be documented in this file.

1034 merges; 148 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)
1035 merges; 148 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)



Expand All @@ -18,6 +18,21 @@ Published tags:



&nbsp;

&nbsp;

## [Untagged] - 8/17/2022 10:02:39 PM

Commit [9209392cd7e025b365da88aa29649c63b241074d](https://github.com/StoneCypher/jssm/commit/9209392cd7e025b365da88aa29649c63b241074d)

Author: `John Haugeland <stonecypher@gmail.com>`

* mostly done, just have to surface the themes then do testing




&nbsp;

&nbsp;
Expand Down Expand Up @@ -160,19 +175,4 @@ Commit [ed398d3627e63b7b64d009acb42779b814e2f6da](https://github.com/StoneCypher

Author: `John Haugeland <stonecypher@gmail.com>`

* tests




&nbsp;

&nbsp;

## [Untagged] - 8/4/2022 9:15:50 PM

Commit [63304cd9d1dd4ea5801edb6437f361023e3d6c32](https://github.com/StoneCypher/jssm/commit/63304cd9d1dd4ea5801edb6437f361023e3d6c32)

Author: `John Haugeland <stonecypher@gmail.com>`

* Styling now works for start, end, and terminal state types too. Fixes StoneCypher/fsl#1143, fixes StoneCypher/fsl#1141, fixes StoneCypher/fsl#1156, fixes StoneCypher/fsl#1157, fixes StoneCypher/fsl#242
* tests
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -18,7 +18,7 @@ Please edit the file it's derived from, instead: `./src/md/readme_base.md`
* Generated for version 5.81.3 at 8/16/2022, 1:20:00 PM
* Generated for version 5.81.3 at 8/18/2022, 5:37:28 PM
-->
# jssm
Expand All @@ -29,7 +29,7 @@ share online. Easy to embed.

Readable, useful state machines as one-liner strings.

***4,832 tests*** run 5,723 times. 4,823 specs with 94.8% coverage, 9 fuzz tests with 5.4% coverage. With 2,293 lines, that's about 2.1 tests per line, or 2.5 generated tests per line.
***4,832 tests*** run 5,723 times. 4,823 specs with 98.5% coverage, 9 fuzz tests with 5.4% coverage. With 2,520 lines, that's about 1.9 tests per line, or 2.3 generated tests per line.

***Meet your new state machine library.***

Expand Down
3 changes: 2 additions & 1 deletion dist/es6/jssm.d.ts
Expand Up @@ -218,7 +218,7 @@ declare class Machine<mDT> {
_arrange_declaration: Array<Array<StateType>>;
_arrange_start_declaration: Array<Array<StateType>>;
_arrange_end_declaration: Array<Array<StateType>>;
_theme: FslTheme;
_themes: FslTheme[];
_flow: FslDirection;
_has_hooks: boolean;
_has_basic_hooks: boolean;
Expand Down Expand Up @@ -626,6 +626,7 @@ declare class Machine<mDT> {
list_named_transitions(): Map<StateType, number>;
list_actions(): Array<StateType>;
theme(): FslTheme;
themes(): FslTheme[];
flow(): FslDirection;
get_transition_by_state_names(from: StateType, to: StateType): number;
lookup_transition_for(from: StateType, to: StateType): JssmTransition<mDT>;
Expand Down
14 changes: 12 additions & 2 deletions dist/es6/jssm.js
Expand Up @@ -2,6 +2,13 @@
import { reduce as reduce_to_639 } from 'reduce-to-639-1';
import { circular_buffer } from 'circular_buffer_js';
import { base_theme } from './themes/jssm_base_stylesheet';
import { default_theme } from './themes/jssm_theme_default';
import { modern_theme } from './themes/jssm_theme_modern';
import { ocean_theme } from './themes/jssm_theme_ocean';
const themes = new Map();
themes.set('default', default_theme);
themes.set('modern', modern_theme);
themes.set('ocean', ocean_theme);
import { seq, unique, find_repeated, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key, array_box_if_string, name_bind_prop_and_state, hook_name, named_hook_name } from './jssm_util';
import * as constants from './jssm_constants';
const { shapes, gviz_shapes, named_colors } = constants;
Expand Down Expand Up @@ -688,7 +695,7 @@ class Machine {
this._arrange_start_declaration = arrange_start_declaration;
this._arrange_end_declaration = arrange_end_declaration;
this._dot_preamble = dot_preamble;
this._theme = theme;
this._themes = [theme];
this._flow = flow;
this._graph_layout = graph_layout;
this._has_hooks = false;
Expand Down Expand Up @@ -1381,7 +1388,10 @@ class Machine {
return Array.from(this._actions.keys());
}
theme() {
return this._theme; // constructor sets this to "default" otherwise
return this._themes[0]; // returns topmost only
}
themes() {
return this._themes; // constructor sets this to "default" otherwise
}
flow() {
return this._flow;
Expand Down
2 changes: 1 addition & 1 deletion dist/es6/themes/jssm_base_stylesheet.d.ts
Expand Up @@ -8,4 +8,4 @@ declare const base_active_start_state_style: JssmStateConfig;
declare const base_end_state_style: JssmStateConfig;
declare const base_active_end_state_style: JssmStateConfig;
declare const base_theme: JssmBaseTheme;
export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, base_theme };
export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, base_theme, base_theme as theme };
2 changes: 1 addition & 1 deletion dist/es6/themes/jssm_base_stylesheet.js
Expand Up @@ -54,4 +54,4 @@ const base_theme = {
graph: undefined,
title: undefined // TODO FIXME
};
export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, base_theme };
export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, base_theme, base_theme as theme };
11 changes: 11 additions & 0 deletions dist/es6/themes/jssm_theme_default.d.ts
@@ -0,0 +1,11 @@
import { JssmStateConfig, JssmBaseTheme } from '../jssm_types';
declare const base_state_style: JssmStateConfig;
declare const base_active_state_style: JssmStateConfig;
declare const base_terminal_state_style: JssmStateConfig;
declare const base_active_terminal_state_style: JssmStateConfig;
declare const base_start_state_style: JssmStateConfig;
declare const base_active_start_state_style: JssmStateConfig;
declare const base_end_state_style: JssmStateConfig;
declare const base_active_end_state_style: JssmStateConfig;
declare const default_theme: JssmBaseTheme;
export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, default_theme, default_theme as theme };
57 changes: 57 additions & 0 deletions dist/es6/themes/jssm_theme_default.js
@@ -0,0 +1,57 @@
const base_state_style = {
shape: 'rectangle',
backgroundColor: 'khaki',
textColor: 'black',
borderColor: 'black'
};
const base_active_state_style = {
textColor: 'white',
backgroundColor: 'dodgerblue4'
};
const base_hooked_state_style = {
shape: 'component'
};
const base_terminal_state_style = {
textColor: 'white',
backgroundColor: 'crimson'
};
const base_active_terminal_state_style = {
textColor: 'white',
backgroundColor: 'indigo'
};
const base_start_state_style = {
backgroundColor: 'yellow'
};
const base_active_start_state_style = {
backgroundColor: 'yellowgreen'
};
const base_active_hooked_state_style = {
backgroundColor: 'yellowgreen'
};
const base_end_state_style = {
textColor: 'white',
backgroundColor: 'darkolivegreen'
};
const base_active_end_state_style = {
textColor: 'white',
backgroundColor: 'darkgreen'
};
const default_theme = {
state: base_state_style,
start: base_start_state_style,
end: base_end_state_style,
terminal: base_terminal_state_style,
hooked: base_hooked_state_style,
active: base_active_state_style,
active_start: base_active_start_state_style,
active_end: base_active_end_state_style,
active_terminal: base_active_terminal_state_style,
active_hooked: base_active_hooked_state_style,
legal: undefined,
main: undefined,
forced: undefined,
action: undefined,
graph: undefined,
title: undefined // TODO FIXME
};
export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, default_theme, default_theme as theme };
11 changes: 11 additions & 0 deletions dist/es6/themes/jssm_theme_modern.d.ts
@@ -0,0 +1,11 @@
import { JssmStateConfig, JssmBaseTheme } from '../jssm_types';
declare const base_state_style: JssmStateConfig;
declare const base_active_state_style: JssmStateConfig;
declare const base_terminal_state_style: JssmStateConfig;
declare const base_active_terminal_state_style: JssmStateConfig;
declare const base_start_state_style: JssmStateConfig;
declare const base_active_start_state_style: JssmStateConfig;
declare const base_end_state_style: JssmStateConfig;
declare const base_active_end_state_style: JssmStateConfig;
declare const modern_theme: JssmBaseTheme;
export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, modern_theme, modern_theme as theme };
57 changes: 57 additions & 0 deletions dist/es6/themes/jssm_theme_modern.js
@@ -0,0 +1,57 @@
const base_state_style = {
shape: 'rectangle',
backgroundColor: 'khaki',
textColor: 'black',
borderColor: 'black'
};
const base_active_state_style = {
textColor: 'white',
backgroundColor: 'dodgerblue4'
};
const base_hooked_state_style = {
shape: 'component'
};
const base_terminal_state_style = {
textColor: 'white',
backgroundColor: 'crimson'
};
const base_active_terminal_state_style = {
textColor: 'white',
backgroundColor: 'indigo'
};
const base_start_state_style = {
backgroundColor: 'yellow'
};
const base_active_start_state_style = {
backgroundColor: 'yellowgreen'
};
const base_active_hooked_state_style = {
backgroundColor: 'yellowgreen'
};
const base_end_state_style = {
textColor: 'white',
backgroundColor: 'darkolivegreen'
};
const base_active_end_state_style = {
textColor: 'white',
backgroundColor: 'darkgreen'
};
const modern_theme = {
state: base_state_style,
start: base_start_state_style,
end: base_end_state_style,
terminal: base_terminal_state_style,
hooked: base_hooked_state_style,
active: base_active_state_style,
active_start: base_active_start_state_style,
active_end: base_active_end_state_style,
active_terminal: base_active_terminal_state_style,
active_hooked: base_active_hooked_state_style,
legal: undefined,
main: undefined,
forced: undefined,
action: undefined,
graph: undefined,
title: undefined // TODO FIXME
};
export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, modern_theme, modern_theme as theme };
11 changes: 11 additions & 0 deletions dist/es6/themes/jssm_theme_ocean.d.ts
@@ -0,0 +1,11 @@
import { JssmStateConfig, JssmBaseTheme } from '../jssm_types';
declare const base_state_style: JssmStateConfig;
declare const base_active_state_style: JssmStateConfig;
declare const base_terminal_state_style: JssmStateConfig;
declare const base_active_terminal_state_style: JssmStateConfig;
declare const base_start_state_style: JssmStateConfig;
declare const base_active_start_state_style: JssmStateConfig;
declare const base_end_state_style: JssmStateConfig;
declare const base_active_end_state_style: JssmStateConfig;
declare const ocean_theme: JssmBaseTheme;
export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, ocean_theme, ocean_theme as theme };
57 changes: 57 additions & 0 deletions dist/es6/themes/jssm_theme_ocean.js
@@ -0,0 +1,57 @@
const base_state_style = {
shape: 'rectangle',
backgroundColor: 'khaki',
textColor: 'black',
borderColor: 'black'
};
const base_active_state_style = {
textColor: 'white',
backgroundColor: 'dodgerblue4'
};
const base_hooked_state_style = {
shape: 'component'
};
const base_terminal_state_style = {
textColor: 'white',
backgroundColor: 'crimson'
};
const base_active_terminal_state_style = {
textColor: 'white',
backgroundColor: 'indigo'
};
const base_start_state_style = {
backgroundColor: 'yellow'
};
const base_active_start_state_style = {
backgroundColor: 'yellowgreen'
};
const base_active_hooked_state_style = {
backgroundColor: 'yellowgreen'
};
const base_end_state_style = {
textColor: 'white',
backgroundColor: 'darkolivegreen'
};
const base_active_end_state_style = {
textColor: 'white',
backgroundColor: 'darkgreen'
};
const ocean_theme = {
state: base_state_style,
start: base_start_state_style,
end: base_end_state_style,
terminal: base_terminal_state_style,
hooked: base_hooked_state_style,
active: base_active_state_style,
active_start: base_active_start_state_style,
active_end: base_active_end_state_style,
active_terminal: base_active_terminal_state_style,
active_hooked: base_active_hooked_state_style,
legal: undefined,
main: undefined,
forced: undefined,
action: undefined,
graph: undefined,
title: undefined // TODO FIXME
};
export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, ocean_theme, ocean_theme as theme };
2 changes: 1 addition & 1 deletion dist/jssm.es5.cjs.js

Large diffs are not rendered by default.

0 comments on commit 2f81a26

Please sign in to comment.