-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.bundle.js
190 lines (147 loc) · 4.05 KB
/
client.bundle.js
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
var css = (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 d.constructor == Object
}
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 : {};
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
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 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 djbx = createCommonjsModule(function (module) {
module.exports = function (str) {
var hash = 5381
, i = str.length;
while (i)
{ hash = (hash * 33) ^ str.charCodeAt(--i); }
return hash >>> 0
};
});
var client_1 = function(ripple) {
return log("creating"), ripple.types["text/css"] = {
header: "text/css",
ext: "*.css",
selector: function (res) { return ("[css~=\"" + (res.name) + "\"]"); },
extract: function (el) { return (attr("css")(el) || "").split(" "); },
check: function (res) { return includes(".css")(res.name); },
shortname: function (path) { return basename(path); },
load: !1,
parse: function (res) { return (res.headers.hash = res.headers.hash || djbx(res.body), res); }
}, ripple;
};
var log = log$1("[ri/types/css]");
var basename;
return client_1;
}());