moved domain specific modules to imagegrid/, now only root modules in root...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-06-01 16:12:10 +03:00
parent b308f6b3b7
commit bc9178038d
19 changed files with 33 additions and 253 deletions

View File

@ -1,151 +0,0 @@
/**********************************************************************
*
*
*
**********************************************************************/
//var DEBUG = DEBUG != null ? DEBUG : true
define(function(require){ var module = {}
doc = require('lib/keyboard').doc
data = require('data')
/*********************************************************************/
// attr can be:
// "name" - attribute name
// "name, name, ..."
// - string containign coma separated attribute names
// list - list of attribute names
//
// XXX add a callback here...
function proxy(attr, name){
// we can proxy multiple attrs...
attr = typeof(attr) == typeof('str')
? attr.split(',').map(function(e){ return e.trim() })
: attr
return function(){
var that = this
var args = arguments
attr.forEach(function(a){
a = that[a]
a[name].apply(a, args)
})
return this
}
}
function proxyMethods(obj, map){
var txt = ''
map = map == null ? obj : map
for(var attr in map){
var methods = map[attr]
methods = typeof(methods) == typeof('str') ? {attr: methods} : methods
for(var name in methods){
var txt = methods[name]
if(txt == null){
obj[name] = proxy(attr, name)
} else {
obj[name] = doc(txt, proxy(attr, name))
}
}
}
return obj
}
/*********************************************************************/
// This will:
// - provide an abstraction layer to data (proxy)
// - provide API docs usable for doc generation...
// - provide callbacks (???)
//
var ClientClassPrototype = {
}
var ClientPrototype = {
// this expects the folowing attrs:
//
// .data
//
// direct proxy methods...
focusImage: 'Focus image',
focusRibbon: 'Focus ribbon',
firstImage: 'Focus first image in current ribbon',
lastImage: 'Focus last image in current ribbon',
// XXX client-specific API...
// XXX
}
// XXX this is temporary...
// ...this will messup actual methods...
proxyMethods(ClientPrototype)
// XXX auto apply this...
function chainSelfAttrMethod(cls, attr, name, func){
return function(){
// NOTE: this is super, python-style but without multiple
// inheritance...
// ...that last part makes this more of a code reuse
// than a programming tool...
cls.__proto__[name].apply(this, arguments)
// call the encapsulated method...
this[attr][name].apply(this[attr], arguments)
if(func != null){
return func.apply(this, arguments)
}
return this
}
}
function chainSelfAttrMethods(obj, map){
for(var attr in map){
var methods = map[attr]
for(var name in methods){
obj[name] = doc(methods[name], chainSelfAttrMethod(obj, attr, name))
}
}
}
var ViewerPrototype = {
// this expects the folowing attrs:
//
// .ribbons
//
}
chainSelfAttrMethods(ViewerPrototype, {
ribbons: {
focusImage: 'Focus image',
focusRibbon: 'Focus ribbon',
},
})
ViewerPrototype.__proto__ = ClientPrototype
var Client =
module.Client = Object.create(ClientPrototype)
var Viewer =
module.Viewer = Object.create(ViewerPrototype)
/**********************************************************************
* vim:set ts=4 sw=4 : */
return module })

View File

@ -13,8 +13,8 @@ var actions = require('lib/actions')
var features = require('lib/features')
var toggler = require('lib/toggler')
var data = require('data')
var images = require('images')
var data = require('imagegrid/data')
var images = require('imagegrid/images')
var core = require('features/core')

View File

@ -12,8 +12,8 @@ var util = require('lib/util')
var actions = require('lib/actions')
var features = require('lib/features')
var data = require('data')
var images = require('images')
var data = require('imagegrid/data')
var images = require('imagegrid/images')
var core = require('features/core')
var base = require('features/base')

View File

