Files
leptos-shadcn-ui/docs/implementation-plan.md

9.4 KiB

Complete Implementation Plan: Rust shadcn/ui Feature Parity

📋 Gap Analysis Summary

Current Status:

  • Leptos: 44/51 components (86% coverage) Near Complete!
  • Yew: 20/51 components (39% coverage)
  • Target: 51/51 components (100% coverage) for both frameworks

Updated Priority Matrix:

🎯 Leptos: Final 7 Components (86% → 100%)

  • avatar, data-table, chart, resizable, sidebar, sonner, typography

🔄 Yew: Bridge Gap (39% → 86%)

Missing 25 components from Leptos:

  • accordion, alert-dialog, calendar, carousel, collapsible
  • combobox, command, context-menu, date-picker, drawer
  • dropdown-menu, form, hover-card, input-otp, menubar
  • navigation-menu, popover, progress, scroll-area, sheet
  • slider, tabs, toast, toggle, utils

Completed Components (44/51)

Form & Input: checkbox, radio-group, select, combobox, form, date-picker, input-otp, slider, toggle, switch, input, label, textarea Navigation: navigation-menu, menubar, tabs, breadcrumb, command, context-menu, hover-card Overlay: dialog, alert-dialog, sheet, drawer, dropdown-menu, popover, tooltip, toast
Layout: accordion, collapsible, scroll-area, separator, aspect-ratio Display: calendar, carousel, progress, skeleton Advanced: pagination, table, button, card, alert, badge, utils

🎯 Implementation Phases

Phase 1: Leptos Completion (1 week) 86% → 100%

Week 1: Final 7 Components for Leptos

# Complete shadcn/ui spec for Leptos
- avatar: User profile image component
- data-table: Advanced table with sorting, filtering, pagination
- chart: Data visualization components  
- resizable: Resizable panel layout system
- sidebar: Navigation sidebar component
- sonner: Toast notification system (modern alternative)
- typography: Text styling and layout utilities

Deliverable: Leptos reaches 51/51 components (100% shadcn/ui coverage)

Phase 2: Yew Bridge Gap (3 weeks) 39% → 86%

Week 2-4: Port 25 Leptos Components to Yew

# Systematic porting from working Leptos implementations
# Tier 1: Core Infrastructure (Week 2)
- accordion, alert-dialog, collapsible, form, utils

# Tier 2: Navigation & Menus (Week 3)  
- dropdown-menu, navigation-menu, menubar, context-menu, command

# Tier 3: Advanced UI (Week 4)
- calendar, carousel, date-picker, drawer, sheet, popover
- hover-card, input-otp, progress, scroll-area, slider
- tabs, toast, toggle
- checkbox - radio button selection
- radio-group - grouped radio buttons  
- select - dropdown selection
- combobox - searchable dropdown
- slider - range input control

Deliverable: Both frameworks at 20/51 components

Phase 3: Navigation & Overlay (3 weeks)

Week 5: Navigation Components

# Navigation Suite (4 components)
- navigation-menu - main site navigation
- menubar - application menu bar
- tabs - tabbed interface
- command - command palette/search

Week 6-7: Overlay Components

# Modal & Overlay Suite (8 components)
- dialog - modal dialogs
- alert-dialog - confirmation dialogs
- sheet - slide-out panels
- dropdown-menu - context menus
- popover - floating content
- tooltip - hover information
- toast - notifications
- drawer - mobile-friendly slides

Deliverable: Both frameworks at 32/51 components

Phase 4: Layout & Display (2 weeks)

Week 8: Layout Components

# Layout Management (7 components)
- accordion - expandable sections
- collapsible - show/hide content
- resizable - adjustable panels
- scroll-area - custom scrollbars
- sidebar - navigation sidebar
- hover-card - content preview
- context-menu - right-click menus

Week 9: Display Components

# Content Display (6 components)  
- calendar - date selection
- progress - loading indicators
- typography - text styling
- carousel - image/content slider
- sonner - toast notifications
- toggle/toggle-group - button toggles

Deliverable: Both frameworks at 45/51 components

Phase 5: Advanced Features (2 weeks)

Week 10: Complex Components

# Advanced Components (6 components)
- chart - data visualization
- data-table - sortable/filterable tables
- form - form validation wrapper
- react-hook-form - form state management
- date-picker - calendar input
- input-otp - one-time password input

Week 11: Quality Assurance & Documentation

# Final polish and documentation
- Cross-browser testing suite
- Component documentation generation  
- Migration guide creation
- Performance benchmarking
- API consistency validation

