aboutsummaryrefslogtreecommitdiffstats
path: root/types.html
diff options
context:
space:
mode:
authoralyx <alyx@aleteoryx.me>2023-07-31 15:16:34 -0400
committeralyx <alyx@aleteoryx.me>2023-07-31 15:16:34 -0400
commit7063d682f9a49f0ab98fb1f6f75585d8672b3bad (patch)
tree1c8b498d176fd1cb8c2ceadf046785c286cee221 /types.html
parent3ac2ff96a2eaf41f65571ebb43c5c9db5d44bdde (diff)
downloadRRCUtils-main.tar.gz
RRCUtils-main.tar.bz2
RRCUtils-main.zip
Load what was stuck on replitHEADmain
Diffstat (limited to 'types.html')
-rw-r--r--types.html141
1 files changed, 86 insertions, 55 deletions
diff --git a/types.html b/types.html
index 81da334..a4ca1be 100644
--- a/types.html
+++ b/types.html
@@ -27,67 +27,98 @@
</head>
<body>
- <table><thead><tr id="head"><th>Type</th></tr></thead><tbody id="body"></tbody></table>
<script>
- console.log("Testing type parsing...")
- 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>)"))
- console.log("Done!")
-
- console.log("Testing type intersections");
- const tistart = performance.now();
- const types = [
- //standard
- new Type("int"),
- new Type("bool"),
- //template
- new Type("List<int>"),
- new Type("List<float>"),
- new Type("List<List<int>>"),
- new Type("List<List<any>>"),
- new Type("List<(int|float)>"),
- new Type("List<(float|Vector3)>"),
- new Type("List<any>"),
- //union
- new Type("(int|float|bool)"),
- new Type("(List<any>|bool)"),
- //any
- new Type("any"),
- //dumb shit
- new Type("List<(List<(int|float)>|Vector3)>"),
- ];
- const head = document.getElementById("head");
- const body = document.getElementById("body");
+ function test() {
+ for (const el of document.body.children)
+ if (el.tagName != 'SCRIPT')
+ el.remove();
+
+ const tbl = document.createElement('table');
+ tbl.innerHTML = '<thead><tr id="head"><th>Type</th></tr></thead><tbody id="body"></tbody>';
+ document.body.prepend(tbl);
+
+ console.log("Testing type parsing...")
+ 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>)"))
+ console.log("Done!")
- for (const t of types) {
- const headel = document.createElement("th");
- headel.innerText = t;
- head.appendChild(headel);
+ console.log("Testing type intersections");
+ const tistart = performance.now();
+ const types = [
+ //standard
+ new Type("int"),
+ new Type("bool"),
+ //template
+ new Type("List<int>"),
+ new Type("List<float>"),
+ new Type("List<List<int>>"),
+ new Type("List<List<any>>"),
+ new Type("List<(int|float)>"),
+ new Type("List<(float|Vector3)>"),
+ new Type("List<any>"),
+ //union
+ new Type("(int|float|bool)"),
+ new Type("(List<any>|bool)"),
+ //any
+ new Type("any"),
+ //dumb shit
+ new Type("List<(List<(int|float)>|Vector3)>"),
+ ];
+ const head = document.getElementById("head");
+ const body = document.getElementById("body");
- const row = document.createElement("tr");
- body.appendChild(row);
- const title = document.createElement("th");
- title.innerText = t;
- row.appendChild(title);
- for (const t2 of types) {
- const sect = document.createElement("td");
- sect.innerText = intersect(t,t2);
- row.appendChild(sect);
+ for (const t of types) {
+ const headel = document.createElement("th");
+ headel.innerText = t;
+ head.appendChild(headel);
+
+ const row = document.createElement("tr");
+ body.appendChild(row);
+ const title = document.createElement("th");
+ title.innerText = t;
+ row.appendChild(title);
+ for (const t2 of types) {
+ const sect = document.createElement("td");
+ sect.innerText = intersect(t,t2);
+ row.appendChild(sect);
+ }
}
- }
-
- console.log(`Done in ${performance.now() - tistart}ms!`)
- console.log("Testing chip class...")
- const node = {"ReadonlyPaletteName": "Set Rotation","ReadonlyChipName": "Set Rotation","Description": "Sets the rotation of the target player or object. Players will rotate about the vertical axis only. Will fail in the following cases: If the target object is currently held, select/frozen by the maker pen, or is the child of a gizmo. Will also fail on players that are seated.","IsBetaChip": true,"DeprecationStage": "Active","PaletteNameSource": "FirstNodeDesc","ChipNameSource": "FirstNodeDesc","NodeDescs": [{"Name": "Set Rotation","ReadonlyTypeParams": {"T": "(Player | Rec Room Object)","U": "(Vector3 | Quaternion)"},"Inputs": [{"Name": "","ReadonlyType": "exec","Description": ""},{"Name": "Target","ReadonlyType": "T","Description": ""},{"Name": "Rotation","ReadonlyType": "U","Description": ""}],"Outputs": [{"Name": "","ReadonlyType": "exec","Description": ""},{"Name": "Success","ReadonlyType": "bool","Description": ""}]}],"NodeFilters": [{"FilterPath": ["Player","Physics"]},{"FilterPath": ["Object","Physics"]}]};
- document.body.append((x=new Chip(node).root));
- document.body.appendChild(x);
+ console.log(`Done in ${performance.now() - tistart}ms!`)
+
+ console.log("Testing chip class...")
+ const nf = {"ReadonlyPaletteName": "foo","ReadonlyChipName": "foo","Description": "","IsBetaChip": false,"DeprecationStage": "Active","PaletteNameSource": "FirstNodeDesc","ChipNameSource": "FirstNodeDesc","NodeDescs": [{"Name": "foo","ReadonlyTypeParams": {"T": "(int|float|bool|string)","U": "(Vector3 | Quaternion)"},"Inputs": [{"Name": "Input0","ReadonlyType": "T","Description": ""},{"Name": "Input1","ReadonlyType": "List<U>","Description": ""}],"Outputs": [{"Name": "Output0","ReadonlyType": "T","Description": ""},{"Name": "Output1","ReadonlyType": "List<U>","Description": ""}]}]};
+ const nb = {"ReadonlyPaletteName": "bar","ReadonlyChipName": "bar","Description": "","IsBetaChip": false,"DeprecationStage": "Active","PaletteNameSource": "FirstNodeDesc","ChipNameSource": "FirstNodeDesc","NodeDescs": [{"Name": "bar","ReadonlyTypeParams": {"T": "(int|float)"},"Inputs": [{"Name": "Input0","ReadonlyType": "T","Description": ""},{"Name": "Input1","ReadonlyType": "List<Quaternion>","Description": ""}],"Outputs": [{"Name": "Output0","ReadonlyType": "T","Description": ""},{"Name": "Output1","ReadonlyType": "List<Quaternion>","Description": ""}]}]};
+ const nu = {"ReadonlyPaletteName": "buzz","ReadonlyChipName": "buzz","Description": "","IsBetaChip": false,"DeprecationStage": "Active","PaletteNameSource": "FirstNodeDesc","ChipNameSource": "FirstNodeDesc","NodeDescs": [{"Name": "buzz","ReadonlyTypeParams": {},"Inputs": [{"Name": "Input0","ReadonlyType": "int","Description": ""}],"Outputs": [{"Name": "Output0","ReadonlyType": "int","Description": ""}]}]};
+ const na = {"ReadonlyPaletteName": "bazz","ReadonlyChipName": "bazz","Description": "","IsBetaChip": false,"DeprecationStage": "Active","PaletteNameSource": "FirstNodeDesc","ChipNameSource": "FirstNodeDesc","NodeDescs": [{"Name": "bazz","ReadonlyTypeParams": {},"Inputs": [{"Name": "Input0","ReadonlyType": "int","Description": ""}],"Outputs": [{"Name": "Output0","ReadonlyType": "int","Description": ""}]}]};
+
+
+ const chstart = performance.now();
+ const foo = newEl('div', '');
+ const nodefoo = new Chip(nf, nf.NodeDescs[0], foo);
+ const bar = newEl('div', '');
+ const nodebar = new Chip(nb, nb.NodeDescs[0], bar);
+ const buzz = newEl('div', '');
+ const nodebuzz = new Chip(nu, nu.NodeDescs[0], buzz);
+ const bazz = newEl('div', '');
+ const nodebazz = new Chip(na, na.NodeDescs[0], bazz);
+ wireData(nodefoo.ins[0], nodebar.outs[0]);
+ wireData(nodebar.ins[0], nodebuzz.outs[0]);
+ document.body.append(foo,bar,buzz,bazz);
+ console.log(`Done in ${performance.now() - chstart}ms!`)
+ }
+ const start = performance.now();
+ const tests = 100;
+ for (let i = 0; i < tests; i++)
+ test();
+ const time = performance.now() - start;
+ console.log(`Avg time: ${time / tests}ms`);
</script>
</body>
</html> \ No newline at end of file