Repository navigation
genji-theme-vitepress
Support magic variables! A variable whose name starts and ends with $$ shows its current value inside the code that uses it, and updates as the value changes.
```js eval code=false
$$size$$ = Inputs.range([0, 300], { label: "size", value: 100, step: 1 });
```
```js eval
call(() => {
const size = $$size$$;
const div = document.createElement("div");
div.style.width = size + "px";
div.style.height = "50px";
div.style.background = "black";
return div;
});
```genji-runtime
- Support modern JavaScript syntax in code blocks, such as optional chaining (
a?.b) and??. Code blocks are now parsed with acorn instead of esprima. - Find dependencies between code blocks with scope analysis, so local variables, object keys and function parameters no longer create false dependencies.
- Report errors from a rejected promise on every code block that depends on it, instead of running them with
undefined. - Detect circular dependencies of any length. Code blocks that depend on a cycle show Depends on a circular dependency.
Some pages may behave differently after upgrading, because these fixes change which code blocks depend on each other.
What's Changed
- Fix rerun code when click tabs of code groups by @pearmini in #226
- Magic variable by @pearmini in #227
- Lock p5 version by @pearmini in #229
- Update dependencies for security alerts by @pearmini in #230
- Replace esprima with acorn and acorn-walk by @pearmini in #232
- Use scope analysis to find cell dependencies by @pearmini in #233
- Add tests for the runtime's reactivity by @pearmini in #234
- Detect cycles of any length by @pearmini in #235
- Update dependencies to clear Dependabot alerts by @pearmini in #236
- Release 0.3.0 by @pearmini in #237
Full Changelog: 0.2.8...0.3.0