- Created a new About page (index.html) detailing the BotServer platform, its features, and technology stack. - Developed a Login page (login.html) with sign-in and sign-up functionality, including form validation and user feedback messages. - Removed the empty style.css file as it is no longer needed.
39 lines
No EOL
1.1 KiB
Rust
39 lines
No EOL
1.1 KiB
Rust
use boa_engine::{Context, JsValue, Source};
|
|
|
|
fn compile_riot_component(riot_code: &str) -> Result<JsValue, Box<dyn std::error::Error>> {
|
|
let mut context = Context::default();
|
|
|
|
let compiler = include_str!("riot_compiler.js"); // Your Riot compiler logic
|
|
|
|
context.eval(Source::from_bytes(compiler))?;
|
|
|
|
let result = context.eval(Source::from_bytes(&format!(
|
|
"compileRiot(`{}`)",
|
|
riot_code.replace('`', "\\`")
|
|
)))?;
|
|
|
|
Ok(result)
|
|
}
|
|
|
|
fn main() {
|
|
let riot_component = r#"
|
|
<todo-item>
|
|
<h3>{ props.title }</h3>
|
|
<input if="{ !props.done }" type="checkbox" onclick="{ toggle }">
|
|
<span if="{ props.done }">✓ Done</span>
|
|
|
|
<script>
|
|
export default {
|
|
toggle() {
|
|
this.props.done = !this.props.done
|
|
}
|
|
}
|
|
</script>
|
|
</todo-item>
|
|
"#;
|
|
|
|
match compile_riot_component(riot_component) {
|
|
Ok(compiled) => println!("Compiled: {:?}", compiled),
|
|
Err(e) => eprintln!("Compilation failed: {}", e),
|
|
}
|
|
} |