uki 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/.gitmodules +3 -0
- data/LICENSE +20 -0
- data/Rakefile +23 -0
- data/Readme.rdoc +9 -0
- data/VERSION +1 -0
- data/bin/uki +102 -0
- data/frameworks/jspec/lib/images/bg.png +0 -0
- data/frameworks/jspec/lib/images/hr.png +0 -0
- data/frameworks/jspec/lib/images/loading.gif +0 -0
- data/frameworks/jspec/lib/images/sprites.bg.png +0 -0
- data/frameworks/jspec/lib/images/sprites.png +0 -0
- data/frameworks/jspec/lib/images/vr.png +0 -0
- data/frameworks/jspec/lib/jspec.css +149 -0
- data/frameworks/jspec/lib/jspec.growl.js +115 -0
- data/frameworks/jspec/lib/jspec.jquery.js +72 -0
- data/frameworks/jspec/lib/jspec.js +1756 -0
- data/frameworks/jspec/lib/jspec.shell.js +39 -0
- data/frameworks/jspec/lib/jspec.timers.js +90 -0
- data/frameworks/jspec/lib/jspec.xhr.js +195 -0
- data/frameworks/uki/README.rdoc +179 -0
- data/frameworks/uki/compiler.jar +0 -0
- data/frameworks/uki/run.rb +2 -0
- data/frameworks/uki/spec/commands/example_command.rb +19 -0
- data/frameworks/uki/spec/dom.html +39 -0
- data/frameworks/uki/spec/support/images/bg.png +0 -0
- data/frameworks/uki/spec/support/images/hr.png +0 -0
- data/frameworks/uki/spec/support/images/loading.gif +0 -0
- data/frameworks/uki/spec/support/images/sprites.bg.png +0 -0
- data/frameworks/uki/spec/support/images/sprites.png +0 -0
- data/frameworks/uki/spec/support/images/vr.png +0 -0
- data/frameworks/uki/spec/support/jspec.css +149 -0
- data/frameworks/uki/spec/support/jspec.js +1773 -0
- data/frameworks/uki/spec/support/jspec.xhr.js +193 -0
- data/frameworks/uki/spec/support/spec.helper.js +1 -0
- data/frameworks/uki/spec/unit/background.spec.js +29 -0
- data/frameworks/uki/spec/unit/builder.spec.js +51 -0
- data/frameworks/uki/spec/unit/data/model.spec.js +29 -0
- data/frameworks/uki/spec/unit/dom/dnd.spec.js +71 -0
- data/frameworks/uki/spec/unit/dom/event.spec.js +78 -0
- data/frameworks/uki/spec/unit/dom.spec.js +28 -0
- data/frameworks/uki/spec/unit/geometry.spec.js +79 -0
- data/frameworks/uki/spec/unit/selector.spec.js +140 -0
- data/frameworks/uki/spec/unit/theme/template.spec.js +31 -0
- data/frameworks/uki/spec/unit/utils.spec.js +176 -0
- data/frameworks/uki/spec/unit/view/base.spec.js +86 -0
- data/frameworks/uki/spec/unit/view/container.spec.js +73 -0
- data/frameworks/uki/spec/unit/view.spec.js +13 -0
- data/frameworks/uki/src/airport.js +1 -0
- data/frameworks/uki/src/uki-core/attachment.js +175 -0
- data/frameworks/uki/src/uki-core/background/css.js +37 -0
- data/frameworks/uki/src/uki-core/background/cssBox.js +73 -0
- data/frameworks/uki/src/uki-core/background/multi.js +20 -0
- data/frameworks/uki/src/uki-core/background/null.js +10 -0
- data/frameworks/uki/src/uki-core/background/rows.js +77 -0
- data/frameworks/uki/src/uki-core/background/sliced9.js +206 -0
- data/frameworks/uki/src/uki-core/background.js +35 -0
- data/frameworks/uki/src/uki-core/builder.js +68 -0
- data/frameworks/uki/src/uki-core/collection.js +278 -0
- data/frameworks/uki/src/uki-core/const.js +17 -0
- data/frameworks/uki/src/uki-core/dom/dnd.js +93 -0
- data/frameworks/uki/src/uki-core/dom/event.js +194 -0
- data/frameworks/uki/src/uki-core/dom/nativeLayout.js +18 -0
- data/frameworks/uki/src/uki-core/dom/offset.js +130 -0
- data/frameworks/uki/src/uki-core/dom/w3cdnd.js +333 -0
- data/frameworks/uki/src/uki-core/dom.js +109 -0
- data/frameworks/uki/src/uki-core/geometry.js +658 -0
- data/frameworks/uki/src/uki-core/image.js +90 -0
- data/frameworks/uki/src/uki-core/selector.js +201 -0
- data/frameworks/uki/src/uki-core/theme/base.js +39 -0
- data/frameworks/uki/src/uki-core/theme/template.js +26 -0
- data/frameworks/uki/src/uki-core/theme.js +45 -0
- data/frameworks/uki/src/uki-core/uki.js +45 -0
- data/frameworks/uki/src/uki-core/utils.js +399 -0
- data/frameworks/uki/src/uki-core/view/base.js +480 -0
- data/frameworks/uki/src/uki-core/view/container.js +155 -0
- data/frameworks/uki/src/uki-core/view/focusable.js +93 -0
- data/frameworks/uki/src/uki-core/view/observable.js +66 -0
- data/frameworks/uki/src/uki-core/view/styleable.js +70 -0
- data/frameworks/uki/src/uki-core/view/utils.js +66 -0
- data/frameworks/uki/src/uki-core/view.js +21 -0
- data/frameworks/uki/src/uki-core.js +36 -0
- data/frameworks/uki/src/uki-data/data.js +1 -0
- data/frameworks/uki/src/uki-data/model.js +28 -0
- data/frameworks/uki/src/uki-data/observable.js +34 -0
- data/frameworks/uki/src/uki-data.js +1 -0
- data/frameworks/uki/src/uki-more/more/utils.js +20 -0
- data/frameworks/uki/src/uki-more/more/view/listContainer.js +4 -0
- data/frameworks/uki/src/uki-more/more/view/multiselectList.js +196 -0
- data/frameworks/uki/src/uki-more/more/view/radioButton.js +27 -0
- data/frameworks/uki/src/uki-more/more/view/splitTable.js +79 -0
- data/frameworks/uki/src/uki-more/more/view/toggleButton.js +24 -0
- data/frameworks/uki/src/uki-more/more/view/treeList/render.js +53 -0
- data/frameworks/uki/src/uki-more/more/view/treeList.js +110 -0
- data/frameworks/uki/src/uki-more/more/view.js +2 -0
- data/frameworks/uki/src/uki-more/more.js +1 -0
- data/frameworks/uki/src/uki-more.js +4 -0
- data/frameworks/uki/src/uki-theamless.js +15 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/down-c.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/down-c.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/down-h.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/down-h.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/down-m.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/down-v.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/focusRing-c.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/focusRing-h.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/focusRing-m.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/focusRing-v.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/focusRing.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/hover-c.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/hover-c.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/hover-h.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/hover-h.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/hover-m.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/hover-v.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/hover.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/normal-c.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/normal-c.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/normal-h.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/normal-h.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/normal-m.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/normal-v.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/button/normal.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/checkbox/checkbox.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/checkbox/focus.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/checkbox/normal.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/checkbox/normal.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/panel/dark-h.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/panel/dark-h.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/panel/dark-m.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/panel/dark.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/popup/normal.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/radio/focus.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/radio/normal.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/radio/normal.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/radio/radio.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/shadow/large-c.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/shadow/large-h.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/shadow/large-m.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/shadow/large-v.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/shadow/large.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/slider/bar-m.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/slider/bar-m.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/slider/bar-v.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/slider/bar-v.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/slider/bar.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/slider/focus.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/slider/handle.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/splitPane/horizontal.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/splitPane/horizontal.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/splitPane/vertical.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/x.gif +0 -0
- data/frameworks/uki/src/uki-theme/airport.js +322 -0
- data/frameworks/uki/src/uki-theme/aristo/i/button/down-c.gif +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/button/down-c.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/button/down-h.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/button/down-m.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/button/down-v.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/button/down.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/button/focusRing-c.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/button/focusRing-h.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/button/focusRing-m.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/button/focusRing-v.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/button/focusRing.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/button/normal-c.gif +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/button/normal-c.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/button/normal-h.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/button/normal-m.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/button/normal-v.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/button/normal.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/checkbox/focus.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/checkbox/normal.gif +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/checkbox/normal.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/panel/normal-h.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/panel/normal-m.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/panel/normal.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/popup/normal.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/radio/focus.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/radio/normal.gif +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/radio/normal.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/shadow/large-c.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/shadow/large-h.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/shadow/large-m.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/shadow/large-v.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/shadow/large.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/slider/bar-m.gif +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/slider/bar-m.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/slider/bar-v.gif +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/slider/bar-v.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/slider/bar.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/slider/handle.gif +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/slider/handle.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/splitPane/horizontal.gif +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/splitPane/horizontal.png +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/splitPane/vertical.gif +0 -0
- data/frameworks/uki/src/uki-theme/aristo/i/x.gif +0 -0
- data/frameworks/uki/src/uki-theme/aristo.js +217 -0
- data/frameworks/uki/src/uki-view/view/box.js +1 -0
- data/frameworks/uki/src/uki-view/view/button.js +126 -0
- data/frameworks/uki/src/uki-view/view/checkbox.js +36 -0
- data/frameworks/uki/src/uki-view/view/flow.js +48 -0
- data/frameworks/uki/src/uki-view/view/image.js +9 -0
- data/frameworks/uki/src/uki-view/view/label.js +123 -0
- data/frameworks/uki/src/uki-view/view/list/render.js +23 -0
- data/frameworks/uki/src/uki-view/view/list.js +442 -0
- data/frameworks/uki/src/uki-view/view/popup.js +113 -0
- data/frameworks/uki/src/uki-view/view/radio.js +57 -0
- data/frameworks/uki/src/uki-view/view/scrollPane.js +139 -0
- data/frameworks/uki/src/uki-view/view/slider.js +154 -0
- data/frameworks/uki/src/uki-view/view/splitPane.js +213 -0
- data/frameworks/uki/src/uki-view/view/table/column.js +96 -0
- data/frameworks/uki/src/uki-view/view/table/header.js +53 -0
- data/frameworks/uki/src/uki-view/view/table/render.js +25 -0
- data/frameworks/uki/src/uki-view/view/table.js +71 -0
- data/frameworks/uki/src/uki-view/view/textField.js +145 -0
- data/frameworks/uki/src/uki-view/view/toolbar.js +93 -0
- data/frameworks/uki/src/uki-view.js +15 -0
- data/frameworks/uki/src/uki.js +2 -0
- data/frameworks/uki/thin.yaml +11 -0
- data/frameworks/uki/uki.rb +38 -0
- data/frameworks/uki/uki.ru +2 -0
- data/lib/uki/include_js.rb +50 -0
- data/lib/uki/project.rb +207 -0
- data/lib/uki/routes.rb +20 -0
- data/lib/uki/server.rb +42 -0
- data/lib/uki.rb +9 -0
- data/templates/index.html.erb +10 -0
- data/templates/model.js.erb +5 -0
- data/templates/myapp.js.erb +44 -0
- data/templates/package.js.erb +3 -0
- data/templates/spec.html.erb +23 -0
- data/templates/spec.js.erb +6 -0
- data/templates/view.js.erb +10 -0
- data/uki.gemspec +281 -0
- metadata +317 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
// JSpec - Shell - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
|
3
|
+
|
4
|
+
;(function(){
|
5
|
+
|
6
|
+
var _quit = quit
|
7
|
+
|
8
|
+
Shell = {
|
9
|
+
|
10
|
+
// --- Global
|
11
|
+
|
12
|
+
main: this,
|
13
|
+
|
14
|
+
// --- Commands
|
15
|
+
|
16
|
+
commands: {
|
17
|
+
quit: ['Terminate the shell', function(){ _quit() }],
|
18
|
+
exit: ['Terminate the shell', function(){ _quit() }],
|
19
|
+
p: ['Inspect an object', function(o){ return o.toSource() }]
|
20
|
+
},
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Start the interactive shell.
|
24
|
+
*
|
25
|
+
* @api public
|
26
|
+
*/
|
27
|
+
|
28
|
+
start : function() {
|
29
|
+
for (var name in this.commands)
|
30
|
+
if (this.commands.hasOwnProperty(name))
|
31
|
+
this.commands[name][1].length ?
|
32
|
+
this.main[name] = this.commands[name][1] :
|
33
|
+
this.main.__defineGetter__(name, this.commands[name][1])
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
Shell.start()
|
38
|
+
|
39
|
+
})()
|
@@ -0,0 +1,90 @@
|
|
1
|
+
|
2
|
+
// JSpec - Mock Timers - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
|
3
|
+
|
4
|
+
;(function(){
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Version.
|
8
|
+
*/
|
9
|
+
|
10
|
+
mockTimersVersion = '1.0.2'
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Localized timer stack.
|
14
|
+
*/
|
15
|
+
|
16
|
+
var timers = []
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Set mock timeout with _callback_ and timeout of _ms_.
|
20
|
+
*
|
21
|
+
* @param {function} callback
|
22
|
+
* @param {int} ms
|
23
|
+
* @return {int}
|
24
|
+
* @api public
|
25
|
+
*/
|
26
|
+
|
27
|
+
setTimeout = function(callback, ms) {
|
28
|
+
var id
|
29
|
+
return id = setInterval(function(){
|
30
|
+
callback()
|
31
|
+
clearInterval(id)
|
32
|
+
}, ms)
|
33
|
+
}
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Set mock interval with _callback_ and interval of _ms_.
|
37
|
+
*
|
38
|
+
* @param {function} callback
|
39
|
+
* @param {int} ms
|
40
|
+
* @return {int}
|
41
|
+
* @api public
|
42
|
+
*/
|
43
|
+
|
44
|
+
setInterval = function(callback, ms) {
|
45
|
+
callback.step = ms, callback.current = callback.last = 0
|
46
|
+
return timers[timers.length] = callback, timers.length
|
47
|
+
}
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Destroy timer with _id_.
|
51
|
+
*
|
52
|
+
* @param {int} id
|
53
|
+
* @return {bool}
|
54
|
+
* @api public
|
55
|
+
*/
|
56
|
+
|
57
|
+
clearInterval = clearTimeout = function(id) {
|
58
|
+
return delete timers[--id]
|
59
|
+
}
|
60
|
+
|
61
|
+
/**
|
62
|
+
* Reset timers.
|
63
|
+
*
|
64
|
+
* @return {array}
|
65
|
+
* @api public
|
66
|
+
*/
|
67
|
+
|
68
|
+
resetTimers = function() {
|
69
|
+
return timers = []
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Increment each timers internal clock by _ms_.
|
74
|
+
*
|
75
|
+
* @param {int} ms
|
76
|
+
* @api public
|
77
|
+
*/
|
78
|
+
|
79
|
+
tick = function(ms) {
|
80
|
+
for (var i = 0, len = timers.length; i < len; ++i)
|
81
|
+
if (timers[i] && (timers[i].current += ms))
|
82
|
+
if (timers[i].current - timers[i].last >= timers[i].step) {
|
83
|
+
var times = Math.floor((timers[i].current - timers[i].last) / timers[i].step)
|
84
|
+
var remainder = (timers[i].current - timers[i].last) % timers[i].step
|
85
|
+
timers[i].last = timers[i].current - remainder
|
86
|
+
while (times-- && timers[i]) timers[i]()
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
})()
|
@@ -0,0 +1,195 @@
|
|
1
|
+
|
2
|
+
// JSpec - XHR - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
|
3
|
+
|
4
|
+
(function(){
|
5
|
+
|
6
|
+
var lastRequest
|
7
|
+
|
8
|
+
// --- Original XMLHttpRequest
|
9
|
+
|
10
|
+
var OriginalXMLHttpRequest = 'XMLHttpRequest' in this ?
|
11
|
+
XMLHttpRequest :
|
12
|
+
function(){}
|
13
|
+
var OriginalActiveXObject = 'ActiveXObject' in this ?
|
14
|
+
ActiveXObject :
|
15
|
+
undefined
|
16
|
+
|
17
|
+
// --- MockXMLHttpRequest
|
18
|
+
|
19
|
+
var MockXMLHttpRequest = function() {
|
20
|
+
this.requestHeaders = {}
|
21
|
+
}
|
22
|
+
|
23
|
+
MockXMLHttpRequest.prototype = {
|
24
|
+
status: 0,
|
25
|
+
async: true,
|
26
|
+
readyState: 0,
|
27
|
+
responseText: '',
|
28
|
+
abort: function(){},
|
29
|
+
onreadystatechange: function(){},
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Return response headers hash.
|
33
|
+
*/
|
34
|
+
|
35
|
+
getAllResponseHeaders : function(){
|
36
|
+
return this.responseHeaders
|
37
|
+
},
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Return case-insensitive value for header _name_.
|
41
|
+
*/
|
42
|
+
|
43
|
+
getResponseHeader : function(name) {
|
44
|
+
return this.responseHeaders[name.toLowerCase()]
|
45
|
+
},
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Set case-insensitive _value_ for header _name_.
|
49
|
+
*/
|
50
|
+
|
51
|
+
setRequestHeader : function(name, value) {
|
52
|
+
this.requestHeaders[name.toLowerCase()] = value
|
53
|
+
},
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Open mock request.
|
57
|
+
*/
|
58
|
+
|
59
|
+
open : function(method, url, async, user, password) {
|
60
|
+
this.user = user
|
61
|
+
this.password = password
|
62
|
+
this.url = url
|
63
|
+
this.readyState = 1
|
64
|
+
this.method = method.toUpperCase()
|
65
|
+
if (async != undefined) this.async = async
|
66
|
+
if (this.async) this.onreadystatechange()
|
67
|
+
},
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Send request _data_.
|
71
|
+
*/
|
72
|
+
|
73
|
+
send : function(data) {
|
74
|
+
var self = this
|
75
|
+
this.data = data
|
76
|
+
this.readyState = 4
|
77
|
+
if (this.method == 'HEAD') this.responseText = null
|
78
|
+
this.responseHeaders['content-length'] = (this.responseText || '').length
|
79
|
+
if(this.async) this.onreadystatechange()
|
80
|
+
lastRequest = function(){
|
81
|
+
return self
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
// --- Response status codes
|
87
|
+
|
88
|
+
JSpec.statusCodes = {
|
89
|
+
100: 'Continue',
|
90
|
+
101: 'Switching Protocols',
|
91
|
+
200: 'OK',
|
92
|
+
201: 'Created',
|
93
|
+
202: 'Accepted',
|
94
|
+
203: 'Non-Authoritative Information',
|
95
|
+
204: 'No Content',
|
96
|
+
205: 'Reset Content',
|
97
|
+
206: 'Partial Content',
|
98
|
+
300: 'Multiple Choice',
|
99
|
+
301: 'Moved Permanently',
|
100
|
+
302: 'Found',
|
101
|
+
303: 'See Other',
|
102
|
+
304: 'Not Modified',
|
103
|
+
305: 'Use Proxy',
|
104
|
+
307: 'Temporary Redirect',
|
105
|
+
400: 'Bad Request',
|
106
|
+
401: 'Unauthorized',
|
107
|
+
402: 'Payment Required',
|
108
|
+
403: 'Forbidden',
|
109
|
+
404: 'Not Found',
|
110
|
+
405: 'Method Not Allowed',
|
111
|
+
406: 'Not Acceptable',
|
112
|
+
407: 'Proxy Authentication Required',
|
113
|
+
408: 'Request Timeout',
|
114
|
+
409: 'Conflict',
|
115
|
+
410: 'Gone',
|
116
|
+
411: 'Length Required',
|
117
|
+
412: 'Precondition Failed',
|
118
|
+
413: 'Request Entity Too Large',
|
119
|
+
414: 'Request-URI Too Long',
|
120
|
+
415: 'Unsupported Media Type',
|
121
|
+
416: 'Requested Range Not Satisfiable',
|
122
|
+
417: 'Expectation Failed',
|
123
|
+
422: 'Unprocessable Entity',
|
124
|
+
500: 'Internal Server Error',
|
125
|
+
501: 'Not Implemented',
|
126
|
+
502: 'Bad Gateway',
|
127
|
+
503: 'Service Unavailable',
|
128
|
+
504: 'Gateway Timeout',
|
129
|
+
505: 'HTTP Version Not Supported'
|
130
|
+
}
|
131
|
+
|
132
|
+
/**
|
133
|
+
* Mock XMLHttpRequest requests.
|
134
|
+
*
|
135
|
+
* mockRequest().and_return('some data', 'text/plain', 200, { 'X-SomeHeader' : 'somevalue' })
|
136
|
+
*
|
137
|
+
* @return {hash}
|
138
|
+
* @api public
|
139
|
+
*/
|
140
|
+
|
141
|
+
function mockRequest() {
|
142
|
+
return { and_return : function(body, type, status, headers) {
|
143
|
+
XMLHttpRequest = MockXMLHttpRequest
|
144
|
+
ActiveXObject = false
|
145
|
+
status = status || 200
|
146
|
+
headers = headers || {}
|
147
|
+
headers['content-type'] = type
|
148
|
+
JSpec.extend(XMLHttpRequest.prototype, {
|
149
|
+
responseText: body,
|
150
|
+
responseHeaders: headers,
|
151
|
+
status: status,
|
152
|
+
statusText: JSpec.statusCodes[status]
|
153
|
+
})
|
154
|
+
}}
|
155
|
+
}
|
156
|
+
|
157
|
+
/**
|
158
|
+
* Unmock XMLHttpRequest requests.
|
159
|
+
*
|
160
|
+
* @api public
|
161
|
+
*/
|
162
|
+
|
163
|
+
function unmockRequest() {
|
164
|
+
XMLHttpRequest = OriginalXMLHttpRequest
|
165
|
+
ActiveXObject = OriginalActiveXObject
|
166
|
+
}
|
167
|
+
|
168
|
+
JSpec.include({
|
169
|
+
name: 'Mock XHR',
|
170
|
+
|
171
|
+
// --- Utilities
|
172
|
+
|
173
|
+
utilities : {
|
174
|
+
mockRequest: mockRequest,
|
175
|
+
unmockRequest: unmockRequest
|
176
|
+
},
|
177
|
+
|
178
|
+
// --- Hooks
|
179
|
+
|
180
|
+
afterSpec : function() {
|
181
|
+
unmockRequest()
|
182
|
+
},
|
183
|
+
|
184
|
+
// --- DSLs
|
185
|
+
|
186
|
+
DSLs : {
|
187
|
+
snake : {
|
188
|
+
mock_request: mockRequest,
|
189
|
+
unmock_request: unmockRequest,
|
190
|
+
last_request: function(){ return lastRequest() }
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
})
|
195
|
+
})()
|
@@ -0,0 +1,179 @@
|
|
1
|
+
= UKI – simple UiKit for complex Web apps
|
2
|
+
Uki is a
|
3
|
+
JavaScript
|
4
|
+
user interface toolkit for desktop-like web applications.
|
5
|
+
It comes with
|
6
|
+
a rich view-component library
|
7
|
+
ranging from Sliders to Grids and SplitPanes.
|
8
|
+
|
9
|
+
uki({ view: 'Button', text: 'Click me', rect: '10 10 100 24' }).attachTo( window );
|
10
|
+
|
11
|
+
uki('Button[text^=Click]').click(function() { alert(this.text()); });
|
12
|
+
|
13
|
+
== Links
|
14
|
+
* API docs at http://ukijs.org/docs/
|
15
|
+
* Google group http://groups.google.com/group/ukijs
|
16
|
+
* Code examples at http://github.com/voloko/uki/tree/master/app/functional/
|
17
|
+
* Development docs and tutorial at http://wiki.github.com/voloko/uki/
|
18
|
+
* Google wave in 100 lines of code example: http://ukijs.org/examples/core-examples/wave
|
19
|
+
|
20
|
+
== Contribute
|
21
|
+
To install development server
|
22
|
+
1. Install ruby http://ruby-lang.org
|
23
|
+
2. Open terminal and run
|
24
|
+
gem install rake sinatra
|
25
|
+
cd PATH_TO_UKI
|
26
|
+
3. On windows run
|
27
|
+
ruby run.rb
|
28
|
+
On *nix
|
29
|
+
rake start
|
30
|
+
4. http://127.0.0.1:21119/src/uki.cjs – should be a merged version of uki
|
31
|
+
|
32
|
+
== Image path
|
33
|
+
For older browsers uki loads images from server.
|
34
|
+
By default development version loads them from uki.theme.airport.imagePath.
|
35
|
+
To point it to your development server do
|
36
|
+
uki.theme.airport.imagePath = 'http://127.0.0.1:21119//src/uki-theme/airport/i/'
|
37
|
+
|
38
|
+
== Simple
|
39
|
+
The Web should be simple.
|
40
|
+
Adding a new library to your app should not require
|
41
|
+
using a specific build process or learning a new language.
|
42
|
+
It should be as simple as adding a <script> tag to your HTML.
|
43
|
+
That's exactly the way uki works. No frameworks to install,
|
44
|
+
no dependencies to manage,
|
45
|
+
no CSS to include.
|
46
|
+
Simple.
|
47
|
+
|
48
|
+
== Cross-Browser
|
49
|
+
I can imagine living
|
50
|
+
in a fairy-tale world
|
51
|
+
where any browser supports HTML 5
|
52
|
+
and there's no such thing as IE6 :)
|
53
|
+
Unfortunately, reality is different.
|
54
|
+
I have to support all the browser flavors available,
|
55
|
+
even the dinosaurs.
|
56
|
+
That's why uki works with IE6+, Opera 9+, FF 2+, Safari 3+, and Chrome.
|
57
|
+
And it looks exactly the same on any of them.
|
58
|
+
|
59
|
+
== Fast
|
60
|
+
One of the reasons uki appeared
|
61
|
+
is that I had to create a 4000-row complex
|
62
|
+
client-side-searchable table.
|
63
|
+
Just rendering the table made any version of IE unresponsive for half a minute.
|
64
|
+
Uki uses progressive rendering and can render 30k+-row lists and tables mostly instantly.
|
65
|
+
|
66
|
+
== Small
|
67
|
+
With all the images packed into it
|
68
|
+
(not supported in IE6 and IE7),
|
69
|
+
a gzipped uki build is under 30kb,
|
70
|
+
and it's a single HTTP request.
|
71
|
+
|
72
|
+
== Extensible
|
73
|
+
Creating a new component requires only one function to redeclare.
|
74
|
+
|
75
|
+
== Embeddable
|
76
|
+
It's great when you start building your whole app with uki.
|
77
|
+
But sometimes
|
78
|
+
you have to add a desktop-like experience to a working site.
|
79
|
+
Say, adding a widget or a table
|
80
|
+
to an existing design.
|
81
|
+
While uki can occupy the whole browser window,
|
82
|
+
it works perfectly well in a small <div> in
|
83
|
+
your sidebar.
|
84
|
+
Just use attachTo( myDiv ) for any widget you want to add.
|
85
|
+
|
86
|
+
== You already know it
|
87
|
+
Uki is written in plain JavaScript.
|
88
|
+
It leverages well-known DOM and JS idioms
|
89
|
+
such as CSS selectors, events and attributes.
|
90
|
+
If you've ever used
|
91
|
+
jQuery, learning uki won't take long.
|
92
|
+
|
93
|
+
== Specific
|
94
|
+
Uki doesn't want to be a Jack-of-all-trades.
|
95
|
+
It only does layout, but it does it well.
|
96
|
+
You won't find any AJAX or data-storage-layer code here.
|
97
|
+
|
98
|
+
== Programmable Layout
|
99
|
+
HTML and CSS are great technologies,
|
100
|
+
though you can't lay everything out with them.
|
101
|
+
There are things that require programmable layout calculations.
|
102
|
+
Think of a toolbar,
|
103
|
+
which should show a popup
|
104
|
+
when some of the buttons don't fit.
|
105
|
+
Or a split pane.
|
106
|
+
Or moving a slider bar on window resize.
|
107
|
+
That's the reason
|
108
|
+
uki calculates view positions and sizes
|
109
|
+
with JavaScript.
|
110
|
+
Unfortunately,
|
111
|
+
resizing everything with pure JS will make your layout slow as a turtle.
|
112
|
+
So uki uses as much native browser layout as possible.
|
113
|
+
|
114
|
+
== Longer example
|
115
|
+
uki(
|
116
|
+
{ // create a split pane...
|
117
|
+
view: 'SplitPane', rect: '1000 600', anchors: 'left top right bottom',
|
118
|
+
handlePosition: 300, leftMin: 200, rightMin: 300,
|
119
|
+
// ...with button on the left
|
120
|
+
leftChildViews: { view: 'Button', rect: '10 10 280 24', anchors: 'top left right', text: 'Clear text field' },
|
121
|
+
// ...and a vertical split pane on the right...
|
122
|
+
rightChildViews: [
|
123
|
+
{ view: 'VSplitPane', rect: '693 600', anchors: 'left top right bottom', vertical: true,
|
124
|
+
// ...with text field in the top part
|
125
|
+
topChildViews: { view: 'TextField', rect: '10 10 280 24', anchors: 'top left', value: '0', id: 'field' },
|
126
|
+
// ...and a slider in the bottom
|
127
|
+
bottomChildViews: { view: 'Slider', rect: '10 10 673 24', anchors: 'top right left' }
|
128
|
+
}
|
129
|
+
]
|
130
|
+
}).attachTo( window, '1000 600' );
|
131
|
+
|
132
|
+
// on slider change update text field
|
133
|
+
uki('SplitPane Slider').bind('change', function() {
|
134
|
+
uki('TextField').value(this.value())
|
135
|
+
});
|
136
|
+
|
137
|
+
// on button click clear the text field
|
138
|
+
uki('Button[text~="Clear"]').bind('click', function() {
|
139
|
+
uki('#field').value('') // find by id
|
140
|
+
});
|
141
|
+
|
142
|
+
results in http://ukijs.org/functional/splitPaneEx.html
|
143
|
+
|
144
|
+
== Builder
|
145
|
+
uki({
|
146
|
+
view: 'Button',
|
147
|
+
rect: '400 40 200 24',
|
148
|
+
text: 'uki is awesome!'
|
149
|
+
}).attachTo( document.getElementById('test'), '1000 100' );
|
150
|
+
|
151
|
+
uki('Button[text^=uki]').click(function() {
|
152
|
+
alert('Hello world!');
|
153
|
+
});
|
154
|
+
|
155
|
+
uki(
|
156
|
+
{ view: "Button", text: "Click me", rect: "10 10 100 24" }
|
157
|
+
).attachTo( document.getElementById("test") );
|
158
|
+
|
159
|
+
uki("Button[text^=Click]").click(
|
160
|
+
function() { alert(this.text()); }
|
161
|
+
);
|
162
|
+
|
163
|
+
uki({ view: 'SplitPane', rect: '1000 600', anchors: 'left top right bottom',
|
164
|
+
handlePosition: 300, autogrowLeft: false, leftMin: 300, rightMin: 300,
|
165
|
+
leftChildViews: { view: 'Button', rect: '10 10 280 24', anchors: 'top left right', text: 'left pane' },
|
166
|
+
rightChildViews: [
|
167
|
+
{ view: 'SplitPane', rect: '693 600', anchors: 'left top right bottom', vertical: true,
|
168
|
+
topChildViews: { view: 'Button', rect: '10 10 280 24', anchors: 'top left', text: 'top pane' },
|
169
|
+
bottomChildViews: { view: 'Slider', rect: '10 10 673 24', anchors: 'top right left' }
|
170
|
+
}
|
171
|
+
]
|
172
|
+
}).attachTo( window, '1000 600' );
|
173
|
+
|
174
|
+
== Tests
|
175
|
+
cd tests
|
176
|
+
narwhal runner.js
|
177
|
+
|
178
|
+
== P.S.
|
179
|
+
And one more thing. Unobtrusive JavaScript is evil.
|
Binary file
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
# uncomment and call with `$ jspec example `
|
3
|
+
|
4
|
+
# command :example do |c|
|
5
|
+
# c.syntax = 'jspec example [options]'
|
6
|
+
# c.description = 'Just an example command'
|
7
|
+
# c.option '-f', '--foo string', 'Does some foo with <string>'
|
8
|
+
# c.option '-b', '--bar [string]', 'Does some bar with [string]'
|
9
|
+
# c.example 'Do some foo', 'jspec example --foo bar'
|
10
|
+
# c.example 'Do some bar', 'jspec example --bar'
|
11
|
+
# c.when_called do |args, options|
|
12
|
+
# p args
|
13
|
+
# p options.__hash__
|
14
|
+
# # options.foo
|
15
|
+
# # options.bar
|
16
|
+
# # options.__hash__[:foo]
|
17
|
+
# # options.__hash__[:bar]
|
18
|
+
# end
|
19
|
+
# end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>UKI specs</title>
|
4
|
+
<link type="text/css" rel="stylesheet" href="support/jspec.css" />
|
5
|
+
<script src="support/jspec.js"></script>
|
6
|
+
<script src="support/jspec.xhr.js"></script>
|
7
|
+
<script src="../src/uki.cjs"></script>
|
8
|
+
<script src="../src/uki-data.cjs"></script>
|
9
|
+
<script src="support/spec.helper.js"></script>
|
10
|
+
<script>
|
11
|
+
function runSuites() {
|
12
|
+
JSpec
|
13
|
+
.exec('unit/selector.spec.js')
|
14
|
+
.exec('unit/geometry.spec.js')
|
15
|
+
.exec('unit/utils.spec.js')
|
16
|
+
.exec('unit/builder.spec.js')
|
17
|
+
.exec('unit/dom.spec.js')
|
18
|
+
.exec('unit/dom/event.spec.js')
|
19
|
+
.exec('unit/dom/dnd.spec.js')
|
20
|
+
.exec('unit/background.spec.js')
|
21
|
+
|
22
|
+
.exec('unit/view.spec.js')
|
23
|
+
.exec('unit/view/base.spec.js')
|
24
|
+
.exec('unit/view/container.spec.js')
|
25
|
+
|
26
|
+
.exec('unit/theme/template.spec.js')
|
27
|
+
|
28
|
+
.exec('unit/data/model.spec.js')
|
29
|
+
.run()
|
30
|
+
.report({ fixturePath: 'fixtures' })
|
31
|
+
}
|
32
|
+
</script>
|
33
|
+
</head>
|
34
|
+
<body class="jspec" onLoad="runSuites();">
|
35
|
+
<div id="jspec-top"><h2 id="jspec-title">JSpec <em><script>document.write(JSpec.version)</script></em></h2></div>
|
36
|
+
<div id="jspec"></div>
|
37
|
+
<div id="jspec-bottom"></div>
|
38
|
+
</body>
|
39
|
+
</html>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|