flight-for-rails 1.2.0 → 1.3.0
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 +1 -1
- data/lib/flight-for-rails/version.rb +1 -1
- data/vendor/assets/javascripts/flight/standalone.js +1333 -1061
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cf5f8320790612e10c457de6f50903059fe37c8
|
4
|
+
data.tar.gz: 03e1aff1cec648d5e1531b909061e5012cf5b2c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11914229d27e2ebdd5d19316852234aba92353207649553e7498bdced8ea3cbe2980b916d6fceaa58a32aaf8eafcd4a1ff5a01d4ab0815fa7117256636bfbcb6
|
7
|
+
data.tar.gz: 04bde428f8c05f9a6acb41cd92957935c4ab69c242d653c1c8261bf584d3060cc053fe12861eb3eaf197ebb99395cce9c3626aac13a6f2436f77f7608accb152
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ This gem vendors Flight files and dependecies for Rails assets pipeline.
|
|
20
20
|
First add the following lines to your application `Gemfile`:
|
21
21
|
|
22
22
|
``` ruby
|
23
|
-
gem 'flight-for-rails', '~> 1.
|
23
|
+
gem 'flight-for-rails', '~> 1.3.0'
|
24
24
|
```
|
25
25
|
|
26
26
|
Then run `bundle install` to update your's gems bundle.
|
@@ -1,1154 +1,1426 @@
|
|
1
|
-
/*! Flight v1.
|
2
|
-
(function(
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
/*! Flight v1.3.0 | (c) Twitter, Inc. | MIT License */
|
2
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
3
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
4
|
+
module.exports = factory();
|
5
|
+
else if(typeof define === 'function' && define.amd)
|
6
|
+
define(factory);
|
7
|
+
else if(typeof exports === 'object')
|
8
|
+
exports["flight"] = factory();
|
9
|
+
else
|
10
|
+
root["flight"] = factory();
|
11
|
+
})(this, function() {
|
12
|
+
return /******/ (function(modules) { // webpackBootstrap
|
13
|
+
/******/ // The module cache
|
14
|
+
/******/ var installedModules = {};
|
15
|
+
/******/
|
16
|
+
/******/ // The require function
|
17
|
+
/******/ function __webpack_require__(moduleId) {
|
18
|
+
/******/
|
19
|
+
/******/ // Check if module is in cache
|
20
|
+
/******/ if(installedModules[moduleId])
|
21
|
+
/******/ return installedModules[moduleId].exports;
|
22
|
+
/******/
|
23
|
+
/******/ // Create a new module (and put it into the cache)
|
24
|
+
/******/ var module = installedModules[moduleId] = {
|
25
|
+
/******/ exports: {},
|
26
|
+
/******/ id: moduleId,
|
27
|
+
/******/ loaded: false
|
28
|
+
/******/ };
|
29
|
+
/******/
|
30
|
+
/******/ // Execute the module function
|
31
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
32
|
+
/******/
|
33
|
+
/******/ // Flag the module as loaded
|
34
|
+
/******/ module.loaded = true;
|
35
|
+
/******/
|
36
|
+
/******/ // Return the exports of the module
|
37
|
+
/******/ return module.exports;
|
38
|
+
/******/ }
|
39
|
+
/******/
|
40
|
+
/******/
|
41
|
+
/******/ // expose the modules object (__webpack_modules__)
|
42
|
+
/******/ __webpack_require__.m = modules;
|
43
|
+
/******/
|
44
|
+
/******/ // expose the module cache
|
45
|
+
/******/ __webpack_require__.c = installedModules;
|
46
|
+
/******/
|
47
|
+
/******/ // __webpack_public_path__
|
48
|
+
/******/ __webpack_require__.p = "";
|
49
|
+
/******/
|
50
|
+
/******/ // Load entry module and return exports
|
51
|
+
/******/ return __webpack_require__(0);
|
52
|
+
/******/ })
|
53
|
+
/************************************************************************/
|
54
|
+
/******/ ([
|
55
|
+
/* 0 */
|
56
|
+
/***/ function(module, exports, __webpack_require__) {
|
57
|
+
|
58
|
+
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 2013 Twitter, Inc. Licensed under The MIT License. http://opensource.org/licenses/MIT */
|
59
|
+
|
60
|
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
|
61
|
+
__webpack_require__(1),
|
62
|
+
__webpack_require__(2),
|
63
|
+
__webpack_require__(3),
|
64
|
+
__webpack_require__(4),
|
65
|
+
__webpack_require__(5),
|
66
|
+
__webpack_require__(6),
|
67
|
+
__webpack_require__(7)
|
68
|
+
], __WEBPACK_AMD_DEFINE_RESULT__ = (function(advice, component, compose, debug, logger, registry, utils) {
|
69
|
+
'use strict';
|
70
|
+
|
71
|
+
return {
|
72
|
+
advice: advice,
|
73
|
+
component: component,
|
74
|
+
compose: compose,
|
75
|
+
debug: debug,
|
76
|
+
logger: logger,
|
77
|
+
registry: registry,
|
78
|
+
utils: utils
|
79
|
+
};
|
80
|
+
|
81
|
+
}.apply(null, __WEBPACK_AMD_DEFINE_ARRAY__)), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
82
|
+
|
83
|
+
|
84
|
+
/***/ },
|
85
|
+
/* 1 */
|
86
|
+
/***/ function(module, exports, __webpack_require__) {
|
87
|
+
|
88
|
+
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 2013 Twitter, Inc. Licensed under The MIT License. http://opensource.org/licenses/MIT */
|
89
|
+
|
90
|
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
|
91
|
+
__webpack_require__(7)
|
92
|
+
], __WEBPACK_AMD_DEFINE_RESULT__ = (function(utils) {
|
93
|
+
'use strict';
|
94
|
+
|
95
|
+
var advice = {
|
96
|
+
|
97
|
+
around: function(base, wrapped) {
|
98
|
+
return function composedAround() {
|
99
|
+
// unpacking arguments by hand benchmarked faster
|
100
|
+
var i = 0, l = arguments.length, args = new Array(l + 1);
|
101
|
+
args[0] = base.bind(this);
|
102
|
+
for (; i < l; i++) {
|
103
|
+
args[i + 1] = arguments[i];
|
104
|
+
}
|
105
|
+
return wrapped.apply(this, args);
|
106
|
+
};
|
107
|
+
},
|
108
|
+
|
109
|
+
before: function(base, before) {
|
110
|
+
var beforeFn = (typeof before == 'function') ? before : before.obj[before.fnName];
|
111
|
+
return function composedBefore() {
|
112
|
+
beforeFn.apply(this, arguments);
|
113
|
+
return base.apply(this, arguments);
|
114
|
+
};
|
115
|
+
},
|
116
|
+
|
117
|
+
after: function(base, after) {
|
118
|
+
var afterFn = (typeof after == 'function') ? after : after.obj[after.fnName];
|
119
|
+
return function composedAfter() {
|
120
|
+
var res = (base.unbound || base).apply(this, arguments);
|
121
|
+
afterFn.apply(this, arguments);
|
122
|
+
return res;
|
123
|
+
};
|
124
|
+
},
|
125
|
+
|
126
|
+
// a mixin that allows other mixins to augment existing functions by adding additional
|
127
|
+
// code before, after or around.
|
128
|
+
withAdvice: function() {
|
129
|
+
['before', 'after', 'around'].forEach(function(m) {
|
130
|
+
this[m] = function(method, fn) {
|
131
|
+
|
132
|
+
utils.mutateProperty(this, method, function() {
|
133
|
+
if (typeof this[method] == 'function') {
|
134
|
+
this[method] = advice[m](this[method], fn);
|
135
|
+
} else {
|
136
|
+
this[method] = fn;
|
137
|
+
}
|
138
|
+
|
139
|
+
return this[method];
|
140
|
+
});
|
141
|
+
|
142
|
+
};
|
143
|
+
}, this);
|
144
|
+
}
|
145
|
+
};
|
146
|
+
|
147
|
+
return advice;
|
148
|
+
}.apply(null, __WEBPACK_AMD_DEFINE_ARRAY__)), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
149
|
+
|
14
150
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
151
|
+
/***/ },
|
152
|
+
/* 2 */
|
153
|
+
/***/ function(module, exports, __webpack_require__) {
|
154
|
+
|
155
|
+
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 2013 Twitter, Inc. Licensed under The MIT License. http://opensource.org/licenses/MIT */
|
156
|
+
|
157
|
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
|
158
|
+
__webpack_require__(1),
|
159
|
+
__webpack_require__(7),
|
160
|
+
__webpack_require__(3),
|
161
|
+
__webpack_require__(8),
|
162
|
+
__webpack_require__(6),
|
163
|
+
__webpack_require__(5),
|
164
|
+
__webpack_require__(4)
|
165
|
+
], __WEBPACK_AMD_DEFINE_RESULT__ = (function(advice, utils, compose, withBase, registry, withLogging, debug) {
|
166
|
+
'use strict';
|
167
|
+
|
168
|
+
var functionNameRegEx = /function (.*?)\s?\(/;
|
169
|
+
|
170
|
+
// teardown for all instances of this constructor
|
171
|
+
function teardownAll() {
|
172
|
+
var componentInfo = registry.findComponentInfo(this);
|
173
|
+
|
174
|
+
componentInfo && Object.keys(componentInfo.instances).forEach(function(k) {
|
175
|
+
var info = componentInfo.instances[k];
|
176
|
+
// It's possible that a previous teardown caused another component to teardown,
|
177
|
+
// so we can't assume that the instances object is as it was.
|
178
|
+
if (info && info.instance) {
|
179
|
+
info.instance.teardown();
|
180
|
+
}
|
181
|
+
});
|
19
182
|
}
|
20
|
-
|
21
|
-
|
183
|
+
|
184
|
+
function attachTo(selector/*, options args */) {
|
185
|
+
// unpacking arguments by hand benchmarked faster
|
186
|
+
var l = arguments.length;
|
187
|
+
var args = new Array(l - 1);
|
188
|
+
for (var i = 1; i < l; i++) {
|
189
|
+
args[i - 1] = arguments[i];
|
190
|
+
}
|
191
|
+
|
192
|
+
if (!selector) {
|
193
|
+
throw new Error('Component needs to be attachTo\'d a jQuery object, native node or selector string');
|
194
|
+
}
|
195
|
+
|
196
|
+
var options = utils.merge.apply(utils, args);
|
197
|
+
var componentInfo = registry.findComponentInfo(this);
|
198
|
+
|
199
|
+
$(selector).each(function(i, node) {
|
200
|
+
if (componentInfo && componentInfo.isAttachedTo(node)) {
|
201
|
+
// already attached
|
202
|
+
return;
|
203
|
+
}
|
204
|
+
|
205
|
+
(new this).initialize(node, options);
|
206
|
+
}.bind(this));
|
22
207
|
}
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
208
|
+
|
209
|
+
function prettyPrintMixins() {
|
210
|
+
//could be called from constructor or constructor.prototype
|
211
|
+
var mixedIn = this.mixedIn || this.prototype.mixedIn || [];
|
212
|
+
return mixedIn.map(function(mixin) {
|
213
|
+
if (mixin.name == null) {
|
214
|
+
// function name property not supported by this browser, use regex
|
215
|
+
var m = mixin.toString().match(functionNameRegEx);
|
216
|
+
return (m && m[1]) ? m[1] : '';
|
217
|
+
} else {
|
218
|
+
return (mixin.name != 'withBase') ? mixin.name : '';
|
219
|
+
}
|
220
|
+
}).filter(Boolean).join(', ');
|
221
|
+
};
|
222
|
+
|
223
|
+
|
224
|
+
// define the constructor for a custom component type
|
225
|
+
// takes an unlimited number of mixin functions as arguments
|
226
|
+
// typical api call with 3 mixins: define(timeline, withTweetCapability, withScrollCapability);
|
227
|
+
function define(/*mixins*/) {
|
228
|
+
// unpacking arguments by hand benchmarked faster
|
229
|
+
var l = arguments.length;
|
230
|
+
var mixins = new Array(l);
|
231
|
+
for (var i = 0; i < l; i++) {
|
232
|
+
mixins[i] = arguments[i];
|
35
233
|
}
|
36
|
-
|
37
|
-
|
38
|
-
|
234
|
+
|
235
|
+
var Component = function() {};
|
236
|
+
|
237
|
+
Component.toString = Component.prototype.toString = prettyPrintMixins;
|
238
|
+
if (debug.enabled) {
|
239
|
+
Component.describe = Component.prototype.describe = Component.toString();
|
39
240
|
}
|
40
|
-
|
41
|
-
|
241
|
+
|
242
|
+
// 'options' is optional hash to be merged with 'defaults' in the component definition
|
243
|
+
Component.attachTo = attachTo;
|
244
|
+
// enables extension of existing "base" Components
|
245
|
+
Component.mixin = function() {
|
246
|
+
var newComponent = define(); //TODO: fix pretty print
|
247
|
+
var newPrototype = Object.create(Component.prototype);
|
248
|
+
newPrototype.mixedIn = [].concat(Component.prototype.mixedIn);
|
249
|
+
newPrototype.defaults = utils.merge(Component.prototype.defaults);
|
250
|
+
newPrototype.attrDef = Component.prototype.attrDef;
|
251
|
+
compose.mixin(newPrototype, arguments);
|
252
|
+
newComponent.prototype = newPrototype;
|
253
|
+
newComponent.prototype.constructor = newComponent;
|
254
|
+
return newComponent;
|
255
|
+
};
|
256
|
+
Component.teardownAll = teardownAll;
|
257
|
+
|
258
|
+
// prepend common mixins to supplied list, then mixin all flavors
|
259
|
+
if (debug.enabled) {
|
260
|
+
mixins.unshift(withLogging);
|
42
261
|
}
|
43
|
-
|
262
|
+
mixins.unshift(withBase, advice.withAdvice, registry.withRegistration);
|
263
|
+
compose.mixin(Component.prototype, mixins);
|
264
|
+
|
265
|
+
return Component;
|
266
|
+
}
|
267
|
+
|
268
|
+
define.teardownAll = function() {
|
269
|
+
registry.components.slice().forEach(function(c) {
|
270
|
+
c.component.teardownAll();
|
271
|
+
});
|
272
|
+
registry.reset();
|
273
|
+
};
|
274
|
+
|
275
|
+
return define;
|
276
|
+
}.apply(null, __WEBPACK_AMD_DEFINE_ARRAY__)), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
277
|
+
|
278
|
+
|
279
|
+
/***/ },
|
280
|
+
/* 3 */
|
281
|
+
/***/ function(module, exports, __webpack_require__) {
|
282
|
+
|
283
|
+
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 2013 Twitter, Inc. Licensed under The MIT License. http://opensource.org/licenses/MIT */
|
284
|
+
|
285
|
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
|
286
|
+
__webpack_require__(7)
|
287
|
+
], __WEBPACK_AMD_DEFINE_RESULT__ = (function(utils) {
|
288
|
+
'use strict';
|
289
|
+
|
290
|
+
var dontLock = ['mixedIn', 'attrDef'];
|
291
|
+
|
292
|
+
function setWritability(obj, writable) {
|
293
|
+
Object.keys(obj).forEach(function (key) {
|
294
|
+
if (dontLock.indexOf(key) < 0) {
|
295
|
+
utils.propertyWritability(obj, key, writable);
|
296
|
+
}
|
297
|
+
});
|
44
298
|
}
|
45
299
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
}
|
300
|
+
function mixin(base, mixins) {
|
301
|
+
base.mixedIn = base.hasOwnProperty('mixedIn') ? base.mixedIn : [];
|
302
|
+
|
303
|
+
for (var i = 0; i < mixins.length; i++) {
|
304
|
+
if (base.mixedIn.indexOf(mixins[i]) == -1) {
|
305
|
+
setWritability(base, false);
|
306
|
+
mixins[i].call(base);
|
307
|
+
base.mixedIn.push(mixins[i]);
|
308
|
+
}
|
55
309
|
}
|
310
|
+
|
311
|
+
setWritability(base, true);
|
56
312
|
}
|
57
313
|
|
58
|
-
return
|
59
|
-
|
314
|
+
return {
|
315
|
+
mixin: mixin
|
316
|
+
};
|
317
|
+
|
318
|
+
}.apply(null, __WEBPACK_AMD_DEFINE_ARRAY__)), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
319
|
+
|
320
|
+
|
321
|
+
/***/ },
|
322
|
+
/* 4 */
|
323
|
+
/***/ function(module, exports, __webpack_require__) {
|
60
324
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
// http://opensource.org/licenses/MIT
|
65
|
-
// ==========================================
|
66
|
-
define('lib/debug', [], function () {
|
325
|
+
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 2013 Twitter, Inc. Licensed under The MIT License. http://opensource.org/licenses/MIT */
|
326
|
+
|
327
|
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = (function(registry) {
|
67
328
|
'use strict';
|
329
|
+
|
68
330
|
// ==========================================
|
69
331
|
// Search object model
|
70
332
|
// ==========================================
|
333
|
+
|
71
334
|
function traverse(util, searchTerm, options) {
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
typeof obj[prop],
|
85
|
-
')'
|
86
|
-
].join(''), obj[prop]);
|
87
|
-
}
|
88
|
-
if (Object.prototype.toString.call(obj[prop]) == '[object Object]' && obj[prop] != obj && path.split('.').indexOf(prop) == -1) {
|
89
|
-
traverse(util, searchTerm, {
|
90
|
-
obj: obj[prop],
|
91
|
-
path: [
|
92
|
-
path,
|
93
|
-
prop
|
94
|
-
].join('.')
|
95
|
-
});
|
96
|
-
}
|
97
|
-
});
|
335
|
+
options = options || {};
|
336
|
+
var obj = options.obj || window;
|
337
|
+
var path = options.path || ((obj == window) ? 'window' : '');
|
338
|
+
var props = Object.keys(obj);
|
339
|
+
props.forEach(function(prop) {
|
340
|
+
if ((tests[util] || util)(searchTerm, obj, prop)) {
|
341
|
+
console.log([path, '.', prop].join(''), '->', ['(', typeof obj[prop], ')'].join(''), obj[prop]);
|
342
|
+
}
|
343
|
+
if (Object.prototype.toString.call(obj[prop]) == '[object Object]' && (obj[prop] != obj) && path.split('.').indexOf(prop) == -1) {
|
344
|
+
traverse(util, searchTerm, {obj: obj[prop], path: [path,prop].join('.')});
|
345
|
+
}
|
346
|
+
});
|
98
347
|
}
|
348
|
+
|
99
349
|
function search(util, expected, searchTerm, options) {
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
'must be',
|
106
|
-
expected
|
107
|
-
].join(' '));
|
108
|
-
}
|
350
|
+
if (!expected || typeof searchTerm == expected) {
|
351
|
+
traverse(util, searchTerm, options);
|
352
|
+
} else {
|
353
|
+
console.error([searchTerm, 'must be', expected].join(' '));
|
354
|
+
}
|
109
355
|
}
|
356
|
+
|
110
357
|
var tests = {
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
}
|
126
|
-
};
|
127
|
-
function byName(searchTerm, options) {
|
128
|
-
search('name', 'string', searchTerm, options);
|
129
|
-
}
|
130
|
-
function byNameContains(searchTerm, options) {
|
131
|
-
search('nameContains', 'string', searchTerm, options);
|
132
|
-
}
|
133
|
-
function byType(searchTerm, options) {
|
134
|
-
search('type', 'function', searchTerm, options);
|
135
|
-
}
|
136
|
-
function byValue(searchTerm, options) {
|
137
|
-
search('value', null, searchTerm, options);
|
138
|
-
}
|
139
|
-
function byValueCoerced(searchTerm, options) {
|
140
|
-
search('valueCoerced', null, searchTerm, options);
|
141
|
-
}
|
142
|
-
function custom(fn, options) {
|
143
|
-
traverse(fn, null, options);
|
144
|
-
}
|
358
|
+
'name': function(searchTerm, obj, prop) {return searchTerm == prop;},
|
359
|
+
'nameContains': function(searchTerm, obj, prop) {return prop.indexOf(searchTerm) > -1;},
|
360
|
+
'type': function(searchTerm, obj, prop) {return obj[prop] instanceof searchTerm;},
|
361
|
+
'value': function(searchTerm, obj, prop) {return obj[prop] === searchTerm;},
|
362
|
+
'valueCoerced': function(searchTerm, obj, prop) {return obj[prop] == searchTerm;}
|
363
|
+
};
|
364
|
+
|
365
|
+
function byName(searchTerm, options) {search('name', 'string', searchTerm, options);}
|
366
|
+
function byNameContains(searchTerm, options) {search('nameContains', 'string', searchTerm, options);}
|
367
|
+
function byType(searchTerm, options) {search('type', 'function', searchTerm, options);}
|
368
|
+
function byValue(searchTerm, options) {search('value', null, searchTerm, options);}
|
369
|
+
function byValueCoerced(searchTerm, options) {search('valueCoerced', null, searchTerm, options);}
|
370
|
+
function custom(fn, options) {traverse(fn, null, options);}
|
371
|
+
|
145
372
|
// ==========================================
|
146
373
|
// Event logging
|
147
374
|
// ==========================================
|
148
|
-
|
149
|
-
//no filter
|
375
|
+
|
376
|
+
var ALL = 'all'; //no filter
|
377
|
+
|
150
378
|
//log nothing by default
|
151
379
|
var logFilter = {
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
380
|
+
eventNames: [],
|
381
|
+
actions: []
|
382
|
+
}
|
383
|
+
|
384
|
+
function filterEventLogsByAction(/*actions*/) {
|
385
|
+
var actions = [].slice.call(arguments);
|
386
|
+
|
387
|
+
logFilter.eventNames.length || (logFilter.eventNames = ALL);
|
388
|
+
logFilter.actions = actions.length ? actions : ALL;
|
389
|
+
saveLogFilter();
|
160
390
|
}
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
391
|
+
|
392
|
+
function filterEventLogsByName(/*eventNames*/) {
|
393
|
+
var eventNames = [].slice.call(arguments);
|
394
|
+
|
395
|
+
logFilter.actions.length || (logFilter.actions = ALL);
|
396
|
+
logFilter.eventNames = eventNames.length ? eventNames : ALL;
|
397
|
+
saveLogFilter();
|
166
398
|
}
|
399
|
+
|
167
400
|
function hideAllEventLogs() {
|
168
|
-
|
169
|
-
|
170
|
-
|
401
|
+
logFilter.actions = [];
|
402
|
+
logFilter.eventNames = [];
|
403
|
+
saveLogFilter();
|
171
404
|
}
|
405
|
+
|
172
406
|
function showAllEventLogs() {
|
173
|
-
|
174
|
-
|
175
|
-
|
407
|
+
logFilter.actions = ALL;
|
408
|
+
logFilter.eventNames = ALL;
|
409
|
+
saveLogFilter();
|
176
410
|
}
|
411
|
+
|
177
412
|
function saveLogFilter() {
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
}
|
183
|
-
} catch (ignored) {
|
413
|
+
try {
|
414
|
+
if (window.localStorage) {
|
415
|
+
localStorage.setItem('logFilter_eventNames', logFilter.eventNames);
|
416
|
+
localStorage.setItem('logFilter_actions', logFilter.actions);
|
184
417
|
}
|
185
|
-
|
418
|
+
} catch (ignored) {};
|
186
419
|
}
|
420
|
+
|
187
421
|
function retrieveLogFilter() {
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
422
|
+
var eventNames, actions;
|
423
|
+
try {
|
424
|
+
eventNames = (window.localStorage && localStorage.getItem('logFilter_eventNames'));
|
425
|
+
actions = (window.localStorage && localStorage.getItem('logFilter_actions'));
|
426
|
+
} catch (ignored) {
|
427
|
+
return;
|
428
|
+
}
|
429
|
+
eventNames && (logFilter.eventNames = eventNames);
|
430
|
+
actions && (logFilter.actions = actions);
|
431
|
+
|
432
|
+
// reconstitute arrays in place
|
433
|
+
Object.keys(logFilter).forEach(function(k) {
|
434
|
+
var thisProp = logFilter[k];
|
435
|
+
if (typeof thisProp == 'string' && thisProp !== ALL) {
|
436
|
+
logFilter[k] = thisProp ? thisProp.split(',') : [];
|
194
437
|
}
|
195
|
-
|
196
|
-
actions && (logFilter.actions = actions);
|
197
|
-
// reconstitute arrays in place
|
198
|
-
Object.keys(logFilter).forEach(function (k) {
|
199
|
-
var thisProp = logFilter[k];
|
200
|
-
if (typeof thisProp == 'string' && thisProp !== ALL) {
|
201
|
-
logFilter[k] = thisProp ? thisProp.split(',') : [];
|
202
|
-
}
|
203
|
-
});
|
438
|
+
});
|
204
439
|
}
|
440
|
+
|
205
441
|
return {
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
window.DEBUG = this;
|
214
|
-
},
|
215
|
-
find: {
|
216
|
-
byName: byName,
|
217
|
-
byNameContains: byNameContains,
|
218
|
-
byType: byType,
|
219
|
-
byValue: byValue,
|
220
|
-
byValueCoerced: byValueCoerced,
|
221
|
-
custom: custom
|
222
|
-
},
|
223
|
-
events: {
|
224
|
-
logFilter: logFilter,
|
225
|
-
logByAction: filterEventLogsByAction,
|
226
|
-
logByName: filterEventLogsByName,
|
227
|
-
logAll: showAllEventLogs,
|
228
|
-
logNone: hideAllEventLogs
|
442
|
+
|
443
|
+
enable: function(enable) {
|
444
|
+
this.enabled = !!enable;
|
445
|
+
|
446
|
+
if (enable && window.console) {
|
447
|
+
console.info('Booting in DEBUG mode');
|
448
|
+
console.info('You can configure event logging with DEBUG.events.logAll()/logNone()/logByName()/logByAction()');
|
229
449
|
}
|
450
|
+
|
451
|
+
retrieveLogFilter();
|
452
|
+
|
453
|
+
window.DEBUG = this;
|
454
|
+
},
|
455
|
+
|
456
|
+
registry: registry,
|
457
|
+
|
458
|
+
find: {
|
459
|
+
byName: byName,
|
460
|
+
byNameContains: byNameContains,
|
461
|
+
byType: byType,
|
462
|
+
byValue: byValue,
|
463
|
+
byValueCoerced: byValueCoerced,
|
464
|
+
custom: custom
|
465
|
+
},
|
466
|
+
|
467
|
+
events: {
|
468
|
+
logFilter: logFilter,
|
469
|
+
|
470
|
+
// Accepts any number of action args
|
471
|
+
// e.g. DEBUG.events.logByAction("on", "off")
|
472
|
+
logByAction: filterEventLogsByAction,
|
473
|
+
|
474
|
+
// Accepts any number of event name args (inc. regex or wildcards)
|
475
|
+
// e.g. DEBUG.events.logByName(/ui.*/, "*Thread*");
|
476
|
+
logByName: filterEventLogsByName,
|
477
|
+
|
478
|
+
logAll: showAllEventLogs,
|
479
|
+
logNone: hideAllEventLogs
|
480
|
+
}
|
230
481
|
};
|
231
|
-
});
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
482
|
+
}.apply(null, __WEBPACK_AMD_DEFINE_ARRAY__)), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
483
|
+
|
484
|
+
|
485
|
+
/***/ },
|
486
|
+
/* 5 */
|
487
|
+
/***/ function(module, exports, __webpack_require__) {
|
488
|
+
|
489
|
+
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 2013 Twitter, Inc. Licensed under The MIT License. http://opensource.org/licenses/MIT */
|
490
|
+
|
491
|
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
|
492
|
+
__webpack_require__(7)
|
493
|
+
], __WEBPACK_AMD_DEFINE_RESULT__ = (function(utils) {
|
238
494
|
'use strict';
|
239
|
-
|
240
|
-
var
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
495
|
+
|
496
|
+
var actionSymbols = {
|
497
|
+
on: '<-',
|
498
|
+
trigger: '->',
|
499
|
+
off: 'x '
|
500
|
+
};
|
501
|
+
|
502
|
+
function elemToString(elem) {
|
503
|
+
var tagStr = elem.tagName ? elem.tagName.toLowerCase() : elem.toString();
|
504
|
+
var classStr = elem.className ? '.' + (elem.className) : '';
|
505
|
+
var result = tagStr + classStr;
|
506
|
+
return elem.tagName ? ['\'', '\''].join(result) : result;
|
507
|
+
}
|
508
|
+
|
509
|
+
function log(action, component, eventArgs) {
|
510
|
+
if (!window.DEBUG || !window.DEBUG.enabled) {
|
511
|
+
return;
|
512
|
+
}
|
513
|
+
var name, eventType, elem, fn, payload, logFilter, toRegExp, actionLoggable, nameLoggable, info;
|
514
|
+
|
515
|
+
if (typeof eventArgs[eventArgs.length - 1] == 'function') {
|
516
|
+
fn = eventArgs.pop();
|
517
|
+
fn = fn.unbound || fn; // use unbound version if any (better info)
|
518
|
+
}
|
519
|
+
|
520
|
+
if (eventArgs.length == 1) {
|
521
|
+
elem = component.$node[0];
|
522
|
+
eventType = eventArgs[0];
|
523
|
+
} else if ((eventArgs.length == 2) && typeof eventArgs[1] == 'object' && !eventArgs[1].type) {
|
524
|
+
//2 args, first arg is not elem
|
525
|
+
elem = component.$node[0];
|
526
|
+
eventType = eventArgs[0];
|
527
|
+
if (action == "trigger") {
|
528
|
+
payload = eventArgs[1];
|
529
|
+
}
|
530
|
+
} else {
|
531
|
+
//2+ args, first arg is elem
|
532
|
+
elem = eventArgs[0];
|
533
|
+
eventType = eventArgs[1];
|
534
|
+
if (action == "trigger") {
|
535
|
+
payload = eventArgs[2];
|
250
536
|
}
|
251
|
-
|
537
|
+
}
|
538
|
+
|
539
|
+
name = typeof eventType == 'object' ? eventType.type : eventType;
|
540
|
+
|
541
|
+
logFilter = DEBUG.events.logFilter;
|
542
|
+
|
543
|
+
// no regex for you, actions...
|
544
|
+
actionLoggable = logFilter.actions == 'all' || (logFilter.actions.indexOf(action) > -1);
|
545
|
+
// event name filter allow wildcards or regex...
|
546
|
+
toRegExp = function(expr) {
|
547
|
+
return expr.test ? expr : new RegExp('^' + expr.replace(/\*/g, '.*') + '$');
|
548
|
+
};
|
549
|
+
nameLoggable =
|
550
|
+
logFilter.eventNames == 'all' ||
|
551
|
+
logFilter.eventNames.some(function(e) {return toRegExp(e).test(name);});
|
552
|
+
|
553
|
+
if (actionLoggable && nameLoggable) {
|
554
|
+
info = [actionSymbols[action], action, '[' + name + ']'];
|
555
|
+
payload && info.push(payload);
|
556
|
+
info.push(elemToString(elem));
|
557
|
+
info.push(component.constructor.describe.split(' ').slice(0,3).join(' '));
|
558
|
+
console.groupCollapsed && action == 'trigger' && console.groupCollapsed(action, name);
|
559
|
+
console.info.apply(console, info);
|
560
|
+
}
|
252
561
|
}
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
// unpacking arguments by hand benchmarked faster
|
262
|
-
var l = arguments.length, args = new Array(l + 1);
|
263
|
-
if (l === 0) {
|
264
|
-
return {};
|
265
|
-
}
|
266
|
-
for (var i = 0; i < l; i++)
|
267
|
-
args[i + 1] = arguments[i];
|
268
|
-
//start with empty object so a copy is created
|
269
|
-
args[0] = {};
|
270
|
-
if (args[args.length - 1] === true) {
|
271
|
-
//jquery extend requires deep copy as first arg
|
272
|
-
args.pop();
|
273
|
-
args.unshift(true);
|
274
|
-
}
|
275
|
-
return $.extend.apply(undefined, args);
|
276
|
-
},
|
277
|
-
push: function (base, extra, protect) {
|
278
|
-
if (base) {
|
279
|
-
Object.keys(extra || {}).forEach(function (key) {
|
280
|
-
if (base[key] && protect) {
|
281
|
-
throw new Error('utils.push attempted to overwrite "' + key + '" while running in protected mode');
|
282
|
-
}
|
283
|
-
if (typeof base[key] == 'object' && typeof extra[key] == 'object') {
|
284
|
-
// recurse
|
285
|
-
this.push(base[key], extra[key]);
|
286
|
-
} else {
|
287
|
-
// no protect, so extra wins
|
288
|
-
base[key] = extra[key];
|
289
|
-
}
|
290
|
-
}, this);
|
291
|
-
}
|
292
|
-
return base;
|
293
|
-
},
|
294
|
-
isEnumerable: function (obj, property) {
|
295
|
-
return Object.keys(obj).indexOf(property) > -1;
|
296
|
-
},
|
297
|
-
compose: function () {
|
298
|
-
var funcs = arguments;
|
299
|
-
return function () {
|
300
|
-
var args = arguments;
|
301
|
-
for (var i = funcs.length - 1; i >= 0; i--) {
|
302
|
-
args = [funcs[i].apply(this, args)];
|
303
|
-
}
|
304
|
-
return args[0];
|
305
|
-
};
|
306
|
-
},
|
307
|
-
uniqueArray: function (array) {
|
308
|
-
var u = {}, a = [];
|
309
|
-
for (var i = 0, l = array.length; i < l; ++i) {
|
310
|
-
if (u.hasOwnProperty(array[i])) {
|
311
|
-
continue;
|
312
|
-
}
|
313
|
-
a.push(array[i]);
|
314
|
-
u[array[i]] = 1;
|
315
|
-
}
|
316
|
-
return a;
|
317
|
-
},
|
318
|
-
debounce: function (func, wait, immediate) {
|
319
|
-
if (typeof wait != 'number') {
|
320
|
-
wait = DEFAULT_INTERVAL;
|
321
|
-
}
|
322
|
-
var timeout, result;
|
323
|
-
return function () {
|
324
|
-
var context = this, args = arguments;
|
325
|
-
var later = function () {
|
326
|
-
timeout = null;
|
327
|
-
if (!immediate) {
|
328
|
-
result = func.apply(context, args);
|
329
|
-
}
|
330
|
-
};
|
331
|
-
var callNow = immediate && !timeout;
|
332
|
-
clearTimeout(timeout);
|
333
|
-
timeout = setTimeout(later, wait);
|
334
|
-
if (callNow) {
|
335
|
-
result = func.apply(context, args);
|
336
|
-
}
|
337
|
-
return result;
|
338
|
-
};
|
339
|
-
},
|
340
|
-
throttle: function (func, wait) {
|
341
|
-
if (typeof wait != 'number') {
|
342
|
-
wait = DEFAULT_INTERVAL;
|
343
|
-
}
|
344
|
-
var context, args, timeout, throttling, more, result;
|
345
|
-
var whenDone = this.debounce(function () {
|
346
|
-
more = throttling = false;
|
347
|
-
}, wait);
|
348
|
-
return function () {
|
349
|
-
context = this;
|
350
|
-
args = arguments;
|
351
|
-
var later = function () {
|
352
|
-
timeout = null;
|
353
|
-
if (more) {
|
354
|
-
result = func.apply(context, args);
|
355
|
-
}
|
356
|
-
whenDone();
|
357
|
-
};
|
358
|
-
if (!timeout) {
|
359
|
-
timeout = setTimeout(later, wait);
|
360
|
-
}
|
361
|
-
if (throttling) {
|
362
|
-
more = true;
|
363
|
-
} else {
|
364
|
-
throttling = true;
|
365
|
-
result = func.apply(context, args);
|
366
|
-
}
|
367
|
-
whenDone();
|
368
|
-
return result;
|
369
|
-
};
|
370
|
-
},
|
371
|
-
countThen: function (num, base) {
|
372
|
-
return function () {
|
373
|
-
if (!--num) {
|
374
|
-
return base.apply(this, arguments);
|
375
|
-
}
|
376
|
-
};
|
377
|
-
},
|
378
|
-
delegate: function (rules) {
|
379
|
-
return function (e, data) {
|
380
|
-
var target = $(e.target), parent;
|
381
|
-
Object.keys(rules).forEach(function (selector) {
|
382
|
-
if (!e.isPropagationStopped() && (parent = target.closest(selector)).length) {
|
383
|
-
data = data || {};
|
384
|
-
data.el = parent[0];
|
385
|
-
return rules[selector].apply(this, [
|
386
|
-
e,
|
387
|
-
data
|
388
|
-
]);
|
389
|
-
}
|
390
|
-
}, this);
|
391
|
-
};
|
392
|
-
},
|
393
|
-
once: function (func) {
|
394
|
-
var ran, result;
|
395
|
-
return function () {
|
396
|
-
if (ran) {
|
397
|
-
return result;
|
398
|
-
}
|
399
|
-
ran = true;
|
400
|
-
result = func.apply(this, arguments);
|
401
|
-
return result;
|
402
|
-
};
|
403
|
-
},
|
404
|
-
propertyWritability: function (obj, prop, writable) {
|
405
|
-
if (canWriteProtect() && obj.hasOwnProperty(prop)) {
|
406
|
-
Object.defineProperty(obj, prop, { writable: writable });
|
407
|
-
}
|
408
|
-
},
|
409
|
-
mutateProperty: function (obj, prop, op) {
|
410
|
-
var writable;
|
411
|
-
if (!canWriteProtect() || !obj.hasOwnProperty(prop)) {
|
412
|
-
op.call(obj);
|
413
|
-
return;
|
414
|
-
}
|
415
|
-
writable = Object.getOwnPropertyDescriptor(obj, prop).writable;
|
416
|
-
Object.defineProperty(obj, prop, { writable: true });
|
417
|
-
op.call(obj);
|
418
|
-
Object.defineProperty(obj, prop, { writable: writable });
|
419
|
-
}
|
420
|
-
};
|
421
|
-
return utils;
|
422
|
-
});
|
423
|
-
// ==========================================
|
424
|
-
// Copyright 2013 Twitter, Inc
|
425
|
-
// Licensed under The MIT License
|
426
|
-
// http://opensource.org/licenses/MIT
|
427
|
-
// ==========================================
|
428
|
-
define('lib/compose', ['./utils'], function (utils) {
|
429
|
-
'use strict';
|
430
|
-
var dontLock = ['mixedIn'];
|
431
|
-
function setWritability(obj, writable) {
|
432
|
-
var props = Object.create(null);
|
433
|
-
Object.keys(obj).forEach(function (key) {
|
434
|
-
if (dontLock.indexOf(key) < 0) {
|
435
|
-
utils.propertyWritability(obj, key, writable);
|
436
|
-
}
|
562
|
+
|
563
|
+
function withLogging() {
|
564
|
+
this.before('trigger', function() {
|
565
|
+
log('trigger', this, utils.toArray(arguments));
|
566
|
+
});
|
567
|
+
if (console.groupCollapsed) {
|
568
|
+
this.after('trigger', function() {
|
569
|
+
console.groupEnd();
|
437
570
|
});
|
571
|
+
}
|
572
|
+
this.before('on', function() {
|
573
|
+
log('on', this, utils.toArray(arguments));
|
574
|
+
});
|
575
|
+
this.before('off', function() {
|
576
|
+
log('off', this, utils.toArray(arguments));
|
577
|
+
});
|
438
578
|
}
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
});
|
452
|
-
// ==========================================
|
453
|
-
// Copyright 2013 Twitter, Inc
|
454
|
-
// Licensed under The MIT License
|
455
|
-
// http://opensource.org/licenses/MIT
|
456
|
-
// ==========================================
|
457
|
-
define('lib/advice', [
|
458
|
-
'./compose',
|
459
|
-
'./utils'
|
460
|
-
], function (compose, utils) {
|
461
|
-
'use strict';
|
462
|
-
var advice = {
|
463
|
-
around: function (base, wrapped) {
|
464
|
-
return function composedAround() {
|
465
|
-
// unpacking arguments by hand benchmarked faster
|
466
|
-
var i = 0, l = arguments.length, args = new Array(l + 1);
|
467
|
-
args[0] = base.bind(this);
|
468
|
-
for (; i < l; i++)
|
469
|
-
args[i + 1] = arguments[i];
|
470
|
-
return wrapped.apply(this, args);
|
471
|
-
};
|
472
|
-
},
|
473
|
-
before: function (base, before) {
|
474
|
-
var beforeFn = typeof before == 'function' ? before : before.obj[before.fnName];
|
475
|
-
return function composedBefore() {
|
476
|
-
beforeFn.apply(this, arguments);
|
477
|
-
return base.apply(this, arguments);
|
478
|
-
};
|
479
|
-
},
|
480
|
-
after: function (base, after) {
|
481
|
-
var afterFn = typeof after == 'function' ? after : after.obj[after.fnName];
|
482
|
-
return function composedAfter() {
|
483
|
-
var res = (base.unbound || base).apply(this, arguments);
|
484
|
-
afterFn.apply(this, arguments);
|
485
|
-
return res;
|
486
|
-
};
|
487
|
-
},
|
488
|
-
withAdvice: function () {
|
489
|
-
[
|
490
|
-
'before',
|
491
|
-
'after',
|
492
|
-
'around'
|
493
|
-
].forEach(function (m) {
|
494
|
-
this[m] = function (method, fn) {
|
495
|
-
utils.mutateProperty(this, method, function () {
|
496
|
-
if (typeof this[method] == 'function') {
|
497
|
-
this[method] = advice[m](this[method], fn);
|
498
|
-
} else {
|
499
|
-
this[method] = fn;
|
500
|
-
}
|
501
|
-
return this[method];
|
502
|
-
});
|
503
|
-
};
|
504
|
-
}, this);
|
505
|
-
}
|
506
|
-
};
|
507
|
-
return advice;
|
508
|
-
});
|
509
|
-
// ==========================================
|
510
|
-
// Copyright 2013 Twitter, Inc
|
511
|
-
// Licensed under The MIT License
|
512
|
-
// http://opensource.org/licenses/MIT
|
513
|
-
// ==========================================
|
514
|
-
define('lib/registry', [], function () {
|
579
|
+
|
580
|
+
return withLogging;
|
581
|
+
}.apply(null, __WEBPACK_AMD_DEFINE_ARRAY__)), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
582
|
+
|
583
|
+
|
584
|
+
/***/ },
|
585
|
+
/* 6 */
|
586
|
+
/***/ function(module, exports, __webpack_require__) {
|
587
|
+
|
588
|
+
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 2013 Twitter, Inc. Licensed under The MIT License. http://opensource.org/licenses/MIT */
|
589
|
+
|
590
|
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
|
515
591
|
'use strict';
|
592
|
+
|
516
593
|
function parseEventArgs(instance, args) {
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
594
|
+
var element, type, callback;
|
595
|
+
var end = args.length;
|
596
|
+
|
597
|
+
if (typeof args[end - 1] === 'function') {
|
598
|
+
end -= 1;
|
599
|
+
callback = args[end];
|
600
|
+
}
|
601
|
+
|
602
|
+
if (typeof args[end - 1] === 'object') {
|
603
|
+
end -= 1;
|
604
|
+
}
|
605
|
+
|
606
|
+
if (end == 2) {
|
607
|
+
element = args[0];
|
608
|
+
type = args[1];
|
609
|
+
} else {
|
610
|
+
element = instance.node;
|
611
|
+
type = args[0];
|
612
|
+
}
|
613
|
+
|
614
|
+
return {
|
615
|
+
element: element,
|
616
|
+
type: type,
|
617
|
+
callback: callback
|
618
|
+
};
|
538
619
|
}
|
620
|
+
|
539
621
|
function matchEvent(a, b) {
|
540
|
-
|
622
|
+
return (
|
623
|
+
(a.element == b.element) &&
|
624
|
+
(a.type == b.type) &&
|
625
|
+
(b.callback == null || (a.callback == b.callback))
|
626
|
+
);
|
541
627
|
}
|
628
|
+
|
542
629
|
function Registry() {
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
}
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
if (!Object.keys(this.instances).length) {
|
564
|
-
//if I hold no more instances remove me from registry
|
565
|
-
registry.removeComponentInfo(this);
|
566
|
-
}
|
567
|
-
};
|
568
|
-
this.isAttachedTo = function (node) {
|
569
|
-
return this.attachedTo.indexOf(node) > -1;
|
570
|
-
};
|
571
|
-
}
|
572
|
-
function InstanceInfo(instance) {
|
573
|
-
this.instance = instance;
|
574
|
-
this.events = [];
|
575
|
-
this.addBind = function (event) {
|
576
|
-
this.events.push(event);
|
577
|
-
registry.events.push(event);
|
578
|
-
};
|
579
|
-
this.removeBind = function (event) {
|
580
|
-
for (var i = 0, e; e = this.events[i]; i++) {
|
581
|
-
if (matchEvent(e, event)) {
|
582
|
-
this.events.splice(i, 1);
|
583
|
-
}
|
584
|
-
}
|
585
|
-
};
|
586
|
-
}
|
587
|
-
this.addInstance = function (instance) {
|
588
|
-
var component = this.findComponentInfo(instance);
|
589
|
-
if (!component) {
|
590
|
-
component = new ComponentInfo(instance.constructor);
|
591
|
-
this.components.push(component);
|
592
|
-
}
|
593
|
-
var inst = component.addInstance(instance);
|
594
|
-
this.allInstances[instance.identity] = inst;
|
595
|
-
return component;
|
596
|
-
};
|
597
|
-
this.removeInstance = function (instance) {
|
598
|
-
var index, instInfo = this.findInstanceInfo(instance);
|
599
|
-
//remove from component info
|
600
|
-
var componentInfo = this.findComponentInfo(instance);
|
601
|
-
componentInfo && componentInfo.removeInstance(instance);
|
602
|
-
//remove from registry
|
603
|
-
delete this.allInstances[instance.identity];
|
604
|
-
};
|
605
|
-
this.removeComponentInfo = function (componentInfo) {
|
606
|
-
var index = this.components.indexOf(componentInfo);
|
607
|
-
index > -1 && this.components.splice(index, 1);
|
608
|
-
};
|
609
|
-
this.findComponentInfo = function (which) {
|
610
|
-
var component = which.attachTo ? which : which.constructor;
|
611
|
-
for (var i = 0, c; c = this.components[i]; i++) {
|
612
|
-
if (c.component === component) {
|
613
|
-
return c;
|
614
|
-
}
|
615
|
-
}
|
616
|
-
return null;
|
617
|
-
};
|
618
|
-
this.findInstanceInfo = function (instance) {
|
619
|
-
return this.allInstances[instance.identity] || null;
|
630
|
+
|
631
|
+
var registry = this;
|
632
|
+
|
633
|
+
(this.reset = function() {
|
634
|
+
this.components = [];
|
635
|
+
this.allInstances = {};
|
636
|
+
this.events = [];
|
637
|
+
}).call(this);
|
638
|
+
|
639
|
+
function ComponentInfo(component) {
|
640
|
+
this.component = component;
|
641
|
+
this.attachedTo = [];
|
642
|
+
this.instances = {};
|
643
|
+
|
644
|
+
this.addInstance = function(instance) {
|
645
|
+
var instanceInfo = new InstanceInfo(instance);
|
646
|
+
this.instances[instance.identity] = instanceInfo;
|
647
|
+
this.attachedTo.push(instance.node);
|
648
|
+
|
649
|
+
return instanceInfo;
|
620
650
|
};
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
651
|
+
|
652
|
+
this.removeInstance = function(instance) {
|
653
|
+
delete this.instances[instance.identity];
|
654
|
+
var indexOfNode = this.attachedTo.indexOf(instance.node);
|
655
|
+
(indexOfNode > -1) && this.attachedTo.splice(indexOfNode, 1);
|
656
|
+
|
657
|
+
if (!Object.keys(this.instances).length) {
|
658
|
+
//if I hold no more instances remove me from registry
|
659
|
+
registry.removeComponentInfo(this);
|
660
|
+
}
|
625
661
|
};
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
var thisInstanceInfo = this.allInstances[k];
|
630
|
-
if (thisInstanceInfo.instance.node === node) {
|
631
|
-
result.push(thisInstanceInfo);
|
632
|
-
}
|
633
|
-
}, this);
|
634
|
-
return result;
|
662
|
+
|
663
|
+
this.isAttachedTo = function(node) {
|
664
|
+
return this.attachedTo.indexOf(node) > -1;
|
635
665
|
};
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
if (boundCallback) {
|
646
|
-
otherArgs[otherArgs.length - 1] = boundCallback;
|
647
|
-
}
|
648
|
-
var event = parseEventArgs(this, otherArgs);
|
649
|
-
instance.addBind(event);
|
650
|
-
}
|
666
|
+
}
|
667
|
+
|
668
|
+
function InstanceInfo(instance) {
|
669
|
+
this.instance = instance;
|
670
|
+
this.events = [];
|
671
|
+
|
672
|
+
this.addBind = function(event) {
|
673
|
+
this.events.push(event);
|
674
|
+
registry.events.push(event);
|
651
675
|
};
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
//remove from global event registry
|
658
|
-
for (var i = 0, e; e = registry.events[i]; i++) {
|
659
|
-
if (matchEvent(e, event)) {
|
660
|
-
registry.events.splice(i, 1);
|
661
|
-
}
|
676
|
+
|
677
|
+
this.removeBind = function(event) {
|
678
|
+
for (var i = 0, e; e = this.events[i]; i++) {
|
679
|
+
if (matchEvent(e, event)) {
|
680
|
+
this.events.splice(i, 1);
|
662
681
|
}
|
682
|
+
}
|
663
683
|
};
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
registry.addInstance(this);
|
673
|
-
});
|
674
|
-
this.around('on', registry.on);
|
675
|
-
this.after('off', registry.off);
|
676
|
-
//debug tools may want to add advice to trigger
|
677
|
-
window.DEBUG && DEBUG.enabled && this.after('trigger', registry.trigger);
|
678
|
-
this.after('teardown', {
|
679
|
-
obj: registry,
|
680
|
-
fnName: 'teardown'
|
681
|
-
});
|
682
|
-
};
|
683
|
-
}
|
684
|
-
return new Registry();
|
685
|
-
});
|
686
|
-
// ==========================================
|
687
|
-
// Copyright 2013 Twitter, Inc
|
688
|
-
// Licensed under The MIT License
|
689
|
-
// http://opensource.org/licenses/MIT
|
690
|
-
// ==========================================
|
691
|
-
define('lib/base', [
|
692
|
-
'./utils',
|
693
|
-
'./registry',
|
694
|
-
'./debug'
|
695
|
-
], function (utils, registry, debug) {
|
696
|
-
'use strict';
|
697
|
-
// common mixin allocates basic functionality - used by all component prototypes
|
698
|
-
// callback context is bound to component
|
699
|
-
var componentId = 0;
|
700
|
-
function teardownInstance(instanceInfo) {
|
701
|
-
instanceInfo.events.slice().forEach(function (event) {
|
702
|
-
var args = [event.type];
|
703
|
-
event.element && args.unshift(event.element);
|
704
|
-
typeof event.callback == 'function' && args.push(event.callback);
|
705
|
-
this.off.apply(this, args);
|
706
|
-
}, instanceInfo.instance);
|
707
|
-
}
|
708
|
-
function checkSerializable(type, data) {
|
709
|
-
try {
|
710
|
-
window.postMessage(data, '*');
|
711
|
-
} catch (e) {
|
712
|
-
console.log('unserializable data for event', type, ':', data);
|
713
|
-
throw new Error([
|
714
|
-
'The event',
|
715
|
-
type,
|
716
|
-
'on component',
|
717
|
-
this.toString(),
|
718
|
-
'was triggered with non-serializable data'
|
719
|
-
].join(' '));
|
720
|
-
}
|
721
|
-
}
|
722
|
-
function initAttributes(attrs) {
|
723
|
-
var definedKeys = [], incomingKeys;
|
724
|
-
this.attr = new this.attrDef();
|
725
|
-
if (debug.enabled && window.console) {
|
726
|
-
for (var key in this.attrDef.prototype)
|
727
|
-
definedKeys.push(key);
|
728
|
-
incomingKeys = Object.keys(attrs);
|
729
|
-
for (var i = incomingKeys.length - 1; i >= 0; i--) {
|
730
|
-
if (definedKeys.indexOf(incomingKeys[i]) == -1) {
|
731
|
-
console.warn('Passed unused attributes including "' + incomingKeys[i] + '" to component "' + this.toString() + '".');
|
732
|
-
break;
|
733
|
-
}
|
734
|
-
}
|
684
|
+
}
|
685
|
+
|
686
|
+
this.addInstance = function(instance) {
|
687
|
+
var component = this.findComponentInfo(instance);
|
688
|
+
|
689
|
+
if (!component) {
|
690
|
+
component = new ComponentInfo(instance.constructor);
|
691
|
+
this.components.push(component);
|
735
692
|
}
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
693
|
+
|
694
|
+
var inst = component.addInstance(instance);
|
695
|
+
|
696
|
+
this.allInstances[instance.identity] = inst;
|
697
|
+
|
698
|
+
return component;
|
699
|
+
};
|
700
|
+
|
701
|
+
this.removeInstance = function(instance) {
|
702
|
+
//remove from component info
|
703
|
+
var componentInfo = this.findComponentInfo(instance);
|
704
|
+
componentInfo && componentInfo.removeInstance(instance);
|
705
|
+
|
706
|
+
//remove from registry
|
707
|
+
delete this.allInstances[instance.identity];
|
708
|
+
};
|
709
|
+
|
710
|
+
this.removeComponentInfo = function(componentInfo) {
|
711
|
+
var index = this.components.indexOf(componentInfo);
|
712
|
+
(index > -1) && this.components.splice(index, 1);
|
713
|
+
};
|
714
|
+
|
715
|
+
this.findComponentInfo = function(which) {
|
716
|
+
var component = which.attachTo ? which : which.constructor;
|
717
|
+
|
718
|
+
for (var i = 0, c; c = this.components[i]; i++) {
|
719
|
+
if (c.component === component) {
|
720
|
+
return c;
|
721
|
+
}
|
754
722
|
}
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
723
|
+
|
724
|
+
return null;
|
725
|
+
};
|
726
|
+
|
727
|
+
this.findInstanceInfo = function(instance) {
|
728
|
+
return this.allInstances[instance.identity] || null;
|
729
|
+
};
|
730
|
+
|
731
|
+
this.getBoundEventNames = function(instance) {
|
732
|
+
return this.findInstanceInfo(instance).events.map(function(ev) {
|
733
|
+
return ev.type;
|
734
|
+
});
|
735
|
+
};
|
736
|
+
|
737
|
+
this.findInstanceInfoByNode = function(node) {
|
738
|
+
var result = [];
|
739
|
+
Object.keys(this.allInstances).forEach(function(k) {
|
740
|
+
var thisInstanceInfo = this.allInstances[k];
|
741
|
+
if (thisInstanceInfo.instance.node === node) {
|
742
|
+
result.push(thisInstanceInfo);
|
743
|
+
}
|
760
744
|
}, this);
|
745
|
+
return result;
|
746
|
+
};
|
747
|
+
|
748
|
+
this.on = function(componentOn) {
|
749
|
+
var instance = registry.findInstanceInfo(this), boundCallback;
|
750
|
+
|
751
|
+
// unpacking arguments by hand benchmarked faster
|
752
|
+
var l = arguments.length, i = 1;
|
753
|
+
var otherArgs = new Array(l - 1);
|
754
|
+
for (; i < l; i++) {
|
755
|
+
otherArgs[i - 1] = arguments[i];
|
756
|
+
}
|
757
|
+
|
758
|
+
if (instance) {
|
759
|
+
boundCallback = componentOn.apply(null, otherArgs);
|
760
|
+
if (boundCallback) {
|
761
|
+
otherArgs[otherArgs.length - 1] = boundCallback;
|
762
|
+
}
|
763
|
+
var event = parseEventArgs(this, otherArgs);
|
764
|
+
instance.addBind(event);
|
765
|
+
}
|
766
|
+
};
|
767
|
+
|
768
|
+
this.off = function(/*el, type, callback*/) {
|
769
|
+
var event = parseEventArgs(this, arguments),
|
770
|
+
instance = registry.findInstanceInfo(this);
|
771
|
+
|
772
|
+
if (instance) {
|
773
|
+
instance.removeBind(event);
|
774
|
+
}
|
775
|
+
|
776
|
+
//remove from global event registry
|
777
|
+
for (var i = 0, e; e = registry.events[i]; i++) {
|
778
|
+
if (matchEvent(e, event)) {
|
779
|
+
registry.events.splice(i, 1);
|
780
|
+
}
|
781
|
+
}
|
782
|
+
};
|
783
|
+
|
784
|
+
// debug tools may want to add advice to trigger
|
785
|
+
registry.trigger = function() {};
|
786
|
+
|
787
|
+
this.teardown = function() {
|
788
|
+
registry.removeInstance(this);
|
789
|
+
};
|
790
|
+
|
791
|
+
this.withRegistration = function() {
|
792
|
+
this.after('initialize', function() {
|
793
|
+
registry.addInstance(this);
|
794
|
+
});
|
795
|
+
|
796
|
+
this.around('on', registry.on);
|
797
|
+
this.after('off', registry.off);
|
798
|
+
//debug tools may want to add advice to trigger
|
799
|
+
window.DEBUG && (false).enabled && this.after('trigger', registry.trigger);
|
800
|
+
this.after('teardown', {obj: registry, fnName: 'teardown'});
|
801
|
+
};
|
802
|
+
|
761
803
|
}
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
804
|
+
|
805
|
+
return new Registry;
|
806
|
+
}.apply(null, __WEBPACK_AMD_DEFINE_ARRAY__)), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
807
|
+
|
808
|
+
|
809
|
+
/***/ },
|
810
|
+
/* 7 */
|
811
|
+
/***/ function(module, exports, __webpack_require__) {
|
812
|
+
|
813
|
+
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 2013 Twitter, Inc. Licensed under The MIT License. http://opensource.org/licenses/MIT */
|
814
|
+
|
815
|
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4)], __WEBPACK_AMD_DEFINE_RESULT__ = (function(debug) {
|
816
|
+
'use strict';
|
817
|
+
|
818
|
+
var DEFAULT_INTERVAL = 100;
|
819
|
+
|
820
|
+
function canWriteProtect() {
|
821
|
+
var writeProtectSupported = debug.enabled && !Object.propertyIsEnumerable('getOwnPropertyDescriptor');
|
822
|
+
if (writeProtectSupported) {
|
823
|
+
//IE8 getOwnPropertyDescriptor is built-in but throws exeption on non DOM objects
|
824
|
+
try {
|
825
|
+
Object.getOwnPropertyDescriptor(Object, 'keys');
|
826
|
+
} catch (e) {
|
827
|
+
return false;
|
828
|
+
}
|
829
|
+
}
|
830
|
+
|
831
|
+
return writeProtectSupported;
|
766
832
|
}
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
833
|
+
|
834
|
+
var utils = {
|
835
|
+
|
836
|
+
isDomObj: function(obj) {
|
837
|
+
return !!(obj.nodeType || (obj === window));
|
838
|
+
},
|
839
|
+
|
840
|
+
toArray: function(obj, from) {
|
841
|
+
from = from || 0;
|
842
|
+
var len = obj.length, arr = new Array(len - from);
|
843
|
+
for (var i = from; i < len; i++) {
|
844
|
+
arr[i - from] = obj[i];
|
845
|
+
}
|
846
|
+
return arr;
|
847
|
+
},
|
848
|
+
|
849
|
+
// returns new object representing multiple objects merged together
|
850
|
+
// optional final argument is boolean which specifies if merge is recursive
|
851
|
+
// original objects are unmodified
|
852
|
+
//
|
853
|
+
// usage:
|
854
|
+
// var base = {a:2, b:6};
|
855
|
+
// var extra = {b:3, c:4};
|
856
|
+
// merge(base, extra); //{a:2, b:3, c:4}
|
857
|
+
// base; //{a:2, b:6}
|
858
|
+
//
|
859
|
+
// var base = {a:2, b:6};
|
860
|
+
// var extra = {b:3, c:4};
|
861
|
+
// var extraExtra = {a:4, d:9};
|
862
|
+
// merge(base, extra, extraExtra); //{a:4, b:3, c:4. d: 9}
|
863
|
+
// base; //{a:2, b:6}
|
864
|
+
//
|
865
|
+
// var base = {a:2, b:{bb:4, cc:5}};
|
866
|
+
// var extra = {a:4, b:{cc:7, dd:1}};
|
867
|
+
// merge(base, extra, true); //{a:4, b:{bb:4, cc:7, dd:1}}
|
868
|
+
// base; //{a:2, b:6}
|
869
|
+
|
870
|
+
merge: function(/*obj1, obj2,....deepCopy*/) {
|
871
|
+
// unpacking arguments by hand benchmarked faster
|
872
|
+
var l = arguments.length,
|
873
|
+
args = new Array(l + 1);
|
874
|
+
|
875
|
+
if (l === 0) {
|
876
|
+
return {};
|
877
|
+
}
|
878
|
+
|
879
|
+
for (var i = 0; i < l; i++) {
|
880
|
+
args[i + 1] = arguments[i];
|
881
|
+
}
|
882
|
+
|
883
|
+
//start with empty object so a copy is created
|
884
|
+
args[0] = {};
|
885
|
+
|
886
|
+
if (args[args.length - 1] === true) {
|
887
|
+
//jquery extend requires deep copy as first arg
|
888
|
+
args.pop();
|
889
|
+
args.unshift(true);
|
890
|
+
}
|
891
|
+
|
892
|
+
return $.extend.apply(undefined, args);
|
893
|
+
},
|
894
|
+
|
895
|
+
// updates base in place by copying properties of extra to it
|
896
|
+
// optionally clobber protected
|
897
|
+
// usage:
|
898
|
+
// var base = {a:2, b:6};
|
899
|
+
// var extra = {c:4};
|
900
|
+
// push(base, extra); //{a:2, b:6, c:4}
|
901
|
+
// base; //{a:2, b:6, c:4}
|
902
|
+
//
|
903
|
+
// var base = {a:2, b:6};
|
904
|
+
// var extra = {b: 4 c:4};
|
905
|
+
// push(base, extra, true); //Error ("utils.push attempted to overwrite 'b' while running in protected mode")
|
906
|
+
// base; //{a:2, b:6}
|
907
|
+
//
|
908
|
+
// objects with the same key will merge recursively when protect is false
|
909
|
+
// eg:
|
910
|
+
// var base = {a:16, b:{bb:4, cc:10}};
|
911
|
+
// var extra = {b:{cc:25, dd:19}, c:5};
|
912
|
+
// push(base, extra); //{a:16, {bb:4, cc:25, dd:19}, c:5}
|
913
|
+
//
|
914
|
+
push: function(base, extra, protect) {
|
915
|
+
if (base) {
|
916
|
+
Object.keys(extra || {}).forEach(function(key) {
|
917
|
+
if (base[key] && protect) {
|
918
|
+
throw new Error('utils.push attempted to overwrite "' + key + '" while running in protected mode');
|
815
919
|
}
|
816
|
-
|
817
|
-
|
818
|
-
|
920
|
+
|
921
|
+
if (typeof base[key] == 'object' && typeof extra[key] == 'object') {
|
922
|
+
// recurse
|
923
|
+
this.push(base[key], extra[key]);
|
819
924
|
} else {
|
820
|
-
|
821
|
-
|
822
|
-
}
|
823
|
-
if (typeof originalCb != 'function' && typeof originalCb != 'object') {
|
824
|
-
throw new Error('Unable to bind to "' + type + '" because the given callback is not a function or an object');
|
925
|
+
// no protect, so extra wins
|
926
|
+
base[key] = extra[key];
|
825
927
|
}
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
928
|
+
}, this);
|
929
|
+
}
|
930
|
+
|
931
|
+
return base;
|
932
|
+
},
|
933
|
+
|
934
|
+
// If obj.key points to an enumerable property, return its value
|
935
|
+
// If obj.key points to a non-enumerable property, return undefined
|
936
|
+
getEnumerableProperty: function(obj, key) {
|
937
|
+
return obj.propertyIsEnumerable(key) ? obj[key] : undefined;
|
938
|
+
},
|
939
|
+
|
940
|
+
// build a function from other function(s)
|
941
|
+
// utils.compose(a,b,c) -> a(b(c()));
|
942
|
+
// implementation lifted from underscore.js (c) 2009-2012 Jeremy Ashkenas
|
943
|
+
compose: function() {
|
944
|
+
var funcs = arguments;
|
945
|
+
|
946
|
+
return function() {
|
947
|
+
var args = arguments;
|
948
|
+
|
949
|
+
for (var i = funcs.length - 1; i >= 0; i--) {
|
950
|
+
args = [funcs[i].apply(this, args)];
|
951
|
+
}
|
952
|
+
|
953
|
+
return args[0];
|
834
954
|
};
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
955
|
+
},
|
956
|
+
|
957
|
+
// Can only unique arrays of homogeneous primitives, e.g. an array of only strings, an array of only booleans, or an array of only numerics
|
958
|
+
uniqueArray: function(array) {
|
959
|
+
var u = {}, a = [];
|
960
|
+
|
961
|
+
for (var i = 0, l = array.length; i < l; ++i) {
|
962
|
+
if (u.hasOwnProperty(array[i])) {
|
963
|
+
continue;
|
964
|
+
}
|
965
|
+
|
966
|
+
a.push(array[i]);
|
967
|
+
u[array[i]] = 1;
|
968
|
+
}
|
969
|
+
|
970
|
+
return a;
|
971
|
+
},
|
972
|
+
|
973
|
+
debounce: function(func, wait, immediate) {
|
974
|
+
if (typeof wait != 'number') {
|
975
|
+
wait = DEFAULT_INTERVAL;
|
976
|
+
}
|
977
|
+
|
978
|
+
var timeout, result;
|
979
|
+
|
980
|
+
return function() {
|
981
|
+
var context = this, args = arguments;
|
982
|
+
var later = function() {
|
983
|
+
timeout = null;
|
984
|
+
if (!immediate) {
|
985
|
+
result = func.apply(context, args);
|
860
986
|
}
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
};
|
873
|
-
this.select = function (attributeKey) {
|
874
|
-
return this.$node.find(this.attr[attributeKey]);
|
987
|
+
};
|
988
|
+
var callNow = immediate && !timeout;
|
989
|
+
|
990
|
+
timeout && clearTimeout(timeout);
|
991
|
+
timeout = setTimeout(later, wait);
|
992
|
+
|
993
|
+
if (callNow) {
|
994
|
+
result = func.apply(context, args);
|
995
|
+
}
|
996
|
+
|
997
|
+
return result;
|
875
998
|
};
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
999
|
+
},
|
1000
|
+
|
1001
|
+
throttle: function(func, wait) {
|
1002
|
+
if (typeof wait != 'number') {
|
1003
|
+
wait = DEFAULT_INTERVAL;
|
1004
|
+
}
|
1005
|
+
|
1006
|
+
var context, args, timeout, throttling, more, result;
|
1007
|
+
var whenDone = this.debounce(function() {
|
1008
|
+
more = throttling = false;
|
1009
|
+
}, wait);
|
1010
|
+
|
1011
|
+
return function() {
|
1012
|
+
context = this; args = arguments;
|
1013
|
+
var later = function() {
|
1014
|
+
timeout = null;
|
1015
|
+
if (more) {
|
1016
|
+
result = func.apply(context, args);
|
885
1017
|
}
|
886
|
-
|
1018
|
+
whenDone();
|
1019
|
+
};
|
1020
|
+
|
1021
|
+
if (!timeout) {
|
1022
|
+
timeout = setTimeout(later, wait);
|
1023
|
+
}
|
1024
|
+
|
1025
|
+
if (throttling) {
|
1026
|
+
more = true;
|
1027
|
+
} else {
|
1028
|
+
throttling = true;
|
1029
|
+
result = func.apply(context, args);
|
1030
|
+
}
|
1031
|
+
|
1032
|
+
whenDone();
|
1033
|
+
return result;
|
887
1034
|
};
|
888
|
-
|
889
|
-
|
890
|
-
|
1035
|
+
},
|
1036
|
+
|
1037
|
+
countThen: function(num, base) {
|
1038
|
+
return function() {
|
1039
|
+
if (!--num) { return base.apply(this, arguments); }
|
891
1040
|
};
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
this.$node = $(node);
|
904
|
-
}
|
905
|
-
if (this.attrDef) {
|
906
|
-
initAttributes.call(this, attrs);
|
907
|
-
} else {
|
908
|
-
initDeprecatedAttributes.call(this, attrs);
|
1041
|
+
},
|
1042
|
+
|
1043
|
+
delegate: function(rules) {
|
1044
|
+
return function(e, data) {
|
1045
|
+
var target = $(e.target), parent;
|
1046
|
+
|
1047
|
+
Object.keys(rules).forEach(function(selector) {
|
1048
|
+
if (!e.isPropagationStopped() && (parent = target.closest(selector)).length) {
|
1049
|
+
data = data || {};
|
1050
|
+
data.el = parent[0];
|
1051
|
+
return rules[selector].apply(this, [e, data]);
|
909
1052
|
}
|
910
|
-
|
1053
|
+
}, this);
|
911
1054
|
};
|
912
|
-
|
913
|
-
|
1055
|
+
},
|
1056
|
+
|
1057
|
+
// ensures that a function will only be called once.
|
1058
|
+
// usage:
|
1059
|
+
// will only create the application once
|
1060
|
+
// var initialize = utils.once(createApplication)
|
1061
|
+
// initialize();
|
1062
|
+
// initialize();
|
1063
|
+
//
|
1064
|
+
// will only delete a record once
|
1065
|
+
// var myHanlder = function () {
|
1066
|
+
// $.ajax({type: 'DELETE', url: 'someurl.com', data: {id: 1}});
|
1067
|
+
// };
|
1068
|
+
// this.on('click', utils.once(myHandler));
|
1069
|
+
//
|
1070
|
+
once: function(func) {
|
1071
|
+
var ran, result;
|
1072
|
+
|
1073
|
+
return function() {
|
1074
|
+
if (ran) {
|
1075
|
+
return result;
|
1076
|
+
}
|
1077
|
+
|
1078
|
+
ran = true;
|
1079
|
+
result = func.apply(this, arguments);
|
1080
|
+
|
1081
|
+
return result;
|
914
1082
|
};
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
1083
|
+
},
|
1084
|
+
|
1085
|
+
propertyWritability: function(obj, prop, writable) {
|
1086
|
+
if (canWriteProtect() && obj.hasOwnProperty(prop)) {
|
1087
|
+
Object.defineProperty(obj, prop, { writable: writable });
|
1088
|
+
}
|
1089
|
+
},
|
1090
|
+
|
1091
|
+
// Property locking/unlocking
|
1092
|
+
mutateProperty: function(obj, prop, op) {
|
1093
|
+
var writable;
|
1094
|
+
|
1095
|
+
if (!canWriteProtect() || !obj.hasOwnProperty(prop)) {
|
1096
|
+
op.call(obj);
|
1097
|
+
return;
|
1098
|
+
}
|
1099
|
+
|
1100
|
+
writable = Object.getOwnPropertyDescriptor(obj, prop).writable;
|
1101
|
+
|
1102
|
+
Object.defineProperty(obj, prop, { writable: true });
|
1103
|
+
op.call(obj);
|
1104
|
+
Object.defineProperty(obj, prop, { writable: writable });
|
1105
|
+
|
1106
|
+
}
|
1107
|
+
|
1108
|
+
};
|
1109
|
+
|
1110
|
+
return utils;
|
1111
|
+
}.apply(null, __WEBPACK_AMD_DEFINE_ARRAY__)), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
1112
|
+
|
1113
|
+
|
1114
|
+
/***/ },
|
1115
|
+
/* 8 */
|
1116
|
+
/***/ function(module, exports, __webpack_require__) {
|
1117
|
+
|
1118
|
+
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 2013 Twitter, Inc. Licensed under The MIT License. http://opensource.org/licenses/MIT */
|
1119
|
+
|
1120
|
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
|
1121
|
+
__webpack_require__(7),
|
1122
|
+
__webpack_require__(6),
|
1123
|
+
__webpack_require__(4)
|
1124
|
+
], __WEBPACK_AMD_DEFINE_RESULT__ = (function(utils, registry, debug) {
|
924
1125
|
'use strict';
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
function
|
931
|
-
|
932
|
-
var
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
1126
|
+
|
1127
|
+
// common mixin allocates basic functionality - used by all component prototypes
|
1128
|
+
// callback context is bound to component
|
1129
|
+
var componentId = 0;
|
1130
|
+
|
1131
|
+
function teardownInstance(instanceInfo) {
|
1132
|
+
instanceInfo.events.slice().forEach(function(event) {
|
1133
|
+
var args = [event.type];
|
1134
|
+
|
1135
|
+
event.element && args.unshift(event.element);
|
1136
|
+
(typeof event.callback == 'function') && args.push(event.callback);
|
1137
|
+
|
1138
|
+
this.off.apply(this, args);
|
1139
|
+
}, instanceInfo.instance);
|
938
1140
|
}
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
1141
|
+
|
1142
|
+
function checkSerializable(type, data) {
|
1143
|
+
try {
|
1144
|
+
window.postMessage(data, '*');
|
1145
|
+
} catch (e) {
|
1146
|
+
console.log('unserializable data for event',type,':',data);
|
1147
|
+
throw new Error(
|
1148
|
+
['The event', type, 'on component', this.toString(), 'was triggered with non-serializable data'].join(' ')
|
1149
|
+
);
|
1150
|
+
}
|
1151
|
+
}
|
1152
|
+
|
1153
|
+
function initAttributes(attrs) {
|
1154
|
+
var definedKeys = [], incomingKeys;
|
1155
|
+
|
1156
|
+
this.attr = new this.attrDef;
|
1157
|
+
|
1158
|
+
if (debug.enabled && window.console) {
|
1159
|
+
for (var key in this.attrDef.prototype) {
|
1160
|
+
definedKeys.push(key);
|
946
1161
|
}
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
1162
|
+
incomingKeys = Object.keys(attrs);
|
1163
|
+
|
1164
|
+
for (var i = incomingKeys.length - 1; i >= 0; i--) {
|
1165
|
+
if (definedKeys.indexOf(incomingKeys[i]) == -1) {
|
1166
|
+
console.warn('Passed unused attributes including "' + incomingKeys[i] +
|
1167
|
+
'" to component "' + this.toString() + '".');
|
1168
|
+
break;
|
1169
|
+
}
|
1170
|
+
}
|
1171
|
+
}
|
1172
|
+
|
1173
|
+
for (var key in this.attrDef.prototype) {
|
1174
|
+
if (typeof attrs[key] == 'undefined') {
|
1175
|
+
if (this.attr[key] === null) {
|
1176
|
+
throw new Error('Required attribute "' + key +
|
1177
|
+
'" not specified in attachTo for component "' + this.toString() + '".');
|
1178
|
+
}
|
957
1179
|
} else {
|
958
|
-
|
959
|
-
elem = eventArgs[0];
|
960
|
-
eventType = eventArgs[1];
|
961
|
-
if (action == 'trigger') {
|
962
|
-
payload = eventArgs[2];
|
963
|
-
}
|
1180
|
+
this.attr[key] = attrs[key];
|
964
1181
|
}
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
actionLoggable = logFilter.actions == 'all' || logFilter.actions.indexOf(action) > -1;
|
969
|
-
// event name filter allow wildcards or regex...
|
970
|
-
toRegExp = function (expr) {
|
971
|
-
return expr.test ? expr : new RegExp('^' + expr.replace(/\*/g, '.*') + '$');
|
972
|
-
};
|
973
|
-
nameLoggable = logFilter.eventNames == 'all' || logFilter.eventNames.some(function (e) {
|
974
|
-
return toRegExp(e).test(name);
|
975
|
-
});
|
976
|
-
if (actionLoggable && nameLoggable) {
|
977
|
-
info = [
|
978
|
-
actionSymbols[action],
|
979
|
-
action,
|
980
|
-
'[' + name + ']'
|
981
|
-
];
|
982
|
-
payload && info.push(payload);
|
983
|
-
info.push(elemToString(elem));
|
984
|
-
info.push(component.constructor.describe.split(' ').slice(0, 3).join(' '));
|
985
|
-
console.groupCollapsed && action == 'trigger' && console.groupCollapsed(action, name);
|
986
|
-
console.info.apply(console, info);
|
1182
|
+
|
1183
|
+
if (typeof this.attr[key] == 'function') {
|
1184
|
+
this.attr[key] = this.attr[key].call(this);
|
987
1185
|
}
|
1186
|
+
}
|
1187
|
+
|
988
1188
|
}
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
1189
|
+
|
1190
|
+
function initDeprecatedAttributes(attrs) {
|
1191
|
+
// merge defaults with supplied options
|
1192
|
+
// put options in attr.__proto__ to avoid merge overhead
|
1193
|
+
var attr = Object.create(attrs);
|
1194
|
+
|
1195
|
+
for (var key in this.defaults) {
|
1196
|
+
if (!attrs.hasOwnProperty(key)) {
|
1197
|
+
attr[key] = this.defaults[key];
|
997
1198
|
}
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1199
|
+
}
|
1200
|
+
|
1201
|
+
this.attr = attr;
|
1202
|
+
|
1203
|
+
Object.keys(this.defaults || {}).forEach(function(key) {
|
1204
|
+
if (this.defaults[key] === null && this.attr[key] === null) {
|
1205
|
+
throw new Error('Required attribute "' + key +
|
1206
|
+
'" not specified in attachTo for component "' + this.toString() + '".');
|
1207
|
+
}
|
1208
|
+
}, this);
|
1004
1209
|
}
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
// http://opensource.org/licenses/MIT
|
1011
|
-
// ==========================================
|
1012
|
-
define('lib/component', [
|
1013
|
-
'./advice',
|
1014
|
-
'./utils',
|
1015
|
-
'./compose',
|
1016
|
-
'./base',
|
1017
|
-
'./registry',
|
1018
|
-
'./logger',
|
1019
|
-
'./debug'
|
1020
|
-
], function (advice, utils, compose, withBase, registry, withLogging, debug) {
|
1021
|
-
'use strict';
|
1022
|
-
var functionNameRegEx = /function (.*?)\s?\(/;
|
1023
|
-
// teardown for all instances of this constructor
|
1024
|
-
function teardownAll() {
|
1025
|
-
var componentInfo = registry.findComponentInfo(this);
|
1026
|
-
componentInfo && Object.keys(componentInfo.instances).forEach(function (k) {
|
1027
|
-
var info = componentInfo.instances[k];
|
1028
|
-
// It's possible that a previous teardown caused another component to teardown,
|
1029
|
-
// so we can't assume that the instances object is as it was.
|
1030
|
-
if (info && info.instance) {
|
1031
|
-
info.instance.teardown();
|
1032
|
-
}
|
1033
|
-
});
|
1210
|
+
|
1211
|
+
function proxyEventTo(targetEvent) {
|
1212
|
+
return function(e, data) {
|
1213
|
+
$(e.target).trigger(targetEvent, data);
|
1214
|
+
};
|
1034
1215
|
}
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1216
|
+
|
1217
|
+
function withBase() {
|
1218
|
+
|
1219
|
+
// delegate trigger, bind and unbind to an element
|
1220
|
+
// if $element not supplied, use component's node
|
1221
|
+
// other arguments are passed on
|
1222
|
+
// event can be either a string specifying the type
|
1223
|
+
// of the event, or a hash specifying both the type
|
1224
|
+
// and a default function to be called.
|
1225
|
+
this.trigger = function() {
|
1226
|
+
var $element, type, data, event, defaultFn;
|
1227
|
+
var lastIndex = arguments.length - 1, lastArg = arguments[lastIndex];
|
1228
|
+
|
1229
|
+
if (typeof lastArg != 'string' && !(lastArg && lastArg.defaultBehavior)) {
|
1230
|
+
lastIndex--;
|
1231
|
+
data = lastArg;
|
1047
1232
|
}
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1233
|
+
|
1234
|
+
if (lastIndex == 1) {
|
1235
|
+
$element = $(arguments[0]);
|
1236
|
+
event = arguments[1];
|
1237
|
+
} else {
|
1238
|
+
$element = this.$node;
|
1239
|
+
event = arguments[0];
|
1240
|
+
}
|
1241
|
+
|
1242
|
+
if (event.defaultBehavior) {
|
1243
|
+
defaultFn = event.defaultBehavior;
|
1244
|
+
event = $.Event(event.type);
|
1245
|
+
}
|
1246
|
+
|
1247
|
+
type = event.type || event;
|
1248
|
+
|
1249
|
+
if (debug.enabled && window.postMessage) {
|
1250
|
+
checkSerializable.call(this, type, data);
|
1251
|
+
}
|
1252
|
+
|
1253
|
+
if (typeof this.attr.eventData === 'object') {
|
1254
|
+
data = $.extend(true, {}, this.attr.eventData, data);
|
1255
|
+
}
|
1256
|
+
|
1257
|
+
$element.trigger((event || type), data);
|
1258
|
+
|
1259
|
+
if (defaultFn && !event.isDefaultPrevented()) {
|
1260
|
+
(this[defaultFn] || defaultFn).call(this, event, data);
|
1261
|
+
}
|
1262
|
+
|
1263
|
+
return $element;
|
1264
|
+
};
|
1265
|
+
|
1266
|
+
|
1267
|
+
this.on = function() {
|
1268
|
+
var $element, type, callback, originalCb;
|
1269
|
+
var lastIndex = arguments.length - 1, origin = arguments[lastIndex];
|
1270
|
+
|
1271
|
+
if (typeof origin == 'object') {
|
1272
|
+
//delegate callback
|
1273
|
+
originalCb = utils.delegate(
|
1274
|
+
this.resolveDelegateRules(origin)
|
1275
|
+
);
|
1276
|
+
} else if (typeof origin == 'string') {
|
1277
|
+
originalCb = proxyEventTo(origin);
|
1278
|
+
} else {
|
1279
|
+
originalCb = origin;
|
1280
|
+
}
|
1281
|
+
|
1282
|
+
if (lastIndex == 2) {
|
1283
|
+
$element = $(arguments[0]);
|
1284
|
+
type = arguments[1];
|
1285
|
+
} else {
|
1286
|
+
$element = this.$node;
|
1287
|
+
type = arguments[0];
|
1288
|
+
}
|
1289
|
+
|
1290
|
+
if (typeof originalCb != 'function' && typeof originalCb != 'object') {
|
1291
|
+
throw new Error('Unable to bind to "' + type +
|
1292
|
+
'" because the given callback is not a function or an object');
|
1293
|
+
}
|
1294
|
+
|
1295
|
+
callback = originalCb.bind(this);
|
1296
|
+
callback.target = originalCb;
|
1297
|
+
callback.context = this;
|
1298
|
+
|
1299
|
+
$element.on(type, callback);
|
1300
|
+
|
1301
|
+
// store every bound version of the callback
|
1302
|
+
originalCb.bound || (originalCb.bound = []);
|
1303
|
+
originalCb.bound.push(callback);
|
1304
|
+
|
1305
|
+
return callback;
|
1306
|
+
};
|
1307
|
+
|
1308
|
+
this.off = function() {
|
1309
|
+
var $element, type, callback;
|
1310
|
+
var lastIndex = arguments.length - 1;
|
1311
|
+
|
1312
|
+
if (typeof arguments[lastIndex] == 'function') {
|
1313
|
+
callback = arguments[lastIndex];
|
1314
|
+
lastIndex -= 1;
|
1057
1315
|
}
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1316
|
+
|
1317
|
+
if (lastIndex == 1) {
|
1318
|
+
$element = $(arguments[0]);
|
1319
|
+
type = arguments[1];
|
1320
|
+
} else {
|
1321
|
+
$element = this.$node;
|
1322
|
+
type = arguments[0];
|
1323
|
+
}
|
1324
|
+
|
1325
|
+
if (callback) {
|
1326
|
+
//this callback may be the original function or a bound version
|
1327
|
+
var boundFunctions = callback.target ? callback.target.bound : callback.bound || [];
|
1328
|
+
//set callback to version bound against this instance
|
1329
|
+
boundFunctions && boundFunctions.some(function(fn, i, arr) {
|
1330
|
+
if (fn.context && (this.identity == fn.context.identity)) {
|
1331
|
+
arr.splice(i, 1);
|
1332
|
+
callback = fn;
|
1333
|
+
return true;
|
1064
1334
|
}
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
// function name property not supported by this browser, use regex
|
1074
|
-
var m = mixin.toString().match(functionNameRegEx);
|
1075
|
-
return m && m[1] ? m[1] : '';
|
1076
|
-
} else {
|
1077
|
-
return mixin.name != 'withBase' ? mixin.name : '';
|
1335
|
+
}, this);
|
1336
|
+
$element.off(type, callback);
|
1337
|
+
} else {
|
1338
|
+
// Loop through the events of `this` instance
|
1339
|
+
// and unbind using the callback
|
1340
|
+
registry.findInstanceInfo(this).events.forEach(function (event) {
|
1341
|
+
if (type == event.type) {
|
1342
|
+
$element.off(type, event.callback);
|
1078
1343
|
}
|
1079
|
-
|
1080
|
-
}
|
1081
|
-
;
|
1082
|
-
// define the constructor for a custom component type
|
1083
|
-
// takes an unlimited number of mixin functions as arguments
|
1084
|
-
// typical api call with 3 mixins: define(timeline, withTweetCapability, withScrollCapability);
|
1085
|
-
function define() {
|
1086
|
-
// unpacking arguments by hand benchmarked faster
|
1087
|
-
var l = arguments.length;
|
1088
|
-
var mixins = new Array(l);
|
1089
|
-
for (var i = 0; i < l; i++)
|
1090
|
-
mixins[i] = arguments[i];
|
1091
|
-
var Component = function () {
|
1092
|
-
};
|
1093
|
-
Component.toString = Component.prototype.toString = prettyPrintMixins;
|
1094
|
-
if (debug.enabled) {
|
1095
|
-
Component.describe = Component.prototype.describe = Component.toString();
|
1344
|
+
});
|
1096
1345
|
}
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1346
|
+
|
1347
|
+
return $element;
|
1348
|
+
};
|
1349
|
+
|
1350
|
+
this.resolveDelegateRules = function(ruleInfo) {
|
1351
|
+
var rules = {};
|
1352
|
+
|
1353
|
+
Object.keys(ruleInfo).forEach(function(r) {
|
1354
|
+
if (!(r in this.attr)) {
|
1355
|
+
throw new Error('Component "' + this.toString() + '" wants to listen on "' + r + '" but no such attribute was defined.');
|
1356
|
+
}
|
1357
|
+
rules[this.attr[r]] = (typeof ruleInfo[r] == 'string') ? proxyEventTo(ruleInfo[r]) : ruleInfo[r];
|
1358
|
+
}, this);
|
1359
|
+
|
1360
|
+
return rules;
|
1361
|
+
};
|
1362
|
+
|
1363
|
+
this.select = function(attributeKey) {
|
1364
|
+
return this.$node.find(this.attr[attributeKey]);
|
1365
|
+
};
|
1366
|
+
|
1367
|
+
// New-style attributes
|
1368
|
+
|
1369
|
+
this.attributes = function(attrs) {
|
1370
|
+
|
1371
|
+
var Attributes = function() {};
|
1372
|
+
|
1373
|
+
if (this.attrDef) {
|
1374
|
+
Attributes.prototype = new this.attrDef;
|
1375
|
+
}
|
1376
|
+
|
1377
|
+
for (var name in attrs) {
|
1378
|
+
Attributes.prototype[name] = attrs[name];
|
1379
|
+
}
|
1380
|
+
|
1381
|
+
this.attrDef = Attributes;
|
1382
|
+
};
|
1383
|
+
|
1384
|
+
// Deprecated attributes
|
1385
|
+
|
1386
|
+
this.defaultAttrs = function(defaults) {
|
1387
|
+
utils.push(this.defaults, defaults, true) || (this.defaults = defaults);
|
1388
|
+
};
|
1389
|
+
|
1390
|
+
this.initialize = function(node, attrs) {
|
1391
|
+
attrs = attrs || {};
|
1392
|
+
this.identity || (this.identity = componentId++);
|
1393
|
+
|
1394
|
+
if (!node) {
|
1395
|
+
throw new Error('Component needs a node');
|
1116
1396
|
}
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1397
|
+
|
1398
|
+
if (node.jquery) {
|
1399
|
+
this.node = node[0];
|
1400
|
+
this.$node = node;
|
1401
|
+
} else {
|
1402
|
+
this.node = node;
|
1403
|
+
this.$node = $(node);
|
1404
|
+
}
|
1405
|
+
|
1406
|
+
if (this.attrDef) {
|
1407
|
+
initAttributes.call(this, attrs);
|
1408
|
+
} else {
|
1409
|
+
initDeprecatedAttributes.call(this, attrs);
|
1410
|
+
}
|
1411
|
+
|
1412
|
+
return this;
|
1413
|
+
};
|
1414
|
+
|
1415
|
+
this.teardown = function() {
|
1416
|
+
teardownInstance(registry.findInstanceInfo(this));
|
1417
|
+
};
|
1120
1418
|
}
|
1121
|
-
define.teardownAll = function () {
|
1122
|
-
registry.components.slice().forEach(function (c) {
|
1123
|
-
c.component.teardownAll();
|
1124
|
-
});
|
1125
|
-
registry.reset();
|
1126
|
-
};
|
1127
|
-
return define;
|
1128
|
-
});
|
1129
|
-
// ==========================================
|
1130
|
-
// Copyright 2013 Twitter, Inc
|
1131
|
-
// Licensed under The MIT License
|
1132
|
-
// http://opensource.org/licenses/MIT
|
1133
|
-
// ==========================================
|
1134
|
-
define('lib/index', [
|
1135
|
-
'./advice',
|
1136
|
-
'./component',
|
1137
|
-
'./compose',
|
1138
|
-
'./logger',
|
1139
|
-
'./registry',
|
1140
|
-
'./utils'
|
1141
|
-
], function (advice, component, compose, logger, registry, utils) {
|
1142
|
-
'use strict';
|
1143
|
-
return {
|
1144
|
-
advice: advice,
|
1145
|
-
component: component,
|
1146
|
-
compose: compose,
|
1147
|
-
logger: logger,
|
1148
|
-
registry: registry,
|
1149
|
-
utils: utils
|
1150
|
-
};
|
1151
|
-
});
|
1152
1419
|
|
1153
|
-
|
1154
|
-
}(
|
1420
|
+
return withBase;
|
1421
|
+
}.apply(null, __WEBPACK_AMD_DEFINE_ARRAY__)), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
1422
|
+
|
1423
|
+
|
1424
|
+
/***/ }
|
1425
|
+
/******/ ])
|
1426
|
+
})
|