Skip to content

Commit

Permalink
Merge pull request #540 from StoneCypher/ReintroduceDisplayText
Browse files Browse the repository at this point in the history
Reintroduce display text, lost in a bad merge
  • Loading branch information
StoneCypher authored Sep 12, 2022
2 parents 98b7b14 + 6475296 commit 87ec233
Show file tree
Hide file tree
Showing 29 changed files with 608 additions and 1,549 deletions.
577 changes: 77 additions & 500 deletions CHANGELOG.long.md

Large diffs are not rendered by default.

100 changes: 54 additions & 46 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Please edit the file it's derived from, instead: `./src/md/readme_base.md`
* Generated for version 5.85.2 at 9/12/2022, 9:59:10 AM
* Generated for version 5.85.3 at 9/12/2022, 11:23:15 AM
-->
# jssm
Expand All @@ -29,7 +29,7 @@ share online. Easy to embed.

Readable, useful state machines as one-liner strings.

***4,844 tests*** run 5,735 times. 4,835 specs with 100.0% coverage, 9 fuzz tests with 13.0% coverage. With 2,693 lines, that's about 1.8 tests per line, or 2.1 generated tests per line.
***4,847 tests*** run 5,738 times. 4,838 specs with 100.0% coverage, 9 fuzz tests with 13.0% coverage. With 2,696 lines, that's about 1.8 tests per line, or 2.1 generated tests per line.

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

