clearwater 1.0.5 → 1.1.0
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/black_box_node.rb +6 -1
- data/opal/clearwater/component.rb +6 -1
- data/opal/clearwater/virtual_dom.rb +1 -0
- data/opal/clearwater/virtual_dom/js/virtual_dom.js +154 -211
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cf3110939fbdc974a1ebe0933f4cadc0eed1712621962a8ace71b35d65b820c
|
4
|
+
data.tar.gz: 4f81952255ed6d290a3a385da192f61babe6216638e46eb254544a16855e7119
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4acadcb97d1e450b56ad3e33ec4dae0703a9b6719fe6be8ab539e13129c82d2b2af675145b0b0cd6336f1d81bffde1f225736c85c57f6e6b7840ae7bcff91460
|
7
|
+
data.tar.gz: 0fce921bf875ab817caacd6c1118d0b59c6352f2bd7dc3aecfb66ebe3b19ed8ce5fdbd9cde69ea4792e2d2f1ac1f3333f73a3d0a58eab73eb85a56cf9baccf92
|
data/lib/clearwater/version.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'bowser/element'
|
2
2
|
require 'clearwater/virtual_dom'
|
3
|
+
require 'clearwater/component'
|
3
4
|
|
4
5
|
module Clearwater
|
5
6
|
module BlackBoxNode
|
@@ -24,6 +25,8 @@ module Clearwater
|
|
24
25
|
end
|
25
26
|
|
26
27
|
class Renderable
|
28
|
+
attr_reader :delegate
|
29
|
+
|
27
30
|
def initialize delegate
|
28
31
|
@delegate = delegate
|
29
32
|
if delegate.key
|
@@ -36,7 +39,9 @@ module Clearwater
|
|
36
39
|
end
|
37
40
|
|
38
41
|
def create_element
|
39
|
-
|
42
|
+
sanitized = Clearwater::Component.sanitize_content(@delegate.node)
|
43
|
+
vnode = VirtualDOM.create_element(sanitized)
|
44
|
+
wrap(vnode)
|
40
45
|
end
|
41
46
|
|
42
47
|
%x{
|
@@ -48,11 +48,16 @@ module Clearwater
|
|
48
48
|
if(!content.$$is_array) {
|
49
49
|
var render = content.$render;
|
50
50
|
|
51
|
-
if(content.$$
|
51
|
+
if(content.$$is_string || content.$$is_number || content == nil) {
|
52
|
+
return content;
|
53
|
+
} else if(content.$$cached_render) {
|
52
54
|
return #{`wrapper`.new(content)};
|
53
55
|
} else if(render && !render.$$stub) {
|
54
56
|
return #{sanitize_content(content.render)};
|
57
|
+
} else if(content.$$is_boolean) {
|
58
|
+
return nil;
|
55
59
|
} else {
|
60
|
+
// #{warn "Unhandled content: #{content.inspect}"};
|
56
61
|
return content;
|
57
62
|
}
|
58
63
|
} else {
|
@@ -1,146 +1,23 @@
|
|
1
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.virtualDom = 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
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
var
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
var VNode = require('./vnode/vnode.js')
|
22
|
-
var VText = require('./vnode/vtext.js')
|
23
|
-
var svg = require("./virtual-hyperscript/svg.js")
|
24
|
-
|
25
|
-
module.exports = {
|
26
|
-
diff: diff,
|
27
|
-
patch: patch,
|
28
|
-
h: h,
|
29
|
-
create: create,
|
30
|
-
VNode: VNode,
|
31
|
-
VText: VText,
|
32
|
-
svg: svg,
|
33
|
-
}
|
34
|
-
|
35
|
-
},{"./create-element.js":1,"./diff.js":2,"./h.js":3,"./patch.js":12,"./virtual-hyperscript/svg.js":25,"./vnode/vnode.js":33,"./vnode/vtext.js":35}],5:[function(require,module,exports){
|
36
|
-
/*!
|
37
|
-
* Cross-Browser Split 1.1.1
|
38
|
-
* Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
|
39
|
-
* Available under the MIT License
|
40
|
-
* ECMAScript compliant, uniform cross-browser split method
|
41
|
-
*/
|
42
|
-
|
43
|
-
/**
|
44
|
-
* Splits a string into an array of strings using a regex or string separator. Matches of the
|
45
|
-
* separator are not included in the result array. However, if `separator` is a regex that contains
|
46
|
-
* capturing groups, backreferences are spliced into the result each time `separator` is matched.
|
47
|
-
* Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably
|
48
|
-
* cross-browser.
|
49
|
-
* @param {String} str String to split.
|
50
|
-
* @param {RegExp|String} separator Regex or string to use for separating the string.
|
51
|
-
* @param {Number} [limit] Maximum number of items to include in the result array.
|
52
|
-
* @returns {Array} Array of substrings.
|
53
|
-
* @example
|
54
|
-
*
|
55
|
-
* // Basic use
|
56
|
-
* split('a b c d', ' ');
|
57
|
-
* // -> ['a', 'b', 'c', 'd']
|
58
|
-
*
|
59
|
-
* // With limit
|
60
|
-
* split('a b c d', ' ', 2);
|
61
|
-
* // -> ['a', 'b']
|
62
|
-
*
|
63
|
-
* // Backreferences in result array
|
64
|
-
* split('..word1 word2..', /([a-z]+)(\d+)/i);
|
65
|
-
* // -> ['..', 'word', '1', ' ', 'word', '2', '..']
|
66
|
-
*/
|
67
|
-
module.exports = (function split(undef) {
|
68
|
-
|
69
|
-
var nativeSplit = String.prototype.split,
|
70
|
-
compliantExecNpcg = /()??/.exec("")[1] === undef,
|
71
|
-
// NPCG: nonparticipating capturing group
|
72
|
-
self;
|
73
|
-
|
74
|
-
self = function(str, separator, limit) {
|
75
|
-
// If `separator` is not a regex, use `nativeSplit`
|
76
|
-
if (Object.prototype.toString.call(separator) !== "[object RegExp]") {
|
77
|
-
return nativeSplit.call(str, separator, limit);
|
78
|
-
}
|
79
|
-
var output = [],
|
80
|
-
flags = (separator.ignoreCase ? "i" : "") + (separator.multiline ? "m" : "") + (separator.extended ? "x" : "") + // Proposed for ES6
|
81
|
-
(separator.sticky ? "y" : ""),
|
82
|
-
// Firefox 3+
|
83
|
-
lastLastIndex = 0,
|
84
|
-
// Make `global` and avoid `lastIndex` issues by working with a copy
|
85
|
-
separator = new RegExp(separator.source, flags + "g"),
|
86
|
-
separator2, match, lastIndex, lastLength;
|
87
|
-
str += ""; // Type-convert
|
88
|
-
if (!compliantExecNpcg) {
|
89
|
-
// Doesn't need flags gy, but they don't hurt
|
90
|
-
separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags);
|
91
|
-
}
|
92
|
-
/* Values for `limit`, per the spec:
|
93
|
-
* If undefined: 4294967295 // Math.pow(2, 32) - 1
|
94
|
-
* If 0, Infinity, or NaN: 0
|
95
|
-
* If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;
|
96
|
-
* If negative number: 4294967296 - Math.floor(Math.abs(limit))
|
97
|
-
* If other: Type-convert, then use the above rules
|
98
|
-
*/
|
99
|
-
limit = limit === undef ? -1 >>> 0 : // Math.pow(2, 32) - 1
|
100
|
-
limit >>> 0; // ToUint32(limit)
|
101
|
-
while (match = separator.exec(str)) {
|
102
|
-
// `separator.lastIndex` is not reliable cross-browser
|
103
|
-
lastIndex = match.index + match[0].length;
|
104
|
-
if (lastIndex > lastLastIndex) {
|
105
|
-
output.push(str.slice(lastLastIndex, match.index));
|
106
|
-
// Fix browsers whose `exec` methods don't consistently return `undefined` for
|
107
|
-
// nonparticipating capturing groups
|
108
|
-
if (!compliantExecNpcg && match.length > 1) {
|
109
|
-
match[0].replace(separator2, function() {
|
110
|
-
for (var i = 1; i < arguments.length - 2; i++) {
|
111
|
-
if (arguments[i] === undef) {
|
112
|
-
match[i] = undef;
|
113
|
-
}
|
114
|
-
}
|
115
|
-
});
|
116
|
-
}
|
117
|
-
if (match.length > 1 && match.index < str.length) {
|
118
|
-
Array.prototype.push.apply(output, match.slice(1));
|
119
|
-
}
|
120
|
-
lastLength = match[0].length;
|
121
|
-
lastLastIndex = lastIndex;
|
122
|
-
if (output.length >= limit) {
|
123
|
-
break;
|
124
|
-
}
|
125
|
-
}
|
126
|
-
if (separator.lastIndex === match.index) {
|
127
|
-
separator.lastIndex++; // Avoid an infinite loop
|
128
|
-
}
|
129
|
-
}
|
130
|
-
if (lastLastIndex === str.length) {
|
131
|
-
if (lastLength || !separator.test("")) {
|
132
|
-
output.push("");
|
133
|
-
}
|
134
|
-
} else {
|
135
|
-
output.push(str.slice(lastLastIndex));
|
136
|
-
}
|
137
|
-
return output.length > limit ? output.slice(0, limit) : output;
|
138
|
-
};
|
139
|
-
|
140
|
-
return self;
|
141
|
-
})();
|
142
|
-
|
143
|
-
},{}],6:[function(require,module,exports){
|
2
|
+
var diff = require('virtual-dom/diff')
|
3
|
+
var patch = require('virtual-dom/patch')
|
4
|
+
var h = require('virtual-dom/h')
|
5
|
+
var create = require('virtual-dom/create-element')
|
6
|
+
var VNode = require('virtual-dom/vnode/vnode')
|
7
|
+
var VText = require('virtual-dom/vnode/vtext')
|
8
|
+
var svg = require('virtual-dom/virtual-hyperscript/svg')
|
9
|
+
|
10
|
+
module.exports = {
|
11
|
+
diff: diff,
|
12
|
+
patch: patch,
|
13
|
+
h: h,
|
14
|
+
create: create,
|
15
|
+
VNode: VNode,
|
16
|
+
VText: VText,
|
17
|
+
svg: svg,
|
18
|
+
}
|
19
|
+
|
20
|
+
},{"virtual-dom/create-element":7,"virtual-dom/diff":8,"virtual-dom/h":9,"virtual-dom/patch":10,"virtual-dom/virtual-hyperscript/svg":23,"virtual-dom/vnode/vnode":31,"virtual-dom/vnode/vtext":33}],2:[function(require,module,exports){
|
144
21
|
'use strict';
|
145
22
|
|
146
23
|
var OneVersionConstraint = require('individual/one-version');
|
@@ -162,7 +39,28 @@ function EvStore(elem) {
|
|
162
39
|
return hash;
|
163
40
|
}
|
164
41
|
|
165
|
-
},{"individual/one-version":
|
42
|
+
},{"individual/one-version":5}],3:[function(require,module,exports){
|
43
|
+
(function (global){
|
44
|
+
var topLevel = typeof global !== 'undefined' ? global :
|
45
|
+
typeof window !== 'undefined' ? window : {}
|
46
|
+
var minDoc = require('min-document');
|
47
|
+
|
48
|
+
var doccy;
|
49
|
+
|
50
|
+
if (typeof document !== 'undefined') {
|
51
|
+
doccy = document;
|
52
|
+
} else {
|
53
|
+
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];
|
54
|
+
|
55
|
+
if (!doccy) {
|
56
|
+
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
module.exports = doccy;
|
61
|
+
|
62
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
63
|
+
},{"min-document":37}],4:[function(require,module,exports){
|
166
64
|
(function (global){
|
167
65
|
'use strict';
|
168
66
|
|
@@ -185,7 +83,7 @@ function Individual(key, value) {
|
|
185
83
|
}
|
186
84
|
|
187
85
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
188
|
-
},{}],
|
86
|
+
},{}],5:[function(require,module,exports){
|
189
87
|
'use strict';
|
190
88
|
|
191
89
|
var Individual = require('./index.js');
|
@@ -209,48 +107,34 @@ function OneVersion(moduleName, version, defaultValue) {
|
|
209
107
|
return Individual(key, defaultValue);
|
210
108
|
}
|
211
109
|
|
212
|
-
},{"./index.js":
|
213
|
-
(function (global){
|
214
|
-
var topLevel = typeof global !== 'undefined' ? global :
|
215
|
-
typeof window !== 'undefined' ? window : {}
|
216
|
-
var minDoc = require('min-document');
|
217
|
-
|
218
|
-
if (typeof document !== 'undefined') {
|
219
|
-
module.exports = document;
|
220
|
-
} else {
|
221
|
-
var doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];
|
222
|
-
|
223
|
-
if (!doccy) {
|
224
|
-
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;
|
225
|
-
}
|
226
|
-
|
227
|
-
module.exports = doccy;
|
228
|
-
}
|
229
|
-
|
230
|
-
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
231
|
-
},{"min-document":38}],10:[function(require,module,exports){
|
110
|
+
},{"./index.js":4}],6:[function(require,module,exports){
|
232
111
|
"use strict";
|
233
112
|
|
234
113
|
module.exports = function isObject(x) {
|
235
114
|
return typeof x === "object" && x !== null;
|
236
115
|
};
|
237
116
|
|
238
|
-
},{}],
|
239
|
-
var
|
240
|
-
var toString = Object.prototype.toString
|
117
|
+
},{}],7:[function(require,module,exports){
|
118
|
+
var createElement = require("./vdom/create-element.js")
|
241
119
|
|
242
|
-
module.exports =
|
120
|
+
module.exports = createElement
|
243
121
|
|
244
|
-
function
|
245
|
-
|
246
|
-
|
122
|
+
},{"./vdom/create-element.js":12}],8:[function(require,module,exports){
|
123
|
+
var diff = require("./vtree/diff.js")
|
124
|
+
|
125
|
+
module.exports = diff
|
126
|
+
|
127
|
+
},{"./vtree/diff.js":35}],9:[function(require,module,exports){
|
128
|
+
var h = require("./virtual-hyperscript/index.js")
|
129
|
+
|
130
|
+
module.exports = h
|
247
131
|
|
248
|
-
},{}],
|
132
|
+
},{"./virtual-hyperscript/index.js":20}],10:[function(require,module,exports){
|
249
133
|
var patch = require("./vdom/patch.js")
|
250
134
|
|
251
135
|
module.exports = patch
|
252
136
|
|
253
|
-
},{"./vdom/patch.js":
|
137
|
+
},{"./vdom/patch.js":15}],11:[function(require,module,exports){
|
254
138
|
var isObject = require("is-object")
|
255
139
|
var isHook = require("../vnode/is-vhook.js")
|
256
140
|
|
@@ -349,7 +233,7 @@ function getPrototype(value) {
|
|
349
233
|
}
|
350
234
|
}
|
351
235
|
|
352
|
-
},{"../vnode/is-vhook.js":
|
236
|
+
},{"../vnode/is-vhook.js":26,"is-object":6}],12:[function(require,module,exports){
|
353
237
|
var document = require("global/document")
|
354
238
|
|
355
239
|
var applyProperties = require("./apply-properties")
|
@@ -383,7 +267,6 @@ function createElement(vnode, opts) {
|
|
383
267
|
doc.createElementNS(vnode.namespace, vnode.tagName)
|
384
268
|
|
385
269
|
var props = vnode.properties
|
386
|
-
applyProperties(node, props)
|
387
270
|
|
388
271
|
var children = vnode.children
|
389
272
|
|
@@ -394,10 +277,12 @@ function createElement(vnode, opts) {
|
|
394
277
|
}
|
395
278
|
}
|
396
279
|
|
280
|
+
applyProperties(node, props)
|
281
|
+
|
397
282
|
return node
|
398
283
|
}
|
399
284
|
|
400
|
-
},{"../vnode/handle-thunk.js":
|
285
|
+
},{"../vnode/handle-thunk.js":24,"../vnode/is-vnode.js":27,"../vnode/is-vtext.js":28,"../vnode/is-widget.js":29,"./apply-properties":11,"global/document":3}],13:[function(require,module,exports){
|
401
286
|
// Maps a virtual DOM tree onto a real DOM tree in an efficient manner.
|
402
287
|
// We don't want to read all of the DOM nodes in the tree so we use
|
403
288
|
// the in-order tree indexing to eliminate recursion down certain branches.
|
@@ -484,7 +369,7 @@ function ascending(a, b) {
|
|
484
369
|
return a > b ? 1 : -1
|
485
370
|
}
|
486
371
|
|
487
|
-
},{}],
|
372
|
+
},{}],14:[function(require,module,exports){
|
488
373
|
var applyProperties = require("./apply-properties")
|
489
374
|
|
490
375
|
var isWidget = require("../vnode/is-widget.js")
|
@@ -539,7 +424,7 @@ function removeNode(domNode, vNode) {
|
|
539
424
|
function insertNode(parentNode, vNode, renderOptions) {
|
540
425
|
var newNode = renderOptions.render(vNode, renderOptions)
|
541
426
|
|
542
|
-
if (parentNode) {
|
427
|
+
if (parentNode && newNode) {
|
543
428
|
parentNode.appendChild(newNode)
|
544
429
|
}
|
545
430
|
|
@@ -637,13 +522,14 @@ function replaceRoot(oldRoot, newRoot) {
|
|
637
522
|
return newRoot;
|
638
523
|
}
|
639
524
|
|
640
|
-
},{"../vnode/is-widget.js":
|
525
|
+
},{"../vnode/is-widget.js":29,"../vnode/vpatch.js":32,"./apply-properties":11,"./update-widget":16}],15:[function(require,module,exports){
|
641
526
|
var document = require("global/document")
|
642
527
|
var isArray = require("x-is-array")
|
643
528
|
|
644
529
|
var render = require("./create-element")
|
645
530
|
var domIndex = require("./dom-index")
|
646
531
|
var patchOp = require("./patch-op")
|
532
|
+
var VPatch = require("../vnode/vpatch.js")
|
647
533
|
module.exports = patch
|
648
534
|
|
649
535
|
function patch(rootNode, patches, renderOptions) {
|
@@ -689,8 +575,25 @@ function applyPatch(rootNode, domNode, patchList, renderOptions) {
|
|
689
575
|
var newNode
|
690
576
|
|
691
577
|
if (isArray(patchList)) {
|
578
|
+
var propsPatchList = [];
|
579
|
+
|
692
580
|
for (var i = 0; i < patchList.length; i++) {
|
693
|
-
|
581
|
+
if (patchList[i].type != VPatch.PROPS) {
|
582
|
+
newNode = patchOp(patchList[i], domNode, renderOptions)
|
583
|
+
|
584
|
+
if (domNode === rootNode) {
|
585
|
+
rootNode = newNode
|
586
|
+
}
|
587
|
+
}
|
588
|
+
else {
|
589
|
+
propsPatchList.push(patchList[i]);
|
590
|
+
}
|
591
|
+
}
|
592
|
+
|
593
|
+
// Properties like scrollTop should be set after all children have been
|
594
|
+
// patched, otherwise they wouldn't take effect.
|
595
|
+
for (var i = 0; i < propsPatchList.length; i++) {
|
596
|
+
newNode = patchOp(propsPatchList[i], domNode, renderOptions)
|
694
597
|
|
695
598
|
if (domNode === rootNode) {
|
696
599
|
rootNode = newNode
|
@@ -719,7 +622,7 @@ function patchIndices(patches) {
|
|
719
622
|
return indices
|
720
623
|
}
|
721
624
|
|
722
|
-
},{"./create-element":
|
625
|
+
},{"../vnode/vpatch.js":32,"./create-element":12,"./dom-index":13,"./patch-op":14,"global/document":3,"x-is-array":36}],16:[function(require,module,exports){
|
723
626
|
var isWidget = require("../vnode/is-widget.js")
|
724
627
|
|
725
628
|
module.exports = updateWidget
|
@@ -736,7 +639,7 @@ function updateWidget(a, b) {
|
|
736
639
|
return false
|
737
640
|
}
|
738
641
|
|
739
|
-
},{"../vnode/is-widget.js":
|
642
|
+
},{"../vnode/is-widget.js":29}],17:[function(require,module,exports){
|
740
643
|
'use strict';
|
741
644
|
|
742
645
|
module.exports = AttributeHook;
|
@@ -773,7 +676,7 @@ AttributeHook.prototype.unhook = function (node, prop, next) {
|
|
773
676
|
|
774
677
|
AttributeHook.prototype.type = 'AttributeHook';
|
775
678
|
|
776
|
-
},{}],
|
679
|
+
},{}],18:[function(require,module,exports){
|
777
680
|
'use strict';
|
778
681
|
|
779
682
|
var EvStore = require('ev-store');
|
@@ -802,7 +705,7 @@ EvHook.prototype.unhook = function(node, propertyName) {
|
|
802
705
|
es[propName] = undefined;
|
803
706
|
};
|
804
707
|
|
805
|
-
},{"ev-store":
|
708
|
+
},{"ev-store":2}],19:[function(require,module,exports){
|
806
709
|
'use strict';
|
807
710
|
|
808
711
|
module.exports = SoftSetHook;
|
@@ -821,7 +724,7 @@ SoftSetHook.prototype.hook = function (node, propertyName) {
|
|
821
724
|
}
|
822
725
|
};
|
823
726
|
|
824
|
-
},{}],
|
727
|
+
},{}],20:[function(require,module,exports){
|
825
728
|
'use strict';
|
826
729
|
|
827
730
|
var isArray = require('x-is-array');
|
@@ -871,6 +774,20 @@ function h(tagName, properties, children) {
|
|
871
774
|
props.value !== undefined &&
|
872
775
|
!isHook(props.value)
|
873
776
|
) {
|
777
|
+
if(typeof props.value === 'number') {
|
778
|
+
props.value = String(props.value);
|
779
|
+
}
|
780
|
+
|
781
|
+
if (props.value !== null && typeof props.value !== 'string') {
|
782
|
+
throw UnsupportedValueType({
|
783
|
+
expected: 'String',
|
784
|
+
received: typeof props.value,
|
785
|
+
Vnode: {
|
786
|
+
tagName: tag,
|
787
|
+
properties: props
|
788
|
+
}
|
789
|
+
});
|
790
|
+
}
|
874
791
|
props.value = softSetHook(props.value);
|
875
792
|
}
|
876
793
|
|
@@ -937,13 +854,13 @@ function UnexpectedVirtualElement(data) {
|
|
937
854
|
var err = new Error();
|
938
855
|
|
939
856
|
err.type = 'virtual-hyperscript.unexpected.virtual-element';
|
940
|
-
err.message = 'Unexpected virtual
|
941
|
-
'Expected a VNode
|
857
|
+
err.message = 'Unexpected virtual DOM node passed in.\n' +
|
858
|
+
'Expected a VNode, VText, String, Number, Clearwater::Component (or other renderable), or nil but:\n' +
|
942
859
|
'got:\n' +
|
943
860
|
errorString(data.foreignObject) +
|
944
861
|
'.\n' +
|
945
862
|
'The parent vnode is:\n' +
|
946
|
-
errorString(data.parentVnode)
|
863
|
+
errorString(data.parentVnode) +
|
947
864
|
'\n' +
|
948
865
|
'Suggested fix: change your `h(..., [ ... ])` callsite.';
|
949
866
|
err.foreignObject = data.foreignObject;
|
@@ -952,22 +869,38 @@ function UnexpectedVirtualElement(data) {
|
|
952
869
|
return err;
|
953
870
|
}
|
954
871
|
|
872
|
+
function UnsupportedValueType(data) {
|
873
|
+
var err = new Error();
|
874
|
+
|
875
|
+
err.type = 'virtual-hyperscript.unsupported.value-type';
|
876
|
+
err.message = 'Unexpected value type for input passed to h().\n' +
|
877
|
+
'Expected a ' +
|
878
|
+
errorString(data.expected) +
|
879
|
+
' but got:\n' +
|
880
|
+
errorString(data.received) +
|
881
|
+
'.\n' +
|
882
|
+
'The vnode is:\n' +
|
883
|
+
errorString(data.Vnode);
|
884
|
+
err.Vnode = data.Vnode;
|
885
|
+
|
886
|
+
return err;
|
887
|
+
}
|
888
|
+
|
955
889
|
function errorString(obj) {
|
956
890
|
try {
|
957
|
-
|
891
|
+
if(obj.$$class) {
|
892
|
+
return obj.$inspect();
|
893
|
+
} else {
|
894
|
+
return JSON.stringify(obj, null, ' ');
|
895
|
+
}
|
958
896
|
} catch (e) {
|
959
897
|
return String(obj);
|
960
898
|
}
|
961
899
|
}
|
962
900
|
|
963
|
-
},{"../vnode/is-thunk":
|
901
|
+
},{"../vnode/is-thunk":25,"../vnode/is-vhook":26,"../vnode/is-vnode":27,"../vnode/is-vtext":28,"../vnode/is-widget":29,"../vnode/vnode.js":31,"../vnode/vtext.js":33,"./hooks/ev-hook.js":18,"./hooks/soft-set-hook.js":19,"./parse-tag.js":21,"x-is-array":36}],21:[function(require,module,exports){
|
964
902
|
'use strict';
|
965
903
|
|
966
|
-
var split = require('browser-split');
|
967
|
-
|
968
|
-
var classIdSplit = /([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/;
|
969
|
-
var notClassId = /^\.|#/;
|
970
|
-
|
971
904
|
module.exports = parseTag;
|
972
905
|
|
973
906
|
function parseTag(tag, props) {
|
@@ -1039,7 +972,7 @@ function splitTag(tag) {
|
|
1039
972
|
return parts;
|
1040
973
|
}
|
1041
974
|
|
1042
|
-
},{
|
975
|
+
},{}],22:[function(require,module,exports){
|
1043
976
|
'use strict';
|
1044
977
|
|
1045
978
|
var DEFAULT_NAMESPACE = null;
|
@@ -1354,7 +1287,7 @@ function SVGAttributeNamespace(value) {
|
|
1354
1287
|
}
|
1355
1288
|
}
|
1356
1289
|
|
1357
|
-
},{}],
|
1290
|
+
},{}],23:[function(require,module,exports){
|
1358
1291
|
'use strict';
|
1359
1292
|
|
1360
1293
|
var isArray = require('x-is-array');
|
@@ -1418,7 +1351,7 @@ function isChildren(x) {
|
|
1418
1351
|
return typeof x === 'string' || isArray(x);
|
1419
1352
|
}
|
1420
1353
|
|
1421
|
-
},{"./hooks/attribute-hook":
|
1354
|
+
},{"./hooks/attribute-hook":17,"./index.js":20,"./svg-attribute-namespace":22,"x-is-array":36}],24:[function(require,module,exports){
|
1422
1355
|
var isVNode = require("./is-vnode")
|
1423
1356
|
var isVText = require("./is-vtext")
|
1424
1357
|
var isWidget = require("./is-widget")
|
@@ -1460,14 +1393,14 @@ function renderThunk(thunk, previous) {
|
|
1460
1393
|
return renderedThunk
|
1461
1394
|
}
|
1462
1395
|
|
1463
|
-
},{"./is-thunk":
|
1396
|
+
},{"./is-thunk":25,"./is-vnode":27,"./is-vtext":28,"./is-widget":29}],25:[function(require,module,exports){
|
1464
1397
|
module.exports = isThunk
|
1465
1398
|
|
1466
1399
|
function isThunk(t) {
|
1467
1400
|
return t && t.type === "Thunk"
|
1468
1401
|
}
|
1469
1402
|
|
1470
|
-
},{}],
|
1403
|
+
},{}],26:[function(require,module,exports){
|
1471
1404
|
module.exports = isHook
|
1472
1405
|
|
1473
1406
|
function isHook(hook) {
|
@@ -1476,7 +1409,7 @@ function isHook(hook) {
|
|
1476
1409
|
typeof hook.unhook === "function" && !hook.hasOwnProperty("unhook"))
|
1477
1410
|
}
|
1478
1411
|
|
1479
|
-
},{}],
|
1412
|
+
},{}],27:[function(require,module,exports){
|
1480
1413
|
var version = require("./version")
|
1481
1414
|
|
1482
1415
|
module.exports = isVirtualNode
|
@@ -1485,7 +1418,7 @@ function isVirtualNode(x) {
|
|
1485
1418
|
return x && x.type === "VirtualNode" && x.version === version
|
1486
1419
|
}
|
1487
1420
|
|
1488
|
-
},{"./version":
|
1421
|
+
},{"./version":30}],28:[function(require,module,exports){
|
1489
1422
|
var version = require("./version")
|
1490
1423
|
|
1491
1424
|
module.exports = isVirtualText
|
@@ -1494,17 +1427,17 @@ function isVirtualText(x) {
|
|
1494
1427
|
return x && x.type === "VirtualText" && x.version === version
|
1495
1428
|
}
|
1496
1429
|
|
1497
|
-
},{"./version":
|
1430
|
+
},{"./version":30}],29:[function(require,module,exports){
|
1498
1431
|
module.exports = isWidget
|
1499
1432
|
|
1500
1433
|
function isWidget(w) {
|
1501
1434
|
return w && w.type === "Widget"
|
1502
1435
|
}
|
1503
1436
|
|
1504
|
-
},{}],
|
1437
|
+
},{}],30:[function(require,module,exports){
|
1505
1438
|
module.exports = "2"
|
1506
1439
|
|
1507
|
-
},{}],
|
1440
|
+
},{}],31:[function(require,module,exports){
|
1508
1441
|
var version = require("./version")
|
1509
1442
|
var isVNode = require("./is-vnode")
|
1510
1443
|
var isWidget = require("./is-widget")
|
@@ -1578,7 +1511,7 @@ function VirtualNode(tagName, properties, children, key, namespace) {
|
|
1578
1511
|
VirtualNode.prototype.version = version
|
1579
1512
|
VirtualNode.prototype.type = "VirtualNode"
|
1580
1513
|
|
1581
|
-
},{"./is-thunk":
|
1514
|
+
},{"./is-thunk":25,"./is-vhook":26,"./is-vnode":27,"./is-widget":29,"./version":30}],32:[function(require,module,exports){
|
1582
1515
|
var version = require("./version")
|
1583
1516
|
|
1584
1517
|
VirtualPatch.NONE = 0
|
@@ -1602,7 +1535,7 @@ function VirtualPatch(type, vNode, patch) {
|
|
1602
1535
|
VirtualPatch.prototype.version = version
|
1603
1536
|
VirtualPatch.prototype.type = "VirtualPatch"
|
1604
1537
|
|
1605
|
-
},{"./version":
|
1538
|
+
},{"./version":30}],33:[function(require,module,exports){
|
1606
1539
|
var version = require("./version")
|
1607
1540
|
|
1608
1541
|
module.exports = VirtualText
|
@@ -1614,7 +1547,7 @@ function VirtualText(text) {
|
|
1614
1547
|
VirtualText.prototype.version = version
|
1615
1548
|
VirtualText.prototype.type = "VirtualText"
|
1616
1549
|
|
1617
|
-
},{"./version":
|
1550
|
+
},{"./version":30}],34:[function(require,module,exports){
|
1618
1551
|
var isObject = require("is-object")
|
1619
1552
|
var isHook = require("../vnode/is-vhook")
|
1620
1553
|
|
@@ -1674,7 +1607,7 @@ function getPrototype(value) {
|
|
1674
1607
|
}
|
1675
1608
|
}
|
1676
1609
|
|
1677
|
-
},{"../vnode/is-vhook":
|
1610
|
+
},{"../vnode/is-vhook":26,"is-object":6}],35:[function(require,module,exports){
|
1678
1611
|
var isArray = require("x-is-array")
|
1679
1612
|
|
1680
1613
|
var VPatch = require("../vnode/vpatch")
|
@@ -2103,7 +2036,17 @@ function appendPatch(apply, patch) {
|
|
2103
2036
|
}
|
2104
2037
|
}
|
2105
2038
|
|
2106
|
-
},{"../vnode/handle-thunk":
|
2039
|
+
},{"../vnode/handle-thunk":24,"../vnode/is-thunk":25,"../vnode/is-vnode":27,"../vnode/is-vtext":28,"../vnode/is-widget":29,"../vnode/vpatch":32,"./diff-props":34,"x-is-array":36}],36:[function(require,module,exports){
|
2040
|
+
var nativeIsArray = Array.isArray
|
2041
|
+
var toString = Object.prototype.toString
|
2042
|
+
|
2043
|
+
module.exports = nativeIsArray || isArray
|
2044
|
+
|
2045
|
+
function isArray(obj) {
|
2046
|
+
return toString.call(obj) === "[object Array]"
|
2047
|
+
}
|
2048
|
+
|
2049
|
+
},{}],37:[function(require,module,exports){
|
2107
2050
|
|
2108
|
-
},{}]},{},[
|
2051
|
+
},{}]},{},[1])(1)
|
2109
2052
|
});
|
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.1.0
|
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-07-
|
11
|
+
date: 2018-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|