clearwater 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/clearwater/version.rb +1 -1
- data/opal/clearwater/virtual_dom/js/dom-delegator.js +664 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 256b1415eb03a7d7fc0387bdd857b8e882adc19b3b83ba9818d38229caca40c4
|
4
|
+
data.tar.gz: 3511d3b1e82bd70c1f5c87db315da2aaf868f691badd8c4bb37e42aaddf39bc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c7056cc47c9326a1f4c9f052eca901849fb6db268ec4677742fe69805d923106a7770ad342018ea4aea4e215771230630204e5326047f8c8aba2019444c0bc5
|
7
|
+
data.tar.gz: 4e765e3f0fa5ef7a44a232376ea3e0f891a8d2c93f6954b2555d0c8b7127f95d0aaaace5d46b9b12d64105ddfc1cf47ec435e589f4b664e948546401886c0090
|
data/lib/clearwater/version.rb
CHANGED
@@ -0,0 +1,664 @@
|
|
1
|
+
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.DOMDelegator = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
2
|
+
var EvStore = require("ev-store")
|
3
|
+
|
4
|
+
module.exports = addEvent
|
5
|
+
|
6
|
+
function addEvent(target, type, handler) {
|
7
|
+
var events = EvStore(target)
|
8
|
+
var event = events[type]
|
9
|
+
|
10
|
+
if (!event) {
|
11
|
+
events[type] = handler
|
12
|
+
} else if (Array.isArray(event)) {
|
13
|
+
if (event.indexOf(handler) === -1) {
|
14
|
+
event.push(handler)
|
15
|
+
}
|
16
|
+
} else if (event !== handler) {
|
17
|
+
events[type] = [event, handler]
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
},{"ev-store":5}],2:[function(require,module,exports){
|
22
|
+
var globalDocument = require("global/document")
|
23
|
+
var EvStore = require("ev-store")
|
24
|
+
var createStore = require("weakmap-shim/create-store")
|
25
|
+
|
26
|
+
var addEvent = require("./add-event.js")
|
27
|
+
var removeEvent = require("./remove-event.js")
|
28
|
+
var ProxyEvent = require("./proxy-event.js")
|
29
|
+
|
30
|
+
var HANDLER_STORE = createStore()
|
31
|
+
|
32
|
+
module.exports = DOMDelegator
|
33
|
+
|
34
|
+
function DOMDelegator(document) {
|
35
|
+
if (!(this instanceof DOMDelegator)) {
|
36
|
+
return new DOMDelegator(document);
|
37
|
+
}
|
38
|
+
|
39
|
+
document = document || globalDocument
|
40
|
+
|
41
|
+
this.target = document.documentElement
|
42
|
+
this.events = {}
|
43
|
+
this.rawEventListeners = {}
|
44
|
+
this.globalListeners = {}
|
45
|
+
}
|
46
|
+
|
47
|
+
DOMDelegator.prototype.addEventListener = addEvent
|
48
|
+
DOMDelegator.prototype.removeEventListener = removeEvent
|
49
|
+
|
50
|
+
DOMDelegator.allocateHandle =
|
51
|
+
function allocateHandle(func) {
|
52
|
+
var handle = new Handle()
|
53
|
+
|
54
|
+
HANDLER_STORE(handle).func = func;
|
55
|
+
|
56
|
+
return handle
|
57
|
+
}
|
58
|
+
|
59
|
+
DOMDelegator.transformHandle =
|
60
|
+
function transformHandle(handle, broadcast) {
|
61
|
+
var func = HANDLER_STORE(handle).func
|
62
|
+
|
63
|
+
return this.allocateHandle(function (ev) {
|
64
|
+
broadcast(ev, func);
|
65
|
+
})
|
66
|
+
}
|
67
|
+
|
68
|
+
DOMDelegator.prototype.addGlobalEventListener =
|
69
|
+
function addGlobalEventListener(eventName, fn) {
|
70
|
+
var listeners = this.globalListeners[eventName] || [];
|
71
|
+
if (listeners.indexOf(fn) === -1) {
|
72
|
+
listeners.push(fn)
|
73
|
+
}
|
74
|
+
|
75
|
+
this.globalListeners[eventName] = listeners;
|
76
|
+
}
|
77
|
+
|
78
|
+
DOMDelegator.prototype.removeGlobalEventListener =
|
79
|
+
function removeGlobalEventListener(eventName, fn) {
|
80
|
+
var listeners = this.globalListeners[eventName] || [];
|
81
|
+
|
82
|
+
var index = listeners.indexOf(fn)
|
83
|
+
if (index !== -1) {
|
84
|
+
listeners.splice(index, 1)
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
DOMDelegator.prototype.listenTo = function listenTo(eventName) {
|
89
|
+
if (!(eventName in this.events)) {
|
90
|
+
this.events[eventName] = 0;
|
91
|
+
}
|
92
|
+
|
93
|
+
this.events[eventName]++;
|
94
|
+
|
95
|
+
if (this.events[eventName] !== 1) {
|
96
|
+
return
|
97
|
+
}
|
98
|
+
|
99
|
+
var listener = this.rawEventListeners[eventName]
|
100
|
+
if (!listener) {
|
101
|
+
listener = this.rawEventListeners[eventName] =
|
102
|
+
createHandler(eventName, this)
|
103
|
+
}
|
104
|
+
|
105
|
+
this.target.addEventListener(eventName, listener, true)
|
106
|
+
}
|
107
|
+
|
108
|
+
DOMDelegator.prototype.unlistenTo = function unlistenTo(eventName) {
|
109
|
+
if (!(eventName in this.events)) {
|
110
|
+
this.events[eventName] = 0;
|
111
|
+
}
|
112
|
+
|
113
|
+
if (this.events[eventName] === 0) {
|
114
|
+
throw new Error("already unlistened to event.");
|
115
|
+
}
|
116
|
+
|
117
|
+
this.events[eventName]--;
|
118
|
+
|
119
|
+
if (this.events[eventName] !== 0) {
|
120
|
+
return
|
121
|
+
}
|
122
|
+
|
123
|
+
var listener = this.rawEventListeners[eventName]
|
124
|
+
|
125
|
+
if (!listener) {
|
126
|
+
throw new Error("dom-delegator#unlistenTo: cannot " +
|
127
|
+
"unlisten to " + eventName)
|
128
|
+
}
|
129
|
+
|
130
|
+
this.target.removeEventListener(eventName, listener, true)
|
131
|
+
}
|
132
|
+
|
133
|
+
function createHandler(eventName, delegator) {
|
134
|
+
var globalListeners = delegator.globalListeners;
|
135
|
+
var delegatorTarget = delegator.target;
|
136
|
+
|
137
|
+
return handler
|
138
|
+
|
139
|
+
function handler(ev) {
|
140
|
+
var globalHandlers = globalListeners[eventName] || []
|
141
|
+
|
142
|
+
if (globalHandlers.length > 0) {
|
143
|
+
var globalEvent = new ProxyEvent(ev);
|
144
|
+
globalEvent.currentTarget = delegatorTarget;
|
145
|
+
callListeners(globalHandlers, globalEvent)
|
146
|
+
}
|
147
|
+
|
148
|
+
findAndInvokeListeners(ev.target, ev, eventName)
|
149
|
+
}
|
150
|
+
}
|
151
|
+
|
152
|
+
function findAndInvokeListeners(elem, ev, eventName) {
|
153
|
+
var listener = getListener(elem, eventName)
|
154
|
+
|
155
|
+
if (listener && listener.handlers.length > 0) {
|
156
|
+
var listenerEvent = new ProxyEvent(ev);
|
157
|
+
listenerEvent.currentTarget = listener.currentTarget
|
158
|
+
callListeners(listener.handlers, listenerEvent)
|
159
|
+
|
160
|
+
if (listenerEvent._bubbles) {
|
161
|
+
var nextTarget = listener.currentTarget.parentNode
|
162
|
+
findAndInvokeListeners(nextTarget, ev, eventName)
|
163
|
+
}
|
164
|
+
}
|
165
|
+
}
|
166
|
+
|
167
|
+
function getListener(target, type) {
|
168
|
+
// terminate recursion if parent is `null`
|
169
|
+
if (target === null || typeof target === "undefined") {
|
170
|
+
return null
|
171
|
+
}
|
172
|
+
|
173
|
+
var events = EvStore(target)
|
174
|
+
// fetch list of handler fns for this event
|
175
|
+
var handler = events[type]
|
176
|
+
var allHandler = events.event
|
177
|
+
|
178
|
+
if (!handler && !allHandler) {
|
179
|
+
return getListener(target.parentNode, type)
|
180
|
+
}
|
181
|
+
|
182
|
+
var handlers = [].concat(handler || [], allHandler || [])
|
183
|
+
return new Listener(target, handlers)
|
184
|
+
}
|
185
|
+
|
186
|
+
function callListeners(handlers, ev) {
|
187
|
+
handlers.forEach(function (handler) {
|
188
|
+
if (typeof handler === "function") {
|
189
|
+
handler(ev)
|
190
|
+
} else if (typeof handler.handleEvent === "function") {
|
191
|
+
handler.handleEvent(ev)
|
192
|
+
} else if (handler.type === "dom-delegator-handle") {
|
193
|
+
HANDLER_STORE(handler).func(ev)
|
194
|
+
} else {
|
195
|
+
throw new Error("dom-delegator: unknown handler " +
|
196
|
+
"found: " + JSON.stringify(handlers));
|
197
|
+
}
|
198
|
+
})
|
199
|
+
}
|
200
|
+
|
201
|
+
function Listener(target, handlers) {
|
202
|
+
this.currentTarget = target
|
203
|
+
this.handlers = handlers
|
204
|
+
}
|
205
|
+
|
206
|
+
function Handle() {
|
207
|
+
this.type = "dom-delegator-handle"
|
208
|
+
}
|
209
|
+
|
210
|
+
},{"./add-event.js":1,"./proxy-event.js":13,"./remove-event.js":14,"ev-store":5,"global/document":8,"weakmap-shim/create-store":11}],3:[function(require,module,exports){
|
211
|
+
var Individual = require("individual")
|
212
|
+
var cuid = require("cuid")
|
213
|
+
var globalDocument = require("global/document")
|
214
|
+
|
215
|
+
var DOMDelegator = require("./dom-delegator.js")
|
216
|
+
|
217
|
+
var versionKey = "13"
|
218
|
+
var cacheKey = "__DOM_DELEGATOR_CACHE@" + versionKey
|
219
|
+
var cacheTokenKey = "__DOM_DELEGATOR_CACHE_TOKEN@" + versionKey
|
220
|
+
var delegatorCache = Individual(cacheKey, {
|
221
|
+
delegators: {}
|
222
|
+
})
|
223
|
+
var commonEvents = [
|
224
|
+
"blur", "change", "click", "contextmenu", "dblclick",
|
225
|
+
"error","focus", "focusin", "focusout", "input", "keydown",
|
226
|
+
"keypress", "keyup", "load", "mousedown", "mouseup",
|
227
|
+
"resize", "select", "submit", "touchcancel",
|
228
|
+
"touchend", "touchstart", "unload"
|
229
|
+
]
|
230
|
+
|
231
|
+
/* Delegator is a thin wrapper around a singleton `DOMDelegator`
|
232
|
+
instance.
|
233
|
+
|
234
|
+
Only one DOMDelegator should exist because we do not want
|
235
|
+
duplicate event listeners bound to the DOM.
|
236
|
+
|
237
|
+
`Delegator` will also `listenTo()` all events unless
|
238
|
+
every caller opts out of it
|
239
|
+
*/
|
240
|
+
module.exports = Delegator
|
241
|
+
|
242
|
+
function Delegator(opts) {
|
243
|
+
opts = opts || {}
|
244
|
+
var document = opts.document || globalDocument
|
245
|
+
|
246
|
+
var cacheKey = document[cacheTokenKey]
|
247
|
+
|
248
|
+
if (!cacheKey) {
|
249
|
+
cacheKey =
|
250
|
+
document[cacheTokenKey] = cuid()
|
251
|
+
}
|
252
|
+
|
253
|
+
var delegator = delegatorCache.delegators[cacheKey]
|
254
|
+
|
255
|
+
if (!delegator) {
|
256
|
+
delegator = delegatorCache.delegators[cacheKey] =
|
257
|
+
new DOMDelegator(document)
|
258
|
+
}
|
259
|
+
|
260
|
+
if (opts.defaultEvents !== false) {
|
261
|
+
for (var i = 0; i < commonEvents.length; i++) {
|
262
|
+
delegator.listenTo(commonEvents[i])
|
263
|
+
}
|
264
|
+
}
|
265
|
+
|
266
|
+
return delegator
|
267
|
+
}
|
268
|
+
|
269
|
+
Delegator.allocateHandle = DOMDelegator.allocateHandle;
|
270
|
+
Delegator.transformHandle = DOMDelegator.transformHandle;
|
271
|
+
|
272
|
+
},{"./dom-delegator.js":2,"cuid":4,"global/document":8,"individual":9}],4:[function(require,module,exports){
|
273
|
+
/**
|
274
|
+
* cuid.js
|
275
|
+
* Collision-resistant UID generator for browsers and node.
|
276
|
+
* Sequential for fast db lookups and recency sorting.
|
277
|
+
* Safe for element IDs and server-side lookups.
|
278
|
+
*
|
279
|
+
* Extracted from CLCTR
|
280
|
+
*
|
281
|
+
* Copyright (c) Eric Elliott 2012
|
282
|
+
* MIT License
|
283
|
+
*/
|
284
|
+
|
285
|
+
/*global window, navigator, document, require, process, module */
|
286
|
+
(function (app) {
|
287
|
+
'use strict';
|
288
|
+
var namespace = 'cuid',
|
289
|
+
c = 0,
|
290
|
+
blockSize = 4,
|
291
|
+
base = 36,
|
292
|
+
discreteValues = Math.pow(base, blockSize),
|
293
|
+
|
294
|
+
pad = function pad(num, size) {
|
295
|
+
var s = "000000000" + num;
|
296
|
+
return s.substr(s.length-size);
|
297
|
+
},
|
298
|
+
|
299
|
+
randomBlock = function randomBlock() {
|
300
|
+
return pad((Math.random() *
|
301
|
+
discreteValues << 0)
|
302
|
+
.toString(base), blockSize);
|
303
|
+
},
|
304
|
+
|
305
|
+
safeCounter = function () {
|
306
|
+
c = (c < discreteValues) ? c : 0;
|
307
|
+
c++; // this is not subliminal
|
308
|
+
return c - 1;
|
309
|
+
},
|
310
|
+
|
311
|
+
api = function cuid() {
|
312
|
+
// Starting with a lowercase letter makes
|
313
|
+
// it HTML element ID friendly.
|
314
|
+
var letter = 'c', // hard-coded allows for sequential access
|
315
|
+
|
316
|
+
// timestamp
|
317
|
+
// warning: this exposes the exact date and time
|
318
|
+
// that the uid was created.
|
319
|
+
timestamp = (new Date().getTime()).toString(base),
|
320
|
+
|
321
|
+
// Prevent same-machine collisions.
|
322
|
+
counter,
|
323
|
+
|
324
|
+
// A few chars to generate distinct ids for different
|
325
|
+
// clients (so different computers are far less
|
326
|
+
// likely to generate the same id)
|
327
|
+
fingerprint = api.fingerprint(),
|
328
|
+
|
329
|
+
// Grab some more chars from Math.random()
|
330
|
+
random = randomBlock() + randomBlock();
|
331
|
+
|
332
|
+
counter = pad(safeCounter().toString(base), blockSize);
|
333
|
+
|
334
|
+
return (letter + timestamp + counter + fingerprint + random);
|
335
|
+
};
|
336
|
+
|
337
|
+
api.slug = function slug() {
|
338
|
+
var date = new Date().getTime().toString(36),
|
339
|
+
counter,
|
340
|
+
print = api.fingerprint().slice(0,1) +
|
341
|
+
api.fingerprint().slice(-1),
|
342
|
+
random = randomBlock().slice(-2);
|
343
|
+
|
344
|
+
counter = safeCounter().toString(36).slice(-4);
|
345
|
+
|
346
|
+
return date.slice(-2) +
|
347
|
+
counter + print + random;
|
348
|
+
};
|
349
|
+
|
350
|
+
api.globalCount = function globalCount() {
|
351
|
+
// We want to cache the results of this
|
352
|
+
var cache = (function calc() {
|
353
|
+
var i,
|
354
|
+
count = 0;
|
355
|
+
|
356
|
+
for (i in window) {
|
357
|
+
count++;
|
358
|
+
}
|
359
|
+
|
360
|
+
return count;
|
361
|
+
}());
|
362
|
+
|
363
|
+
api.globalCount = function () { return cache; };
|
364
|
+
return cache;
|
365
|
+
};
|
366
|
+
|
367
|
+
api.fingerprint = function browserPrint() {
|
368
|
+
return pad((navigator.mimeTypes.length +
|
369
|
+
navigator.userAgent.length).toString(36) +
|
370
|
+
api.globalCount().toString(36), 4);
|
371
|
+
};
|
372
|
+
|
373
|
+
// don't change anything from here down.
|
374
|
+
if (app.register) {
|
375
|
+
app.register(namespace, api);
|
376
|
+
} else if (typeof module !== 'undefined') {
|
377
|
+
module.exports = api;
|
378
|
+
} else {
|
379
|
+
app[namespace] = api;
|
380
|
+
}
|
381
|
+
|
382
|
+
}(this.applitude || this));
|
383
|
+
|
384
|
+
},{}],5:[function(require,module,exports){
|
385
|
+
'use strict';
|
386
|
+
|
387
|
+
var OneVersionConstraint = require('individual/one-version');
|
388
|
+
|
389
|
+
var MY_VERSION = '7';
|
390
|
+
OneVersionConstraint('ev-store', MY_VERSION);
|
391
|
+
|
392
|
+
var hashKey = '__EV_STORE_KEY@' + MY_VERSION;
|
393
|
+
|
394
|
+
module.exports = EvStore;
|
395
|
+
|
396
|
+
function EvStore(elem) {
|
397
|
+
var hash = elem[hashKey];
|
398
|
+
|
399
|
+
if (!hash) {
|
400
|
+
hash = elem[hashKey] = {};
|
401
|
+
}
|
402
|
+
|
403
|
+
return hash;
|
404
|
+
}
|
405
|
+
|
406
|
+
},{"individual/one-version":7}],6:[function(require,module,exports){
|
407
|
+
(function (global){
|
408
|
+
'use strict';
|
409
|
+
|
410
|
+
/*global window, global*/
|
411
|
+
|
412
|
+
var root = typeof window !== 'undefined' ?
|
413
|
+
window : typeof global !== 'undefined' ?
|
414
|
+
global : {};
|
415
|
+
|
416
|
+
module.exports = Individual;
|
417
|
+
|
418
|
+
function Individual(key, value) {
|
419
|
+
if (key in root) {
|
420
|
+
return root[key];
|
421
|
+
}
|
422
|
+
|
423
|
+
root[key] = value;
|
424
|
+
|
425
|
+
return value;
|
426
|
+
}
|
427
|
+
|
428
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
429
|
+
},{}],7:[function(require,module,exports){
|
430
|
+
'use strict';
|
431
|
+
|
432
|
+
var Individual = require('./index.js');
|
433
|
+
|
434
|
+
module.exports = OneVersion;
|
435
|
+
|
436
|
+
function OneVersion(moduleName, version, defaultValue) {
|
437
|
+
var key = '__INDIVIDUAL_ONE_VERSION_' + moduleName;
|
438
|
+
var enforceKey = key + '_ENFORCE_SINGLETON';
|
439
|
+
|
440
|
+
var versionValue = Individual(enforceKey, version);
|
441
|
+
|
442
|
+
if (versionValue !== version) {
|
443
|
+
throw new Error('Can only have one copy of ' +
|
444
|
+
moduleName + '.\n' +
|
445
|
+
'You already have version ' + versionValue +
|
446
|
+
' installed.\n' +
|
447
|
+
'This means you cannot install version ' + version);
|
448
|
+
}
|
449
|
+
|
450
|
+
return Individual(key, defaultValue);
|
451
|
+
}
|
452
|
+
|
453
|
+
},{"./index.js":6}],8:[function(require,module,exports){
|
454
|
+
(function (global){
|
455
|
+
var topLevel = typeof global !== 'undefined' ? global :
|
456
|
+
typeof window !== 'undefined' ? window : {}
|
457
|
+
var minDoc = require('min-document');
|
458
|
+
|
459
|
+
var doccy;
|
460
|
+
|
461
|
+
if (typeof document !== 'undefined') {
|
462
|
+
doccy = document;
|
463
|
+
} else {
|
464
|
+
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];
|
465
|
+
|
466
|
+
if (!doccy) {
|
467
|
+
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;
|
468
|
+
}
|
469
|
+
}
|
470
|
+
|
471
|
+
module.exports = doccy;
|
472
|
+
|
473
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
474
|
+
},{"min-document":15}],9:[function(require,module,exports){
|
475
|
+
(function (global){
|
476
|
+
var root = typeof window !== 'undefined' ?
|
477
|
+
window : typeof global !== 'undefined' ?
|
478
|
+
global : {};
|
479
|
+
|
480
|
+
module.exports = Individual
|
481
|
+
|
482
|
+
function Individual(key, value) {
|
483
|
+
if (root[key]) {
|
484
|
+
return root[key]
|
485
|
+
}
|
486
|
+
|
487
|
+
Object.defineProperty(root, key, {
|
488
|
+
value: value
|
489
|
+
, configurable: true
|
490
|
+
})
|
491
|
+
|
492
|
+
return value
|
493
|
+
}
|
494
|
+
|
495
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
496
|
+
},{}],10:[function(require,module,exports){
|
497
|
+
if (typeof Object.create === 'function') {
|
498
|
+
// implementation from standard node.js 'util' module
|
499
|
+
module.exports = function inherits(ctor, superCtor) {
|
500
|
+
ctor.super_ = superCtor
|
501
|
+
ctor.prototype = Object.create(superCtor.prototype, {
|
502
|
+
constructor: {
|
503
|
+
value: ctor,
|
504
|
+
enumerable: false,
|
505
|
+
writable: true,
|
506
|
+
configurable: true
|
507
|
+
}
|
508
|
+
});
|
509
|
+
};
|
510
|
+
} else {
|
511
|
+
// old school shim for old browsers
|
512
|
+
module.exports = function inherits(ctor, superCtor) {
|
513
|
+
ctor.super_ = superCtor
|
514
|
+
var TempCtor = function () {}
|
515
|
+
TempCtor.prototype = superCtor.prototype
|
516
|
+
ctor.prototype = new TempCtor()
|
517
|
+
ctor.prototype.constructor = ctor
|
518
|
+
}
|
519
|
+
}
|
520
|
+
|
521
|
+
},{}],11:[function(require,module,exports){
|
522
|
+
var hiddenStore = require('./hidden-store.js');
|
523
|
+
|
524
|
+
module.exports = createStore;
|
525
|
+
|
526
|
+
function createStore() {
|
527
|
+
var key = {};
|
528
|
+
|
529
|
+
return function (obj) {
|
530
|
+
if ((typeof obj !== 'object' || obj === null) &&
|
531
|
+
typeof obj !== 'function'
|
532
|
+
) {
|
533
|
+
throw new Error('Weakmap-shim: Key must be object')
|
534
|
+
}
|
535
|
+
|
536
|
+
var store = obj.valueOf(key);
|
537
|
+
return store && store.identity === key ?
|
538
|
+
store : hiddenStore(obj, key);
|
539
|
+
};
|
540
|
+
}
|
541
|
+
|
542
|
+
},{"./hidden-store.js":12}],12:[function(require,module,exports){
|
543
|
+
module.exports = hiddenStore;
|
544
|
+
|
545
|
+
function hiddenStore(obj, key) {
|
546
|
+
var store = { identity: key };
|
547
|
+
var valueOf = obj.valueOf;
|
548
|
+
|
549
|
+
Object.defineProperty(obj, "valueOf", {
|
550
|
+
value: function (value) {
|
551
|
+
return value !== key ?
|
552
|
+
valueOf.apply(this, arguments) : store;
|
553
|
+
},
|
554
|
+
writable: true
|
555
|
+
});
|
556
|
+
|
557
|
+
return store;
|
558
|
+
}
|
559
|
+
|
560
|
+
},{}],13:[function(require,module,exports){
|
561
|
+
var inherits = require("inherits")
|
562
|
+
|
563
|
+
var ALL_PROPS = [
|
564
|
+
"altKey", "bubbles", "cancelable", "ctrlKey",
|
565
|
+
"eventPhase", "metaKey", "relatedTarget", "shiftKey",
|
566
|
+
"target", "timeStamp", "type", "view", "which"
|
567
|
+
]
|
568
|
+
var KEY_PROPS = ["char", "charCode", "key", "keyCode"]
|
569
|
+
var MOUSE_PROPS = [
|
570
|
+
"button", "buttons", "clientX", "clientY", "layerX",
|
571
|
+
"layerY", "offsetX", "offsetY", "pageX", "pageY",
|
572
|
+
"screenX", "screenY", "toElement"
|
573
|
+
]
|
574
|
+
|
575
|
+
var rkeyEvent = /^key|input/
|
576
|
+
var rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/
|
577
|
+
|
578
|
+
module.exports = ProxyEvent
|
579
|
+
|
580
|
+
function ProxyEvent(ev) {
|
581
|
+
if (!(this instanceof ProxyEvent)) {
|
582
|
+
return new ProxyEvent(ev)
|
583
|
+
}
|
584
|
+
|
585
|
+
if (rkeyEvent.test(ev.type)) {
|
586
|
+
return new KeyEvent(ev)
|
587
|
+
} else if (rmouseEvent.test(ev.type)) {
|
588
|
+
return new MouseEvent(ev)
|
589
|
+
}
|
590
|
+
|
591
|
+
for (var i = 0; i < ALL_PROPS.length; i++) {
|
592
|
+
var propKey = ALL_PROPS[i]
|
593
|
+
this[propKey] = ev[propKey]
|
594
|
+
}
|
595
|
+
|
596
|
+
this._rawEvent = ev
|
597
|
+
this._bubbles = false;
|
598
|
+
}
|
599
|
+
|
600
|
+
ProxyEvent.prototype.preventDefault = function () {
|
601
|
+
this._rawEvent.preventDefault()
|
602
|
+
}
|
603
|
+
|
604
|
+
ProxyEvent.prototype.startPropagation = function () {
|
605
|
+
this._bubbles = true;
|
606
|
+
}
|
607
|
+
|
608
|
+
function MouseEvent(ev) {
|
609
|
+
for (var i = 0; i < ALL_PROPS.length; i++) {
|
610
|
+
var propKey = ALL_PROPS[i]
|
611
|
+
this[propKey] = ev[propKey]
|
612
|
+
}
|
613
|
+
|
614
|
+
for (var j = 0; j < MOUSE_PROPS.length; j++) {
|
615
|
+
var mousePropKey = MOUSE_PROPS[j]
|
616
|
+
this[mousePropKey] = ev[mousePropKey]
|
617
|
+
}
|
618
|
+
|
619
|
+
this._rawEvent = ev
|
620
|
+
}
|
621
|
+
|
622
|
+
inherits(MouseEvent, ProxyEvent)
|
623
|
+
|
624
|
+
function KeyEvent(ev) {
|
625
|
+
for (var i = 0; i < ALL_PROPS.length; i++) {
|
626
|
+
var propKey = ALL_PROPS[i]
|
627
|
+
this[propKey] = ev[propKey]
|
628
|
+
}
|
629
|
+
|
630
|
+
for (var j = 0; j < KEY_PROPS.length; j++) {
|
631
|
+
var keyPropKey = KEY_PROPS[j]
|
632
|
+
this[keyPropKey] = ev[keyPropKey]
|
633
|
+
}
|
634
|
+
|
635
|
+
this._rawEvent = ev
|
636
|
+
}
|
637
|
+
|
638
|
+
inherits(KeyEvent, ProxyEvent)
|
639
|
+
|
640
|
+
},{"inherits":10}],14:[function(require,module,exports){
|
641
|
+
var EvStore = require("ev-store")
|
642
|
+
|
643
|
+
module.exports = removeEvent
|
644
|
+
|
645
|
+
function removeEvent(target, type, handler) {
|
646
|
+
var events = EvStore(target)
|
647
|
+
var event = events[type]
|
648
|
+
|
649
|
+
if (!event) {
|
650
|
+
return
|
651
|
+
} else if (Array.isArray(event)) {
|
652
|
+
var index = event.indexOf(handler)
|
653
|
+
if (index !== -1) {
|
654
|
+
event.splice(index, 1)
|
655
|
+
}
|
656
|
+
} else if (event === handler) {
|
657
|
+
events[type] = null
|
658
|
+
}
|
659
|
+
}
|
660
|
+
|
661
|
+
},{"ev-store":5}],15:[function(require,module,exports){
|
662
|
+
|
663
|
+
},{}]},{},[3])(3)
|
664
|
+
});
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clearwater
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Gaskins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.5
|
33
|
+
version: '0.5'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.5
|
40
|
+
version: '0.5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +136,7 @@ files:
|
|
136
136
|
- opal/clearwater/memoized_component.rb
|
137
137
|
- opal/clearwater/svg_component.rb
|
138
138
|
- opal/clearwater/virtual_dom.rb
|
139
|
+
- opal/clearwater/virtual_dom/js/dom-delegator.js
|
139
140
|
- opal/clearwater/virtual_dom/js/virtual_dom.js
|
140
141
|
- shared/clearwater/component/html_tags.rb
|
141
142
|
- shared/clearwater/router.rb
|