@douyinfe/semi-foundation 2.74.0 → 2.74.1-alpha.0

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.
@@ -13,21 +13,27 @@ class LottieFoundation extends _foundation.default {
13
13
  this.animation = null;
14
14
  this.handleParamsUpdate = () => {
15
15
  var _a;
16
- this.animation.destroy();
17
- this.animation = _lottieWeb.default.loadAnimation(this._adapter.getLoadParams());
18
- (_a = this.getProp("getAnimationInstance")) === null || _a === void 0 ? void 0 : _a(this.animation);
16
+ if (typeof document !== 'undefined') {
17
+ this.animation.destroy();
18
+ this.animation = _lottieWeb.default.loadAnimation(this._adapter.getLoadParams());
19
+ (_a = this.getProp('getAnimationInstance')) === null || _a === void 0 ? void 0 : _a(this.animation);
20
+ }
19
21
  };
20
22
  }
21
23
  init(lifecycle) {
22
24
  var _a, _b;
23
25
  super.init(lifecycle);
24
- this.animation = _lottieWeb.default.loadAnimation(this._adapter.getLoadParams());
25
- (_a = this.getProp("getAnimationInstance")) === null || _a === void 0 ? void 0 : _a(this.animation);
26
- (_b = this.getProp("getLottie")) === null || _b === void 0 ? void 0 : _b(LottieFoundation.getLottie());
26
+ if (typeof document !== 'undefined') {
27
+ this.animation = _lottieWeb.default.loadAnimation(this._adapter.getLoadParams());
28
+ (_a = this.getProp('getAnimationInstance')) === null || _a === void 0 ? void 0 : _a(this.animation);
29
+ (_b = this.getProp('getLottie')) === null || _b === void 0 ? void 0 : _b(LottieFoundation.getLottie());
30
+ }
27
31
  }
28
32
  destroy() {
29
33
  super.destroy();
30
- this.animation.destroy();
34
+ if (typeof document !== 'undefined') {
35
+ this.animation.destroy();
36
+ }
31
37
  }
32
38
  }
33
39
  LottieFoundation.getLottie = () => {
@@ -6,21 +6,27 @@ class LottieFoundation extends BaseFoundation {
6
6
  this.animation = null;
7
7
  this.handleParamsUpdate = () => {
8
8
  var _a;
9
- this.animation.destroy();
10
- this.animation = lottie.loadAnimation(this._adapter.getLoadParams());
11
- (_a = this.getProp("getAnimationInstance")) === null || _a === void 0 ? void 0 : _a(this.animation);
9
+ if (typeof document !== 'undefined') {
10
+ this.animation.destroy();
11
+ this.animation = lottie.loadAnimation(this._adapter.getLoadParams());
12
+ (_a = this.getProp('getAnimationInstance')) === null || _a === void 0 ? void 0 : _a(this.animation);
13
+ }
12
14
  };
13
15
  }
14
16
  init(lifecycle) {
15
17
  var _a, _b;
16
18
  super.init(lifecycle);
17
- this.animation = lottie.loadAnimation(this._adapter.getLoadParams());
18
- (_a = this.getProp("getAnimationInstance")) === null || _a === void 0 ? void 0 : _a(this.animation);
19
- (_b = this.getProp("getLottie")) === null || _b === void 0 ? void 0 : _b(LottieFoundation.getLottie());
19
+ if (typeof document !== 'undefined') {
20
+ this.animation = lottie.loadAnimation(this._adapter.getLoadParams());
21
+ (_a = this.getProp('getAnimationInstance')) === null || _a === void 0 ? void 0 : _a(this.animation);
22
+ (_b = this.getProp('getLottie')) === null || _b === void 0 ? void 0 : _b(LottieFoundation.getLottie());
23
+ }
20
24
  }
21
25
  destroy() {
22
26
  super.destroy();
23
- this.animation.destroy();
27
+ if (typeof document !== 'undefined') {
28
+ this.animation.destroy();
29
+ }
24
30
  }
25
31
  }
26
32
  LottieFoundation.getLottie = () => {
@@ -28,28 +28,34 @@ class LottieFoundation <P = Record<string, any>, S = Record<string, any>> extend
28
28
  constructor(adapter: LottieAdapter<P, S>) {
29
29
  super({ ...LottieFoundation.defaultAdapter, ...adapter });
30
30
  }
31
+
31
32
 
32
-
33
- static getLottie = ()=>{
33
+ static getLottie = () => {
34
34
  return lottie;
35
- }
35
+ };
36
36
 
37
37
  init(lifecycle?: any) {
38
38
  super.init(lifecycle);
39
- this.animation = lottie.loadAnimation(this._adapter.getLoadParams());
40
- this.getProp("getAnimationInstance")?.(this.animation);
41
- this.getProp("getLottie")?.(LottieFoundation.getLottie());
39
+ if (typeof document !== 'undefined') {
40
+ this.animation = lottie.loadAnimation(this._adapter.getLoadParams());
41
+ this.getProp('getAnimationInstance')?.(this.animation);
42
+ this.getProp('getLottie')?.(LottieFoundation.getLottie());
43
+ }
42
44
  }
43
45
 
44
- handleParamsUpdate = ()=>{
45
- this.animation.destroy();
46
- this.animation = lottie.loadAnimation(this._adapter.getLoadParams());
47
- this.getProp("getAnimationInstance")?.(this.animation);
48
- }
46
+ handleParamsUpdate = () => {
47
+ if (typeof document !== 'undefined') {
48
+ this.animation.destroy();
49
+ this.animation = lottie.loadAnimation(this._adapter.getLoadParams());
50
+ this.getProp('getAnimationInstance')?.(this.animation);
51
+ }
52
+ };
49
53
 
50
54
  destroy() {
51
55
  super.destroy();
52
- this.animation.destroy();
56
+ if (typeof document !== 'undefined') {
57
+ this.animation.destroy();
58
+ }
53
59
  }
54
60
 
55
61
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.74.0",
3
+ "version": "2.74.1-alpha.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
@@ -29,7 +29,7 @@
29
29
  "*.scss",
30
30
  "*.css"
31
31
  ],
32
- "gitHead": "f88ca5423473b6b4a44751396ceda02b6e6bf7d5",
32
+ "gitHead": "3f33747ec592ea1446bc0f059f38ed274d6772f3",
33
33
  "devDependencies": {
34
34
  "@babel/plugin-transform-runtime": "^7.15.8",
35
35
  "@babel/preset-env": "^7.15.8",