lsd_rails 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. data/Packages/Sheet.js/Source/SheetParser.Value.js +1 -1
  2. data/Packages/lsd/Source/Action/Clone.js +2 -12
  3. data/Packages/lsd/Source/Action/Delete.js +1 -7
  4. data/Packages/lsd/Source/Action/Display.js +7 -7
  5. data/Packages/lsd/Source/Action/Edit.js +2 -2
  6. data/Packages/lsd/Source/Action/Invoke.js +2 -2
  7. data/Packages/lsd/Source/Action/Submit.js +2 -0
  8. data/Packages/lsd/Source/Action/Toggle.js +4 -0
  9. data/Packages/lsd/Source/Action/Update.js +2 -1
  10. data/Packages/lsd/Source/Action.js +4 -5
  11. data/Packages/lsd/Source/Document.js +10 -7
  12. data/Packages/lsd/Source/LSD.js +22 -127
  13. data/Packages/lsd/Source/Layer.js +4 -4
  14. data/Packages/lsd/Source/Layout.js +1077 -259
  15. data/Packages/lsd/Source/Mixin/Animation.js +1 -1
  16. data/Packages/lsd/Source/Mixin/Choice.js +2 -2
  17. data/Packages/lsd/Source/Mixin/Command.js +26 -8
  18. data/Packages/lsd/Source/Mixin/ContentEditable.js +2 -1
  19. data/Packages/lsd/Source/{Trait → Mixin}/Date.js +21 -11
  20. data/Packages/lsd/Source/{Trait/Menu.js → Mixin/Details.js} +6 -1
  21. data/Packages/lsd/Source/Mixin/Draggable.js +1 -1
  22. data/Packages/lsd/Source/Mixin/Fieldset.js +51 -49
  23. data/Packages/lsd/Source/Mixin/Focusable.js +38 -39
  24. data/Packages/lsd/Source/Mixin/Invokable.js +13 -14
  25. data/Packages/lsd/Source/Mixin/List.js +9 -17
  26. data/Packages/lsd/Source/Mixin/Placeholder.js +2 -7
  27. data/Packages/lsd/Source/Mixin/Request.js +5 -3
  28. data/Packages/lsd/Source/Mixin/Resizable.js +3 -3
  29. data/Packages/lsd/Source/Mixin/Resource.js +1 -1
  30. data/Packages/lsd/Source/Mixin/Root.js +17 -1
  31. data/Packages/lsd/Source/Mixin/Scrollable.js +1 -1
  32. data/Packages/lsd/Source/{Trait → Mixin}/Slider.js +0 -0
  33. data/Packages/lsd/Source/Mixin/Sortable.js +2 -2
  34. data/Packages/lsd/Source/Mixin/Submittable.js +2 -1
  35. data/Packages/lsd/Source/Mixin/Target.js +11 -6
  36. data/Packages/lsd/Source/Mixin/Touchable.js +2 -2
  37. data/Packages/lsd/Source/Mixin/Unselectable.js +1 -1
  38. data/Packages/lsd/Source/Mixin/Uploader.js +11 -13
  39. data/Packages/lsd/Source/Mixin/Validity.js +35 -9
  40. data/Packages/lsd/Source/Mixin/Value.js +5 -3
  41. data/Packages/lsd/Source/Module/Accessories/Attributes.js +90 -89
  42. data/Packages/lsd/Source/Module/Accessories/Chain.js +40 -25
  43. data/Packages/lsd/Source/Module/Accessories/Element.js +59 -58
  44. data/Packages/lsd/Source/Module/Accessories/Events.js +25 -10
  45. data/Packages/lsd/Source/Module/Accessories/Options.js +11 -13
  46. data/Packages/lsd/Source/Module/Accessories/States.js +42 -5
  47. data/Packages/lsd/Source/Module/Accessories/Styles.js +1 -1
  48. data/Packages/lsd/Source/Module/Accessories/Tag.js +21 -7
  49. data/Packages/lsd/Source/Module/Ambient/Allocations.js +178 -64
  50. data/Packages/lsd/Source/Module/Ambient/DOM.js +98 -55
  51. data/Packages/lsd/Source/Module/Ambient/Expectations.js +57 -8
  52. data/Packages/lsd/Source/Module/Ambient/Interpolations.js +147 -0
  53. data/Packages/lsd/Source/Module/Ambient/Layout.js +52 -15
  54. data/Packages/lsd/Source/Module/Ambient/Proxies.js +44 -36
  55. data/Packages/lsd/Source/Module/Ambient/Relations.js +3 -1
  56. data/Packages/lsd/Source/Module/Ambient/Selectors.js +3 -3
  57. data/Packages/lsd/Source/Module/Ambient.js +2 -2
  58. data/Packages/lsd/Source/Module/Graphics/Layers.js +1 -1
  59. data/Packages/lsd/Source/Module/Graphics/Render.js +1 -1
  60. data/Packages/lsd/Source/Relation.js +19 -20
  61. data/Packages/lsd/Source/Sheet.js +4 -5
  62. data/Packages/lsd/Source/{Behavior.js → Tools/Behavior.js} +0 -0
  63. data/Packages/lsd/Source/Tools/Command.js +190 -0
  64. data/Packages/lsd/Source/Tools/Helpers.js +109 -0
  65. data/Packages/lsd/Source/Tools/Interpolation.js +351 -0
  66. data/Packages/lsd/Source/Tools/Microdata.js +75 -0
  67. data/Packages/lsd/Source/Tools/Object.js +192 -0
  68. data/Packages/lsd/Source/Tools/Position.js +208 -0
  69. data/Packages/lsd/Source/Tools/Require.js +76 -0
  70. data/Packages/lsd/Source/Type.js +2 -2
  71. data/Packages/lsd/package.yml +11 -7
  72. data/Packages/lsd-mobile/Source/Body/Dialog.js +2 -2
  73. data/Packages/lsd-mobile/Source/Input/Date.js +9 -84
  74. data/Packages/lsd-native/Source/Input/Checkbox.js +4 -4
  75. data/Packages/lsd-native/Source/Input/Date.js +46 -6
  76. data/Packages/lsd-native/Source/Input/Radio.js +1 -4
  77. data/Packages/lsd-native/Source/Input.js +5 -6
  78. data/Packages/lsd-widgets/Source/Body/Dialog.js +9 -6
  79. data/Packages/lsd-widgets/Source/Body/Page.js +1 -1
  80. data/Packages/lsd-widgets/Source/Body.js +1 -1
  81. data/Packages/lsd-widgets/Source/Button.js +1 -1
  82. data/Packages/lsd-widgets/Source/Form.js +1 -1
  83. data/Packages/lsd-widgets/Source/Input/Checkbox.js +2 -2
  84. data/Packages/lsd-widgets/Source/Input/Date.js +45 -16
  85. data/Packages/lsd-widgets/Source/Input/File.js +2 -2
  86. data/Packages/lsd-widgets/Source/Input/HTML.js +2 -2
  87. data/Packages/lsd-widgets/Source/Input/Radio.js +1 -1
  88. data/Packages/lsd-widgets/Source/Input/Range.js +2 -2
  89. data/Packages/lsd-widgets/Source/Input/Submit.js +1 -1
  90. data/Packages/lsd-widgets/Source/Input.js +2 -11
  91. data/Packages/lsd-widgets/Source/Label.js +4 -8
  92. data/Packages/lsd-widgets/Source/Menu/List.js +3 -3
  93. data/Packages/lsd-widgets/Source/Menu.js +2 -2
  94. data/Packages/lsd-widgets/Source/Progress.js +1 -1
  95. data/Packages/lsd-widgets/Source/Select.js +7 -6
  96. data/Packages/lsd-widgets/Source/Table/Calendar.js +41 -15
  97. data/Packages/lsd-widgets/Source/Table.js +7 -2
  98. data/Packages/mootools-ext/Source/Core/Class.Mixin.js +43 -38
  99. data/Packages/mootools-ext/Source/Core/Class.States.js +26 -22
  100. data/Packages/mootools-ext/Source/Element/Element.from.js +1 -1
  101. data/Packages/mootools-ext/Source/Element/Properties/Item.js +1 -2
  102. data/Packages/mootools-ext/Source/Request/Request.Statuses.js +9 -7
  103. data/Packages/mootools-ext/Source/Types/{FastArray.js → Object.Array.js} +8 -14
  104. data/Packages/mootools-ext/package.yml +1 -2
  105. data/lib/lsd.rake +28 -0
  106. metadata +15 -11
  107. data/Packages/lsd/Source/Command.js +0 -135
  108. data/Packages/lsd/Source/Interpolation.js +0 -103
  109. data/Packages/lsd/Source/Module/Ambient/Container.js +0 -56
  110. data/Packages/mootools-ext/Source/Element/Element.onDispose.js +0 -36
