@justeattakeaway/pie-lottie-player 0.0.2 → 0.0.3
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/index.js
CHANGED
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { query as
|
|
3
|
-
import { defineCustomElement as
|
|
4
|
-
const
|
|
1
|
+
import { LitElement as h, isServer as m, html as _, unsafeCSS as u } from "lit";
|
|
2
|
+
import { query as y, property as s } from "lit/decorators.js";
|
|
3
|
+
import { defineCustomElement as f } from "@justeattakeaway/pie-webc-core";
|
|
4
|
+
const v = ["forward", "reverse"], d = {
|
|
5
5
|
loopDisabled: !1,
|
|
6
6
|
autoPlayDisabled: !1,
|
|
7
7
|
speed: 1,
|
|
8
8
|
direction: "forward"
|
|
9
9
|
};
|
|
10
|
-
var
|
|
11
|
-
for (var i = o > 1 ? void 0 : o ?
|
|
12
|
-
(
|
|
13
|
-
return o && i &&
|
|
10
|
+
var D = Object.defineProperty, b = Object.getOwnPropertyDescriptor, n = (p, t, a, o) => {
|
|
11
|
+
for (var i = o > 1 ? void 0 : o ? b(t, a) : t, r = p.length - 1, l; r >= 0; r--)
|
|
12
|
+
(l = p[r]) && (i = (o ? l(t, a, i) : l(i)) || i);
|
|
13
|
+
return o && i && D(t, a, i), i;
|
|
14
14
|
};
|
|
15
|
-
const
|
|
16
|
-
class e extends h {
|
|
15
|
+
const I = "pie-lottie-player", c = class c extends h {
|
|
17
16
|
constructor() {
|
|
18
|
-
super(...arguments), this._animationSrc = "", this._autoPlayDisabled =
|
|
17
|
+
super(...arguments), this._animationSrc = "", this._autoPlayDisabled = d.autoPlayDisabled, this._loopDisabled = d.loopDisabled, this._speed = d.speed, this._direction = d.direction;
|
|
19
18
|
}
|
|
20
19
|
async firstUpdated() {
|
|
21
|
-
const t = await import("./lottie_light_canvas.min-
|
|
20
|
+
const t = await import("./lottie_light_canvas.min-C0TZgtte.js").then((a) => a.l);
|
|
22
21
|
t && t.default && (this._lottie = t.default, this._loadAnimation());
|
|
23
22
|
}
|
|
24
23
|
disconnectedCallback() {
|
|
25
24
|
super.disconnectedCallback(), this._destroyAnimation();
|
|
26
25
|
}
|
|
27
26
|
_loadAnimation() {
|
|
28
|
-
if (m || !this._hostElement || !this._lottie || (this._destroyAnimation(), !this.animationSrc && !this.animationData))
|
|
29
|
-
return;
|
|
27
|
+
if (m || !this._hostElement || !this._lottie || (this._destroyAnimation(), !this.animationSrc && !this.animationData)) return;
|
|
30
28
|
const t = window.matchMedia("(prefers-reduced-motion: reduce)").matches, a = t === !0 ? !t : !this.autoPlayDisabled;
|
|
31
29
|
try {
|
|
32
30
|
this._animationInstance = this._lottie.loadAnimation({
|
|
@@ -68,8 +66,7 @@ class e extends h {
|
|
|
68
66
|
return this._loopDisabled;
|
|
69
67
|
}
|
|
70
68
|
set loopDisabled(t) {
|
|
71
|
-
if (this._loopDisabled = t, !this._animationInstance)
|
|
72
|
-
return;
|
|
69
|
+
if (this._loopDisabled = t, !this._animationInstance) return;
|
|
73
70
|
this._animationInstance.loop = !t, this._loopDisabled === !1 && this._animationInstance.isPaused && this._animationInstance.isLoaded && this.play();
|
|
74
71
|
}
|
|
75
72
|
get speed() {
|
|
@@ -111,10 +108,11 @@ class e extends h {
|
|
|
111
108
|
return _`<div aria-hidden="true" data-test-id="pie-lottie-player"></div>`;
|
|
112
109
|
}
|
|
113
110
|
// Kept as empty to ensure it will be present during SSR testing
|
|
114
|
-
}
|
|
115
|
-
|
|
111
|
+
};
|
|
112
|
+
c.styles = u("");
|
|
113
|
+
let e = c;
|
|
116
114
|
n([
|
|
117
|
-
|
|
115
|
+
y("div")
|
|
118
116
|
], e.prototype, "_hostElement", 2);
|
|
119
117
|
n([
|
|
120
118
|
s({ type: String, reflect: !0 })
|
|
@@ -134,9 +132,9 @@ n([
|
|
|
134
132
|
n([
|
|
135
133
|
s({ type: String, reflect: !0 })
|
|
136
134
|
], e.prototype, "direction", 1);
|
|
137
|
-
|
|
135
|
+
f(I, e);
|
|
138
136
|
export {
|
|
139
137
|
e as PieLottiePlayer,
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
d as defaultProps,
|
|
139
|
+
v as directions
|
|
142
140
|
};
|