SESSION 12.5 REAL WIDGETS
Documentation for Sessions
Session 12.5 - Real Widget Components Integration
🎯 Issue Fixed
Problem: The adapters were using simple placeholder components (PureButtonComponent) instead of the real widget components that integrate with the backend property system.
Solution: Updated all adapters to use the actual widget components from @libs-widgets/widgets:
| Adapter | Now Uses | Properties From |
|---|---|---|
ButtonWidgetAdapter |
ButtonWidgetComponent |
Backend property templates |
TextWidgetAdapter |
TextWidgetComponent |
Backend property templates |
ContainerWidgetAdapter |
ContainerWidgetComponent |
Backend property templates |
ImageWidgetAdapter |
ImageWidgetComponent |
Backend property templates |
InputWidgetAdapter |
InputWidgetComponent |
Backend property templates |
📁 Files Changed
Updated Adapters
libs/libs-widgets/widget-adapters/src/lib/adapters/button.adapter.ts- Now uses
ButtonWidgetComponentfrom@libs-widgets/widgets - Properties aligned with
backend-api/propertiestemplates - Full config: text, buttonType, color, size, shape, effect, icons, action, etc.
- Now uses
libs/libs-widgets/widget-adapters/src/lib/adapters/text.adapter.ts- Now uses
TextWidgetComponent - Full typography support: fontSize, fontFamily, fontWeight, textAlign, lineHeight, etc.
- Now uses
libs/libs-widgets/widget-adapters/src/lib/adapters/container.adapter.ts- Now uses
ContainerWidgetComponent - Layout support: free, flex, grid
- Full spacing and appearance properties
- Now uses
libs/libs-widgets/widget-adapters/src/lib/adapters/image.adapter.ts- Now uses
ImageWidgetComponent - Full image support: src, alt, objectFit, loading, clickAction, etc.
- Now uses
libs/libs-widgets/widget-adapters/src/lib/adapters/input.adapter.ts- Now uses
InputWidgetComponent - Form field support: type, validation, variants, icons, etc.
- Now uses
Updated Interface
libs/libs-widgets/widget-adapters/src/lib/models/adapter.interface.ts- Added more property types:
icon,file,richtext,code,json,date,array,object - Added more categories:
appearance,advanced,data,accessibility - Added
templateIdfield to link to backend property templates - Added
stepto validation - Added
aimetadata for smart assistance
- Added more property types:
🔗 Property Template Integration
Each adapter property now has a templateId that maps to backend property templates:
{
name: 'fontSize',
label: 'Font Size',
type: 'slider',
defaultValue: 16,
templateId: 'font-size', // Maps to backend template
validation: { min: 8, max: 120, step: 1 },
}
This enables:
- AI Training - AI knows property semantics from templates
- Consistency - Same property definition across all widgets
- Validation - Backend-driven validation rules
- Theming - Properties can reference theme values
🤖 AI Context
Each adapter now provides comprehensive AI context:
getAIContext(): string {
return `
Button widget: An interactive button component.
Properties (aligned with property templates):
- text: Display text on the button
- buttonType: Visual style (primary, secondary, outline, ghost...)
- size: xs, sm, md, lg, xl
- shape: square, rounded, pill
- effect: none, pulse, glow, ripple
- leftIcon/rightIcon: Font Awesome icon classes
...
AI Training Notes:
- Use "primary" for main CTAs
- Use "outline" or "ghost" for secondary actions
- Always set meaningful text
- Use icons to improve scannability
`;
}
⚠️ Known Issue
There's a pre-existing circular dependency in the project:
widget-adapters → widgets → widget-builder → widgets
This needs to be resolved by:
- Moving widget components to a separate library (
widget-core) - Or using lazy loading for the circular references
- Or restructuring the widget-builder to not depend on widgets
⏭️ Next Steps
- Fix circular dependency in widget libraries
- Ensure PageBuilder renders real widget components
- Connect property panel to widget properties
- Test AI generation with new property templates