diff options
author | 2021-12-12 17:48:47 +0100 | |
---|---|---|
committer | 2021-12-12 17:48:47 +0100 | |
commit | fc7e9312d00e60171ed77c477ed91231d3dbfff9 (patch) | |
tree | cc185dd088b5fa6e9357aab3c9062a70626d1953 /subprojects/language-web/src/main/js/index.tsx | |
parent | build: refactor java-application conventions (diff) | |
download | refinery-fc7e9312d00e60171ed77c477ed91231d3dbfff9.tar.gz refinery-fc7e9312d00e60171ed77c477ed91231d3dbfff9.tar.zst refinery-fc7e9312d00e60171ed77c477ed91231d3dbfff9.zip |
build: move modules into subproject directory
Diffstat (limited to 'subprojects/language-web/src/main/js/index.tsx')
-rw-r--r-- | subprojects/language-web/src/main/js/index.tsx | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/subprojects/language-web/src/main/js/index.tsx b/subprojects/language-web/src/main/js/index.tsx new file mode 100644 index 00000000..d368c9ba --- /dev/null +++ b/subprojects/language-web/src/main/js/index.tsx | |||
@@ -0,0 +1,69 @@ | |||
1 | import React from 'react'; | ||
2 | import { render } from 'react-dom'; | ||
3 | import CssBaseline from '@mui/material/CssBaseline'; | ||
4 | |||
5 | import { App } from './App'; | ||
6 | import { RootStore, RootStoreProvider } from './RootStore'; | ||
7 | import { ThemeProvider } from './theme/ThemeProvider'; | ||
8 | |||
9 | import '../css/index.scss'; | ||
10 | |||
11 | const initialValue = `class Family { | ||
12 | contains Person[] members | ||
13 | } | ||
14 | |||
15 | class Person { | ||
16 | Person[] children opposite parent | ||
17 | Person[0..1] parent opposite children | ||
18 | int age | ||
19 | TaxStatus taxStatus | ||
20 | } | ||
21 | |||
22 | enum TaxStatus { | ||
23 | child, student, adult, retired | ||
24 | } | ||
25 | |||
26 | % A child cannot have any dependents. | ||
27 | pred invalidTaxStatus(Person p) <-> | ||
28 | taxStatus(p, child), | ||
29 | children(p, _q) | ||
30 | ; taxStatus(p, retired), | ||
31 | parent(p, q), | ||
32 | !taxStatus(q, retired). | ||
33 | |||
34 | direct rule createChild(p): | ||
35 | children(p, newPerson) = unknown, | ||
36 | equals(newPerson, newPerson) = unknown | ||
37 | ~> new q, | ||
38 | children(p, q) = true, | ||
39 | taxStatus(q, child) = true. | ||
40 | |||
41 | indiv family. | ||
42 | Family(family). | ||
43 | members(family, anne). | ||
44 | members(family, bob). | ||
45 | members(family, ciri). | ||
46 | children(anne, ciri). | ||
47 | ?children(bob, ciri). | ||
48 | default children(ciri, *): false. | ||
49 | taxStatus(anne, adult). | ||
50 | age(anne, 35). | ||
51 | bobAge: 27. | ||
52 | age(bob, bobAge). | ||
53 | !age(ciri, bobAge). | ||
54 | |||
55 | scope Family = 1, Person += 5..10. | ||
56 | `; | ||
57 | |||
58 | const rootStore = new RootStore(initialValue); | ||
59 | |||
60 | const app = ( | ||
61 | <RootStoreProvider rootStore={rootStore}> | ||
62 | <ThemeProvider> | ||
63 | <CssBaseline /> | ||
64 | <App /> | ||
65 | </ThemeProvider> | ||
66 | </RootStoreProvider> | ||
67 | ); | ||
68 | |||
69 | render(app, document.getElementById('app')); | ||