uki 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/uki +1 -1
- data/frameworks/uki/README.rdoc +1 -1
- data/frameworks/uki/examples/core-examples/controls/controls.js +6 -6
- data/frameworks/uki/examples/core-examples/flow/flow.js +4 -4
- data/frameworks/uki/examples/core-examples/linearGradient/gradient.svg +11 -0
- data/frameworks/uki/examples/core-examples/linearGradient/linearGradient.js +87 -0
- data/frameworks/uki/examples/core-examples/popup/popup.js +23 -10
- data/frameworks/uki/examples/core-examples/resizeToContents/resizeToContents.js +12 -1
- data/frameworks/uki/examples/core-examples/slider/slider.js +1 -1
- data/frameworks/uki/examples/core-examples/splitPaneExtended/splitPaneExtended.js +1 -1
- data/frameworks/uki/examples/core-examples/table/table.js +19 -2
- data/frameworks/uki/examples/core-examples/wave/wave-theme.js +1 -1
- data/frameworks/uki/examples/core-examples/wave/wave.js +1 -1
- data/frameworks/uki/examples/more-examples/radioButton/radioButton.js +3 -3
- data/frameworks/uki/examples/more-examples/select/select.js +35 -0
- data/frameworks/uki/examples/touch-examples/scrollPane/scrollPane.js +53 -0
- data/frameworks/uki/spec/unit/background.spec.js +1 -1
- data/frameworks/uki/spec/unit/selector.spec.js +28 -12
- data/frameworks/uki/spec/unit/utils.spec.js +14 -0
- data/frameworks/uki/src/uki-core.js +3 -1
- data/frameworks/uki/src/uki-core/after.js +57 -0
- data/frameworks/uki/src/uki-core/attachment.js +15 -6
- data/frameworks/uki/src/uki-core/background.js +4 -3
- data/frameworks/uki/src/uki-core/background/css.js +1 -0
- data/frameworks/uki/src/uki-core/background/cssBox.js +5 -3
- data/frameworks/uki/src/uki-core/background/linearGradient.js +112 -0
- data/frameworks/uki/src/uki-core/background/multi.js +2 -2
- data/frameworks/uki/src/uki-core/background/rows.js +1 -0
- data/frameworks/uki/src/uki-core/background/sliced9.js +5 -2
- data/frameworks/uki/src/uki-core/builder.js +5 -4
- data/frameworks/uki/src/uki-core/collection.js +18 -13
- data/frameworks/uki/src/uki-core/dom/browser.js +114 -0
- data/frameworks/uki/src/uki-core/dom/event.js +3 -0
- data/frameworks/uki/src/uki-core/image.js +1 -26
- data/frameworks/uki/src/uki-core/selector.js +5 -0
- data/frameworks/uki/src/uki-core/theme.js +24 -23
- data/frameworks/uki/src/uki-core/theme/template.js +1 -1
- data/frameworks/uki/src/uki-core/uki.js +7 -4
- data/frameworks/uki/src/uki-core/utils.js +51 -26
- data/frameworks/uki/src/uki-core/view.js +6 -3
- data/frameworks/uki/src/uki-core/view/base.js +16 -1
- data/frameworks/uki/src/uki-core/view/container.js +15 -5
- data/frameworks/uki/src/uki-core/view/focusable.js +17 -4
- data/frameworks/uki/src/uki-core/view/observable.js +15 -2
- data/frameworks/uki/src/uki-core/view/styleable.js +4 -11
- data/frameworks/uki/src/uki-data/ajax.js +4 -30
- data/frameworks/uki/src/uki-data/json.js +191 -0
- data/frameworks/uki/src/uki-data/localStore.js +37 -0
- data/frameworks/uki/src/uki-data/model.js +1 -1
- data/frameworks/uki/src/uki-more.js +4 -0
- data/frameworks/uki/src/uki-more/more/background.js +2 -0
- data/frameworks/uki/src/uki-more/more/color.js +168 -0
- data/frameworks/uki/src/uki-more/more/utils.js +5 -12
- data/frameworks/uki/src/uki-more/more/view.js +3 -1
- data/frameworks/uki/src/uki-more/more/view/form.js +30 -0
- data/frameworks/uki/src/uki-more/more/view/hTile.js +59 -0
- data/frameworks/uki/src/uki-more/more/view/nativeButton.js +3 -0
- data/frameworks/uki/src/uki-more/more/view/nativeCheckbox.js +38 -0
- data/frameworks/uki/src/uki-more/more/view/nativeControl.js +40 -0
- data/frameworks/uki/src/uki-more/more/view/nativeInput.js +78 -0
- data/frameworks/uki/src/uki-more/more/view/nativeSelect.js +29 -0
- data/frameworks/uki/src/uki-more/more/view/radioButton.js +1 -1
- data/frameworks/uki/src/uki-more/more/view/select-theme.js +55 -0
- data/frameworks/uki/src/uki-more/more/view/select.js +208 -0
- data/frameworks/uki/src/uki-theme/airport.js +145 -88
- data/frameworks/uki/src/uki-theme/airport/i/table/a-down.png +0 -0
- data/frameworks/uki/src/uki-theme/airport/i/table/a-up.png +0 -0
- data/frameworks/uki/src/uki-touch.js +2 -0
- data/frameworks/uki/src/uki-touch/touch.js +1 -0
- data/frameworks/uki/src/uki-touch/touch/const.js +24 -0
- data/frameworks/uki/src/uki-touch/touch/setup.js +52 -0
- data/frameworks/uki/src/uki-touch/touch/view.js +4 -0
- data/frameworks/uki/src/uki-touch/touch/view/scrollPane.js +505 -0
- data/frameworks/uki/src/uki-touch/touch/view/scrollableList.js +27 -0
- data/frameworks/uki/src/uki-view/view/box.js +9 -0
- data/frameworks/uki/src/uki-view/view/button.js +36 -1
- data/frameworks/uki/src/uki-view/view/checkbox.js +32 -3
- data/frameworks/uki/src/uki-view/view/flow.js +37 -9
- data/frameworks/uki/src/uki-view/view/image.js +14 -1
- data/frameworks/uki/src/uki-view/view/label.js +72 -11
- data/frameworks/uki/src/uki-view/view/list.js +143 -13
- data/frameworks/uki/src/uki-view/view/list/render.js +1 -0
- data/frameworks/uki/src/uki-view/view/popup.js +46 -2
- data/frameworks/uki/src/uki-view/view/radio.js +19 -4
- data/frameworks/uki/src/uki-view/view/scrollPane.js +91 -33
- data/frameworks/uki/src/uki-view/view/slider.js +67 -54
- data/frameworks/uki/src/uki-view/view/splitPane.js +102 -9
- data/frameworks/uki/src/uki-view/view/table.js +59 -2
- data/frameworks/uki/src/uki-view/view/table/column.js +45 -17
- data/frameworks/uki/src/uki-view/view/table/header.js +40 -12
- data/frameworks/uki/src/uki-view/view/table/render.js +4 -0
- data/frameworks/uki/src/uki-view/view/textField.js +75 -21
- data/frameworks/uki/src/uki-view/view/toolbar.js +16 -0
- data/lib/uki/builder.rb +1 -1
- data/lib/uki/include_js.rb +2 -2
- data/lib/uki/project.rb +14 -14
- data/templates/index.html.erb +2 -2
- data/templates/myapp.js.erb +2 -2
- data/uki.gemspec +34 -48
- metadata +44 -47
- data/frameworks/uki/src/uki-core/dom/nativeLayout.js +0 -18
- 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/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/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
@@ -130,7 +130,9 @@ uki.background.Sliced9 = uki.newClass(new function() {
|
|
130
130
|
settings.c, [LEFT + '-' + inset.left + PX, TOP + '-' + inset.top + PX, WIDTH + width + PX, HEIGHT + height + PX].join(';'), 'right -' + inset.top + PX
|
131
131
|
);
|
132
132
|
}
|
133
|
-
|
133
|
+
var container = uki.createElement('div', 'position:absolute;overflow:hidden;' + css, html.join(''));
|
134
|
+
container.className = 'uki-background-Sliced9';
|
135
|
+
return container;
|
134
136
|
};
|
135
137
|
|
136
138
|
/** @ignore */
|
@@ -144,7 +146,8 @@ uki.background.Sliced9 = uki.newClass(new function() {
|
|
144
146
|
this._comp = comp;
|
145
147
|
|
146
148
|
this._container.style.visibility = 'visible';
|
147
|
-
this._comp.dom().
|
149
|
+
this._comp.dom().insertBefore(this._container, this._comp.dom().firstChild);
|
150
|
+
// this._comp.dom().appendChild(this._container);
|
148
151
|
|
149
152
|
if (!uki.supportNativeLayout) {
|
150
153
|
this._layoutHandler = this._layoutHandler || uki.proxy(function(e) {
|
@@ -20,8 +20,9 @@ include('collection.js');
|
|
20
20
|
* @returns {uki.view.Collection} collection of created elements
|
21
21
|
*/
|
22
22
|
uki.build = function(ml) {
|
23
|
-
|
24
|
-
return new uki.Collection(createMulti(ml));
|
23
|
+
|
24
|
+
return new uki.Collection( createMulti( (ml.length === undefined) ? [ml] : ml ) );
|
25
|
+
|
25
26
|
};
|
26
27
|
|
27
28
|
uki.viewNamespaces = ['uki.view.', ''];
|
@@ -40,11 +41,11 @@ include('collection.js');
|
|
40
41
|
if (uki.isFunction(c)) {
|
41
42
|
result = new c(mlRow.rect);
|
42
43
|
} else if (typeof c === 'string') {
|
43
|
-
for (var i=0, ns = uki.viewNamespaces; i < ns
|
44
|
+
for (var i=0, ns = uki.viewNamespaces, ns$length = ns.length; i < ns$length; i++) {
|
44
45
|
var parts = (ns[i] + c).split('.'),
|
45
46
|
obj = root;
|
46
47
|
|
47
|
-
for (var j=0; obj && j < parts
|
48
|
+
for (var j=0, parts$length = parts.length; obj && j < parts$length; j++) {
|
48
49
|
obj = obj[parts[j]];
|
49
50
|
};
|
50
51
|
if (obj) {
|
@@ -31,8 +31,7 @@ uki.fn = uki.Collection.prototype = new function() {
|
|
31
31
|
* @returns {uki.view.Collection} self
|
32
32
|
*/
|
33
33
|
this.each = function( callback ) {
|
34
|
-
uki.each( this, callback );
|
35
|
-
return this;
|
34
|
+
return uki.each( this, callback );
|
36
35
|
};
|
37
36
|
|
38
37
|
/**
|
@@ -62,12 +61,12 @@ uki.fn = uki.Collection.prototype = new function() {
|
|
62
61
|
*/
|
63
62
|
this.attr = function( name, value ) {
|
64
63
|
if (value !== undefined) {
|
65
|
-
for (var i=
|
64
|
+
for (var i=this.length-1; i >= 0; i--) {
|
66
65
|
uki.attr( this[i], name, value );
|
67
66
|
};
|
68
67
|
return this;
|
69
68
|
} else {
|
70
|
-
return this[0] ? uki.attr( this[0], name ) :
|
69
|
+
return this[0] ? uki.attr( this[0], name ) : "";
|
71
70
|
}
|
72
71
|
};
|
73
72
|
|
@@ -110,11 +109,15 @@ uki.fn = uki.Collection.prototype = new function() {
|
|
110
109
|
* @returns {uki.view.Collection} self
|
111
110
|
*/
|
112
111
|
this.append = function( views ) {
|
113
|
-
|
112
|
+
var target = this[0];
|
113
|
+
if (!target) return this;
|
114
|
+
|
114
115
|
views = views.length !== undefined ? views : [views];
|
115
|
-
|
116
|
-
|
116
|
+
|
117
|
+
for (var i = views.length-1; i >= 0; i--) {
|
118
|
+
target.appendChild(views[i]);
|
117
119
|
};
|
120
|
+
|
118
121
|
return this;
|
119
122
|
};
|
120
123
|
|
@@ -123,7 +126,8 @@ uki.fn = uki.Collection.prototype = new function() {
|
|
123
126
|
this.each(function() {
|
124
127
|
target.appendChild(this);
|
125
128
|
});
|
126
|
-
return this;
|
129
|
+
return this;
|
130
|
+
|
127
131
|
};
|
128
132
|
|
129
133
|
/**#@-*/
|
@@ -167,8 +171,9 @@ uki.fn = uki.Collection.prototype = new function() {
|
|
167
171
|
@name uki.Collection#focusable */
|
168
172
|
/** @function
|
169
173
|
@name uki.Collection#style */
|
170
|
-
uki.Collection.addAttrs('dom html text background value rect checked anchors childViews typeName id name visible disabled focusable style draggable textSelectable width height minX maxX minY maxY left top x y'.split(' '));
|
171
|
-
|
174
|
+
uki.Collection.addAttrs('dom html text background value rect checked anchors childViews typeName id name visible disabled focusable style draggable textSelectable width height minX maxX minY maxY left top x y contentsSize'.split(' '));
|
175
|
+
|
176
|
+
|
172
177
|
/** @function
|
173
178
|
@name uki.Collection#parent */
|
174
179
|
/** @function
|
@@ -180,7 +185,7 @@ uki.fn = uki.Collection.prototype = new function() {
|
|
180
185
|
['next', 'nextView'],
|
181
186
|
['prev', 'prevView']
|
182
187
|
], function(i, desc) {
|
183
|
-
proto[desc[0]] = function() {
|
188
|
+
proto[ desc[0] ] = function() {
|
184
189
|
return new uki.Collection( uki.unique( uki.map(this, desc[1]) ) );
|
185
190
|
};
|
186
191
|
});
|
@@ -210,7 +215,7 @@ uki.fn = uki.Collection.prototype = new function() {
|
|
210
215
|
@name uki.Collection#toggle */
|
211
216
|
uki.each('bind unbind trigger layout appendChild removeChild insertBefore addRow removeRow resizeToContents toggle'.split(' '), function(i, name) {
|
212
217
|
proto[name] = function() {
|
213
|
-
for (var i=
|
218
|
+
for (var i=this.length-1; i >=0; i--) {
|
214
219
|
this[i][name].apply(this[i], arguments);
|
215
220
|
};
|
216
221
|
return this;
|
@@ -266,7 +271,7 @@ uki.fn = uki.Collection.prototype = new function() {
|
|
266
271
|
if (handler) {
|
267
272
|
this.bind(name, handler);
|
268
273
|
} else {
|
269
|
-
for (var i=
|
274
|
+
for (var i=this.length-1; i >=0; i--) {
|
270
275
|
this[i][name] ? this[i][name]() : this[i].trigger(name);
|
271
276
|
};
|
272
277
|
}
|
@@ -0,0 +1,114 @@
|
|
1
|
+
include('../dom.js');
|
2
|
+
|
3
|
+
uki.browser = new function() {
|
4
|
+
|
5
|
+
var boxShadow;
|
6
|
+
this.cssBoxShadow = function() {
|
7
|
+
// Opera 10.5 consistently fails to redraw shadows. Easier to switch off
|
8
|
+
boxShadow = boxShadow || (root.opera ? 'unsupported' : checkPrefixes('box-shadow'));
|
9
|
+
return boxShadow;
|
10
|
+
};
|
11
|
+
|
12
|
+
var borderRadius;
|
13
|
+
this.cssBorderRadius = function() {
|
14
|
+
borderRadius = borderRadius || checkPrefixes('border-radius');
|
15
|
+
return borderRadius;
|
16
|
+
};
|
17
|
+
|
18
|
+
var userSelect;
|
19
|
+
this.cssUserSelect = function() {
|
20
|
+
userSelect = userSelect || checkPrefixes('user-select');
|
21
|
+
return userSelect;
|
22
|
+
};
|
23
|
+
|
24
|
+
var linearGradient;
|
25
|
+
this.cssLinearGradient = function() {
|
26
|
+
linearGradient = linearGradient || initLinearGradient();
|
27
|
+
return linearGradient;
|
28
|
+
};
|
29
|
+
|
30
|
+
var canvas;
|
31
|
+
this.canvas = function() {
|
32
|
+
if (canvas === undefined) canvas = !!uki.createElement('canvas').getContext;
|
33
|
+
return canvas;
|
34
|
+
};
|
35
|
+
|
36
|
+
var filter;
|
37
|
+
this.cssFilter = function() {
|
38
|
+
if (filter === undefined) filter = typeof uki.createElement('div').style.filter != 'undefined';
|
39
|
+
return filter;
|
40
|
+
};
|
41
|
+
|
42
|
+
function swap (obj, src, dst) {
|
43
|
+
var v = obj[src];
|
44
|
+
obj[src] = undefined;
|
45
|
+
obj[dst] = v;
|
46
|
+
}
|
47
|
+
this.css = function(css) {
|
48
|
+
if (!css) return '';
|
49
|
+
if (typeof css == 'string') {
|
50
|
+
return css.replace(/(^|[^-])(box-shadow|border-radius|user-select)/g, function(value) {
|
51
|
+
var p;
|
52
|
+
if ((p = value.indexOf('box-shadow')) > -1) return value.substr(0, p) + uki.browser.cssBoxShadow();
|
53
|
+
if ((p = value.indexOf('border-radius')) > -1) return value.substr(0, p) + uki.browser.cssBorderRadius();
|
54
|
+
if ((p = value.indexOf('user-select')) > -1) return value.substr(0, p) + uki.browser.cssUserSelect();
|
55
|
+
});
|
56
|
+
}
|
57
|
+
|
58
|
+
uki.each(['boxShadow', 'borderRadius', 'userSelect'], function(k, v) {
|
59
|
+
if (css[v]) swap(css, v, uki.camalize( uki.browser[ uki.camalize('css-' + v) ]() ) );
|
60
|
+
});
|
61
|
+
return css;
|
62
|
+
};
|
63
|
+
|
64
|
+
this.textStyles = 'font fontFamily fontWeight fontSize textDecoration textOverflow textAlign textShadow overflow color'.split(' ');
|
65
|
+
|
66
|
+
function checkPrefixes (dashProp) {
|
67
|
+
var e = uki.createElement('div'),
|
68
|
+
style = e.style,
|
69
|
+
prefixes = ['', '-webkit-', '-moz-'];
|
70
|
+
|
71
|
+
for (var i=0; i < prefixes.length; i++) {
|
72
|
+
if (style[ uki.camalize(prefixes[i] + dashProp) ] !== undefined) return prefixes[i] + dashProp;
|
73
|
+
};
|
74
|
+
return 'unsupported';
|
75
|
+
}
|
76
|
+
|
77
|
+
function initLinearGradient () {
|
78
|
+
var e = uki.createElement(
|
79
|
+
'div',
|
80
|
+
'background-image:-moz-linear-gradient(right,red,red);'+
|
81
|
+
'background-image:linear-gradient(right,red,red);'+
|
82
|
+
'background-image:-webkit-gradient(linear,0 0,100% 0,from(red),to(red))'
|
83
|
+
),
|
84
|
+
style = e.style,
|
85
|
+
bgi = style.backgroundImage + '';
|
86
|
+
|
87
|
+
if (bgi.indexOf('-moz-linear-gradient') > -1) {
|
88
|
+
return '-moz-linear-gradient';
|
89
|
+
} else if (bgi.indexOf('-webkit-gradient') > -1) {
|
90
|
+
return '-webkit-gradient';
|
91
|
+
} else if (bgi.indexOf('linear-gradient') > -1) {
|
92
|
+
return 'linear-gradient';
|
93
|
+
} else {
|
94
|
+
return 'unsupported';
|
95
|
+
}
|
96
|
+
}
|
97
|
+
};
|
98
|
+
|
99
|
+
uki.initNativeLayout = function() {
|
100
|
+
if (uki.supportNativeLayout === undefined) {
|
101
|
+
uki.dom.probe(
|
102
|
+
uki.createElement(
|
103
|
+
'div',
|
104
|
+
'position:absolute;width:100px;height:100px;left:-999em;',
|
105
|
+
'<div style="position:absolute;left:0;right:0"></div>'
|
106
|
+
),
|
107
|
+
function(div) {
|
108
|
+
uki.supportNativeLayout = div.childNodes[0].offsetWidth == 100 && !root.opera;
|
109
|
+
}
|
110
|
+
);
|
111
|
+
}
|
112
|
+
};
|
113
|
+
|
114
|
+
// uki.supportNativeLayout = false;
|
@@ -101,6 +101,7 @@ uki.extend(uki.dom, /** @lends uki.dom */ {
|
|
101
101
|
|
102
102
|
/** @ignore */
|
103
103
|
handler: function( e ) {
|
104
|
+
|
104
105
|
e = e || root.event;
|
105
106
|
|
106
107
|
var type = e.type,
|
@@ -115,9 +116,11 @@ uki.extend(uki.dom, /** @lends uki.dom */ {
|
|
115
116
|
|
116
117
|
if (!id || !handlers || !handlers[type]) return;
|
117
118
|
|
119
|
+
uki.after.start();
|
118
120
|
for (i=0, handlers = handlers[type]; i < handlers.length; i++) {
|
119
121
|
handlers[i].call(this, e);
|
120
122
|
};
|
123
|
+
uki.after.stop();
|
121
124
|
},
|
122
125
|
|
123
126
|
/**
|
@@ -18,7 +18,6 @@ uki.image = function(url, dataUrl, alphaUrl) {
|
|
18
18
|
result.src = uki.imageSrc(url, dataUrl, alphaUrl);
|
19
19
|
return result;
|
20
20
|
};
|
21
|
-
|
22
21
|
/**
|
23
22
|
* Selects image src depending on browser
|
24
23
|
*
|
@@ -53,30 +52,6 @@ uki.imageHTML = function(url, dataUrl, alphaUrl, html) {
|
|
53
52
|
return '<img' + (html || '') + ' src="' + url + '" />';
|
54
53
|
};
|
55
54
|
|
56
|
-
/**
|
57
|
-
* Loads given images, callbacks after all of them loads
|
58
|
-
*
|
59
|
-
* @param {Array.<Element>} images Images to load
|
60
|
-
* @param {function()} callback
|
61
|
-
*/
|
62
|
-
uki.image.load = function(images, callback) {
|
63
|
-
var imagesToLoad = images.length;
|
64
|
-
|
65
|
-
uki.each(images, function(i, img) {
|
66
|
-
if (!img || img.width) {
|
67
|
-
if (!--imagesToLoad) callback();
|
68
|
-
return;
|
69
|
-
}
|
70
|
-
|
71
|
-
var handler = function() {
|
72
|
-
img.onload = img.onerror = img.onabort = null; // prevent memory leaks
|
73
|
-
if (!--imagesToLoad) callback();
|
74
|
-
};
|
75
|
-
img.onload = handler;
|
76
|
-
img.onerror = handler;
|
77
|
-
img.onabort = handler;
|
78
|
-
});
|
79
|
-
};
|
80
55
|
|
81
56
|
/**
|
82
57
|
* @type boolean
|
@@ -87,4 +62,4 @@ uki.image.dataUrlSupported = doc.createElement('canvas').toDataURL || (/MSIE (8)
|
|
87
62
|
* @type boolean
|
88
63
|
*/
|
89
64
|
uki.image.needAlphaFix = /MSIE 6/.test(ua);
|
90
|
-
if(uki.image.needAlphaFix) doc.execCommand("BackgroundImageCache", false, true);
|
65
|
+
if(uki.image.needAlphaFix) try { doc.execCommand("BackgroundImageCache", false, true); } catch(e){}
|
@@ -89,8 +89,13 @@ include('collection.js');
|
|
89
89
|
},
|
90
90
|
|
91
91
|
"~": function(context){
|
92
|
+
return uki.unique( flatten( uki.map(context, nextViews) ) );
|
92
93
|
}
|
93
94
|
};
|
95
|
+
|
96
|
+
function nextViews (view) {
|
97
|
+
return view.parent().childViews().slice((view._viewIndex || 0) + 1);
|
98
|
+
}
|
94
99
|
|
95
100
|
function recChildren (comps) {
|
96
101
|
return flatten(uki.map(comps, function(comp) {
|
@@ -3,43 +3,44 @@ include('uki.js');
|
|
3
3
|
/**
|
4
4
|
* @namespace
|
5
5
|
*/
|
6
|
-
|
6
|
+
(function() {
|
7
|
+
var self = uki.theme = {
|
7
8
|
themes: [],
|
8
|
-
|
9
|
-
register: function(theme) {
|
10
|
-
|
9
|
+
|
10
|
+
register: function(theme, /* internal */ themes) {
|
11
|
+
(themes = self.themes)[ themes.length] = theme;
|
11
12
|
},
|
12
|
-
|
13
|
+
|
13
14
|
background: function(name, params) {
|
14
|
-
return
|
15
|
+
return self._namedResource(name, 'background', params) || new uki.background.Null();
|
15
16
|
},
|
16
|
-
|
17
|
+
|
17
18
|
image: function(name, params) {
|
18
|
-
return
|
19
|
+
return self._namedResource(name, 'image', params) || new Image();
|
19
20
|
},
|
20
|
-
|
21
|
+
|
21
22
|
imageSrc: function(name, params) {
|
22
|
-
return
|
23
|
+
return self._namedResource(name, 'imageSrc', params) || '';
|
23
24
|
},
|
24
|
-
|
25
|
+
|
25
26
|
style: function(name, params) {
|
26
|
-
return
|
27
|
+
return self._namedResource(name, 'style', params) || '';
|
27
28
|
},
|
28
|
-
|
29
|
+
|
29
30
|
dom: function(name, params) {
|
30
|
-
return
|
31
|
+
return self._namedResource(name, 'dom', params) || uki.createElement('div');
|
31
32
|
},
|
32
|
-
|
33
|
+
|
33
34
|
template: function(name, params) {
|
34
|
-
return
|
35
|
+
return self._namedResource(name, 'template', params) || '';
|
35
36
|
},
|
36
|
-
|
37
|
-
_namedResource: function(name, type, params) {
|
38
|
-
for (
|
39
|
-
|
40
|
-
|
37
|
+
|
38
|
+
_namedResource: function(name, type, params, i, result) {
|
39
|
+
for ( i = self.themes.length - 1 ; i >= 0; i--) {
|
40
|
+
if (result = (self.themes[i] [type](name, params)))
|
41
|
+
return result;
|
41
42
|
};
|
42
43
|
return null;
|
43
|
-
|
44
44
|
}
|
45
|
-
};
|
45
|
+
};
|
46
|
+
})();
|
@@ -1,7 +1,7 @@
|
|
1
1
|
include('../theme.js');
|
2
2
|
|
3
3
|
/**
|
4
|
-
* Simple and fast (2x
|
4
|
+
* Simple and fast (2x-15x faster than regexp) html template
|
5
5
|
* @example
|
6
6
|
* var t = new uki.theme.Template('<p class="${className}">${value}</p>')
|
7
7
|
* t.render({className: 'myClass', value: 'some html'})
|
@@ -11,16 +11,19 @@ include('const.js');
|
|
11
11
|
* @return {uki.Collection}
|
12
12
|
*/
|
13
13
|
root.uki = root.uki || function(val, context) {
|
14
|
-
if (typeof val
|
14
|
+
if (typeof val === "string") {
|
15
|
+
|
15
16
|
var m = val.match(/^#((?:[\w\u00c0-\uFFFF_-]|\\.)+)$/),
|
16
17
|
e = m && uki._ids[m[1]];
|
17
18
|
if (m && !context) {
|
18
19
|
return new uki.Collection( e ? [e] : [] );
|
19
20
|
}
|
20
21
|
return uki.find(val, context);
|
22
|
+
|
21
23
|
}
|
22
24
|
if (val.length === undefined) val = [val];
|
23
25
|
if (val.length > 0 && uki.isFunction(val[0].typeName)) return new uki.Collection(val);
|
26
|
+
|
24
27
|
return uki.build(val);
|
25
28
|
};
|
26
29
|
|
@@ -28,7 +31,7 @@ root.uki = root.uki || function(val, context) {
|
|
28
31
|
* @type string
|
29
32
|
* @field
|
30
33
|
*/
|
31
|
-
uki.version = '0.
|
34
|
+
uki.version = '0.3.8';
|
32
35
|
uki.guid = 1;
|
33
36
|
|
34
37
|
/**
|
@@ -39,9 +42,9 @@ uki.F = function() { return false; };
|
|
39
42
|
uki._ids = {};
|
40
43
|
|
41
44
|
uki.registerId = function(comp) {
|
42
|
-
uki._ids[uki.attr(comp, 'id')] = comp;
|
45
|
+
uki._ids[ uki.attr(comp, 'id') ] = comp;
|
43
46
|
};
|
44
47
|
uki.unregisterId = function(comp) {
|
45
|
-
uki._ids[uki.attr(comp, 'id')] = undefined;
|
48
|
+
uki._ids[ uki.attr(comp, 'id') ] = undefined;
|
46
49
|
};
|
47
50
|
|