[jQuery] chainability and/or public methods

[jQuery] chainability and/or public methods


Hello.
often, chainability is a must
therefore, a plugin has
return this.each(function(){
});
at its end.
There are cases where chainability is not important but a good
interface of public methods is needed
example
return {
method1 : function(color){
},
method2 : function(){
}
};
I've found two plugins to realise this:
http://mattberseth2.com/jquery.ui.progressbar/_assets/js/ui.progressbar.js
it gives you chainability and interface for public methods
(using ui.core and widget)
I've also found ui.datepicker that extends ui.core.
I don't want to extend ui.core only for this task: is wouldn't be a
clean design.
Is there someone who is able to create a skeleton of a plugin as
following?
jQuery("table.mytable")
.table_plugin()
.css("border", "1px solid red");
var _table_data = jQuery("table.mytable").eq
(0).table_plugin.get_public_data();
Thanks a lot