-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.bundle.js
More file actions
277 lines (224 loc) · 6.16 KB
/
client.bundle.js
File metadata and controls
277 lines (224 loc) · 6.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
var features = (function () {
'use strict';
var is_1 = is;
is.fn = isFunction;
is.str = isString;
is.num = isNumber;
is.obj = isObject;
is.lit = isLiteral;
is.bol = isBoolean;
is.truthy = isTruthy;
is.falsy = isFalsy;
is.arr = isArray;
is.null = isNull;
is.def = isDef;
is.in = isIn;
is.promise = isPromise;
is.stream = isStream;
function is(v){
return function(d){
return d == v
}
}
function isFunction(d) {
return typeof d == 'function'
}
function isBoolean(d) {
return typeof d == 'boolean'
}
function isString(d) {
return typeof d == 'string'
}
function isNumber(d) {
return typeof d == 'number'
}
function isObject(d) {
return typeof d == 'object'
}
function isLiteral(d) {
return typeof d == 'object'
&& !(d instanceof Array)
}
function isTruthy(d) {
return !!d == true
}
function isFalsy(d) {
return !!d == false
}
function isArray(d) {
return d instanceof Array
}
function isNull(d) {
return d === null
}
function isDef(d) {
return typeof d !== 'undefined'
}
function isPromise(d) {
return d instanceof Promise
}
function isStream(d) {
return !!(d && d.next)
}
function isIn(set) {
return function(d){
return !set ? false
: set.indexOf ? ~set.indexOf(d)
: d in set
}
}
var to = {
arr: toArray
, obj: toObject
};
function toArray(d){
return Array.prototype.slice.call(d, 0)
}
function toObject(d) {
var by = 'id';
return arguments.length == 1
? (by = d, reduce)
: reduce.apply(this, arguments)
function reduce(p,v,i){
if (i === 0) { p = {}; }
p[is_1.fn(by) ? by(v, i) : v[by]] = v;
return p
}
}
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var client = typeof window != 'undefined';
var owner = client ? /* istanbul ignore next */ window : commonjsGlobal;
var log$1 = function log(ns){
return function(d){
if (!owner.console || !console.log.apply) { return d; }
is_1.arr(arguments[2]) && (arguments[2] = arguments[2].length);
var args = to.arr(arguments)
, prefix = '[log][' + (new Date()).toISOString() + ']' + ns;
args.unshift(prefix.grey ? prefix.grey : prefix);
return console.log.apply(console, args), d
}
};
var includes = function includes(pattern){
return function(d){
return d && d.indexOf && ~d.indexOf(pattern)
}
};
var wrap = function wrap(d){
return function(){
return d
}
};
var str = function str(d){
return d === 0 ? '0'
: !d ? ''
: is_1.fn(d) ? '' + d
: is_1.obj(d) ? JSON.stringify(d)
: String(d)
};
var key = function key(k, v){
var set = arguments.length > 1
, keys = is_1.fn(k) ? [] : str(k).split('.')
, root = keys.shift();
return function deep(o, i){
var masked = {};
return !o ? undefined
: !is_1.num(k) && !k ? o
: is_1.arr(k) ? (k.map(copy), masked)
: o[k] || !keys.length ? (set ? ((o[k] = is_1.fn(v) ? v(o[k], i) : v), o)
: (is_1.fn(k) ? k(o) : o[k]))
: (set ? (key(keys.join('.'), v)(o[root] ? o[root] : (o[root] = {})), o)
: key(keys.join('.'))(o[root]))
function copy(k){
var val = key(k)(o);
if (val != undefined)
{ key(k, is_1.fn(val) ? wrap(val) : val)(masked); }
}
}
};
var header = function header(header$1, value) {
var getter = arguments.length == 1;
return function(d){
return !d || !d.headers ? null
: getter ? key(header$1)(d.headers)
: key(header$1)(d.headers) == value
}
};
var append = function append(v) {
return function(d){
return d+v
}
};
var attr = function attr(name, value) {
var args = arguments.length;
return !is_1.str(name) && args == 2 ? attr(arguments[1]).call(this, arguments[0])
: !is_1.str(name) && args == 3 ? attr(arguments[1], arguments[2]).call(this, arguments[0])
: function(el){
var ctx = this || {};
el = ctx.nodeName || is_1.fn(ctx.node) ? ctx : el;
el = el.node ? el.node() : el;
el = el.host || el;
return args > 1 && value === false ? el.removeAttribute(name)
: args > 1 ? (el.setAttribute(name, value), value)
: el.attributes.getNamedItem(name)
&& el.attributes.getNamedItem(name).value
}
};
var datum = function datum(node){
return node.__data__
};
var from_1 = from;
from.parent = fromParent;
function from(o){
return function(k){
return key(k)(o)
}
}
function fromParent(k){
return datum(this.parentNode)[k]
}
var not = function not(fn){
return function(){
return !fn.apply(this, arguments)
}
};
var by = function by(k, v){
var exists = arguments.length == 1;
return function(o){
var d = is_1.fn(k) ? k(o) : key(k)(o);
return d && v && d.toLowerCase && v.toLowerCase ? d.toLowerCase() === v.toLowerCase()
: exists ? Boolean(d)
: is_1.fn(v) ? v(d)
: d == v
}
};
// -------------------------------------------
// Extend Components with Features
// -------------------------------------------
var index = function features(ripple){
if (!client) { return }
log('creating');
ripple.render = render(ripple)(ripple.render);
return ripple
};
var render = function (ripple) { return function (next) { return function (el) {
var features = str(attr(el, 'is'))
.split(' ')
.map(from_1(ripple.resources))
.filter(header('content-type', 'application/javascript'))
, css = str(attr('css')(el)).split(' ');
features
.filter(by('headers.needs', includes('[css]')))
.map(key('name'))
.map(append('.css'))
.filter(not(is_1.in(css)))
.map(function (d) { return attr('css', (str(attr('css')(el)) + ' ' + d).trim())(el); });
var node = next(el);
return !node || !node.state ? undefined
: (features
.map(key('body'))
.map(function (d) { return d.call(node.shadowRoot || node, node.shadowRoot || node, node.state); })
, node)
}; }; };
var log = log$1('[ri/features]');
return index;
}());