Commit graph

16 commits

Author SHA1 Message Date
enzotar
ea64617569 feat: physics language integration — scene container with Rapier2D WASM
- Add scene container to AST, lexer, parser, analyzer, and codegen
- Add circle/rect/line as UI elements for physics body declaration
- Compile scene {} to canvas + async WASM init + Rapier2D PhysicsWorld
- Reactive gravity via DS.effect() — bodies wake on gravity change
- Mouse drag interaction with impulse-based body movement
- Compile-time hex color parsing for body colors
- Fix is_signal_ref matching numeric literals (700.value bug)
- Fix body variable uniqueness (next_node_id per body)
- Fix gravity signal detection (check AST Ident before emit_expr)
- Add physics.ds example with 5 bodies + 4 gravity control buttons
- Update DREAMSTACK.md and IMPLEMENTATION_PLAN.md with Phase 10-11
- 39 tests pass across all crates, 22KB output
2026-02-25 10:58:43 -08:00
enzotar
d7961cdc98 feat: universal bitstream streaming — any input → any output
New crate: engine/ds-stream/
- Binary protocol: 16-byte header, typed frame/input enums
  - Frame types: Pixels, Delta, Audio, Signal, Neural (0x01-0x43)
  - Input types: Pointer, Key, Scroll, Gamepad, MIDI, BCI (0x01-0x90)
- WebSocket relay server (tokio + tungstenite)
  - Source → receivers: frame broadcast
  - Receivers → source: input routing
- Codec: encode/decode, XOR delta compression, RLE, convenience builders
- 17 unit tests, all passing

Streaming modes (stream-source.html):
1. Pixel mode: raw RGBA framebuffer (~28 MB/s)
2. Delta mode: XOR + RLE compression (~1-9 MB/s, 70-95% savings)
3. Signal mode: compact JSON signal diffs (~2 KB/s, 12000x reduction)
4. Neural mode: procedural SDF pixel generator (concept demo)
5. Audio channel: spring velocity→frequency synthesis
6. Multi-receiver: broadcast to all connected clients

Thin receiver client (stream-receiver.html, ~300 lines):
- Zero framework, zero build step
- Renders any incoming bitstream mode
- Local signal-diff renderer for signal mode
- AudioContext playback for audio frames
- Full input capture: click/drag, keyboard, scroll
- Per-channel bitstream bus visualization

DREAMSTACK.md: Phase 7 section with protocol spec
2026-02-25 10:29:44 -08:00
enzotar
a35d44bd59 feat: two-way binding, form props, and async resources
Phase 8 features:
- bind prop: two-way signal <-> input sync
- placeholder, value, style, disabled props
- DS.resource() for reactive async data fetching
- DS.fetchJSON() convenience wrapper
- Props-only element parsing: input { bind: x }
- examples/form.ds: contact form with validation

Fixed: double .value.value bug in bind codegen.
2026-02-25 08:08:37 -08:00
enzotar
33ed843abb docs: add router to DREAMSTACK.md features and comparison 2026-02-25 07:54:43 -08:00
enzotar
adff40d47f feat: hash-based router + keyed list reconciliation
Phase 7 features:
- route "/path" -> body declarations with hash-based routing
- navigate "/path" built-in function
- DS.route signal tracks current hash path
- DS.matchRoute() with :param pattern matching
- DS.keyedList() for keyed DOM reconciliation
- Route-aware mounting: views + routes compose
- examples/router.ds: 3-page app (home/about/counter)
- State persists across route changes (10818 bytes)
2026-02-25 07:54:00 -08:00
enzotar
06cd2371d5 docs: add implementation status, benchmarks, and React comparison to DREAMSTACK.md 2026-02-25 01:39:05 -08:00
enzotar
ca45c688df feat: for-in list rendering + component system
Phase 6 features:
- ForIn reactive list rendering: for item in items -> body
- Optional index binding: for item, idx in items -> body
- Component declarations: component Name(props) = body
- Component instantiation: ComponentUse { name, props }

Added across 5 crates:
- ds-parser: For/In/Component tokens, ForIn/ComponentDecl AST nodes
- ds-codegen: reactive list effect, component function emission
- ds-types: ForIn/ComponentUse type inference
- local_vars tracking for non-reactive for-in loop vars

Includes examples/list.ds showcasing for-in + when + signals.
2026-02-25 01:33:28 -08:00
enzotar
e3da3b2d8b feat: signal propagation benchmarks + dev server HMR fix
Benchmarks (examples/benchmarks.html):
- Wide Fan-Out: 1→1000 derived signals (46K ops/s)
- Deep Chain: 100-layer propagation (399K ops/s)
- Diamond Dependency: 500 glitch-free diamonds (16K ops/s)
- Batch Updates: 50 sources in single batch (89K ops/s)
- Effect Throughput: 500 effects (135K ops/s)
- Mixed Graph: realistic 10→30→10 topology (247K ops/s)

