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)
- ✅
UiButtonComponent - ✅
UiInputComponent - ✅
UxCardComponent - ✅
UxIconComponent - ✅
UxChipComponent - ✅
UxChipListComponent
Widget Library (from libs-widgets/widgets)
- ✅
ButtonWidgetComponent - ✅
TextWidgetComponent(Just Fixed)
⏳ Remaining Widgets (16)
Priority 1: Simple Widgets (Quick Migrations)
These follow similar patterns to TextWidget and can be migrated quickly:
- ⏳
IconWidgetComponent- Already using signals - ⏳
InputWidgetComponent- Already using signals - ⏳
DividerWidgetComponent- Simple component - ⏳
SpacerWidgetComponent- Simple component - ⏳
LinkWidgetComponent- Simple component - ⏳
CheckboxWidgetComponent- Form control - ⏳
RadioWidgetComponent- Form control - ⏳
SelectWidgetComponent- Form control - ⏳
RangeWidgetComponent- Form control - ⏳
ShapeWidgetComponent- Visual element
Priority 2: Medium Complexity (Need Analysis)
These have more complex lifecycle or state management:
- ⏳
ImageWidgetComponent- Has image loading logic - ⏳
VideoWidgetComponent- Has media player logic - ⏳
SimpleWidgetComponent- Need to analyze
Priority 3: Complex Widgets (Require Careful Migration)
These have complex state, child widgets, or special behavior:
- ⏳
CardWidgetComponent- Complex widget with internal state - ⏳
HeroWidgetComponent- Complex layout widget - ⏳
FeatureWidgetComponent- Complex widget - ⏳
GalleryWidgetComponent- Complex with multiple items - ⏳
PricingWidgetComponent- Complex with pricing logic - ⏳
TestimonialWidgetComponent- Complex with testimonials
Priority 4: Special Cases (Dedicated Session)
- ⏳
ContainerWidgetComponent- Very complex, has child widget management - ⏳
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)
- Import
BaseWidgetComponentfrom@libs-widgets/widget-system - Extend the base class
- Keep
widget = input.required<Widget>()input - Remove
widgetIdinput (comes from base) - Add
super()call in constructor - Implement
onWidgetInit()andonWidgetDestroy() - Add
overridetongOnDestroy()if exists - Call
super.ngOnDestroy()at end of cleanup - Replace
emitEvent()withemitWidgetEvent() - Test widget renders correctly
- Verify no compilation errors
🔍 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
- ✅ State machine for lifecycle management
- ✅ Timeout protection (no hanging states)
- ✅ Data binding support (when configured)
- ✅ Standardized event handling
- ✅ Error boundary protection
- ✅ Performance monitoring
- ✅ Consistent API across all widgets
System-Wide
- ✅ Single source of truth
- ✅ Easy maintenance
- ✅ AI-friendly patterns
- ✅ Better testability
- ✅ Type safety
- ✅ Reduced bugs
🚀 Batch Migration Strategy
Session 1 (Completed ✅)
- Core UI components (6)
- ButtonWidget, TextWidget (2)
Session 2 (Next)
- Simple widgets (10): Icon, Input, Divider, Spacer, Link, Checkbox, Radio, Select, Range, Shape
Session 3 (After Session 2)
- Medium complexity (3): Image, Video, Simple
Session 4 (Careful Analysis)
- Complex widgets (6): Card, Hero, Feature, Gallery, Pricing, Testimonial
Session 5 (Dedicated)
- Special cases (2): Container, EmbeddableHost
📝 Notes
- ContainerWidget is deferred - too complex for batch migration
- EmbeddableHostWidget may need special handling
- All simple widgets should follow TextWidget pattern
- Complex widgets may need custom state management
Current Status: ✅ TextWidget migrated, backend API fixed
Next Target: Batch migrate 10 simple widgets
Goal: 100% widget migration to BaseWidgetComponent
Date: December 6, 2025