jssm 5.35.4 → 5.42.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.
Files changed (93) hide show
  1. package/.codeclimate.yml +22 -22
  2. package/.editorconfig +12 -12
  3. package/.eslintrc +20 -20
  4. package/.nycrc +6 -6
  5. package/.travis.yml +8 -8
  6. package/LICENSE.md +21 -21
  7. package/README.md +997 -993
  8. package/dist/es6/jssm-dot.d.ts +6 -6
  9. package/dist/es6/jssm-dot.js +1 -1
  10. package/dist/es6/jssm.d.ts +100 -100
  11. package/dist/es6/jssm.js +792 -792
  12. package/dist/es6/jssm_types.d.ts +151 -151
  13. package/dist/es6/jssm_types.js +1 -1
  14. package/dist/es6/jssm_util.d.ts +8 -8
  15. package/dist/es6/jssm_util.js +34 -34
  16. package/dist/es6/version.d.ts +2 -2
  17. package/dist/es6/version.js +2 -2
  18. package/dist/jssm.es5.cjs.js +1 -1
  19. package/dist/jssm.es5.iife.js +1 -0
  20. package/jest-spec.config.js +27 -27
  21. package/jest-stoch.config.js +27 -27
  22. package/jssm-dot.d.ts +6 -6
  23. package/jssm.d.ts +100 -100
  24. package/jssm_types.d.ts +151 -151
  25. package/jssm_util.d.ts +8 -8
  26. package/package.json +125 -122
  27. package/rollup.config.iife.js +44 -44
  28. package/rollup.config.js +44 -44
  29. package/src/demo/index.html +38 -38
  30. package/src/demo/style.css +1 -1
  31. package/src/ts/jssm-dot.peg +928 -874
  32. package/src/ts/jssm.ts +1120 -1120
  33. package/src/ts/jssm_types.ts +346 -346
  34. package/src/ts/jssm_util.ts +100 -100
  35. package/src/ts/tests/actions.spec.ts +167 -167
  36. package/src/ts/tests/arrange.spec.ts +72 -72
  37. package/src/ts/tests/arrange.stoch.ts +4 -4
  38. package/src/ts/tests/array_box_if_string.spec.ts +30 -31
  39. package/src/ts/tests/array_transitions.spec.ts +129 -129
  40. package/src/ts/tests/arrow unicode.spec.ts +88 -88
  41. package/src/ts/tests/arrow.spec.ts +124 -124
  42. package/src/ts/tests/colors.spec.ts +58 -58
  43. package/src/ts/tests/comment.spec.ts +134 -134
  44. package/src/ts/tests/compile.spec.ts +79 -79
  45. package/src/ts/tests/constants.spec.ts +98 -98
  46. package/src/ts/tests/cycles.spec.ts +153 -153
  47. package/src/ts/tests/dot_preamble.spec.ts +16 -16
  48. package/src/ts/tests/embedded_sm.spec.ts +36 -36
  49. package/src/ts/tests/flow.spec.ts +22 -22
  50. package/src/ts/tests/forced transitions.spec.ts +26 -26
  51. package/src/ts/tests/general.spec.ts +933 -933
  52. package/src/ts/tests/graph node lists.spec.ts +21 -21
  53. package/src/ts/tests/histo.spec.ts +24 -24
  54. package/src/ts/tests/hooks.spec.ts +28 -0
  55. package/src/ts/tests/language.spec.ts +37 -37
  56. package/src/ts/tests/language_data/belarussian.json +13 -13
  57. package/src/ts/tests/language_data/bengali.json +15 -15
  58. package/src/ts/tests/language_data/emoji.json +21 -21
  59. package/src/ts/tests/language_data/english.json +16 -16
  60. package/src/ts/tests/language_data/french.json +16 -16
  61. package/src/ts/tests/language_data/german.json +16 -16
  62. package/src/ts/tests/language_data/hebrew.json +16 -16
  63. package/src/ts/tests/language_data/portuguese.json +12 -12
  64. package/src/ts/tests/language_data/russian.json +12 -12
  65. package/src/ts/tests/language_data/spanish.json +17 -17
  66. package/src/ts/tests/language_data/ukrainian.json +18 -18
  67. package/src/ts/tests/layout.spec.ts +29 -29
  68. package/src/ts/tests/machine_attributes.spec.ts +398 -398
  69. package/src/ts/tests/machine_name.spec.ts +14 -14
  70. package/src/ts/tests/named lists.spec.ts +24 -19
  71. package/src/ts/tests/nominated states.spec.ts +133 -133
  72. package/src/ts/tests/parse actions.spec.ts +32 -32
  73. package/src/ts/tests/parse.spec.ts +94 -94
  74. package/src/ts/tests/probability.spec.ts +146 -146
  75. package/src/ts/tests/r639.spec.ts +27 -27
  76. package/src/ts/tests/sample_select.spec.ts +173 -173
  77. package/src/ts/tests/seq.spec.ts +14 -16
  78. package/src/ts/tests/seq.stoch.ts +83 -0
  79. package/src/ts/tests/shapes.spec.ts +63 -63
  80. package/src/ts/tests/sm_tag.spec.ts +37 -37
  81. package/src/ts/tests/special characters.spec.ts +39 -39
  82. package/src/ts/tests/state_declaration.spec.ts +214 -200
  83. package/src/ts/tests/state_style.spec.ts +82 -39
  84. package/src/ts/tests/stop light.spec.ts +157 -157
  85. package/src/ts/tests/stripes.spec.ts +52 -52
  86. package/src/ts/tests/theme.spec.ts +45 -45
  87. package/src/ts/tests/weighted_histo_key.spec.ts +22 -22
  88. package/src/ts/tests/weighted_rand_select.spec.ts +27 -27
  89. package/src/ts/tests/weighted_sample_select.spec.ts +24 -26
  90. package/src/ts/version.ts +1 -1
  91. package/tree.txt +1794 -1794
  92. package/tsconfig.json +27 -27
  93. package/version.d.ts +2 -2
