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,147 @@
1
+ /*
2
+ ---
3
+
4
+ script: Interpolations.js
5
+
6
+ description: Retrieves meta data from widgets and runs expressions with it
7
+
8
+ license: Public domain (http://unlicense.org).
9
+
10
+ authors: Yaroslaff Fedin
11
+
12
+ requires:
13
+ - LSD.Module
14
+ - LSD.Module.Events
15
+ - LSD.Interpolation
16
+
17
+ provides:
18
+ - LSD.Module.Interpolations
19
+
20
+ ...
21
+ */
22
+
23
+ LSD.Module.Interpolations = new Class
24
+
25
+ Object.append(LSD.Module.Interpolations, {
26
+ addInterpolation: function(token, callback) {
27
+ var index = token.indexOf('.');
28
+ if (index > -1) {
29
+ var string = token.substr(0, index), saved;
30
+ var finder = function(value) {
31
+ var key = token.substring(index + 1);
32
+ if (value == null) {
33
+ saved.unwatch(key, callback);
34
+ delete saved;
35
+ } else if (typeof value == 'object' && value.watch) {
36
+ saved = value;
37
+ value.watch(key, callback);
38
+ } else {
39
+ callback(value);
40
+ }
41
+ };
42
+ finder.callback = callback;
43
+ LSD.Module.Interpolations.addInterpolation.call(this, string, finder);
44
+ } else {
45
+ for (var node = this, length, interpolators, interpolations, group; node; node = node.parentNode) {
46
+ if (!(interpolations = node.interpolations)) interpolations = node.interpolations = {};
47
+ if (!(group = node.interpolations[token])) group = node.interpolations[token] = [];
48
+ group.push(callback);
49
+ if ((interpolators = node.interpolators) && (interpolators = interpolators[token])) {
50
+ if (length = interpolators.length) {
51
+ var value = interpolators[length - 1];
52
+ if (value.call) value = value.call(node, token, callback, true);
53
+ if (value != null) callback(value);
54
+ break;
55
+ }
56
+ }
57
+ }
58
+ }
59
+ },
60
+
61
+ removeInterpolation: function(token, callback) {
62
+ var index = token.indexOf('.');
63
+ if (index > -1) {
64
+ var string = index.substr(shift || 0, index);
65
+ LSD.Module.Interpolations.removeInterpolation.call(this, string, callback);
66
+ } else {
67
+ for (var node = this; node; node = node.parentNode) {
68
+ var group = node.interpolations[token];
69
+ var index = group.indexOf(callback);
70
+ if (index > -1) group.splice(index, 1);
71
+ }
72
+ }
73
+ },
74
+
75
+ getInterpolationCallback: function() {
76
+ return (this.interpolationCallback || (this.interpolationCallback = function(name, value, state) {
77
+ this[state ? 'addInterpolator' : 'removeInterpolator'](name, value);
78
+ }.bind(this)));
79
+ },
80
+
81
+ findParentInterpolator: function(name) {
82
+ for (var node = this, group; node = node.parentNode;)
83
+ if ((group = node.interpolators) && (group = group[name]) && group.length)
84
+ return group[group.length - 1];
85
+ },
86
+
87
+ addInterpolator: function(name, value) {
88
+ if (name.toObject) {
89
+ var callback = LSD.Module.Interpolations.getInterpolationCallback.call(this);
90
+ name.addEvent('change', callback).addEvent('beforechange', callback);
91
+ for (var property in name) if (name.has(property))
92
+ LSD.Module.Interpolations.addInterpolator.call(this, property, name[property]);
93
+ } else if (name.call) {
94
+
95
+ } else if (!name.indexOf) {
96
+ for (var property in name)
97
+ LSD.Module.Interpolations.addInterpolator.call(this, property, name[property]);
98
+ } else {
99
+ var interpolators = this.interpolators;
100
+ if (!interpolators) interpolators = this.interpolators = {};
101
+ var group = interpolators[name];
102
+ if (!group) group = interpolators[name] = [];
103
+ group.push(value);
104
+ var interpolations = this.interpolations;
105
+ if (interpolations) {
106
+ var fns = interpolations[name];
107
+ if (fns) for (var i = 0, fn, lazy = true; fn = fns[i++];) {
108
+ if (value.call && lazy && !(lazy = false)) value = value.call(this, name, value);
109
+ fn(value);
110
+ }
111
+ }
112
+ }
113
+ },
114
+
115
+ removeInterpolator: function(name, value) {
116
+ if (name.toObject) {
117
+ var callback = LSD.Module.Interpolations.getInterpolationCallback.call(this);
118
+ name.removeEvent('change', callback).removeEvent('beforechange', callback);
119
+ for (var property in name) if (name.has(property)) this.removeInterpolator(property, name[property])
120
+ } else if (name.call) {
121
+
122
+ } else if (!name.indexOf) {
123
+ for (var property in name)
124
+ LSD.Module.Interpolations.removeInterpolator.call(this, property, name[property]);
125
+ } else {
126
+ var group = this.interpolators[name];
127
+ var index = group.indexOf(value);
128
+ if (index > -1) {
129
+ group.splice(index, 1);
130
+ var length = group.length;
131
+ if (index == length) {
132
+ if (!length) delete this.interpolators[name];
133
+ var interpolations = this.interpolations;
134
+ if (interpolations) {
135
+ var fns = interpolations[name];
136
+ var replacement = length ? group[length - 1] : LSD.Module.Interpolations.findParentInterpolator.call(this, name);
137
+ if (fns) for (var i = 0, fn; fn = fns[i++];) fn(replacement);
138
+ }
139
+ }
140
+ }
141
+ }
142
+ }
143
+ });
144
+
145
+ ['addInterpolator', 'removeInterpolator', 'addInterpolation', 'removeInterpolation'].each(function(method) {
146
+ LSD.Module.Interpolations.implement(method, LSD.Module.Interpolations[method]);
147
+ });
@@ -35,7 +35,7 @@ LSD.Module.Layout = new Class({
35
35
  },
36
36
 
37
37
  setLayout: function(layout) {
38
- if (typeOf(layout) == 'layout') this.layout = this;
38
+ if (typeOf(layout) == 'layout') this.layout = layout;
39
39
  else this.options.layout = layout;
40
40
  },
41
41
 
@@ -44,15 +44,39 @@ LSD.Module.Layout = new Class({
44
44
  else delete this.options.layout;
45
45
  },
46
46
 
47
- getLayout: Macro.getter('layout', function() {
48
- var options = { interpolate: this.options.interpolate, clone: this.options.clone };
49
- if (this.options.context) options.context = this.options.context;
50
- return new LSD.Layout(this, null, options);
51
- }),
47
+ getLayout: function() {
48
+ if (!this.layout) this.layout = new LSD.Layout(this);
49
+ return this.layout;
50
+ },
51
+
52
+ addLayout: function(name, layout, parent, memo) {
53
+ if (!memo) memo = {};
54
+ var old = this.rendered[name];
55
+ if (old) {
56
+ this.layout.add(old, parent, memo)
57
+ } else {
58
+ var first = layout.push && layout.length && layout[0];
59
+ var method = (first && first.nodeType && ((first.nodeType != 1) || (!first.lsd))) ? 'children' : 'render';
60
+ old = this.rendered[name] = this.layout[method](layout, parent, memo);
61
+ }
62
+ if (memo.promised) {
63
+ delete memo.promised;
64
+ this.addEvent('DOMChildNodesRendered:once', function() {
65
+ this.layout.realize(old)
66
+ })
67
+ }
68
+ return this.rendered[name];
69
+ },
52
70
 
53
- buildLayout: function(layout, parent, options) {
71
+ removeLayout: function(name, layout, parent, memo) {
72
+ return this.layout.remove(this.rendered[name] || layout, parent, memo);
73
+ },
74
+
75
+ buildLayout: function(layout, parent, memo) {
76
+ var args = [layout, (!parent && !parent !== false) ? this : parent, memo];
77
+ var instance = this.getLayout();
54
78
  var method = layout.charAt ? 'selector' : 'render';
55
- return this.getLayout()[method](layout, (parent === false || parent) ? parent : this, options);
79
+ return instance[method].apply(instance, args);
56
80
  }
57
81
  });
58
82
 
@@ -62,18 +86,32 @@ LSD.Module.Layout.events = {
62
86
  */
63
87
  build: function() {
64
88
  this.getLayout();
89
+ if (this.options.layout) {
90
+ var memo = {lazy: this.options.lazy || this.layout.origin == this}, parents = [this, this.getWrapper()];
91
+ this.addLayout('options', this.options.layout, parents, memo);
92
+ }
65
93
  if (!this.options.lazy && this.layout.origin == this && this.options.traverse !== false) {
66
- if (this.origin && !this.options.clone) this.element.replaces(this.origin);
67
- var nodes = (this.origin || this.element).childNodes;
68
- this.layout.array(nodes, [this, this.getWrapper()], this.options.clone ? {clone: true} : null);
94
+ if (this.origin && !this.options.clone && this.origin.parentNode) this.element.replaces(this.origin);
95
+ var nodes = LSD.slice((this.origin || this.element).childNodes);
96
+ var opts = {}
97
+ if (this.options.context) opts.context = this.options.context;
98
+ if (this.options.clone) opts.clone = this.options.clone;
99
+ if (nodes.length) this.addLayout('children', nodes, [this, this.getWrapper()], opts);
100
+ this.fireEvent('DOMChildNodesRendered')
69
101
  }
70
- if (this.options.layout) this.buildLayout(this.options.layout);
71
102
  },
103
+ /*
104
+ Destroys the built layout with the widget
105
+ */
106
+ destroy: function() {
107
+ if (this.rendered.children) this.removeLayout('children');
108
+ if (this.rendered.options) this.removeLayout('options');
109
+ },
72
110
  /*
73
111
  Augments all parsed HTML that goes through standart .write() interface
74
112
  */
75
113
  write: function(node) {
76
- this.buildLayout(node, [this, this.getWrapper()]);
114
+ this.addLayout('written', node, [this, this.getWrapper()]);
77
115
  },
78
116
  /*
79
117
  Augments all inserted nodes that come from partial html updates
@@ -81,9 +119,8 @@ LSD.Module.Layout.events = {
81
119
  DOMNodeInserted: function(node) {
82
120
  this.buildLayout(node, [this, this.getWrapper()]);
83
121
  },
84
-
85
122
  DOMNodeInsertedBefore: function(node, target) {
86
- this.buildLayout(node, [this, this.getWrapper()], {before: target});
123
+ this.buildLayout(node, [this, this.getWrapper()], null, {before: target});
87
124
  }
88
125
  };
89
126
 
@@ -32,51 +32,59 @@ LSD.Module.Proxies = new Class({
32
32
 
33
33
  removeProxy: function(name, proxy) {
34
34
  this.proxies.erase(proxy);
35
+ }
36
+ });
37
+
38
+ Object.append(LSD.Module.Proxies, {
39
+ match: function(node, proxy, parent) {
40
+ if (node.lsd) {
41
+ if (!node.element) node.toElement();
42
+ if (proxy.selector) return proxy.selector === true || node.match(proxy.selector);
43
+ } else {
44
+ if (proxy.mutation) return proxy.mutation === true || (node.nodeType == 1 && Slick.matchNode(node, proxy.mutation, parent || proxy.element))
45
+ if (proxy.text) return node.nodeType == 3;
46
+ }
35
47
  },
36
48
 
37
- proxyChild: function(child) {
38
- for (var i = 0, proxy; proxy = this.proxies[i++];) {
39
- if (!proxy.condition.call(this, child)) continue;
40
- var self = this;
41
- var reinject = function(target) {
42
- var where = proxy.where && proxy.where.call ? proxy.where.call(self, child) : proxy.where;
43
- if (proxy.rewrite === false) {
44
- self.appendChild(child, function() {
45
- target.grab(child, where);
46
- }, true);
47
- } else {
48
- child.inject(target, where);
49
+ invoke: function(parent, child, proxy, memo) {
50
+ if (proxy.callback) proxy.callback.call(parent, child, proxy, memo);
51
+ var container = proxy.container && proxy.container.call ? proxy.container.call(parent, child, proxy) : proxy.container;
52
+ if (container === false) {
53
+ if (!proxy.queued) proxy.queued = [];
54
+ proxy.queued.push(child);
55
+ if (child.parentNode) child.parentNode.removeChild(child);
56
+ return false;
57
+ }
58
+ var result = {};
59
+ if (container && container !== true) {
60
+ if (child.lsd) {
61
+ if (container.localName) {
62
+ result.override = function(parent, child) {
63
+ container.appendChild(child);
64
+ }
49
65
  }
50
- };
51
- var container = proxy.container;
52
- if (container.call) {
53
- if ((container = container.call(this, reinject))) reinject(container);
66
+ if (container.lsd) result.parent = container;
67
+ else result.parent = [parent[0] || parent, container];
68
+ if (proxy.rewrite === false) result.parent[0] == parent[0] || parent;
54
69
  } else {
55
- this.use(container, reinject)
70
+ result.parent = container;
56
71
  }
57
- return true;
58
72
  }
59
- },
60
-
61
- appendChild: function(widget, adoption, proxy) {
62
- var element = widget.element || widget;
63
- var parent = element.parentNode;
64
- if (proxy !== true && !this.canAppendChild(widget)) {
65
- if (element == parent) {
66
- if (widget.parentNode) widget.dispose();
67
- else if (widget.element.parentNode) widget.element.dispose();
68
- }
69
- return false;
70
- };
71
- return LSD.Module.DOM.prototype.appendChild.call(this, widget, adoption);
72
- },
73
-
74
- canAppendChild: function(child) {
75
- return !this.proxyChild(child);
73
+ if (proxy.before) result.before = proxy.before.call ? proxy.before.call(parent, child, proxy) : proxy.before;
74
+ else if (proxy.after) {
75
+ var after = (proxy.after.call ? proxy.after.call(parent, child, proxy) : proxy.after);
76
+ if (after) result.before = after.nextSibling;
77
+ }
78
+ return result;
76
79
  }
77
-
78
80
  });
79
81
 
82
+ LSD.Module.Proxies.events = {
83
+ appendChild: function(child) {
84
+
85
+ }
86
+ }
87
+
80
88
  LSD.Options.proxies = {
81
89
  add: 'addProxy',
82
90
  remove: 'removeProxy',
@@ -74,6 +74,9 @@ LSD.Relation.Traits = {
74
74
  }
75
75
  }
76
76
  }
77
+ },
78
+ states: {
79
+ add: Array.object('selected')
77
80
  }
78
81
  },
79
82
 
@@ -87,7 +90,6 @@ LSD.Relation.Traits = {
87
90
  return widget.pseudos.item;
88
91
  },
89
92
  states: {
90
- use: Array.fast('collapsed'),
91
93
  set: {
92
94
  collapsed: 'hidden'
93
95
  },
@@ -81,12 +81,12 @@ var pseudos = {};
81
81
 
82
82
  var Combinators = LSD.Module.Selectors.Combinators = {
83
83
  '$': function(node, tag, id, classes, attributes, pseudos, classList) { //this element
84
- if ((tag == '*') && !id && !classes && !attributes && !pseudos) return this.push(node);
84
+ if ((tag == '*') && !id && !classes && !attributes) return this.push(node, null, null, null, null, pseudos);
85
85
  else return this['combinator: '](node, tag, id, classes, attributes, pseudos, classList)
86
86
  },
87
87
 
88
88
  '$$': function(node, tag, id, classes, attributes, pseudos, classList) { //this element document
89
- if ((tag == '*') && !id && !classes && !attributes && !pseudos) return this.push(this.document.body);
89
+ if ((tag == '*') && !id && !classes && !attributes) return this.push(this.document.body, null, null, null, null, pseudos);
90
90
  else return this['combinator: '](this.document.body, tag, id, classes, attributes, pseudos, classList);
91
91
  },
92
92
 
@@ -105,7 +105,7 @@ Combinators['&&'] = Combinators['$$'];
105
105
  for (var combinator in Combinators)
106
106
  if (combinator != '::') Combinators[combinator + '::'] = Combinators['::'];
107
107
 
108
- for (name in Combinators) Slick.defineCombinator(name, Combinators[name]);
108
+ for (var name in Combinators) Slick.defineCombinator(name, Combinators[name]);
109
109
 
110
110
  LSD.Module.Selectors.Features = {
111
111
  brokenStarGEBTN: false,
@@ -17,7 +17,7 @@ requires:
17
17
  - LSD.Module.Allocations
18
18
  - LSD.Module.Relations
19
19
  - LSD.Module.Proxies
20
- - LSD.Module.Container
20
+ - LSD.Module.Interpolations
21
21
 
22
22
  provides:
23
23
  - LSD.Module.Ambient
@@ -34,6 +34,6 @@ LSD.Module.Ambient = new Class({
34
34
  LSD.Module.Allocations,
35
35
  LSD.Module.Relations,
36
36
  LSD.Module.Proxies,
37
- LSD.Module.Container
37
+ LSD.Module.Interpolations
38
38
  ]
39
39
  });
@@ -59,7 +59,7 @@ LSD.Module.Layers = new Class({
59
59
  },
60
60
 
61
61
  renderLayers: function(dirty) {
62
- var updated = new FastArray, style = this.style, layers = style.layers, offset = this.offset;
62
+ var updated = new Object.Array, style = this.style, layers = style.layers, offset = this.offset;
63
63
  for (var property in dirty) if (layers[property]) updated.push.apply(updated, layers[property]);
64
64
 
65
65
  var result = {};
@@ -52,7 +52,7 @@ LSD.Module.Render = new Class({
52
52
  */
53
53
 
54
54
  update: function(recursive) {
55
- if (recursive) LSD.Module.DOM.walk(this, function(widget) {
55
+ if (recursive) LSD.Module.DOM.each(this, function(widget) {
56
56
  widget.update();
57
57
  });
58
58
  },
@@ -42,8 +42,11 @@ LSD.Relation.prototype = Object.append({
42
42
  var opts = Object.merge.apply(Object, [{}].concat(this.$options));
43
43
  this.lastOptions = this.options;
44
44
  this.options = opts;
45
- if (options.target) this.memo.target = Options.target.call(this, options.target, true);
46
- for (name in options) {
45
+ if (options.target) {
46
+ this.target = null;
47
+ this.memo.target = Options.target.call(this, options.target, true);
48
+ }
49
+ for (var name in options) {
47
50
  var setter = Options[name], value = options[name];
48
51
  if (!setter || !setter.call)
49
52
  for (var i = 0, widget; widget = this.widgets[i++];)
@@ -142,7 +145,7 @@ LSD.Relation.prototype = Object.append({
142
145
  }, Events.prototype);
143
146
 
144
147
  var Options = LSD.Relation.Options = {
145
- selector: function(selector, state, memo) {
148
+ selector: function(selector, state, memo, a) {
146
149
  if (memo) memo[0].unwatch(memo[1], this.onChange);
147
150
  if (state && this.target) {
148
151
  if (selector.call) selector = selector.call(this.origin);
@@ -174,16 +177,14 @@ var Options = LSD.Relation.Options = {
174
177
  if (value) {
175
178
  relation.target = object.nodeType == 9 ? object.body : object;
176
179
  var selector = relation.options.selector, expectation = relation.options.expectation;
177
- if (selector) Options.selector.call(relation, selector, true, relation.memo.selector);
180
+ if (selector) Options.selector.call(relation, selector, true, relation.memo.selector, 1);
178
181
  if (expectation) Options.expectation.call(relation, expectation, true, relation.memo.expectation);
179
182
  }
180
183
  }
181
184
  })
182
185
  this.origin.addEvents(events);
183
- if (setting.getter && !this.target) {
184
- this.target = this.origin[setting.getter];
185
- events[Object.keyOf(setting, true)](this.target)
186
- }
186
+ if (setting.getter && !this.target)
187
+ if ((this.target = this.origin[setting.getter])) events[Object.keyOf(setting, true)](this.target);
187
188
  return events;
188
189
  } else {
189
190
  if (this.origin[target]) this.target = this.origin[target];
@@ -307,20 +308,18 @@ var Options = LSD.Relation.Options = {
307
308
 
308
309
  states: {
309
310
  add: function(widget, states) {
310
- var get = states.get, set = states.set, add = states.add, lnk = states.link, use = states.use;
311
- if (get) for (var from in get) widget.linkState(this.origin, from, (get[from] === true) ? from : get[from]);
312
- if (set) for (var to in set) this.origin.linkState(widget, to, (set[to] === true) ? to : set[to]);
313
- if (use) for (var to in use) this.origin.addState(widget, to, (use[to] === true) ? to : use[to]);
314
- if (add) for (var index in add) widget.addState(index, add[index]);
315
- if (lnk) for (var to in lnk) widget.linkState(widget, to, (lnk[to] === true) ? to : lnk[to]);
311
+ var get = states.get, set = states.set, add = states.add, lnk = states.link;
312
+ if (add) for (var index in add) widget.states.set(index);
313
+ if (get) for (var from in get) widget.states.watch(from, [this.origin.states, get[from]]);
314
+ if (set) for (var to in set) this.origin.states.watch(to, [widget.states, set[to]]);
315
+ if (lnk) for (var to in lnk) widget.states.watch(to, [widget.states, lnk[to]])
316
316
  },
317
317
  remove: function(widget, states) {
318
- var get = states.get, set = states.set, add = states.add, lnk = states.link, use = states.use;
319
- if (get) for (var from in get) widget.unlinkState(this.origin, from, (get[from] === true) ? from : get[from]);
320
- if (set) for (var to in set) this.origin.unlinkState(widget, to, (set[to] === true) ? to : set[to]);
321
- if (use) for (var to in use) this.origin.removeState(widget, to, (use[to] === true) ? to : use[to]);
322
- if (add) for (var index in add) widget.removeState(index, add[index]);
323
- if (lnk) for (var to in lnk) widget.unlinkState(widget, to, (lnk[to] === true) ? to : lnk[to]);
318
+ var get = states.get, set = states.set, add = states.add, lnk = states.link;
319
+ if (add) for (var index in add) widget.states.unset(index)
320
+ if (get) for (var from in get) widget.states.unwatch(from, [this.origin.states, get[from]]);
321
+ if (set) for (var to in set) this.origin.states.unwatch(to, [widget.states, set[to]]);
322
+ if (lnk) for (var to in lnk) widget.states.unwatch(to, [widget.states, lnk[to]])
324
323
  }
325
324
  },
326
325
 
@@ -88,7 +88,7 @@ LSD.Sheet = new Class({
88
88
  var result = definition[value.push ? 'apply' : 'call'](this, value);
89
89
  if (result === false) value = false;
90
90
  else if (result !== true) {
91
- for (prop in result) styles[prop] = Value.compile(result[prop]);
91
+ for (var prop in result) styles[prop] = Value.compile(result[prop]);
92
92
  continue
93
93
  }
94
94
  }
@@ -168,7 +168,7 @@ LSD.Sheet.Rule = function(selector, style) {
168
168
  this.index = LSD.Sheet.Rule.index ++;
169
169
  this.expressions = selector.expressions[0];
170
170
  this.specificity = this.getSpecificity();
171
- for (property in style) {
171
+ for (var property in style) {
172
172
  var cc = property.camelCase();
173
173
  var type = (LSD.Sheet.Rule.separate && LSD.Sheet.isElementStyle(cc)) ? 'implied' : 'style';
174
174
  if (!this[type]) this[type] = {};
@@ -260,13 +260,12 @@ var Value = LSD.Sheet.Value = {
260
260
  calc: function(value) {
261
261
  var bits = value.map(function(bit, i) {
262
262
  if (bit.call) {
263
- return "value[" + i + "].call(this, property)"
263
+ return 'value[' + i + '].call(this, property)'
264
264
  } else {
265
265
  return bit;
266
266
  }
267
267
  })
268
- eval("var compiled = function(property) { return " + bits.join(" ") + "}");
269
- return compiled
268
+ return new Function('property', 'return ' + bits.join(' '));
270
269
  },
271
270
  min: function() {
272
271
  return Math.min.apply(Math, arguments)