From 8cbf8fdcfdceab8a330bdc82e4260a55c125c37d Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Sun, 22 Aug 2021 19:54:51 +0200 Subject: Covert language-web to TypeScript --- language-web/src/main/js/index.tsx | 79 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 language-web/src/main/js/index.tsx (limited to 'language-web/src/main/js/index.tsx') diff --git a/language-web/src/main/js/index.tsx b/language-web/src/main/js/index.tsx new file mode 100644 index 00000000..f59b40a9 --- /dev/null +++ b/language-web/src/main/js/index.tsx @@ -0,0 +1,79 @@ +import { CacheProvider } from "@emotion/react"; +import React from 'react'; +import { render } from 'react-dom'; +import CssBaseline from '@material-ui/core/CssBaseline'; +import { ThemeProvider, createTheme } from '@material-ui/core/styles'; +import { getCache } from "tss-react/cache"; + +import App from './App'; +import RootStore, { RootStoreProvider } from './RootStore'; + +import '../css/index.scss'; + +const initialValue = `class Family { + contains Person[] members +} + +class Person { + Person[] children opposite parent + Person[0..1] parent opposite children + int age + TaxStatus taxStatus +} + +enum TaxStatus { + child, student, adult, retired +} + +% A child cannot have any dependents. +error invalidTaxStatus(Person p) <-> + taxStatus(p, child), children(p, _q). + +unique family. +Family(family). +members(family, anne). +members(family, bob). +members(family, ciri). +children(anne, ciri). +?children(bob, ciri). +default children(ciri, *): false. +taxStatus(anne, adult). +age(anne, 35). +bobAge: 27. +age(bob, bobAge). +!age(ciri, bobAge). + +scope Family = 1, Person += 5..10. +`; + +const rootStore = new RootStore(); +rootStore.editorStore.updateValue(initialValue); + +const theme = createTheme({ + palette: { + mode: 'dark', + background: { + default: '#212121', + paper: '#2f2f2f', + }, + primary: { + main: '#82aaff', + }, + secondary: { + main: '#ff5370', + }, + }, +}); + +const app = ( + + + + + + + + +); + +render(app, document.getElementById('app')); -- cgit v1.2.3-54-g00ecf