Widget control design
- Dominant language
- JavaScript
- Stars
- 28
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
**Problem:** Making view names, messages, classes and selectors configurable for more flexibility can lead to a lot of options to handle. CanJS currently doesn't allow deep extension of defaults.
## Option 1: A separate name for each option
How to handle a large number of options?
```
{
headerSelector : 'header',
bodySelector : 'body',
overlayClass : 'modal-overlay',
title : 'A dialog',
initView : '//my/widget/init.ejs'
}
```
## Option 2: Deep extension
CanUI extends can.Control to do allow deep extension of defaults:
```
{
select : {
header : 'header',
body : '.body'
},
classes : {
overlay : 'modal-overlay'
},
view : {
initView : '//my/widget/init.ejs'
}
title : 'A dialog',
}
```
## Option 3: Configuration object
Provide a configuration object for settings that deal with widget customization:
```
{
config : new can.ui.Configuration({
select : {
header : 'header',
body : '.body'
},
classes : {
overlay : 'modal-overlay'
},
view : {
initView : '//my/widget/init.ejs'
}
}),
title : 'A dialog',
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the current CanJS can.Control behavior and how CanUI handles widget defaults. Compare the three configuration approaches described in the issue, then establish and implement one agreed design for configurable view names, messages, classes, and selectors; done means the chosen API supports those customizations consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100