package/package.json CHANGED
@@ -1,122 +1,125 @@
1
- {
2
- "name": "jssm",
3
- "version": "5.35.4",
4
- "engines": {
5
- "node": ">=10.0.0"
6
- },
7
- "autoupdate": {
8
- "source": "git",
9
- "target": "git://github.com/StoneCypher/jssm.git",
10
- "fileMap": [
11
- {
12
- "basePath": "/dist",
13
- "files": [
14
- "jssm.es5.cjs.js"
15
- ]
16
- }
17
- ]
18
- },
19
- "description": "A Javascript finite state machine (FSM) with a terse DSL and a simple API. Well tested, and typed with Flowtype. MIT License.",
20
- "main": "dist/jssm.es5.cjs.js",
21
- "module": "dist/es6/jssm.js",
22
- "types": "./jssm.d.ts",
23
- "scripts": {
24
- "jest-spec": "jest -c jest-spec.config.js --color --verbose",
25
- "jest-stoch": "jest -c jest-stoch.config.js --color --verbose",
26
- "jest": "npm run jest-spec",
27
- "jjest": "npm run jest-spec && npm run jest-stoch",
28
- "test": "npm run make && npm run jest",
29
- "rmgenerated": "rm -f src/ts/jssm-dot.ts && rm -f src/ts/version.ts && rm -f *.d.ts",
30
- "removedir": "rm -rf dist && rm -rf docs",
31
- "createdir": "mkdir dist && mkdir docs",
32
- "clean": "npm run removedir && npm run rmgenerated && npm run createdir",
33
- "peg": "rm -f src/ts/jssm-dot.js && pegjs src/ts/jssm-dot.peg && node src/buildjs/fixparser.js && rm src/ts/jssm-dot.js",
34
- "make_cjs": "rollup -c",
35
- "make_iife": "rollup -c rollup.config.iife.js",
36
- "typescript": "tsc --build tsconfig.json && cp dist/es6/*.d.ts .",
37
- "makever": "node src/buildjs/makever.js",
38
- "make": "npm run clean && npm run makever && npm run peg && npm run typescript && npm run make_iife && npm run make_cjs && npm run minify && npm run min_iife && npm run min_cjs",
39
- "eslint": "eslint --color src/ts/jssm.ts src/ts/jssm_types.ts src/ts/tests/*.ts",
40
- "audit": "text_audit -r -t major MAJOR wasteful WASTEFUL any mixed fixme FIXME checkme CHECKME testme TESTME stochable STOCHABLE todo TODO comeback COMEBACK whargarbl WHARGARBL -g ./src/ts/**/*.{js,ts}",
41
- "vet": "npm run eslint && npm run audit",
42
- "build": "npm run vet && npm run test && npm run site && npm run docs && rm -f src/ts/jssm-dot.ts",
43
- "minify": "mv dist/es6/jssm-dot.js dist/es6/jssm-dot.nonmin.js && terser dist/es6/jssm-dot.nonmin.js > dist/es6/jssm-dot.js",
44
- "min_iife": "mv dist/jssm.es5.iife.js dist/jssm.es5.iife.nonmin.js && terser dist/jssm.es5.iife.nonmin.js > dist/jssm.es5.iife.js",
45
- "min_cjs": "mv dist/jssm.es5.cjs.js dist/jssm.es5.cjs.nonmin.js && terser dist/jssm.es5.cjs.nonmin.js > dist/jssm.es5.cjs.js",
46
- "site": "cp src/site/* docs/",
47
- "docs": "typedoc src/ts/jssm.ts --out docs/docs --theme ./node_modules/typedoc-neo-theme/bin/default",
48
- "changelog": "rm -f CHANGELOG.md && changelog-maker -a > CHANGELOG.md"
49
- },
50
- "repository": {
51
- "type": "git",
52
- "url": "git+https://github.com/StoneCypher/jssm.git"
53
- },
54
- "keywords": [
55
- "finite",
56
- "state",
57
- "state machine",
58
- "state-machine",
59
- "machine",
60
- "finite-state-machine",
61
- "finite state machine",
62
- "fsm",
63
- "fsm-library",
64
- "js",
65
- "javascript",
66
- "javascript-library",
67
- "mit-license",
68
- "tested",
69
- "typed",
70
- "typed-js",
71
- "flowtype",
72
- "mealy",
73
- "moore",
74
- "mealy machine",
75
- "moore machine",
76
- "mealy-machine",
77
- "moore-machine",
78
- "graphviz",
79
- "viz.js",
80
- "flowchart",
81
- "visualization",
82
- "StoneCypher"
83
- ],
84
- "author": "John Haugeland <stonecypher@gmail.com>",
85
- "license": "MIT",
86
- "bugs": {
87
- "url": "https://github.com/StoneCypher/jssm/issues"
88
- },
89
- "homepage": "https://stonecypher.github.io/jssm/",
90
- "devDependencies": {
91
- "@typescript-eslint/eslint-plugin": "^4.13.0",
92
- "@typescript-eslint/parser": "^4.13.0",
93
- "changelog-maker": "^2.3.2",
94
- "coveralls": "^3.0.11",
95
- "eslint": "^6.8.0",
96
- "eslint-plugin-fp": "^2.3.0",
97
- "eslint-plugin-jsdoc": "^20.4.0",
98
- "eslint-plugin-new-with-error": "^2.0.0",
99
- "eslint-plugin-promise": "^3.6.0",
100
- "eslint-plugin-react": "^7.19.0",
101
- "eslint-plugin-unicorn": "^15.0.1",
102
- "glob": "^7.1.6",
103
- "jest": "^26.6.3",
104
- "pegjs": "^0.10.0",
105
- "rollup": "^1.32.1",
106
- "rollup-plugin-commonjs": "^9.3.4",
107
- "rollup-plugin-node-resolve": "^4.2.3",
108
- "rollup-plugin-replace": "^2.2.0",
109
- "rollup-plugin-typescript2": "^0.27.0",
110
- "semver": "^5.7.1",
111
- "terser": "^4.6.11",
112
- "text_audit": "^0.9.3",
113
- "ts-jest": "^26.4.4",
114
- "typedoc": "^0.20.16",
115
- "typedoc-neo-theme": "^1.1.0",
116
- "typescript": "^4.1.3",
117
- "viz.js": "^1.7.1"
118
- },
119
- "dependencies": {
120
- "reduce-to-639-1": "^1.0.4"
121
- }
122
- }
1
+ {
2
+ "name": "jssm",
3
+ "version": "5.42.0",
4
+ "engines": {
5
+ "node": ">=10.0.0"
6
+ },
7
+ "autoupdate": {
8
+ "source": "git",
9
+ "target": "git://github.com/StoneCypher/jssm.git",
10
+ "fileMap": [
11
+ {
12
+ "basePath": "/dist",
13
+ "files": [
14
+ "jssm.es5.cjs.js"
15
+ ]
16
+ }
17
+ ]
18
+ },
19
+ "description": "A Javascript finite state machine (FSM) with a terse DSL and a simple API. Well tested, and typed with Flowtype. MIT License.",
20
+ "main": "dist/jssm.es5.cjs.js",
21
+ "module": "dist/es6/jssm.js",
22
+ "types": "./jssm.d.ts",
23
+ "scripts": {
24
+ "jest-spec": "jest -c jest-spec.config.js --color --verbose",
25
+ "jest-stoch": "jest -c jest-stoch.config.js --color --verbose",
26
+ "jest": "npm run jest-spec",
27
+ "jjest": "npm run jest-spec && npm run jest-stoch",
28
+ "test": "npm run make && npm run jest",
29
+ "rmgenerated": "rm -f src/ts/jssm-dot.ts && rm -f src/ts/version.ts && rm -f *.d.ts",
30
+ "removedir": "rm -rf dist && rm -rf docs",
31
+ "createdir": "mkdir dist && mkdir docs",
32
+ "clean": "npm run removedir && npm run rmgenerated && npm run createdir",
33
+ "peg": "rm -f src/ts/jssm-dot.js && pegjs src/ts/jssm-dot.peg && node src/buildjs/fixparser.js && rm src/ts/jssm-dot.js",
34
+ "make_cjs": "rollup -c",
35
+ "make_iife": "rollup -c rollup.config.iife.js",
36
+ "typescript": "tsc --build tsconfig.json && cp dist/es6/*.d.ts .",
37
+ "makever": "node src/buildjs/makever.js",
38
+ "make": "npm run clean && npm run makever && npm run peg && npm run typescript && npm run make_iife && npm run make_cjs && npm run minify && npm run min_iife && npm run min_cjs",
39
+ "eslint": "eslint --color src/ts/jssm.ts src/ts/jssm_types.ts src/ts/tests/*.ts",
40
+ "audit": "text_audit -r -t major MAJOR wasteful WASTEFUL any mixed fixme FIXME checkme CHECKME testme TESTME stochable STOCHABLE todo TODO comeback COMEBACK whargarbl WHARGARBL -g ./src/ts/**/*.{js,ts}",
41
+ "vet": "npm run eslint && npm run audit",
42
+ "benny": "node ./src/buildjs/benchmark.js",
43
+ "build": "npm run vet && npm run test && npm run site && npm run docs && npm run benny",
44
+ "ci_build": "npm run vet && npm run test && npm run benny",
45
+ "minify": "mv dist/es6/jssm-dot.js dist/es6/jssm-dot.nonmin.js && terser dist/es6/jssm-dot.nonmin.js > dist/es6/jssm-dot.js",
46
+ "min_iife": "mv dist/jssm.es5.iife.js dist/jssm.es5.iife.nonmin.js && terser dist/jssm.es5.iife.nonmin.js > dist/jssm.es5.iife.js",
47
+ "min_cjs": "mv dist/jssm.es5.cjs.js dist/jssm.es5.cjs.nonmin.js && terser dist/jssm.es5.cjs.nonmin.js > dist/jssm.es5.cjs.js",
48
+ "site": "cp src/site/* docs/",
49
+ "docs": "typedoc src/ts/jssm.ts --out docs/docs",
50
+ "changelog": "rm -f CHANGELOG.md && changelog-maker -a > CHANGELOG.md"
51
+ },
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "git+https://github.com/StoneCypher/jssm.git"
55
+ },
56
+ "keywords": [
57
+ "finite",
58
+ "state",
59
+ "state machine",
60
+ "state-machine",
61
+ "machine",
62
+ "finite-state-machine",
63
+ "finite state machine",
64
+ "fsm",
65
+ "fsm-library",
66
+ "js",
67
+ "javascript",
68
+ "javascript-library",
69
+ "mit-license",
70
+ "tested",
71
+ "typed",
72
+ "typed-js",
73
+ "flowtype",
74
+ "mealy",
75
+ "moore",
76
+ "mealy machine",
77
+ "moore machine",
78
+ "mealy-machine",
79
+ "moore-machine",
80
+ "graphviz",
81
+ "viz.js",
82
+ "flowchart",
83
+ "visualization",
84
+ "StoneCypher"
85
+ ],
86
+ "author": "John Haugeland <stonecypher@gmail.com>",
87
+ "license": "MIT",
88
+ "bugs": {
89
+ "url": "https://github.com/StoneCypher/jssm/issues"
90
+ },
91
+ "homepage": "https://stonecypher.github.io/jssm/",
92
+ "devDependencies": {
93
+ "@types/jest": "^27.0.2",
94
+ "@typescript-eslint/eslint-plugin": "^4.13.0",
95
+ "@typescript-eslint/parser": "^4.13.0",
96
+ "benny": "^3.7.1",
97
+ "changelog-maker": "^2.3.2",
98
+ "coveralls": "^3.0.11",
99
+ "eslint": "^7.32.0",
100
+ "eslint-plugin-fp": "^2.3.0",
101
+ "eslint-plugin-new-with-error": "^2.0.0",
102
+ "eslint-plugin-promise": "^5.1.0",
103
+ "eslint-plugin-react": "^7.26.1",
104
+ "eslint-plugin-unicorn": "^37.0.1",
105
+ "fast-check": "^2.12.0",
106
+ "glob": "^7.1.6",
107
+ "jest": "^27.3.1",
108
+ "pegjs": "^0.10.0",
109
+ "rollup": "^1.32.1",
110
+ "rollup-plugin-commonjs": "^9.3.4",
111
+ "rollup-plugin-node-resolve": "^4.2.3",
112
+ "rollup-plugin-replace": "^2.2.0",
113
+ "rollup-plugin-typescript2": "^0.27.0",
114
+ "semver": "^5.7.1",
115
+ "terser": "^4.6.11",
116
+ "text_audit": "^0.9.3",
117
+ "ts-jest": "^27.0.7",
118
+ "typedoc": "^0.22.15",
119
+ "typescript": "^4.1.3",
120
+ "viz.js": "^1.7.1"
121
+ },
122
+ "dependencies": {
123
+ "reduce-to-639-1": "^1.0.4"
124
+ }
125
+ }
@@ -1,44 +1,44 @@
1
-
2
- import nodeResolve from 'rollup-plugin-node-resolve';
3
- import commonjs from 'rollup-plugin-commonjs';
4
- import replace from 'rollup-plugin-replace';
5
-
6
- const pkg = require('./package.json');
7
-
8
-
9
-
10
-
11
- const config = {
12
-
13
- input: 'dist/es6/jssm.js',
14
-
15
- output: {
16
- file : 'dist/jssm.es5.iife.js',
17
- format : 'iife',
18
- name : 'jssm'
19
- },
20
-
21
- plugins : [
22
-
23
- nodeResolve({
24
- mainFields : ['module', 'main'],
25
- browser : true,
26
- extensions : [ '.js', '.json', '.ts', '.tsx' ],
27
- preferBuiltins : false
28
- }),
29
-
30
- commonjs(),
31
-
32
- replace({
33
- 'process.env.NODE_ENV' : JSON.stringify( 'production' )
34
- })
35
-
36
- ]
37
-
38
- };
39
-
40
-
41
-
42
-
43
-
44
- export default config;
1
+
2
+ import nodeResolve from 'rollup-plugin-node-resolve';
3
+ import commonjs from 'rollup-plugin-commonjs';
4
+ import replace from 'rollup-plugin-replace';
5
+
6
+ const pkg = require('./package.json');
7
+
8
+
9
+
10
+
11
+ const config = {
12
+
13
+ input: 'dist/es6/jssm.js',
14
+
15
+ output: {
16
+ file : 'dist/jssm.es5.iife.js',
17
+ format : 'iife',
18
+ name : 'jssm'
19
+ },
20
+
21
+ plugins : [
22
+
23
+ nodeResolve({
24
+ mainFields : ['module', 'main'],
25
+ browser : true,
26
+ extensions : [ '.js', '.json', '.ts', '.tsx' ],
27
+ preferBuiltins : false
28
+ }),
29
+
30
+ commonjs(),
31
+
32
+ replace({
33
+ 'process.env.NODE_ENV' : JSON.stringify( 'production' )
34
+ })
35
+
36
+ ]
37
+
38
+ };
39
+
40
+
41
+
42
+
43
+
44
+ export default config;
package/rollup.config.js CHANGED
@@ -1,44 +1,44 @@
1
-
2
- import nodeResolve from 'rollup-plugin-node-resolve';
3
- import commonjs from 'rollup-plugin-commonjs';
4
- import replace from 'rollup-plugin-replace';
5
-
6
- const pkg = require('./package.json');
7
-
8
-
9
-
10
-
11
- const config = {
12
-
13
- input: 'dist/es6/jssm.js',
14
-
15
- output: {
16
- file : 'dist/jssm.es5.cjs.js',
17
- format : 'cjs',
18
- name : 'jssm'
19
- },
20
-
21
- plugins : [
22
-
23
- nodeResolve({
24
- mainFields : ['module', 'main'],
25
- browser : true,
26
- extensions : [ '.js', '.json', '.ts', '.tsx' ],
27
- preferBuiltins : false
28
- }),
29
-
30
- commonjs(),
31
-
32
- replace({
33
- 'process.env.NODE_ENV' : JSON.stringify( 'production' )
34
- })
35
-
36
- ]
37
-
38
- };
39
-
40
-
41
-
42
-
43
-
44
- export default config;
1
+
2
+ import nodeResolve from 'rollup-plugin-node-resolve';
3
+ import commonjs from 'rollup-plugin-commonjs';
4
+ import replace from 'rollup-plugin-replace';
5
+
6
+ const pkg = require('./package.json');
7
+
8
+
9
+
10
+
11
+ const config = {
12
+
13
+ input: 'dist/es6/jssm.js',
14
+
15
+ output: {
16
+ file : 'dist/jssm.es5.cjs.js',
17
+ format : 'cjs',
18
+ name : 'jssm'
19
+ },
20
+
21
+ plugins : [
22
+
23
+ nodeResolve({
24
+ mainFields : ['module', 'main'],
25
+ browser : true,
26
+ extensions : [ '.js', '.json', '.ts', '.tsx' ],
27
+ preferBuiltins : false
28
+ }),
29
+
30
+ commonjs(),
31
+
32
+ replace({
33
+ 'process.env.NODE_ENV' : JSON.stringify( 'production' )
34
+ })
35
+
36
+ ]
37
+
38
+ };
39
+
40
+
41
+
42
+
43
+
44
+ export default config;
@@ -1,38 +1,38 @@
1
- <!doctype html>
2
- <html>
3
-
4
- <head>
5
-
6
- <link rel="stylesheet" type="text/css" href="./style.css" />
7
- <style type="text/css">
8
- h1 { margin: 0; padding: 0 0 1em 0; font-size: 150%; }
9
- html, body { margin: 0; padding: 0; border: 0; }
10
- body { padding: 2em; line-height: 135%; }
11
- code { font-size: 120%; padding: 0 0.25em; background-color: #eee; }
12
- kbd { font-size: 115%; padding: 0 0.25em; background-color: #ddd; }
13
- </style>
14
-
15
- <script defer type="text/javascript" src="../../build/jssm.es5.cjs.js"></script>
16
-
17
- <script defer type="text/javascript">
18
- /* eslint-disable */
19
-
20
- let jssm, sm;
21
-
22
- window.onload = () => {
23
-
24
- jssm = require('jssm');
25
- sm = jssm.sm;
26
-
27
- document.body.innerHTML = `<h1>Ready</h1><p>JSSM has now been loaded at version ${jssm.version}, and is bound to the global <code>jssm</code> (aka <code>window.jssm</code>.) Also, the state machine template string tag is exposed as <code>sm</code> (aka <code>window.sm</code>).</p><p>Please open a console and type something like</p><p><code>var traffic_light = sm<b>\` off -> red => green => yellow => red; [red yellow green] ~> off; \`</b>;</code></p><p>Now you have a working state machine to play with:</p><pre>&gt; traffic_light.state();\n"off"\n\n&gt; traffic_light.transition("green");\nfalse\n\n&gt; traffic_light.state();\n"off"\n\n&gt; traffic_light.transition("red");\ntrue\n\n&gt; traffic_light.state();\n"red"</pre><p>Consoles are <kbd>f12</kbd> on Windows and Linux PCs, or <kbd>command-option-j</kbd> on Macs.</p>`;
28
-
29
- }
30
-
31
- /* eslint-enable */
32
- </script>
33
-
34
- </head>
35
-
36
- <body>Loading&hellip;</body>
37
-
38
- </html>
1
+ <!doctype html>
2
+ <html>
3
+
4
+ <head>
5
+
6
+ <link rel="stylesheet" type="text/css" href="./style.css" />
7
+ <style type="text/css">
8
+ h1 { margin: 0; padding: 0 0 1em 0; font-size: 150%; }
9
+ html, body { margin: 0; padding: 0; border: 0; }
10
+ body { padding: 2em; line-height: 135%; }
11
+ code { font-size: 120%; padding: 0 0.25em; background-color: #eee; }
12
+ kbd { font-size: 115%; padding: 0 0.25em; background-color: #ddd; }
13
+ </style>
14
+
15
+ <script defer type="text/javascript" src="../../build/jssm.es5.cjs.js"></script>
16
+
17
+ <script defer type="text/javascript">
18
+ /* eslint-disable */
19
+
20
+ let jssm, sm;
21
+
22
+ window.onload = () => {
23
+
24
+ jssm = require('jssm');
25
+ sm = jssm.sm;
26
+
27
+ document.body.innerHTML = `<h1>Ready</h1><p>JSSM has now been loaded at version ${jssm.version}, and is bound to the global <code>jssm</code> (aka <code>window.jssm</code>.) Also, the state machine template string tag is exposed as <code>sm</code> (aka <code>window.sm</code>).</p><p>Please open a console and type something like</p><p><code>var traffic_light = sm<b>\` off -> red => green => yellow => red; [red yellow green] ~> off; \`</b>;</code></p><p>Now you have a working state machine to play with:</p><pre>&gt; traffic_light.state();\n"off"\n\n&gt; traffic_light.transition("green");\nfalse\n\n&gt; traffic_light.state();\n"off"\n\n&gt; traffic_light.transition("red");\ntrue\n\n&gt; traffic_light.state();\n"red"</pre><p>Consoles are <kbd>f12</kbd> on Windows and Linux PCs, or <kbd>command-option-j</kbd> on Macs.</p>`;
28
+
29
+ }
30
+
31
+ /* eslint-enable */
32
+ </script>
33
+
34
+ </head>
35
+
36
+ <body>Loading&hellip;</body>
37
+
38
+ </html>
@@ -1,2 +1,2 @@
1
- html, body { padding: 0; margin: 0; border: 0; font-family: helvetica neue, helvetica, arial, sans-serif; }
1
+ html, body { padding: 0; margin: 0; border: 0; font-family: helvetica neue, helvetica, arial, sans-serif; }
2
2
  body { padding: 2em; }