diff options
| -rw-r--r-- | grapher/index.html | 2 | ||||
| -rw-r--r-- | grapher/pl/index.html | 1 | ||||
| -rw-r--r-- | index.html | 70 | ||||
| -rw-r--r-- | lib/types.js | 82 | ||||
| -rw-r--r-- | pwathings/appver.json | 2 | ||||
| -rw-r--r-- | searcher/index.html | 2 | ||||
| -rw-r--r-- | style.css | 142 | ||||
| -rw-r--r-- | types.html | 25 | 
8 files changed, 301 insertions, 25 deletions
diff --git a/grapher/index.html b/grapher/index.html index 9b05e23..3c88bad 100644 --- a/grapher/index.html +++ b/grapher/index.html @@ -4,7 +4,7 @@      <meta charset="utf-8">      <meta name="viewport" content="width=device-width">  		<meta name="description" content="A simple utility to help you make CV2 graphs, out-of-game."> -		<meta name="author" content="@✨Aleteoryx✨#1027"> +		<meta name="author" content="recnet/winrg">  		<link rel="manifest" href="/pwathings/manifest.json" />      <title>CV2 Node Graph Generator</title>  		<link crossorigin href="/oi.css" rel="stylesheet" type="text/css"> diff --git a/grapher/pl/index.html b/grapher/pl/index.html index 7a728b9..73f047b 100644 --- a/grapher/pl/index.html +++ b/grapher/pl/index.html @@ -3,6 +3,7 @@  	<head>  		<meta charset="UTF-8">  		<meta name="viewport" content="width=device-width, initial-scale=1.0"> +		<meta name="author" content="recnet/winrg">  		<title>Permalinked Graph</title>  		<link rel="manifest" href="/pwathings/manifest.json" /> @@ -1,23 +1,53 @@  <!DOCTYPE html>  <html> -<head> -	<title>Placeholder</title> -	<link rel="manifest" href="/pwathings/manifest.json" /> -	<link rel="manifest" href="/pwathings/manifest.json" /> -	<script> -		var reg; -	  window.addEventListener("load", async function() { -			reg = await navigator.serviceWorker.getRegistrations(); -			if (reg.length) document.getElementById("enabler").innerText = "Click to refresh the Service Worker!"; -		}); -		const reloader = () => Promise.all(reg.map(r => r.unregister())).then(() => navigator.serviceWorker.register('/worker.js', {scope: '/'})); -	</script> -</head> -<body> -	<ul> -		<li><a href="/searcher">Chip Searcher</a></li> -		<li><a href="/grapher">Chip Grapher</a></li> -		<li><button id="enabler" onclick="reloader();">Click to enable offline use!</button></li> -	</ul> -</body> +	<head> + 		<meta name="viewport" content="width=device-width"> +		<meta name="description" content="A set of tools for working with Rec Room Circuits."> +		<meta name="author" content="recnet/winrg"> +		<title>Aleteoryx's CV2Utils</title> +		<link rel="manifest" href="/pwathings/manifest.json" /> +		<link rel="manifest" href="/pwathings/manifest.json" /> + +		<link rel="stylesheet" href="style.css" /> +		<script> +			var reg; +		  window.addEventListener("load", async function() { +				reg = await navigator.serviceWorker.getRegistrations(); +				if (reg.length) document.getElementById("enabler").innerText = "Click to refresh the Service Worker!"; +			}); +			const reloader = () => Promise.all(reg.map(r => r.unregister())).then(() => navigator.serviceWorker.register('/worker.js', {scope: '/'})); +		</script> +	</head> +	<body> +		<div id="logo"><img src="/pwathings/icons/400x.png" alt="logo"/></div> +		<h1>Welcome to CV2Utils!</h1> +		<p> +			This is a little project of mine. +			Below you'll find a collection of tools for understanding and explaining CV2, as well as playing with it out-of-game. +			This site is in a perpetual state of work-in-progress, but there's a changelog below, too. +		</p> +		<ul> +			<li><a href="/searcher">Chip Searcher</a></li> +			<li><a href="/grapher">Chip Grapher</a></li> +			<li><button id="enabler" onclick="reloader();">Click to enable offline use!</button></li> +		</ul> +		<section id="changelog"> +			<article> +				<h1>June 6, 2022 - The Three Clicks Edition</h1> +				<hr/> +				<ul> +					<li>Built a proper homepage.</li> +					<ul> +						<li>Revamped the install code.</li> +						<li>Added Changelog</li> +					</ul> +					<li>Continued work on type inference logic.</li> +					<ul> +						<li>You can view it at <a href="/types.html">types.html</a>, by opening the DevTools console.</li> +						<li>The actual logic is contained in <code>/lib/types.js</code>.</li> +					</ul> +				</ul> +			</article> +		</section> +	</body>  </html>
\ No newline at end of file diff --git a/lib/types.js b/lib/types.js index ed83f12..3e37424 100644 --- a/lib/types.js +++ b/lib/types.js @@ -1,4 +1,82 @@  //Gods-awful type-checking logic. -//TypeName: string, Params: Array<string>|Object<string> -function workOutType()
\ No newline at end of file +//TypeName: string, Params: Array<string> +function Type(TypeName,Params=[]) { +	this.typename = ""; +	this.mode = ""; +	//Union/Tuple +	if (/^\(.+\)$/.test(TypeName)) { +		const types = []; +		var depth = 0; +		var workspace = ""; +		for (const c of /^\((.+)\)$/.exec(TypeName)[1]) { +			switch (c) { +				case '(': +				case '<': +					depth++; +					break; +				case ')': +				case '>': +					depth--; +					break; +				case ',': +					if (depth == 0) { +						this.mode = "tuple"; +						types.push(workspace); +						workspace = ""; +						continue; +					} +					break; +				case '|': +					if (depth == 0) { +						this.mode = "union"; +						types.push(workspace); +						workspace = ""; +						continue; +					} +					break; +			} +			workspace += c; +		} +		if (workspace) types.push(workspace); +		this.template = types.map(t => t.trim()).map(t => ["any", ...Params].includes(t) ? t : new Type(t, Params)); +		 +	} +	//Template +	else if (/^[^<]+<.+>$/.test(TypeName)) { +		this.typename = /^([^<]+)</.exec(TypeName)[1]; +		this.mode = "templated"; +		const types = []; +		var depth = 0; +		var workspace = ""; +		for (const c of /^[^<]+<(.+)>$/.exec(TypeName)[1]) { +			switch (c) { +				case '(': +				case '<': +					depth++; +					break; +				case ')': +				case '>': +					depth--; +					break; +				case ',': +					if (depth == 0) { +						types.push(workspace); +						workspace = ""; +						continue; +					} +					break; +			} +			workspace += c; +		} +		if (workspace) types.push(workspace); +		this.template = types.map(t => t.trim()).map(t => ["any", ...Params].includes(t) ? t : new Type(t, Params)); +	} +	//Standard Type +	else if (/^[^()|<>,]+$/.test(TypeName)) { +		this.typename = TypeName; +		this.mode = "standard" +	} +	 +	this.params   = Object.fromEntries(Params.map(p => [p, 'any'])); +}
\ No newline at end of file diff --git a/pwathings/appver.json b/pwathings/appver.json index 669fb74..d7cf647 100644 --- a/pwathings/appver.json +++ b/pwathings/appver.json @@ -1,3 +1,3 @@  { -	"ver": 1 +	"ver": 2  }
\ No newline at end of file diff --git a/searcher/index.html b/searcher/index.html index e02fabb..963c74b 100644 --- a/searcher/index.html +++ b/searcher/index.html @@ -4,7 +4,7 @@      <meta charset="utf-8">      <meta name="viewport" content="width=device-width">  		<meta name="description" content="A simple utility to help you work out what chips do."> -		<meta name="author" content="@✨Aleteoryx✨#1027"> +		<meta name="author" content="recnet/winrg">      <title>CV2 Chip Searcher</title>    	<link rel="manifest" href="/pwathings/manifest.json" /> diff --git a/style.css b/style.css new file mode 100644 index 0000000..d8f884f --- /dev/null +++ b/style.css @@ -0,0 +1,142 @@ +@import url('https://fonts.googleapis.com/css2?family=Raleway&display=swap'); + +html { +	--foreforeground: #3788ae; +	--foreground: #082f41; +	--background: #03141c; +	color: white; +	background: black; +	/*padding: 1cm;*/ +	font-size: 12pt; +	font-family: 'Raleway', sans-serif; + +	width: 100vw; + +	overflow-x: hidden; +	display: flex; +	flex-direction: column; +	justify-content: center; +	align-items: center; +} +body > * { +	width: max(60vw, 8cm); +} + +hr { +	border: 0.5mm solid var(--foreforeground); +	background: var(--foreforeground); +	width: 100%; +	height: 0%; +} + +.hide {display: none;} + +input, button, details{ +	color: white; +	background: var(--foreground); +	padding: 1rem; + +	border: none; +	border-radius: 0.5cm; +	font-size: 13pt; +	margin: 0.5rem; +} + +input::placeholder { +	color: var(--foreforeground); +} + +details :is(input, button) { +	background: var(--background); +} + +details { +	padding: 1rem; +	background: var(--foreground); +} + +body { +	height: calc(100% - 2cm); +	margin: 1cm; +	display: flex; +	flex-direction: column; +	justify-content: center; +	align-items: center; +	 +	width: max(60vw, 8cm); + +	background: var(--background); + +	padding: 1cm; +	box-shadow: 0 0 5mm inset black; +} + +a:link { +	color: white; +} +a:visited { +	color: var(--foreforeground); +} + +kbd { +  background: white; +  color: black; +  padding: 0.5mm; +  border-radius: 1mm; +  box-shadow: inset black -0.25mm -0.25mm 1mm; +} + +summary, +button, +:is(input[type=radio], input[type=checkbox]), +:is(input[type=radio], input[type=checkbox]) + label  { +	cursor: pointer; +} + +section#changelog { +	height: 60vh; +	overflow-y: auto; +	overflow-x: hidden; + +	box-shadow: inset 0mm 0mm 5mm #000; + +} + +section#changelog > article { +	margin: 5mm; +	margin-bottom 0; +	box-shadow: 0mm 0mm 2.5mm #000; +	padding: 2.5mm; +	background: var(--foreground); +} + +#logo { +	width: 5cm; +	height: 5cm; +	 +	position: relative; +	z-index: 0; + +	border-radius: 26px; +	animation: logo 5s infinite ease; +	overflow: hidden; +	padding: none; +} +#logo > img { +	width: 5cm; +	z-index: -2; +	margin: none; +	position: relative; +} + +@keyframes logo { +	0% { +		box-shadow: 0mm 0mm 1cm white, 0mm 0mm 0mm white; +	} +	50% { +		box-shadow: 0mm 0mm 5mm white, 0mm 0mm 1cm var(--foreforeground); +	} +	100% { +		box-shadow: 0mm 0mm 1cm white, 0mm 0mm 0mm white; +	} +}
\ No newline at end of file diff --git a/types.html b/types.html new file mode 100644 index 0000000..6794e75 --- /dev/null +++ b/types.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html lang="en"> +<head> +	<meta charset="UTF-8"> +	<meta name="viewport" content="width=device-width"> +	<title>Document</title> + +	<script src="/lib/types.js" ></script> + +	<script> +		console.log(new Type("int")) +		console.log(new Type("List<int>")) +		console.log(new Type("(int, T1)", ["T1"])) +		console.log(new Type("List<(T,int)>", ["T"])) +		console.log(new Type("(int|float|Vector3)")) +		console.log(new Type("List<(int|float|Vector3)>")) +		console.log(new Type("(List<List<(int|float|Vector3)>>|List<any>)")) +		 +	</script> +		 +</head> +<body> +	 +</body> +</html>
\ No newline at end of file  | 
