WIDGET MIGRATION STATUS

Comprehensive guidelines for AI-assisted development within the Editor platform

Widget Migration Status - BaseWidgetComponent

📊 Migration Overview

Total Widgets: 23
Migrated: 7 ✅
Remaining: 16 ⏳
Progress: 30%


✅ Migrated Widgets (7)

Core UI Components (from libs-ui-core)

  1. ✅ UiButtonComponent
  2. ✅ UiInputComponent
  3. ✅ UxCardComponent
  4. ✅ UxIconComponent
  5. ✅ UxChipComponent
  6. ✅ UxChipListComponent

Widget Library (from libs-widgets/widgets)

  1. ✅ ButtonWidgetComponent
  2. ✅ TextWidgetComponent (Just Fixed)

⏳ Remaining Widgets (16)

Priority 1: Simple Widgets (Quick Migrations)

These follow similar patterns to TextWidget and can be migrated quickly:

  1. ⏳ IconWidgetComponent - Already using signals
  2. ⏳ InputWidgetComponent - Already using signals
  3. ⏳ DividerWidgetComponent - Simple component
  4. ⏳ SpacerWidgetComponent - Simple component
  5. ⏳ LinkWidgetComponent - Simple component
  6. ⏳ CheckboxWidgetComponent - Form control
  7. ⏳ RadioWidgetComponent - Form control
  8. ⏳ SelectWidgetComponent - Form control
  9. ⏳ RangeWidgetComponent - Form control
  10. ⏳ ShapeWidgetComponent - Visual element

Priority 2: Medium Complexity (Need Analysis)

These have more complex lifecycle or state management:

  1. ⏳ ImageWidgetComponent - Has image loading logic
  2. ⏳ VideoWidgetComponent - Has media player logic
  3. ⏳ SimpleWidgetComponent - Need to analyze

Priority 3: Complex Widgets (Require Careful Migration)

These have complex state, child widgets, or special behavior:

  1. ⏳ CardWidgetComponent - Complex widget with internal state
  2. ⏳ HeroWidgetComponent - Complex layout widget
  3. ⏳ FeatureWidgetComponent - Complex widget
  4. ⏳ GalleryWidgetComponent - Complex with multiple items
  5. ⏳ PricingWidgetComponent - Complex with pricing logic
  6. ⏳ TestimonialWidgetComponent - Complex with testimonials

Priority 4: Special Cases (Dedicated Session)

  1. ⏳ ContainerWidgetComponent - Very complex, has child widget management
  2. ⏳ EmbeddableHostWidgetComponent - Special widget for hosting embeddables

🎯 Migration Pattern

Standard Migration Steps

// 1. Import BaseWidgetComponent
import { BaseWidgetComponent } from '@libs-widgets/widget-system';

// 2. Extend the class
export class MyWidgetComponent extends BaseWidgetComponent implements OnDestroy {
  // widgetId comes from base, keep widget input
  readonly widget = input.required<Widget>();
  
  // 3. Call super in constructor
  constructor() {
    super();
  }
  
  // 4. Implement lifecycle methods
  override onWidgetInit(): void {
    this.markReady();
  }
  
  override onWidgetDestroy(): void {
    // Cleanup handled by base class
  }
  
  // 5. Override ngOnDestroy if exists
  override ngOnDestroy(): void {
    // Component-specific cleanup
    super.ngOnDestroy();
  }
  
  // 6. Replace emitEvent() with emitWidgetEvent()
  // this.emitEvent('click') → this.emitWidgetEvent('click')
}

📋 Migration Checklist (Per Widget)


🔍 Common Issues & Solutions

Issue 1: Missing widgetId input

Error: NG0303: Can't set value of the 'widgetId' input
Fix: Extend BaseWidgetComponent

Issue 2: Property 'widget' does not exist

Error: TS2551: Property 'widget' does not exist on type
Fix: Keep widget = input.required<Widget>() in component

Issue 3: Missing override modifier

Error: TS4114: This member must have an 'override' modifier
Fix: Add override keyword to ngOnDestroy() and lifecycle methods

Issue 4: emitEvent not found

Error: TS2339: Property 'emitEvent' does not exist
Fix: Use emitWidgetEvent() from base class


📈 Benefits of Migration

Per Widget

System-Wide


🚀 Batch Migration Strategy

Session 1 (Completed ✅)

Session 2 (Next)

Session 3 (After Session 2)

Session 4 (Careful Analysis)

Session 5 (Dedicated)


📝 Notes


Current Status: ✅ TextWidget migrated, backend API fixed
Next Target: Batch migrate 10 simple widgets
Goal: 100% widget migration to BaseWidgetComponent

Date: December 6, 2025