dou-rails 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +229 -8
- data/lib/dou/version.rb +1 -1
- data/vendor/assets/javascripts/dou-min.js +2 -2
- data/vendor/assets/javascripts/dou.js +38 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88d0880e97bc213d201dccfd76df9b252b5a93dc
|
4
|
+
data.tar.gz: 86ebfe78b623d30e37508ce819479d5d8c79de77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59fe3c976181ecabbfdbf8facf7e31df4e4b760b722c44c3516e977ba86460420d5d7a93f81a3b4a5a91ea08c8a7894655a673eed9ea8665526c062f33109fb2
|
7
|
+
data.tar.gz: edd5ffeafcc4e855a8c1ee4aa7b64f5cf2bb891aaded2c9b1e9363553b986d1ed61f33bd869d37234a77133c626d50af601141130cd7d065489c2b3523e119b4
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ Light-weight javascript module framework
|
|
5
5
|
http://flightjs.github.io/)
|
6
6
|
|
7
7
|
## 'dou' means ..
|
8
|
-
* 都 (
|
8
|
+
* 都 (all) - Chinese pinyin
|
9
9
|
* Do you .. - English
|
10
10
|
|
11
11
|
## Features
|
@@ -15,21 +15,130 @@ http://flightjs.github.io/)
|
|
15
15
|
* Property
|
16
16
|
* Life Cycle
|
17
17
|
|
18
|
+
## Getting Started
|
19
|
+
It supports packages for nodejs, bower & rails.
|
20
|
+
|
21
|
+
As a gem for rails provides:
|
22
|
+
|
23
|
+
* dou-rails
|
24
|
+
|
25
|
+
As a package for nodejs provides:
|
26
|
+
|
27
|
+
* dou
|
28
|
+
|
29
|
+
As a package for bower provides:
|
30
|
+
|
31
|
+
* dou
|
32
|
+
|
33
|
+
### Install the nodejs module with:
|
34
|
+
`npm install dou --save`
|
35
|
+
|
36
|
+
### Install the bower module with:
|
37
|
+
`bower install dou --save`
|
38
|
+
|
39
|
+
### Configure for requirejs as follow:
|
40
|
+
|
41
|
+
```js
|
42
|
+
requirejs.config({
|
43
|
+
...
|
44
|
+
paths: {
|
45
|
+
'dou' : 'bower_components/dou/dou'
|
46
|
+
},
|
47
|
+
shim: {
|
48
|
+
dou: {
|
49
|
+
exports: 'dou'
|
50
|
+
}
|
51
|
+
},
|
52
|
+
...
|
53
|
+
});
|
54
|
+
```
|
55
|
+
|
56
|
+
### Install the rails module with Gemfile
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
gem "dou-rails"
|
60
|
+
```
|
61
|
+
|
62
|
+
And run `bundle install`. The rest of the installation depends on
|
63
|
+
whether the asset pipeline is being used.
|
64
|
+
|
65
|
+
### Rails 3.1 or greater (with asset pipeline *enabled*)
|
66
|
+
|
67
|
+
The dou-rails files will be added to the asset pipeline and available for you to use. If they're not already in `app/assets/javascripts/application.js` by default, add these lines:
|
68
|
+
|
69
|
+
```js
|
70
|
+
//= require dou-min
|
71
|
+
```
|
72
|
+
|
18
73
|
## Usage
|
19
74
|
|
75
|
+
### Define Class
|
76
|
+
|
20
77
|
```js
|
21
78
|
var dou = require('dou');
|
22
79
|
|
23
|
-
|
24
|
-
|
25
|
-
|
80
|
+
var Super = dou.define({
|
81
|
+
/* members are class members (methods or variable), not instance members */
|
82
|
+
members: {
|
83
|
+
methodA: function() {...},
|
84
|
+
methodB: function() {...}
|
85
|
+
}
|
86
|
+
});
|
87
|
+
|
88
|
+
var inst = new Super();
|
89
|
+
|
90
|
+
inst.methodA();
|
91
|
+
|
92
|
+
```
|
93
|
+
|
94
|
+
### Extend
|
95
|
+
|
96
|
+
```js
|
97
|
+
|
98
|
+
var Clazz = dou.define({
|
99
|
+
extend : Super,
|
100
|
+
members : {
|
101
|
+
methodC: function() {...}
|
102
|
+
}
|
103
|
+
});
|
104
|
+
|
105
|
+
var inst = new Clazz();
|
106
|
+
|
107
|
+
inst.methodA();
|
108
|
+
inst.methodB();
|
109
|
+
inst.methodC();
|
110
|
+
|
111
|
+
```
|
112
|
+
|
113
|
+
### Constructor
|
114
|
+
|
115
|
+
```js
|
116
|
+
|
117
|
+
var Clazz = dou.define({
|
118
|
+
extend : Super
|
119
|
+
},
|
120
|
+
/* constructor */
|
121
|
+
function(arg) {
|
122
|
+
// construction goes here
|
123
|
+
}
|
124
|
+
);
|
125
|
+
|
126
|
+
var inst = new Clazz(arg);
|
127
|
+
|
128
|
+
```
|
129
|
+
|
130
|
+
### Mixin
|
131
|
+
|
132
|
+
```js
|
26
133
|
|
27
134
|
function mixin1() {
|
28
|
-
this.
|
135
|
+
/* 'this' is prototype of Target Class. in this case Clazz.prototype */
|
136
|
+
this.methodD = function() { return 'foo'; };
|
29
137
|
}
|
30
138
|
|
31
139
|
function mixin2() {
|
32
|
-
this.
|
140
|
+
/* 'this' is prototype of Target Class. in this case Clazz.prototype */
|
141
|
+
this.methodE = function() { return 'bar'; };
|
33
142
|
}
|
34
143
|
|
35
144
|
var Clazz = dou.define({
|
@@ -39,10 +148,122 @@ var Clazz = dou.define({
|
|
39
148
|
|
40
149
|
var inst = new Clazz();
|
41
150
|
|
42
|
-
inst.
|
43
|
-
inst.
|
151
|
+
inst.methodD();
|
152
|
+
inst.methodE();
|
153
|
+
|
154
|
+
```
|
155
|
+
|
156
|
+
### Advice
|
157
|
+
|
158
|
+
```js
|
159
|
+
|
160
|
+
function mixin() {
|
161
|
+
this.before('methodA', function(arg) {
|
162
|
+
/* before logic */
|
163
|
+
...
|
164
|
+
});
|
165
|
+
this.after('methodB', function(arg) {
|
166
|
+
/* after logic */
|
167
|
+
...
|
168
|
+
});
|
169
|
+
this.around('methodC', function(origin, arg) {
|
170
|
+
/* before logic */
|
171
|
+
...
|
172
|
+
|
173
|
+
/* origin logic */
|
174
|
+
origin(arg);
|
175
|
+
|
176
|
+
/* after logic */
|
177
|
+
...
|
178
|
+
});
|
179
|
+
}
|
180
|
+
|
181
|
+
var Clazz = dou.define({
|
182
|
+
extend : Super,
|
183
|
+
/* dou.with.advice should be mixed in. */
|
184
|
+
mixins : [dou.with.advice, mixin]
|
185
|
+
});
|
186
|
+
|
187
|
+
var inst = new Clazz();
|
188
|
+
|
189
|
+
inst.methodA('abc');
|
190
|
+
|
191
|
+
```
|
192
|
+
|
193
|
+
### Event
|
194
|
+
|
195
|
+
```js
|
196
|
+
|
197
|
+
var Clazz = dou.define({
|
198
|
+
mixins : [dou.with.event],
|
199
|
+
members : {
|
200
|
+
test: function(x) {
|
201
|
+
this.trigger('test', x);
|
202
|
+
}
|
203
|
+
}
|
204
|
+
});
|
205
|
+
|
206
|
+
var inst = new Clazz();
|
207
|
+
|
208
|
+
inst.on('test', function(e) {
|
209
|
+
console.log(e);
|
210
|
+
});
|
211
|
+
|
212
|
+
inst.test(1);
|
213
|
+
|
214
|
+
inst.off('test');
|
215
|
+
|
216
|
+
```
|
217
|
+
|
218
|
+
### Property
|
219
|
+
|
220
|
+
```js
|
221
|
+
|
222
|
+
var Clazz = dou.define({
|
223
|
+
/* dou.with.property includes dou.with.event mixin */
|
224
|
+
mixins : [dou.with.property]
|
225
|
+
});
|
226
|
+
|
227
|
+
var inst = new Clazz();
|
228
|
+
|
229
|
+
inst.on('change', function(e) {
|
230
|
+
console.log(e.before);
|
231
|
+
console.log(e.after);
|
232
|
+
});
|
233
|
+
|
234
|
+
inst.set('attr1', 'value1');
|
235
|
+
|
236
|
+
inst.set({
|
237
|
+
attr1 : 'value1',
|
238
|
+
attr2 : 'value2'
|
239
|
+
});
|
240
|
+
|
241
|
+
var val = inst.get('attr1'); // val should be 'value1'
|
44
242
|
|
45
243
|
```
|
46
244
|
|
245
|
+
### Life Cycle
|
246
|
+
|
247
|
+
```js
|
248
|
+
var Clazz = dou.define({
|
249
|
+
/* dou.with.lifecycle includes 2 mixins (dou.with.property and dou.with.event) */
|
250
|
+
mixins : [dou.with.lifecycle],
|
251
|
+
members : {
|
252
|
+
defaults : {
|
253
|
+
attr1: 'A',
|
254
|
+
attr2: 'B'
|
255
|
+
}
|
256
|
+
}
|
257
|
+
});
|
258
|
+
|
259
|
+
var inst = new Clazz();
|
260
|
+
inst.initialize({
|
261
|
+
attr2: 'b'
|
262
|
+
});
|
263
|
+
|
264
|
+
var val1 = inst.get('attr1'); // val1 should be 'A'
|
265
|
+
var val2 = inst.get('attr2'); // val2 should be 'b'
|
266
|
+
|
267
|
+
```
|
47
268
|
## License
|
48
269
|
Copyright (c) 2014 Hearty, Oh. Licensed under the MIT license.
|
data/lib/dou/version.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
/*! Dou v0.0.
|
2
|
-
!function(t){function n(){var t,n,e=Array.prototype.slice.call(arguments),i=[];"string"==typeof e[0]&&(t=e.shift()),o(e[0])&&(i=e.shift()),n=e.shift(),r[t]=[i,n]}function e(t){function n(n){var e=t.split("/"),r=n.split("/"),i=!1;for(e.pop();".."==r[0]&&e.length;)e.pop(),r.shift(),i=!0;return"."==r[0]&&(r.shift(),i=!0),i&&(r=e.concat(r)),r.join("/")}var o,u,c;return"undefined"==typeof i[t]&&(o=r[t],o&&(c=o[0],u=o[1],i[t]=u.apply(void 0,s(c,function(t){return e(n(t))})))),i[t]}var r={},i={},o=Array.isArray||function(t){return t.constructor==Array},s=Array.map||function(t,n,e){for(var r=0,i=t.length,o=[];i>r;r++)o.push(n.call(e,t[r]));return o};!function(){var t=[].slice,e={}.hasOwnProperty;n("build/js/utils",[],function(){"use strict";var n,r;return n=100,r=0,{merge:function(){var n,r,i,o,s,u,c;for(o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],o&&typeof o!==!1||(o={}),u=0,c=n.length;c>u;u++){i=n[u];for(r in i)e.call(i,r)&&(s=i[r],o[r]="object"!=typeof s?s:this.merge(o[r],s))}return o},push:function(t,n,r){var i,o;if(!t||!n)return t;for(i in n)if(e.call(n,i)){if(o=n[i],t[i]&&r)throw new Error('utils.push attempted to overwrite "'+i+'" while running in protected mode');"object"==typeof t[i]&&"object"==typeof n[i]?this.push(t[i],n[i]):t[i]=n[i]}return t},isEnumerable:function(t,n){return Object.keys(t).indexOf(n)>-1},compose:function(){var t;return t=arguments,function(){var n,e,r,i;for(n=arguments,e=r=i=t.length-1;0>=i?0>=r:r>=0;e=0>=i?++r:--r)n=t[e].apply(this,n);return n[0]}},uniqueArray:function(t){var n,e,r,i,o;for(r={},n=[],i=0,o=t.length;o>i;i++)e=t[i],r.hasOwnProperty(e)||(n.push(e),r[e]=1);return n},debounce:function(t,e,r){var i,o;return"number"!=typeof e&&(e=n),o=0,i=null,function(){var n,s,u,c;return u=this,n=arguments,c=function(){return o=null,r?void 0:i=t.apply(u,n)},s=r&&!o,clearTimeout(o),o=setTimeout(c,e),s&&(i=t.apply(u,n)),i}},throttle:function(t,e){var r,i,o,s,u,c,a;return"number"!=typeof e&&(e=n),i=r=c=u=o=s=null,a=this.debounce(function(){return o=u=!1},e),function(){var n;return i=this,r=arguments,n=function(){return c=null,o&&(s=t.apply(i,r)),a()},c||(c=setTimeout(n,e)),u?o=!0:(u=!0,s=t.apply(i,r)),a(),s}},countThen:function(t,n){return function(){return--t?void 0:n.apply(this,arguments)}},delegate:function(t){return function(n,r){var i,o,s;s=$(n.target),i=null;for(o in t)if(e.call(t,o)&&!n.isPropagationStopped()&&(i=s.closest(o)).length)return r=r||{},r.el=i[0],t[o].apply(this,[n,r])}},once:function(t){var n,e;return n=!1,e=null,function(){return n?e:(e=t.apply(this,arguments),n=!0,e)}},uniqueId:function(t){var n;return n=++r+"",t?t+n:n}}})}.call(this),function(){var t={}.hasOwnProperty;n("build/js/debug",[],function(){"use strict";var n,e,r,i,o,s,u,c,a,l,f,h,p,g,v,y,m,d,b,w;return h="undefined"==typeof window?{}:window,w=function(n,e,r){var i,o,s,u;r=r||{},i=r.obj||h,o=r.path||(i===h?"global":""),u=[];for(s in i)t.call(i,s)&&((b[n]||n)(e,i,s)&&console.log(""+o+"."+s+" -> ("+typeof i[s]+")",i[s]),i[s]&&"object"==typeof i[s]&&i[s]!==i?u.push(w(n,e,{obj:i[s],path:""+o+"."+s})):u.push(void 0));return u},m=function(t,n,e,r){return n&&typeof e!==n?console.error(""+e+" must be "+n):w(t,e,r)},b={name:function(t,n,e){return t===e},nameContains:function(t,n,e){return e.indexOf(t)>-1},type:function(t,n,e){return n[e]instanceof t},value:function(t,n,e){return n[e]===t},valueCoerced:function(t,n,e){return n[e]==t}},e=function(t,n){return m("name","string",t,n)},r=function(t,n){return m("nameContains","string",t,n)},i=function(t,n){return m("type","function",t,n)},o=function(t,n){return m("value",null,t,n)},s=function(t,n){return m("valueCoerced",null,t,n)},u=function(t,n){return w(t,null,n)},l=function(){var t;return t=[].slice.call(arguments),g.eventNames.length||(g.eventNames=n),g.actions=t.length?t:n,y()},f=function(){var t;return t=[].slice.call(arguments),g.actions.length||(g.actions=n),g.eventNames=t.length?t:n,y()},p=function(){return g.actions=[],g.eventNames=[],y()},d=function(){return g.actions=n,g.eventNames=n,y()},y=function(){return h.localStorage?(h.localStorage.setItem("logFilter_eventNames",g.eventNames),h.localStorage.setItem("logFilter_actions",g.actions)):void 0},v=function(){var e,r,i;r={eventNames:h.localStorage&&h.localStorage.getItem("logFilter_eventNames")||a,actions:h.localStorage&&h.localStorage.getItem("logFilter_actions")||c};for(e in r)t.call(r,e)&&(i=r[e],"string"==typeof i&&i!==n&&(r[e]=i.split(".")));return r},n="all",a=[],c=[],g=v(),{enable:function(t){return this.enabled=!!t,t&&h.console&&(console.info("Booting in DEBUG mode"),console.info("You can configure event logging with DEBUG.events.logAll()/logNone()/logByName()/logByAction()")),h.DEBUG=this},find:{byName:e,byNameContains:r,byType:i,byValue:o,byValueCoerced:s,custom:u},events:{logFilter:g,logByAction:l,logByName:f,logAll:d,logNone:p}}})}.call(this),function(){var t={}.hasOwnProperty;n("build/js/compose",["./utils","./debug"],function(n,e){"use strict";var r,i,o,s,u,c;if(r=e.enabled&&!n.isEnumerable(Object,"getOwnPropertyDescriptor"),i=["mixedIn","mixingIn"],r)try{Object.getOwnPropertyDescriptor(Object,"keys")}catch(a){o=a,r=!1}return u=function(n,e){var o,s,u;if(r){u=Object.create(null);for(s in n)t.call(n,s)&&i.indexOf(0>s)&&(o=Object.getOwnPropertyDescriptor(n,s),o.writable=e,u[s]=o);return Object.defineProperties(n,u)}},c=function(t,n,e){var i;return r&&t.hasOwnProperty(n)?(i=Object.getOwnPropertyDescriptor(t,n).writable,Object.defineProperties(t,n,{writable:!0}),e.call(t),Object.defineProperties(t,n,{writable:i})):e.call(t)},s=function(t,n){var e,r;if(!(n instanceof Array))return this.mixin(t,[n]);for(t.mixedIn=t.hasOwnProperty("mixedIn")?t.mixedIn:[],t.mixingIn=t.hasOwnProperty("mixingIn")?t.mixingIn:[],u(t,!1),e=0,r=n.length;r>e;e++)if(s=n[e],-1===t.mixedIn.indexOf(s)){if(t.mixingIn.indexOf(s)>-1)throw new Error("found cyclic dependencies between "+t.mixingIn);t.mixingIn.push(s),s.call(t),t.mixingIn.pop(),t.mixedIn.push(s)}return u(t,!0),t},{mixin:s,unlockProperty:c}})}.call(this),function(){n("build/js/advice",["./compose"],function(t){"use strict";var n;return n={around:function(t,n){return function(){var e,r,i,o,s,u;for(o=arguments.length,e=new Array(o+1),e[0]=t.bind(this),i=s=0,u=e.length;u>s;i=++s)r=e[i],e[i+1]=arguments[i];return n.apply(this,e)}},before:function(t,n){var e;return e="function"==typeof n?n:n.obj[n.fnName],function(){return e.apply(this,arguments),t.apply(this,arguments)}},after:function(t,n){var e;return e="function"==typeof n?n:n.obj[n.fnName],function(){var n;return n=(t.unbound||t).apply(this,arguments),e.apply(this,arguments),n}},withAdvice:function(){return["before","after","around"].forEach(function(e){return this[e]=function(r,i){return t.unlockProperty(this,r,function(){return this[r]="function"==typeof this[r]?n[e](this[r],i):i,this[r]})}},this)}}})}.call(this),function(){n("build/js/event",["./utils"],function(t){"use strict";var n,e,r,i,o,s,u,c;u=[].slice,n={withEvent:function(){var t,e,r,i,o;for(i=["on","off","once","trigger"],o=[],e=0,r=i.length;r>e;e++)t=i[e],o.push(this[t]=n[t]);return o},on:function(t,n,e){var i;return r(this,"on",t,[n,e])&&n?(this._events||(this._events={}),i=this._events[t]||(this._events[t]=[]),i.push({callback:n,context:e,ctx:e||this}),this):this},once:function(n,e,i){var o,s;return r(this,"once",n,[e,i])&&e?(s=this,o=t.once(function(){return s.off(n,o),e.apply(this,arguments)}),o._callback=e,this.on(n,o,i)):this},off:function(t,n,e){var i,o,s,u,c,a,l,f,h,p;if(!this._events||!r(this,"off",t,[n,e]))return this;if(!t&&!n&&!e)return this._events=void 0,this;for(c=t?[t]:Object.keys(this._events),s=l=0,h=c.length;h>l;s=++l)if(t=c[s],o=this._events[t]){if(this._events[t]=a=[],n||e)for(u=f=0,p=o.length;p>f;u=++f)i=o[u],(n&&n!==i.callback&&n!==i.callback._callback||e&&e!==i.context)&&a.push(i);a.length||delete this._events[t]}return this},trigger:function(t){var n,e,i;return this._events?(e=u.call(arguments,1),r(this,"trigger",t,e)?(i=this._events[t],n=this._events.all,i&&c(i,e),n&&c(n,arguments),this):this):this},stopListening:function(t,n,e){var r,i,o;if(i=this._listeningTo,!i)return this;o=!n&&!e,e||"object"!=typeof n||(e=this),t&&((i={})[t._listenId]=t);for(r in i)t=i[r],t.off(n,e,this),(o||_.isEmpty(t._events))&&delete this._listeningTo[r];return this}},e=/\s+/,r=function(t,n,r,i){var o,s,u,c,a;if(!r)return!0;if("object"==typeof r){for(o in r)u=r[o],t[n].apply(t,[o,u].concat(i));return!1}if(e.test(r)){for(s=r.split(e),c=0,a=s.length;a>c;c++)u=s[c],t[n].apply(t,[u].concat(i));return!1}return!0},c=function(t,n){var e,r,i,o;for(o=[],r=0,i=t.length;i>r;r++)e=t[r],o.push(e.callback.apply(e.ctx,n));return o},o={listenTo:"on",listenToOnce:"once"};for(s in o)i=o[s],n[s]=function(n,e,r){var o,s;return s=this._listeningTo||(this._listeningTo={}),o=n._listenId||(n._listenId=t.uniqueId("l")),s[o]=n,r||"object"!=typeof e||(r=this),n[i](e,r,this),this};return n})}.call(this),function(){var t={}.hasOwnProperty;n("build/js/property",["./utils","./compose","./event"],function(n,e,r){"use strict";var i,o;return o=function(e,r){var i,o,s,u,c;if(!e)return this;if(arguments.length>1&&"string"==typeof arguments[0])return o={},o[e]=r,this.set(o);this.attrs||(this.attrs={}),o=e,i={},s={},u=this.attrs;for(e in u)t.call(u,e)&&(r=u[e],s[e]=r);n.push(this.attrs,o),c=this.attrs;for(e in c)t.call(c,e)&&(r=c[e],r!==s[e]?i[e]=r:delete s[e]);return 0!==Object.keys(i).length&&this.trigger("change",{before:s,after:i},!0),this},i=function(t){return this.attrs&&this.attrs[t]},function(){return e.mixin(this,r.withEvent),this.set=o,this.get=i}})}.call(this),function(){var t={}.hasOwnProperty;n("build/js/lifecycle",["./compose","./property"],function(n,e){"use strict";var r,i;return i=function(n){var e,r,i,o;n||(n={}),e={};for(r in n)t.call(n,r)&&(i=n[r],e[r]=i);o=this.defaults;for(r in o)t.call(o,r)&&(i=o[r],e.hasOwnProperty(r)||(e[r]=i));return this.set(e),this},r=function(){},function(){return n.mixin(this,e),this.initialize=i,this.despose=r}})}.call(this),function(){n("build/js/serialize",["./compose","./property"],function(t,n){"use strict";var e,r;return r=function(){return["type: "+this.name,"id: "+this.id,"props: "+JSON.stringify(this.attrs)].join(",")},e=function(){},function(){return t.mixin(this,n),this.serialize||(this.serialize=r),this.deserialize?void 0:this.deserialize=e}})}.call(this),function(){var t={}.hasOwnProperty,e=function(n,e){function r(){this.constructor=n}for(var i in e)t.call(e,i)&&(n[i]=e[i]);return r.prototype=e.prototype,n.prototype=new r,n.__super__=e.prototype,n};n("build/js/dou",["./compose","./advice","./lifecycle","./property","./serialize","./event"],function(n,r,i,o,s,u){"use strict";var c,a;return c=function(r,i,o){var s,u,c,a;if(i||(i=function(){}),s=r["extends"]?function(t){function n(){return r.apply(this,arguments)}var r;return e(n,t),r=i,n}(r["extends"]):function(){function t(){return n.apply(this,arguments)}var n;return n=i,t}(),r.members){a=r.members;for(u in a)t.call(a,u)&&(c=a[u],s.prototype[u]=c)}if(o)for(u in o)t.call(o,u)&&(c=o[u],s.prototype[u]=c);return r.mixins&&n.mixin(s.prototype,r.mixins),r.name&&(s.name=r.name),s},a=function(t,e){return n.mixin("function"==typeof t?t.prototype:t,e)},{define:c,mixin:a,"with":{advice:r.withAdvice,property:o,lifecycle:i,event:u.withEvent,serialize:s}}})}.call(this),t.dou=e("build/js/dou")}(this);
|
1
|
+
/*! Dou v0.0.10 | (c) Hatio, Lab. | MIT License */
|
2
|
+
!function(t){function n(){var t,n,e=Array.prototype.slice.call(arguments),i=[];"string"==typeof e[0]&&(t=e.shift()),o(e[0])&&(i=e.shift()),n=e.shift(),r[t]=[i,n]}function e(t){function n(n){var e=t.split("/"),r=n.split("/"),i=!1;for(e.pop();".."==r[0]&&e.length;)e.pop(),r.shift(),i=!0;return"."==r[0]&&(r.shift(),i=!0),i&&(r=e.concat(r)),r.join("/")}var o,s,c;return"undefined"==typeof i[t]&&(o=r[t],o&&(c=o[0],s=o[1],i[t]=s.apply(void 0,u(c,function(t){return e(n(t))})))),i[t]}var r={},i={},o=Array.isArray||function(t){return t.constructor==Array},u=Array.map||function(t,n,e){for(var r=0,i=t.length,o=[];i>r;r++)o.push(n.call(e,t[r]));return o};!function(){var t=[].slice,e={}.hasOwnProperty;n("build/js/utils",[],function(){"use strict";var n,r;return n=100,r=0,{merge:function(){var n,r,i,o,u,s,c;for(o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],o&&typeof o!==!1||(o={}),s=0,c=n.length;c>s;s++){i=n[s];for(r in i)e.call(i,r)&&(u=i[r],o[r]="object"!=typeof u?u:this.merge(o[r],u))}return o},push:function(t,n,r){var i,o;if(!t||!n)return t;for(i in n)if(e.call(n,i)){if(o=n[i],t[i]&&r)throw new Error('utils.push attempted to overwrite "'+i+'" while running in protected mode');"object"==typeof t[i]&&"object"==typeof n[i]?this.push(t[i],n[i]):t[i]=n[i]}return t},isEnumerable:function(t,n){return Object.keys(t).indexOf(n)>-1},compose:function(){var t;return t=arguments,function(){var n,e,r,i;for(n=arguments,e=r=i=t.length-1;0>=i?0>=r:r>=0;e=0>=i?++r:--r)n=t[e].apply(this,n);return n[0]}},uniqueArray:function(t){var n,e,r,i,o;for(r={},n=[],i=0,o=t.length;o>i;i++)e=t[i],r.hasOwnProperty(e)||(n.push(e),r[e]=1);return n},debounce:function(t,e,r){var i,o;return"number"!=typeof e&&(e=n),o=0,i=null,function(){var n,u,s,c;return s=this,n=arguments,c=function(){return o=null,r?void 0:i=t.apply(s,n)},u=r&&!o,clearTimeout(o),o=setTimeout(c,e),u&&(i=t.apply(s,n)),i}},throttle:function(t,e){var r,i,o,u,s,c,a;return"number"!=typeof e&&(e=n),i=r=c=s=o=u=null,a=this.debounce(function(){return o=s=!1},e),function(){var n;return i=this,r=arguments,n=function(){return c=null,o&&(u=t.apply(i,r)),a()},c||(c=setTimeout(n,e)),s?o=!0:(s=!0,u=t.apply(i,r)),a(),u}},countThen:function(t,n){return function(){return--t?void 0:n.apply(this,arguments)}},delegate:function(t){return function(n,r){var i,o,u;u=$(n.target),i=null;for(o in t)if(e.call(t,o)&&!n.isPropagationStopped()&&(i=u.closest(o)).length)return r=r||{},r.el=i[0],t[o].apply(this,[n,r])}},once:function(t){var n,e;return n=!1,e=null,function(){return n?e:(e=t.apply(this,arguments),n=!0,e)}},uniqueId:function(t){var n;return n=++r+"",t?t+n:n},clone:function(t){var n,e,r;if(null==t||"object"!=typeof t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return n="",null!=t.global&&(n+="g"),null!=t.ignoreCase&&(n+="i"),null!=t.multiline&&(n+="m"),null!=t.sticky&&(n+="y"),new RegExp(t.source,n);r=new t.constructor;for(e in t)r[e]=this.clone(t[e]);return r}}})}.call(this),function(){var t={}.hasOwnProperty;n("build/js/debug",[],function(){"use strict";var n,e,r,i,o,u,s,c,a,l,f,h,p,g,v,y,m,d,b,w;return h="undefined"==typeof window?{}:window,w=function(n,e,r){var i,o,u,s;r=r||{},i=r.obj||h,o=r.path||(i===h?"global":""),s=[];for(u in i)t.call(i,u)&&((b[n]||n)(e,i,u)&&console.log(""+o+"."+u+" -> ("+typeof i[u]+")",i[u]),i[u]&&"object"==typeof i[u]&&i[u]!==i?s.push(w(n,e,{obj:i[u],path:""+o+"."+u})):s.push(void 0));return s},m=function(t,n,e,r){return n&&typeof e!==n?console.error(""+e+" must be "+n):w(t,e,r)},b={name:function(t,n,e){return t===e},nameContains:function(t,n,e){return e.indexOf(t)>-1},type:function(t,n,e){return n[e]instanceof t},value:function(t,n,e){return n[e]===t},valueCoerced:function(t,n,e){return n[e]==t}},e=function(t,n){return m("name","string",t,n)},r=function(t,n){return m("nameContains","string",t,n)},i=function(t,n){return m("type","function",t,n)},o=function(t,n){return m("value",null,t,n)},u=function(t,n){return m("valueCoerced",null,t,n)},s=function(t,n){return w(t,null,n)},l=function(){var t;return t=[].slice.call(arguments),g.eventNames.length||(g.eventNames=n),g.actions=t.length?t:n,y()},f=function(){var t;return t=[].slice.call(arguments),g.actions.length||(g.actions=n),g.eventNames=t.length?t:n,y()},p=function(){return g.actions=[],g.eventNames=[],y()},d=function(){return g.actions=n,g.eventNames=n,y()},y=function(){return h.localStorage?(h.localStorage.setItem("logFilter_eventNames",g.eventNames),h.localStorage.setItem("logFilter_actions",g.actions)):void 0},v=function(){var e,r,i;r={eventNames:h.localStorage&&h.localStorage.getItem("logFilter_eventNames")||a,actions:h.localStorage&&h.localStorage.getItem("logFilter_actions")||c};for(e in r)t.call(r,e)&&(i=r[e],"string"==typeof i&&i!==n&&(r[e]=i.split(".")));return r},n="all",a=[],c=[],g=v(),{enable:function(t){return this.enabled=!!t,t&&h.console&&(console.info("Booting in DEBUG mode"),console.info("You can configure event logging with DEBUG.events.logAll()/logNone()/logByName()/logByAction()")),h.DEBUG=this},find:{byName:e,byNameContains:r,byType:i,byValue:o,byValueCoerced:u,custom:s},events:{logFilter:g,logByAction:l,logByName:f,logAll:d,logNone:p}}})}.call(this),function(){var t={}.hasOwnProperty;n("build/js/compose",["./utils","./debug"],function(n,e){"use strict";var r,i,o,u,s,c;if(r=e.enabled&&!n.isEnumerable(Object,"getOwnPropertyDescriptor"),i=["mixedIn","mixingIn"],r)try{Object.getOwnPropertyDescriptor(Object,"keys")}catch(a){o=a,r=!1}return s=function(n,e){var o,u,s;if(r){s=Object.create(null);for(u in n)t.call(n,u)&&i.indexOf(0>u)&&(o=Object.getOwnPropertyDescriptor(n,u),o.writable=e,s[u]=o);return Object.defineProperties(n,s)}},c=function(t,n,e){var i;return r&&t.hasOwnProperty(n)?(i=Object.getOwnPropertyDescriptor(t,n).writable,Object.defineProperties(t,n,{writable:!0}),e.call(t),Object.defineProperties(t,n,{writable:i})):e.call(t)},u=function(t,n){var e,r;if(!(n instanceof Array))return this.mixin(t,[n]);for(t.mixedIn=t.hasOwnProperty("mixedIn")?t.mixedIn:[],t.mixingIn=t.hasOwnProperty("mixingIn")?t.mixingIn:[],s(t,!1),e=0,r=n.length;r>e;e++)if(u=n[e],-1===t.mixedIn.indexOf(u)){if(t.mixingIn.indexOf(u)>-1)throw new Error("found cyclic dependencies between "+t.mixingIn);t.mixingIn.push(u),u.call(t),t.mixingIn.pop(),t.mixedIn.push(u)}return s(t,!0),t},{mixin:u,unlockProperty:c}})}.call(this),function(){n("build/js/advice",["./compose"],function(t){"use strict";var n;return n={around:function(t,n){return function(){var e,r,i,o,u,s;for(o=arguments.length,e=new Array(o+1),e[0]=t.bind(this),i=u=0,s=e.length;s>u;i=++u)r=e[i],e[i+1]=arguments[i];return n.apply(this,e)}},before:function(t,n){var e;return e="function"==typeof n?n:n.obj[n.fnName],function(){return e.apply(this,arguments),t.apply(this,arguments)}},after:function(t,n){var e;return e="function"==typeof n?n:n.obj[n.fnName],function(){var n;return n=(t.unbound||t).apply(this,arguments),e.apply(this,arguments),n}},withAdvice:function(){return["before","after","around"].forEach(function(e){return this[e]=function(r,i){return t.unlockProperty(this,r,function(){return this[r]="function"==typeof this[r]?n[e](this[r],i):i,this[r]})}},this)}}})}.call(this),function(){n("build/js/event",["./utils"],function(t){"use strict";var n,e,r,i,o,u,s,c;s=[].slice,n={withEvent:function(){var t,e,r,i,o;for(i=["on","off","once","trigger"],o=[],e=0,r=i.length;r>e;e++)t=i[e],o.push(this[t]=n[t]);return o},on:function(t,n,e){var i;return r(this,"on",t,[n,e])&&n?(this._events||(this._events={}),i=this._events[t]||(this._events[t]=[]),i.push({callback:n,context:e,ctx:e||this}),this):this},once:function(n,e,i){var o,u;return r(this,"once",n,[e,i])&&e?(u=this,o=t.once(function(){return u.off(n,o),e.apply(this,arguments)}),o._callback=e,this.on(n,o,i)):this},off:function(t,n,e){var i,o,u,s,c,a,l,f,h,p;if(!this._events||!r(this,"off",t,[n,e]))return this;if(!t&&!n&&!e)return this._events=void 0,this;for(c=t?[t]:Object.keys(this._events),u=l=0,h=c.length;h>l;u=++l)if(t=c[u],o=this._events[t]){if(this._events[t]=a=[],n||e)for(s=f=0,p=o.length;p>f;s=++f)i=o[s],(n&&n!==i.callback&&n!==i.callback._callback||e&&e!==i.context)&&a.push(i);a.length||delete this._events[t]}return this},trigger:function(t){var n,e,i;return this._events?(e=s.call(arguments,1),r(this,"trigger",t,e)?(i=this._events[t],n=this._events.all,i&&c(i,e),n&&c(n,arguments),this):this):this},stopListening:function(t,n,e){var r,i,o;if(i=this._listeningTo,!i)return this;o=!n&&!e,e||"object"!=typeof n||(e=this),t&&((i={})[t._listenId]=t);for(r in i)t=i[r],t.off(n,e,this),(o||_.isEmpty(t._events))&&delete this._listeningTo[r];return this}},e=/\s+/,r=function(t,n,r,i){var o,u,s,c,a;if(!r)return!0;if("object"==typeof r){for(o in r)s=r[o],t[n].apply(t,[o,s].concat(i));return!1}if(e.test(r)){for(u=r.split(e),c=0,a=u.length;a>c;c++)s=u[c],t[n].apply(t,[s].concat(i));return!1}return!0},c=function(t,n){var e,r,i,o;for(o=[],r=0,i=t.length;i>r;r++)e=t[r],o.push(e.callback.apply(e.ctx,n));return o},o={listenTo:"on",listenToOnce:"once"};for(u in o)i=o[u],n[u]=function(n,e,r){var o,u;return u=this._listeningTo||(this._listeningTo={}),o=n._listenId||(n._listenId=t.uniqueId("l")),u[o]=n,r||"object"!=typeof e||(r=this),n[i](e,r,this),this};return n})}.call(this),function(){var t={}.hasOwnProperty;n("build/js/property",["./utils","./compose","./event"],function(n,e,r){"use strict";var i,o;return o=function(e,r){var i,o,u,s,c;if(!e)return this;if(arguments.length>1&&"string"==typeof arguments[0])return o={},o[e]=r,this.set(o);this.attrs||(this.attrs={}),o=e,i={},u={},s=this.attrs;for(e in s)t.call(s,e)&&(r=s[e],u[e]=r);n.push(this.attrs,o),c=this.attrs;for(e in c)t.call(c,e)&&(r=c[e],r!==u[e]?i[e]=r:delete u[e]);return 0!==Object.keys(i).length&&this.trigger("change",{before:u,after:i},!0),this},i=function(t){return this.attrs&&this.attrs[t]},function(){return e.mixin(this,r.withEvent),this.set=o,this.get=i}})}.call(this),function(){var t={}.hasOwnProperty;n("build/js/lifecycle",["./compose","./property"],function(n,e){"use strict";var r,i;return i=function(n){var e,r,i,o;n||(n={}),e={};for(r in n)t.call(n,r)&&(i=n[r],e[r]=i);o=this.defaults;for(r in o)t.call(o,r)&&(i=o[r],e.hasOwnProperty(r)||(e[r]=i));return this.set(e),this},r=function(){},function(){return n.mixin(this,e),this.initialize=i,this.despose=r}})}.call(this),function(){n("build/js/serialize",["./compose","./property"],function(t,n){"use strict";var e,r;return r=function(){return["type: "+this.name,"id: "+this.id,"props: "+JSON.stringify(this.attrs)].join(",")},e=function(){},function(){return t.mixin(this,n),this.serialize||(this.serialize=r),this.deserialize?void 0:this.deserialize=e}})}.call(this),function(){var t={}.hasOwnProperty,e=function(n,e){function r(){this.constructor=n}for(var i in e)t.call(e,i)&&(n[i]=e[i]);return r.prototype=e.prototype,n.prototype=new r,n.__super__=e.prototype,n};n("build/js/dou",["./compose","./advice","./lifecycle","./property","./serialize","./event","./utils"],function(n,r,i,o,u,s,c){"use strict";var a,l;return a=function(r,i,o){var u,s,c,a;if(i||(i=function(){}),u=r["extends"]?function(t){function n(){return r.apply(this,arguments)}var r;return e(n,t),r=i,n}(r["extends"]):function(){function t(){return n.apply(this,arguments)}var n;return n=i,t}(),r.members){a=r.members;for(s in a)t.call(a,s)&&(c=a[s],u.prototype[s]=c)}if(o)for(s in o)t.call(o,s)&&(c=o[s],u.prototype[s]=c);return r.mixins&&n.mixin(u.prototype,r.mixins),r.name&&(u.name=r.name),u},l=function(t,e){return n.mixin("function"==typeof t?t.prototype:t,e),t},{define:a,mixin:l,"with":{advice:r.withAdvice,property:o,lifecycle:i,event:s.withEvent,serialize:u},util:c}})}.call(this),t.dou=e("build/js/dou")}(this);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! Dou v0.0.
|
1
|
+
/*! Dou v0.0.10 | (c) Hatio, Lab. | MIT License */
|
2
2
|
(function(context) {
|
3
3
|
var factories = {}, loaded = {};
|
4
4
|
var isArray = Array.isArray || function(obj) {
|
@@ -242,6 +242,36 @@
|
|
242
242
|
} else {
|
243
243
|
return id;
|
244
244
|
}
|
245
|
+
},
|
246
|
+
clone: function (obj) {
|
247
|
+
var flags, key, newInstance;
|
248
|
+
if (obj == null || typeof obj !== 'object') {
|
249
|
+
return obj;
|
250
|
+
}
|
251
|
+
if (obj instanceof Date) {
|
252
|
+
return new Date(obj.getTime());
|
253
|
+
}
|
254
|
+
if (obj instanceof RegExp) {
|
255
|
+
flags = '';
|
256
|
+
if (obj.global != null) {
|
257
|
+
flags += 'g';
|
258
|
+
}
|
259
|
+
if (obj.ignoreCase != null) {
|
260
|
+
flags += 'i';
|
261
|
+
}
|
262
|
+
if (obj.multiline != null) {
|
263
|
+
flags += 'm';
|
264
|
+
}
|
265
|
+
if (obj.sticky != null) {
|
266
|
+
flags += 'y';
|
267
|
+
}
|
268
|
+
return new RegExp(obj.source, flags);
|
269
|
+
}
|
270
|
+
newInstance = new obj.constructor();
|
271
|
+
for (key in obj) {
|
272
|
+
newInstance[key] = this.clone(obj[key]);
|
273
|
+
}
|
274
|
+
return newInstance;
|
245
275
|
}
|
246
276
|
};
|
247
277
|
});
|
@@ -860,8 +890,9 @@
|
|
860
890
|
'./lifecycle',
|
861
891
|
'./property',
|
862
892
|
'./serialize',
|
863
|
-
'./event'
|
864
|
-
|
893
|
+
'./event',
|
894
|
+
'./utils'
|
895
|
+
], function (compose, advice, lifecycle, property, serialize, event, utils) {
|
865
896
|
'use strict';
|
866
897
|
var define, mixin;
|
867
898
|
define = function (options, constructor, prototype) {
|
@@ -914,7 +945,8 @@
|
|
914
945
|
return Component;
|
915
946
|
};
|
916
947
|
mixin = function (target, withs) {
|
917
|
-
|
948
|
+
compose.mixin(typeof target === 'function' ? target.prototype : target, withs);
|
949
|
+
return target;
|
918
950
|
};
|
919
951
|
return {
|
920
952
|
define: define,
|
@@ -925,7 +957,8 @@
|
|
925
957
|
lifecycle: lifecycle,
|
926
958
|
event: event.withEvent,
|
927
959
|
serialize: serialize
|
928
|
-
}
|
960
|
+
},
|
961
|
+
util: utils
|
929
962
|
};
|
930
963
|
});
|
931
964
|
}.call(this));
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dou-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hearty, Oh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02
|
11
|
+
date: 2014-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|