@@ -0,0 +1,75 @@
1
+ /*
2
+ ---
3
+
4
+ script: Microdata.js
5
+
6
+ description: Data that comes from specially html5 formatted elements
7
+
8
+ license: Public domain (http://unlicense.org).
9
+
10
+ authors: Yaroslaff Fedin
11
+
12
+ requires:
13
+ - LSD
14
+ - LSD.Object
15
+ - Ext/Element.Item
16
+
17
+ provides:
18
+ - LSD.Microdata
19
+
20
+ ...
21
+ */
22
+
23
+ LSD.Microdata = function(element, name) {
24
+ this._element = element;
25
+ this._name = name;
26
+ };
27
+
28
+ LSD.Microdata.prototype = Object.append(new LSD.Object, {
29
+ add: function(element, property, value) {
30
+ var group = (this._elements || (this._elements = {}))[property];
31
+ if (!group) group = element
32
+ else if (!group.push) group = [group]
33
+ else if (group.push) group.push(name);
34
+ if (value == null) value = Element.get(element, 'itemvalue');
35
+ this.set(property, value);
36
+ var callback = Element.retrieve(element, 'microdata:setter');
37
+ if (!callback) Element.store(element, 'microdata:setter', (callback = function(value) {
38
+ Element.set(element, 'itemvalue', value);
39
+ }))
40
+ this.watch(property, callback, true)
41
+ },
42
+ remove: function(element, property, value) {
43
+ var group = (this._elements || (this._elements = {}))[property];
44
+ if (group.push) group.erase(element)
45
+ else delete this._elements[property];
46
+ if (value == null) value = Element.get(element, 'itemvalue');
47
+ if (this.property && this.property == value) this.unset(property);
48
+ this.unwatch(property, Element.retrieve(element, 'microdata:setter'));
49
+ }
50
+ });
51
+
52
+ LSD.Microdata.element = function(element, widget, parent) {
53
+ var itemprop = element.getAttribute('itemprop');
54
+ if (itemprop) {
55
+ var itemscope = element.getAttribute('itemscope');
56
+ if (itemscope) {
57
+ var scope = Element.retrieve(element, 'microdata:scope');
58
+ if (!scope)
59
+ Element.store(element, 'microdata:scope', (scope = new LSD.Microdata(element, itemprop)));
60
+ if (widget) {
61
+ if (widget.element == element) widget.itemscope = scope;
62
+ for (var node = widget; node; node = (!parent && node.parentNode)) {
63
+ LSD.Module.Interpolations.addInterpolator.call(node, itemprop, scope);
64
+ if (!widget.itemPropertyExportCallback) widget.itemPropertyExportCallback = function(name, value, state) {
65
+ if (!value.watch || !value.set) widget[state ? 'addInterpolator' : 'removeInterpolator'](name, value);
66
+ }
67
+ if (scope && widget.itemscope && widget.itemscope == scope)
68
+ scope.addEvent('change', widget.itemPropertyExportCallback).addEvent('beforechange', widget.itemPropertyExportCallback);
69
+ }
70
+ }
71
+ }
72
+ if (parent) parent.add(element, itemprop, scope);
73
+ }
74
+ return scope;
75
+ };
@@ -0,0 +1,192 @@
1
+ /*
2
+ ---
3
+
4
+ script: Object.js
5
+
6
+ description: An observable object
7
+
8
+ license: Public domain (http://unlicense.org).
9
+
10
+ authors: Yaroslaff Fedin
11
+
12
+ requires:
13
+ - LSD
14
+
15
+ provides:
16
+ - LSD.Object
17
+
18
+ ...
19
+ */
20
+
21
+ LSD.Object = function(object) {
22
+ if (object) for (var key in object) this.set(key, object[key]);
23
+ }
24
+ LSD.Object.prototype = {
25
+ set: function(key, value, memo) {
26
+ var old = this[key];
27
+ if (old === value && typeof old != 'undefined') return false;
28
+ if (old) this.fireEvent('beforechange', key, old, false);
29
+ this[key] = value;
30
+ this[key] = value = this.fireEvent('change', key, value, true, old, memo);
31
+ var watched = this._watched;
32
+ if (watched && (watched = watched[key]))
33
+ for (var i = 0, fn; fn = watched[i++];)
34
+ if (fn.call) fn(value, old);
35
+ else LSD.Object.callback(this, fn, key, value, old, memo);
36
+ return true;
37
+ },
38
+ unset: function(key, value, memo) {
39
+ var old = this[key];
40
+ if (old == null && value != null) return false;
41
+ this.fireEvent('change', key, old, false, null, memo);
42
+ var watched = this._watched;
43
+ if (watched && (watched = watched[key]))
44
+ for (var i = 0, fn; fn = watched[i++];)
45
+ if (fn.call) fn(null, old);
46
+ else LSD.Object.callback(this, fn, key, null, old, memo);
47
+ delete this[key];
48
+ return true;
49
+ },
50
+ add: function(key, memo) {
51
+ return this.set(key, true, memo)
52
+ },
53
+ remove: function(key, memo) {
54
+ return this.unset(key, true, memo)
55
+ },
56
+ fireEvent: function(key, a, b, c, d, e) {
57
+ var storage = this._events;
58
+ if (storage) {
59
+ var collection = storage[key];
60
+ if (collection) for (var i = 0, fn; fn = collection[i++];) {
61
+ var result = fn(a, b, c, d, e);
62
+ if (result != null) b = result;
63
+ }
64
+ }
65
+ return b;
66
+ },
67
+ addEvent: function(key, callback) {
68
+ var storage = this._events;
69
+ if (!storage) storage = this._events = {};
70
+ (storage[key] || (storage[key] = [])).push(callback);
71
+ return this;
72
+ },
73
+ removeEvent: function(key, callback) {
74
+ var storage = this._events;
75
+ var key = key;
76
+ var index = storage[key].indexOf(callback);
77
+ if (index > -1) storage[key].splice(0, 1);
78
+ return this;
79
+ },
80
+ watch: function(key, callback, lazy) {
81
+ var index = key.indexOf('.');
82
+ if (index > -1) {
83
+ var finder = function(value, old) {
84
+ (value || old)[value ? 'watch' : 'unwatch'](key.substring(index + 1), callback);
85
+ };
86
+ finder.callback = callback;
87
+ this.watch(key.substr(0, index), finder)
88
+ } else {
89
+ var watched = (this._watched || (this._watched = {}));
90
+ (watched[key] || (watched[key] = [])).push(callback);
91
+ var value = this[key];
92
+ if (!lazy && value != null) {
93
+ if (callback.call) callback(value);
94
+ else LSD.Object.callback(this, callback, key, value);
95
+ }
96
+ }
97
+ },
98
+ unwatch: function(key, callback) {
99
+ var index = key.indexOf('.');
100
+ if (index > -1) {
101
+ this.unwatch(key.substr(0, index), callback)
102
+ } else if (this._watched) {
103
+ var watched = this._watched[key];
104
+ var value = this[key];
105
+ for (var i = 0, fn; fn = watched[i]; i++) {
106
+ var match = fn.callback || fn;
107
+ if (match.push) {
108
+ if (!callback.push || callback[0] != match[0] || callback[1] != match[1]) continue;
109
+ } else if (match != callback && fn != callback) continue;
110
+ watched.splice(i, 1);
111
+ if (value != null) {
112
+ if (callback.call) fn(null, value);
113
+ else LSD.Object.callback(this, fn, key, null, value);
114
+ }
115
+ break;
116
+ }
117
+ }
118
+ },
119
+ toObject: function() {
120
+ var object = {};
121
+ for (var key in this) if (this.has(key)) object[key] = this[key];
122
+ return object;
123
+ },
124
+ has: function(key) {
125
+ return this.hasOwnProperty(key) && (key.charAt(0) != '_')
126
+ },
127
+ join: function(separator) {
128
+ var ary = [];
129
+ for (var key in this)
130
+ if (this.has ? this.has(key) : this.hasOwnProperty(key))
131
+ ary.push(key);
132
+ return ary.join(separator)
133
+ }
134
+ };
135
+
136
+ /*
137
+ Stack object is an object that may have its values set from multiple sources.
138
+ All of `set` and `unset` calls are logged, so when the value gets unset,
139
+ it returns to previous value (that was set before by a different external object).
140
+
141
+ It was designed to be symetric, so every .set is paired with .unset. Originally,
142
+ unset raised exception when it could not find its value set before.
143
+
144
+ That perhaps is too idealistic and doenst work in real world, so you can
145
+ value that was set before by some `set`/`unset` pair can be unset by an outside
146
+ `unset` call. Then a paired `unset` just will silently do nothing.
147
+ */
148
+
149
+ LSD.Object.Stack = function(object) {
150
+ if (object) for (var key in object) this.set(key, object[key]);
151
+ };
152
+
153
+ LSD.Object.Stack.prototype = Object.append(new LSD.Object, {
154
+ set: function(key, value, memo) {
155
+ var stack = this._stack;
156
+ if (!stack) stack = this._stack = {};
157
+ var group = stack[key];
158
+ if (!group) group = stack[key] = []
159
+ var length = (value == null) ? group.unshift(value) : group.push(value);
160
+ return LSD.Object.prototype.set.call(this, key, group[length - 1], memo);
161
+ },
162
+ unset: function(key, value, memo) {
163
+ var group = this._stack[key], length = group.length;
164
+ for (var j = length; --j > -1; ) {
165
+ if (group[j] === value) {
166
+ group.splice(j, 1);
167
+ break;
168
+ }
169
+ }
170
+ value = group[length - 2];
171
+ var method = length == 1 ? 'unset' : 'set';
172
+ if (j == -1) return //throw "The value can not be unset, because it was not set before"
173
+ return LSD.Object.prototype[method].call(this, key, value, memo);
174
+ }
175
+ })
176
+
177
+ LSD.Object.callback = function(object, callback, key, value, old, memo) {
178
+ if (callback.substr) var subject = object, property = callback;
179
+ else if (callback.watch && callback.set) var subject = callback, property = key;
180
+ else if (callback.push) var subject = callback[0], property = callback[1];
181
+ else throw "Callbacks should be either functions, strings, objects, or [object, string] arrays"
182
+ if (property === true || property == false) property = key;
183
+ // check for circular calls
184
+ if (memo != null && memo.push) {
185
+ for (var i = 0, a; a = memo[i++];)
186
+ if (a[0] == object && a[1] == property) return;
187
+ } else memo = [];
188
+ memo.push([object, key]);
189
+ if (value != null || typeof old == 'undefined') subject.set(property, value, memo);
190
+ if (value == null || typeof old != 'undefined') subject.unset(property, old, memo);
191
+ };
192
+
@@ -0,0 +1,208 @@
1
+ /*
2
+ ---
3
+
4
+ script: Position.js
5
+
6
+ description: An observable object
7
+
8
+ license: Public domain (http://unlicense.org).
9
+
10
+ authors: Yaroslaff Fedin
11
+
12
+ requires:
13
+ - LSD
14
+
15
+ provides:
16
+ - LSD.Position
17
+
18
+ ...
19
+ */
20
+
21
+ LSD.Position = function(object, options) {
22
+ this.object = object;
23
+ this.setOptions(options);
24
+ };
25
+
26
+ LSD.Position.fallback = ['flip', 'hug', 'invert'];
27
+
28
+ (function() {
29
+ var expanded = {};
30
+ var vertical = {top: true, bottom: true, left: false, right: false};
31
+ var props = ['left', 'top'], dimensions = ['x', 'y']
32
+ var oprops = {left: true, top: true};
33
+ var flip = {left: 'right', right: 'left', bottom: 'top', top: 'bottom'};
34
+ LSD.Position.calculate = function(object, boundaries, position, anchor, fallback) {
35
+ if (!position) position = ['center', 'center']
36
+ else if (position.split) {
37
+ // expand position (left -> [left, center])
38
+ var pos = expanded[position];
39
+ if (!pos) expanded[position] = pos = position.split('-');
40
+ position = pos;
41
+ }
42
+ if (!position[1] || vertical[position[0]] == vertical[position[1]]) position[1] = 'center';
43
+ if (!anchor) {
44
+ // no anchor given, object either fits into boundaries or not
45
+ if (object.x > boundaries.x || object.y > boundaries.y) return false;
46
+ var result = {};
47
+ for (var i = 0, pos; pos = position[i]; i++)
48
+ if (pos == 'center') {
49
+ var index = vertical[position[+!i]];
50
+ index = (index == null) ? i : +!index;
51
+ result[index ? 'y' : 'x'] = ((boundaries[dimensions[index]] || 0) - object[dimensions[index]]) / 2;
52
+ } else {
53
+ var index = +vertical[pos];
54
+ result[index ? 'y' : 'x'] = (oprops[pos] ? 0 : ((boundaries[dimensions[index]] || 0) - object[dimensions[index]]))
55
+ }
56
+ console.log(position, boundaries, [result.x, result.y])
57
+ if (boundaries.left) result.x += boundaries.left;
58
+ if (boundaries.top) result.y += boundaries.top;
59
+ } else {
60
+ // positioning against anchor means different boundaries and another position
61
+ var pos = position[0], otherpos = position[1];
62
+ var index = +!!vertical[position[0]];
63
+ var query = {};
64
+ switch (position[0]) {
65
+ case "center":
66
+
67
+ break;
68
+ case props[index]:
69
+ query[props[index]] = 0;
70
+ query[dimensions[index]] = anchor[props[index]];
71
+ break;
72
+ default:
73
+ query[props[index]] = anchor[props[index]] + anchor[dimensions[index]];
74
+ query[dimensions[index]] = (boundaries[props[index]] || 0) + boundaries[dimensions[index]] - anchor[dimensions[index]] - anchor[props[index]];
75
+ };
76
+ switch (position[1]) {
77
+ case "center":
78
+ query[props[+!index]] = anchor[props[+!index]] + anchor[dimensions[+!index]] / 2
79
+ break;
80
+ case props[+!index]:
81
+ query[props[+!index]] = anchor[props[+!index]];
82
+ break;
83
+ default:
84
+ query[dimensions[+!index]] = anchor[props[+!index]] + anchor[dimensions[+!index]];
85
+ }
86
+ console.log(333, query, object, position, [index], +!index, props[+!index], anchor, boundaries)
87
+ // positioning an object at top right relative to anchor,
88
+ // means positioning at bottom right of rectangle space above the anchor.
89
+ var result = LSD.Position.calculate(object, query, [flip[position[0]], position[1]]);
90
+ console.log(result)
91
+ if (result) {
92
+ //result[dimensions[+!index]] -= anchor[props[+!index]];
93
+ } else if (fallback) {
94
+ // if the object does not fit there, fallback method may be used
95
+ if (fallback === true) fallback = LSD.Position.fallback;
96
+ else if (fallback.match) fallback = [fallback];
97
+ for (var i = 0, method, attempt; method = fallback[i++];) {
98
+ switch (method) {
99
+ case "flip":
100
+ // tries "right top", closest corner on the same side
101
+ attempt = [position[1], position[0]];
102
+ break;
103
+ case "hug":
104
+ // tries "left top", distant corner on the same side
105
+ attempt = [flip[position[1]], position[0]];
106
+ break;
107
+ case "invert":
108
+ // tries "bottom right", same corner on the other side
109
+ attempt = [flip[position[0]], position[1]];
110
+ }
111
+ var result = LSD.Position.calculate(object, boundaries, attempt, anchor);
112
+ if (result) break;
113
+ }
114
+ }
115
+ }
116
+ return result;
117
+ };
118
+ })();
119
+
120
+ LSD.Position.getDefaultBoundaries = function() {
121
+ return this.object.ownerDocument.body;
122
+ };
123
+
124
+ LSD.Position.prototype = {
125
+ setOptions: function(options) {
126
+ if (!options.match && !options.push) {
127
+ for (var name in options) {
128
+ var value = options[name];
129
+ switch (name) {
130
+ case "boundaries":
131
+ if (value === true) value = LSD.Position.getDefaultBoundaries;
132
+ break;
133
+ }
134
+ this[name] = value;
135
+ }
136
+ } else this.attachment = options;
137
+ this.attach(this.attachment)
138
+ },
139
+ attach: function(attachment) {
140
+ this.update(attachment)
141
+ },
142
+
143
+ detach: function() {
144
+
145
+ },
146
+
147
+ resolve: function(object, position) {
148
+ if (object.call) object = object.call(this);
149
+ if (object.lsd) {
150
+ if (object.size.width) {
151
+ var result = {};
152
+ result.x = object.size.width;
153
+ result.y = object.size.height;
154
+ if (position) {
155
+ result.left = object.style.left || 0;
156
+ result.top = object.style.top || 0
157
+ }
158
+ } else object = object.toElement();
159
+ }
160
+ if (object.localName) {
161
+ var result = Element.getSize(object);
162
+ if (position) {
163
+ position = Element.getPosition(object);
164
+ result.left = position.x;
165
+ result.top = position.y;
166
+ }
167
+ }
168
+ return result || object;
169
+ },
170
+
171
+ update: function(attachment) {
172
+ var coordinates = this.coordinates;
173
+ var object, boundaries, anchor, fallback;
174
+ var object = this.resolve(this.object);
175
+ if ((boundaries = this.boundaries)) boundaries = this.resolve(boundaries);
176
+ if ((anchor = this.anchor)) anchor = this.resolve(anchor, true);
177
+ if ((fallback = this.fallback) && fallback.call) fallback = fallback.call(this);
178
+ this.coordinates = LSD.Position.calculate(object, boundaries, attachment, anchor, fallback);
179
+ if (!this.coordinates) {
180
+ this.unset(coordinates);
181
+ delete this.coordinates;
182
+ } else this.set(this.coordinates);
183
+ },
184
+
185
+ set: function(styles) {
186
+ for (var name in styles) {
187
+ var prop = name == 'x' ? 'left' : 'top';
188
+ if (this.object.lsd)
189
+ this.object.setStyle(name, styles[name]);
190
+ else
191
+ this.object.style[prop] = styles[name] + 'px';
192
+ }
193
+ },
194
+
195
+ unset: function(styles) {
196
+ for (var name in styles){
197
+ var prop = name == 'x' ? 'left' : 'top';
198
+ if (this.object.lsd)
199
+ this.object.setStyle(name, 0);
200
+ else
201
+ delete this.object.style[prop];
202
+ }
203
+ },
204
+
205
+ unsetStyle: function() {
206
+
207
+ }
208
+ };
@@ -0,0 +1,76 @@
1
+ /*
2
+ ---
3
+
4
+ script: Require.js
5
+
6
+ description: A require implementation that uses jsus-raptor middleware
7
+
8
+ license: Public domain (http://unlicense.org).
9
+
10
+ authors: Yaroslaff Fedin
11
+
12
+ provides:
13
+ - require
14
+
15
+ ...
16
+ */
17
+
18
+ !function(document) {
19
+ if (!this.requireURL) this.requireURL = '/javascripts/require/'
20
+
21
+ var head = document.getElementsByTagName('head')[0];
22
+
23
+ var retrieve = function(expression, hard) {
24
+ // remove package name
25
+ var bits = expression.split(':');
26
+ bits = bits[bits.length - 1];
27
+ // split by parts
28
+ bits = bits.split('.');
29
+ for (var i = 0, bit, obj = window; obj && (bit = bits[i++]);)
30
+ if ((obj = obj[bit]) == null)
31
+ if (hard) throw "Can't find " + expression + ". Stopped at " + bit + ".";
32
+ return obj;
33
+ };
34
+
35
+ var start = function(queue, callback) {
36
+ var queued = {}, source;
37
+ for (var i = 0, item; item = queue[i]; i++) {
38
+ var object = retrieve(item);
39
+ if (object) queue[i] = object;
40
+ else queued[i] = item;
41
+ }
42
+ for (var index in queued) {
43
+ var expression = queued[index];
44
+ if (!source) source = expression;
45
+ else source += '+' + expression;
46
+ }
47
+ if (!source) callback.apply(this, queue);
48
+ else load(this.requireURL + source + ".js", function() {
49
+ for (var index in queued) queue[index] = retrieve(queued[index]/*, true*/);
50
+ callback.apply(window, queue)
51
+ });
52
+ }
53
+
54
+ var load = function(source, callback) {
55
+ var script = document.createElement('script');
56
+ script.onload = callback,
57
+ script.onreadystatechange = function () {
58
+ var state = this.readyState;
59
+ if ("loaded" === state || "complete" === state) {
60
+ script.onreadystatechange = null;
61
+ callback();
62
+ head.removeChild(script);
63
+ }
64
+ };
65
+ script.src = source;
66
+ script.type = 'text/javascript';
67
+ head.appendChild(script);
68
+ return script;
69
+ }
70
+
71
+ this.use = function() {
72
+ var args = Array.prototype.slice.call(arguments, 0);
73
+ if (args[args.length - 1].call) var callback = args.pop();
74
+ return start(args, callback);
75
+ }
76
+ }.call(window, document);
@@ -11,6 +11,7 @@ authors: Yaroslaff Fedin
11
11
 
