@plasmicpkgs/lottie-react 0.0.167 → 0.0.168
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/Lottie.d.ts +10 -4
- package/dist/lottie-react.cjs.development.js +486 -20
- package/dist/lottie-react.cjs.development.js.map +1 -1
- package/dist/lottie-react.cjs.production.min.js +1 -1
- package/dist/lottie-react.cjs.production.min.js.map +1 -1
- package/dist/lottie-react.esm.js +486 -20
- package/dist/lottie-react.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/Lottie.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ComponentMeta } from "@plasmicapp/host";
|
|
2
1
|
import registerComponent from "@plasmicapp/host/registerComponent";
|
|
3
2
|
import React from "react";
|
|
4
3
|
export declare const CheckExample: {
|
|
@@ -571,15 +570,22 @@ export declare const CheckExample: {
|
|
|
571
570
|
bm: number;
|
|
572
571
|
})[];
|
|
573
572
|
};
|
|
574
|
-
|
|
573
|
+
interface CommonLottieWrapperProps {
|
|
575
574
|
className?: string;
|
|
576
575
|
animationData?: {};
|
|
577
576
|
loop?: boolean;
|
|
578
577
|
autoplay?: boolean;
|
|
579
578
|
preview?: boolean;
|
|
580
579
|
}
|
|
580
|
+
export interface LottieWrapperProps extends CommonLottieWrapperProps {
|
|
581
|
+
animationData?: {};
|
|
582
|
+
}
|
|
583
|
+
export interface AsyncLottieWrapperProps extends CommonLottieWrapperProps {
|
|
584
|
+
animationUrl?: string;
|
|
585
|
+
}
|
|
581
586
|
export declare function LottieWrapper({ className, animationData, loop, autoplay, preview, }: LottieWrapperProps): React.JSX.Element;
|
|
582
|
-
export declare
|
|
587
|
+
export declare function AsyncLottieWrapper({ className, animationUrl, loop, autoplay, preview, }: AsyncLottieWrapperProps): React.JSX.Element;
|
|
583
588
|
export declare function registerLottieWrapper(loader?: {
|
|
584
589
|
registerComponent: typeof registerComponent;
|
|
585
|
-
}
|
|
590
|
+
}): void;
|
|
591
|
+
export {};
|
|
@@ -10,6 +10,352 @@ var Lottie = _interopDefault(require('lottie-react'));
|
|
|
10
10
|
var React = require('react');
|
|
11
11
|
var React__default = _interopDefault(React);
|
|
12
12
|
|
|
13
|
+
function _regeneratorRuntime() {
|
|
14
|
+
_regeneratorRuntime = function () {
|
|
15
|
+
return e;
|
|
16
|
+
};
|
|
17
|
+
var t,
|
|
18
|
+
e = {},
|
|
19
|
+
r = Object.prototype,
|
|
20
|
+
n = r.hasOwnProperty,
|
|
21
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
22
|
+
t[e] = r.value;
|
|
23
|
+
},
|
|
24
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
25
|
+
a = i.iterator || "@@iterator",
|
|
26
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
27
|
+
u = i.toStringTag || "@@toStringTag";
|
|
28
|
+
function define(t, e, r) {
|
|
29
|
+
return Object.defineProperty(t, e, {
|
|
30
|
+
value: r,
|
|
31
|
+
enumerable: !0,
|
|
32
|
+
configurable: !0,
|
|
33
|
+
writable: !0
|
|
34
|
+
}), t[e];
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
define({}, "");
|
|
38
|
+
} catch (t) {
|
|
39
|
+
define = function (t, e, r) {
|
|
40
|
+
return t[e] = r;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function wrap(t, e, r, n) {
|
|
44
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
45
|
+
a = Object.create(i.prototype),
|
|
46
|
+
c = new Context(n || []);
|
|
47
|
+
return o(a, "_invoke", {
|
|
48
|
+
value: makeInvokeMethod(t, r, c)
|
|
49
|
+
}), a;
|
|
50
|
+
}
|
|
51
|
+
function tryCatch(t, e, r) {
|
|
52
|
+
try {
|
|
53
|
+
return {
|
|
54
|
+
type: "normal",
|
|
55
|
+
arg: t.call(e, r)
|
|
56
|
+
};
|
|
57
|
+
} catch (t) {
|
|
58
|
+
return {
|
|
59
|
+
type: "throw",
|
|
60
|
+
arg: t
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
e.wrap = wrap;
|
|
65
|
+
var h = "suspendedStart",
|
|
66
|
+
l = "suspendedYield",
|
|
67
|
+
f = "executing",
|
|
68
|
+
s = "completed",
|
|
69
|
+
y = {};
|
|
70
|
+
function Generator() {}
|
|
71
|
+
function GeneratorFunction() {}
|
|
72
|
+
function GeneratorFunctionPrototype() {}
|
|
73
|
+
var p = {};
|
|
74
|
+
define(p, a, function () {
|
|
75
|
+
return this;
|
|
76
|
+
});
|
|
77
|
+
var d = Object.getPrototypeOf,
|
|
78
|
+
v = d && d(d(values([])));
|
|
79
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
80
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
81
|
+
function defineIteratorMethods(t) {
|
|
82
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
83
|
+
define(t, e, function (t) {
|
|
84
|
+
return this._invoke(e, t);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function AsyncIterator(t, e) {
|
|
89
|
+
function invoke(r, o, i, a) {
|
|
90
|
+
var c = tryCatch(t[r], t, o);
|
|
91
|
+
if ("throw" !== c.type) {
|
|
92
|
+
var u = c.arg,
|
|
93
|
+
h = u.value;
|
|
94
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
95
|
+
invoke("next", t, i, a);
|
|
96
|
+
}, function (t) {
|
|
97
|
+
invoke("throw", t, i, a);
|
|
98
|
+
}) : e.resolve(h).then(function (t) {
|
|
99
|
+
u.value = t, i(u);
|
|
100
|
+
}, function (t) {
|
|
101
|
+
return invoke("throw", t, i, a);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
a(c.arg);
|
|
105
|
+
}
|
|
106
|
+
var r;
|
|
107
|
+
o(this, "_invoke", {
|
|
108
|
+
value: function (t, n) {
|
|
109
|
+
function callInvokeWithMethodAndArg() {
|
|
110
|
+
return new e(function (e, r) {
|
|
111
|
+
invoke(t, n, e, r);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function makeInvokeMethod(e, r, n) {
|
|
119
|
+
var o = h;
|
|
120
|
+
return function (i, a) {
|
|
121
|
+
if (o === f) throw new Error("Generator is already running");
|
|
122
|
+
if (o === s) {
|
|
123
|
+
if ("throw" === i) throw a;
|
|
124
|
+
return {
|
|
125
|
+
value: t,
|
|
126
|
+
done: !0
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
for (n.method = i, n.arg = a;;) {
|
|
130
|
+
var c = n.delegate;
|
|
131
|
+
if (c) {
|
|
132
|
+
var u = maybeInvokeDelegate(c, n);
|
|
133
|
+
if (u) {
|
|
134
|
+
if (u === y) continue;
|
|
135
|
+
return u;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
139
|
+
if (o === h) throw o = s, n.arg;
|
|
140
|
+
n.dispatchException(n.arg);
|
|
141
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
142
|
+
o = f;
|
|
143
|
+
var p = tryCatch(e, r, n);
|
|
144
|
+
if ("normal" === p.type) {
|
|
145
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
146
|
+
return {
|
|
147
|
+
value: p.arg,
|
|
148
|
+
done: n.done
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function maybeInvokeDelegate(e, r) {
|
|
156
|
+
var n = r.method,
|
|
157
|
+
o = e.iterator[n];
|
|
158
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
159
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
160
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
161
|
+
var a = i.arg;
|
|
162
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
163
|
+
}
|
|
164
|
+
function pushTryEntry(t) {
|
|
165
|
+
var e = {
|
|
166
|
+
tryLoc: t[0]
|
|
167
|
+
};
|
|
168
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
169
|
+
}
|
|
170
|
+
function resetTryEntry(t) {
|
|
171
|
+
var e = t.completion || {};
|
|
172
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
173
|
+
}
|
|
174
|
+
function Context(t) {
|
|
175
|
+
this.tryEntries = [{
|
|
176
|
+
tryLoc: "root"
|
|
177
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
178
|
+
}
|
|
179
|
+
function values(e) {
|
|
180
|
+
if (e || "" === e) {
|
|
181
|
+
var r = e[a];
|
|
182
|
+
if (r) return r.call(e);
|
|
183
|
+
if ("function" == typeof e.next) return e;
|
|
184
|
+
if (!isNaN(e.length)) {
|
|
185
|
+
var o = -1,
|
|
186
|
+
i = function next() {
|
|
187
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
188
|
+
return next.value = t, next.done = !0, next;
|
|
189
|
+
};
|
|
190
|
+
return i.next = i;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
194
|
+
}
|
|
195
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
196
|
+
value: GeneratorFunctionPrototype,
|
|
197
|
+
configurable: !0
|
|
198
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
199
|
+
value: GeneratorFunction,
|
|
200
|
+
configurable: !0
|
|
201
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
202
|
+
var e = "function" == typeof t && t.constructor;
|
|
203
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
204
|
+
}, e.mark = function (t) {
|
|
205
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
206
|
+
}, e.awrap = function (t) {
|
|
207
|
+
return {
|
|
208
|
+
__await: t
|
|
209
|
+
};
|
|
210
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
211
|
+
return this;
|
|
212
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
213
|
+
void 0 === i && (i = Promise);
|
|
214
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
215
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
216
|
+
return t.done ? t.value : a.next();
|
|
217
|
+
});
|
|
218
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
219
|
+
return this;
|
|
220
|
+
}), define(g, "toString", function () {
|
|
221
|
+
return "[object Generator]";
|
|
222
|
+
}), e.keys = function (t) {
|
|
223
|
+
var e = Object(t),
|
|
224
|
+
r = [];
|
|
225
|
+
for (var n in e) r.push(n);
|
|
226
|
+
return r.reverse(), function next() {
|
|
227
|
+
for (; r.length;) {
|
|
228
|
+
var t = r.pop();
|
|
229
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
230
|
+
}
|
|
231
|
+
return next.done = !0, next;
|
|
232
|
+
};
|
|
233
|
+
}, e.values = values, Context.prototype = {
|
|
234
|
+
constructor: Context,
|
|
235
|
+
reset: function (e) {
|
|
236
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
237
|
+
},
|
|
238
|
+
stop: function () {
|
|
239
|
+
this.done = !0;
|
|
240
|
+
var t = this.tryEntries[0].completion;
|
|
241
|
+
if ("throw" === t.type) throw t.arg;
|
|
242
|
+
return this.rval;
|
|
243
|
+
},
|
|
244
|
+
dispatchException: function (e) {
|
|
245
|
+
if (this.done) throw e;
|
|
246
|
+
var r = this;
|
|
247
|
+
function handle(n, o) {
|
|
248
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
249
|
+
}
|
|
250
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
251
|
+
var i = this.tryEntries[o],
|
|
252
|
+
a = i.completion;
|
|
253
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
254
|
+
if (i.tryLoc <= this.prev) {
|
|
255
|
+
var c = n.call(i, "catchLoc"),
|
|
256
|
+
u = n.call(i, "finallyLoc");
|
|
257
|
+
if (c && u) {
|
|
258
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
259
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
260
|
+
} else if (c) {
|
|
261
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
262
|
+
} else {
|
|
263
|
+
if (!u) throw new Error("try statement without catch or finally");
|
|
264
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
abrupt: function (t, e) {
|
|
270
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
271
|
+
var o = this.tryEntries[r];
|
|
272
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
273
|
+
var i = o;
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
278
|
+
var a = i ? i.completion : {};
|
|
279
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
280
|
+
},
|
|
281
|
+
complete: function (t, e) {
|
|
282
|
+
if ("throw" === t.type) throw t.arg;
|
|
283
|
+
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 && e && (this.next = e), y;
|
|
284
|
+
},
|
|
285
|
+
finish: function (t) {
|
|
286
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
287
|
+
var r = this.tryEntries[e];
|
|
288
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
catch: function (t) {
|
|
292
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
293
|
+
var r = this.tryEntries[e];
|
|
294
|
+
if (r.tryLoc === t) {
|
|
295
|
+
var n = r.completion;
|
|
296
|
+
if ("throw" === n.type) {
|
|
297
|
+
var o = n.arg;
|
|
298
|
+
resetTryEntry(r);
|
|
299
|
+
}
|
|
300
|
+
return o;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
throw new Error("illegal catch attempt");
|
|
304
|
+
},
|
|
305
|
+
delegateYield: function (e, r, n) {
|
|
306
|
+
return this.delegate = {
|
|
307
|
+
iterator: values(e),
|
|
308
|
+
resultName: r,
|
|
309
|
+
nextLoc: n
|
|
310
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
311
|
+
}
|
|
312
|
+
}, e;
|
|
313
|
+
}
|
|
314
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
315
|
+
try {
|
|
316
|
+
var info = gen[key](arg);
|
|
317
|
+
var value = info.value;
|
|
318
|
+
} catch (error) {
|
|
319
|
+
reject(error);
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
if (info.done) {
|
|
323
|
+
resolve(value);
|
|
324
|
+
} else {
|
|
325
|
+
Promise.resolve(value).then(_next, _throw);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
function _asyncToGenerator(fn) {
|
|
329
|
+
return function () {
|
|
330
|
+
var self = this,
|
|
331
|
+
args = arguments;
|
|
332
|
+
return new Promise(function (resolve, reject) {
|
|
333
|
+
var gen = fn.apply(self, args);
|
|
334
|
+
function _next(value) {
|
|
335
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
336
|
+
}
|
|
337
|
+
function _throw(err) {
|
|
338
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
339
|
+
}
|
|
340
|
+
_next(undefined);
|
|
341
|
+
});
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
function _extends() {
|
|
345
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
346
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
347
|
+
var source = arguments[i];
|
|
348
|
+
for (var key in source) {
|
|
349
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
350
|
+
target[key] = source[key];
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
return target;
|
|
355
|
+
};
|
|
356
|
+
return _extends.apply(this, arguments);
|
|
357
|
+
}
|
|
358
|
+
|
|
13
359
|
var CheckExample = {
|
|
14
360
|
v: "4.10.1",
|
|
15
361
|
fr: 30,
|
|
@@ -621,17 +967,111 @@ function LottieWrapper(_ref) {
|
|
|
621
967
|
autoplay: inEditor ? preview : autoplay
|
|
622
968
|
});
|
|
623
969
|
}
|
|
624
|
-
var
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
970
|
+
var PROMISE_CACHE = {};
|
|
971
|
+
var DATA_CACHE = {};
|
|
972
|
+
function fetchAnimationData(_x) {
|
|
973
|
+
return _fetchAnimationData.apply(this, arguments);
|
|
974
|
+
}
|
|
975
|
+
function _fetchAnimationData() {
|
|
976
|
+
_fetchAnimationData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(url) {
|
|
977
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
978
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
979
|
+
case 0:
|
|
980
|
+
if (!(url in DATA_CACHE)) {
|
|
981
|
+
_context2.next = 4;
|
|
982
|
+
break;
|
|
983
|
+
}
|
|
984
|
+
return _context2.abrupt("return", DATA_CACHE[url]);
|
|
985
|
+
case 4:
|
|
986
|
+
if (!(url in PROMISE_CACHE)) {
|
|
987
|
+
_context2.next = 8;
|
|
988
|
+
break;
|
|
989
|
+
}
|
|
990
|
+
return _context2.abrupt("return", PROMISE_CACHE[url]);
|
|
991
|
+
case 8:
|
|
992
|
+
PROMISE_CACHE[url] = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
993
|
+
var resp, json;
|
|
994
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
995
|
+
while (1) switch (_context.prev = _context.next) {
|
|
996
|
+
case 0:
|
|
997
|
+
_context.next = 2;
|
|
998
|
+
return fetch(url);
|
|
999
|
+
case 2:
|
|
1000
|
+
resp = _context.sent;
|
|
1001
|
+
if (resp.ok) {
|
|
1002
|
+
_context.next = 5;
|
|
1003
|
+
break;
|
|
1004
|
+
}
|
|
1005
|
+
throw new Error("Error downloading Lottie animation from " + url + ": " + resp.statusText);
|
|
1006
|
+
case 5:
|
|
1007
|
+
_context.next = 7;
|
|
1008
|
+
return resp.json();
|
|
1009
|
+
case 7:
|
|
1010
|
+
json = _context.sent;
|
|
1011
|
+
// Only delete from PROMISE_CACHE upon success
|
|
1012
|
+
delete PROMISE_CACHE[url];
|
|
1013
|
+
return _context.abrupt("return", json);
|
|
1014
|
+
case 10:
|
|
1015
|
+
case "end":
|
|
1016
|
+
return _context.stop();
|
|
1017
|
+
}
|
|
1018
|
+
}, _callee);
|
|
1019
|
+
}))();
|
|
1020
|
+
return _context2.abrupt("return", PROMISE_CACHE[url]);
|
|
1021
|
+
case 10:
|
|
1022
|
+
case "end":
|
|
1023
|
+
return _context2.stop();
|
|
1024
|
+
}
|
|
1025
|
+
}, _callee2);
|
|
1026
|
+
}));
|
|
1027
|
+
return _fetchAnimationData.apply(this, arguments);
|
|
1028
|
+
}
|
|
1029
|
+
function AsyncLottieWrapper(_ref2) {
|
|
1030
|
+
var className = _ref2.className,
|
|
1031
|
+
animationUrl = _ref2.animationUrl,
|
|
1032
|
+
_ref2$loop = _ref2.loop,
|
|
1033
|
+
loop = _ref2$loop === void 0 ? true : _ref2$loop,
|
|
1034
|
+
_ref2$autoplay = _ref2.autoplay,
|
|
1035
|
+
autoplay = _ref2$autoplay === void 0 ? true : _ref2$autoplay,
|
|
1036
|
+
_ref2$preview = _ref2.preview,
|
|
1037
|
+
preview = _ref2$preview === void 0 ? false : _ref2$preview;
|
|
1038
|
+
var inEditor = React.useContext(host.PlasmicCanvasContext);
|
|
1039
|
+
var _React$useState = React__default.useState(animationUrl ? DATA_CACHE[animationUrl] : undefined),
|
|
1040
|
+
data = _React$useState[0],
|
|
1041
|
+
setData = _React$useState[1];
|
|
1042
|
+
var _React$useState2 = React__default.useState(undefined),
|
|
1043
|
+
error = _React$useState2[0],
|
|
1044
|
+
setError = _React$useState2[1];
|
|
1045
|
+
React__default.useEffect(function () {
|
|
1046
|
+
if (animationUrl) {
|
|
1047
|
+
fetchAnimationData(animationUrl).then(function (res) {
|
|
1048
|
+
setData(res);
|
|
1049
|
+
}, function (err) {
|
|
1050
|
+
setError(err);
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
}, [animationUrl]);
|
|
1054
|
+
if (!animationUrl) {
|
|
1055
|
+
throw new Error("animationUrl is required");
|
|
1056
|
+
}
|
|
1057
|
+
if (error) {
|
|
1058
|
+
throw error;
|
|
1059
|
+
}
|
|
1060
|
+
if (!data) {
|
|
1061
|
+
return React__default.createElement("div", {
|
|
1062
|
+
className: className
|
|
1063
|
+
});
|
|
1064
|
+
} else {
|
|
1065
|
+
return React__default.createElement(Lottie, {
|
|
1066
|
+
className: className,
|
|
1067
|
+
animationData: data,
|
|
1068
|
+
loop: loop,
|
|
1069
|
+
autoplay: inEditor ? preview : autoplay
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
function registerLottieWrapper(loader) {
|
|
1074
|
+
var commonProps = {
|
|
635
1075
|
loop: {
|
|
636
1076
|
type: "boolean",
|
|
637
1077
|
description: "Whether to loop the animation",
|
|
@@ -647,18 +1087,44 @@ var lottieWrapper = {
|
|
|
647
1087
|
description: "Whether to preview the animation in the editor",
|
|
648
1088
|
defaultValueHint: false
|
|
649
1089
|
}
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
}
|
|
1090
|
+
};
|
|
1091
|
+
var register = function register(component, meta) {
|
|
1092
|
+
if (loader) {
|
|
1093
|
+
loader.registerComponent(component, meta);
|
|
1094
|
+
} else {
|
|
1095
|
+
registerComponent(component, meta);
|
|
1096
|
+
}
|
|
1097
|
+
};
|
|
1098
|
+
register(LottieWrapper, {
|
|
1099
|
+
name: "hostless-lottie-react",
|
|
1100
|
+
displayName: "Lottie",
|
|
1101
|
+
importName: "LottieWrapper",
|
|
1102
|
+
importPath: "@plasmicpkgs/lottie-react",
|
|
1103
|
+
props: _extends({
|
|
1104
|
+
animationData: {
|
|
1105
|
+
type: "object",
|
|
1106
|
+
description: "The animation JSON data",
|
|
1107
|
+
defaultValue: CheckExample
|
|
1108
|
+
}
|
|
1109
|
+
}, commonProps)
|
|
1110
|
+
});
|
|
1111
|
+
register(AsyncLottieWrapper, {
|
|
1112
|
+
name: "hostless-lottie-async-react",
|
|
1113
|
+
displayName: "Lottie Async",
|
|
1114
|
+
importName: "AsyncLottieWrapper",
|
|
1115
|
+
importPath: "@plasmicpkgs/lottie-react",
|
|
1116
|
+
props: _extends({
|
|
1117
|
+
animationUrl: {
|
|
1118
|
+
displayName: "Animation URL",
|
|
1119
|
+
type: "string",
|
|
1120
|
+
description: "URL from which to download Lottie JSON data"
|
|
1121
|
+
}
|
|
1122
|
+
}, commonProps)
|
|
1123
|
+
});
|
|
658
1124
|
}
|
|
659
1125
|
|
|
1126
|
+
exports.AsyncLottieWrapper = AsyncLottieWrapper;
|
|
660
1127
|
exports.CheckExample = CheckExample;
|
|
661
1128
|
exports.LottieWrapper = LottieWrapper;
|
|
662
|
-
exports.lottieWrapper = lottieWrapper;
|
|
663
1129
|
exports.registerLottieWrapper = registerLottieWrapper;
|
|
664
1130
|
//# sourceMappingURL=lottie-react.cjs.development.js.map
|