@ -11,8 +11,8 @@ define(function(require){ var module = {}
var actions = require('lib/actions')
var features = require('lib/features')
var data = require('data')
var images = require('images')
var data = require('imagegrid/data')
var images = require('imagegrid/images')
var core = require('features/core')

View File

@ -15,11 +15,11 @@ if(typeof(process) != 'undefined'){
var pathlib = requirejs('path')
var glob = requirejs('glob')
var file = require('file')
var file = require('imagegrid/file')
}
var data = require('data')
var images = require('images')
var data = require('imagegrid/data')
var images = require('imagegrid/images')
var util = require('lib/util')

View File

@ -27,7 +27,7 @@ if(typeof(process) != 'undefined'){
var pathlib = requirejs('path')
var glob = requirejs('glob')
var file = require('file')
var file = require('imagegrid/file')
}

View File

@ -12,8 +12,8 @@ var toggler = require('lib/toggler')
var actions = require('lib/actions')
var features = require('lib/features')
var data = require('data')
var images = require('images')
var data = require('imagegrid/data')
var images = require('imagegrid/images')
var core = require('features/core')
var base = require('features/base')

View File

@ -13,9 +13,9 @@ var actions = require('lib/actions')
var features = require('lib/features')
var keyboard = require('lib/keyboard')
var data = require('data')
var images = require('images')
var ribbons = require('ribbons')
var data = require('imagegrid/data')
var images = require('imagegrid/images')
var ribbons = require('imagegrid/ribbons')
var core = require('features/core')
var base = require('features/base')

View File

@ -12,9 +12,9 @@ var keyboard = require('lib/keyboard')
var actions = require('lib/actions')
var features = require('lib/features')
var data = require('data')
var images = require('images')
var ribbons = require('ribbons')
var data = require('imagegrid/data')
var images = require('imagegrid/images')
var ribbons = require('imagegrid/ribbons')
var core = require('features/core')
var base = require('features/base')

View File

@ -12,9 +12,9 @@ var toggler = require('lib/toggler')
var actions = require('lib/actions')
var features = require('lib/features')
var data = require('data')
var images = require('images')
var ribbons = require('ribbons')
var data = require('imagegrid/data')
var images = require('imagegrid/images')
var ribbons = require('imagegrid/ribbons')
var core = require('features/core')
var base = require('features/base')

View File

@ -11,10 +11,11 @@
define(function(require){ var module = {}
var sha1 = require('ext-lib/sha1')
var object = require('lib/object')
var formats = require('formats')
var sha1 = require('./ext-lib/sha1')
var formats = require('imagegrid/formats')
module.DATA_VERSION = '3.0'

View File

@ -22,8 +22,8 @@ if(typeof(process) != 'undefined'){
return module
}
var data = require('data')
var images = require('images')
var data = require('imagegrid/data')
var images = require('imagegrid/images')
var util = require('lib/util')
var tasks = require('lib/tasks')

View File

@ -68,7 +68,7 @@ function(data, cmp){
//
// NOTE: this will just convert the JSON format and will not construct
// the Data object...
// NOTE: this uses require('data').Data().newGid(..) for ribbon gid
// NOTE: this uses require('imagegrid/data').Data().newGid(..) for ribbon gid
// generation...
//
module.VERSIONS['3.0'] =
@ -76,7 +76,7 @@ function(data){
data = data.version < '2.0' ? module.VERSIONS['2.0'](data) : data
// XXX is this the right way to go???
var that = require('data').Data()
var that = require('imagegrid/data').Data()
var res = {}
res.version = '3.0'

View File

@ -8,7 +8,7 @@ define(function(require){ var module = {}
//var DEBUG = DEBUG != null ? DEBUG : true
var sha1 = require('./ext-lib/sha1')
var sha1 = require('ext-lib/sha1')
var object = require('lib/object')

View File

@ -20,8 +20,8 @@ var util = require('lib/util')
var transform = require('lib/transform')
var object = require('lib/object')
var data = require('data')
var images = require('images')
var data = require('imagegrid/data')
var images = require('imagegrid/images')
var IMAGE = '.image:not(.clone)'

View File

@ -1,70 +0,0 @@
/**********************************************************************
*
*
*
**********************************************************************/
//var DEBUG = DEBUG != null ? DEBUG : true
/*********************************************************************/
//
// Basic terms:
// - trigger
// this is similar to an event bind...
// - filter
// - action
// fast reaction to instantanious actions, this is the same as an
// event handler...
// - feedback
// feedback loop used for long interactions
//
// * might be a good idea to combine trigger and filter...
//
//
// DSL loading stages:
// Stage 1: Read.
// - read the code
// - eval the code
// - introspection
// Stage 2: Run.
// - install hooks
// - introspection
// - run the handlers
//
//
/*********************************************************************/
/*********************************************************************/
// Slang version candidate:
//
// on click
// if [ ... ]
// do [ ... ]
//
// if [ ... ]
// key X
// do [ ... ]
//
var context = Context('test')
// trigger...
.on('click')
// filter...
.when(function(){ return true })
// action...
.act(function(){
return
})
// action...
.done()
.when(function(){ return true })
.key('X')
.act(function(){ })
/**********************************************************************
* vim:set ts=4 sw=4 : */

View File

@ -16,7 +16,7 @@ try{
if(typeof(process) != 'undefined'){
var fse = requirejs('fs-extra')
var pathlib = requirejs('path')
var file = requirejs('./file')
var file = requirejs('imagegrid/file')
}

View File

@ -45,7 +45,7 @@ define(function(require){ var module = {}
//var DEBUG = DEBUG != null ? DEBUG : true
var viewer = require('viewer')
var viewer = require('imagegrid/viewer')