bump dependencies, render values and slots
This commit is contained in:
parent
8a9fd5ebfe
commit
edb614f9aa
6 changed files with 147 additions and 106 deletions
|
|
@ -11,7 +11,7 @@
|
|||
font-weight: 400;
|
||||
font-style: normal;
|
||||
font-variation-settings: "wdth" 100;
|
||||
color: darkgrey;
|
||||
/* color: darkgrey; */
|
||||
}
|
||||
|
||||
.functionType {
|
||||
|
|
@ -61,6 +61,20 @@
|
|||
animation: flickerAnimation 500ms steps(1) normal infinite;
|
||||
}
|
||||
|
||||
.valueType {
|
||||
background-color: coral;
|
||||
color: black;
|
||||
border: 1px dashed green;
|
||||
padding-left: 4px;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.slotType {
|
||||
background-color: beige;
|
||||
color: black;
|
||||
border: 1px dashed purple;
|
||||
}
|
||||
|
||||
/* Animations */
|
||||
|
||||
@keyframes flickerAnimation {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { getHumanReadableName, getSymbol, prettySS, symbolDict, symbolDictIterator, symbolFunction, symbolList, symbolProduct, symbolSet, symbolSetIterator, symbolSum } from "dope2";
|
||||
import { getHumanReadableName, getSymbol, prettySS, symbolDict, symbolDictIterator, symbolFunction, symbolList, symbolProduct, symbolSet, symbolSetIterator, symbolSum, symbolSlot, symbolValue } from "dope2";
|
||||
|
||||
import { ValueUnknown } from "./Value";
|
||||
import type { TypeInfo } from "../../eval/infer_type";
|
||||
|
|
@ -35,7 +35,11 @@ export function Type({type}) {
|
|||
return <UnaryType type={type} cssClass="setType iteratorType" prefix="{*" suffix="}" />;
|
||||
case symbolDictIterator:
|
||||
return <BinaryType type={type} cssClass="dictType iteratorType" infix="*⇒" prefix="{" suffix="}"/>;
|
||||
|
||||
case symbolSlot:
|
||||
return <UnaryType type={type} cssClass="slotType" prefix="" suffix="" />;
|
||||
case symbolValue:
|
||||
return <UnaryType type={type} cssClass="valueType" prefix="" suffix="" />;
|
||||
|
||||
default:
|
||||
return <div className="type">{getHumanReadableName(symbol)}</div>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {getType, getInst, getSymbol, Double, Int, symbolFunction, symbolProduct, symbolSum, symbolDict, symbolSet, symbolList, eqType, match, getLeft, getRight, dict, Bool, set, Unit, symbolType, symbolUUID, getHumanReadableName, Ordering, isTypeVar, symbolDynamic} from "dope2";
|
||||
import {getType, getInst, getSymbol, Double, Int, symbolFunction, symbolProduct, symbolSum, symbolDict, symbolSet, symbolList, eqType, match, getLeft, getRight, dict, Bool, set, Unit, symbolType, symbolUUID, getHumanReadableName, Ordering, isTypeVar, symbolDynamic, symbolValue, symbolSlot } from "dope2";
|
||||
|
||||
import "./Value.css";
|
||||
import { Type } from "./Type";
|
||||
|
|
@ -47,6 +47,10 @@ export function Value({dynamic}) {
|
|||
return <ValueUUID val={inst}/>
|
||||
case symbolDynamic:
|
||||
return <ValueDynamic val={inst}/>
|
||||
case symbolValue:
|
||||
return <ValueValue val={inst}/>
|
||||
case symbolSlot:
|
||||
return <ValueSlot val={inst}/>
|
||||
default:
|
||||
console.log("don't know how to show value:", dynamic);
|
||||
return <>don't know how to show value</>;
|
||||
|
|
@ -103,4 +107,14 @@ function ValueDynamic({val}) {
|
|||
<Value dynamic={val}/>
|
||||
::<Type type={val.t}/>
|
||||
</span>;
|
||||
}
|
||||
}
|
||||
function ValueValue({val}) {
|
||||
return <span className="valueType">
|
||||
(Value)
|
||||
</span>;
|
||||
}
|
||||
function ValueSlot({val}) {
|
||||
return <span className="slotType">
|
||||
(Slot)
|
||||
</span>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,9 +52,18 @@ export function deepEvalInput(s: InputBlockState, env: DynamicEnvironment): Deep
|
|||
Int: BigInt,
|
||||
Double: Number,
|
||||
}[s.value.type] as (s: string) => any;
|
||||
let val;
|
||||
try {
|
||||
val = ctor(s.text);
|
||||
} catch (e) {
|
||||
return {
|
||||
kind: "input",
|
||||
err: e as Error,
|
||||
};
|
||||
}
|
||||
return {
|
||||
kind: "input",
|
||||
val: ctor(s.text)
|
||||
val: val,
|
||||
};
|
||||
}
|
||||
else if (s.value.kind === "name") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue