ā ļø WARNING: Prototype / Experimental Project
This repository is a vibe-coded prototype created for experimentation and learning purposes.
DO NOT USE IN PRODUCTION.
This code is not battle-tested, not optimized, and not maintained for production use. It's a playground for exploring ideas around Svelte-like syntax in Dart.
Silhouette is an experimental UI framework for Dart that takes inspiration from Svelte. It provides a compiler that transforms .silhouette template files into Dart code with reactive state management.
$state, $derived, and $effect runespackage:web)<script>
final (
:String name,
) = $props((
name: 'World',
));
final int count = $state(0);
final String greeting = $derived(() => 'Hello, $name!');
$effect(() {
print('Count changed: $count');
});
void increment() {
count = count + 1;
}
</script>
<div>
<h1>{greeting}</h1>
<p>Count: {count}</p>
<button on:click={increment}>Increment</button>
</div>
<style>
div {
padding: 20px;
}
</style>
silhouette/
āāā packages/
ā āāā silhouette_cli/
ā āāā bin/
ā ā āāā silhouette.dart # CLI entry point
ā āāā lib/
ā ā āāā src/
ā ā āāā compiler/
ā ā ā āāā parser.dart # Template parser
ā ā ā āāā analyzer.dart # AST analyzer
ā ā ā āāā ast.dart # AST definitions
ā ā ā āāā compiler.dart # Main compiler
ā ā ā āāā generator/
ā ā ā āāā client.dart # Client-side code generator
ā ā ā āāā static.dart # Static HTML generator
ā ā āāā runtime/
ā ā āāā runtime.dart # Runtime reactive primitives
ā āāā example/ # Example components
ā āāā test/ # Tests
āāā README.md
# Compile a single component (client mode - default)
dart run silhouette counter.silhouette
# Compile for static/SSR mode
dart run silhouette counter.silhouette --mode static
# Compile all components in a directory
dart run silhouette ./components
# Watch for changes
dart run silhouette ./components --watch
# Help
dart run silhouette --help
$state(initialValue) - Creates reactive state$derived(() => expression) - Creates computed/derived values$effect(() => { ... }) - Runs side effects when dependencies change$props(defaults) - Declares component properties using Dart record destructuring{expression} - Expression interpolation{@html expression} - Raw HTML output{#if condition}...{:else}...{/if} - Conditional rendering{#each items as item, index}...{/each} - List rendering{#await promise}...{:then value}...{:catch error}...{/await} - Async handlingon:event={handler} - Event bindingbind:value={variable} - Two-way bindingThings that are missing, broken, or half-baked:
This is a learning project to explore:
Sure! Feel free to explore, learn, fork, and experiment. Just don't put it in production.
MIT License - See LICENSE file
Remember: This is a prototype. A proof of concept. An experiment. A vibe. Not a product. šØāØ