| 
									
										
										
										
											2017-12-20 04:39:03 +03:00
										 |  |  | /********************************************************************** | 
					
						
							|  |  |  | *  | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | **********************************************************************/ | 
					
						
							|  |  |  | ((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(){} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // singular items...
 | 
					
						
							|  |  |  | // 
 | 
					
						
							|  |  |  | // 	.Item(value[, make][, options])
 | 
					
						
							|  |  |  | // 		-> ???
 | 
					
						
							|  |  |  | // 	
 | 
					
						
							|  |  |  | var Items.Item = function(value, make, options){ | 
					
						
							| 
									
										
										
										
											2017-12-22 05:52:31 +03:00
										 |  |  | 	// XXX check if we are in a container -> create if needed and update context...
 | 
					
						
							|  |  |  | 	// XXX ???
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// create item...
 | 
					
						
							|  |  |  | 	return make(value, make, options) | 
					
						
							| 
									
										
										
										
											2017-12-20 04:39:03 +03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-22 05:52:31 +03:00
										 |  |  | var Items.Action = function(value, make, options){ | 
					
						
							|  |  |  | 	options = Object.create(options || {}) | 
					
						
							|  |  |  | 	options.cls = (options.cls || '') + ' action' | 
					
						
							|  |  |  | 	return this.Item(value, make, options) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | var 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) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-12-20 04:39:03 +03:00
										 |  |  | var Items.Empty = function(value){} | 
					
						
							|  |  |  | var Items.Separator = function(value){} | 
					
						
							|  |  |  | var Items.Spinner = function(value){} | 
					
						
							| 
									
										
										
										
											2017-12-22 05:52:31 +03:00
										 |  |  | var Items.Selected = function(value){} | 
					
						
							|  |  |  | var Items.Editable = function(value){} | 
					
						
							|  |  |  | var Items.ConfirmAction = function(value){} | 
					
						
							| 
									
										
										
										
											2017-12-20 04:39:03 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | // groups...
 | 
					
						
							|  |  |  | var Items.Group = function(items){} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // lists...
 | 
					
						
							| 
									
										
										
										
											2017-12-20 06:35:55 +03:00
										 |  |  | // 
 | 
					
						
							|  |  |  | // 	.List(values[, make][, options])
 | 
					
						
							|  |  |  | // 		-> ???
 | 
					
						
							|  |  |  | // 		
 | 
					
						
							|  |  |  | // XXX how do we indicate the selected item???
 | 
					
						
							|  |  |  | // 		- options.path / options.selected?
 | 
					
						
							|  |  |  | // 		- path argument?
 | 
					
						
							| 
									
										
										
										
											2017-12-20 04:39:03 +03:00
										 |  |  | var Items.List = function(values){} | 
					
						
							|  |  |  | var Items.EditableList = function(values){} | 
					
						
							|  |  |  | var Items.EditablePinnedList = function(values){} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /********************************************************************** | 
					
						
							|  |  |  | * vim:set ts=4 sw=4 :                               */ return module }) |