Commit Graph
4 Commits
Author SHA1 Message Date
Aaron SinclairandClaude 134ddc4c42 Fix duplicate append bug and componentize tabs
**Bug Fixes:**
- Fixed duplicate js_append_child calls causing DOM element re-insertion
- Elements were being appended twice: once by self-append logic, once by parent loop
- This was breaking CSS transitions on vertical tabs (elements moved in DOM)
- Removed self-append logic from _emit_with() and _emit_yield_component()

**Refactoring:**
- Created reusable HTab and VTab components for horizontal/vertical tabs
- Reduced repetitive tab code from 9 lines per tab to 1 line
- Improved code maintainability and reusability
- WASM bundle size reduced from 5987 bytes to 4690 bytes (22% reduction!)

**Result:**
- CSS transitions now work smoothly on vertical tabs ✓
- All 55 tests passing ✓
- Cleaner, more composable tab components ✓

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-15 11:39:53 -08:00
Aaron SinclairandClaude b0e38db22c Fix nested components - render functions now return i32
Changes:
- Component render functions return i32 (root element) instead of void
- Nested components (yield SomeComponent()) now work correctly
- Added main() entry point that calls top-level component and sets root
- Updated runtime to call main() instead of render_ComponentName()

Note: Active state in ternary expressions still needs reactive updates
This commit fixes the nested component rendering issue

All tests passing (51 passed, 2 skipped)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-15 11:16:23 -08:00
Aaron SinclairandClaude c947bcf6e0 Update Tabs example to use lambda event handlers
Replace verbose boilerplate (set_tab_0, set_tab_1, etc.) with clean
lambda syntax using the new feature.

Before (18 lines of boilerplate):
  def set_tab_0(): tab_index = 0
  def set_tab_1(): tab_index = 1
  def set_tab_2(): tab_index = 2
  def set_setting_0(): setting_tab = 0
  def set_setting_1(): setting_tab = 1
  def set_setting_2(): setting_tab = 2

After (2 lines):
  def set_tab(value): tab_index = value
  def set_setting(value): setting_tab = value

Usage:
  onclick=lambda: set_tab(0)
  onclick=lambda: set_setting(1)

Generated WASM: 8810 bytes (smaller than before!)
Lambda functions: 36 total (12 per component × 2 components)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-15 10:48:40 -08:00
Aaron Sinclair 81d51d5617 Parser: Support multiple components in one file, change args to params with defaults 2025-11-15 03:25:13 -08:00