Dev server fix: replaced EventSource SSE (flickering) with
fetch-based polling every 500ms for stable HMR.
2026-02-25 01:06:07 -08:00
enzotar
c9b1913a57 feat: dev server with file watching + poll-based HMR
- File watcher thread using notify crate (100ms debounce)
- Auto-recompiles .ds files on change with timed output
- Poll-based HMR: client fetches /__hmr every 500ms for version
- Injects HMR script into compiled HTML before </body>
- Error pages rendered with DreamStack styling on compile failure
- Version counter shared between watcher and HTTP server via AtomicU64
2026-02-25 01:01:59 -08:00
enzotar
bbdeb6b82b feat: showcase — What DreamStack Does That Nothing Else Can
Interactive page comparing 5 unique DreamStack capabilities vs React/Svelte/Solid/Vue:
1. Reactivity as a type (Signal<T> in the type system)
2. Algebraic effects (swappable side-effect handlers)
3. Springs are signals (physics auto-propagates through reactive graph)
4. Compile-time dependency graph (static analysis, dead signal elimination)
5. Constraint-based layout (Cassowary solver, not CSS hacks)

Includes live spring physics demo, interactive constraint layout toggle,
side-by-side code comparisons, Elm-style error previews, and comparison table.
2026-02-25 00:34:46 -08:00
enzotar
20ea2cb82e feat: Phase 5 — Live Playground with editor, preview, signal graph, console
- playground.html: full web IDE for DreamStack DSL
- Code editor with auto-compile (500ms debounce) + Ctrl+Enter
- Live preview: renders interactive UI from DreamStack code
- Signal graph: visualizes source signals, derived values, handlers, views
- Console: compile metrics, type inference (Signal<Int>, Derived<Bool>, etc.)
- 4 examples: counter, todo, effects, springs
- Dark theme with purple accent, premium glassmorphism design
2026-02-25 00:27:42 -08:00
enzotar
462663830e feat: Phase 3+4 — Cassowary constraint solver + type system
Phase 3 — Constraint Layout:
- ds-layout crate: Gaussian elimination constraint solver
- eq, gte, lte, sum_eq, ratio constraints with strength priority
- get_rect() for resolving absolute (x,y,w,h) layouts
- 7 tests: simple eq, two-var eq, sums, rects, gte, ratio, 3-panel

Phase 4 — Type System:
- ds-types crate: Signal<T>, Derived<T>, Stream<T>, Spring<T>, View
- Effect types: Http, Storage, Time, Dom, Custom(name)
- Hindley-Milner type checker with signal-awareness
- Elm-inspired error messages (TYPE MISMATCH, UNHANDLED EFFECT, etc.)
- 11 tests: type display, reactive checks, mismatch errors, etc.

Total: 34 tests passing across 6 crates
2026-02-25 00:22:35 -08:00
enzotar
fcf2639d9b feat: Phase 2+3 — effects, streams, springs, search + dashboard
Phase 2 — Effect System & Streams:
- Algebraic effects (perform/handle/handleAsync) for composable,
  testable side-effects with swappable handlers
- Stream engine with map, filter, debounce, throttle, distinct,
  scan, flatMap, merge, fromEvent, fromSignal, fromPromise
- Search-with-autocomplete example: debounce + flatMap + effects

Phase 3 — Spring Physics:
- RK4 integrator with fixed substep and sleep-when-idle scheduler
- Springs are signals — anything that reads spring.value auto-updates
- Dashboard example: spring-animated sidebar, staggered card entrance,
  draggable spring ball with configurable stiffness/damping/mass

Runtime evolution: v0.1 (signals) → v0.2 (+ effects + streams) → v0.3 (+ springs)
2026-02-25 00:13:09 -08:00
enzotar
51cf09336b feat: TodoMVC example with full reactivity
Full todo app using DreamStack's signal runtime:
- Add/toggle/remove individual todos
- Filter by all/active/completed
- Clear completed batch action
- Derived reactive stats (total, active, done counts)
- Premium dark theme with glassmorphism, slide-in animations
- No VDOM, no re-renders — pure signal propagation
2026-02-25 00:06:20 -08:00
enzotar
a634152318 feat: DreamStack compiler foundation — Phase 0/1
Complete compiler pipeline from .ds source to reactive browser apps:

- ds-parser: lexer (string interpolation, operators, keywords) + recursive
  descent parser with operator precedence + full AST types
- ds-analyzer: signal graph extraction (source/derived classification),
  topological sort for glitch-free propagation, DOM binding analysis
- ds-codegen: JavaScript emitter with embedded reactive runtime (~3KB
  signal/derived/effect system) and dark-theme CSS design system
- ds-cli: build (compile to HTML+JS), dev (live server), check (analyze)

Verified working: source signals, derived signals, event handlers,
conditional rendering (when), 12 unit tests passing, 6.8KB output.
2026-02-25 00:03:06 -08:00
enzotar
cc45557248 feat: add DreamStack project vision and detailed implementation plan documentation. 2026-02-24 23:49:59 -08:00