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
@@ -1,135 +0,0 @@
1
- /*
2
- ---
3
-
4
- script: Checkbox.js
5
-
6
- description: Abstract command
7
-
8
- license: Public domain (http://unlicense.org).
9
-
10
- authors: Yaroslaff Fedin
11
-
12
- requires:
13
- - LSD
14
-
15
- provides:
16
- - LSD.Command
17
-
18
- ...
19
- */
20
-
21
- LSD.Command = function(document, options) {
22
- this.setOptions(options);
23
- this.widgets = [];
24
- this.$events = Object.clone(this.$events);
25
- if (document) {
26
- this.document = document;
27
- if (!this.document.commands) this.document.commands = {};
28
- this.document.commands[this.options.id] = this;
29
- }
30
- if (this.options.type) this.setType(this.options.type);
31
- };
32
-
33
- LSD.Command.prototype = Object.append(new Options, new Events, new States, {
34
- options: {
35
- id: null,
36
- action: null
37
- },
38
-
39
- click: function() {
40
- this.fireEvent('click', arguments);
41
- },
42
-
43
- attach: function(widget) {
44
- for (var name in this.$states) {
45
- if (!widget.$states[name]) {
46
- widget.addState(name);
47
- widget.$states[name].origin = this;
48
- }
49
- this.linkState(widget, name, name, true);
50
- widget.linkState(this, name, name, true);
51
- }
52
- widget.fireEvent('register', ['command', this]);
53
- this.widgets.push(widget);
54
- return this;
55
- },
56
-
57
- detach: function(widget) {
58
- widget.fireEvent('unregister', ['command', this]);
59
- for (var name in this.$states) {
60
- this.linkState(widget, name, name, false);
61
- if (widget.$states[name].origin == this); widget.removeState(name);
62
- }
63
- this.widgets.erase(widget);
64
- return this;
65
- },
66
-
67
- setType: function(type, unset) {
68
- if (this.type == type) return;
69
- if (this.type) this.unsetType(type);
70
- switch (type) {
71
- case "checkbox":
72
- /*
73
- Checkbox commands are useful when you need to track and toggle
74
- state of some linked object.
75
-
76
- Provide your custom logic hooking on *check* and *uncheck*
77
- state transitions. Use *checked* property to get the current state.
78
-
79
- Examples:
80
- - Button that toggles visibility of a sidebar
81
- - Context menu item that shows or hides line numbers in editor
82
- */
83
- this.events = {
84
- click: function() {
85
- this.toggle();
86
- }
87
- }
88
- break;
89
-
90
-
91
- /*
92
- Radio groupping is a way to links commands together to allow
93
- only one in the group be active at the moment of time.
94
-
95
- Activation (*check*ing) of the commands deactivates all
96
- other commands in a radiogroup.
97
-
98
- Examples:
99
- - Tabs on top of a content window
100
- - Select box with a dropdown menu
101
- */
102
- case "radio":
103
- var name = this.options.radiogroup;
104
- if (name) {
105
- var groups = this.document.radiogroups;
106
- if (!groups) groups = this.document.radiogroups = {};
107
- var group = groups[name];
108
- if (!group) group = groups[name] = [];
109
- group.push(this);
110
- this.group = group;
111
- this.events = {
112
- click: function() {
113
- this.check.apply(this, arguments);
114
- },
115
- check: function() {
116
- group.each(function(sibling) {
117
- if (sibling != this) sibling.uncheck();
118
- }, this);
119
- }
120
- };
121
- }
122
- }
123
- if (this.events) this.addEvents(this.events);
124
- },
125
-
126
- unsetType: function() {
127
- if (this.events) {
128
- this.removeEvents(this.events);
129
- delete this.events;
130
- }
131
- delete this.type;
132
- }
133
- });
134
-
135
- LSD.Command.prototype.addStates('disabled', 'checked');
@@ -1,103 +0,0 @@
1
- /*
2
- ---
3
-
4
- script: Interpolation.js
5
-
6
- description: A logic to render (and nest) widgets out of the key-value hash or dom tree
7
-
8
- license: Public domain (http://unlicense.org).
9
-
10
- authors: Yaroslaff Fedin
11
-
12
- requires:
13
- - LSD
14
- - Sheet/SheetParser.Value
15
- - String.Inflections/String.pluralize
16
-
17
- provides:
18
- - LSD.Interpolation
19
-
20
- ...
21
- */
22
-
23
-
24
- !function() {
25
- LSD.Interpolation = {}
26
- var helpers = LSD.Interpolation.helpers = {
27
- pluralize: function(count, singular, plural) {
28
- var value = (count == 1) ? singular : (plural || (singular.pluralize()));
29
- return value.replace("%", count);
30
- },
31
- auto_pluralize: function(count, singular, plural) {
32
- return count + " " + helpers.pluralize(count, singular, plural);
33
- }
34
- }
35
-
36
- var regex = SheetParser.Value.tokenize;
37
- var parsed = {};
38
-
39
- var interpolate = LSD.Interpolation.execute = function(name, callback, simple) {
40
- if (!simple || (name.indexOf('(') > -1)) return run(translate(name), callback);
41
- return callback(name);
42
- }
43
-
44
- var translate = LSD.Interpolation.translate = function(value) {
45
- var cached = parsed[name];
46
- if (cached) return cached;
47
- var found, result = [], matched = [], scope = result, func, text;
48
- var names = regex.names;
49
- while (found = regex.exec(value)) matched.push(found);
50
- for (var i = 0; found = matched[i++];) {
51
- if (func = found[names['function']]) {
52
- var translated = translate(found[names._arguments]);
53
- for (var j = 0, bit; bit = translated[j]; j++) if (bit && bit.length == 1) translated[j] = bit[0];
54
- scope.push({fn: func, arguments: translated});
55
- } else if (text = (found[names.dstring] || found[names.sstring])) {
56
- scope.push(text)
57
- } else if (text = found[names.token]) {
58
- scope.push({fn: interpolate, arguments: [text, true], callback: true})
59
- }
60
- }
61
- return (parsed[value] = (result.length == 1 ? result[0] : result));
62
- };
63
-
64
- var run = LSD.Interpolation.run = function(command, callback) {
65
- var fn = command.fn;
66
- if (fn) {
67
- var func = fn.indexOf ? (helpers[fn] || (callback(fn))) : fn;
68
- if (!func) {
69
- console.error(fn, ' interpoaltion function is not found');
70
- return "";
71
- }
72
- var args = Array.prototype.slice.call(command.arguments, 0);
73
- for (var i = 0, j = args.length; i < j; i++) args[i] = run(args[i], callback);
74
- if (command.callback) args.splice(1, 0, callback);
75
- return func.apply(this, args);
76
- }
77
- return command;
78
- };
79
-
80
- var attempt = LSD.Interpolation.attempt = function(string) {
81
- var count = 0, args = arguments;
82
- string = string.replace(/\\?\{([^{}]+)\}/g, function(match, name){
83
- count++;
84
- if (match.charAt(0) == '\\') return match.slice(1);
85
- for (var arg, value, callback, element, i = 1, j = args.length; i < j; i++) {
86
- if (!(arg = args[i])) continue;
87
- if (arg.call) callback = call;
88
- else if (arg.localName) element = arg;
89
- else if (arg[match]) return arg[match];
90
- }
91
- return interpolate(match, callback) || (element && element.getAttribute('data-' + match.dasherize)) || "";
92
- });
93
- return count ? string : false;
94
- };
95
-
96
- var from = LSD.Interpolation.from = function() {
97
- var args = Array.prototype.slice(arguments, 0);
98
- return function(string) {
99
- return attempt.apply([string].concat(args));
100
- };
101
- };
102
-
103
- }();
@@ -1,56 +0,0 @@
1
- /*
2
- ---
3
-
4
- script: Container.js
5
-
6
- description: Makes widget use container - wrapper around content setting
7
-
8
- license: Public domain (http://unlicense.org).
9
-
10
- authors: Yaroslaff Fedin
11
-
12
- requires:
13
- - LSD.Module.DOM
14
-
15
- provides:
16
- - LSD.Module.Container
17
-
18
- ...
19
- */
20
-
21
- LSD.Module.Container = new Class({
22
- options: {
23
- container: {
24
- enabled: false,
25
- position: null,
26
- inline: true,
27
- attributes: {
28
- 'class': 'container'
29
- }
30
- },
31
-
32
- proxies: {
33
- container: {
34
- container: function() {
35
- return document.id(this.getContainer()) //creates container, once condition is true
36
- },
37
- condition: function() { //turned off by default
38
- return this.options.container.enabled;
39
- },
40
- priority: -1, //lowest priority
41
- rewrite: false //does not rewrite parent
42
- }
43
- }
44
- },
45
-
46
- getContainer: Macro.getter('container', function() {
47
- var options = this.options.container;
48
- if (!options.enabled) return;
49
- var tag = options.tag || (options.inline ? 'span' : 'div');
50
- return new Element(tag, options.attributes).inject(this.element, options.position);
51
- }),
52
-
53
- getWrapper: function() {
54
- return this.getContainer() || this.toElement();
55
- }
56
- });
@@ -1,36 +0,0 @@
1
- /*
2
- ---
3
-
4
- script: Element.onDispose.js
5
-
6
- description: Fires event when element is destroyed
7
-
8
- license: MIT-style license.
9
-
10
- extends: Core/Element
11
-
12
- ...
13
- */
14
-
15
- !function(dispose) {
16
- Element.implement({
17
- dispose: function() {
18
- if (this.fireEvent) this.fireEvent('dispose', this.parentNode);
19
- return (this.parentNode) ? this.parentNode.removeChild(this) : this;
20
- },
21
-
22
- replaces: function(el) {
23
- el = document.id(el, true);
24
- var parent = el.parentNode;
25
- parent.replaceChild(this, el);
26
- if (el.fireEvent) el.fireEvent('dispose', parent);
27
- return this;
28
- }
29
- });
30
- Element.dispose = function(element) {
31
- return Element.prototype.dispose.call(element);
32
- }
33
- Element.replaces = function(element, el) {
34
- return Element.prototype.dispose.call(element, el);
35
- }
36
- }(Element.prototype.dispose, Element.prototype.replaces);