diff options
Diffstat (limited to 'language-web/src/main/js/index.tsx')
-rw-r--r-- | language-web/src/main/js/index.tsx | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/language-web/src/main/js/index.tsx b/language-web/src/main/js/index.tsx new file mode 100644 index 00000000..1f08feeb --- /dev/null +++ b/language-web/src/main/js/index.tsx | |||
@@ -0,0 +1,63 @@ | |||
1 | import { CacheProvider } from '@emotion/react'; | ||
2 | import React from 'react'; | ||
3 | import { render } from 'react-dom'; | ||
4 | import CssBaseline from '@material-ui/core/CssBaseline'; | ||
5 | import { getCache } from 'tss-react/cache'; | ||
6 | |||
7 | import { App } from './App'; | ||
8 | import { RootStore, RootStoreProvider } from './RootStore'; | ||
9 | import { ThemeProvider } from './theme/ThemeProvider'; | ||
10 | |||
11 | import '../css/index.scss'; | ||
12 | |||
13 | const initialValue = `class Family { | ||
14 | contains Person[] members | ||
15 | } | ||
16 | |||
17 | class Person { | ||
18 | Person[] children opposite parent | ||
19 | Person[0..1] parent opposite children | ||
20 | int age | ||
21 | TaxStatus taxStatus | ||
22 | } | ||
23 | |||
24 | enum TaxStatus { | ||
25 | child, student, adult, retired | ||
26 | } | ||
27 | |||
28 | % A child cannot have any dependents. | ||
29 | error invalidTaxStatus(Person p) <-> | ||
30 | taxStatus(p, child), children(p, _q). | ||
31 | |||
32 | unique family. | ||
33 | Family(family). | ||
34 | members(family, anne). | ||
35 | members(family, bob). | ||
36 | members(family, ciri). | ||
37 | children(anne, ciri). | ||
38 | ?children(bob, ciri). | ||
39 | default children(ciri, *): false. | ||
40 | taxStatus(anne, adult). | ||
41 | age(anne, 35). | ||
42 | bobAge: 27. | ||
43 | age(bob, bobAge). | ||
44 | !age(ciri, bobAge). | ||
45 | |||
46 | scope Family = 1, Person += 5..10. | ||
47 | `; | ||
48 | |||
49 | const rootStore = new RootStore(); | ||
50 | rootStore.editorStore.updateValue(initialValue); | ||
51 | |||
52 | const app = ( | ||
53 | <RootStoreProvider rootStore={rootStore}> | ||
54 | <CacheProvider value={getCache()}> | ||
55 | <ThemeProvider> | ||
56 | <CssBaseline /> | ||
57 | <App /> | ||
58 | </ThemeProvider> | ||
59 | </CacheProvider> | ||
60 | </RootStoreProvider> | ||
61 | ); | ||
62 | |||
63 | render(app, document.getElementById('app')); | ||