Deliverable: Both frameworks at 51/51 components (100% parity)

🛠 Technical Implementation Strategy

Component Development Workflow

1. Component Scaffold Generation

// Template structure for each new component
src/
├── lib.rs          // Framework integration & public API
├── default.rs      // Default theme variant
├── new_york.rs     // New York theme variant  
├── types.rs        // Props and component types
└── tests.rs        // Unit tests

2. Framework-Specific Implementation

// Yew implementation pattern
#[function_component]
pub fn Button(props: &ButtonProps) -> Html {
    let classes = use_button_classes(props);
    html! { <button class={classes}>{&props.children}</button> }
}

// Leptos implementation pattern  
#[component]
pub fn Button(props: ButtonProps) -> impl IntoView {
    let classes = create_button_classes(props);
    view! { <button class=classes>{props.children}</button> }
}

3. Registry Integration

// Add component to registry_ui.rs
RegistryEntry {
    name: "checkbox".into(),
    r#type: RegistryItemType::Ui,
    description: Some("Checkbox input control".into()),
    dependencies: Some(vec!["web-sys".into()]),
    files: Some(vec![
        RegistryItemFile {
            path: "ui/checkbox.rs".into(),
            r#type: RegistryItemType::Ui,
            target: None,
        }
    ]),
    category: Some("forms".into()),
}

Quality Gates

Per-Component Checklist

  • Both framework implementations completed
  • Default and New York themes implemented
  • Props API consistency validated
  • Unit tests written and passing
  • Documentation generated
  • CLI integration tested
  • Cross-browser compatibility verified

Milestone Validation

  • Framework parity maintained (Leptos == Yew component count)
  • Registry metadata complete and accurate
  • CLI commands functional for all new components
  • Theme consistency across frameworks
  • Performance benchmarks within acceptable ranges

📊 Resource Requirements

Development Team Structure

  • Lead Architect: Registry and infrastructure design
  • Leptos Specialist: Framework-specific implementations
  • Yew Specialist: Framework-specific implementations
  • QA Engineer: Testing and validation
  • Technical Writer: Documentation and guides

Timeline Summary

  • Total Duration: 11 weeks
  • Major Milestones: 5 phases
  • Component Implementation: ~4.6 components/week average
  • Quality Gates: Built into each phase
  • Buffer Time: 10% contingency included

Success Metrics

  • Feature Parity: 51/51 components in both frameworks
  • API Consistency: 100% matching interfaces
  • Theme Accuracy: Visual parity with original shadcn/ui
  • Performance: WASM bundle size < 50KB per component
  • Developer Experience: < 5min component installation time

🎬 Implementation Commands

Phase 1 Commands

# Week 1: Infrastructure
cargo new packages/test-utils --lib
cargo new packages/component-generator --lib
# Update registry_ui.rs with complete component list

# Week 2: Leptos Parity
rust-shadcn add aspect-ratio --framework leptos
rust-shadcn add avatar --framework leptos
rust-shadcn add breadcrumb --framework leptos
rust-shadcn add input --framework leptos
rust-shadcn add label --framework leptos
rust-shadcn add pagination --framework leptos
rust-shadcn add separator --framework leptos
rust-shadcn add skeleton --framework leptos
rust-shadcn add switch --framework leptos
rust-shadcn add table --framework leptos
rust-shadcn add textarea --framework leptos

Phase 2-5 Commands

# Tier 1 Critical (Weeks 3-4)
rust-shadcn add checkbox --framework all
rust-shadcn add radio-group --framework all
rust-shadcn add select --framework all
rust-shadcn add combobox --framework all
rust-shadcn add slider --framework all

# Navigation Suite (Week 5)
rust-shadcn add navigation-menu --framework all
rust-shadcn add menubar --framework all
rust-shadcn add tabs --framework all
rust-shadcn add command --framework all

# Continue for all remaining components...

Testing Commands

# Run comprehensive test suite
cargo test --workspace
wasm-pack test --headless --firefox
npx playwright test
cargo test parity_tests --workspace

# Generate coverage reports
cargo tarpaulin --workspace --out html

Quality Assurance Commands

# Component validation
rust-shadcn validate --all-frameworks
rust-shadcn test --coverage --visual-regression
rust-shadcn benchmark --performance

# Documentation generation
rust-shadcn docs generate --all-components
rust-shadcn docs validate --completeness

This comprehensive plan provides a structured approach to achieving 100% feature parity with systematic quality gates, testing strategies, and clear success criteria.