/********************************************************************** * * * **********************************************************************/ ((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define) (function(require){ var module={} // make module AMD/node compatible... /*********************************************************************/ var toggler = require('../toggler') var keyboard = require('../keyboard') var object = require('../object') var widget = require('./widget') /*********************************************************************/ // XXX general design: // - each of these can take either a value or a function (constructor) // - the function has access to Items.* and context // - the constructor can be called from two contexts: // - external // called from the module or as a function... // calls the passed constructor (passing context) // builds the container // - nested // called from constructor function... // calls constructor (if applicable) // builds item(s) // XXX need a way to pass container constructors (a-la ui-widgets dialog containers) // - passing through the context (this) makes this more flexible... // - passing via args fixes the signature which is a good thing... // // // XXX var Items = module.items = function(){} // Focus last created item... // XXX also would be nice to set the last created items to .last or // similar in the context... Items.focus = function(){ }, // singular items... // // .Item(value[, make][, options]) // -> ??? // var Items.Item = function(value, make, options){ // XXX check if we are in a container -> create if needed and update context... // XXX ??? // create item... return make(value, make, options) } Items.Action = function(value, make, options){ options = Object.create(options || {}) options.cls = (options.cls || '') + ' action' return this.Item(value, make, options) } Items.Heading = function(value, make, options){ options = Object.create(options || {}) options.cls = (options.cls || '') + ' heading' var attrs = options.doc ? {doc: options.doc} : {} attrs.__proto__ = options.attrs || {} options.attrs = attrs return this.Item(value, make, options) } Items.Empty = function(value){} Items.Separator = function(value){} Items.Spinner = function(value){} Items.Selected = function(value){} Items.Editable = function(value){} Items.ConfirmAction = function(value){} // groups... var Items.Group = function(items){} // lists... // // .List(values[, make][, options]) // -> ??? // // XXX how do we indicate the selected item??? // - options.path / options.selected? // - path argument? Items.List = function(values){} Items.EditableList = function(values){} Items.EditablePinnedList = function(values){} // Special list components... // // XXX these should be normal items... Items.ListPath = function(){} Items.ListTitle = function(){} //--------------------------------------------------------------------- var BrowsePrototype = { update: function(){}, filter: function(){}, get: function(){}, focus: function(){}, // Navigation... // up: function(){}, down: function(){}, left: function(){}, right: function(){}, next: function(){}, prev: function(){}, // XXX scroll... __init__: function(func, options){}, } /********************************************************************** * vim:set ts=4 sw=4 : */ return module })