Expand Down
26 changes: 26 additions & 0 deletions dist/es6/jssm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,38 @@ declare class Machine<mDT> {
*
* const lswitch = jssm.from('a -> b; state a: { label: "Foo!"; };');
* console.log( lswitch.label_for('a') ); // 'Foo!'
* console.log( lswitch.label_for('b') ); // undefined
* ```
*
* See also {@link display_text}.
*
* @typeparam mDT The type of the machine data member; usually omitted
*
*/
label_for(state: StateType): string;
/*********
*
* Get whatever the node should show as text.
*
* Currently, this means to get the label for a given state, if any;
* otherwise to return the node's name. However, this definition is expected
* to grow with time, and it is currently considered ill-advised to manually
* parse this text.
*
* See also {@link label_for}.
*
* ```typescript
* import * as jssm from 'jssm';
*
* const lswitch = jssm.from('a -> b; state a: { label: "Foo!"; };');
* console.log( lswitch.display_text('a') ); // 'Foo!'
* console.log( lswitch.display_text('b') ); // 'b'
* ```
*
* @typeparam mDT The type of the machine data member; usually omitted
*
*/
display_text(state: StateType): string;
/*********
*
* Get the current data of a machine.
Expand Down
29 changes: 29 additions & 0 deletions dist/es6/jssm.js
Original file line number Diff line number Diff line change
Expand Up @@ -946,14 +946,43 @@ class Machine {
*
* const lswitch = jssm.from('a -> b; state a: { label: "Foo!"; };');
* console.log( lswitch.label_for('a') ); // 'Foo!'
* console.log( lswitch.label_for('b') ); // undefined
* ```
*
* See also {@link display_text}.
*
* @typeparam mDT The type of the machine data member; usually omitted
*
*/
label_for(state) {
return this._state_labels.get(state);
}
/*********
*
* Get whatever the node should show as text.
*
* Currently, this means to get the label for a given state, if any;
* otherwise to return the node's name. However, this definition is expected
* to grow with time, and it is currently considered ill-advised to manually
* parse this text.
*
* See also {@link label_for}.
*
* ```typescript
* import * as jssm from 'jssm';
*
* const lswitch = jssm.from('a -> b; state a: { label: "Foo!"; };');
* console.log( lswitch.display_text('a') ); // 'Foo!'
* console.log( lswitch.display_text('b') ); // 'b'
* ```
*
* @typeparam mDT The type of the machine data member; usually omitted
*
*/
display_text(state) {
var _a;
return (_a = this._state_labels.get(state)) !== null && _a !== void 0 ? _a : state;
}
/*********
*
* Get the current data of a machine.
Expand Down
2 changes: 1 addition & 1 deletion dist/es6/version.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const version = "5.85.2";
const version = "5.85.3";
export { version };
2 changes: 1 addition & 1 deletion dist/jssm.es5.cjs.js

Large diffs are not rendered by default.

31 changes: 30 additions & 1 deletion dist/jssm.es5.cjs.nonmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -19301,7 +19301,7 @@ function peg$parse(input, options) {
}
}

const version = "5.85.2";
const version = "5.85.3";

// whargarbl lots of these return arrays could/should be sets
const theme_mapping = new Map();
Expand Down Expand Up @@ -20235,14 +20235,43 @@ class Machine {
*
* const lswitch = jssm.from('a -> b; state a: { label: "Foo!"; };');
* console.log( lswitch.label_for('a') ); // 'Foo!'
* console.log( lswitch.label_for('b') ); // undefined
* ```
*
* See also {@link display_text}.
*
* @typeparam mDT The type of the machine data member; usually omitted
*
*/
label_for(state) {
return this._state_labels.get(state);
}
/*********
*
* Get whatever the node should show as text.
*
* Currently, this means to get the label for a given state, if any;
* otherwise to return the node's name. However, this definition is expected
* to grow with time, and it is currently considered ill-advised to manually
* parse this text.
*
* See also {@link label_for}.
*
* ```typescript
* import * as jssm from 'jssm';
*
* const lswitch = jssm.from('a -> b; state a: { label: "Foo!"; };');
* console.log( lswitch.display_text('a') ); // 'Foo!'
* console.log( lswitch.display_text('b') ); // 'b'
* ```
*
* @typeparam mDT The type of the machine data member; usually omitted
*
*/
display_text(state) {
var _a;
return (_a = this._state_labels.get(state)) !== null && _a !== void 0 ? _a : state;
}
/*********
*
* Get the current data of a machine.
Expand Down
2 changes: 1 addition & 1 deletion dist/jssm.es5.iife.js

Large diffs are not rendered by default.

31 changes: 30 additions & 1 deletion dist/jssm.es5.iife.nonmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -19300,7 +19300,7 @@ var jssm = (function (exports) {
}
}

const version = "5.85.2";
const version = "5.85.3";

// whargarbl lots of these return arrays could/should be sets
const theme_mapping = new Map();
Expand Down Expand Up @@ -20234,14 +20234,43 @@ var jssm = (function (exports) {
*
* const lswitch = jssm.from('a -> b; state a: { label: "Foo!"; };');
* console.log( lswitch.label_for('a') ); // 'Foo!'
* console.log( lswitch.label_for('b') ); // undefined
* ```
*
* See also {@link display_text}.
*
* @typeparam mDT The type of the machine data member; usually omitted
*
*/
label_for(state) {
return this._state_labels.get(state);
}
/*********
*
* Get whatever the node should show as text.
*
* Currently, this means to get the label for a given state, if any;
* otherwise to return the node's name. However, this definition is expected
* to grow with time, and it is currently considered ill-advised to manually
* parse this text.
*
* See also {@link label_for}.
*
* ```typescript
* import * as jssm from 'jssm';
*
* const lswitch = jssm.from('a -> b; state a: { label: "Foo!"; };');
* console.log( lswitch.display_text('a') ); // 'Foo!'
* console.log( lswitch.display_text('b') ); // 'b'
* ```
*
* @typeparam mDT The type of the machine data member; usually omitted
*
*/
display_text(state) {
var _a;
return (_a = this._state_labels.get(state)) !== null && _a !== void 0 ? _a : state;
}
/*********
*
* Get the current data of a machine.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/assets/search.js

Large diffs are not rendered by default.

90 changes: 50 additions & 40 deletions docs/docs/classes/jssm.Machine.html

Large diffs are not rendered by default.

Loading

0 comments on commit 87ec233

Please sign in to comment.