@afjk/loomlet
v0.3.0
Published
A small reactive DSL and node graph toolkit for interactive scenes.
Maintainers
Readme
Loomlet
A small reactive DSL and node graph toolkit for interactive scenes.
Loomlet provides:
- a
.loomDSL - a core JavaScript library
- a CLI
- a VS Code extension
- a Web Node Editor
Status: experimental. APIs, graph format, and DSL syntax may change.
Try it
- Web Node Editor: https://afjk.github.io/loomlet/node-editor/
- Examples: examples/README.md
Install
npm install @afjk/loomletCLI
Create a small .loom file:
echo 'x = 1' > hello.loomCompile it:
npx -p @afjk/loomlet loomlet compile hello.loomFor global install:
npm install -g @afjk/loomlet
loomlet --helpTo load a trusted local package file or manifest directory:
loomlet run ./file.loom --package ./examples/packages/demo/index.js --get x.out
loomlet run ./file.loom --package ./path/to/package-dir --get x.outSee Package System docs for details.
Library usage
import { parseDSLToAST, compileToGraph } from "@afjk/loomlet";
const source = `x = 1`;
const { ast, errors: parseErrors } = parseDSLToAST(source);
if (parseErrors.length) {
console.error(parseErrors);
}
const { graph, errors: compileErrors } = compileToGraph(ast);
if (compileErrors.length) {
console.error(compileErrors);
}
console.log(graph);Host events with OnEvent
import { Loom } from "@afjk/loomlet/runtime";
const graph = {
nodes: [{ id: "flash", type: "onEvent", params: { channel: "custom.flash" } }],
edges: []
};
const engine = new Loom(graph);
engine.evaluateOnce({
env: {
time: 1.5,
events: [{ channel: "custom.flash", timestamp: 1.2, payload: { intensity: 0.8 } }]
}
});
console.log(engine.getValue("flash.event"));VS Code extension
The Loomlet VS Code extension provides:
- syntax highlighting
- completion
- diagnostics
- preview support
Search for Loomlet in the VS Code Marketplace.
Documentation
- Language guide
- CLI guide
- VS Code extension
- Concepts and design notes
- Terminology
- Stabilization roadmap
- 設計ノート(日本語)
- Scene Sync integration
- Release and maintainer notes
- Standard library reference
- Runtime node registration
- Runtime parity fixtures
- Unity runtime compatibility
Generated metadata and reference docs can be refreshed with npm run generate:metadata.
License
MIT