12
12
  requires:
13
13
  - LSD.Behavior
14
+ - LSD.Helpers
14
15
  - More/Object.Extras
15
16
 
16
17
  provides:
@@ -71,8 +72,7 @@ LSD.Type.prototype = {
71
72
  },
72
73
 
73
74
  convert: function(element, options) {
74
- var source = options.source || (options.tag && LSD.Layout.getSource(options.attributes, options.tag)) || LSD.Layout.getSource(element);
75
- if (!this.find(source)) return;
75
+ if (!this.find(LSD.Layout.getSource(element))) return;
76
76
  var klass = this.klass || LSD.Widget;
77
77
  return new LSD.Widget(element, options);
78
78
  }
@@ -19,12 +19,17 @@ sources:
19
19
  - Source/ART/ART.Shape.Flower.js
20
20
  - Source/ART/ART.Shape.Rectangle.js
21
21
  - Source/ART/ART.Shape.Star.js
22
- - Source/Behavior.js
23
- - Source/Command.js
22
+ - Source/Tools/Behavior.js
23
+ - Source/Tools/Interpolation.js
24
+ - Source/Tools/Microdata.js
25
+ - Source/Tools/Object.js
26
+ - Source/Tools/Helpers.js
27
+ - Source/Tools/Command.js
28
+ - Source/Tools/Require.js
29
+ - Source/Tools/Position.js
24
30
  - Source/Document.js
