@consumidor-positivo/aurora 0.0.195 → 0.0.196
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.
- package/dist/components/misc/index.d.ts +1 -2
- package/dist/components/misc/index.es.js +2 -2
- package/dist/main.d.ts +1 -1
- package/dist/main.es.js +5 -5
- package/dist/react-if.esm-Cek6sbNY.js +568 -0
- package/dist/{react-if.esm-CGh0ofh0.js.map → react-if.esm-Cek6sbNY.js.map} +1 -1
- package/package.json +1 -1
- package/dist/react-if.esm-CGh0ofh0.js +0 -65
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Conditional } from "../Conditional/index.es.js";
|
|
2
|
-
import { C, D,
|
|
2
|
+
import { C, D, I, S } from "../../react-if.esm-Cek6sbNY.js";
|
|
3
3
|
export {
|
|
4
4
|
C as Case,
|
|
5
5
|
Conditional,
|
|
6
6
|
D as Default,
|
|
7
|
-
|
|
7
|
+
I as If,
|
|
8
8
|
S as Switch
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=index.es.js.map
|
package/dist/main.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
export {
|
|
2
|
+
export { If, Switch, Case, Default } from 'react-if';
|
|
3
3
|
export { Button } from './components/Button';
|
|
4
4
|
export { PureSwitch } from './components/Switch/Pure';
|
|
5
5
|
export { CardSwitch } from './components/Switch/Card';
|
package/dist/main.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C, D,
|
|
1
|
+
import { C, D, I, S } from "./react-if.esm-Cek6sbNY.js";
|
|
2
2
|
import { Button } from "./components/Button/index.es.js";
|
|
3
3
|
import { PureSwitch } from "./components/Pure/index.es.js";
|
|
4
4
|
import { CardSwitch } from "./components/Card/index.es.js";
|
|
@@ -355,7 +355,7 @@ import { IconZoomIn } from "./components/icons/IconZoomIn/index.es.js";
|
|
|
355
355
|
import { IconZoomOut } from "./components/icons/IconZoomOut/index.es.js";
|
|
356
356
|
import { IconSocialGoogle } from "./components/icons/IconSocialGoogle/index.es.js";
|
|
357
357
|
import { Carousel } from "./components/Carousel/index.es.js";
|
|
358
|
-
import { k as k2, j as j2, l as l2, i as i2, a as a2, B, ai, aj, ah, x, w, v, u, t, s, r, K, J, I, H, g as g2, G, F, E, D as D2, A, z, y, W
|
|
358
|
+
import { k as k2, j as j2, l as l2, i as i2, a as a2, B, ai, aj, ah, x, w, v, u, t, s, r, K, J, I as I2, H, g as g2, G, F, E, D as D2, A, z, y, W, V, U, T, S as S2, b as b2, R, a6, a5, a4, a3, a2 as a22, f as f2, a1, h as h2, q as q2, p as p2, o as o2, c as c2, n as n2, m as m2, d as d2, Q, P, O, N, M, C as C2, L as L2, a0, $, _, Z, Y, e as e2, X, ak, av, aA, aB, aC, aD, aE, aF, aG, aH, aI, aJ, au, aw, ay, az, ax, al, am, an, ao, ap, aq, ar, as, at, a7, a8, a9, aa, ab, ac, ad, ae, af, ag } from "./tokens-D_iASp38.js";
|
|
359
359
|
import './components/main/styles.css';const CardContainer = ({
|
|
360
360
|
direction,
|
|
361
361
|
alignItems,
|
|
@@ -479,7 +479,7 @@ export {
|
|
|
479
479
|
r as COLOR_BRAND_BLUE_60,
|
|
480
480
|
K as COLOR_BRAND_CYAN_10,
|
|
481
481
|
J as COLOR_BRAND_CYAN_20,
|
|
482
|
-
|
|
482
|
+
I2 as COLOR_BRAND_CYAN_30,
|
|
483
483
|
H as COLOR_BRAND_CYAN_40,
|
|
484
484
|
g2 as COLOR_BRAND_CYAN_50,
|
|
485
485
|
G as COLOR_BRAND_CYAN_60,
|
|
@@ -489,7 +489,7 @@ export {
|
|
|
489
489
|
A as COLOR_BRAND_EMERALD_40,
|
|
490
490
|
z as COLOR_BRAND_EMERALD_50,
|
|
491
491
|
y as COLOR_BRAND_EMERALD_60,
|
|
492
|
-
|
|
492
|
+
W as COLOR_ERROR_00,
|
|
493
493
|
V as COLOR_ERROR_10,
|
|
494
494
|
U as COLOR_ERROR_20,
|
|
495
495
|
T as COLOR_ERROR_30,
|
|
@@ -874,7 +874,7 @@ export {
|
|
|
874
874
|
IconZapOff,
|
|
875
875
|
IconZoomIn,
|
|
876
876
|
IconZoomOut,
|
|
877
|
-
|
|
877
|
+
I as If,
|
|
878
878
|
Image,
|
|
879
879
|
InputField,
|
|
880
880
|
LazyImage,
|
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
import * as $dbSRa$react from "react";
|
|
2
|
+
import $dbSRa$react__default, { Fragment, useState, useMemo, useRef, useEffect } from "react";
|
|
3
|
+
var render = function render2(props) {
|
|
4
|
+
if (typeof props.children === "function") {
|
|
5
|
+
return $dbSRa$react__default.createElement(Fragment, null, props.children());
|
|
6
|
+
}
|
|
7
|
+
return $dbSRa$react__default.createElement(Fragment, null, props.children || null);
|
|
8
|
+
};
|
|
9
|
+
var Case = function Case2(_ref) {
|
|
10
|
+
var _ref$children = _ref.children, children = _ref$children === void 0 ? null : _ref$children;
|
|
11
|
+
return render({
|
|
12
|
+
children
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var Default = function Default2(_ref) {
|
|
16
|
+
var _ref$children = _ref.children, children = _ref$children === void 0 ? null : _ref$children;
|
|
17
|
+
return render({
|
|
18
|
+
children
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var Else = function Else2(props) {
|
|
22
|
+
return render(props);
|
|
23
|
+
};
|
|
24
|
+
var Fallback = function Fallback2(props) {
|
|
25
|
+
return render(props);
|
|
26
|
+
};
|
|
27
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
28
|
+
try {
|
|
29
|
+
var i = n[a](c), u = i.value;
|
|
30
|
+
} catch (n2) {
|
|
31
|
+
return void e(n2);
|
|
32
|
+
}
|
|
33
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
34
|
+
}
|
|
35
|
+
function _asyncToGenerator(n) {
|
|
36
|
+
return function() {
|
|
37
|
+
var t = this, e = arguments;
|
|
38
|
+
return new Promise(function(r, o) {
|
|
39
|
+
var a = n.apply(t, e);
|
|
40
|
+
function _next(n2) {
|
|
41
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n2);
|
|
42
|
+
}
|
|
43
|
+
function _throw(n2) {
|
|
44
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n2);
|
|
45
|
+
}
|
|
46
|
+
_next(void 0);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function _extends() {
|
|
51
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
52
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
53
|
+
var t = arguments[e];
|
|
54
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
55
|
+
}
|
|
56
|
+
return n;
|
|
57
|
+
}, _extends.apply(null, arguments);
|
|
58
|
+
}
|
|
59
|
+
function _regeneratorRuntime() {
|
|
60
|
+
_regeneratorRuntime = function() {
|
|
61
|
+
return r;
|
|
62
|
+
};
|
|
63
|
+
var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag";
|
|
64
|
+
function c(t2, r2, e2, n2) {
|
|
65
|
+
return Object.defineProperty(t2, r2, {
|
|
66
|
+
value: e2,
|
|
67
|
+
enumerable: !n2,
|
|
68
|
+
configurable: !n2,
|
|
69
|
+
writable: !n2
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
c({}, "");
|
|
74
|
+
} catch (t2) {
|
|
75
|
+
c = function(t3, r2, e2) {
|
|
76
|
+
return t3[r2] = e2;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function h(r2, e2, n2, o2) {
|
|
80
|
+
var i2 = e2 && e2.prototype instanceof Generator ? e2 : Generator, a2 = Object.create(i2.prototype);
|
|
81
|
+
return c(a2, "_invoke", /* @__PURE__ */ function(r3, e3, n3) {
|
|
82
|
+
var o3 = 1;
|
|
83
|
+
return function(i3, a3) {
|
|
84
|
+
if (3 === o3) throw Error("Generator is already running");
|
|
85
|
+
if (4 === o3) {
|
|
86
|
+
if ("throw" === i3) throw a3;
|
|
87
|
+
return {
|
|
88
|
+
value: t,
|
|
89
|
+
done: true
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
for (n3.method = i3, n3.arg = a3; ; ) {
|
|
93
|
+
var u2 = n3.delegate;
|
|
94
|
+
if (u2) {
|
|
95
|
+
var c2 = d(u2, n3);
|
|
96
|
+
if (c2) {
|
|
97
|
+
if (c2 === f) continue;
|
|
98
|
+
return c2;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if ("next" === n3.method) n3.sent = n3._sent = n3.arg;
|
|
102
|
+
else if ("throw" === n3.method) {
|
|
103
|
+
if (1 === o3) throw o3 = 4, n3.arg;
|
|
104
|
+
n3.dispatchException(n3.arg);
|
|
105
|
+
} else "return" === n3.method && n3.abrupt("return", n3.arg);
|
|
106
|
+
o3 = 3;
|
|
107
|
+
var h2 = s(r3, e3, n3);
|
|
108
|
+
if ("normal" === h2.type) {
|
|
109
|
+
if (o3 = n3.done ? 4 : 2, h2.arg === f) continue;
|
|
110
|
+
return {
|
|
111
|
+
value: h2.arg,
|
|
112
|
+
done: n3.done
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
"throw" === h2.type && (o3 = 4, n3.method = "throw", n3.arg = h2.arg);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}(r2, n2, new Context(o2 || [])), true), a2;
|
|
119
|
+
}
|
|
120
|
+
function s(t2, r2, e2) {
|
|
121
|
+
try {
|
|
122
|
+
return {
|
|
123
|
+
type: "normal",
|
|
124
|
+
arg: t2.call(r2, e2)
|
|
125
|
+
};
|
|
126
|
+
} catch (t3) {
|
|
127
|
+
return {
|
|
128
|
+
type: "throw",
|
|
129
|
+
arg: t3
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
r.wrap = h;
|
|
134
|
+
var f = {};
|
|
135
|
+
function Generator() {
|
|
136
|
+
}
|
|
137
|
+
function GeneratorFunction() {
|
|
138
|
+
}
|
|
139
|
+
function GeneratorFunctionPrototype() {
|
|
140
|
+
}
|
|
141
|
+
var l = {};
|
|
142
|
+
c(l, i, function() {
|
|
143
|
+
return this;
|
|
144
|
+
});
|
|
145
|
+
var p = Object.getPrototypeOf, y = p && p(p(x([])));
|
|
146
|
+
y && y !== e && n.call(y, i) && (l = y);
|
|
147
|
+
var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l);
|
|
148
|
+
function g(t2) {
|
|
149
|
+
["next", "throw", "return"].forEach(function(r2) {
|
|
150
|
+
c(t2, r2, function(t3) {
|
|
151
|
+
return this._invoke(r2, t3);
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function AsyncIterator(t2, r2) {
|
|
156
|
+
function e2(o3, i2, a2, u2) {
|
|
157
|
+
var c2 = s(t2[o3], t2, i2);
|
|
158
|
+
if ("throw" !== c2.type) {
|
|
159
|
+
var h2 = c2.arg, f2 = h2.value;
|
|
160
|
+
return f2 && "object" == typeof f2 && n.call(f2, "__await") ? r2.resolve(f2.__await).then(function(t3) {
|
|
161
|
+
e2("next", t3, a2, u2);
|
|
162
|
+
}, function(t3) {
|
|
163
|
+
e2("throw", t3, a2, u2);
|
|
164
|
+
}) : r2.resolve(f2).then(function(t3) {
|
|
165
|
+
h2.value = t3, a2(h2);
|
|
166
|
+
}, function(t3) {
|
|
167
|
+
return e2("throw", t3, a2, u2);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
u2(c2.arg);
|
|
171
|
+
}
|
|
172
|
+
var o2;
|
|
173
|
+
c(this, "_invoke", function(t3, n2) {
|
|
174
|
+
function i2() {
|
|
175
|
+
return new r2(function(r3, o3) {
|
|
176
|
+
e2(t3, n2, r3, o3);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
return o2 = o2 ? o2.then(i2, i2) : i2();
|
|
180
|
+
}, true);
|
|
181
|
+
}
|
|
182
|
+
function d(r2, e2) {
|
|
183
|
+
var n2 = e2.method, o2 = r2.i[n2];
|
|
184
|
+
if (o2 === t) return e2.delegate = null, "throw" === n2 && r2.i.return && (e2.method = "return", e2.arg = t, d(r2, e2), "throw" === e2.method) || "return" !== n2 && (e2.method = "throw", e2.arg = new TypeError("The iterator does not provide a '" + n2 + "' method")), f;
|
|
185
|
+
var i2 = s(o2, r2.i, e2.arg);
|
|
186
|
+
if ("throw" === i2.type) return e2.method = "throw", e2.arg = i2.arg, e2.delegate = null, f;
|
|
187
|
+
var a2 = i2.arg;
|
|
188
|
+
return a2 ? a2.done ? (e2[r2.r] = a2.value, e2.next = r2.n, "return" !== e2.method && (e2.method = "next", e2.arg = t), e2.delegate = null, f) : a2 : (e2.method = "throw", e2.arg = new TypeError("iterator result is not an object"), e2.delegate = null, f);
|
|
189
|
+
}
|
|
190
|
+
function w(t2) {
|
|
191
|
+
this.tryEntries.push(t2);
|
|
192
|
+
}
|
|
193
|
+
function m(r2) {
|
|
194
|
+
var e2 = r2[4] || {};
|
|
195
|
+
e2.type = "normal", e2.arg = t, r2[4] = e2;
|
|
196
|
+
}
|
|
197
|
+
function Context(t2) {
|
|
198
|
+
this.tryEntries = [[-1]], t2.forEach(w, this), this.reset(true);
|
|
199
|
+
}
|
|
200
|
+
function x(r2) {
|
|
201
|
+
if (null != r2) {
|
|
202
|
+
var e2 = r2[i];
|
|
203
|
+
if (e2) return e2.call(r2);
|
|
204
|
+
if ("function" == typeof r2.next) return r2;
|
|
205
|
+
if (!isNaN(r2.length)) {
|
|
206
|
+
var o2 = -1, a2 = function e3() {
|
|
207
|
+
for (; ++o2 < r2.length; ) if (n.call(r2, o2)) return e3.value = r2[o2], e3.done = false, e3;
|
|
208
|
+
return e3.value = t, e3.done = true, e3;
|
|
209
|
+
};
|
|
210
|
+
return a2.next = a2;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
throw new TypeError(typeof r2 + " is not iterable");
|
|
214
|
+
}
|
|
215
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function(t2) {
|
|
216
|
+
var r2 = "function" == typeof t2 && t2.constructor;
|
|
217
|
+
return !!r2 && (r2 === GeneratorFunction || "GeneratorFunction" === (r2.displayName || r2.name));
|
|
218
|
+
}, r.mark = function(t2) {
|
|
219
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t2, GeneratorFunctionPrototype) : (t2.__proto__ = GeneratorFunctionPrototype, c(t2, u, "GeneratorFunction")), t2.prototype = Object.create(v), t2;
|
|
220
|
+
}, r.awrap = function(t2) {
|
|
221
|
+
return {
|
|
222
|
+
__await: t2
|
|
223
|
+
};
|
|
224
|
+
}, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function() {
|
|
225
|
+
return this;
|
|
226
|
+
}), r.AsyncIterator = AsyncIterator, r.async = function(t2, e2, n2, o2, i2) {
|
|
227
|
+
void 0 === i2 && (i2 = Promise);
|
|
228
|
+
var a2 = new AsyncIterator(h(t2, e2, n2, o2), i2);
|
|
229
|
+
return r.isGeneratorFunction(e2) ? a2 : a2.next().then(function(t3) {
|
|
230
|
+
return t3.done ? t3.value : a2.next();
|
|
231
|
+
});
|
|
232
|
+
}, g(v), c(v, u, "Generator"), c(v, i, function() {
|
|
233
|
+
return this;
|
|
234
|
+
}), c(v, "toString", function() {
|
|
235
|
+
return "[object Generator]";
|
|
236
|
+
}), r.keys = function(t2) {
|
|
237
|
+
var r2 = Object(t2), e2 = [];
|
|
238
|
+
for (var n2 in r2) e2.unshift(n2);
|
|
239
|
+
return function t3() {
|
|
240
|
+
for (; e2.length; ) if ((n2 = e2.pop()) in r2) return t3.value = n2, t3.done = false, t3;
|
|
241
|
+
return t3.done = true, t3;
|
|
242
|
+
};
|
|
243
|
+
}, r.values = x, Context.prototype = {
|
|
244
|
+
constructor: Context,
|
|
245
|
+
reset: function(r2) {
|
|
246
|
+
if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r2) for (var e2 in this) "t" === e2.charAt(0) && n.call(this, e2) && !isNaN(+e2.slice(1)) && (this[e2] = t);
|
|
247
|
+
},
|
|
248
|
+
stop: function() {
|
|
249
|
+
this.done = true;
|
|
250
|
+
var t2 = this.tryEntries[0][4];
|
|
251
|
+
if ("throw" === t2.type) throw t2.arg;
|
|
252
|
+
return this.rval;
|
|
253
|
+
},
|
|
254
|
+
dispatchException: function(r2) {
|
|
255
|
+
if (this.done) throw r2;
|
|
256
|
+
var e2 = this;
|
|
257
|
+
function n2(t2) {
|
|
258
|
+
a2.type = "throw", a2.arg = r2, e2.next = t2;
|
|
259
|
+
}
|
|
260
|
+
for (var o2 = e2.tryEntries.length - 1; o2 >= 0; --o2) {
|
|
261
|
+
var i2 = this.tryEntries[o2], a2 = i2[4], u2 = this.prev, c2 = i2[1], h2 = i2[2];
|
|
262
|
+
if (-1 === i2[0]) return n2("end"), false;
|
|
263
|
+
if (!c2 && !h2) throw Error("try statement without catch or finally");
|
|
264
|
+
if (null != i2[0] && i2[0] <= u2) {
|
|
265
|
+
if (u2 < c2) return this.method = "next", this.arg = t, n2(c2), true;
|
|
266
|
+
if (u2 < h2) return n2(h2), false;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
abrupt: function(t2, r2) {
|
|
271
|
+
for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) {
|
|
272
|
+
var n2 = this.tryEntries[e2];
|
|
273
|
+
if (n2[0] > -1 && n2[0] <= this.prev && this.prev < n2[2]) {
|
|
274
|
+
var o2 = n2;
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
o2 && ("break" === t2 || "continue" === t2) && o2[0] <= r2 && r2 <= o2[2] && (o2 = null);
|
|
279
|
+
var i2 = o2 ? o2[4] : {};
|
|
280
|
+
return i2.type = t2, i2.arg = r2, o2 ? (this.method = "next", this.next = o2[2], f) : this.complete(i2);
|
|
281
|
+
},
|
|
282
|
+
complete: function(t2, r2) {
|
|
283
|
+
if ("throw" === t2.type) throw t2.arg;
|
|
284
|
+
return "break" === t2.type || "continue" === t2.type ? this.next = t2.arg : "return" === t2.type ? (this.rval = this.arg = t2.arg, this.method = "return", this.next = "end") : "normal" === t2.type && r2 && (this.next = r2), f;
|
|
285
|
+
},
|
|
286
|
+
finish: function(t2) {
|
|
287
|
+
for (var r2 = this.tryEntries.length - 1; r2 >= 0; --r2) {
|
|
288
|
+
var e2 = this.tryEntries[r2];
|
|
289
|
+
if (e2[2] === t2) return this.complete(e2[4], e2[3]), m(e2), f;
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
catch: function(t2) {
|
|
293
|
+
for (var r2 = this.tryEntries.length - 1; r2 >= 0; --r2) {
|
|
294
|
+
var e2 = this.tryEntries[r2];
|
|
295
|
+
if (e2[0] === t2) {
|
|
296
|
+
var n2 = e2[4];
|
|
297
|
+
if ("throw" === n2.type) {
|
|
298
|
+
var o2 = n2.arg;
|
|
299
|
+
m(e2);
|
|
300
|
+
}
|
|
301
|
+
return o2;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
throw Error("illegal catch attempt");
|
|
305
|
+
},
|
|
306
|
+
delegateYield: function(r2, e2, n2) {
|
|
307
|
+
return this.delegate = {
|
|
308
|
+
i: x(r2),
|
|
309
|
+
r: e2,
|
|
310
|
+
n: n2
|
|
311
|
+
}, "next" === this.method && (this.arg = t), f;
|
|
312
|
+
}
|
|
313
|
+
}, r;
|
|
314
|
+
}
|
|
315
|
+
var Then = function Then2(props) {
|
|
316
|
+
return render(props);
|
|
317
|
+
};
|
|
318
|
+
function isFunction(input) {
|
|
319
|
+
return typeof input === "function";
|
|
320
|
+
}
|
|
321
|
+
function hasThen(input) {
|
|
322
|
+
return Reflect.has(input, "then") && isFunction(input.then);
|
|
323
|
+
}
|
|
324
|
+
function hasCatch(input) {
|
|
325
|
+
return Reflect.has(input, "catch") && isFunction(input["catch"]);
|
|
326
|
+
}
|
|
327
|
+
function isThenable(input) {
|
|
328
|
+
if (typeof input !== "object" || input === null) return false;
|
|
329
|
+
return input instanceof Promise || input !== Promise.prototype && hasThen(input) && hasCatch(input);
|
|
330
|
+
}
|
|
331
|
+
var shallowArraysEqual = function shallowArraysEqual2(a, b) {
|
|
332
|
+
if (!Array.isArray(a) || !Array.isArray(b)) throw new Error("shallowArraysEqual only accepts arrays as parameters");
|
|
333
|
+
if (a.length !== b.length) return false;
|
|
334
|
+
for (var i = 0; i < a.length; ++i) {
|
|
335
|
+
if (a[i] !== b[i]) return false;
|
|
336
|
+
}
|
|
337
|
+
return true;
|
|
338
|
+
};
|
|
339
|
+
var createCancellablePromise = function createCancellablePromise2(promise) {
|
|
340
|
+
if (!isThenable(promise)) {
|
|
341
|
+
throw new Error("Argument of createCancellablePromise should be a Promise");
|
|
342
|
+
}
|
|
343
|
+
var isCancelled = {
|
|
344
|
+
value: false
|
|
345
|
+
};
|
|
346
|
+
var wrappedPromise = new Promise(/* @__PURE__ */ function() {
|
|
347
|
+
var _ref = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(res, rej) {
|
|
348
|
+
var d;
|
|
349
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
350
|
+
while (1) switch (_context.prev = _context.next) {
|
|
351
|
+
case 0:
|
|
352
|
+
_context.prev = 0;
|
|
353
|
+
_context.next = 3;
|
|
354
|
+
return promise;
|
|
355
|
+
case 3:
|
|
356
|
+
d = _context.sent;
|
|
357
|
+
if (!isCancelled.value) {
|
|
358
|
+
res(d);
|
|
359
|
+
}
|
|
360
|
+
_context.next = 10;
|
|
361
|
+
break;
|
|
362
|
+
case 7:
|
|
363
|
+
_context.prev = 7;
|
|
364
|
+
_context.t0 = _context["catch"](0);
|
|
365
|
+
if (!isCancelled.value) {
|
|
366
|
+
rej(_context.t0);
|
|
367
|
+
}
|
|
368
|
+
case 10:
|
|
369
|
+
case "end":
|
|
370
|
+
return _context.stop();
|
|
371
|
+
}
|
|
372
|
+
}, _callee, null, [[0, 7]]);
|
|
373
|
+
}));
|
|
374
|
+
return function(_x, _x2) {
|
|
375
|
+
return _ref.apply(this, arguments);
|
|
376
|
+
};
|
|
377
|
+
}());
|
|
378
|
+
Object.keys(promise).forEach(function(key) {
|
|
379
|
+
wrappedPromise[key] = promise[key];
|
|
380
|
+
});
|
|
381
|
+
return {
|
|
382
|
+
promise: wrappedPromise,
|
|
383
|
+
cancel: function cancel() {
|
|
384
|
+
isCancelled.value = true;
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
};
|
|
388
|
+
var useSingleton = function useSingleton2(callback, dependencies) {
|
|
389
|
+
if (dependencies === void 0) {
|
|
390
|
+
dependencies = [];
|
|
391
|
+
}
|
|
392
|
+
var hasRan = useRef(false);
|
|
393
|
+
var lastDependencies = useRef([]);
|
|
394
|
+
if (typeof callback !== "function") {
|
|
395
|
+
throw new Error("Incorrect callback parameter for useSingleton hook; expected a function, but got: '" + typeof callback + "'.");
|
|
396
|
+
}
|
|
397
|
+
if (!Array.isArray(dependencies)) {
|
|
398
|
+
throw new Error("Incorrect dependencies parameter for useSingleton; expected an array, but got: '" + typeof dependencies + "'.");
|
|
399
|
+
}
|
|
400
|
+
var hasDependencies = Array.isArray(dependencies) && dependencies.length > 0;
|
|
401
|
+
if (hasDependencies) {
|
|
402
|
+
var hasAnyDependencyChanged = !shallowArraysEqual(lastDependencies.current, dependencies);
|
|
403
|
+
if (hasAnyDependencyChanged) {
|
|
404
|
+
lastDependencies.current = dependencies;
|
|
405
|
+
} else if (hasRan.current) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
} else if (hasRan.current) {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
callback();
|
|
412
|
+
hasRan.current = true;
|
|
413
|
+
};
|
|
414
|
+
function IfAsync(_ref) {
|
|
415
|
+
var promise = _ref.promise, _ref$keepAlive = _ref.keepAlive, keepAlive = _ref$keepAlive === void 0 ? false : _ref$keepAlive, children = _ref.children;
|
|
416
|
+
var _useState = useState(null), isResolved = _useState[0], setIsResolved = _useState[1];
|
|
417
|
+
var _useState2 = useState(null), returnValue = _useState2[0], setReturnValue = _useState2[1];
|
|
418
|
+
var cancellablePromise = useMemo(function() {
|
|
419
|
+
return createCancellablePromise(promise);
|
|
420
|
+
}, [promise]);
|
|
421
|
+
var history = useRef([]);
|
|
422
|
+
useEffect(function() {
|
|
423
|
+
return function() {
|
|
424
|
+
if (!keepAlive) {
|
|
425
|
+
cancellablePromise.cancel();
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
}, [cancellablePromise, cancellablePromise.promise, keepAlive]);
|
|
429
|
+
useSingleton(/* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee() {
|
|
430
|
+
var data;
|
|
431
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
432
|
+
while (1) switch (_context.prev = _context.next) {
|
|
433
|
+
case 0:
|
|
434
|
+
setIsResolved(null);
|
|
435
|
+
setReturnValue(null);
|
|
436
|
+
_context.prev = 2;
|
|
437
|
+
_context.next = 5;
|
|
438
|
+
return cancellablePromise.promise;
|
|
439
|
+
case 5:
|
|
440
|
+
data = _context.sent;
|
|
441
|
+
setReturnValue(data);
|
|
442
|
+
setIsResolved(true);
|
|
443
|
+
history.current.push(cancellablePromise);
|
|
444
|
+
_context.next = 16;
|
|
445
|
+
break;
|
|
446
|
+
case 11:
|
|
447
|
+
_context.prev = 11;
|
|
448
|
+
_context.t0 = _context["catch"](2);
|
|
449
|
+
setReturnValue(_context.t0);
|
|
450
|
+
setIsResolved(false);
|
|
451
|
+
history.current.push(cancellablePromise);
|
|
452
|
+
case 16:
|
|
453
|
+
case "end":
|
|
454
|
+
return _context.stop();
|
|
455
|
+
}
|
|
456
|
+
}, _callee, null, [[2, 11]]);
|
|
457
|
+
})), [cancellablePromise.promise]);
|
|
458
|
+
if (!children || !isThenable(promise)) {
|
|
459
|
+
return null;
|
|
460
|
+
}
|
|
461
|
+
if (isResolved === null) {
|
|
462
|
+
var hasFallback = $dbSRa$react.Children.toArray(children).find(function(c) {
|
|
463
|
+
return c.type === Fallback;
|
|
464
|
+
});
|
|
465
|
+
return $dbSRa$react.createElement(Fragment, null, hasFallback || null);
|
|
466
|
+
}
|
|
467
|
+
if (!isResolved) {
|
|
468
|
+
var hasElse = $dbSRa$react.Children.toArray(children).find(function(c) {
|
|
469
|
+
return c.type === Else;
|
|
470
|
+
});
|
|
471
|
+
if (!hasElse) return $dbSRa$react.createElement(Fragment, null, null);
|
|
472
|
+
var elseElement = hasElse;
|
|
473
|
+
var hasElseProps = hasElse.props;
|
|
474
|
+
if (typeof hasElseProps.children === "function") {
|
|
475
|
+
elseElement = _extends({}, hasElse, {
|
|
476
|
+
props: _extends({}, hasElseProps, {
|
|
477
|
+
children: function children2() {
|
|
478
|
+
return hasElseProps.children(returnValue, history.current, cancellablePromise.promise);
|
|
479
|
+
}
|
|
480
|
+
})
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
return $dbSRa$react.createElement(Fragment, null, elseElement);
|
|
484
|
+
}
|
|
485
|
+
var hasThen2 = $dbSRa$react.Children.toArray(children).find(function(c) {
|
|
486
|
+
return c.type === Then;
|
|
487
|
+
});
|
|
488
|
+
if (!hasThen2) return $dbSRa$react.createElement(Fragment, null, null);
|
|
489
|
+
var thenElement = hasThen2;
|
|
490
|
+
var hasThenProps = hasThen2.props;
|
|
491
|
+
if (typeof hasThenProps.children === "function") {
|
|
492
|
+
thenElement = _extends({}, hasThen2, {
|
|
493
|
+
props: _extends({}, hasThenProps, {
|
|
494
|
+
children: function children2() {
|
|
495
|
+
return hasThenProps.children(returnValue, history.current, cancellablePromise.promise);
|
|
496
|
+
}
|
|
497
|
+
})
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
return $dbSRa$react.createElement(Fragment, null, thenElement);
|
|
501
|
+
}
|
|
502
|
+
var getConditionResult = function getConditionResult2(condition) {
|
|
503
|
+
var conditionResult = Boolean(typeof condition === "function" ? condition() : condition);
|
|
504
|
+
return conditionResult;
|
|
505
|
+
};
|
|
506
|
+
function tinyWarning(condition, message) {
|
|
507
|
+
if (process.env.NODE_ENV !== "production") {
|
|
508
|
+
if (condition) {
|
|
509
|
+
if (typeof console !== "undefined") {
|
|
510
|
+
console.warn(message);
|
|
511
|
+
}
|
|
512
|
+
try {
|
|
513
|
+
throw new Error(message);
|
|
514
|
+
} catch (x) {
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
var If = function If2(_ref) {
|
|
520
|
+
var condition = _ref.condition, _ref$keepAlive = _ref.keepAlive, keepAlive = _ref$keepAlive === void 0 ? false : _ref$keepAlive, children = _ref.children;
|
|
521
|
+
if (!children) {
|
|
522
|
+
return null;
|
|
523
|
+
}
|
|
524
|
+
tinyWarning(!Array.isArray(children) && !(children.type === Else || children.type === Then) || !$dbSRa$react__default.Children.toArray(children).every(function(child) {
|
|
525
|
+
return child.type === Else || child.type === Then || child.type === Fallback;
|
|
526
|
+
}), "The <If> component should contain <Then /> <Else /> or <Fallback /> components as its children");
|
|
527
|
+
if (isThenable(condition)) {
|
|
528
|
+
return $dbSRa$react__default.createElement(IfAsync, {
|
|
529
|
+
promise: condition,
|
|
530
|
+
keepAlive
|
|
531
|
+
}, children);
|
|
532
|
+
}
|
|
533
|
+
var conditionResult = getConditionResult(condition);
|
|
534
|
+
return $dbSRa$react__default.createElement(Fragment, null, $dbSRa$react__default.Children.toArray(children).find(function(c) {
|
|
535
|
+
return c.type !== Else !== !conditionResult;
|
|
536
|
+
}) || null);
|
|
537
|
+
};
|
|
538
|
+
var Switch = function Switch2(_ref) {
|
|
539
|
+
var _ref2;
|
|
540
|
+
var children = _ref.children;
|
|
541
|
+
var matchingCase = void 0;
|
|
542
|
+
var defaultCase = void 0;
|
|
543
|
+
if (isFunction(children)) {
|
|
544
|
+
children = children();
|
|
545
|
+
}
|
|
546
|
+
$dbSRa$react.Children.forEach(children, function(child) {
|
|
547
|
+
if (!$dbSRa$react.isValidElement(child)) {
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
if (!matchingCase && child.type === Case) {
|
|
551
|
+
var childProps = child.props;
|
|
552
|
+
var conditionResult = getConditionResult(childProps.condition);
|
|
553
|
+
if (conditionResult) {
|
|
554
|
+
matchingCase = child;
|
|
555
|
+
}
|
|
556
|
+
} else if (!defaultCase && child.type === Default) {
|
|
557
|
+
defaultCase = child;
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
return (_ref2 = matchingCase != null ? matchingCase : defaultCase) != null ? _ref2 : null;
|
|
561
|
+
};
|
|
562
|
+
export {
|
|
563
|
+
Case as C,
|
|
564
|
+
Default as D,
|
|
565
|
+
If as I,
|
|
566
|
+
Switch as S
|
|
567
|
+
};
|
|
568
|
+
//# sourceMappingURL=react-if.esm-Cek6sbNY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-if.esm-CGh0ofh0.js","sources":["../node_modules/react-if/dist/react-if.esm.js"],"sourcesContent":["import * as React from 'react';\nimport React__default, { Fragment, useRef, useState, useMemo, useEffect } from 'react';\n\n/**\n * Renders a React component while also checking whether the children are a function or not\n * @param props Props of the component to render\n */\nvar render = function render(props) {\n if (typeof props.children === 'function') {\n return React__default.createElement(Fragment, null, props.children());\n }\n return React__default.createElement(Fragment, null, props.children || null);\n};\n\n/**\n * If the `<Case />` is the first one to have its condition evaluates to true\n * inside the parent `<Switch />` it will be the only rendered.\n * @param props The props to pass down to the `<Case />` component\n */\nvar Case = function Case(_ref) {\n var _ref$children = _ref.children,\n children = _ref$children === void 0 ? null : _ref$children;\n return render({\n children: children\n });\n};\n\n/**\n * If no `<Case />` have its condition evaluates to true inside the parent `<Switch />`,\n * the first `<Default />` will be the only one rendered.\n * @param props The props to pass down to the `<Default />` component\n */\nvar Default = function Default(_ref) {\n var _ref$children = _ref.children,\n children = _ref$children === void 0 ? null : _ref$children;\n return render({\n children: children\n });\n};\n\n/**\n * Must only contain a single child, which it renders as-is.\n * Should not be used outside of an `<If />` block.\n * @param props The props to pass down to the `<Else />` component\n */\nvar Else = function Else(props) {\n return render(props);\n};\n\n/**\n * Must contain only a single child, which it renders as-is.\n * Should not be used outside of an `<If />` block whose condition prop is a promise.\n * @param props The props to pass down to the `<Fallback />` component\n */\nvar Fallback = function Fallback(props) {\n return render(props);\n};\n\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) {\n try {\n var i = n[a](c),\n u = i.value;\n } catch (n) {\n return void e(n);\n }\n i.done ? t(u) : Promise.resolve(u).then(r, o);\n}\nfunction _asyncToGenerator(n) {\n return function () {\n var t = this,\n e = arguments;\n return new Promise(function (r, o) {\n var a = n.apply(t, e);\n function _next(n) {\n asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n);\n }\n function _throw(n) {\n asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n);\n }\n _next(void 0);\n });\n };\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _regeneratorRuntime() {\n _regeneratorRuntime = function () {\n return r;\n };\n var t,\n r = {},\n e = Object.prototype,\n n = e.hasOwnProperty,\n o = \"function\" == typeof Symbol ? Symbol : {},\n i = o.iterator || \"@@iterator\",\n a = o.asyncIterator || \"@@asyncIterator\",\n u = o.toStringTag || \"@@toStringTag\";\n function c(t, r, e, n) {\n return Object.defineProperty(t, r, {\n value: e,\n enumerable: !n,\n configurable: !n,\n writable: !n\n });\n }\n try {\n c({}, \"\");\n } catch (t) {\n c = function (t, r, e) {\n return t[r] = e;\n };\n }\n function h(r, e, n, o) {\n var i = e && e.prototype instanceof Generator ? e : Generator,\n a = Object.create(i.prototype);\n return c(a, \"_invoke\", function (r, e, n) {\n var o = 1;\n return function (i, a) {\n if (3 === o) throw Error(\"Generator is already running\");\n if (4 === o) {\n if (\"throw\" === i) throw a;\n return {\n value: t,\n done: !0\n };\n }\n for (n.method = i, n.arg = a;;) {\n var u = n.delegate;\n if (u) {\n var c = d(u, n);\n if (c) {\n if (c === f) continue;\n return c;\n }\n }\n if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) {\n if (1 === o) throw o = 4, n.arg;\n n.dispatchException(n.arg);\n } else \"return\" === n.method && n.abrupt(\"return\", n.arg);\n o = 3;\n var h = s(r, e, n);\n if (\"normal\" === h.type) {\n if (o = n.done ? 4 : 2, h.arg === f) continue;\n return {\n value: h.arg,\n done: n.done\n };\n }\n \"throw\" === h.type && (o = 4, n.method = \"throw\", n.arg = h.arg);\n }\n };\n }(r, n, new Context(o || [])), !0), a;\n }\n function s(t, r, e) {\n try {\n return {\n type: \"normal\",\n arg: t.call(r, e)\n };\n } catch (t) {\n return {\n type: \"throw\",\n arg: t\n };\n }\n }\n r.wrap = h;\n var f = {};\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n var l = {};\n c(l, i, function () {\n return this;\n });\n var p = Object.getPrototypeOf,\n y = p && p(p(x([])));\n y && y !== e && n.call(y, i) && (l = y);\n var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l);\n function g(t) {\n [\"next\", \"throw\", \"return\"].forEach(function (r) {\n c(t, r, function (t) {\n return this._invoke(r, t);\n });\n });\n }\n function AsyncIterator(t, r) {\n function e(o, i, a, u) {\n var c = s(t[o], t, i);\n if (\"throw\" !== c.type) {\n var h = c.arg,\n f = h.value;\n return f && \"object\" == typeof f && n.call(f, \"__await\") ? r.resolve(f.__await).then(function (t) {\n e(\"next\", t, a, u);\n }, function (t) {\n e(\"throw\", t, a, u);\n }) : r.resolve(f).then(function (t) {\n h.value = t, a(h);\n }, function (t) {\n return e(\"throw\", t, a, u);\n });\n }\n u(c.arg);\n }\n var o;\n c(this, \"_invoke\", function (t, n) {\n function i() {\n return new r(function (r, o) {\n e(t, n, r, o);\n });\n }\n return o = o ? o.then(i, i) : i();\n }, !0);\n }\n function d(r, e) {\n var n = e.method,\n o = r.i[n];\n if (o === t) return e.delegate = null, \"throw\" === n && r.i.return && (e.method = \"return\", e.arg = t, d(r, e), \"throw\" === e.method) || \"return\" !== n && (e.method = \"throw\", e.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), f;\n var i = s(o, r.i, e.arg);\n if (\"throw\" === i.type) return e.method = \"throw\", e.arg = i.arg, e.delegate = null, f;\n var a = i.arg;\n return a ? a.done ? (e[r.r] = a.value, e.next = r.n, \"return\" !== e.method && (e.method = \"next\", e.arg = t), e.delegate = null, f) : a : (e.method = \"throw\", e.arg = new TypeError(\"iterator result is not an object\"), e.delegate = null, f);\n }\n function w(t) {\n this.tryEntries.push(t);\n }\n function m(r) {\n var e = r[4] || {};\n e.type = \"normal\", e.arg = t, r[4] = e;\n }\n function Context(t) {\n this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0);\n }\n function x(r) {\n if (null != r) {\n var e = r[i];\n if (e) return e.call(r);\n if (\"function\" == typeof r.next) return r;\n if (!isNaN(r.length)) {\n var o = -1,\n a = function e() {\n for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e;\n return e.value = t, e.done = !0, e;\n };\n return a.next = a;\n }\n }\n throw new TypeError(typeof r + \" is not iterable\");\n }\n return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, \"constructor\", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), r.isGeneratorFunction = function (t) {\n var r = \"function\" == typeof t && t.constructor;\n return !!r && (r === GeneratorFunction || \"GeneratorFunction\" === (r.displayName || r.name));\n }, r.mark = function (t) {\n return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, \"GeneratorFunction\")), t.prototype = Object.create(v), t;\n }, r.awrap = function (t) {\n return {\n __await: t\n };\n }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () {\n return this;\n }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) {\n void 0 === i && (i = Promise);\n var a = new AsyncIterator(h(t, e, n, o), i);\n return r.isGeneratorFunction(e) ? a : a.next().then(function (t) {\n return t.done ? t.value : a.next();\n });\n }, g(v), c(v, u, \"Generator\"), c(v, i, function () {\n return this;\n }), c(v, \"toString\", function () {\n return \"[object Generator]\";\n }), r.keys = function (t) {\n var r = Object(t),\n e = [];\n for (var n in r) e.unshift(n);\n return function t() {\n for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t;\n return t.done = !0, t;\n };\n }, r.values = x, Context.prototype = {\n constructor: Context,\n reset: function (r) {\n if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) \"t\" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t);\n },\n stop: function () {\n this.done = !0;\n var t = this.tryEntries[0][4];\n if (\"throw\" === t.type) throw t.arg;\n return this.rval;\n },\n dispatchException: function (r) {\n if (this.done) throw r;\n var e = this;\n function n(t) {\n a.type = \"throw\", a.arg = r, e.next = t;\n }\n for (var o = e.tryEntries.length - 1; o >= 0; --o) {\n var i = this.tryEntries[o],\n a = i[4],\n u = this.prev,\n c = i[1],\n h = i[2];\n if (-1 === i[0]) return n(\"end\"), !1;\n if (!c && !h) throw Error(\"try statement without catch or finally\");\n if (null != i[0] && i[0] <= u) {\n if (u < c) return this.method = \"next\", this.arg = t, n(c), !0;\n if (u < h) return n(h), !1;\n }\n }\n },\n abrupt: function (t, r) {\n for (var e = this.tryEntries.length - 1; e >= 0; --e) {\n var n = this.tryEntries[e];\n if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) {\n var o = n;\n break;\n }\n }\n o && (\"break\" === t || \"continue\" === t) && o[0] <= r && r <= o[2] && (o = null);\n var i = o ? o[4] : {};\n return i.type = t, i.arg = r, o ? (this.method = \"next\", this.next = o[2], f) : this.complete(i);\n },\n complete: function (t, r) {\n if (\"throw\" === t.type) throw t.arg;\n return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && r && (this.next = r), f;\n },\n finish: function (t) {\n for (var r = this.tryEntries.length - 1; r >= 0; --r) {\n var e = this.tryEntries[r];\n if (e[2] === t) return this.complete(e[4], e[3]), m(e), f;\n }\n },\n catch: function (t) {\n for (var r = this.tryEntries.length - 1; r >= 0; --r) {\n var e = this.tryEntries[r];\n if (e[0] === t) {\n var n = e[4];\n if (\"throw\" === n.type) {\n var o = n.arg;\n m(e);\n }\n return o;\n }\n }\n throw Error(\"illegal catch attempt\");\n },\n delegateYield: function (r, e, n) {\n return this.delegate = {\n i: x(r),\n r: e,\n n: n\n }, \"next\" === this.method && (this.arg = t), f;\n }\n }, r;\n}\n\n/**\n * Must contain only a single child, which it renders as-is.\n * Should not be used outside of an `<If />` block.\n * @param props The props to pass down to the `<Then />` component\n */\nvar Then = function Then(props) {\n return render(props);\n};\n\n/**\n * The MIT License (MIT)\n *\n * Copyright © `2020` `The Sapphire Community and its contributors`\n *\n * Source: https://github.com/sapphiredev/utilities/blob/main/packages/utilities/src/lib/isThenable.ts\n * Full license: https://github.com/sapphiredev/utilities/blob/main/LICENSE.md\n */\n/**\n * Verify if the input is a function.\n * @param input The function to verify\n */\nfunction isFunction(input) {\n return typeof input === 'function';\n}\nfunction hasThen(input) {\n return Reflect.has(input, 'then') && isFunction(input.then);\n}\nfunction hasCatch(input) {\n return Reflect.has(input, 'catch') && isFunction(input[\"catch\"]);\n}\n/**\n * Verify if an object is a promise.\n * @param input The promise to verify\n */\nfunction isThenable(input) {\n if (typeof input !== 'object' || input === null) return false;\n return input instanceof Promise || input !== Promise.prototype && hasThen(input) && hasCatch(input);\n}\n\n/**\n * Compare two arrays without checking for possible nested properties\n * @param a Array to compare with b\n * @param b Array to compare with a\n * @returns True if arrays are identical, false if they are different\n */\nvar shallowArraysEqual = function shallowArraysEqual(a, b) {\n if (!Array.isArray(a) || !Array.isArray(b)) throw new Error('shallowArraysEqual only accepts arrays as parameters');\n if (a.length !== b.length) return false;\n for (var i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n};\n/**\n * Create a CancellablePromise from a native Promise\n * @param promise The promise object to wrap\n * @returns Return value is an object of type CancellablePromise, with 2 properties:\n * - promise: a promise that can be left pending\n * - cancel: the function to use for cancelling the returned promise\n */\nvar createCancellablePromise = function createCancellablePromise(promise) {\n if (!isThenable(promise)) {\n throw new Error('Argument of createCancellablePromise should be a Promise');\n }\n var isCancelled = {\n value: false\n };\n var wrappedPromise = new Promise(/*#__PURE__*/function () {\n var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(res, rej) {\n var d;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n _context.next = 3;\n return promise;\n case 3:\n d = _context.sent;\n if (!isCancelled.value) {\n res(d);\n }\n _context.next = 10;\n break;\n case 7:\n _context.prev = 7;\n _context.t0 = _context[\"catch\"](0);\n if (!isCancelled.value) {\n rej(_context.t0);\n }\n case 10:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[0, 7]]);\n }));\n return function (_x, _x2) {\n return _ref.apply(this, arguments);\n };\n }());\n // Forward potential additional properties\n Object.keys(promise).forEach(function (key) {\n wrappedPromise[key] = promise[key];\n });\n return {\n promise: wrappedPromise,\n cancel: function cancel() {\n isCancelled.value = true;\n }\n };\n};\n\n/**\n * Calls a function only once during component lifecycle;\n * When dependency array is provided, will call the function again if at least one of the dependencies changed\n * @param callback The function to execute only once\n * @param dependencies A list of dependencies whose value, if changed since last call,\n * will trigger the execution of the callback\n */\nvar useSingleton = function useSingleton(callback, dependencies) {\n if (dependencies === void 0) {\n dependencies = [];\n }\n var hasRan = useRef(false);\n var lastDependencies = useRef([]);\n // Parameters type check\n if (typeof callback !== 'function') {\n throw new Error(\"Incorrect callback parameter for useSingleton hook; expected a function, but got: '\" + typeof callback + \"'.\");\n }\n if (!Array.isArray(dependencies)) {\n throw new Error(\"Incorrect dependencies parameter for useSingleton; expected an array, but got: '\" + typeof dependencies + \"'.\");\n }\n var hasDependencies = Array.isArray(dependencies) && dependencies.length > 0;\n if (hasDependencies) {\n // Has dependencies\n var hasAnyDependencyChanged = !shallowArraysEqual(lastDependencies.current, dependencies);\n if (hasAnyDependencyChanged) {\n // Any dep has changed => overwrite last dependencies and execute callback\n lastDependencies.current = dependencies;\n } else if (hasRan.current) {\n // No dep has changed => same behaviour as if no dependencies\n return;\n }\n } else if (hasRan.current) {\n // No dependencies\n return;\n }\n callback();\n hasRan.current = true;\n};\n\n/**\n * Is included in the `<If />` component, rendered when the condition prop of `<If />` is a Promise;\n * Renders the Fallback component, if contains any, until provided promise is fulfilled;\n * Renders `<Then />` when promise is fulfilled, `<Else />` when rejected\n */\nfunction IfAsync(_ref) {\n var promise = _ref.promise,\n _ref$keepAlive = _ref.keepAlive,\n keepAlive = _ref$keepAlive === void 0 ? false : _ref$keepAlive,\n children = _ref.children;\n var _useState = useState(null),\n isResolved = _useState[0],\n setIsResolved = _useState[1];\n var _useState2 = useState(null),\n returnValue = _useState2[0],\n setReturnValue = _useState2[1];\n // Make promise cancellable\n var cancellablePromise = useMemo(function () {\n return createCancellablePromise(promise);\n }, [promise]);\n var history = useRef([]); // Keep history of promises\n // Handle unmount\n useEffect(function () {\n return function () {\n if (!keepAlive) {\n cancellablePromise.cancel();\n }\n };\n }, [cancellablePromise, cancellablePromise.promise, keepAlive]);\n // Await promise\n useSingleton(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var data;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n setIsResolved(null);\n setReturnValue(null);\n _context.prev = 2;\n _context.next = 5;\n return cancellablePromise.promise;\n case 5:\n data = _context.sent;\n setReturnValue(data);\n setIsResolved(true);\n history.current.push(cancellablePromise);\n _context.next = 16;\n break;\n case 11:\n _context.prev = 11;\n _context.t0 = _context[\"catch\"](2);\n setReturnValue(_context.t0);\n setIsResolved(false);\n history.current.push(cancellablePromise);\n case 16:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[2, 11]]);\n })), [cancellablePromise.promise]);\n if (!children || !isThenable(promise)) {\n return null;\n }\n if (isResolved === null) {\n // Promise is pending\n var hasFallback = React.Children.toArray(children).find(function (c) {\n return c.type === Fallback;\n });\n return React.createElement(Fragment, null, hasFallback || null);\n }\n if (!isResolved) {\n // Promise is fulfilled and rejected\n var hasElse = React.Children.toArray(children).find(function (c) {\n return c.type === Else;\n });\n if (!hasElse) return React.createElement(Fragment, null, null);\n // Inject caught error\n var elseElement = hasElse;\n var hasElseProps = hasElse.props;\n if (typeof hasElseProps.children === 'function') {\n elseElement = _extends({}, hasElse, {\n props: _extends({}, hasElseProps, {\n children: function children() {\n return hasElseProps.children(returnValue, history.current, cancellablePromise.promise);\n }\n })\n });\n }\n return React.createElement(Fragment, null, elseElement);\n }\n // Promise is fulfilled and resolved\n var hasThen = React.Children.toArray(children).find(function (c) {\n return c.type === Then;\n });\n if (!hasThen) return React.createElement(Fragment, null, null);\n // Inject promise return value\n var thenElement = hasThen;\n var hasThenProps = hasThen.props;\n if (typeof hasThenProps.children === 'function') {\n thenElement = _extends({}, hasThen, {\n props: _extends({}, hasThenProps, {\n children: function children() {\n return hasThenProps.children(returnValue, history.current, cancellablePromise.promise);\n }\n })\n });\n }\n return React.createElement(Fragment, null, thenElement);\n}\n\n/**\n * Resolves a condition that is {@link BooleanLike} or returns {@link BooleanLike} from a function\n * @param condition The condition to resolve\n */\nvar getConditionResult = function getConditionResult(condition) {\n var conditionResult = Boolean(typeof condition === 'function' ? condition() : condition);\n return conditionResult;\n};\n\n/**\n * Handles errors by throwing them to the console.\n * `__DEV__` is replaced by dts-cli using {@link https://www.npmjs.com/package/babel-plugin-dev-expression babel-plugin-dev-expressions}\n * which will ensure this entire throw is not present in production\n * @param condition The condition to check\n * @param message The message to throw if `condition` resolves to `true`\n */\nfunction tinyWarning(condition, message) {\n if (process.env.NODE_ENV !== \"production\") {\n if (condition) {\n // check console for IE9 support which provides console\n // only with open devtools\n if (typeof console !== 'undefined') {\n console.warn(message);\n }\n // Throwing an error and catching it immediately to improve debugging\n // Users can utilize 'pause on caught exceptions' to get into this throw\n try {\n throw new Error(message);\n } catch (x) {\n // noop\n }\n }\n }\n}\n\n/**\n * If condition evaluates to true, renders the `<Then />` block will be rendered,\n * otherwise renders the `<Else />` block. Either block may be omitted.\n *\n * This component can contain any number of `<Then />` or `<Else />` blocks,\n * but only the first block of the right type (either Then or Else, depending on the condition) will be rendered.\n * @param __namedParameters The props to pass down to the `<IF />` component, see {@link ComponentWithConditionProps}\n */\nvar If = function If(_ref) {\n var condition = _ref.condition,\n _ref$keepAlive = _ref.keepAlive,\n keepAlive = _ref$keepAlive === void 0 ? false : _ref$keepAlive,\n children = _ref.children;\n if (!children) {\n return null;\n }\n tinyWarning(!Array.isArray(children) && !(children.type === Else || children.type === Then) || !React__default.Children.toArray(children).every(function (child) {\n return child.type === Else || child.type === Then || child.type === Fallback;\n }), 'The <If> component should contain <Then /> <Else /> or <Fallback /> components as its children');\n if (isThenable(condition)) {\n return React__default.createElement(IfAsync, {\n promise: condition,\n keepAlive: keepAlive\n }, children);\n }\n var conditionResult = getConditionResult(condition);\n return React__default.createElement(Fragment, null, React__default.Children.toArray(children).find(function (c) {\n return c.type !== Else !== !conditionResult;\n }) || null);\n};\n\n/**\n * It will render the first matching `<Case />`, or the first encountered `<Default />` (or `null`).\n *\n * This component can contain any number of `<Case />` and one `<Default />` blocks\n * @param __namedParameters Children to pass into the `<Switch />` component\n */\nvar Switch = function Switch(_ref) {\n var _ref2;\n var children = _ref.children;\n // -- Inspired by react-router --\n // We use React.Children.forEach instead of React.Children.toArray().find()\n // here because toArray adds keys to all child elements and we do not want\n // to trigger an unmount/remount for two children <Case>s or <Default>s\n var matchingCase = undefined;\n var defaultCase = undefined;\n // If the children are a function then resolve it first\n if (isFunction(children)) {\n children = children();\n }\n React.Children.forEach(children, function (child) {\n // not a valid react child, don't add it\n /* istanbul ignore next - This is only a safe fail for people writing bad code */\n if (!React.isValidElement(child)) {\n return;\n }\n if (!matchingCase && child.type === Case) {\n var childProps = child.props;\n var conditionResult = getConditionResult(childProps.condition);\n if (conditionResult) {\n matchingCase = child;\n } // else not matching condition, don't add it\n } else if (!defaultCase && child.type === Default) {\n defaultCase = child;\n } // else unknown type, don't add it\n });\n return (_ref2 = matchingCase != null ? matchingCase : defaultCase) != null ? _ref2 : null;\n};\n\n/** A shorthand for\n *\n * ```jsx\n * <If condition={...}>\n * <Else>\n * { ... }\n * </Else>\n * </If>\n * ```\n *\n * The same rules apply to the child elements as with using the `<Else />` block.\n *\n * @param __namedParameters The props to pass down to the `<IF />` component, see {@link ComponentWithConditionProps}\n */\nvar Unless = function Unless(_ref) {\n var condition = _ref.condition,\n _ref$children = _ref.children,\n children = _ref$children === void 0 ? null : _ref$children;\n var conditionResult = Boolean(getConditionResult(condition));\n return !conditionResult && children ? render({\n children: children\n }) : null;\n};\n\n/** A shorthand for\n *\n * ```jsx\n * <If condition={...}>\n * <Then>\n * { ... }\n * </Then>\n * </If>\n * ```\n *\n * The same rules apply to the child elements as with using the `<Then /`> block.\n *\n * @param __namedParameters The props to pass down to the `<IF />` component, see {@link ComponentWithConditionProps}\n */\nvar When = function When(_ref) {\n var condition = _ref.condition,\n _ref$children = _ref.children,\n children = _ref$children === void 0 ? null : _ref$children;\n var conditionResult = Boolean(getConditionResult(condition));\n return conditionResult && children ? render({\n children: children\n }) : null;\n};\n\nexport { Case, Default, Else, Fallback, If, Switch, Then, Unless, When };\n//# sourceMappingURL=react-if.esm.js.map\n"],"names":["render","React__default","Case","Default","getConditionResult","Switch","React","When"],"mappings":";;AAOA,IAAI,SAAS,SAASA,QAAO,OAAO;AAClC,MAAI,OAAO,MAAM,aAAa,YAAY;AACxC,WAAOC,sBAAe,cAAc,UAAU,MAAM,MAAM,SAAQ,CAAE;AAAA,EACrE;AACD,SAAOA,sBAAe,cAAc,UAAU,MAAM,MAAM,YAAY,IAAI;AAC5E;AAOG,IAAC,OAAO,SAASC,MAAK,MAAM;AAC7B,MAAI,gBAAgB,KAAK,UACvB,WAAW,kBAAkB,SAAS,OAAO;AAC/C,SAAO,OAAO;AAAA,IACZ;AAAA,EACJ,CAAG;AACH;AAOG,IAAC,UAAU,SAASC,SAAQ,MAAM;AACnC,MAAI,gBAAgB,KAAK,UACvB,WAAW,kBAAkB,SAAS,OAAO;AAC/C,SAAO,OAAO;AAAA,IACZ;AAAA,EACJ,CAAG;AACH;AAyVA,SAAS,WAAW,OAAO;AACzB,SAAO,OAAO,UAAU;AAC1B;AAgPA,IAAI,qBAAqB,SAASC,oBAAmB,WAAW;AAC9D,MAAI,kBAAkB,QAAQ,OAAO,cAAc,aAAa,UAAS,IAAK,SAAS;AACvF,SAAO;AACT;AAiEG,IAAC,SAAS,SAASC,QAAO,MAAM;AACjC,MAAI;AACJ,MAAI,WAAW,KAAK;AAKpB,MAAI,eAAe;AACnB,MAAI,cAAc;AAElB,MAAI,WAAW,QAAQ,GAAG;AACxB,eAAW,SAAQ;AAAA,EACpB;AACDC,eAAM,SAAS,QAAQ,UAAU,SAAU,OAAO;AAGhD,QAAI,CAACA,aAAM,eAAe,KAAK,GAAG;AAChC;AAAA,IACD;AACD,QAAI,CAAC,gBAAgB,MAAM,SAAS,MAAM;AACxC,UAAI,aAAa,MAAM;AACvB,UAAI,kBAAkB,mBAAmB,WAAW,SAAS;AAC7D,UAAI,iBAAiB;AACnB,uBAAe;AAAA,MAChB;AAAA,IACF,WAAU,CAAC,eAAe,MAAM,SAAS,SAAS;AACjD,oBAAc;AAAA,IACf;AAAA,EACL,CAAG;AACD,UAAQ,QAAQ,gBAAgB,OAAO,eAAe,gBAAgB,OAAO,QAAQ;AACvF;AAwCG,IAAC,OAAO,SAASC,MAAK,MAAM;AAC7B,MAAI,YAAY,KAAK,WACnB,gBAAgB,KAAK,UACrB,WAAW,kBAAkB,SAAS,OAAO;AAC/C,MAAI,kBAAkB,QAAQ,mBAAmB,SAAS,CAAC;AAC3D,SAAO,mBAAmB,WAAW,OAAO;AAAA,IAC1C;AAAA,EACD,CAAA,IAAI;AACP;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"react-if.esm-Cek6sbNY.js","sources":["../node_modules/react-if/dist/react-if.esm.js"],"sourcesContent":["import * as React from 'react';\nimport React__default, { Fragment, useRef, useState, useMemo, useEffect } from 'react';\n\n/**\n * Renders a React component while also checking whether the children are a function or not\n * @param props Props of the component to render\n */\nvar render = function render(props) {\n if (typeof props.children === 'function') {\n return React__default.createElement(Fragment, null, props.children());\n }\n return React__default.createElement(Fragment, null, props.children || null);\n};\n\n/**\n * If the `<Case />` is the first one to have its condition evaluates to true\n * inside the parent `<Switch />` it will be the only rendered.\n * @param props The props to pass down to the `<Case />` component\n */\nvar Case = function Case(_ref) {\n var _ref$children = _ref.children,\n children = _ref$children === void 0 ? null : _ref$children;\n return render({\n children: children\n });\n};\n\n/**\n * If no `<Case />` have its condition evaluates to true inside the parent `<Switch />`,\n * the first `<Default />` will be the only one rendered.\n * @param props The props to pass down to the `<Default />` component\n */\nvar Default = function Default(_ref) {\n var _ref$children = _ref.children,\n children = _ref$children === void 0 ? null : _ref$children;\n return render({\n children: children\n });\n};\n\n/**\n * Must only contain a single child, which it renders as-is.\n * Should not be used outside of an `<If />` block.\n * @param props The props to pass down to the `<Else />` component\n */\nvar Else = function Else(props) {\n return render(props);\n};\n\n/**\n * Must contain only a single child, which it renders as-is.\n * Should not be used outside of an `<If />` block whose condition prop is a promise.\n * @param props The props to pass down to the `<Fallback />` component\n */\nvar Fallback = function Fallback(props) {\n return render(props);\n};\n\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) {\n try {\n var i = n[a](c),\n u = i.value;\n } catch (n) {\n return void e(n);\n }\n i.done ? t(u) : Promise.resolve(u).then(r, o);\n}\nfunction _asyncToGenerator(n) {\n return function () {\n var t = this,\n e = arguments;\n return new Promise(function (r, o) {\n var a = n.apply(t, e);\n function _next(n) {\n asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n);\n }\n function _throw(n) {\n asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n);\n }\n _next(void 0);\n });\n };\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _regeneratorRuntime() {\n _regeneratorRuntime = function () {\n return r;\n };\n var t,\n r = {},\n e = Object.prototype,\n n = e.hasOwnProperty,\n o = \"function\" == typeof Symbol ? Symbol : {},\n i = o.iterator || \"@@iterator\",\n a = o.asyncIterator || \"@@asyncIterator\",\n u = o.toStringTag || \"@@toStringTag\";\n function c(t, r, e, n) {\n return Object.defineProperty(t, r, {\n value: e,\n enumerable: !n,\n configurable: !n,\n writable: !n\n });\n }\n try {\n c({}, \"\");\n } catch (t) {\n c = function (t, r, e) {\n return t[r] = e;\n };\n }\n function h(r, e, n, o) {\n var i = e && e.prototype instanceof Generator ? e : Generator,\n a = Object.create(i.prototype);\n return c(a, \"_invoke\", function (r, e, n) {\n var o = 1;\n return function (i, a) {\n if (3 === o) throw Error(\"Generator is already running\");\n if (4 === o) {\n if (\"throw\" === i) throw a;\n return {\n value: t,\n done: !0\n };\n }\n for (n.method = i, n.arg = a;;) {\n var u = n.delegate;\n if (u) {\n var c = d(u, n);\n if (c) {\n if (c === f) continue;\n return c;\n }\n }\n if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) {\n if (1 === o) throw o = 4, n.arg;\n n.dispatchException(n.arg);\n } else \"return\" === n.method && n.abrupt(\"return\", n.arg);\n o = 3;\n var h = s(r, e, n);\n if (\"normal\" === h.type) {\n if (o = n.done ? 4 : 2, h.arg === f) continue;\n return {\n value: h.arg,\n done: n.done\n };\n }\n \"throw\" === h.type && (o = 4, n.method = \"throw\", n.arg = h.arg);\n }\n };\n }(r, n, new Context(o || [])), !0), a;\n }\n function s(t, r, e) {\n try {\n return {\n type: \"normal\",\n arg: t.call(r, e)\n };\n } catch (t) {\n return {\n type: \"throw\",\n arg: t\n };\n }\n }\n r.wrap = h;\n var f = {};\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n var l = {};\n c(l, i, function () {\n return this;\n });\n var p = Object.getPrototypeOf,\n y = p && p(p(x([])));\n y && y !== e && n.call(y, i) && (l = y);\n var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l);\n function g(t) {\n [\"next\", \"throw\", \"return\"].forEach(function (r) {\n c(t, r, function (t) {\n return this._invoke(r, t);\n });\n });\n }\n function AsyncIterator(t, r) {\n function e(o, i, a, u) {\n var c = s(t[o], t, i);\n if (\"throw\" !== c.type) {\n var h = c.arg,\n f = h.value;\n return f && \"object\" == typeof f && n.call(f, \"__await\") ? r.resolve(f.__await).then(function (t) {\n e(\"next\", t, a, u);\n }, function (t) {\n e(\"throw\", t, a, u);\n }) : r.resolve(f).then(function (t) {\n h.value = t, a(h);\n }, function (t) {\n return e(\"throw\", t, a, u);\n });\n }\n u(c.arg);\n }\n var o;\n c(this, \"_invoke\", function (t, n) {\n function i() {\n return new r(function (r, o) {\n e(t, n, r, o);\n });\n }\n return o = o ? o.then(i, i) : i();\n }, !0);\n }\n function d(r, e) {\n var n = e.method,\n o = r.i[n];\n if (o === t) return e.delegate = null, \"throw\" === n && r.i.return && (e.method = \"return\", e.arg = t, d(r, e), \"throw\" === e.method) || \"return\" !== n && (e.method = \"throw\", e.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), f;\n var i = s(o, r.i, e.arg);\n if (\"throw\" === i.type) return e.method = \"throw\", e.arg = i.arg, e.delegate = null, f;\n var a = i.arg;\n return a ? a.done ? (e[r.r] = a.value, e.next = r.n, \"return\" !== e.method && (e.method = \"next\", e.arg = t), e.delegate = null, f) : a : (e.method = \"throw\", e.arg = new TypeError(\"iterator result is not an object\"), e.delegate = null, f);\n }\n function w(t) {\n this.tryEntries.push(t);\n }\n function m(r) {\n var e = r[4] || {};\n e.type = \"normal\", e.arg = t, r[4] = e;\n }\n function Context(t) {\n this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0);\n }\n function x(r) {\n if (null != r) {\n var e = r[i];\n if (e) return e.call(r);\n if (\"function\" == typeof r.next) return r;\n if (!isNaN(r.length)) {\n var o = -1,\n a = function e() {\n for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e;\n return e.value = t, e.done = !0, e;\n };\n return a.next = a;\n }\n }\n throw new TypeError(typeof r + \" is not iterable\");\n }\n return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, \"constructor\", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), r.isGeneratorFunction = function (t) {\n var r = \"function\" == typeof t && t.constructor;\n return !!r && (r === GeneratorFunction || \"GeneratorFunction\" === (r.displayName || r.name));\n }, r.mark = function (t) {\n return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, \"GeneratorFunction\")), t.prototype = Object.create(v), t;\n }, r.awrap = function (t) {\n return {\n __await: t\n };\n }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () {\n return this;\n }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) {\n void 0 === i && (i = Promise);\n var a = new AsyncIterator(h(t, e, n, o), i);\n return r.isGeneratorFunction(e) ? a : a.next().then(function (t) {\n return t.done ? t.value : a.next();\n });\n }, g(v), c(v, u, \"Generator\"), c(v, i, function () {\n return this;\n }), c(v, \"toString\", function () {\n return \"[object Generator]\";\n }), r.keys = function (t) {\n var r = Object(t),\n e = [];\n for (var n in r) e.unshift(n);\n return function t() {\n for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t;\n return t.done = !0, t;\n };\n }, r.values = x, Context.prototype = {\n constructor: Context,\n reset: function (r) {\n if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) \"t\" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t);\n },\n stop: function () {\n this.done = !0;\n var t = this.tryEntries[0][4];\n if (\"throw\" === t.type) throw t.arg;\n return this.rval;\n },\n dispatchException: function (r) {\n if (this.done) throw r;\n var e = this;\n function n(t) {\n a.type = \"throw\", a.arg = r, e.next = t;\n }\n for (var o = e.tryEntries.length - 1; o >= 0; --o) {\n var i = this.tryEntries[o],\n a = i[4],\n u = this.prev,\n c = i[1],\n h = i[2];\n if (-1 === i[0]) return n(\"end\"), !1;\n if (!c && !h) throw Error(\"try statement without catch or finally\");\n if (null != i[0] && i[0] <= u) {\n if (u < c) return this.method = \"next\", this.arg = t, n(c), !0;\n if (u < h) return n(h), !1;\n }\n }\n },\n abrupt: function (t, r) {\n for (var e = this.tryEntries.length - 1; e >= 0; --e) {\n var n = this.tryEntries[e];\n if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) {\n var o = n;\n break;\n }\n }\n o && (\"break\" === t || \"continue\" === t) && o[0] <= r && r <= o[2] && (o = null);\n var i = o ? o[4] : {};\n return i.type = t, i.arg = r, o ? (this.method = \"next\", this.next = o[2], f) : this.complete(i);\n },\n complete: function (t, r) {\n if (\"throw\" === t.type) throw t.arg;\n return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && r && (this.next = r), f;\n },\n finish: function (t) {\n for (var r = this.tryEntries.length - 1; r >= 0; --r) {\n var e = this.tryEntries[r];\n if (e[2] === t) return this.complete(e[4], e[3]), m(e), f;\n }\n },\n catch: function (t) {\n for (var r = this.tryEntries.length - 1; r >= 0; --r) {\n var e = this.tryEntries[r];\n if (e[0] === t) {\n var n = e[4];\n if (\"throw\" === n.type) {\n var o = n.arg;\n m(e);\n }\n return o;\n }\n }\n throw Error(\"illegal catch attempt\");\n },\n delegateYield: function (r, e, n) {\n return this.delegate = {\n i: x(r),\n r: e,\n n: n\n }, \"next\" === this.method && (this.arg = t), f;\n }\n }, r;\n}\n\n/**\n * Must contain only a single child, which it renders as-is.\n * Should not be used outside of an `<If />` block.\n * @param props The props to pass down to the `<Then />` component\n */\nvar Then = function Then(props) {\n return render(props);\n};\n\n/**\n * The MIT License (MIT)\n *\n * Copyright © `2020` `The Sapphire Community and its contributors`\n *\n * Source: https://github.com/sapphiredev/utilities/blob/main/packages/utilities/src/lib/isThenable.ts\n * Full license: https://github.com/sapphiredev/utilities/blob/main/LICENSE.md\n */\n/**\n * Verify if the input is a function.\n * @param input The function to verify\n */\nfunction isFunction(input) {\n return typeof input === 'function';\n}\nfunction hasThen(input) {\n return Reflect.has(input, 'then') && isFunction(input.then);\n}\nfunction hasCatch(input) {\n return Reflect.has(input, 'catch') && isFunction(input[\"catch\"]);\n}\n/**\n * Verify if an object is a promise.\n * @param input The promise to verify\n */\nfunction isThenable(input) {\n if (typeof input !== 'object' || input === null) return false;\n return input instanceof Promise || input !== Promise.prototype && hasThen(input) && hasCatch(input);\n}\n\n/**\n * Compare two arrays without checking for possible nested properties\n * @param a Array to compare with b\n * @param b Array to compare with a\n * @returns True if arrays are identical, false if they are different\n */\nvar shallowArraysEqual = function shallowArraysEqual(a, b) {\n if (!Array.isArray(a) || !Array.isArray(b)) throw new Error('shallowArraysEqual only accepts arrays as parameters');\n if (a.length !== b.length) return false;\n for (var i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n};\n/**\n * Create a CancellablePromise from a native Promise\n * @param promise The promise object to wrap\n * @returns Return value is an object of type CancellablePromise, with 2 properties:\n * - promise: a promise that can be left pending\n * - cancel: the function to use for cancelling the returned promise\n */\nvar createCancellablePromise = function createCancellablePromise(promise) {\n if (!isThenable(promise)) {\n throw new Error('Argument of createCancellablePromise should be a Promise');\n }\n var isCancelled = {\n value: false\n };\n var wrappedPromise = new Promise(/*#__PURE__*/function () {\n var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(res, rej) {\n var d;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n _context.next = 3;\n return promise;\n case 3:\n d = _context.sent;\n if (!isCancelled.value) {\n res(d);\n }\n _context.next = 10;\n break;\n case 7:\n _context.prev = 7;\n _context.t0 = _context[\"catch\"](0);\n if (!isCancelled.value) {\n rej(_context.t0);\n }\n case 10:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[0, 7]]);\n }));\n return function (_x, _x2) {\n return _ref.apply(this, arguments);\n };\n }());\n // Forward potential additional properties\n Object.keys(promise).forEach(function (key) {\n wrappedPromise[key] = promise[key];\n });\n return {\n promise: wrappedPromise,\n cancel: function cancel() {\n isCancelled.value = true;\n }\n };\n};\n\n/**\n * Calls a function only once during component lifecycle;\n * When dependency array is provided, will call the function again if at least one of the dependencies changed\n * @param callback The function to execute only once\n * @param dependencies A list of dependencies whose value, if changed since last call,\n * will trigger the execution of the callback\n */\nvar useSingleton = function useSingleton(callback, dependencies) {\n if (dependencies === void 0) {\n dependencies = [];\n }\n var hasRan = useRef(false);\n var lastDependencies = useRef([]);\n // Parameters type check\n if (typeof callback !== 'function') {\n throw new Error(\"Incorrect callback parameter for useSingleton hook; expected a function, but got: '\" + typeof callback + \"'.\");\n }\n if (!Array.isArray(dependencies)) {\n throw new Error(\"Incorrect dependencies parameter for useSingleton; expected an array, but got: '\" + typeof dependencies + \"'.\");\n }\n var hasDependencies = Array.isArray(dependencies) && dependencies.length > 0;\n if (hasDependencies) {\n // Has dependencies\n var hasAnyDependencyChanged = !shallowArraysEqual(lastDependencies.current, dependencies);\n if (hasAnyDependencyChanged) {\n // Any dep has changed => overwrite last dependencies and execute callback\n lastDependencies.current = dependencies;\n } else if (hasRan.current) {\n // No dep has changed => same behaviour as if no dependencies\n return;\n }\n } else if (hasRan.current) {\n // No dependencies\n return;\n }\n callback();\n hasRan.current = true;\n};\n\n/**\n * Is included in the `<If />` component, rendered when the condition prop of `<If />` is a Promise;\n * Renders the Fallback component, if contains any, until provided promise is fulfilled;\n * Renders `<Then />` when promise is fulfilled, `<Else />` when rejected\n */\nfunction IfAsync(_ref) {\n var promise = _ref.promise,\n _ref$keepAlive = _ref.keepAlive,\n keepAlive = _ref$keepAlive === void 0 ? false : _ref$keepAlive,\n children = _ref.children;\n var _useState = useState(null),\n isResolved = _useState[0],\n setIsResolved = _useState[1];\n var _useState2 = useState(null),\n returnValue = _useState2[0],\n setReturnValue = _useState2[1];\n // Make promise cancellable\n var cancellablePromise = useMemo(function () {\n return createCancellablePromise(promise);\n }, [promise]);\n var history = useRef([]); // Keep history of promises\n // Handle unmount\n useEffect(function () {\n return function () {\n if (!keepAlive) {\n cancellablePromise.cancel();\n }\n };\n }, [cancellablePromise, cancellablePromise.promise, keepAlive]);\n // Await promise\n useSingleton(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var data;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n setIsResolved(null);\n setReturnValue(null);\n _context.prev = 2;\n _context.next = 5;\n return cancellablePromise.promise;\n case 5:\n data = _context.sent;\n setReturnValue(data);\n setIsResolved(true);\n history.current.push(cancellablePromise);\n _context.next = 16;\n break;\n case 11:\n _context.prev = 11;\n _context.t0 = _context[\"catch\"](2);\n setReturnValue(_context.t0);\n setIsResolved(false);\n history.current.push(cancellablePromise);\n case 16:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[2, 11]]);\n })), [cancellablePromise.promise]);\n if (!children || !isThenable(promise)) {\n return null;\n }\n if (isResolved === null) {\n // Promise is pending\n var hasFallback = React.Children.toArray(children).find(function (c) {\n return c.type === Fallback;\n });\n return React.createElement(Fragment, null, hasFallback || null);\n }\n if (!isResolved) {\n // Promise is fulfilled and rejected\n var hasElse = React.Children.toArray(children).find(function (c) {\n return c.type === Else;\n });\n if (!hasElse) return React.createElement(Fragment, null, null);\n // Inject caught error\n var elseElement = hasElse;\n var hasElseProps = hasElse.props;\n if (typeof hasElseProps.children === 'function') {\n elseElement = _extends({}, hasElse, {\n props: _extends({}, hasElseProps, {\n children: function children() {\n return hasElseProps.children(returnValue, history.current, cancellablePromise.promise);\n }\n })\n });\n }\n return React.createElement(Fragment, null, elseElement);\n }\n // Promise is fulfilled and resolved\n var hasThen = React.Children.toArray(children).find(function (c) {\n return c.type === Then;\n });\n if (!hasThen) return React.createElement(Fragment, null, null);\n // Inject promise return value\n var thenElement = hasThen;\n var hasThenProps = hasThen.props;\n if (typeof hasThenProps.children === 'function') {\n thenElement = _extends({}, hasThen, {\n props: _extends({}, hasThenProps, {\n children: function children() {\n return hasThenProps.children(returnValue, history.current, cancellablePromise.promise);\n }\n })\n });\n }\n return React.createElement(Fragment, null, thenElement);\n}\n\n/**\n * Resolves a condition that is {@link BooleanLike} or returns {@link BooleanLike} from a function\n * @param condition The condition to resolve\n */\nvar getConditionResult = function getConditionResult(condition) {\n var conditionResult = Boolean(typeof condition === 'function' ? condition() : condition);\n return conditionResult;\n};\n\n/**\n * Handles errors by throwing them to the console.\n * `__DEV__` is replaced by dts-cli using {@link https://www.npmjs.com/package/babel-plugin-dev-expression babel-plugin-dev-expressions}\n * which will ensure this entire throw is not present in production\n * @param condition The condition to check\n * @param message The message to throw if `condition` resolves to `true`\n */\nfunction tinyWarning(condition, message) {\n if (process.env.NODE_ENV !== \"production\") {\n if (condition) {\n // check console for IE9 support which provides console\n // only with open devtools\n if (typeof console !== 'undefined') {\n console.warn(message);\n }\n // Throwing an error and catching it immediately to improve debugging\n // Users can utilize 'pause on caught exceptions' to get into this throw\n try {\n throw new Error(message);\n } catch (x) {\n // noop\n }\n }\n }\n}\n\n/**\n * If condition evaluates to true, renders the `<Then />` block will be rendered,\n * otherwise renders the `<Else />` block. Either block may be omitted.\n *\n * This component can contain any number of `<Then />` or `<Else />` blocks,\n * but only the first block of the right type (either Then or Else, depending on the condition) will be rendered.\n * @param __namedParameters The props to pass down to the `<IF />` component, see {@link ComponentWithConditionProps}\n */\nvar If = function If(_ref) {\n var condition = _ref.condition,\n _ref$keepAlive = _ref.keepAlive,\n keepAlive = _ref$keepAlive === void 0 ? false : _ref$keepAlive,\n children = _ref.children;\n if (!children) {\n return null;\n }\n tinyWarning(!Array.isArray(children) && !(children.type === Else || children.type === Then) || !React__default.Children.toArray(children).every(function (child) {\n return child.type === Else || child.type === Then || child.type === Fallback;\n }), 'The <If> component should contain <Then /> <Else /> or <Fallback /> components as its children');\n if (isThenable(condition)) {\n return React__default.createElement(IfAsync, {\n promise: condition,\n keepAlive: keepAlive\n }, children);\n }\n var conditionResult = getConditionResult(condition);\n return React__default.createElement(Fragment, null, React__default.Children.toArray(children).find(function (c) {\n return c.type !== Else !== !conditionResult;\n }) || null);\n};\n\n/**\n * It will render the first matching `<Case />`, or the first encountered `<Default />` (or `null`).\n *\n * This component can contain any number of `<Case />` and one `<Default />` blocks\n * @param __namedParameters Children to pass into the `<Switch />` component\n */\nvar Switch = function Switch(_ref) {\n var _ref2;\n var children = _ref.children;\n // -- Inspired by react-router --\n // We use React.Children.forEach instead of React.Children.toArray().find()\n // here because toArray adds keys to all child elements and we do not want\n // to trigger an unmount/remount for two children <Case>s or <Default>s\n var matchingCase = undefined;\n var defaultCase = undefined;\n // If the children are a function then resolve it first\n if (isFunction(children)) {\n children = children();\n }\n React.Children.forEach(children, function (child) {\n // not a valid react child, don't add it\n /* istanbul ignore next - This is only a safe fail for people writing bad code */\n if (!React.isValidElement(child)) {\n return;\n }\n if (!matchingCase && child.type === Case) {\n var childProps = child.props;\n var conditionResult = getConditionResult(childProps.condition);\n if (conditionResult) {\n matchingCase = child;\n } // else not matching condition, don't add it\n } else if (!defaultCase && child.type === Default) {\n defaultCase = child;\n } // else unknown type, don't add it\n });\n return (_ref2 = matchingCase != null ? matchingCase : defaultCase) != null ? _ref2 : null;\n};\n\n/** A shorthand for\n *\n * ```jsx\n * <If condition={...}>\n * <Else>\n * { ... }\n * </Else>\n * </If>\n * ```\n *\n * The same rules apply to the child elements as with using the `<Else />` block.\n *\n * @param __namedParameters The props to pass down to the `<IF />` component, see {@link ComponentWithConditionProps}\n */\nvar Unless = function Unless(_ref) {\n var condition = _ref.condition,\n _ref$children = _ref.children,\n children = _ref$children === void 0 ? null : _ref$children;\n var conditionResult = Boolean(getConditionResult(condition));\n return !conditionResult && children ? render({\n children: children\n }) : null;\n};\n\n/** A shorthand for\n *\n * ```jsx\n * <If condition={...}>\n * <Then>\n * { ... }\n * </Then>\n * </If>\n * ```\n *\n * The same rules apply to the child elements as with using the `<Then /`> block.\n *\n * @param __namedParameters The props to pass down to the `<IF />` component, see {@link ComponentWithConditionProps}\n */\nvar When = function When(_ref) {\n var condition = _ref.condition,\n _ref$children = _ref.children,\n children = _ref$children === void 0 ? null : _ref$children;\n var conditionResult = Boolean(getConditionResult(condition));\n return conditionResult && children ? render({\n children: children\n }) : null;\n};\n\nexport { Case, Default, Else, Fallback, If, Switch, Then, Unless, When };\n//# sourceMappingURL=react-if.esm.js.map\n"],"names":["render","React__default","Case","Default","Else","Fallback","n","t","r","e","o","i","a","u","c","h","f","Then","shallowArraysEqual","createCancellablePromise","useSingleton","React","children","hasThen","getConditionResult","If","Switch"],"mappings":";;AAOA,IAAI,SAAS,SAASA,QAAO,OAAO;AAClC,MAAI,OAAO,MAAM,aAAa,YAAY;AACxC,WAAOC,sBAAe,cAAc,UAAU,MAAM,MAAM,SAAQ,CAAE;AAAA,EACrE;AACD,SAAOA,sBAAe,cAAc,UAAU,MAAM,MAAM,YAAY,IAAI;AAC5E;AAOG,IAAC,OAAO,SAASC,MAAK,MAAM;AAC7B,MAAI,gBAAgB,KAAK,UACvB,WAAW,kBAAkB,SAAS,OAAO;AAC/C,SAAO,OAAO;AAAA,IACZ;AAAA,EACJ,CAAG;AACH;AAOG,IAAC,UAAU,SAASC,SAAQ,MAAM;AACnC,MAAI,gBAAgB,KAAK,UACvB,WAAW,kBAAkB,SAAS,OAAO;AAC/C,SAAO,OAAO;AAAA,IACZ;AAAA,EACJ,CAAG;AACH;AAOA,IAAI,OAAO,SAASC,MAAK,OAAO;AAC9B,SAAO,OAAO,KAAK;AACrB;AAOA,IAAI,WAAW,SAASC,UAAS,OAAO;AACtC,SAAO,OAAO,KAAK;AACrB;AAEA,SAAS,mBAAmB,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG;AAC/C,MAAI;AACF,QAAI,IAAI,EAAE,CAAC,EAAE,CAAC,GACZ,IAAI,EAAE;AAAA,EACT,SAAQC,IAAG;AACV,WAAO,KAAK,EAAEA,EAAC;AAAA,EAChB;AACD,IAAE,OAAO,EAAE,CAAC,IAAI,QAAQ,QAAQ,CAAC,EAAE,KA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QAAQ;AAAA,EACZ;AACD,MAAI,kBAAkB,mBAAmB,SAAS;AAClD,SAAOA,sBAAe,cAAc,UAAU,MAAMA,sBAAe,SAAS,QAAQ,QAAQ,EAAE,KAAK,SAAU,GAAG;AAC9G,WAAO,EAAE,SAAS,SAAS,CAAC;AAAA,EAChC,CAAG,KAAK,IAAI;AACZ;AAQG,IAAC,SAAS,SAASyB,QAAO,MAAM;AACjC,MAAI;AACJ,MAAI,WAAW,KAAK;AAKpB,MAAI,eAAe;AACnB,MAAI,cAAc;AAElB,MAAI,WAAW,QAAQ,GAAG;AACxB,eAAW,SAAQ;AAAA,EACpB;AACDL,eAAM,SAAS,QAAQ,UAAU,SAAU,OAAO;AAGhD,QAAI,CAACA,aAAM,eAAe,KAAK,GAAG;AAChC;AAAA,IACD;AACD,QAAI,CAAC,gBAAgB,MAAM,SAAS,MAAM;AACxC,UAAI,aAAa,MAAM;AACvB,UAAI,kBAAkB,mBAAmB,WAAW,SAAS;AAC7D,UAAI,iBAAiB;AACnB,uBAAe;AAAA,MAChB;AAAA,IACF,WAAU,CAAC,eAAe,MAAM,SAAS,SAAS;AACjD,oBAAc;AAAA,IACf;AAAA,EACL,CAAG;AACD,UAAQ,QAAQ,gBAAgB,OAAO,eAAe,gBAAgB,OAAO,QAAQ;AACvF;","x_google_ignoreList":[0]}
|
package/package.json
CHANGED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import * as $dbSRa$react from "react";
|
|
2
|
-
import $dbSRa$react__default, { Fragment } from "react";
|
|
3
|
-
var render = function render2(props) {
|
|
4
|
-
if (typeof props.children === "function") {
|
|
5
|
-
return $dbSRa$react__default.createElement(Fragment, null, props.children());
|
|
6
|
-
}
|
|
7
|
-
return $dbSRa$react__default.createElement(Fragment, null, props.children || null);
|
|
8
|
-
};
|
|
9
|
-
var Case = function Case2(_ref) {
|
|
10
|
-
var _ref$children = _ref.children, children = _ref$children === void 0 ? null : _ref$children;
|
|
11
|
-
return render({
|
|
12
|
-
children
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
var Default = function Default2(_ref) {
|
|
16
|
-
var _ref$children = _ref.children, children = _ref$children === void 0 ? null : _ref$children;
|
|
17
|
-
return render({
|
|
18
|
-
children
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
function isFunction(input) {
|
|
22
|
-
return typeof input === "function";
|
|
23
|
-
}
|
|
24
|
-
var getConditionResult = function getConditionResult2(condition) {
|
|
25
|
-
var conditionResult = Boolean(typeof condition === "function" ? condition() : condition);
|
|
26
|
-
return conditionResult;
|
|
27
|
-
};
|
|
28
|
-
var Switch = function Switch2(_ref) {
|
|
29
|
-
var _ref2;
|
|
30
|
-
var children = _ref.children;
|
|
31
|
-
var matchingCase = void 0;
|
|
32
|
-
var defaultCase = void 0;
|
|
33
|
-
if (isFunction(children)) {
|
|
34
|
-
children = children();
|
|
35
|
-
}
|
|
36
|
-
$dbSRa$react.Children.forEach(children, function(child) {
|
|
37
|
-
if (!$dbSRa$react.isValidElement(child)) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (!matchingCase && child.type === Case) {
|
|
41
|
-
var childProps = child.props;
|
|
42
|
-
var conditionResult = getConditionResult(childProps.condition);
|
|
43
|
-
if (conditionResult) {
|
|
44
|
-
matchingCase = child;
|
|
45
|
-
}
|
|
46
|
-
} else if (!defaultCase && child.type === Default) {
|
|
47
|
-
defaultCase = child;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
return (_ref2 = matchingCase != null ? matchingCase : defaultCase) != null ? _ref2 : null;
|
|
51
|
-
};
|
|
52
|
-
var When = function When2(_ref) {
|
|
53
|
-
var condition = _ref.condition, _ref$children = _ref.children, children = _ref$children === void 0 ? null : _ref$children;
|
|
54
|
-
var conditionResult = Boolean(getConditionResult(condition));
|
|
55
|
-
return conditionResult && children ? render({
|
|
56
|
-
children
|
|
57
|
-
}) : null;
|
|
58
|
-
};
|
|
59
|
-
export {
|
|
60
|
-
Case as C,
|
|
61
|
-
Default as D,
|
|
62
|
-
Switch as S,
|
|
63
|
-
When as W
|
|
64
|
-
};
|
|
65
|
-
//# sourceMappingURL=react-if.esm-CGh0ofh0.js.map
|