25
31
  - Source/LSD.js
26
32
  - Source/Type.js
27
- - Source/Interpolation.js
28
33
  - Source/Relation.js
29
34
  - Source/Layer.js
30
35
  - Source/Layer/Color.js
@@ -63,8 +68,9 @@ sources:
63
68
  - Source/Mixin/Root.js
64
69
  - Source/Mixin/Sortable.js
65
70
  - Source/Mixin/Invokable.js
71
+ - Source/Mixin/Slider.js
72
+ - Source/Mixin/Date.js
66
73
  - Source/Module/Ambient/Allocations.js
67
- - Source/Module/Ambient/Container.js
68
74
  - Source/Module/Ambient/DOM.js
69
75
  - Source/Module/Ambient/Selectors.js
70
76
  - Source/Module/Ambient/Expectations.js
@@ -72,6 +78,7 @@ sources:
72
78
  - Source/Module/Ambient/Layout.js
73
79
  - Source/Module/Ambient/Relations.js
74
80
  - Source/Module/Ambient/Proxies.js
81
+ - Source/Module/Ambient/Interpolations.js
75
82
  - Source/Module/Ambient.js
76
83
  - Source/Module/Accessories/Chain.js
77
84
  - Source/Module/Accessories/Actions.js
@@ -89,10 +96,7 @@ sources:
89
96
  - Source/Module/Graphics/Layers.js
90
97
  - Source/Module/Graphics/Shape.js
91
98
  - Source/Module/Graphics.js
92
- - Source/Trait/Menu.js
93
99
  - Source/Trait/Input.js
94
- - Source/Trait/Slider.js
95
- - Source/Trait/Date.js
96
100
  - Source/Action/Create.js
97
101
  - Source/Action/Update.js
98
102
  - Source/Action/Delete.js
@@ -25,8 +25,8 @@ LSD.Mobile.Body.Dialog = new Class({
25
25
  transformation: {
26
26
  name: 'slideup'
27
27
  },
28
- pseudos: Array.fast('fieldset'),
29
- classes: Array.fast('dialog'),
28
+ pseudos: Array.object('fieldset'),
29
+ classes: Array.object('dialog'),
30
30
  events: {
31
31
  _dialog: {
32
32
  element: {